Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Enemies::walka(Player& p1)
- {
- srand(time(0));
- system("cls");
- p1.showStats();
- cout << " --- VS --- " << "\n\n";
- cout << " | Enemy: " << goblin[rand()%6].name << " | " << "\n"
- << " | HP: " << goblin[rand() % 6].hp << " | Attack: " << goblin[rand() % 6].attack << " | " << "\n\n";
- while (goblin[rand() % 6].hp >= 0)
- {
- cout << " --- What you want to do? --- " << "\n"
- << " (0) Cancel adventure | (1) Attack! " << "\n\n";
- int choice;
- cin >> choice;
- cin.clear();
- if(choice ==1)
- {
- goblin[rand() % 6].hp-= p1.damage;
- p1.hp -= goblin[rand() % 6].attack;
- cout << " Enemy HP: " << goblin[rand() % 6].hp << "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement