Merge pull request #172 from Day36512/master

Fixed Zombie eating and decimate
This commit is contained in:
ZhengPeiRu21
2023-08-21 12:19:06 -06:00
committed by GitHub
3 changed files with 107 additions and 64 deletions

View File

@@ -0,0 +1,4 @@
DELETE FROM `creature_template_spell` WHERE `CreatureID`=351084 AND `Index`=0;
INSERT INTO `creature_template_spell` (`CreatureID`, `Index`, `Spell`, `VerifiedBuild`) VALUES (351084, 0, 29060, 0);
DELETE FROM `creature_template_spell` WHERE `CreatureID`=351084 AND `Index`=1;
INSERT INTO `creature_template_spell` (`CreatureID`, `Index`, `Spell`, `VerifiedBuild`) VALUES (351084, 1, 29061, 0);

View File

@@ -23,36 +23,36 @@
enum Spells enum Spells
{ {
SPELL_MORTAL_WOUND = 25646, SPELL_MORTAL_WOUND = 25646,
SPELL_ENRAGE = 28371, SPELL_ENRAGE = 28371,
SPELL_DECIMATE = 28374, SPELL_DECIMATE = 28374,
SPELL_BERSERK = 26662, SPELL_BERSERK = 26662,
SPELL_INFECTED_WOUND = 29306, SPELL_INFECTED_WOUND = 29306,
SPELL_CHOW_SEARCHER = 28404 SPELL_CHOW_SEARCHER = 28404
}; };
enum Events enum Events
{ {
EVENT_MORTAL_WOUND = 1, EVENT_MORTAL_WOUND = 1,
EVENT_ENRAGE = 2, EVENT_ENRAGE = 2,
EVENT_DECIMATE = 3, EVENT_DECIMATE = 3,
EVENT_BERSERK = 4, EVENT_BERSERK = 4,
EVENT_SUMMON_ZOMBIE = 5, EVENT_SUMMON_ZOMBIE = 5,
EVENT_CAN_EAT_ZOMBIE = 6 EVENT_CAN_EAT_ZOMBIE = 6
}; };
enum Misc enum Misc
{ {
NPC_ZOMBIE_CHOW = 351069 NPC_ZOMBIE_CHOW = 351069
}; };
enum Emotes enum Emotes
{ {
EMOTE_SPOTS_ONE = 0, EMOTE_SPOTS_ONE = 0,
EMOTE_DECIMATE = 1, EMOTE_DECIMATE = 1,
EMOTE_ENRAGE = 2, EMOTE_ENRAGE = 2,
EMOTE_DEVOURS_ALL = 3, EMOTE_DEVOURS_ALL = 3,
EMOTE_BERSERK = 4 EMOTE_BERSERK = 4
}; };
const Position zombiePos[3] = const Position zombiePos[3] =
@@ -143,7 +143,7 @@ public:
} }
} }
void JustDied(Unit* killer) override void JustDied(Unit* killer) override
{ {
BossAI::JustDied(killer); BossAI::JustDied(killer);
summons.DespawnAll(); summons.DespawnAll();
@@ -181,44 +181,65 @@ public:
switch (events.ExecuteEvent()) switch (events.ExecuteEvent())
{ {
case EVENT_BERSERK: case EVENT_BERSERK:
me->CastSpell(me, SPELL_BERSERK, true); me->CastSpell(me, SPELL_BERSERK, true);
break; break;
case EVENT_ENRAGE: case EVENT_ENRAGE:
Talk(EMOTE_ENRAGE); Talk(EMOTE_ENRAGE);
me->CastSpell(me, SPELL_ENRAGE, true); me->CastSpell(me, SPELL_ENRAGE, true);
events.RepeatEvent(22000); events.RepeatEvent(22000);
break; break;
case EVENT_MORTAL_WOUND: case EVENT_MORTAL_WOUND:
me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false);
events.RepeatEvent(10000); events.RepeatEvent(10000);
break; break;
case EVENT_DECIMATE: case EVENT_DECIMATE:
Talk(EMOTE_DECIMATE); Talk(EMOTE_DECIMATE);
me->CastSpell(me, SPELL_DECIMATE, false); me->CastSpell(me, SPELL_DECIMATE, false);
events.RepeatEvent(105000); // Apply Decimate effect to zombies
break; {
case EVENT_SUMMON_ZOMBIE: std::list<Creature*> zombies;
me->GetCreatureListWithEntryInGrid(zombies, NPC_ZOMBIE_CHOW, 150.0f);
for (Creature* zombie : zombies)
{ {
uint8 rand = urand(0, 2); if (zombie->IsAlive())
for (int32 i = 0; i < 1; ++i)
{ {
// In 40 man raid, use all gates int32 reduceHp = int32(zombie->GetMaxHealth() * 0.05f);
me->SummonCreature(NPC_ZOMBIE_CHOW, zombiePos[urand(0, 2)]); if (zombie->GetHealth() > reduceHp)
(rand == 2 ? rand = 0 : rand++); zombie->SetHealth(reduceHp); // Reduce HP to 5%
zombie->SetWalk(true); // Set to walk
zombie->GetMotionMaster()->MoveFollow(me, 0.0f, 0.0f, MOTION_SLOT_CONTROLLED); // Move to boss
zombie->SetReactState(REACT_PASSIVE); // Set to passive
} }
events.RepeatEvent(10000);
break;
} }
case EVENT_CAN_EAT_ZOMBIE: }
events.RepeatEvent(1000); events.RepeatEvent(105000);
if (me->GetVictim()->GetEntry() == NPC_ZOMBIE_CHOW && me->IsWithinMeleeRange(me->GetVictim())) break;
case EVENT_SUMMON_ZOMBIE:
{
uint8 rand = urand(0, 2);
for (int32 i = 0; i < 1; ++i)
{
// In 40 man raid, use all gates
me->SummonCreature(NPC_ZOMBIE_CHOW, zombiePos[urand(0, 2)]);
(rand == 2 ? rand = 0 : rand++);
}
events.RepeatEvent(10000);
break;
}
case EVENT_CAN_EAT_ZOMBIE:
events.RepeatEvent(1000);
if (me->GetVictim() && me->GetVictim()->GetEntry() == NPC_ZOMBIE_CHOW && me->IsWithinMeleeRange(me->GetVictim()))
{
if (me->GetVictim()->GetHealth() > 0) // Check if the zombie is alive
{ {
me->CastCustomSpell(SPELL_CHOW_SEARCHER, SPELLVALUE_RADIUS_MOD, 20000, me, true); me->ModifyHealth(int32(me->GetMaxHealth() * 0.05f)); // Heal for 5% of max health
Talk(EMOTE_DEVOURS_ALL); Talk(EMOTE_DEVOURS_ALL);
Unit::DealDamage(me, me->GetVictim(), me->GetVictim()->GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false); // Kill the zombie
return; // leave it to skip DoMeleeAttackIfReady return; // leave it to skip DoMeleeAttackIfReady
} }
break; }
break;
} }
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
@@ -269,5 +290,5 @@ public:
void AddSC_boss_gluth_40() void AddSC_boss_gluth_40()
{ {
new boss_gluth_40(); new boss_gluth_40();
// new spell_gluth_decimate(); new spell_gluth_decimate();
} }

View File

@@ -116,6 +116,7 @@ enum Yells
SAY_EVADE = 5 SAY_EVADE = 5
}; };
class boss_onyxia_40 : public CreatureScript class boss_onyxia_40 : public CreatureScript
{ {
public: public:
@@ -209,18 +210,16 @@ public:
void JustSummoned(Creature* summon) override void JustSummoned(Creature* summon) override
{ {
if (summon->GetEntry() != NPC_ONYXIAN_WHELP && summon->GetEntry() != NPC_ONYXIAN_LAIR_GUARD) if (summon->GetEntry() == NPC_ONYXIAN_WHELP || summon->GetEntry() == NPC_ONYXIAN_LAIR_GUARD)
{ {
return; if (Unit* target = summon->SelectNearestTarget(300.0f))
} {
summon->AI()->AttackStart(target);
DoZoneInCombat(summon);
}
if (Unit* target = summon->SelectNearestTarget(300.0f)) summons.Summon(summon);
{
summon->AI()->AttackStart(target);
DoZoneInCombat(summon);
} }
summons.Summon(summon);
} }
void MovementInform(uint32 type, uint32 id) override void MovementInform(uint32 type, uint32 id) override
@@ -275,11 +274,29 @@ public:
whelpSpamTimer -= diff; whelpSpamTimer -= diff;
if (whelpSpamTimer <= 0) if (whelpSpamTimer <= 0)
{ {
float angle = rand_norm() * 2 * M_PI; // Coordinates for the cave mouths
float dist = rand_norm() * 4.0f; float caveMouths[2][3] = {
me->CastSpell(-33.18f + cos(angle) * dist, -258.80f + sin(angle) * dist, -89.0f, SPELL_SUMMON_WHELP, true); {-31.71, -170.55, -89.72},
me->CastSpell(-32.535f + cos(angle) * dist, -170.190f + sin(angle) * dist, -89.0f, SPELL_SUMMON_WHELP, true); {-32.086, -258.55, -89.72},
whelpCount += 2; };
// Randomly select one of the cave mouths for spawning
uint8 selectedCave = urand(0, 1);
// Summon a whelp at the selected cave mouth
Creature* whelp = me->SummonCreature(NPC_ONYXIAN_WHELP, caveMouths[selectedCave][0], caveMouths[selectedCave][1], caveMouths[selectedCave][2], 0);
if (whelp)
{
// Find the nearest player and attack
if (Unit* target = whelp->SelectNearestTarget(300.0f))
{
whelp->AI()->AttackStart(target);
}
}
// Increment the whelp count and reset the timer
whelpCount += 1;
whelpSpamTimer += 600; whelpSpamTimer += 600;
} }
} }
@@ -292,6 +309,7 @@ public:
} }
} }
bool CheckInRoom() override bool CheckInRoom() override
{ {
if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 95.0f) if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 95.0f)