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/combat.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 (54 sloc)
1.96 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> | |
#include "save.cpp" | |
using namespace std; | |
int combat(int& health, int strength, int itembonus, int enemedefense) | |
{ | |
int damage; | |
int damagetoenemy; | |
damage = RNG() + itembonus + strength+ takeWeapon (1); | |
damagetoenemy = damage - enemedefense; | |
if (1 <= damagetoenemy && 10 > damagetoenemy) | |
{ | |
cout << "You've done " << damage << " damage to the enemy, but because of his defense he took " << damagetoenemy << " damage" << endl; | |
} | |
else if (damagetoenemy <= 0) | |
{ | |
cout << "You did " << damage << "to the enemy but because of his defense he took no damage "<< endl; | |
} | |
else if (damagetoenemy >= 10) | |
{ | |
cout << "Holy Shit you did " << damage << " damage and his defense bearly managed to protect him and he took " << damagetoenemy << " damage, He growls in anger" << endl; | |
} | |
if (damagetoenemy >= 0) | |
{ | |
health = health - damagetoenemy; | |
} | |
return damagetoenemy; | |
} | |
int combat2(int& health, int strength, int itembonus, int characterdefense) | |
{ | |
int damage; | |
int damagetocharacter; | |
damage = RNG() + itembonus + strength ; | |
damagetocharacter = damage - characterdefense- takeArmour(1) ; | |
if (1 <= damagetocharacter && 10 > damagetocharacter) | |
{ | |
cout << "Enemy did " << damage << " damage to you, but because of your defense you took " << damagetocharacter << " damage" << endl; | |
} | |
else if (damagetocharacter <= 0) | |
{ | |
cout << "Enemy did " << damage << " damage to you but because of your defense you took no damage "<< damagetocharacter <<endl; | |
} | |
else if (damagetocharacter >= 10) | |
{ | |
cout << "Holy Shit they did " << damage << " damage and your defense barely managed to protect you and you took " << damagetocharacter << " damage"<< endl; | |
} | |
if (damagetocharacter >= 0 ) | |
{ | |
health = health - damagetocharacter; | |
} | |
return damagetocharacter; | |
} | |