diff options
author | Seline <none@none> | 2008-10-19 10:20:53 -0500 |
---|---|---|
committer | Seline <none@none> | 2008-10-19 10:20:53 -0500 |
commit | e78b34c63fccc5ba7e5fb7fc057d48c63876b8be (patch) | |
tree | 97bc506d8fad655550a17fb2588567a1bd9f84a0 | |
parent | 90a5b215f9cb28daf094120957d31df17b5d3578 (diff) |
[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
-rw-r--r-- | src/game/Unit.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index eff464f110b..08a2ac93c92 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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) |