No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

51 líneas
816 B

#ifndef _2EASY4ME_PLAYER_H_
#define _2EASY4ME_PLAYER_H_
#include "character.hpp"
class Player : public Character
{
protected:
int xp;
int level;
public:
Player(char *name)
: Character(name)
{
this->xp = 0;
this->level = 1;
}
Player(char *name, int hp, int att, int def, int level, int xp)
: Character(name, hp, att, def)
{
this->xp = xp;
this->level = level;
}
bool checkLevelup()
{
return xp > (level * level);
}
bool levelUp(int stat)
{
switch (stat)
{
case 1:
hp += 10;
break;
case 2:
att += 2;
break;
case 3:
def += 1;
break;
}
xp -= level * level;
}
};
#endif