diff options
author | offl <11556157+offl@users.noreply.github.com> | 2021-04-16 20:14:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-16 20:14:40 +0300 |
commit | e5a34d94a6b2802452f34afa35dd37626d3ebf15 (patch) | |
tree | c90fa12189245fcf141fd94d20bc8c9f0115d195 /src | |
parent | 19606ea1e7daadde9aa5ee7169565d5ec727b7e7 (diff) |
Scripts/HoL: Update Bjarngrim to new model (#26422)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp | 522 | ||||
-rw-r--r-- | src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h | 2 |
2 files changed, 251 insertions, 273 deletions
diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp index aad76487dec..ab25ce6781a 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_bjarngrim.cpp @@ -93,376 +93,352 @@ enum Stanges ## boss_bjarngrim ######*/ -class boss_bjarngrim : public CreatureScript +struct boss_bjarngrim : public ScriptedAI { -public: - boss_bjarngrim() : CreatureScript("boss_bjarngrim") { } - - CreatureAI* GetAI(Creature* creature) const override + boss_bjarngrim(Creature* creature) : ScriptedAI(creature) { - return GetHallsOfLightningAI<boss_bjarngrimAI>(creature); + Initialize(); + instance = creature->GetInstanceScript(); + m_uiStance = STANCE_DEFENSIVE; + canBuff = true; } - struct boss_bjarngrimAI : public ScriptedAI + void Initialize() { - boss_bjarngrimAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - instance = creature->GetInstanceScript(); - m_uiStance = STANCE_DEFENSIVE; - canBuff = true; - } + m_bIsChangingStance = false; - void Initialize() - { - m_bIsChangingStance = false; + m_uiChargingStatus = 0; + m_uiCharge_Timer = 1000; - m_uiChargingStatus = 0; - m_uiCharge_Timer = 1000; + m_uiChangeStance_Timer = urand(20000, 25000); - m_uiChangeStance_Timer = urand(20000, 25000); + m_uiReflection_Timer = 8000; + m_uiKnockAway_Timer = 20000; + m_uiPummel_Timer = 10000; + m_uiIronform_Timer = 25000; - m_uiReflection_Timer = 8000; - m_uiKnockAway_Timer = 20000; - m_uiPummel_Timer = 10000; - m_uiIronform_Timer = 25000; + m_uiIntercept_Timer = 5000; + m_uiWhirlwind_Timer = 10000; + m_uiCleave_Timer = 8000; - m_uiIntercept_Timer = 5000; - m_uiWhirlwind_Timer = 10000; - m_uiCleave_Timer = 8000; + m_uiMortalStrike_Timer = 8000; + m_uiSlam_Timer = 10000; + } - m_uiMortalStrike_Timer = 8000; - m_uiSlam_Timer = 10000; - } + InstanceScript* instance; - InstanceScript* instance; + bool m_bIsChangingStance; + bool canBuff; - bool m_bIsChangingStance; - bool canBuff; + uint8 m_uiChargingStatus; + uint8 m_uiStance; - uint8 m_uiChargingStatus; - uint8 m_uiStance; + uint32 m_uiCharge_Timer; + uint32 m_uiChangeStance_Timer; - uint32 m_uiCharge_Timer; - uint32 m_uiChangeStance_Timer; + uint32 m_uiReflection_Timer; + uint32 m_uiKnockAway_Timer; + uint32 m_uiPummel_Timer; + uint32 m_uiIronform_Timer; - uint32 m_uiReflection_Timer; - uint32 m_uiKnockAway_Timer; - uint32 m_uiPummel_Timer; - uint32 m_uiIronform_Timer; + uint32 m_uiIntercept_Timer; + uint32 m_uiWhirlwind_Timer; + uint32 m_uiCleave_Timer; - uint32 m_uiIntercept_Timer; - uint32 m_uiWhirlwind_Timer; - uint32 m_uiCleave_Timer; + uint32 m_uiMortalStrike_Timer; + uint32 m_uiSlam_Timer; - uint32 m_uiMortalStrike_Timer; - uint32 m_uiSlam_Timer; + ObjectGuid m_auiStormforgedLieutenantGUID[2]; + + void Reset() override + { + if (canBuff) + if (!me->HasAura(SPELL_TEMPORARY_ELECTRICAL_CHARGE)) + me->AddAura(SPELL_TEMPORARY_ELECTRICAL_CHARGE, me); - ObjectGuid m_auiStormforgedLieutenantGUID[2]; + Initialize(); - void Reset() override + for (uint8 i = 0; i < 2; ++i) { - if (canBuff) - if (!me->HasAura(SPELL_TEMPORARY_ELECTRICAL_CHARGE)) - me->AddAura(SPELL_TEMPORARY_ELECTRICAL_CHARGE, me); + // Something isn't right here - m_auiStormforgedLieutenantGUID is never assinged to + if (Creature* pStormforgedLieutenant = ObjectAccessor::GetCreature(*me, m_auiStormforgedLieutenantGUID[i])) + if (!pStormforgedLieutenant->IsAlive()) + pStormforgedLieutenant->Respawn(); + } - Initialize(); + if (m_uiStance != STANCE_DEFENSIVE) + { + DoRemoveStanceAura(m_uiStance); + DoCast(me, SPELL_DEFENSIVE_STANCE); + m_uiStance = STANCE_DEFENSIVE; + } - for (uint8 i = 0; i < 2; ++i) - { - // Something isn't right here - m_auiStormforgedLieutenantGUID is never assinged to - if (Creature* pStormforgedLieutenant = ObjectAccessor::GetCreature(*me, m_auiStormforgedLieutenantGUID[i])) - if (!pStormforgedLieutenant->IsAlive()) - pStormforgedLieutenant->Respawn(); - } + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); - if (m_uiStance != STANCE_DEFENSIVE) - { - DoRemoveStanceAura(m_uiStance); - DoCast(me, SPELL_DEFENSIVE_STANCE); - m_uiStance = STANCE_DEFENSIVE; - } + instance->SetBossState(DATA_BJARNGRIM, NOT_STARTED); + } - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); + void EnterEvadeMode(EvadeReason why) override + { + if (me->HasAura(SPELL_TEMPORARY_ELECTRICAL_CHARGE)) + canBuff = true; + else + canBuff = false; - instance->SetBossState(DATA_BJARNGRIM, NOT_STARTED); - } + ScriptedAI::EnterEvadeMode(why); + } - void EnterEvadeMode(EvadeReason why) override - { - if (me->HasAura(SPELL_TEMPORARY_ELECTRICAL_CHARGE)) - canBuff = true; - else - canBuff = false; + void JustEngagedWith(Unit* /*who*/) override + { + Talk(SAY_AGGRO); - ScriptedAI::EnterEvadeMode(why); - } + //must get both lieutenants here and make sure they are with him + me->CallForHelp(30.0f); - void JustEngagedWith(Unit* /*who*/) override - { - Talk(SAY_AGGRO); + instance->SetBossState(DATA_BJARNGRIM, IN_PROGRESS); + } - //must get both lieutenants here and make sure they are with him - me->CallForHelp(30.0f); + void KilledUnit(Unit* /*victim*/) override + { + Talk(SAY_SLAY); + } - instance->SetBossState(DATA_BJARNGRIM, IN_PROGRESS); - } + void JustDied(Unit* /*killer*/) override + { + Talk(SAY_DEATH); - void KilledUnit(Unit* /*victim*/) override + instance->SetBossState(DATA_BJARNGRIM, DONE); + } + + /// @todo remove when removal is done by the core + void DoRemoveStanceAura(uint8 uiStance) + { + switch (uiStance) { - Talk(SAY_SLAY); + case STANCE_DEFENSIVE: + me->RemoveAurasDueToSpell(SPELL_DEFENSIVE_STANCE); + break; + case STANCE_BERSERKER: + me->RemoveAurasDueToSpell(SPELL_BERSEKER_STANCE); + break; + case STANCE_BATTLE: + me->RemoveAurasDueToSpell(SPELL_BATTLE_STANCE); + break; } + } - void JustDied(Unit* /*killer*/) override + void UpdateAI(uint32 uiDiff) override + { + //Return since we have no target + if (!UpdateVictim()) + return; + + // Change stance + if (m_uiChangeStance_Timer <= uiDiff) { - Talk(SAY_DEATH); + //wait for current spell to finish before change stance + if (me->IsNonMeleeSpellCast(false)) + return; - instance->SetBossState(DATA_BJARNGRIM, DONE); - } + DoRemoveStanceAura(m_uiStance); - /// @todo remove when removal is done by the core - void DoRemoveStanceAura(uint8 uiStance) - { - switch (uiStance) + int uiTempStance = rand32() % (3 - 1); + + if (uiTempStance >= m_uiStance) + ++uiTempStance; + + m_uiStance = uiTempStance; + + switch (m_uiStance) { case STANCE_DEFENSIVE: - me->RemoveAurasDueToSpell(SPELL_DEFENSIVE_STANCE); + Talk(SAY_DEFENSIVE_STANCE); + Talk(EMOTE_DEFENSIVE_STANCE); + DoCast(me, SPELL_DEFENSIVE_STANCE); + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); break; case STANCE_BERSERKER: - me->RemoveAurasDueToSpell(SPELL_BERSEKER_STANCE); + Talk(SAY_BERSEKER_STANCE); + Talk(EMOTE_BERSEKER_STANCE); + DoCast(me, SPELL_BERSEKER_STANCE); + SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); break; case STANCE_BATTLE: - me->RemoveAurasDueToSpell(SPELL_BATTLE_STANCE); + Talk(SAY_BATTLE_STANCE); + Talk(EMOTE_BATTLE_STANCE); + DoCast(me, SPELL_BATTLE_STANCE); + SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); break; } + + m_uiChangeStance_Timer = urand(20000, 25000); + return; } + else + m_uiChangeStance_Timer -= uiDiff; - void UpdateAI(uint32 uiDiff) override + switch (m_uiStance) { - //Return since we have no target - if (!UpdateVictim()) - return; - - // Change stance - if (m_uiChangeStance_Timer <= uiDiff) + case STANCE_DEFENSIVE: { - //wait for current spell to finish before change stance - if (me->IsNonMeleeSpellCast(false)) - return; - - DoRemoveStanceAura(m_uiStance); - - int uiTempStance = rand32() % (3 - 1); + if (m_uiReflection_Timer <= uiDiff) + { + DoCast(me, SPELL_SPELL_REFLECTION); + m_uiReflection_Timer = urand(8000, 9000); + } + else + m_uiReflection_Timer -= uiDiff; - if (uiTempStance >= m_uiStance) - ++uiTempStance; + if (m_uiKnockAway_Timer <= uiDiff) + { + DoCast(me, SPELL_KNOCK_AWAY); + m_uiKnockAway_Timer = urand(20000, 21000); + } + else + m_uiKnockAway_Timer -= uiDiff; - m_uiStance = uiTempStance; + if (m_uiPummel_Timer <= uiDiff) + { + DoCastVictim(SPELL_PUMMEL); + m_uiPummel_Timer = urand(10000, 11000); + } + else + m_uiPummel_Timer -= uiDiff; - switch (m_uiStance) + if (m_uiIronform_Timer <= uiDiff) { - case STANCE_DEFENSIVE: - Talk(SAY_DEFENSIVE_STANCE); - Talk(EMOTE_DEFENSIVE_STANCE); - DoCast(me, SPELL_DEFENSIVE_STANCE); - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SHIELD, EQUIP_NO_CHANGE); - break; - case STANCE_BERSERKER: - Talk(SAY_BERSEKER_STANCE); - Talk(EMOTE_BERSEKER_STANCE); - DoCast(me, SPELL_BERSEKER_STANCE); - SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE); - break; - case STANCE_BATTLE: - Talk(SAY_BATTLE_STANCE); - Talk(EMOTE_BATTLE_STANCE); - DoCast(me, SPELL_BATTLE_STANCE); - SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); - break; + DoCast(me, SPELL_IRONFORM); + m_uiIronform_Timer = urand(25000, 26000); } + else + m_uiIronform_Timer -= uiDiff; - m_uiChangeStance_Timer = urand(20000, 25000); - return; + break; } - else - m_uiChangeStance_Timer -= uiDiff; - - switch (m_uiStance) + case STANCE_BERSERKER: { - case STANCE_DEFENSIVE: + if (m_uiIntercept_Timer <= uiDiff) { - if (m_uiReflection_Timer <= uiDiff) - { - DoCast(me, SPELL_SPELL_REFLECTION); - m_uiReflection_Timer = urand(8000, 9000); - } - else - m_uiReflection_Timer -= uiDiff; - - if (m_uiKnockAway_Timer <= uiDiff) - { - DoCast(me, SPELL_KNOCK_AWAY); - m_uiKnockAway_Timer = urand(20000, 21000); - } - else - m_uiKnockAway_Timer -= uiDiff; - - if (m_uiPummel_Timer <= uiDiff) - { - DoCastVictim(SPELL_PUMMEL); - m_uiPummel_Timer = urand(10000, 11000); - } - else - m_uiPummel_Timer -= uiDiff; - - if (m_uiIronform_Timer <= uiDiff) - { - DoCast(me, SPELL_IRONFORM); - m_uiIronform_Timer = urand(25000, 26000); - } - else - m_uiIronform_Timer -= uiDiff; - - break; + //not much point is this, better random target and more often? + DoCastVictim(SPELL_INTERCEPT); + m_uiIntercept_Timer = urand(45000, 46000); } - case STANCE_BERSERKER: + else + m_uiIntercept_Timer -= uiDiff; + + if (m_uiWhirlwind_Timer <= uiDiff) { - if (m_uiIntercept_Timer <= uiDiff) - { - //not much point is this, better random target and more often? - DoCastVictim(SPELL_INTERCEPT); - m_uiIntercept_Timer = urand(45000, 46000); - } - else - m_uiIntercept_Timer -= uiDiff; - - if (m_uiWhirlwind_Timer <= uiDiff) - { - DoCast(me, SPELL_WHIRLWIND); - m_uiWhirlwind_Timer = urand(10000, 11000); - } - else - m_uiWhirlwind_Timer -= uiDiff; - - if (m_uiCleave_Timer <= uiDiff) - { - DoCastVictim(SPELL_CLEAVE); - m_uiCleave_Timer = urand(8000, 9000); - } - else - m_uiCleave_Timer -= uiDiff; + DoCast(me, SPELL_WHIRLWIND); + m_uiWhirlwind_Timer = urand(10000, 11000); + } + else + m_uiWhirlwind_Timer -= uiDiff; - break; + if (m_uiCleave_Timer <= uiDiff) + { + DoCastVictim(SPELL_CLEAVE); + m_uiCleave_Timer = urand(8000, 9000); } - case STANCE_BATTLE: + else + m_uiCleave_Timer -= uiDiff; + + break; + } + case STANCE_BATTLE: + { + if (m_uiMortalStrike_Timer <= uiDiff) { - if (m_uiMortalStrike_Timer <= uiDiff) - { - DoCastVictim(SPELL_MORTAL_STRIKE); - m_uiMortalStrike_Timer = urand(20000, 21000); - } - else - m_uiMortalStrike_Timer -= uiDiff; - - if (m_uiSlam_Timer <= uiDiff) - { - DoCastVictim(SPELL_SLAM); - m_uiSlam_Timer = urand(15000, 16000); - } - else - m_uiSlam_Timer -= uiDiff; + DoCastVictim(SPELL_MORTAL_STRIKE); + m_uiMortalStrike_Timer = urand(20000, 21000); + } + else + m_uiMortalStrike_Timer -= uiDiff; - break; + if (m_uiSlam_Timer <= uiDiff) + { + DoCastVictim(SPELL_SLAM); + m_uiSlam_Timer = urand(15000, 16000); } - } + else + m_uiSlam_Timer -= uiDiff; - DoMeleeAttackIfReady(); + break; + } } - }; + DoMeleeAttackIfReady(); + } }; /*###### ## npc_stormforged_lieutenant ######*/ -class npc_stormforged_lieutenant : public CreatureScript +struct npc_stormforged_lieutenant : public ScriptedAI { -public: - npc_stormforged_lieutenant() : CreatureScript("npc_stormforged_lieutenant") { } - - CreatureAI* GetAI(Creature* creature) const override + npc_stormforged_lieutenant(Creature* creature) : ScriptedAI(creature) { - return GetHallsOfLightningAI<npc_stormforged_lieutenantAI>(creature); + Initialize(); + instance = creature->GetInstanceScript(); } - struct npc_stormforged_lieutenantAI : public ScriptedAI + void Initialize() { - npc_stormforged_lieutenantAI(Creature* creature) : ScriptedAI(creature) - { - Initialize(); - instance = creature->GetInstanceScript(); - } + m_uiArcWeld_Timer = urand(20000, 21000); + m_uiRenewSteel_Timer = urand(10000, 11000); + } - void Initialize() - { - m_uiArcWeld_Timer = urand(20000, 21000); - m_uiRenewSteel_Timer = urand(10000, 11000); - } + InstanceScript* instance; - InstanceScript* instance; + uint32 m_uiArcWeld_Timer; + uint32 m_uiRenewSteel_Timer; - uint32 m_uiArcWeld_Timer; - uint32 m_uiRenewSteel_Timer; + void Reset() override + { + Initialize(); + } - void Reset() override + void JustEngagedWith(Unit* who) override + { + if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BJARNGRIM))) { - Initialize(); + if (pBjarngrim->IsAlive() && !pBjarngrim->GetVictim()) + pBjarngrim->AI()->AttackStart(who); } + } - void JustEngagedWith(Unit* who) override + void UpdateAI(uint32 uiDiff) override + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (m_uiArcWeld_Timer <= uiDiff) { - if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BJARNGRIM))) - { - if (pBjarngrim->IsAlive() && !pBjarngrim->GetVictim()) - pBjarngrim->AI()->AttackStart(who); - } + DoCastVictim(SPELL_ARC_WELD); + m_uiArcWeld_Timer = urand(20000, 21000); } + else + m_uiArcWeld_Timer -= uiDiff; - void UpdateAI(uint32 uiDiff) override + if (m_uiRenewSteel_Timer <= uiDiff) { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (m_uiArcWeld_Timer <= uiDiff) - { - DoCastVictim(SPELL_ARC_WELD); - m_uiArcWeld_Timer = urand(20000, 21000); - } - else - m_uiArcWeld_Timer -= uiDiff; - - if (m_uiRenewSteel_Timer <= uiDiff) + if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BJARNGRIM))) { - if (Creature* pBjarngrim = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BJARNGRIM))) - { - if (pBjarngrim->IsAlive()) - DoCast(pBjarngrim, SPELL_RENEW_STEEL_N); - } - m_uiRenewSteel_Timer = urand(10000, 14000); + if (pBjarngrim->IsAlive()) + DoCast(pBjarngrim, SPELL_RENEW_STEEL_N); } - else - m_uiRenewSteel_Timer -= uiDiff; - - DoMeleeAttackIfReady(); + m_uiRenewSteel_Timer = urand(10000, 14000); } - }; + else + m_uiRenewSteel_Timer -= uiDiff; + DoMeleeAttackIfReady(); + } }; void AddSC_boss_bjarngrim() { - new boss_bjarngrim(); - new npc_stormforged_lieutenant(); + RegisterHallsOfLightningCreatureAI(boss_bjarngrim); + RegisterHallsOfLightningCreatureAI(npc_stormforged_lieutenant); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h index 7db29ea3028..e13ad0c7265 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h @@ -57,4 +57,6 @@ inline AI* GetHallsOfLightningAI(T* obj) return GetInstanceAI<AI>(obj, HoLScriptName); } +#define RegisterHallsOfLightningCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetHallsOfLightningAI) + #endif // HALLS_OF_LIGHTNING_H_ |