26 lines
367 B
C++
26 lines
367 B
C++
#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;
|
|
}
|