cirno-puzzle/hero.cpp

26 lines
367 B
C++
Raw Normal View History

2020-02-19 18:50:09 +01:00
#include "hero.h"
Hero::Hero(int initial_charges) :
hero_charges(initial_charges)
{}
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;
}