Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <random>
- #include <ctime>
- using namespace std;
- int AttackDamage(int, int);
- int Heal(int);
- int RandomNumberGenerator();
- int main() {
- int playerHealth = 100;
- int playerDamage = 25;
- int Ultramove = playerDamage + 20 * RandomNumberGenerator();
- int wolfHealth = 100;
- int generalMove = 1;
- int energy = 0;
- char input1, playerMove;
- string game;
- cout << "Wolf HP: " << wolfHealth << endl;
- cout << "Your HP: " << playerHealth << endl;
- while (playerHealth > 0 || wolfHealth > 0) {
- if (generalMove == 1) {
- cout << "\nType A to attack, H to heal or P to Pass and gain energy" << endl;
- cin >> playerMove;
- if (playerMove == 'a' || playerMove == 'A') {
- generalMove++;
- wolfHealth = AttackDamage(wolfHealth, playerDamage);
- cout << "Damage dealt: " << playerDamage << endl;
- cout << "Wolf HP: " << wolfHealth << endl;
- }
- else if (playerMove == 'h' || playerMove == 'H') {
- generalMove++;
- playerHealth = Heal(playerHealth);
- cout << "You regained: " << (2 * RandomNumberGenerator()) << " HP" << endl;
- cout << "Your Health: " << playerHealth << endl;
- }
- else if (playerMove == 'P' || playerMove == 'p') {
- generalMove++;
- energy++;
- cout << "Energy gained " << energy << endl;
- if (energy == 3) {
- cout << "Hurry! You have enough energy to use Ultra move! " << endl;
- cout << "Press X to use ultramove " << endl;
- }
- }
- else if (playerMove == 'X' || playerMove == 'x') {
- generalMove++;
- wolfHealth = AttackDamage(wolfHealth, Ultramove);
- cout << "Damage dealt: " << Ultramove << endl;
- cout << "Wolf HP: " << wolfHealth << endl;
- }
- }
- else {
- int wolfDamage = 15 + RandomNumberGenerator();
- generalMove--;
- playerHealth = AttackDamage(playerHealth, wolfDamage);
- cout << "\nDamage Recieved: " << wolfDamage << endl;
- cout << "Your HP: " << playerHealth << endl;
- cout << "___________________________________________________________________" << endl;
- }
- }
- if (wolfHealth < 0) {
- cout << "You win!" << endl;
- }
- else if (playerHealth < 0 && wolfHealth < 0) {
- cout << "You both died" << endl;
- }
- else if (playerHealth < 0) {
- cout << "You lost!" << endl;
- }
- }
- int AttackDamage(int hp, int dmg) {
- hp -= dmg;
- return hp;
- }
- int Heal(int hp) {
- hp += (2 * RandomNumberGenerator());
- return hp;
- }
- int RandomNumberGenerator() {
- int randomNumber = 0;
- default_random_engine generator(time(NULL));
- uniform_int_distribution<int> interval(1, 10);
- randomNumber = interval(generator);
- return randomNumber;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement