-
Notifications
You must be signed in to change notification settings - Fork 0
/
trainerDB.cpp
164 lines (132 loc) · 5.14 KB
/
trainerDB.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#include "sampleTrainersDB.cpp"
#include <conio.h>
void clearScreen(){ system("cls"); }
//Cynthia
Trainer *Cynthia = new Trainer("Cynthia",CHAMPION,{});
Trainer *Tobias = new Trainer("Tobias", ACE_TRAINER, {});
Trainer *Flint = new Trainer("Flint", ELITE_FOUR, {});
Trainer* player = new Trainer("",RICH_BOY,{});
void fill(Trainer* trainer){
for(auto pkmn: trainer->getParty()){
pkmn->startStats();
}
}
// =========== CREACION DE EQUIPOS ===============================================
vector<Move*> chooseMoveset(Pokemon* pkmn){
cout << pkmn->getName() << " attacks: " << endl;
vector<Move*> movepool = pkmn->getMovepool();
vector<Move*> new_moveset;
int index = 1;
int chosen_move;
for(auto &move : movepool){
cout << "["<<index<<"] ";
move->printMove();
index++;
}
for(int i = 0; i < 4; i++){
do{
cout << "Choose an attack. ["<<i<<"/4]: \t";
cin >> chosen_move;
} while(chosen_move < 0 || chosen_move > index);
new_moveset.push_back(movepool[chosen_move-1]);
}
return new_moveset;
}
template<typename Map>
Pokemon* choosePkmn(Map &m){
Pokemon* pkmn;
string chosenPokemon;
int index = 1;
bool exists = false;
for (auto &item : m) {
pkmn = item.second;
cout << "["<<index<<"] ";
pkmn->mostrar();
cout << "-------------------------" << endl;
index++;
}
do{
cout << "Choose a pokemon." << endl;
cin >> chosenPokemon;
for (auto &item : m) {
if(chosenPokemon == item.first){
exists = true;
pkmn = item.second;
}
}
if(exists == false)
cout << "The chosen pokemon doesn't exists" << endl;
} while(exists == false);
clearScreen();
return pkmn;
}
void chooseTeam(Trainer* player){
int partySize = 0;
do{
cout << "Set your party size.\t";
cin >> partySize;
} while(partySize < 1 || partySize > 6);
vector<Pokemon*> party;
for(int i = 0; i < partySize; i++){
clearScreen();
Pokemon* pkmn = choosePkmn(pokemones);
vector<Move*> moveset = chooseMoveset(pkmn);
int level;
cout << "Choose the level for the pokemon [1-100].\t";
do{
cin >> level;
} while(level < 1 || level > 100);
player->setPkmn(pkmn,level,moveset);
}
}
void updateTrainers(){
//Flint
Flint->setPkmn(pokemones.at("Houndoom"),50,{moves.at("Flamethrower"),moves.at("Sludge Bomb"),moves.at("Dark Pulse"),moves.at("Sunny Day")});
Flint->setPkmn(pokemones.at("Flareon"),50,{moves.at("Overheat"),moves.at("Giga Impact"),moves.at("Quick Attack"),moves.at("Will-O-Wisp")});
Flint->setPkmn(pokemones.at("Rapidash"),50,{moves.at("Flare Blitz"),moves.at("Solar Beam"),moves.at("Bounce"),moves.at("Sunny Day")});
Flint->setPkmn(pokemones.at("Infernape"),50,{moves.at("Flare Blitz"),moves.at("Thunder Punch"),moves.at("Mach Punch"),moves.at("Earthquake")});
Flint->setPkmn(pokemones.at("Magmortar"),50,{moves.at("Flamethrower"),moves.at("Thunderbolt"),moves.at("Solar Beam"),moves.at("Hyper Beam")});
fill(Flint);
//Tobias
Tobias->setPkmn(pokemones.at("Darkrai"), 50, {moves.at("Dark Pulse"), moves.at("Dark Void"), moves.at("Ice Beam"), moves.at("Nasty Plot")});
Tobias->setPkmn(pokemones.at("Latios"), 50, {moves.at("Light Screen"), moves.at("Recover"), moves.at("Luster Purge"), moves.at("Giga Impact")});
fill(Tobias);
//Cynthia
Cynthia->setPkmn(pokemones2.at("Spiritomb"),50,{moves.at("Dark Pulse"),moves.at("Will-O-Wisp"),moves.at("Psychic"),moves.at("Embargo")});
Cynthia->setPkmn(pokemones2.at("Roserade"),50,{moves.at("Energy Ball"),moves.at("Sludge Bomb"),moves.at("Shadow Ball"),moves.at("Extrasensory")});
Cynthia->setPkmn(pokemones2.at("Gastrodon"),50,{moves.at("Muddy Water"),moves.at("Earthquake"),moves.at("Stone Edge"),moves.at("Sludge Bomb")});
Cynthia->setPkmn(pokemones2.at("Lucario"),50,{moves.at("Aura Sphere"),moves.at("Dragon Pulse"),moves.at("Psychic"),moves.at("Earthquake")});
Cynthia->setPkmn(pokemones2.at("Milotic"),50,{moves.at("Surf"),moves.at("Ice Beam"),moves.at("Mirror Coat"),moves.at("Aqua Ring")});
Cynthia->setPkmn(pokemones2.at("Garchomp"),50,{moves.at("Dragon Rush"),moves.at("Earthquake"),moves.at("Brick Break"),moves.at("Giga Impact")});
fill(Cynthia);
}
Trainer* start(){
updateTrainers();
char teamBuilding;
string name;
Trainer *t;
cout << "Do you want to create your own team? [Y/N]: " << endl;
cin >> teamBuilding;
if(teamBuilding == 'Y' || teamBuilding == 'y'){
cout << "Choose your name: " << endl; cin >> name;
player->setName(name);
chooseTeam(player);
fill(player);
return player;
} else {
int name;
cout << "Choose your team: " << endl;
cout << "[1] Flint" << endl;
cout << "[2] Tobias" << endl;
cin >> name;
switch(name){
case 1:
return Flint;
break;
case 2:
return Tobias;
break;
}
}
return Flint;
}