Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void battle(struct player *players) {
- for(int i = 0; i <= 4; i++) {
- if(players[i].hp <= 0 && players[i].ally == "ally" && !players[i].dead) {
- players[i].dead = true;
- ac -= 1;
- players[i].hp = 0;
- break;
- }
- if(players[i].hp <= 0 && players[i].ally == "enemy" && !players[i].dead) {
- ec -= 1;
- players[i].dead = true;
- players[i].hp = 0;
- break;
- }
- if(ac <= 0) {
- cout << "\nDefeat\n";
- cin.get();
- cin.get();
- return;
- }
- if(ec <= 0) {
- cout << "\nVictory!\n";
- while(true) {
- if(players[3].exp >= players[3].expmax && players[4].exp >= players[4].expmax) break;
- for(int i = 0; i <= 2; i++) {
- if(players[i].dead)i++;
- players[i].exp += players[3].expmax;
- players[i].exp += players[4].expmax;
- players[3].exp++;
- players[4].exp++;
- if(players[i].exp >= players[i].expmax) {
- players[i].hpmax += 10;
- players[i].agi++;
- players[i].lvl++;
- players[i].exp = 0;
- players[i].expmax *= 2;
- players[i].mpmax += 10;
- cout << players[i].name << " Leveled Up!\n";
- }
- }
- gold += players[3].gold;
- gold += players[4].gold;
- }
- return;
- }
- turn = findturn(players);
- if(players[turn].ally == "ally") {
- cout << players[turn].name << endl;
- for(int c = 0; c <= 2; c++) {
- cout << c << " - " << players[turn].abilities[c].name << endl;
- }
- cin >> input;
- cout << "Who do you want to target?\n";
- for(int j = 0; j <= 4; j++) {
- cout << j << " - " << players[j].name << " Hp: " << players[j].hp << endl;
- }
- cin >> target;
- if(players[target].dead) {
- cout << "\nAlready dead\n";
- players[turn].ct = 0;
- turn = findturn(players);
- break;
- }
- checkabi(players, turn, target, input); break;
- }
- if(players[turn].ally == "enemy") {
- while(true) {
- if(players[etarget].dead || players[etarget].ally == "enemy") {
- if(ac <= 0) break;
- etarget = rand() % 4;
- }
- if(!players[etarget].dead || players[etarget].ally == "ally") break;
- }
- checkabi(players, turn, etarget, eability);
- players[turn].ct = 0;
- etarget = rand() % 4;
- eability = rand() % 2;
- }
- }
- battle(players);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement