aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian <runningnak3d@gmail.com>2010-06-28 06:42:01 -0600
committerBrian <runningnak3d@gmail.com>2010-06-28 06:42:01 -0600
commitd2f6ae6f778138643a8f0af621ad9a7e9015ecd3 (patch)
tree5fd8f2038f32e8cf4af8ec4e8c505bf92e134473 /src
parent6531cbcb21cb1d9b43a4bb4927836f377a19d403 (diff)
* Fix creatures spawning with less than max health if curhealth field in
* creature is != maxhealth in creature_template and the creature is supposed * to regenerate health. * Patch courtesy of Visagalis * Thanks for taking the time to fix this LONG outstanding bug --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index f51b7a585bd..f1f5e7729a1 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1262,16 +1262,26 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
}
}
- uint32 curhealth = data->curhealth;
- if (curhealth)
+ uint32 curhealth;
+
+ if (!m_regenHealth)
{
- curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank));
- if (curhealth < 1)
- curhealth = 1;
+ curhealth = data->curhealth;
+ if (curhealth)
+ {
+ curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank));
+ if (curhealth < 1)
+ curhealth = 1;
+ }
+ SetPower(POWER_MANA,data->curmana);
+ }
+ else
+ {
+ curhealth = GetMaxHealth();
+ SetPower(POWER_MANA,GetMaxPower(POWER_MANA));
}
SetHealth(m_deathState == ALIVE ? curhealth : 0);
- SetPower(POWER_MANA,data->curmana);
// checked at creature_template loading
m_defaultMovementType = MovementGeneratorType(data->movementType);