-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpkmnBattle.cpp
65 lines (48 loc) · 1.53 KB
/
pkmnBattle.cpp
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
#include <algorithm>
#include <iostream>
#include "pkmn.h"
int main() {
std::ifstream pkmnList;
std::ifstream pkmnMoves;
printWelcome();
checkData(pkmnList, pkmnMoves);
bool replay = true;
while (replay) {
printLongSep();
std::cout << "Getting your Pokemon ready...\n";
Pkmn pkmn1(pkmnList, pkmnMoves);
printLongSep();
std::cout << "Getting the opponent Pokemon ready...\n";
Pkmn pkmn2(pkmnList, pkmnMoves);
printLongSep();
std::cout << "A wild " << pkmn2.name << " appeared!\n";
std::cout << "Go! " << pkmn1.name << "!\n";
bool inBattle = true;
while (inBattle) {
printBothPkmnInfo(pkmn1, pkmn2);
//pkmn w higher speed goes first
if (pkmn1.compareSPD(pkmn2)) {
pkmn1.makeMove(pkmn2, true, inBattle, pkmnMoves);
inBattle = inBattleCheck(pkmn1, pkmn2, inBattle);
if (!inBattle) {break;}
printBothPkmnInfo(pkmn1, pkmn2);
pkmn2.makeMove(pkmn1, false, inBattle, pkmnMoves);
}
else {
pkmn2.makeMove(pkmn1, false, inBattle, pkmnMoves);
inBattle = inBattleCheck(pkmn1, pkmn2, inBattle);
if (!inBattle) {break;}
printBothPkmnInfo(pkmn1, pkmn2);
pkmn1.makeMove(pkmn2, true, inBattle, pkmnMoves);
}
printLongSep();
inBattle = inBattleCheck(pkmn1, pkmn2, inBattle);
if (!inBattle) {break;}
}
printLongSep();
std::cout << "\n";
std::cout << "The battle has ended!\n";
replay = replayCheck();
}
std::cout << "Thank you for playing! :)\n";
}