3 #include "../common/Capsule.h"
4 #include "../math/Vector.h"
8 using graphics::Animation;
9 using graphics::Sprite;
13 Capsule::Capsule(common::Capsule *master)
15 , health(master ? master->MaxHealth() : 0) {
17 stats = master->GetStats();
22 const char *Capsule::Name() const {
24 return master->Name();
27 Uint8 Capsule::Level() const {
29 return master->Level();
32 const Sprite *Capsule::Sprite() {
34 return master->BattleSprite();
37 const Animation *Capsule::MeleeAnimation() const {
39 return master->MeleeAnimation();
42 const Animation *Capsule::AttackAnimation() const {
44 return master->AttackAnimation();
47 const Animation *Capsule::SpellAnimation() const {
49 return master->SpellAnimation();
53 Uint16 Capsule::MaxHealth() const {
55 return master->MaxHealth();
58 Uint16 Capsule::Health() const {
62 int Capsule::RelativeHealth(int max) const {
63 return Health() * max / MaxHealth();
66 void Capsule::SubtractHealth(int amount) {
67 if (amount > health) {