diff --git a/combat.cpp b/combat.cpp new file mode 100644 index 0000000..518a0c6 --- /dev/null +++ b/combat.cpp @@ -0,0 +1,39 @@ +#include "Combat.h" +#include "Monster.h" +#include "Character.h" + +Combat::Combat(Monster& newM) : M(newM) +{ + +} +void Combat::combatChoice(Character& C) +{ + C.display(); + cout << "What do you do? 1: Attack, 2: Fire Arrow" << endl; + short choice; + cin >> choice; + switch (choice) + { + case 1: + C.attack(M); + break; + + case 2: + C.rangedAttack(M); + break; + } +} +void Combat::combat1(Character& C) +{ + while (M.health > 0 && C.health > 0) + { + M->attack(C); + combatChoice(C); + + } + if (M.health < 0) //we're using -> for pointer in this + cout << "Congratulations! You succeessfully killed the monster!" << endl; + if (C.health < 0) //used a dot for the reference + cout << "YOU HAVE DIED!" << endl;; + +}