HasBuff function in the simulator is one of the most used when creating rotations. The short description on the function itself:
“True if the current actor, player, hostile target, or friendly target has the specified buff/debuff.”
Here is some more detail about how this function works – it is meant to be pretty “smart” so that it is simple and convenient to use.
1. Buff Type Matters
Every buff effect in the game falls into three main categories:
- A “normal” buff – it only works and can be cast on yourself (the “player” in the simulator, aka you)
- A “debuff” – a buff that you place on an enemy target, usually with a negative effect
- An “ally buff” – a buff that the actor/you casts on another ally, usually with a positive effect
Most buffs are “normal” buffs. A “debuff” or an “ally buff” will have a flag indicating as such on the spell wiki, e.g.
Beacon of Faith – has an ally buff effect
Judgment of Light – has a debuff effect
Note on ally buffs: most “ally buffs” can also be cast on yourself as well, and any searches for buffs on allies will always check yourself too.
Note 2: the game itself calls these “auras” instead of “buffs”.
HasBuff will return true if any of the following are true:
- Is the spell a normal buff and active on the player?
- Is the spell a debuff and active on the current enemy target?
- Is the spell an ally buff and active on the current ally target?
It does not matter which “actor” applied the buff, e.g. in some rarer cases a pet can apply a buff to the player or a debuff to a target. That will get picked up.
3. Notes on Targeting
At any moment in the simulator, the player has a current enemy target and a current ally target.
The enemy target is determined by the targeting logic in the rotation. If no logic is present, it is determined by the kill order in the boss script.
The ally target is usually determined right on the action itself in the rotation. There are several properties that let you specify which ally targets on which to use an action. For example, you might say to cast a heal spell on any Tank or Melee target with a
HasBuff condition on your action. In that case, your condition will be checked against every present Tank or Melee ally target. The order in which it searches can also be controlled by certain properties on the action in your rotation.