Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
dcrawlerproject/defendandpowerup.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
62 lines (57 sloc)
2.02 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "RandomGenerating.h" | |
#include <iostream> | |
#include <stdlib.h> | |
#include <stdio.h> | |
using namespace std; | |
// after a player uses defend or powerup think of a way to keep the defense or powerup for 2 or 3 turns you don't have to if you don't want to | |
int defend(int characterdefence) | |
{ | |
int characterdefencenew; | |
int defenceincrease; | |
defenceincrease = RNG() + 5; | |
characterdefencenew = characterdefence + defenceincrease; | |
if (characterdefencenew >= 10) | |
{ | |
cout << "You look your enemy straight in the eye." | |
<< "\n" << " You lower down clenching your weapon tight, ready to defend agaisnt the next strike." | |
<< "\n" << " Your dfence has gone up by " << characterdefencenew << endl; | |
} | |
if (characterdefencenew < 10) | |
{ | |
cout << "You look at the enemy and you shout 'come at me'" | |
<< "\n" << " Your defence has gone up to" << characterdefencenew << endl; | |
} | |
return characterdefencenew; | |
} | |
int powerup (int strenght) | |
{ | |
int powerdupstrenght: | |
int powerup; | |
powerup = RNG() + 5; | |
powerdupstrenght = strenght + powerup | |
if (powerdupstrenght >= 10) | |
{ | |
cout << "You feel your self gaining strenght. " << "\n" << "You look up at the ceiling and scream from the top of your lungs." << "\n" | |
<< " You look back at your enemy he seems just as angry as before" << "\n" << " Your strewnght has gone up by " << powerdupstrenght << endl; | |
} | |
if (powerdupstrenght < 10) | |
{ | |
cout << "you focus on your enemy looking straight at him " << "\n" << "your strenght has gone up to " << powerdupstrenght << endl; | |
} | |
return powerdupstrenght | |
} | |
int heal (int& health) | |
{ | |
if(health < 30) | |
{ | |
int healthincrease; | |
healthincrease= RNG() + 2; | |
health = health + healthincrease; | |
cout << "You healed yourself for a total of" << healthincrease << endl; | |
} | |
if (health >= 30) | |
{ | |
cout << "Your health is alredy at the limit." << | |
"\n" << " You can't heal more than 30." endl; | |
} | |
} |