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
|
int bonus = 1+(rand()%5);
cin >> battle;
if (battle == 1)
atk = baseAtk + bonus;
enemyHealth = enemyHealth - atk;
Beep(646,20);
Beep(810,30);
cout << "You did " << atk << " damage!\n";
cin.ignore();
cin.get();
if (enemyHealth <= 0)
goto win;
int eBonus = 1+(rand()%5);
eAtk = enemyAtk + eBonus;
baseHealth = baseHealth - eAtk;
Beep(656,20);
Beep(327,30);
system("color c");
system("color 4");
system("color c");
system("color 4");
system("color c");
system("color c");
system("color 4");
system("color c");
system("color 0f");
cout << "The enemy did " << eAtk << " damage!\n\n";
cin.get();
if (baseHealth <= 0 ){
system("color 4");
Beep(334,30);
Beep(296, 25);
Beep(252, 23);
Beep(177, 20);
Beep(143, 27);
Beep(102, 60);
cout << "You died!";
goto mainMenu;
}
}while (enemyHealth >= 1);
win:
Beep(634, 37);
Beep(679, 35);
Beep(732, 40);
Beep(900, 100);
Beep(978, 400);
int winExp = 1+(rand()%20);
exp = exp + winExp;
int winGold = 28+(rand()%30);
gold = gold + winGold;
cout << "You won!\n\n";
cout << "You got " << winExp << " exp!\n\n";
cout << "You got " << winGold << " gold!\n\n";
cin.get();
system("cls");
|