Fix mana set to 0 when mob dies. Thanks Malcrom.

--HG--
branch : trunk
This commit is contained in:
Trazom62
2010-02-28 21:34:31 +01:00
parent 3ffeb5f5dd
commit 4c16bff8e6
2 changed files with 4 additions and 5 deletions
+3 -2
View File
@@ -1484,6 +1484,9 @@ void Creature::setDeathState(DeathState s)
if(m_formation && m_formation->getLeader() == this) if(m_formation && m_formation->getLeader() == this)
m_formation->FormationReset(true); m_formation->FormationReset(true);
SetHealth(0);
SetPower(getPowerType(),0);
if ((canFly() || IsFlying()) && FallGround()) if ((canFly() || IsFlying()) && FallGround())
return; return;
@@ -1564,7 +1567,6 @@ void Creature::Respawn(bool force)
if (m_isDeadByDefault) if (m_isDeadByDefault)
{ {
setDeathState(JUST_DIED); setDeathState(JUST_DIED);
SetHealth(0);
i_motionMaster.Clear(); i_motionMaster.Clear();
clearUnitState(UNIT_STAT_ALL_STATE); clearUnitState(UNIT_STAT_ALL_STATE);
LoadCreaturesAddon(true); LoadCreaturesAddon(true);
@@ -1608,7 +1610,6 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn)
setDeathState(JUST_DIED); setDeathState(JUST_DIED);
RemoveCorpse(); RemoveCorpse();
SetHealth(0); // just for nice GM-mode view
} }
bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo) bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
+1 -3
View File
@@ -658,7 +658,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
if (damage >= pVictim->GetHealth()) if (damage >= pVictim->GetHealth())
{ {
pVictim->setDeathState(JUST_DIED); pVictim->setDeathState(JUST_DIED);
pVictim->SetHealth(0);
CreatureInfo const* cInfo = ((Creature*)pVictim)->GetCreatureInfo(); CreatureInfo const* cInfo = ((Creature*)pVictim)->GetCreatureInfo();
if (cInfo && cInfo->lootid) if (cInfo && cInfo->lootid)
@@ -11997,6 +11996,7 @@ void Unit::setDeathState(DeathState s)
//without this when removing IncreaseMaxHealth aura player may stuck with 1 hp //without this when removing IncreaseMaxHealth aura player may stuck with 1 hp
//do not why since in IncreaseMaxHealth currenthealth is checked //do not why since in IncreaseMaxHealth currenthealth is checked
SetHealth(0); SetHealth(0);
SetPower(getPowerType(),0);
} }
else if (s == JUST_ALIVED) else if (s == JUST_ALIVED)
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
@@ -14550,8 +14550,6 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
//sLog.outError("%u kill %u", GetEntry(), pVictim->GetEntry()); //sLog.outError("%u kill %u", GetEntry(), pVictim->GetEntry());
pVictim->SetHealth(0);
// 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();