Fixed Zombie eating and decimate

Zombies need faction set to 89, npcid 351069
This commit is contained in:
Dinkledork
2023-08-20 19:00:45 -06:00
committed by GitHub
parent 41731a0dfa
commit 7a4e0e0761

View File

@@ -196,6 +196,23 @@ public:
case EVENT_DECIMATE:
Talk(EMOTE_DECIMATE);
me->CastSpell(me, SPELL_DECIMATE, false);
// Apply Decimate effect to zombies
{
std::list<Creature*> zombies;
me->GetCreatureListWithEntryInGrid(zombies, NPC_ZOMBIE_CHOW, 150.0f);
for (Creature* zombie : zombies)
{
if (zombie->IsAlive())
{
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(105000);
break;
case EVENT_SUMMON_ZOMBIE:
@@ -212,12 +229,16 @@ public:
}
case EVENT_CAN_EAT_ZOMBIE:
events.RepeatEvent(1000);
if (me->GetVictim()->GetEntry() == NPC_ZOMBIE_CHOW && me->IsWithinMeleeRange(me->GetVictim()))
if (me->GetVictim() && me->GetVictim()->GetEntry() == NPC_ZOMBIE_CHOW && me->IsWithinMeleeRange(me->GetVictim()))
{
me->CastCustomSpell(SPELL_CHOW_SEARCHER, SPELLVALUE_RADIUS_MOD, 20000, me, true);
if (me->GetVictim()->GetHealth() > 0) // Check if the zombie is alive
{
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;
}
DoMeleeAttackIfReady();
@@ -269,5 +290,5 @@ public:
void AddSC_boss_gluth_40()
{
new boss_gluth_40();
// new spell_gluth_decimate();
new spell_gluth_decimate();
}