cirno-puzzle/hero.h

45 lines
882 B
C++

#ifndef HERO_H
#define HERO_H
enum class Direction
{
Left,
Up,
Right,
Down,
None
};
using coordinate = unsigned int;
/// Represents a controlable by player game character
class Hero
{
private:
int hero_charges;
coordinate pos_x, pos_y;
public:
explicit Hero(coordinate position_x = 0, coordinate position_y = 0, int initial_charges = 0);
/// Add more charges for hero to use
void refillCharges(int append_charges);
/// Get amount of charges
int charges() const noexcept;
/// Spend one charge on action
bool useCharge();
/// Get current Hero position
void position(coordinate &x, coordinate &y) const noexcept;
/// Set Hero position explicitly
void setPosition(coordinate x, coordinate y);
/// Move hero by one cell to any direction
void move(const Direction &direction);
};
#endif // HERO_H