This commit is contained in:
Jelle Meeus
2025-07-13 10:35:57 +02:00
parent af0cc22a49
commit b14029d3af

View File

@@ -18,6 +18,7 @@
#include "CreatureScript.h" #include "CreatureScript.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "naxxramas.h" #include "naxxramas.h"
#include "SpellInfo.h"
enum Says enum Says
{ {
@@ -48,7 +49,7 @@ enum Events
enum NPCs enum NPCs
{ {
NPC_DEATH_KNIGHT_UNDERSTUDY = 351084, // NPC_DEATH_KNIGHT_UNDERSTUDY = 351084,
NPC_TARGET_DUMMY = 16211, NPC_TARGET_DUMMY = 16211,
}; };
@@ -80,13 +81,10 @@ public:
struct boss_razuvious_40AI : public BossAI struct boss_razuvious_40AI : public BossAI
{ {
explicit boss_razuvious_40AI(Creature* c) : BossAI(c, BOSS_RAZUVIOUS), summons(me) explicit boss_razuvious_40AI(Creature* c) : BossAI(c, BOSS_RAZUVIOUS), summons(me)
{ {}
pInstance = me->GetInstanceScript();
}
EventMap events; EventMap events;
SummonList summons; SummonList summons;
InstanceScript* pInstance;
void SpawnHelpers() void SpawnHelpers()
{ {
@@ -207,19 +205,16 @@ public:
void KilledUnit(Unit* who) override void KilledUnit(Unit* who) override
{ {
if (roll_chance_i(30)) if (roll_chance_i(30))
{
Talk(SAY_SLAY); Talk(SAY_SLAY);
}
if (who->GetTypeId() == TYPEID_PLAYER && pInstance) if (who->IsPlayer())
{ instance->StorePersistentData(PERSISTENT_DATA_IMMORTAL_FAIL, 1);
pInstance->SetData(DATA_IMMORTAL_FAIL, 0);
}
} }
void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) override void DamageTaken(Unit* who, uint32& damage, DamageEffectType, SpellSchoolMask) override
{ {
// Damage done by the controlled Death Knight understudies should also count toward damage done by players // Damage done by the controlled Death Knight understudies should also count toward damage done by players
if(who && who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == NPC_DEATH_KNIGHT_UNDERSTUDY) if (who && who->IsCreature() && who->GetEntry() == NPC_DEATH_KNIGHT_UNDERSTUDY)
{ {
me->LowerPlayerDamageReq(damage); me->LowerPlayerDamageReq(damage);
} }
@@ -331,13 +326,8 @@ public:
scheduler.CancelGroup(GROUP_OOC_RP); scheduler.CancelGroup(GROUP_OOC_RP);
me->SetSheath(SHEATH_STATE_UNARMED); me->SetSheath(SHEATH_STATE_UNARMED);
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
if (InstanceScript* instance = me->GetInstanceScript()) if (Creature* creature = me->GetInstanceScript()->GetCreature(DATA_RAZUVIOUS_BOSS))
{ me->SetFacingToObject(creature);
if (Creature* creature = instance->GetCreature(DATA_RAZUVIOUS_40))
{
me->SetFacingToObject(creature);
}
}
break; break;
case ACTION_TALK: case ACTION_TALK:
Talk(SAY_DEATH_KNIGHT_UNDERSTUDY); Talk(SAY_DEATH_KNIGHT_UNDERSTUDY);
@@ -357,22 +347,18 @@ public:
void KilledUnit(Unit* who) override void KilledUnit(Unit* who) override
{ {
if (who->GetTypeId() == TYPEID_PLAYER && me->GetInstanceScript()) if (who->IsPlayer())
{ me->GetInstanceScript()->StorePersistentData(PERSISTENT_DATA_IMMORTAL_FAIL, 1);
me->GetInstanceScript()->SetData(DATA_IMMORTAL_FAIL, 0);
}
} }
void JustEngagedWith(Unit* who) override void JustEngagedWith(Unit* who) override
{ {
scheduler.CancelGroup(GROUP_OOC_RP); scheduler.CancelGroup(GROUP_OOC_RP);
if (InstanceScript* instance = me->GetInstanceScript())
if (Creature* creature = me->GetInstanceScript()->GetCreature(DATA_RAZUVIOUS_BOSS))
{ {
if (Creature* creature = instance->GetCreature(DATA_RAZUVIOUS_40)) creature->SetInCombatWithZone();
{ creature->AI()->AttackStart(who);
creature->SetInCombatWithZone();
creature->AI()->AttackStart(who);
}
} }
} }