X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FHero.cpp;h=ab3b23e9b9c396e023516e539f640501a76ff831;hb=fbf5a98f8fd0da951e469003fe87d575a6bb30a4;hp=faaf841bf7710139b1be6e475913e55d62eae9e7;hpb=d997e6743dfa0df245bc3f59ee97ecd63efb3c4f;p=l2e.git diff --git a/src/battle/Hero.cpp b/src/battle/Hero.cpp index faaf841..ab3b23e 100644 --- a/src/battle/Hero.cpp +++ b/src/battle/Hero.cpp @@ -9,14 +9,49 @@ namespace battle { -Hero::Hero() { - // TODO Auto-generated constructor stub +Hero::Hero() +: name("") +, sprite(0) + +, weapon(0) +, armor(0) +, shield(0) +, helmet(0) +, ring(0) +, jewel(0) + +, meleeAnimation(0) +, attackAnimation(0) +, spellAnimation(0) + +, maxHealth(0) +, health(0) +, maxMana(0) +, mana(0) + +, attack(0) +, defense(0) +, agility(0) +, intelligence(0) +, gut(0) +, magicResistance(0) + +, level(0) +, ip(0) { } Hero::~Hero() { - // TODO Auto-generated destructor stub } + +void Hero::SubtractHealth(int amount) { + if (amount > Health()) { + health = 0; + } else { + health -= amount; + } +} + }