mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
[svn] * Prevent creatures from moving if they are dead (if they were fleeing for example).
* Critters now flee from attacker when taking damage. --HG-- branch : trunk
This commit is contained in:
@@ -500,17 +500,25 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
// no xp,health if type 8 /critters/
|
||||
if ( pVictim->GetCreatureType() == CREATURE_TYPE_CRITTER)
|
||||
{
|
||||
pVictim->setDeathState(JUST_DIED);
|
||||
pVictim->SetHealth(0);
|
||||
// critters run away when hit
|
||||
pVictim->GetMotionMaster()->MoveFleeing(this);
|
||||
|
||||
// allow loot only if has loot_id in creature_template
|
||||
CreatureInfo const* cInfo = ((Creature*)pVictim)->GetCreatureInfo();
|
||||
if(cInfo && cInfo->lootid)
|
||||
pVictim->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||
if(damage >= pVictim->GetHealth())
|
||||
{
|
||||
pVictim->setDeathState(JUST_DIED);
|
||||
pVictim->SetHealth(0);
|
||||
|
||||
// some critters required for quests
|
||||
if(GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)this)->KilledMonster(pVictim->GetEntry(),pVictim->GetGUID());
|
||||
CreatureInfo const* cInfo = ((Creature*)pVictim)->GetCreatureInfo();
|
||||
if(cInfo && cInfo->lootid)
|
||||
pVictim->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||
|
||||
// some critters required for quests
|
||||
if(GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)this)->KilledMonster(pVictim->GetEntry(),pVictim->GetGUID());
|
||||
}
|
||||
else
|
||||
pVictim->ModifyHealth(- (int32)damage);
|
||||
|
||||
return damage;
|
||||
}
|
||||
@@ -612,6 +620,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
pVictim->CombatStop();
|
||||
pVictim->getHostilRefManager().deleteReferences();
|
||||
|
||||
// stop movement
|
||||
pVictim->StopMoving();
|
||||
|
||||
bool damageFromSpiritOfRedemtionTalent = spellProto && spellProto->Id == 27795;
|
||||
|
||||
// if talent known but not triggered (check priest class for speedup check)
|
||||
|
||||
Reference in New Issue
Block a user