diff options
author | Andrew <47818697+Nyeriah@users.noreply.github.com> | 2024-11-10 14:55:04 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-10 14:55:04 -0300 |
commit | 8e05cd7e8096d4254c337d808802259c09050b26 (patch) | |
tree | 72dd74d5f8040e0a831875f3c7a34a9987398d23 /src | |
parent | 91b8cc29cfa2652f84a780998ad82e37b950934c (diff) |
refactor(Scripts/ZulAman): Move Spirit of the Lynx to SAI (#20498)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp | 99 |
1 files changed, 14 insertions, 85 deletions
diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index 46efc1da6b..4524cd4a73 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -74,6 +74,11 @@ enum Groups GROUP_MERGE = 2 }; +enum Actions +{ + ACTION_MERGE = 0 +}; + struct boss_halazzi : public BossAI { boss_halazzi(Creature* creature) : BossAI(creature, DATA_HALAZZI) @@ -118,33 +123,19 @@ struct boss_halazzi : public BossAI void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) override { if (damage >= me->GetHealth() && _phase != PHASE_ENRAGE) - { damage = 0; - } else { if (_phase == PHASE_LYNX || _phase == PHASE_ENRAGE) { _healthCheckPercentage = 25 * (3 - _transformCount); if (!HealthAbovePct(_healthCheckPercentage)) - { EnterPhase(PHASE_SPLIT); - } } else if (_phase == PHASE_HUMAN) { - if (Creature* lynx = instance->GetCreature(DATA_SPIRIT_LYNX)) - { - if (!HealthAbovePct(20) || !lynx->HealthAbovePct(20)) - { - EnterPhase(PHASE_MERGE); - } - } - else - { - //should not really happen - EnterEvadeMode(); - } + if (!HealthAbovePct(20)) + EnterPhase(PHASE_MERGE); } } } @@ -152,17 +143,13 @@ struct boss_halazzi : public BossAI void SpellHit(Unit*, SpellInfo const* spell) override { if (spell->Id == SPELL_TRANSFORM_SPLIT2) - { EnterPhase(PHASE_HUMAN); - } } void AttackStart(Unit* who) override { if (_phase != PHASE_MERGE) - { BossAI::AttackStart(who); - } } void EnterPhase(PhaseHalazzi nextPhase) @@ -175,7 +162,7 @@ struct boss_halazzi : public BossAI { DoCastSelf(SPELL_TRANSFORM_MERGE, true); me->RemoveAurasDueToSpell(SPELL_TRANSFORM_SPLIT2); - me->GetMotionMaster()->MoveChase(me->GetVictim()); + me->ResumeChasingVictim(); } summons.DespawnAll(); me->SetMaxHealth(_lynxFormHealth); @@ -207,13 +194,9 @@ struct boss_halazzi : public BossAI if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0)) { if (target->IsNonMeleeSpellCast(false)) - { DoCast(target, SPELL_EARTHSHOCK); - } else - { DoCast(target, SPELL_FLAMESHOCK); - } } context.Repeat(10s, 15s); }).Schedule(12s, GROUP_HUMAN, [this](TaskContext context) @@ -236,19 +219,13 @@ struct boss_halazzi : public BossAI scheduler.Schedule(2s, GROUP_MERGE, [this](TaskContext context) { if (Creature* lynx = instance->GetCreature(DATA_SPIRIT_LYNX)) - { if (me->IsWithinDistInMap(lynx, 6.0f)) { if (_transformCount < 3) - { EnterPhase(PHASE_LYNX); - } else - { EnterPhase(PHASE_ENRAGE); - } } - } context.Repeat(2s); }); } @@ -263,9 +240,13 @@ struct boss_halazzi : public BossAI { BossAI::KilledUnit(victim); if (victim->IsPlayer()) - { Talk(SAY_KILL); - } + } + + void DoAction(int32 actionId) override + { + if (actionId == ACTION_MERGE) + EnterPhase(PHASE_MERGE); } void JustDied(Unit* killer) override @@ -281,60 +262,8 @@ private: uint32 _healthCheckPercentage; PhaseHalazzi _phase; }; -// Spirits Lynx AI -struct npc_halazzi_lynx : public ScriptedAI -{ - npc_halazzi_lynx(Creature* creature) : ScriptedAI(creature) { } - - void Reset() override - { - scheduler.CancelAll(); - } - - void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) override - { - if (damage >= me->GetHealth()) - { - damage = 0; - } - } - - void AttackStart(Unit* who) override - { - if (!me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE)) - { - ScriptedAI::AttackStart(who); - } - } - - void JustEngagedWith(Unit* who) override - { - ScriptedAI::JustEngagedWith(who); - - ScheduleTimedEvent(30s, 50s, [&] - { - DoCastSelf(SPELL_LYNX_FRENZY); - }, 30s, 50s); - ScheduleTimedEvent(4s, [&]{ - DoCastVictim(SPELL_SHRED_ARMOR); - }, 4s); - } - - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - { - return; - } - - scheduler.Update(diff); - - DoMeleeAttackIfReady(); - } -}; void AddSC_boss_halazzi() { RegisterZulAmanCreatureAI(boss_halazzi); - RegisterZulAmanCreatureAI(npc_halazzi_lynx); } |