1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
#include <iostream>
#include <ctime>
#include <string>
#include "Combat.h"
#include "Combatant.h"
#include "Scenario.h"
#include "Dice.h"
#include "Equipment.h"
using namespace std;
Combat::Combat()
{
}
bool Combat::runCombat()
{
Combatant kyle(1, 10, 10, 3, 5, 6, 15, 12, 500, 1000);
Combatant one(1, 10, 10, 2, 5, 6, 15, 12, 500, 1000);
Combatant two(1, 10, 10, 1, 5, 6, 15, 12, 500, 1000);
Combatant three(1, 10, 10, 4, 5, 6, 15, 12, 500, 1000);
kyle._name = "Kyle";
one._name = "Orrin";
two._name = "Braedon";
three._name = "Brent";
int turn = checkSpeed(kyle._speed, one._speed, two._speed, three._speed);
if (turn == 1) {
int choice = kyle.pickAction();
if (choice == 1) {
//Pick target
cout << "Please pick a target" << endl;
cout << "1)." << one._name << endl;
cout << "2)." << two._name << endl;
cout << "3)." << three._name << endl;
int choice;
cin >> choice;
//Check is attack beats target defense, then subtract armor from damage total and inflict to health.
switch (choice)
{
case 1:
kyle.attack(one);
break;
case 2:
kyle.attack(two);
break;
case 3:
kyle.attack(three);
break;
}
}
}
else if (turn == 2) {
one.attack(kyle);
}
else if (turn == 3) {
two.attack(kyle);
}
else {
three.attack(kyle);
}
return true;
}
int Combat::checkSpeed(int crea1, int crea2, int crea3, int crea4)
{
if (crea1 > crea2 && crea3 && crea4) {
return 1;
}
else if (crea2 > crea1 && crea3 && crea4) {
return 2;
}
else if (crea3 > crea1 && crea2 && crea4) {
return 3;
}
else {
return 4;
}
}
|