aboutsummaryrefslogtreecommitdiff
path: root/src/game/Creature.h
diff options
context:
space:
mode:
authorBrian <runningnak3d@gmail.com>2009-12-20 20:23:18 -0700
committerBrian <runningnak3d@gmail.com>2009-12-20 20:23:18 -0700
commit5300226feebec5bab585819f7cdce214ec14dce9 (patch)
treed6e55869d4cc010033b5c1e9120b458448505a87 /src/game/Creature.h
parentc4ac6323b0bb4eb9f4f1729ce2a63ab1a8ebd523 (diff)
* Added support for using a lookup table for creature mana / health
* As long as creature level, class, and the proper expansion they are from are * set in creature_template, you will have 100% accurate health and mana. * Research and base stats table done by Malcrom -- THANK YOU! * Original patch by Kudlaty -- THANK YOU! * Updated and enhanced by Machiavelli - THANK YOU! * Optimizations by w12x, MrSmite, and XTZGZoReX -- THANK YOU! * Final code updating for current rev by XTZGZoReX -- THANK YOU! --HG-- branch : trunk
Diffstat (limited to 'src/game/Creature.h')
-rw-r--r--src/game/Creature.h41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/game/Creature.h b/src/game/Creature.h
index b259fa76422..3743539d86a 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -81,10 +81,7 @@ struct CreatureInfo
uint32 GossipMenuId;
uint32 minlevel;
uint32 maxlevel;
- uint32 minhealth;
- uint32 maxhealth;
- uint32 minmana;
- uint32 maxmana;
+ uint32 expansion;
uint32 armor;
uint32 faction_A;
uint32 faction_H;
@@ -129,8 +126,8 @@ struct CreatureInfo
char const* AIName;
uint32 MovementType;
uint32 InhabitType;
- float unk16;
- float unk17;
+ float ModHealth;
+ float ModMana;
bool RacialLeader;
uint32 questItems[6];
uint32 movementId;
@@ -165,6 +162,35 @@ struct CreatureInfo
}
};
+// Defines base stats for creatures (used to calculate HP/mana).
+struct CreatureBaseStats
+{
+ uint8 Expansion;
+ uint8 Class;
+ uint32 Level;
+ uint32 BaseHealth;
+ uint32 BaseMana;
+
+ // Helpers
+
+ uint32 GenerateHealth(uint32 level, CreatureInfo const* info) const
+ {
+ return uint32((BaseHealth * info->ModHealth) + 0.5f);
+ }
+
+ uint32 GenerateMana(uint32 level, CreatureInfo const* info) const
+ {
+ // Mana can be 0.
+ if (!BaseMana)
+ return 0;
+
+ return uint32((BaseMana * info->ModMana) + 0.5f);
+ }
+};
+
+typedef std::list<CreatureBaseStats> CreatureBaseStatsList;
+typedef std::pair<uint32, uint32> BaseHealthManaPair;
+
struct CreatureLocale
{
std::vector<std::string> Name;
@@ -625,6 +651,9 @@ class TRINITY_DLL_SPEC Creature : public Unit
void SetOriginalEntry(uint32 entry) { m_originalEntry = entry; }
+ // Provided for script access.
+ BaseHealthManaPair GenerateHealthMana();
+
static float _GetDamageMod(int32 Rank);
float m_SightDistance, m_CombatDistance;