Skip to content
Permalink
92524fadfe
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
62 lines (54 sloc) 1.96 KB
#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;
}