split anubrekhan, grobbulus scripts

This commit is contained in:
Yunfan Li
2023-06-18 21:52:39 +08:00
parent abaf4655e2
commit 433467b8c0
5 changed files with 477 additions and 401 deletions

View File

@@ -15,9 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "naxxramas.h"
#include "boss_anubrekhan.h"
enum Says
{
@@ -60,188 +58,174 @@ enum Misc
ACHIEV_TIMED_START_EVENT = 9891
};
class boss_anubrekhan : public CreatureScript
CreatureAI* boss_anubrekhan::GetAI(Creature* pCreature) const
{
public:
boss_anubrekhan() : CreatureScript("boss_anubrekhan") { }
return GetNaxxramasAI<boss_anubrekhanAI>(pCreature);
}
CreatureAI* GetAI(Creature* pCreature) const override
boss_anubrekhan::boss_anubrekhanAI::boss_anubrekhanAI(Creature* c) : BossAI(c, BOSS_ANUB), summons(me)
{
pInstance = c->GetInstanceScript();
sayGreet = false;
}
void boss_anubrekhan::boss_anubrekhanAI::SummonCryptGuards()
{
if (Is25ManRaid())
{
return GetNaxxramasAI<boss_anubrekhanAI>(pCreature);
me->SummonCreature(NPC_CRYPT_GUARD, 3299.732f, -3502.489f, 287.077f, 2.378f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
me->SummonCreature(NPC_CRYPT_GUARD, 3299.086f, -3450.929f, 287.077f, 3.999f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
}
}
void boss_anubrekhan::boss_anubrekhanAI::Reset()
{
BossAI::Reset();
events.Reset();
summons.DespawnAll();
SummonCryptGuards();
if (pInstance)
{
if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_ANUB_GATE)))
{
go->SetGoState(GO_STATE_ACTIVE);
}
}
}
void boss_anubrekhan::boss_anubrekhanAI::JustSummoned(Creature* cr)
{
if (me->IsInCombat())
{
cr->SetInCombatWithZone();
if (cr->GetEntry() == NPC_CRYPT_GUARD)
{
cr->AI()->Talk(EMOTE_SPAWN, me);
}
}
summons.Summon(cr);
}
void boss_anubrekhan::boss_anubrekhanAI::SummonedCreatureDies(Creature* cr, Unit*)
{
if (cr->GetEntry() == NPC_CRYPT_GUARD)
{
cr->CastSpell(cr, SPELL_SUMMON_CORPSE_SCRABS_10, true, nullptr, nullptr, me->GetGUID());
cr->AI()->Talk(EMOTE_SCARAB);
}
}
void boss_anubrekhan::boss_anubrekhanAI::SummonedCreatureDespawn(Creature* cr)
{
summons.Despawn(cr);
}
void boss_anubrekhan::boss_anubrekhanAI::JustDied(Unit* killer)
{
BossAI::JustDied(killer);
summons.DespawnAll();
if (pInstance)
{
pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
}
void boss_anubrekhan::boss_anubrekhanAI::KilledUnit(Unit* victim)
{
if (victim->GetTypeId() != TYPEID_PLAYER)
return;
Talk(SAY_SLAY);
victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCRABS_5, true, nullptr, nullptr, me->GetGUID());
if (pInstance)
{
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}
}
void boss_anubrekhan::boss_anubrekhanAI::JustEngagedWith(Unit* who)
{
BossAI::JustEngagedWith(who);
me->CallForHelp(30.0f);
Talk(SAY_AGGRO);
if (pInstance)
{
if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_ANUB_GATE)))
{
go->SetGoState(GO_STATE_READY);
}
}
events.ScheduleEvent(EVENT_IMPALE, 15s);
events.ScheduleEvent(EVENT_LOCUST_SWARM, 70s, 120s);
events.ScheduleEvent(EVENT_BERSERK, 10min);
if (!summons.HasEntry(NPC_CRYPT_GUARD))
{
SummonCryptGuards();
}
if (!Is25ManRaid())
{
events.ScheduleEvent(EVENT_SPAWN_GUARD, 15s, 20s);
}
}
void boss_anubrekhan::boss_anubrekhanAI::MoveInLineOfSight(Unit* who)
{
if (!sayGreet && who->GetTypeId() == TYPEID_PLAYER)
{
Talk(SAY_GREET);
sayGreet = true;
}
ScriptedAI::MoveInLineOfSight(who);
}
void boss_anubrekhan::boss_anubrekhanAI::UpdateAI(uint32 diff)
{
if (!me->IsInCombat() && sayGreet)
{
for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr)
{
if (pInstance)
{
if (Creature* cr = pInstance->instance->GetCreature(*itr))
{
if (cr->IsInCombat())
DoZoneInCombat();
}
}
}
}
struct boss_anubrekhanAI : public BossAI
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
explicit boss_anubrekhanAI(Creature* c) : BossAI(c, BOSS_ANUB), summons(me)
{
pInstance = c->GetInstanceScript();
sayGreet = false;
}
InstanceScript* pInstance;
EventMap events;
SummonList summons;
bool sayGreet;
void SummonCryptGuards()
{
if (Is25ManRaid())
case EVENT_IMPALE:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
me->SummonCreature(NPC_CRYPT_GUARD, 3299.732f, -3502.489f, 287.077f, 2.378f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
me->SummonCreature(NPC_CRYPT_GUARD, 3299.086f, -3450.929f, 287.077f, 3.999f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
me->CastSpell(target, RAID_MODE(SPELL_IMPALE_10, SPELL_IMPALE_25), false);
}
}
void Reset() override
{
BossAI::Reset();
events.Reset();
summons.DespawnAll();
SummonCryptGuards();
if (pInstance)
{
if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_ANUB_GATE)))
{
go->SetGoState(GO_STATE_ACTIVE);
}
}
}
void JustSummoned(Creature* cr) override
{
if (me->IsInCombat())
{
cr->SetInCombatWithZone();
if (cr->GetEntry() == NPC_CRYPT_GUARD)
{
cr->AI()->Talk(EMOTE_SPAWN, me);
}
}
summons.Summon(cr);
}
void SummonedCreatureDies(Creature* cr, Unit*) override
{
if (cr->GetEntry() == NPC_CRYPT_GUARD)
{
cr->CastSpell(cr, SPELL_SUMMON_CORPSE_SCRABS_10, true, nullptr, nullptr, me->GetGUID());
cr->AI()->Talk(EMOTE_SCARAB);
}
}
void SummonedCreatureDespawn(Creature* cr) override
{
summons.Despawn(cr);
}
void JustDied(Unit* killer) override
{
BossAI::JustDied(killer);
summons.DespawnAll();
if (pInstance)
{
pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
}
}
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() != TYPEID_PLAYER)
return;
Talk(SAY_SLAY);
victim->CastSpell(victim, SPELL_SUMMON_CORPSE_SCRABS_5, true, nullptr, nullptr, me->GetGUID());
if (pInstance)
{
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}
}
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
me->CallForHelp(30.0f);
Talk(SAY_AGGRO);
if (pInstance)
{
if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_ANUB_GATE)))
{
go->SetGoState(GO_STATE_READY);
}
}
events.ScheduleEvent(EVENT_IMPALE, 15s);
events.ScheduleEvent(EVENT_LOCUST_SWARM, 70s, 120s);
events.ScheduleEvent(EVENT_BERSERK, 10min);
if (!summons.HasEntry(NPC_CRYPT_GUARD))
{
SummonCryptGuards();
}
if (!Is25ManRaid())
{
events.ScheduleEvent(EVENT_SPAWN_GUARD, 15s, 20s);
}
}
void MoveInLineOfSight(Unit* who) override
{
if (!sayGreet && who->GetTypeId() == TYPEID_PLAYER)
{
Talk(SAY_GREET);
sayGreet = true;
}
ScriptedAI::MoveInLineOfSight(who);
}
void UpdateAI(uint32 diff) override
{
if (!me->IsInCombat() && sayGreet)
{
for (SummonList::iterator itr = summons.begin(); itr != summons.end(); ++itr)
{
if (pInstance)
{
if (Creature* cr = pInstance->instance->GetCreature(*itr))
{
if (cr->IsInCombat())
DoZoneInCombat();
}
}
}
}
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_IMPALE:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
{
me->CastSpell(target, RAID_MODE(SPELL_IMPALE_10, SPELL_IMPALE_25), false);
}
events.Repeat(20s);
break;
case EVENT_LOCUST_SWARM:
Talk(EMOTE_LOCUST);
me->CastSpell(me, RAID_MODE(SPELL_LOCUST_SWARM_10, SPELL_LOCUST_SWARM_25), false);
events.ScheduleEvent(EVENT_SPAWN_GUARD, 3s);
events.Repeat(90s);
break;
case EVENT_SPAWN_GUARD:
me->SummonCreature(NPC_CRYPT_GUARD, 3331.217f, -3476.607f, 287.074f, 3.269f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
break;
case EVENT_BERSERK:
me->CastSpell(me, SPELL_BERSERK, true);
break;
}
DoMeleeAttackIfReady();
}
};
};
events.Repeat(20s);
break;
case EVENT_LOCUST_SWARM:
Talk(EMOTE_LOCUST);
me->CastSpell(me, RAID_MODE(SPELL_LOCUST_SWARM_10, SPELL_LOCUST_SWARM_25), false);
events.ScheduleEvent(EVENT_SPAWN_GUARD, 3s);
events.Repeat(90s);
break;
case EVENT_SPAWN_GUARD:
me->SummonCreature(NPC_CRYPT_GUARD, 3331.217f, -3476.607f, 287.074f, 3.269f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
break;
case EVENT_BERSERK:
me->CastSpell(me, SPELL_BERSERK, true);
break;
}
DoMeleeAttackIfReady();
}
void AddSC_boss_anubrekhan()
{

View File

@@ -0,0 +1,46 @@
#ifndef BOSS_ANUBREKHAN_H_
#define BOSS_ANUBREKHAN_H_
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "naxxramas.h"
class boss_anubrekhan : public CreatureScript
{
public:
boss_anubrekhan() : CreatureScript("boss_anubrekhan") { }
CreatureAI* GetAI(Creature* pCreature) const override;
struct boss_anubrekhanAI : public BossAI
{
explicit boss_anubrekhanAI(Creature* c);
InstanceScript* pInstance;
EventMap events;
SummonList summons;
bool sayGreet;
void SummonCryptGuards();
void Reset() override;
void JustSummoned(Creature* cr) override;
void SummonedCreatureDies(Creature* cr, Unit*) override;
void SummonedCreatureDespawn(Creature* cr) override;
void JustDied(Unit* killer) override;
void KilledUnit(Unit* victim) override;
void JustEngagedWith(Unit* who) override;
void MoveInLineOfSight(Unit* who) override;
void UpdateAI(uint32 diff) override;
};
};
#endif

View File

@@ -17,6 +17,252 @@
#include "boss_grobbulus.h"
enum Spells
{
SPELL_POISON_CLOUD = 28240,
SPELL_MUTATING_INJECTION = 28169,
SPELL_MUTATING_EXPLOSION = 28206,
SPELL_SLIME_SPRAY_10 = 28157,
SPELL_SLIME_SPRAY_25 = 54364,
SPELL_POISON_CLOUD_DAMAGE_AURA_10 = 28158,
SPELL_POISON_CLOUD_DAMAGE_AURA_25 = 54362,
SPELL_BERSERK = 26662,
SPELL_BOMBARD_SLIME = 28280
};
enum Emotes
{
EMOTE_SLIME = 0
};
enum Events
{
EVENT_BERSERK = 1,
EVENT_POISON_CLOUD = 2,
EVENT_SLIME_SPRAY = 3,
EVENT_MUTATING_INJECTION = 4
};
enum Misc
{
NPC_FALLOUT_SLIME = 16290,
NPC_SEWAGE_SLIME = 16375,
NPC_STICHED_GIANT = 16025
};
CreatureAI* boss_grobbulus::GetAI(Creature* pCreature) const
{
return GetNaxxramasAI<boss_grobbulusAI>(pCreature);
}
boss_grobbulus::boss_grobbulusAI::boss_grobbulusAI(Creature* c) : BossAI(c, BOSS_GROBBULUS), summons(me)
{
pInstance = me->GetInstanceScript();
}
void boss_grobbulus::boss_grobbulusAI::Reset()
{
BossAI::Reset();
events.Reset();
summons.DespawnAll();
dropSludgeTimer = 0;
}
void boss_grobbulus::boss_grobbulusAI::PullChamberAdds()
{
std::list<Creature*> StichedGiants;
me->GetCreaturesWithEntryInRange(StichedGiants, 300.0f, NPC_STICHED_GIANT);
for (std::list<Creature*>::const_iterator itr = StichedGiants.begin(); itr != StichedGiants.end(); ++itr)
{
(*itr)->ToCreature()->AI()->AttackStart(me->GetVictim());
}
}
void boss_grobbulus::boss_grobbulusAI::JustEngagedWith(Unit* who)
{
BossAI::JustEngagedWith(who);
PullChamberAdds();
me->SetInCombatWithZone();
events.ScheduleEvent(EVENT_POISON_CLOUD, 15s);
events.ScheduleEvent(EVENT_MUTATING_INJECTION, 20s);
events.ScheduleEvent(EVENT_SLIME_SPRAY, 10s);
events.ScheduleEvent(EVENT_BERSERK, RAID_MODE(720000, 540000));
}
void boss_grobbulus::boss_grobbulusAI::SpellHitTarget(Unit* target, SpellInfo const* spellInfo)
{
if (spellInfo->Id == RAID_MODE(SPELL_SLIME_SPRAY_10, SPELL_SLIME_SPRAY_25) && target->GetTypeId() == TYPEID_PLAYER)
{
me->SummonCreature(NPC_FALLOUT_SLIME, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
}
}
void boss_grobbulus::boss_grobbulusAI::JustSummoned(Creature* cr)
{
if (cr->GetEntry() == NPC_FALLOUT_SLIME)
{
cr->SetInCombatWithZone();
}
summons.Summon(cr);
}
void boss_grobbulus::boss_grobbulusAI::SummonedCreatureDespawn(Creature* summon)
{
summons.Despawn(summon);
}
void boss_grobbulus::boss_grobbulusAI::JustDied(Unit* killer)
{
BossAI::JustDied(killer);
summons.DespawnAll();
}
void boss_grobbulus::boss_grobbulusAI::KilledUnit(Unit* who)
{
if (who->GetTypeId() == TYPEID_PLAYER && pInstance)
{
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}
}
void boss_grobbulus::boss_grobbulusAI::UpdateAI(uint32 diff)
{
dropSludgeTimer += diff;
if (!me->IsInCombat() && dropSludgeTimer >= 5000)
{
if (me->IsWithinDist3d(3178, -3305, 319, 5.0f) && !summons.HasEntry(NPC_SEWAGE_SLIME))
{
me->CastSpell(3128.96f + irand(-20, 20), -3312.96f + irand(-20, 20), 293.25f, SPELL_BOMBARD_SLIME, false);
}
dropSludgeTimer = 0;
}
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_POISON_CLOUD:
me->CastSpell(me, SPELL_POISON_CLOUD, true);
events.Repeat(15s);
break;
case EVENT_BERSERK:
me->CastSpell(me, SPELL_BERSERK, true);
break;
case EVENT_SLIME_SPRAY:
Talk(EMOTE_SLIME);
me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_SLIME_SPRAY_10, SPELL_SLIME_SPRAY_25), false);
events.Repeat(20s);
break;
case EVENT_MUTATING_INJECTION:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, true, -SPELL_MUTATING_INJECTION))
{
me->CastSpell(target, SPELL_MUTATING_INJECTION, false);
}
events.RepeatEvent(6000 + uint32(120 * me->GetHealthPct()));
break;
}
DoMeleeAttackIfReady();
}
CreatureAI* boss_grobbulus_poison_cloud::GetAI(Creature* pCreature) const
{
return GetNaxxramasAI<boss_grobbulus_poison_cloudAI>(pCreature);
}
void boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::Reset()
{
sizeTimer = 0;
auraVisualTimer = 1;
me->SetFloatValue(UNIT_FIELD_COMBATREACH, 2.0f);
me->SetFaction(FACTION_BOOTY_BAY);
}
void boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::KilledUnit(Unit* who)
{
if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript())
{
me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0);
}
}
void boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::UpdateAI(uint32 diff)
{
if (auraVisualTimer) // this has to be delayed to be visible
{
auraVisualTimer += diff;
if (auraVisualTimer >= 1000)
{
me->CastSpell(me, (me->GetMap()->Is25ManRaid() ? SPELL_POISON_CLOUD_DAMAGE_AURA_25 : SPELL_POISON_CLOUD_DAMAGE_AURA_10), true);
auraVisualTimer = 0;
}
}
sizeTimer += diff; // increase size to 15yd in 60 seconds, 0.00025 is the growth of size in 1ms
me->SetFloatValue(UNIT_FIELD_COMBATREACH, 2.0f + (0.00025f * sizeTimer));
}
void spell_grobbulus_poison::spell_grobbulus_poison_SpellScript::FilterTargets(std::list<WorldObject*>& targets)
{
std::list<WorldObject*> tmplist;
for (auto& target : targets)
{
if (GetCaster()->IsWithinDist3d(target, 0.0f))
{
tmplist.push_back(target);
}
}
targets.clear();
for (auto& itr : tmplist)
{
targets.push_back(itr);
}
}
void spell_grobbulus_poison::spell_grobbulus_poison_SpellScript::Register()
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_grobbulus_poison_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
SpellScript* spell_grobbulus_poison::GetSpellScript() const
{
return new spell_grobbulus_poison_SpellScript();
}
bool spell_grobbulus_mutating_injection::spell_grobbulus_mutating_injection_AuraScript::Validate(SpellInfo const* /*spellInfo*/)
{
return ValidateSpellInfo({ SPELL_MUTATING_EXPLOSION });
}
void spell_grobbulus_mutating_injection::spell_grobbulus_mutating_injection_AuraScript::HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
switch (GetTargetApplication()->GetRemoveMode())
{
case AURA_REMOVE_BY_ENEMY_SPELL:
case AURA_REMOVE_BY_EXPIRE:
if (auto caster = GetCaster())
{
caster->CastSpell(GetTarget(), SPELL_MUTATING_EXPLOSION, true);
}
break;
default:
return;
}
}
void spell_grobbulus_mutating_injection::spell_grobbulus_mutating_injection_AuraScript::Register()
{
AfterEffectRemove += AuraEffectRemoveFn(spell_grobbulus_mutating_injection_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
AuraScript* spell_grobbulus_mutating_injection::GetAuraScript() const
{
return new spell_grobbulus_mutating_injection_AuraScript();
}
void AddSC_boss_grobbulus()
{
new boss_grobbulus();

View File

@@ -9,169 +9,41 @@
#include "SpellScript.h"
#include "naxxramas.h"
enum Spells
{
SPELL_POISON_CLOUD = 28240,
SPELL_MUTATING_INJECTION = 28169,
SPELL_MUTATING_EXPLOSION = 28206,
SPELL_SLIME_SPRAY_10 = 28157,
SPELL_SLIME_SPRAY_25 = 54364,
SPELL_POISON_CLOUD_DAMAGE_AURA_10 = 28158,
SPELL_POISON_CLOUD_DAMAGE_AURA_25 = 54362,
SPELL_BERSERK = 26662,
SPELL_BOMBARD_SLIME = 28280
};
enum Emotes
{
EMOTE_SLIME = 0
};
enum Events
{
EVENT_BERSERK = 1,
EVENT_POISON_CLOUD = 2,
EVENT_SLIME_SPRAY = 3,
EVENT_MUTATING_INJECTION = 4
};
enum Misc
{
NPC_FALLOUT_SLIME = 16290,
NPC_SEWAGE_SLIME = 16375,
NPC_STICHED_GIANT = 16025
};
class boss_grobbulus : public CreatureScript
{
public:
boss_grobbulus() : CreatureScript("boss_grobbulus") { }
CreatureAI* GetAI(Creature* pCreature) const override
{
return GetNaxxramasAI<boss_grobbulusAI>(pCreature);
}
CreatureAI* GetAI(Creature* pCreature) const override;
struct boss_grobbulusAI : public BossAI
{
explicit boss_grobbulusAI(Creature* c) : BossAI(c, BOSS_GROBBULUS), summons(me)
{
pInstance = me->GetInstanceScript();
}
explicit boss_grobbulusAI(Creature* c);
EventMap events;
SummonList summons;
InstanceScript* pInstance;
uint32 dropSludgeTimer{};
void Reset() override
{
BossAI::Reset();
events.Reset();
summons.DespawnAll();
dropSludgeTimer = 0;
}
void Reset() override;
void PullChamberAdds()
{
std::list<Creature*> StichedGiants;
me->GetCreaturesWithEntryInRange(StichedGiants, 300.0f, NPC_STICHED_GIANT);
for (std::list<Creature*>::const_iterator itr = StichedGiants.begin(); itr != StichedGiants.end(); ++itr)
{
(*itr)->ToCreature()->AI()->AttackStart(me->GetVictim());
}
}
void PullChamberAdds();
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
PullChamberAdds();
me->SetInCombatWithZone();
events.ScheduleEvent(EVENT_POISON_CLOUD, 15s);
events.ScheduleEvent(EVENT_MUTATING_INJECTION, 20s);
events.ScheduleEvent(EVENT_SLIME_SPRAY, 10s);
events.ScheduleEvent(EVENT_BERSERK, RAID_MODE(720000, 540000));
}
void JustEngagedWith(Unit* who) override;
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == RAID_MODE(SPELL_SLIME_SPRAY_10, SPELL_SLIME_SPRAY_25) && target->GetTypeId() == TYPEID_PLAYER)
{
me->SummonCreature(NPC_FALLOUT_SLIME, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
}
}
void SpellHitTarget(Unit* target, SpellInfo const* spellInfo) override;
void JustSummoned(Creature* cr) override
{
if (cr->GetEntry() == NPC_FALLOUT_SLIME)
{
cr->SetInCombatWithZone();
}
summons.Summon(cr);
}
void JustSummoned(Creature* cr) override;
void SummonedCreatureDespawn(Creature* summon) override
{
summons.Despawn(summon);
}
void SummonedCreatureDespawn(Creature* summon) override;
void JustDied(Unit* killer) override
{
BossAI::JustDied(killer);
summons.DespawnAll();
}
void JustDied(Unit* killer) override;
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && pInstance)
{
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}
}
void KilledUnit(Unit* who) override;
void UpdateAI(uint32 diff) override
{
dropSludgeTimer += diff;
if (!me->IsInCombat() && dropSludgeTimer >= 5000)
{
if (me->IsWithinDist3d(3178, -3305, 319, 5.0f) && !summons.HasEntry(NPC_SEWAGE_SLIME))
{
me->CastSpell(3128.96f + irand(-20, 20), -3312.96f + irand(-20, 20), 293.25f, SPELL_BOMBARD_SLIME, false);
}
dropSludgeTimer = 0;
}
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
switch (events.ExecuteEvent())
{
case EVENT_POISON_CLOUD:
me->CastSpell(me, SPELL_POISON_CLOUD, true);
events.Repeat(15s);
break;
case EVENT_BERSERK:
me->CastSpell(me, SPELL_BERSERK, true);
break;
case EVENT_SLIME_SPRAY:
Talk(EMOTE_SLIME);
me->CastSpell(me->GetVictim(), RAID_MODE(SPELL_SLIME_SPRAY_10, SPELL_SLIME_SPRAY_25), false);
events.Repeat(20s);
break;
case EVENT_MUTATING_INJECTION:
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true, true, -SPELL_MUTATING_INJECTION))
{
me->CastSpell(target, SPELL_MUTATING_INJECTION, false);
}
events.RepeatEvent(6000 + uint32(120 * me->GetHealthPct()));
break;
}
DoMeleeAttackIfReady();
}
void UpdateAI(uint32 diff) override;
};
};
@@ -180,10 +52,7 @@ class boss_grobbulus_poison_cloud : public CreatureScript
public:
boss_grobbulus_poison_cloud() : CreatureScript("boss_grobbulus_poison_cloud") { }
CreatureAI* GetAI(Creature* pCreature) const override
{
return GetNaxxramasAI<boss_grobbulus_poison_cloudAI>(pCreature);
}
CreatureAI* GetAI(Creature* pCreature) const override;
struct boss_grobbulus_poison_cloudAI : public NullCreatureAI
{
@@ -192,36 +61,11 @@ public:
uint32 sizeTimer{};
uint32 auraVisualTimer{};
void Reset() override
{
sizeTimer = 0;
auraVisualTimer = 1;
me->SetFloatValue(UNIT_FIELD_COMBATREACH, 2.0f);
me->SetFaction(FACTION_BOOTY_BAY);
}
void Reset() override;
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript())
{
me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0);
}
}
void KilledUnit(Unit* who) override;
void UpdateAI(uint32 diff) override
{
if (auraVisualTimer) // this has to be delayed to be visible
{
auraVisualTimer += diff;
if (auraVisualTimer >= 1000)
{
me->CastSpell(me, (me->GetMap()->Is25ManRaid() ? SPELL_POISON_CLOUD_DAMAGE_AURA_25 : SPELL_POISON_CLOUD_DAMAGE_AURA_10), true);
auraVisualTimer = 0;
}
}
sizeTimer += diff; // increase size to 15yd in 60 seconds, 0.00025 is the growth of size in 1ms
me->SetFloatValue(UNIT_FIELD_COMBATREACH, 2.0f + (0.00025f * sizeTimer));
}
void UpdateAI(uint32 diff) override;
};
};
@@ -234,33 +78,12 @@ public:
{
PrepareSpellScript(spell_grobbulus_poison_SpellScript);
void FilterTargets(std::list<WorldObject*>& targets)
{
std::list<WorldObject*> tmplist;
for (auto& target : targets)
{
if (GetCaster()->IsWithinDist3d(target, 0.0f))
{
tmplist.push_back(target);
}
}
targets.clear();
for (auto& itr : tmplist)
{
targets.push_back(itr);
}
}
void FilterTargets(std::list<WorldObject*>& targets);
void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_grobbulus_poison_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
void Register() override;
};
SpellScript* GetSpellScript() const override
{
return new spell_grobbulus_poison_SpellScript();
}
SpellScript* GetSpellScript() const override;
};
class spell_grobbulus_mutating_injection : public SpellScriptLoader
@@ -272,37 +95,14 @@ class spell_grobbulus_mutating_injection : public SpellScriptLoader
{
PrepareAuraScript(spell_grobbulus_mutating_injection_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_MUTATING_EXPLOSION });
}
bool Validate(SpellInfo const* /*spellInfo*/) override;
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
switch (GetTargetApplication()->GetRemoveMode())
{
case AURA_REMOVE_BY_ENEMY_SPELL:
case AURA_REMOVE_BY_EXPIRE:
if (auto caster = GetCaster())
{
caster->CastSpell(GetTarget(), SPELL_MUTATING_EXPLOSION, true);
}
break;
default:
return;
}
}
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/);
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_grobbulus_mutating_injection_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
void Register() override;
};
AuraScript* GetAuraScript() const override
{
return new spell_grobbulus_mutating_injection_AuraScript();
}
AuraScript* GetAuraScript() const override;
};
#endif

View File

@@ -1,5 +1,5 @@
#ifndef BOSSHEIGAN_H_
#define BOSSHEIGAN_H_
#ifndef BOSS_HEIGAN_H_
#define BOSS_HEIGAN_H_
#include "Player.h"
#include "ScriptMgr.h"