Skip to content

Commit

Permalink
Merge pull request #189 from Day36512/master
Browse files Browse the repository at this point in the history
Fixed Naxx40 Maexxna
  • Loading branch information
ZhengPeiRu21 authored Sep 27, 2023
2 parents 55f6bee + 8c687ed commit f1c20c5
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 74 deletions.
2 changes: 1 addition & 1 deletion sql/world/base/naxx40_creatures.sql
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ REPLACE INTO `creature_template` (`entry`, `modelid1`, `name`, `subname`, `minle
(351076, 16586, "Guardian of Icecrown", "", 60, 60, 21, 4.8, 1.71429, 20.0, 1.0, 1, 0, 20.75, 2000, 1650, 1.0, 1.0, 1, 0, 2048, 0, 6, 72, 0, 0, 0, 0, 0, '', 1, 1.0, 500.0, 1.0, 1.1, 1.0, 174, 1, 1019427442, 0, 0, 'boss_kelthuzad_minion_40'),
(351077, 14710, "Plagued Gargoyle", "", 61, 61, 21, 1.0, 1.42857, 20.0, 1.0, 1, 0, 37.5, 3000, 1265, 1.0, 1.0, 2, 0, 2048, 0, 6, 8, 351077, 0, 0, 1, 138065, '', 0, 1.0, 100.0, 3.0, 1.45, 1.0, 144, 1, 1073725439, 0, 0, ''),
(351078, 10627, "Plagued Ghoul", "", 61, 61, 21, 0.777776, 1.42857, 20.0, 1.0, 1, 0, 26.25, 1500, 1265, 1.0, 1.0, 1, 32832, 2048, 0, 6, 72, 351078, 0, 0, 3878, 8925, 'SmartAI', 0, 1.0, 30.0, 1.0, 1.15, 1.0, 144, 1, 1021518352, 0, 0, ''),
(351079, 16213, "Web Wrap", "", 60, 60, 16, 1.0, 1.0, 18.0, 1.0, 0, 0, 0.6, 2000, 2000, 1.0, 1.0, 1, 0, 2048, 0, 10, 0, 0, 0, 0, 0, 0, '', 0, 1.0, 2.0, 1.0, 0.7, 1.0, 0, 1, 0, 0, 0, 'boss_maexxna_webwrap'),
(351079, 16213, "Web Wrap", "", 60, 60, 16, 1.0, 1.0, 18.0, 1.0, 0, 0, 0.6, 2000, 2000, 1.0, 1.0, 1, 0, 2048, 0, 10, 0, 0, 0, 0, 0, 0, '', 0, 1.0, 2.0, 1.0, 0.7, 1.0, 0, 1, 0, 0, 0, 'boss_maexxna_webwrap40'),
(351080, 16605, "Naxxramas Follower", "", 61, 61, 21, 1.0, 1.42857, 20.0, 1.0, 1, 0, 59.2, 2000, 1265, 1.0, 1.0, 8, 32832, 2048, 0, 7, 72, 0, 0, 0, 0, 0, 'SmartAI', 0, 1.0, 45.0, 10.0, 1.15, 1.0, 144, 1, 1023391482, 0, 0, ''),
(351081, 16603, "Naxxramas Worshipper", "", 61, 61, 21, 1.0, 1.42857, 20.0, 1.0, 1, 0, 35.0, 2000, 1265, 1.0, 1.0, 8, 32832, 2048, 0, 7, 72, 0, 0, 0, 0, 0, 'SmartAI', 0, 1.0, 40.0, 10.0, 1.0, 1.0, 144, 1, 1023391482, 0, 0, ''),
(351082, 14698, "Crypt Guard", "", 61, 61, 21, 1.0, 1.42857, 20.0, 1.0, 1, 0, 14.7, 1000, 1265, 1.0, 1.0, 1, 64, 2048, 0, 6, 72, 0, 0, 0, 0, 0, 'SmartAI', 0, 1.0, 65.0, 1.0, 1.15, 1.0, 144, 1, 1023391482, 0, 0, ''),
Expand Down
20 changes: 13 additions & 7 deletions src/naxx40Scripts/boss_anubrekhan_40.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum Spells
{
SPELL_IMPALE = 28783,
SPELL_LOCUST_SWARM = 28785,
SPELL_LOCUST_SWARM_TRIGGER = 28786, // periodic effect
SPELL_SUMMON_CORPSE_SCRABS_5 = 90001, // Changed from 29105 to Level 60 Mob ID for summon
SPELL_SUMMON_CORPSE_SCRABS_10 = 90002, // Changed from 29105 to Level 60 Mob ID for summon
SPELL_BERSERK = 26662
Expand Down Expand Up @@ -89,13 +90,11 @@ class boss_anubrekhan_40 : public CreatureScript

void SummonCryptGuards()
{
if (Is25ManRaid())
{
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->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 Reset() override
{
BossAI::Reset();
Expand Down Expand Up @@ -164,7 +163,7 @@ class boss_anubrekhan_40 : public CreatureScript
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
me->CallForHelp(30.0f);
me->CallForHelp(60.0f);
Talk(SAY_AGGRO);
if (pInstance)
{
Expand Down Expand Up @@ -232,14 +231,21 @@ class boss_anubrekhan_40 : public CreatureScript
events.RepeatEvent(20000);
break;
case EVENT_LOCUST_SWARM:
{
Talk(EMOTE_LOCUST);
// Set damage for periodic trigger effect to a random value between 875 and 1125
int32 modifiedLocustSwarmDamage = urand(875, 1125);
me->CastSpell(me, SPELL_LOCUST_SWARM, false);
// Update the periodic trigger effect with custom damage
me->CastCustomSpell(me, SPELL_LOCUST_SWARM_TRIGGER, &modifiedLocustSwarmDamage, nullptr, nullptr, true, nullptr, nullptr, me->GetGUID());

events.ScheduleEvent(EVENT_SPAWN_GUARD, 3000);
events.RepeatEvent(90000);
break;
}
case EVENT_SPAWN_GUARD:
me->SummonCreature(NPC_CRYPT_GUARD, 3331.217f, -3476.607f, 287.074f, 3.269f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
break;
break;
case EVENT_BERSERK:
me->CastSpell(me, SPELL_BERSERK, true);
break;
Expand Down
185 changes: 119 additions & 66 deletions src/naxx40Scripts/boss_maexxna_40.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,44 @@
*/

#include "PassiveAI.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellAuras.h"
#include "naxxramas.h"


enum Spells
{
SPELL_WEB_WRAP = 28622,
SPELL_WEB_SPRAY = 29484,
SPELL_POISON_SHOCK = 28741,
SPELL_NECROTIC_POISON = 54121,
SPELL_FRENZY = 54123,
SPELL_WEB_WRAP = 28622,
SPELL_WEB_SPRAY = 29484,
SPELL_POISON_SHOCK = 28741,
SPELL_NECROTIC_POISON = 54121,
SPELL_FRENZY = 54123,
};

enum Events
{
EVENT_WEB_SPRAY = 1,
EVENT_POISON_SHOCK = 2,
EVENT_NECROTIC_POISON = 3,
EVENT_WEB_WRAP = 4,
EVENT_HEALTH_CHECK = 5,
EVENT_SUMMON_SPIDERLINGS = 6
EVENT_WEB_SPRAY = 1,
EVENT_POISON_SHOCK = 2,
EVENT_NECROTIC_POISON = 3,
EVENT_WEB_WRAP = 4,
EVENT_HEALTH_CHECK = 5,
EVENT_SUMMON_SPIDERLINGS = 6,
EVENT_MODIFY_WEB_SPRAY_AURA = 7
};

enum Emotes
{
EMOTE_SPIDERS = 0,
EMOTE_WEB_WRAP = 1,
EMOTE_WEB_SPRAY = 2
EMOTE_SPIDERS = 0,
EMOTE_WEB_WRAP = 1,
EMOTE_WEB_SPRAY = 2
};

enum Misc
{
NPC_WEB_WRAP = 351079,
NPC_MAEXXNA_SPIDERLING = 351088
NPC_WEB_WRAP = 351079,
NPC_MAEXXNA_SPIDERLING = 351088
};

const Position PosWrap[3] =
Expand All @@ -59,6 +63,8 @@ const Position PosWrap[3] =
{3497.067f, -3843.384f, 302.384f, 0.0f}
};



class boss_maexxna_40 : public CreatureScript
{
public:
Expand Down Expand Up @@ -144,7 +150,7 @@ class boss_maexxna_40 : public CreatureScript
}
}

void JustDied(Unit* killer) override
void JustDied(Unit* killer) override
{
BossAI::JustDied(killer);
summons.DespawnAll();
Expand All @@ -164,94 +170,141 @@ class boss_maexxna_40 : public CreatureScript

switch (events.ExecuteEvent())
{
case EVENT_WEB_SPRAY:
Talk(EMOTE_WEB_SPRAY);
me->CastSpell(me, SPELL_WEB_SPRAY, true);
events.RepeatEvent(40000);
break;
case EVENT_POISON_SHOCK:
me->CastSpell(me->GetVictim(), SPELL_POISON_SHOCK, false);
events.RepeatEvent(10000);
break;
case EVENT_NECROTIC_POISON:
me->CastSpell(me->GetVictim(), SPELL_NECROTIC_POISON, false);
events.RepeatEvent(30000);
break;
case EVENT_SUMMON_SPIDERLINGS:
Talk(EMOTE_SPIDERS);
for (uint8 i = 0; i < 8; ++i)
{
me->SummonCreature(NPC_MAEXXNA_SPIDERLING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
}
events.RepeatEvent(40000);
break;
case EVENT_HEALTH_CHECK:
if (me->GetHealthPct() < 30)
{
me->CastSpell(me, SPELL_FRENZY, true);
break;
}
events.RepeatEvent(1000);
break;
case EVENT_WEB_WRAP:
Talk(EMOTE_WEB_WRAP);
for (uint8 i = 0; i < 2; ++i)
case EVENT_WEB_SPRAY:
Talk(EMOTE_WEB_SPRAY);
me->CastSpell(me, SPELL_WEB_SPRAY, true);
events.ScheduleEvent(EVENT_MODIFY_WEB_SPRAY_AURA, 500); // Schedule the modify aura event with a 500ms delay
events.RepeatEvent(40000);
break;

case EVENT_MODIFY_WEB_SPRAY_AURA:
{
Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (Player* player = i->GetSource())
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0, true, true, -SPELL_WEB_WRAP))
if (player->IsAlive() && player->HasAura(SPELL_WEB_SPRAY))
{
target->RemoveAura(SPELL_WEB_SPRAY);
uint8 pos = urand(0, 2);
if (Creature* wrap = me->SummonCreature(NPC_WEB_WRAP, PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000))
if (Aura* aura = player->GetAura(SPELL_WEB_SPRAY))
{
wrap->AI()->SetGUID(target->GetGUID());
target->GetMotionMaster()->MoveJump(PosWrap[pos].GetPositionX(), PosWrap[pos].GetPositionY(), PosWrap[pos].GetPositionZ(), 20, 20);
aura->SetDuration(8000); // Set the duration to 8 seconds
}
}
}
events.RepeatEvent(40000);
}
}
break;
case EVENT_POISON_SHOCK:
{
int32 modifiedPoisonShockDamage = urand(1750, 2250); // Set damage to a random value between 1750 and 2250
me->CastCustomSpell(me->GetVictim(), SPELL_POISON_SHOCK, &modifiedPoisonShockDamage, nullptr, nullptr, false, nullptr, nullptr, me->GetGUID());
events.RepeatEvent(10000);
break;
}
case EVENT_NECROTIC_POISON:
me->CastSpell(me->GetVictim(), SPELL_NECROTIC_POISON, false);
events.RepeatEvent(30000);
break;
case EVENT_SUMMON_SPIDERLINGS:
Talk(EMOTE_SPIDERS);
for (uint8 i = 0; i < 8; ++i)
{
me->SummonCreature(NPC_MAEXXNA_SPIDERLING, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
}
events.RepeatEvent(40000);
break;
case EVENT_HEALTH_CHECK:
if (me->GetHealthPct() < 30)
{
me->CastSpell(me, SPELL_FRENZY, true);
break;
}
events.RepeatEvent(1000);
break;
case EVENT_WEB_WRAP:
Talk(EMOTE_WEB_WRAP);
for (uint8 i = 0; i < 2; ++i)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0, true, true, -SPELL_WEB_WRAP))
{
target->RemoveAura(SPELL_WEB_SPRAY);
float x, y, z;
target->GetPosition(x, y, z); // Get the current position of the target player

// Set the destination position for the Web Wrap NPC
uint8 pos = urand(0, 2);
float destX = PosWrap[pos].GetPositionX();
float destY = PosWrap[pos].GetPositionY();
float destZ = PosWrap[pos].GetPositionZ();

if (Creature* wrap = me->SummonCreature(NPC_WEB_WRAP, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000))
{
wrap->AI()->SetGUID(target->GetGUID());
wrap->GetMotionMaster()->MoveJump(destX, destY, destZ, 20, 20); // Make the Web Wrap NPC fly to the destination

// Make the player fly to the same destination as Web Wrap NPC
target->GetMotionMaster()->MoveJump(destX, destY, destZ, 20, 20);

int32 modifiedBaseDamage = urand(650, 850); // Set damage to a random value between 650 and 850
int32 damageForEffect2 = modifiedBaseDamage;
target->CastCustomSpell(target, SPELL_WEB_WRAP, nullptr, &damageForEffect2, nullptr, true, nullptr, nullptr, wrap->GetGUID());
}
}
}
events.RepeatEvent(40000);
break;
}
DoMeleeAttackIfReady();
}
};
};

class boss_maexxna_webwrap : public CreatureScript

class boss_maexxna_webwrap40 : public CreatureScript
{
public:
boss_maexxna_webwrap() : CreatureScript("boss_maexxna_webwrap") { }
boss_maexxna_webwrap40() : CreatureScript("boss_maexxna_webwrap40") { }

CreatureAI* GetAI(Creature* pCreature) const override
{
return GetNaxxramasAI<boss_maexxna_webwrapAI>(pCreature);
return GetNaxxramasAI<boss_maexxna_webwrap40AI>(pCreature);
}

struct boss_maexxna_webwrapAI : public NullCreatureAI
struct boss_maexxna_webwrap40AI : public NullCreatureAI
{
explicit boss_maexxna_webwrapAI(Creature* c) : NullCreatureAI(c) {}
explicit boss_maexxna_webwrap40AI(Creature* c) : NullCreatureAI(c) {}

ObjectGuid victimGUID;

void SetGUID(ObjectGuid guid, int32 /*param*/) override
{
victimGUID = guid;

if (me->m_spells[0] && victimGUID)
if (victimGUID)
{
if (Unit* victim = ObjectAccessor::GetUnit(*me, victimGUID))
{
victim->CastSpell(victim, me->m_spells[0], true, nullptr, nullptr, me->GetGUID());
if (victim->GetTypeId() == TYPEID_PLAYER && victim->GetEntry() != NPC_WEB_WRAP)
{
int32 modifiedBaseDamage = urand(650, 850); // Set damage to a random value between 650 and 850
int32 damageForEffect2 = modifiedBaseDamage;
victim->CastCustomSpell(victim, SPELL_WEB_WRAP, nullptr, &damageForEffect2, nullptr, true, nullptr, nullptr, me->GetGUID());
}
}
}
}

void JustDied(Unit* /*killer*/) override
{
if (me->m_spells[0] && victimGUID)
if (victimGUID)
{
if (Unit* victim = ObjectAccessor::GetUnit(*me, victimGUID))
{
victim->RemoveAurasDueToSpell(me->m_spells[0], me->GetGUID());
if (victim->HasAura(SPELL_WEB_WRAP))
{
victim->RemoveAurasDueToSpell(SPELL_WEB_WRAP, me->GetGUID());
}
}
}
}
Expand All @@ -261,5 +314,5 @@ class boss_maexxna_webwrap : public CreatureScript
void AddSC_boss_maexxna_40()
{
new boss_maexxna_40();
// new boss_maexxna_webwrap();
new boss_maexxna_webwrap40();
}

0 comments on commit f1c20c5

Please sign in to comment.