Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. void Enemies::walka(Player& p1)
  2. {
  3. srand(time(0));
  4. system("cls");
  5. p1.showStats();
  6. cout << " --- VS --- " << "\n\n";
  7. cout << " | Enemy: " << goblin[rand()%6].name << " | " << "\n"
  8. << " | HP: " << goblin[rand() % 6].hp << " | Attack: " << goblin[rand() % 6].attack << " | " << "\n\n";
  9.  
  10.  
  11. while (goblin[rand() % 6].hp >= 0)
  12. {
  13. cout << " --- What you want to do? --- " << "\n"
  14. << " (0) Cancel adventure | (1) Attack! " << "\n\n";
  15.  
  16. int choice;
  17. cin >> choice;
  18. cin.clear();
  19.  
  20. if(choice ==1)
  21. {
  22. goblin[rand() % 6].hp-= p1.damage;
  23. p1.hp -= goblin[rand() % 6].attack;
  24. cout << " Enemy HP: " << goblin[rand() % 6].hp << "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement