Skip to content
Permalink
master
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
#ifndef CHARACTER_H
#define CHARACTER_H
#include <string>
#include <locale>
#include <ctype.h>
#include <cstdlib>
#include <math.h>
#include <unistd.h>
#include <iostream>
unsigned int sleep(unsigned int seconds);
using namespace std;
class Character
{
private:
/*
* The UNDERSCORE is mainly so you know it's private!
*/
string _name;
int _level;
int _health;
int _hpThres;
int _exp;
int _expThres;
int _bonusDEF; // UNUSED
int _bonusATK; // UNUSED
int _totalATK; // UNUSED
int _attack;
int _damageMin;
int _damageMax;
int _defense;
int _money;
int _item;
public:
Character();
Character(const string name);
virtual ~Character();
//Functions
void init (const string name);
string getAsString();
void setBonus(int n, int m){
this->_attack = _attack + n;
this->_defense = _defense + m;
}
void levelUp(int exp){
while (this->_exp >= this->_expThres)
{
this->_exp -= this->_expThres;
if (_level < 40){
this->_level++;
this->_expThres = (_level*100) - 50;
cout << "Congratulations!! You leveled up!!" << endl;
}
}
}
void levelMatch(int lvl){
this->_level = _level + lvl;
this->_health = _level + _health;
this->_hpThres = _level + _hpThres;
}
void damage(int dmg){
if (dmg <= 0)
{
dmg = 1;
}
this->_health = _health - dmg;
}
void CanGuard(bool check){
if(check == true)
{
cout << "Guard failed!";
}
}
void MoneyGain(int munny){
this->_money = _money += munny;
}
void HealthRestore(int hp){
this->_health = pow(_health, 0);
this->_health = _health + (hp-1);
}
void ItemCount(int num){
this->_item = _item + num;
}
//Accessors
inline const string& getName() const {return this->_name;}
inline const int& getLevel() const {return this->_level;}
inline const int& getHealth() const {return this->_health;}
inline const int& getHPThres() const {return this->_hpThres;}
inline const int& getEXP() const {return this->_exp;}
inline const int& getEXPThres() const {return this->_expThres;}
inline const int& getAttack() const {return this->_attack;}
inline const int& getDamageMin() const {return this->_damageMin;}
inline const int& getDamageMax() const {return this->_damageMax;}
inline const int& getDefense() const {return this->_defense;}
inline const int& getMoney() const {return this->_money;}
inline const int& getItem() const {return this->_item;}
//Modifiers
};
#endif