Core/Pets: Fix bugged reactstate behaviour after spline system implementation.
Signed-off-by: Machiavelli <[email protected]>
This commit is contained in:
@@ -15328,14 +15328,6 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
|||||||
if (!victim->GetHealth())
|
if (!victim->GetHealth())
|
||||||
return;
|
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
|
// find player: owner of controlled `this` or `this` itself maybe
|
||||||
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
Player* player = GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||||
Creature* creature = victim->ToCreature();
|
Creature* creature = victim->ToCreature();
|
||||||
@@ -15464,6 +15456,16 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
|
|||||||
victim->setDeathState(JUST_DIED);
|
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
|
// 10% durability loss on death
|
||||||
// clean InHateListOf
|
// clean InHateListOf
|
||||||
if (Player* plrVictim = victim->ToPlayer())
|
if (Player* plrVictim = victim->ToPlayer())
|
||||||
|
|||||||
@@ -38,15 +38,18 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
|
//! Following block of code deleted by MrSmite in issue 4891
|
||||||
if (i_offset && i_target->IsWithinDistInMap(&owner,2*i_offset))
|
//! Code kept for learning and diagnostical purposes
|
||||||
{
|
//
|
||||||
if (!owner.movespline->Finalized())
|
// if (i_offset && i_target->IsWithinDistInMap(&owner,2*i_offset))
|
||||||
return;
|
// {
|
||||||
|
// if (!owner.movespline->Finalized())
|
||||||
owner.GetPosition(x, y, z);
|
// return;
|
||||||
}
|
//
|
||||||
else if (!i_offset)
|
// owner.GetPosition(x, y, z);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
if (!i_offset)
|
||||||
{
|
{
|
||||||
if (i_target->IsWithinMeleeRange(&owner))
|
if (i_target->IsWithinMeleeRange(&owner))
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user