This commit is contained in:
Jelle Meeus
2025-07-13 10:33:12 +02:00
parent 66a2f1ff73
commit 3721bfee19

View File

@@ -15,29 +15,33 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "ScriptMgr.h" #include "CreatureScript.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "naxxramas.h" #include "naxxramas.h"
enum Spells enum Spells
{ {
SPELL_NECROTIC_AURA = 55593, SPELL_NECROTIC_AURA = 55593,
// SPELL_CORRUPTED_MIND = 29201, // this triggers the following spells on targets (based on class): 29185, 29194, 29196, 29198 // SPELL_SUMMON_SPORE = 29234,
// SPELL_POISON_AURA = 29865, // does 200 dmg every second for 6 seconds with 1200 extra damage at the end. should do 196 dmg every 6 seconds. no extra damage at the end. // SPELL_DEATHBLOOM_10 = 29865, // does 200 dmg every second for 6 seconds with 1200 extra damage at the end. should do 196 dmg every 6 seconds. no extra damage at the end.
SPELL_POISON_SHOCK = 22595, // does 180-220 aoe poison damage. if we let loatheb recast this every 6 seconds it's a possible fix for poison aura. SPELL_POISON_SHOCK = 22595, // does 180-220 aoe poison damage. if Loatheb recasts this every 6 seconds it's a possible fix for poison aura.
// SPELL_DEATHBLOOM_25 = 55053,
SPELL_INEVITABLE_DOOM = 29204, SPELL_INEVITABLE_DOOM = 29204,
//SPELL_INEVITABLE_DOOM_25 = 55052,
// SPELL_BERSERK = 26662, // he doesn't cast berserk in Naxx40
SPELL_REMOVE_CURSE = 30281 // He periodically removes all curses on himself SPELL_REMOVE_CURSE = 30281 // He periodically removes all curses on himself
}; };
enum Events enum Events
{ {
// EVENT_CORRUPTED_MIND = 1, EVENT_NECROTIC_AURA = 1,
EVENT_NECROTIC_AURA = 1, // EVENT_DEATHBLOOM = 2,
EVENT_POISON_SHOCK = 2, EVENT_POISON_SHOCK = 2,
EVENT_INEVITABLE_DOOM = 3, EVENT_INEVITABLE_DOOM = 3,
EVENT_SUMMON_SPORE = 4, // EVENT_BERSERK = 4,
EVENT_REMOVE_CURSE = 5, EVENT_REMOVE_CURSE = 4,
EVENT_NECROTIC_AURA_FADING = 6, EVENT_SUMMON_SPORE = 5,
EVENT_NECROTIC_AURA_FADING = 6,
EVENT_NECROTIC_AURA_REMOVED = 7 EVENT_NECROTIC_AURA_REMOVED = 7
}; };
@@ -62,11 +66,9 @@ public:
{ {
explicit boss_loatheb_40AI(Creature* c) : BossAI(c, BOSS_LOATHEB), summons(me) explicit boss_loatheb_40AI(Creature* c) : BossAI(c, BOSS_LOATHEB), summons(me)
{ {
pInstance = me->GetInstanceScript();
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
} }
InstanceScript* pInstance;
uint8 doomCounter; uint8 doomCounter;
EventMap events; EventMap events;
SummonList summons; SummonList summons;
@@ -77,14 +79,6 @@ public:
events.Reset(); events.Reset();
summons.DespawnAll(); summons.DespawnAll();
doomCounter = 0; doomCounter = 0;
if (pInstance)
{
pInstance->SetData(BOSS_LOATHEB, NOT_STARTED);
if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_LOATHEB_GATE)))
{
go->SetGoState(GO_STATE_ACTIVE);
}
}
} }
void JustSummoned(Creature* cr) override void JustSummoned(Creature* cr) override
@@ -95,48 +89,32 @@ public:
void SummonedCreatureDies(Creature* /*cr*/, Unit*) override void SummonedCreatureDies(Creature* /*cr*/, Unit*) override
{ {
if (pInstance) instance->SetData(DATA_SPORE_KILLED, 0);
{
pInstance->SetData(DATA_SPORE_KILLED, 0);
}
} }
void KilledUnit(Unit* who) override void KilledUnit(Unit* who) override
{ {
if (who->GetTypeId() == TYPEID_PLAYER && pInstance) if (who->IsPlayer())
{ instance->StorePersistentData(PERSISTENT_DATA_IMMORTAL_FAIL, 1);
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}
} }
void JustEngagedWith(Unit* who) override void JustEngagedWith(Unit* who) override
{ {
BossAI::JustEngagedWith(who); BossAI::JustEngagedWith(who);
me->SetInCombatWithZone(); me->SetInCombatWithZone();
// events.ScheduleEvent(EVENT_CORRUPTED_MIND, 5000); events.ScheduleEvent(EVENT_NECROTIC_AURA, 10s);
events.ScheduleEvent(EVENT_NECROTIC_AURA, 10000); // events.ScheduleEvent(EVENT_DEATHBLOOM, 5s);
events.ScheduleEvent(EVENT_POISON_SHOCK, 6000); events.ScheduleEvent(EVENT_POISON_SHOCK, 5s);
events.ScheduleEvent(EVENT_INEVITABLE_DOOM, 120000); events.ScheduleEvent(EVENT_INEVITABLE_DOOM, 2min);
events.ScheduleEvent(EVENT_SUMMON_SPORE, 13000); events.ScheduleEvent(EVENT_SUMMON_SPORE, 15s);
events.ScheduleEvent(EVENT_REMOVE_CURSE, 5000); // events.ScheduleEvent(EVENT_BERSERK, 12min);
if (pInstance) events.ScheduleEvent(EVENT_REMOVE_CURSE, 5s);
{
pInstance->SetData(BOSS_LOATHEB, IN_PROGRESS);
if (GameObject* go = me->GetMap()->GetGameObject(pInstance->GetGuidData(DATA_LOATHEB_GATE)))
{
go->SetGoState(GO_STATE_READY);
}
}
} }
void JustDied(Unit* killer) override void JustDied(Unit* killer) override
{ {
BossAI::JustDied(killer); BossAI::JustDied(killer);
summons.DespawnAll(); summons.DespawnAll();
if (pInstance)
{
pInstance->SetData(BOSS_LOATHEB, DONE);
}
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
@@ -151,77 +129,59 @@ public:
switch (events.ExecuteEvent()) switch (events.ExecuteEvent())
{ {
case EVENT_SUMMON_SPORE: case EVENT_SUMMON_SPORE:
{
me->CastSpell(me, SPELL_SUMMON_SPORE, true); me->CastSpell(me, SPELL_SUMMON_SPORE, true);
events.RepeatEvent(13000); events.Repeat(13s);
break; break;
}
case EVENT_NECROTIC_AURA: case EVENT_NECROTIC_AURA:
{
me->CastSpell(me, SPELL_NECROTIC_AURA, true); me->CastSpell(me, SPELL_NECROTIC_AURA, true);
Talk(SAY_NECROTIC_AURA_APPLIED); Talk(SAY_NECROTIC_AURA_APPLIED);
events.ScheduleEvent(EVENT_NECROTIC_AURA_FADING, 14000); events.ScheduleEvent(EVENT_NECROTIC_AURA_FADING, 14s);
events.ScheduleEvent(EVENT_NECROTIC_AURA_REMOVED, 17000); events.ScheduleEvent(EVENT_NECROTIC_AURA_REMOVED, 17s);
events.RepeatEvent(20000); events.Repeat(20s);
break; break;
} /*
/* case EVENT_DEATHBLOOM:
case EVENT_CORRUPTED_MIND:
{ {
if (me->CastSpell(me, SPELL_CORRUPTED_MIND, true) == SPELL_CAST_OK) int32 bp0 = 33; // TODO: Amplitude should be 6k, but is 1k. 200 dmg after 6 seconds
{ me->CastCustomSpell(me, SPELL_DEATHBLOOM_10, &bp0, 0, 0, false);
events.RepeatEvent(10000); events.Repeat(30s);
}
else
{
events.RepeatEvent(100);
}
break; break;
} }
*/ */
case EVENT_POISON_SHOCK: case EVENT_POISON_SHOCK:
{ if (me->CastSpell(me, SPELL_POISON_SHOCK, true) == SPELL_CAST_OK)
if (me->CastSpell(me, SPELL_POISON_SHOCK, true) == SPELL_CAST_OK)
{
events.RepeatEvent(6000); events.RepeatEvent(6000);
} else
else events.RepeatEvent(100);
{ break;
events.RepeatEvent(100);
}
break;
}
case EVENT_INEVITABLE_DOOM: case EVENT_INEVITABLE_DOOM:
{ {
int32 bp0 = 2549; int32 bp0 = 2549;
if (me->CastCustomSpell(me, SPELL_INEVITABLE_DOOM, &bp0, 0, 0, false) == SPELL_CAST_OK) if (me->CastCustomSpell(me, SPELL_INEVITABLE_DOOM, &bp0, 0, 0, false) == SPELL_CAST_OK)
{ {
doomCounter++; doomCounter++;
events.RepeatEvent(doomCounter < 6 ? 30000 : 15000); events.Repeat(doomCounter < 6 ? 30s : 15s);
} }
else else
{ events.RepeatEvent(100);
events.RepeatEvent(100);
}
break; break;
} }
/*
case EVENT_BERSERK:
me->CastSpell(me, SPELL_BERSERK, true);
break;
*/
case EVENT_REMOVE_CURSE: case EVENT_REMOVE_CURSE:
{
me->CastSpell(me, SPELL_REMOVE_CURSE, true); me->CastSpell(me, SPELL_REMOVE_CURSE, true);
events.RepeatEvent(30000); events.Repeat(30s);
break; break;
}
case EVENT_NECROTIC_AURA_FADING: case EVENT_NECROTIC_AURA_FADING:
{
Talk(SAY_NECROTIC_AURA_FADING); Talk(SAY_NECROTIC_AURA_FADING);
break; break;
}
case EVENT_NECROTIC_AURA_REMOVED: case EVENT_NECROTIC_AURA_REMOVED:
{
Talk(SAY_NECROTIC_AURA_REMOVED); Talk(SAY_NECROTIC_AURA_REMOVED);
break; break;
}
} }
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
@@ -237,54 +197,11 @@ public:
return false; return false;
} }
return true; return true;
} }
}; };
}; };
/*
// 29201 - Corrupted Mind (Loatheb)
class spell_loatheb_corrupted_mind_aoe_40 : public SpellScript
{
PrepareSpellScript(spell_loatheb_corrupted_mind_aoe_40);
void HandleEffect(Spell* spell, SpellEffIndex effIndex)
{
// Loatheb Corrupted Mind triggered sub spells
uint32 spellid;
switch (spell->GetTarget()->GetClass())
{
// priests should be getting 29185, but it triggers on dmg effects as well, don't know why.
case CLASS_PRIEST: spellid = 29194; break;//29185; break;
case CLASS_DRUID: spellid = 29194; break;
case CLASS_PALADIN: spellid = 29196; break;
case CLASS_SHAMAN: spellid = 29198; break;
default: return false;
}
spell->me->CastSpell(spell->GetTarget(), spellid, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_loatheb_corrupted_mind_aoe_40::HandleEffect, SPELL_CORRUPTED_MIND, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL);
}
};
class spell_loatheb_corrupted_mind_loader : public SpellScriptLoader
{
public:
spell_loatheb_corrupted_mind_loader() : SpellScriptLoader("spell_loatheb_corrupted_mind_aoe_40") { }
SpellScript* GetSpellScript() const override
{
return new spell_loatheb_corrupted_mind_aoe_40();
}
};
*/
void AddSC_boss_loatheb_40() void AddSC_boss_loatheb_40()
{ {
new boss_loatheb_40(); new boss_loatheb_40();
// new spell_loatheb_corrupted_mind_loader();
} }