diff --git a/sql/world/base/creature_template_spell.sql b/sql/world/base/creature_template_spell.sql new file mode 100644 index 0000000..79a5560 --- /dev/null +++ b/sql/world/base/creature_template_spell.sql @@ -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); diff --git a/src/naxx40Scripts/boss_gluth_40.cpp b/src/naxx40Scripts/boss_gluth_40.cpp index 5719847..604f5f9 100644 --- a/src/naxx40Scripts/boss_gluth_40.cpp +++ b/src/naxx40Scripts/boss_gluth_40.cpp @@ -23,36 +23,36 @@ enum Spells { - SPELL_MORTAL_WOUND = 25646, - SPELL_ENRAGE = 28371, - SPELL_DECIMATE = 28374, - SPELL_BERSERK = 26662, - SPELL_INFECTED_WOUND = 29306, - SPELL_CHOW_SEARCHER = 28404 + SPELL_MORTAL_WOUND = 25646, + SPELL_ENRAGE = 28371, + SPELL_DECIMATE = 28374, + SPELL_BERSERK = 26662, + SPELL_INFECTED_WOUND = 29306, + SPELL_CHOW_SEARCHER = 28404 }; enum Events { - EVENT_MORTAL_WOUND = 1, - EVENT_ENRAGE = 2, - EVENT_DECIMATE = 3, - EVENT_BERSERK = 4, - EVENT_SUMMON_ZOMBIE = 5, - EVENT_CAN_EAT_ZOMBIE = 6 + EVENT_MORTAL_WOUND = 1, + EVENT_ENRAGE = 2, + EVENT_DECIMATE = 3, + EVENT_BERSERK = 4, + EVENT_SUMMON_ZOMBIE = 5, + EVENT_CAN_EAT_ZOMBIE = 6 }; enum Misc { - NPC_ZOMBIE_CHOW = 351069 + NPC_ZOMBIE_CHOW = 351069 }; enum Emotes { - EMOTE_SPOTS_ONE = 0, - EMOTE_DECIMATE = 1, - EMOTE_ENRAGE = 2, - EMOTE_DEVOURS_ALL = 3, - EMOTE_BERSERK = 4 + EMOTE_SPOTS_ONE = 0, + EMOTE_DECIMATE = 1, + EMOTE_ENRAGE = 2, + EMOTE_DEVOURS_ALL = 3, + EMOTE_BERSERK = 4 }; const Position zombiePos[3] = @@ -143,7 +143,7 @@ public: } } - void JustDied(Unit* killer) override + void JustDied(Unit* killer) override { BossAI::JustDied(killer); summons.DespawnAll(); @@ -181,44 +181,65 @@ public: switch (events.ExecuteEvent()) { - case EVENT_BERSERK: - me->CastSpell(me, SPELL_BERSERK, true); - break; - case EVENT_ENRAGE: - Talk(EMOTE_ENRAGE); - me->CastSpell(me, SPELL_ENRAGE, true); - events.RepeatEvent(22000); - break; - case EVENT_MORTAL_WOUND: - me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); - events.RepeatEvent(10000); - break; - case EVENT_DECIMATE: - Talk(EMOTE_DECIMATE); - me->CastSpell(me, SPELL_DECIMATE, false); - events.RepeatEvent(105000); - break; - case EVENT_SUMMON_ZOMBIE: + case EVENT_BERSERK: + me->CastSpell(me, SPELL_BERSERK, true); + break; + case EVENT_ENRAGE: + Talk(EMOTE_ENRAGE); + me->CastSpell(me, SPELL_ENRAGE, true); + events.RepeatEvent(22000); + break; + case EVENT_MORTAL_WOUND: + me->CastSpell(me->GetVictim(), SPELL_MORTAL_WOUND, false); + events.RepeatEvent(10000); + break; + case EVENT_DECIMATE: + Talk(EMOTE_DECIMATE); + me->CastSpell(me, SPELL_DECIMATE, false); + // Apply Decimate effect to zombies + { + std::list zombies; + me->GetCreatureListWithEntryInGrid(zombies, NPC_ZOMBIE_CHOW, 150.0f); + for (Creature* zombie : zombies) { - uint8 rand = urand(0, 2); - for (int32 i = 0; i < 1; ++i) + if (zombie->IsAlive()) { - // In 40 man raid, use all gates - me->SummonCreature(NPC_ZOMBIE_CHOW, zombiePos[urand(0, 2)]); - (rand == 2 ? rand = 0 : rand++); + int32 reduceHp = int32(zombie->GetMaxHealth() * 0.05f); + if (zombie->GetHealth() > reduceHp) + 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); - if (me->GetVictim()->GetEntry() == NPC_ZOMBIE_CHOW && me->IsWithinMeleeRange(me->GetVictim())) + } + events.RepeatEvent(105000); + 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); + 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 } - break; + } + break; } DoMeleeAttackIfReady(); } @@ -269,5 +290,5 @@ public: void AddSC_boss_gluth_40() { new boss_gluth_40(); -// new spell_gluth_decimate(); + new spell_gluth_decimate(); } diff --git a/src/vanillaScripts/boss_onyxia.cpp b/src/vanillaScripts/boss_onyxia.cpp index 649c320..e12b91a 100644 --- a/src/vanillaScripts/boss_onyxia.cpp +++ b/src/vanillaScripts/boss_onyxia.cpp @@ -116,6 +116,7 @@ enum Yells SAY_EVADE = 5 }; + class boss_onyxia_40 : public CreatureScript { public: @@ -209,18 +210,16 @@ public: 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)) - { - summon->AI()->AttackStart(target); - DoZoneInCombat(summon); + summons.Summon(summon); } - - summons.Summon(summon); } void MovementInform(uint32 type, uint32 id) override @@ -275,11 +274,29 @@ public: whelpSpamTimer -= diff; if (whelpSpamTimer <= 0) { - float angle = rand_norm() * 2 * M_PI; - float dist = rand_norm() * 4.0f; - me->CastSpell(-33.18f + cos(angle) * dist, -258.80f + sin(angle) * dist, -89.0f, SPELL_SUMMON_WHELP, true); - me->CastSpell(-32.535f + cos(angle) * dist, -170.190f + sin(angle) * dist, -89.0f, SPELL_SUMMON_WHELP, true); - whelpCount += 2; + // Coordinates for the cave mouths + float caveMouths[2][3] = { + {-31.71, -170.55, -89.72}, + {-32.086, -258.55, -89.72}, + }; + + // 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; } } @@ -292,6 +309,7 @@ public: } } + bool CheckInRoom() override { if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 95.0f)