mirror of
https://github.com/ZhengPeiRu21/mod-individual-progression
synced 2025-11-29 23:44:51 +08:00
Fixed Zombie eating and decimate
Zombies need faction set to 89, npcid 351069
This commit is contained in:
@@ -196,6 +196,23 @@ public:
|
|||||||
case EVENT_DECIMATE:
|
case EVENT_DECIMATE:
|
||||||
Talk(EMOTE_DECIMATE);
|
Talk(EMOTE_DECIMATE);
|
||||||
me->CastSpell(me, SPELL_DECIMATE, false);
|
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);
|
events.RepeatEvent(105000);
|
||||||
break;
|
break;
|
||||||
case EVENT_SUMMON_ZOMBIE:
|
case EVENT_SUMMON_ZOMBIE:
|
||||||
@@ -212,12 +229,16 @@ public:
|
|||||||
}
|
}
|
||||||
case EVENT_CAN_EAT_ZOMBIE:
|
case EVENT_CAN_EAT_ZOMBIE:
|
||||||
events.RepeatEvent(1000);
|
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);
|
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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user