Guest User

Untitled

a guest
May 22nd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. srand(time(0));
  2. int maxDamage = armor + health;
  3. int damage = rand() % maxDamage + 1;
  4. if(damage < armor)
  5. {
  6. armor -= damage;
  7. }
  8. if(damage >= armor && damage <= maxDamage)
  9. {
  10. armor = 0;
  11. health -= (damage - armor);
  12. }
  13. if(damage > maxDamage)
  14. {
  15. cout << "\t\tThe orcs were stronger than you and you are now dead.\n";
  16. cout << "\t\tHope you had fun playing. Goodbye.\n\n";
  17. break;
  18. }
  19.  
  20. cout << "They put up a good fight but take your armor down to: " << armor << "\n";
  21. cout << "And your health is at: " << health << "\n\n";
  22. break;
Add Comment
Please, Sign In to add comment