fix(Scripts/SethekkHalls): Update Talon King Ikiss script (#15098)

This commit is contained in:
Skjalf
2023-02-18 17:26:52 -03:00
committed by GitHub
parent e759ac3c71
commit c2208318ea
6 changed files with 279 additions and 323 deletions

View File

@@ -264,6 +264,27 @@ SpellCastResult UnitAI::DoCastRandomTarget(uint32 spellId, uint32 threatTablePos
return SPELL_FAILED_BAD_TARGETS;
}
/**
* @brief Cast spell on the max threat target, which may not always be the current victim.
*
* @param uint32 spellId Spell ID to cast.
* @param uint32 Threat table position.
* @param float dist Distance from caster to target.
* @param bool playerOnly Select players only, excludes pets and other npcs.
* @param bool triggered Triggered cast (full triggered mask).
*
* @return SpellCastResult
*/
SpellCastResult UnitAI::DoCastMaxThreat(uint32 spellId, uint32 threatTablePosition, float dist, bool playerOnly, bool triggered)
{
if (Unit* target = SelectTarget(SelectTargetMethod::MaxThreat, threatTablePosition, dist, playerOnly))
{
return DoCast(target, spellId, triggered);
}
return SPELL_FAILED_BAD_TARGETS;
}
#define UPDATE_TARGET(a) {if (AIInfo->target<a) AIInfo->target=a;}
void UnitAI::FillAISpellInfo()

View File

@@ -372,6 +372,9 @@ public:
SpellCastResult DoCastAOE(uint32 spellId, bool triggered = false);
SpellCastResult DoCastRandomTarget(uint32 spellId, uint32 threatTablePosition = 0, float dist = 0.0f, bool playerOnly = true, bool triggered = false);
// Cast spell on the top threat target, which may not be the current victim.
SpellCastResult DoCastMaxThreat(uint32 spellId, uint32 threatTablePosition = 0, float dist = 0.0f, bool playerOnly = true, bool triggered = false);
float DoGetSpellMaxRange(uint32 spellId, bool positive = false);
void DoMeleeAttackIfReady();