Core/Pets: Fix bugged reactstate behaviour after spline system implementation.

Signed-off-by: Machiavelli <machiavelli.trinity@gmail.com>
This commit is contained in:
MrSmite authored and Machiavelli committed 2012-02-21 10:26:14 +01:00
1 parent 44195689b9
commit fb39566f1f
2 files changed
+22 -17

No files matched your search

+10 -8
View File
@@ -15328,14 +15328,6 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
if (!victim->GetHealth())
return;
// Inform pets (if any) when player kills target)
if (Player* player = ToPlayer())
{
Pet* pet = player->GetPet();
if (pet && pet->isAlive() && pet->isControlled())
pet->AI()->KilledUnit(victim);
}
// find player: owner of controlled `this` or `this` itself maybe
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
Creature* creature = victim->ToCreature();
@@ -15464,6 +15456,16 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
victim->setDeathState(JUST_DIED);
}
// Inform pets (if any) when player kills target)
// MUST come after victim->setDeathState(JUST_DIED); or pet next target
// selection will get stuck on same target and break pet react state
if (Player* player = ToPlayer())
{
Pet* pet = player->GetPet();
if (pet && pet->isAlive() && pet->isControlled())
pet->AI()->KilledUnit(victim);
}
// 10% durability loss on death
// clean InHateListOf
if (Player* plrVictim = victim->ToPlayer())