#include "hero.h" Hero::Hero(int position_x, int position_y, int initial_charges) : hero_charges(initial_charges), pos_x(position_x), pos_y(position_y) {} void Hero::refillCharges(int append_charges) { hero_charges += append_charges; } int Hero::charges() const noexcept { return hero_charges; } bool Hero::useCharge() { if (hero_charges > 0) { --hero_charges; return true; } return false; } void Hero::position(int &x, int &y) const noexcept { x = pos_x; y = pos_y; } void Hero::move(Direction &direction) { switch (direction) { case Direction::UP: --pos_y; break; case Direction::DOWN: ++pos_y; break; case Direction::LEFT: --pos_x; break; case Direction::RIGHT: ++pos_x; break; case Direction::NONE: break; } }