diff --git a/character.cpp b/character.cpp new file mode 100644 index 0000000..1a2257e --- /dev/null +++ b/character.cpp @@ -0,0 +1,37 @@ +#include "Character.h" + +void Character::attack(Monster& target) +{ + target.health -= damage; + cout << " You attack the " << target.name << " doing " << damage << " damage!" << endl; + cout << " health: " << health << endl; + +} + +void Character::rangedAttack(Monster& target) +{ + if (arrows == 0) + cout << " You're out of arrows!" << endl; + else + { + short rangedDamage = 3; + target.health -= rangedDamage; + arrows--; + cout << "You shoot " << target.name << " doing " << rangedDamage << " damage!" << endl; + + + } +} +Character::Character(string newname) +{ + name = newname; + health = 100; + damage = 3; + arrows = 5; + +} +void Character::display() +{ + cout << name << " health: " << health << " arrows: " << arrows << endl; + +}