Skip to content
Permalink
Browse files
Create character.cpp
  • Loading branch information
gillettr committed Mar 11, 2019
1 parent 38af521 commit d0bd7166b294d1a99a67c8a7cab62af245a13ca2
Showing 1 changed file with 37 additions and 0 deletions.
@@ -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;

}

0 comments on commit d0bd716

Please sign in to comment.