]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/Hero.cpp
adjusted PerformAttacks' usage of animations
[l2e.git] / src / battle / Hero.cpp
index ff411137773ee72a21fa20ec54ba5115f3cdd914..a3361c6045e0e368bfcbde718d51e80cfcde96ea 100644 (file)
@@ -20,6 +20,7 @@ Hero::Hero()
 , ring(0)
 , jewel(0)
 
+, meleeAnimation(0)
 , attackAnimation(0)
 , spellAnimation(0)
 
@@ -28,13 +29,6 @@ Hero::Hero()
 , maxMana(0)
 , mana(0)
 
-, attack(0)
-, defense(0)
-, agility(0)
-, intelligence(0)
-, gut(0)
-, magicResistance(0)
-
 , level(0)
 , ip(0) {
 
@@ -44,4 +38,19 @@ 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;
+               }
+       }
+}
+
 }