[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:
Seline
2008-10-19 10:20:53 -05:00
parent 90a5b215f9
commit e78b34c63f
+19 -8
View File
@@ -500,17 +500,25 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// no xp,health if type 8 /critters/ // no xp,health if type 8 /critters/
if ( pVictim->GetCreatureType() == CREATURE_TYPE_CRITTER) if ( pVictim->GetCreatureType() == CREATURE_TYPE_CRITTER)
{ {
pVictim->setDeathState(JUST_DIED); // critters run away when hit
pVictim->SetHealth(0); pVictim->GetMotionMaster()->MoveFleeing(this);
// allow loot only if has loot_id in creature_template // allow loot only if has loot_id in creature_template
CreatureInfo const* cInfo = ((Creature*)pVictim)->GetCreatureInfo(); if(damage >= pVictim->GetHealth())
if(cInfo && cInfo->lootid) {
pVictim->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); pVictim->setDeathState(JUST_DIED);
pVictim->SetHealth(0);
// some critters required for quests CreatureInfo const* cInfo = ((Creature*)pVictim)->GetCreatureInfo();
if(GetTypeId() == TYPEID_PLAYER) if(cInfo && cInfo->lootid)
((Player*)this)->KilledMonster(pVictim->GetEntry(),pVictim->GetGUID()); 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; return damage;
} }
@@ -612,6 +620,9 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
pVictim->CombatStop(); pVictim->CombatStop();
pVictim->getHostilRefManager().deleteReferences(); pVictim->getHostilRefManager().deleteReferences();
// stop movement
pVictim->StopMoving();
bool damageFromSpiritOfRedemtionTalent = spellProto && spellProto->Id == 27795; bool damageFromSpiritOfRedemtionTalent = spellProto && spellProto->Id == 27795;
// if talent known but not triggered (check priest class for speedup check) // if talent known but not triggered (check priest class for speedup check)