diff options
-rw-r--r-- | src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp | 491 | ||||
-rw-r--r-- | src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h | 2 |
2 files changed, 231 insertions, 262 deletions
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp index 5e2b1cf9dd5..087d8e27b84 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp @@ -66,303 +66,270 @@ enum Phases PHASE_COMBAT }; -class boss_baltharus_the_warborn : public CreatureScript +struct boss_baltharus_the_warborn : public BossAI { - public: - boss_baltharus_the_warborn() : CreatureScript("boss_baltharus_the_warborn") { } - - struct boss_baltharus_the_warbornAI : public BossAI + boss_baltharus_the_warborn(Creature* creature) : BossAI(creature, DATA_BALTHARUS_THE_WARBORN), _cloneCount(0) { } + + void Reset() override + { + _Reset(); + events.SetPhase(PHASE_INTRO); + instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetMaxHealth()); + if (Creature* channelTarget = instance->GetCreature(DATA_CRYSTAL_CHANNEL_TARGET)) + DoCast(channelTarget, SPELL_BARRIER_CHANNEL); + _cloneCount = 0; + } + + void DoAction(int32 action) override + { + switch (action) { - boss_baltharus_the_warbornAI(Creature* creature) : BossAI(creature, DATA_BALTHARUS_THE_WARBORN), _cloneCount(0) { } - - void Reset() override + case ACTION_INTRO_BALTHARUS: + me->setActive(true); + me->SetFarVisible(true); + events.ScheduleEvent(EVENT_INTRO_TALK, Seconds(7), 0, PHASE_INTRO); + break; + case ACTION_CLONE: { - _Reset(); - events.SetPhase(PHASE_INTRO); - instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetMaxHealth()); - if (Creature* channelTarget = instance->GetCreature(DATA_CRYSTAL_CHANNEL_TARGET)) - DoCast(channelTarget, SPELL_BARRIER_CHANNEL); - _cloneCount = 0; + DoCastSelf(SPELL_CLEAR_DEBUFFS, true); + DoCastSelf(SPELL_CLONE, true); + DoCastSelf(SPELL_REPELLING_WAVE); + Talk(SAY_CLONE); + break; } - - void DoAction(int32 action) override - { - switch (action) - { - case ACTION_INTRO_BALTHARUS: - me->setActive(true); - me->SetFarVisible(true); - events.ScheduleEvent(EVENT_INTRO_TALK, Seconds(7), 0, PHASE_INTRO); - break; - case ACTION_CLONE: - { - DoCastSelf(SPELL_CLEAR_DEBUFFS, true); - DoCastSelf(SPELL_CLONE, true); - DoCastSelf(SPELL_REPELLING_WAVE); - Talk(SAY_CLONE); - break; - } - default: - break; - } - } - - void JustEngagedWith(Unit* who) override + default: + break; + } + } + + void JustEngagedWith(Unit* who) override + { + me->InterruptNonMeleeSpells(false); + BossAI::JustEngagedWith(who); + events.Reset(); + events.SetPhase(PHASE_COMBAT); + events.ScheduleEvent(EVENT_CLEAVE, Seconds(13), 0, PHASE_COMBAT); + events.ScheduleEvent(EVENT_ENERVATING_BRAND, Seconds(13), 0, PHASE_COMBAT); + events.ScheduleEvent(EVENT_BLADE_TEMPEST, Seconds(18), 0, PHASE_COMBAT); + Talk(SAY_AGGRO); + } + + void JustDied(Unit* /*killer*/) override + { + _JustDied(); + Talk(SAY_DEATH); + if (Creature* xerestrasza = instance->GetCreature(DATA_XERESTRASZA)) + xerestrasza->AI()->DoAction(ACTION_BALTHARUS_DEATH); + } + + void KilledUnit(Unit* victim) override + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_KILL); + } + + void JustSummoned(Creature* summon) override + { + summons.Summon(summon); + summon->SetHealth(me->GetHealth()); + events.ScheduleEvent(EVENT_SUMMONS_ATTACK, 2s); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) override + { + if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) + { + if (me->HealthBelowPctDamaged(50, damage) && _cloneCount == 0) { - me->InterruptNonMeleeSpells(false); - BossAI::JustEngagedWith(who); - events.Reset(); - events.SetPhase(PHASE_COMBAT); - events.ScheduleEvent(EVENT_CLEAVE, Seconds(13), 0, PHASE_COMBAT); - events.ScheduleEvent(EVENT_ENERVATING_BRAND, Seconds(13), 0, PHASE_COMBAT); - events.ScheduleEvent(EVENT_BLADE_TEMPEST, Seconds(18), 0, PHASE_COMBAT); - Talk(SAY_AGGRO); + ++_cloneCount; + events.ScheduleEvent(EVENT_CLONE, Milliseconds(1)); } - - void JustDied(Unit* /*killer*/) override + } + else + { + if (me->HealthBelowPctDamaged(66, damage) && _cloneCount == 0) { - _JustDied(); - Talk(SAY_DEATH); - if (Creature* xerestrasza = instance->GetCreature(DATA_XERESTRASZA)) - xerestrasza->AI()->DoAction(ACTION_BALTHARUS_DEATH); + ++_cloneCount; + events.ScheduleEvent(EVENT_CLONE, Milliseconds(1)); } - - void KilledUnit(Unit* victim) override + else if (me->HealthBelowPctDamaged(33, damage) && _cloneCount == 1) { - if (victim->GetTypeId() == TYPEID_PLAYER) - Talk(SAY_KILL); - } - - void JustSummoned(Creature* summon) override - { - summons.Summon(summon); - summon->SetHealth(me->GetHealth()); - events.ScheduleEvent(EVENT_SUMMONS_ATTACK, 2s); + ++_cloneCount; + events.ScheduleEvent(EVENT_CLONE, Milliseconds(1)); } + } - void DamageTaken(Unit* /*attacker*/, uint32& damage) override - { - if (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) - { - if (me->HealthBelowPctDamaged(50, damage) && _cloneCount == 0) - { - ++_cloneCount; - events.ScheduleEvent(EVENT_CLONE, Milliseconds(1)); - } - } - else - { - if (me->HealthBelowPctDamaged(66, damage) && _cloneCount == 0) - { - ++_cloneCount; - events.ScheduleEvent(EVENT_CLONE, Milliseconds(1)); - } - else if (me->HealthBelowPctDamaged(33, damage) && _cloneCount == 1) - { - ++_cloneCount; - events.ScheduleEvent(EVENT_CLONE, Milliseconds(1)); - } - } - - if (me->GetHealth() > damage) - instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetHealth() - damage); - } + if (me->GetHealth() > damage) + instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetHealth() - damage); + } - void EnterEvadeMode(EvadeReason /*why*/) override - { - summons.DespawnAll(); - events.Reset(); - _DespawnAtEvade(); - } + void EnterEvadeMode(EvadeReason /*why*/) override + { + summons.DespawnAll(); + events.Reset(); + _DespawnAtEvade(); + } - void UpdateAI(uint32 diff) override - { + void UpdateAI(uint32 diff) override + { - if (!events.IsInPhase(PHASE_INTRO) && !UpdateVictim()) - return; - - if (!events.IsInPhase(PHASE_INTRO)) - me->SetHealth(instance->GetData(DATA_BALTHARUS_SHARED_HEALTH)); - - events.Update(diff); - - if (!events.IsInPhase(PHASE_INTRO) && me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_INTRO_TALK: - Talk(SAY_BALTHARUS_INTRO); - break; - case EVENT_CLEAVE: - DoCastVictim(SPELL_CLEAVE); - events.Repeat(Seconds(20), Seconds(24)); - break; - case EVENT_BLADE_TEMPEST: - DoCastSelf(SPELL_BLADE_TEMPEST); - events.Repeat(Seconds(24)); - break; - case EVENT_ENERVATING_BRAND: - for (uint8 i = 0; i < RAID_MODE<uint8>(2, 4, 2, 4); i++) - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true, false, -SPELL_ENERVATING_BRAND)) - DoCast(target, SPELL_ENERVATING_BRAND); - events.Repeat(Seconds(26)); - break; - case EVENT_SUMMONS_ATTACK: - summons.DoZoneInCombat(NPC_BALTHARUS_THE_WARBORN_CLONE); - break; - case EVENT_CLONE: - DoAction(ACTION_CLONE); - break; - default: - break; - } - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - } - - DoMeleeAttackIfReady(); - } + if (!events.IsInPhase(PHASE_INTRO) && !UpdateVictim()) + return; - private: - uint8 _cloneCount; - }; + if (!events.IsInPhase(PHASE_INTRO)) + me->SetHealth(instance->GetData(DATA_BALTHARUS_SHARED_HEALTH)); - CreatureAI* GetAI(Creature* creature) const override - { - return GetRubySanctumAI<boss_baltharus_the_warbornAI>(creature); - } -}; + events.Update(diff); -class npc_baltharus_the_warborn_clone : public CreatureScript -{ - public: - npc_baltharus_the_warborn_clone() : CreatureScript("npc_baltharus_the_warborn_clone") { } + if (!events.IsInPhase(PHASE_INTRO) && me->HasUnitState(UNIT_STATE_CASTING)) + return; - struct npc_baltharus_the_warborn_cloneAI : public BossAI + while (uint32 eventId = events.ExecuteEvent()) { - npc_baltharus_the_warborn_cloneAI(Creature* creature) : BossAI(creature, DATA_BALTHARUS_CLONE) { } - - void Reset() override + switch (eventId) { - DoCastSelf(SPELL_SPAWN_EFFECT); - me->SetReactState(REACT_DEFENSIVE); + case EVENT_INTRO_TALK: + Talk(SAY_BALTHARUS_INTRO); + break; + case EVENT_CLEAVE: + DoCastVictim(SPELL_CLEAVE); + events.Repeat(Seconds(20), Seconds(24)); + break; + case EVENT_BLADE_TEMPEST: + DoCastSelf(SPELL_BLADE_TEMPEST); + events.Repeat(Seconds(24)); + break; + case EVENT_ENERVATING_BRAND: + for (uint8 i = 0; i < RAID_MODE<uint8>(2, 4, 2, 4); i++) + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true, false, -SPELL_ENERVATING_BRAND)) + DoCast(target, SPELL_ENERVATING_BRAND); + events.Repeat(Seconds(26)); + break; + case EVENT_SUMMONS_ATTACK: + summons.DoZoneInCombat(NPC_BALTHARUS_THE_WARBORN_CLONE); + break; + case EVENT_CLONE: + DoAction(ACTION_CLONE); + break; + default: + break; } - void JustEngagedWith(Unit* /*who*/) override - { - DoZoneInCombat(); - events.Reset(); - events.ScheduleEvent(EVENT_CLEAVE, 11s); - events.ScheduleEvent(EVENT_BLADE_TEMPEST, 15s); - events.ScheduleEvent(EVENT_ENERVATING_BRAND, 10s); - } - - void EnterEvadeMode(EvadeReason /*why*/) override { } - - void DamageTaken(Unit* /*attacker*/, uint32& damage) override - { - // Setting DATA_BALTHARUS_SHARED_HEALTH to 0 when killed would bug the boss. - if (me->GetHealth() > damage) - instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetHealth() - damage); - } - - void JustDied(Unit* killer) override - { - // This is here because DamageTaken wont trigger if the damage is deadly. - if (Creature* baltharus = instance->GetCreature(DATA_BALTHARUS_THE_WARBORN)) - Unit::Kill(killer, baltharus); - } + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } - void UpdateAI(uint32 diff) override - { - if (!UpdateVictim()) - return; - - me->SetHealth(instance->GetData(DATA_BALTHARUS_SHARED_HEALTH)); - - events.Update(diff); - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_CLEAVE: - DoCastVictim(SPELL_CLEAVE); - events.Repeat(Seconds(20), Seconds(24)); - break; - case EVENT_BLADE_TEMPEST: - DoCastVictim(SPELL_BLADE_TEMPEST); - events.Repeat(Seconds(24)); - break; - case EVENT_ENERVATING_BRAND: - for (uint8 i = 0; i < RAID_MODE<uint8>(2, 4, 2, 4); i++) - if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true, false, -SPELL_ENERVATING_BRAND)) - DoCast(target, SPELL_ENERVATING_BRAND); - events.Repeat(Seconds(26)); - break; - default: - break; - } - - if (me->HasUnitState(UNIT_STATE_CASTING)) - return; - } - - DoMeleeAttackIfReady(); - } - }; + DoMeleeAttackIfReady(); + } - CreatureAI* GetAI(Creature* creature) const override - { - return GetRubySanctumAI<npc_baltharus_the_warborn_cloneAI>(creature); - } +private: + uint8 _cloneCount; }; -// 74505 - Enervating Brand -class spell_baltharus_enervating_brand_trigger : public SpellScriptLoader +struct npc_baltharus_the_warborn_clone : public BossAI { - public: - spell_baltharus_enervating_brand_trigger() : SpellScriptLoader("spell_baltharus_enervating_brand_trigger") { } - - class spell_baltharus_enervating_brand_trigger_SpellScript : public SpellScript + npc_baltharus_the_warborn_clone(Creature* creature) : BossAI(creature, DATA_BALTHARUS_CLONE) { } + + void Reset() override + { + DoCastSelf(SPELL_SPAWN_EFFECT); + me->SetReactState(REACT_DEFENSIVE); + } + + void JustEngagedWith(Unit* /*who*/) override + { + DoZoneInCombat(); + events.Reset(); + events.ScheduleEvent(EVENT_CLEAVE, 11s); + events.ScheduleEvent(EVENT_BLADE_TEMPEST, 15s); + events.ScheduleEvent(EVENT_ENERVATING_BRAND, 10s); + } + + void EnterEvadeMode(EvadeReason /*why*/) override { } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) override + { + // Setting DATA_BALTHARUS_SHARED_HEALTH to 0 when killed would bug the boss. + if (me->GetHealth() > damage) + instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetHealth() - damage); + } + + void JustDied(Unit* killer) override + { + // This is here because DamageTaken wont trigger if the damage is deadly. + if (Creature* baltharus = instance->GetCreature(DATA_BALTHARUS_THE_WARBORN)) + Unit::Kill(killer, baltharus); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + me->SetHealth(instance->GetData(DATA_BALTHARUS_SHARED_HEALTH)); + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) { - PrepareSpellScript(spell_baltharus_enervating_brand_trigger_SpellScript); - - bool Validate(SpellInfo const* /*spell*/) override + switch (eventId) { - return ValidateSpellInfo({ SPELL_SIPHONED_MIGHT }); + case EVENT_CLEAVE: + DoCastVictim(SPELL_CLEAVE); + events.Repeat(Seconds(20), Seconds(24)); + break; + case EVENT_BLADE_TEMPEST: + DoCastVictim(SPELL_BLADE_TEMPEST); + events.Repeat(Seconds(24)); + break; + case EVENT_ENERVATING_BRAND: + for (uint8 i = 0; i < RAID_MODE<uint8>(2, 4, 2, 4); i++) + if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true, false, -SPELL_ENERVATING_BRAND)) + DoCast(target, SPELL_ENERVATING_BRAND); + events.Repeat(Seconds(26)); + break; + default: + break; } - void HandleSiphonedMight() - { - if (SpellInfo const* spellInfo = GetTriggeringSpell()) - if (Aura* triggerAura = GetCaster()->GetAura(spellInfo->Id)) - if (Unit* caster = triggerAura->GetCaster()) - GetHitUnit()->CastSpell(caster, SPELL_SIPHONED_MIGHT, true); - } + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } - void Register() override - { - OnHit += SpellHitFn(spell_baltharus_enervating_brand_trigger_SpellScript::HandleSiphonedMight); - } - }; + DoMeleeAttackIfReady(); + } +}; - SpellScript* GetSpellScript() const override - { - return new spell_baltharus_enervating_brand_trigger_SpellScript(); - } +// 74505 - Enervating Brand +class spell_baltharus_enervating_brand_trigger : public SpellScript +{ + PrepareSpellScript(spell_baltharus_enervating_brand_trigger); + + bool Validate(SpellInfo const* /*spell*/) override + { + return ValidateSpellInfo({ SPELL_SIPHONED_MIGHT }); + } + + void HandleSiphonedMight() + { + if (SpellInfo const* spellInfo = GetTriggeringSpell()) + if (Aura* triggerAura = GetCaster()->GetAura(spellInfo->Id)) + if (Unit* caster = triggerAura->GetCaster()) + GetHitUnit()->CastSpell(caster, SPELL_SIPHONED_MIGHT, true); + } + + void Register() override + { + OnHit += SpellHitFn(spell_baltharus_enervating_brand_trigger::HandleSiphonedMight); + } }; void AddSC_boss_baltharus_the_warborn() { - new boss_baltharus_the_warborn(); - new npc_baltharus_the_warborn_clone(); - new spell_baltharus_enervating_brand_trigger(); + RegisterRubySanctumCreatureAI(boss_baltharus_the_warborn); + RegisterRubySanctumCreatureAI(npc_baltharus_the_warborn_clone); + RegisterSpellScript(spell_baltharus_enervating_brand_trigger); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h index e86351fdef9..7c243617e03 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h @@ -135,4 +135,6 @@ inline AI* GetRubySanctumAI(T* obj) return GetInstanceAI<AI>(obj, RSScriptName); } +#define RegisterRubySanctumCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetRubySanctumAI) + #endif // RUBY_SANCTUM_H_ |