X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FHero.cpp;h=d09b824d4961f5edb5fc397ec90740de8eae86dd;hb=0b11a24a8b08c49d6e4301573602fb6d01e7a8c8;hp=17ec08a2bbc8316abd84fadb827d02f087d80745;hpb=5121f4215d725f492bea084fb94900d7e5972743;p=l2e.git diff --git a/src/battle/Hero.cpp b/src/battle/Hero.cpp index 17ec08a..d09b824 100644 --- a/src/battle/Hero.cpp +++ b/src/battle/Hero.cpp @@ -1,10 +1,3 @@ -/* - * Hero.cpp - * - * Created on: Aug 6, 2012 - * Author: holy - */ - #include "Hero.h" #include "AttackChoice.h" @@ -12,6 +5,7 @@ #include "../common/Ikari.h" #include "../common/Item.h" #include "../common/Spell.h" +#include "../math/Vector.h" using common::Ikari; using common::Spell; @@ -20,47 +14,18 @@ using std::vector; namespace battle { 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) - -, level(0) -, ip(0) { +: master(0) { } -Hero::~Hero() { +Hero::Hero(common::Hero &h) +: master(&h) +, stats(h.GetStats()) { } +Hero::~Hero() { -void Hero::SubtractHealth(int amount) { - if (amount > Health()) { - health = 0; - } else { - health -= amount; - int ipGain(amount * 255 / health); - if (ip + ipGain > 255) { - ip = 255; - } else { - ip += ipGain; - } - } }