2011-07-01 18:10:45 +00:00
|
|
|
#include "player.h"
|
|
|
|
|
2011-07-02 00:00:19 +00:00
|
|
|
Player::Player(string name, unsigned int colour)
|
2011-07-01 18:10:45 +00:00
|
|
|
{
|
2011-07-02 00:00:19 +00:00
|
|
|
this->name = name;
|
2011-07-01 18:10:45 +00:00
|
|
|
this->colour = colour;
|
2011-07-04 05:27:56 +00:00
|
|
|
energy = 25;
|
2011-07-01 18:10:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Player::add_energy(unsigned int amount)
|
|
|
|
{
|
|
|
|
energy += amount;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Player::spend_energy(unsigned int amount)
|
|
|
|
{
|
|
|
|
if (amount > energy) return false;
|
|
|
|
|
|
|
|
energy -= amount;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Player::set_played()
|
|
|
|
{
|
|
|
|
played = true;
|
|
|
|
}
|