![]() |
Peoplemon
0.1.0
Peoplemon 3 game source documentation
|
Base class for battlers in the game. This provides storage for peoplemon and turn choices. More...
#include <Battler.hpp>
Public Member Functions | |
Battler () | |
Creates an uninitialized battler. More... | |
void | init (std::vector< core::pplmn::BattlePeoplemon > &&team, std::unique_ptr< BattlerController > &&controller) |
Initializes the battler with a team and a controller. More... | |
void | refresh () |
Calls refresh on the controller. Should be called every update. More... | |
bool | actionSelected () const |
Returns whether or not the battler has chosen what to do on this turn. More... | |
void | pickAction () |
Initiates the process of selecting what to do on this turn. More... | |
void | pickPeoplemon (bool fromFaint, bool reviveOnly) |
Initiates the process of selecting a replacement peoplemon if the current one faints. More... | |
TurnAction | chosenAction () const |
Returns the action the battler is using this turn. More... | |
int | chosenMove () const |
Returns the move the battler is using this turn. More... | |
core::item::Id | chosenItem () const |
Returns the item the battler is using this turn. More... | |
std::uint8_t | chosenPeoplemon () const |
Returns the peoplemon the battler is switching to this turn. More... | |
std::vector< core::pplmn::BattlePeoplemon > & | peoplemon () |
Returns all the peoplemon held by this battler. More... | |
core::pplmn::BattlePeoplemon & | activePeoplemon () |
Returns the peoplemon that is currently out. More... | |
void | setActivePeoplemon (unsigned int index) |
Sets the Peoplemon that is out now. More... | |
unsigned int | outNowIndex () const |
Returns the index of the peoplemon that is out now. More... | |
bool | canFight () const |
Returns true if the battler has at least one non-fainted peoplemon. More... | |
bool | canSwitch () const |
Returns whether or not the battler has another peoplemon besides the active one. More... | |
const std::string & | name () const |
Returns the name of the battler. More... | |
unsigned int | getPriority () const |
Returns the priority of the battler's action. Fight returns the move priority and other choices return 1000. Player goes first in case of tie. More... | |
BattlerSubstate & | getSubstate () |
Returns the state of this battler. More... | |
const BattlerSubstate & | getSubstate () const |
Returns the state of this battler. More... | |
void | notifyTurnBegin () |
Notifies the battler that a turn has began. More... | |
void | notifyTurnEnd () |
Notifies the battler that a turn has ended. More... | |
unsigned int | selectRandomPeoplemon () const |
Returns the index of a random, living Peoplemon that is not currently out. More... | |
bool | shouldContinue () const |
Returns whether or not the player has chosen to continue. More... | |
void | startChooseToContinue () |
Begins to decide whether or not to continue. More... | |
int | prizeMoney () const |
Returns the amount of prize money awarded for defeating this battler. More... | |
int | xpEarnerCount () const |
Returns how many of the current peoplemon should earn exp. More... | |
void | resetXpEarners () |
Resets who earns XP. More... | |
int | getFirstXpEarner () const |
Returns the index of the first peoplemon that should earn XP. More... | |
int | getNextXpEarnerIndex (int ci) |
Returns the index of the next peoplemon that should earn XP. More... | |
int | getBroCount () const |
Returns the number of total bros in the party, excluding the active peoplemon. More... | |
bool | removeItem (item::Id item) |
Removes the given item from the battler's inventory. More... | |
bool | isHost () const |
Returns whether or not this battler is the host. More... | |
Base class for battlers in the game. This provides storage for peoplemon and turn choices.
Definition at line 23 of file Battler.hpp.
core::battle::Battler::Battler | ( | ) |
Creates an uninitialized battler.
Definition at line 11 of file Battler.cpp.
bool core::battle::Battler::actionSelected | ( | ) | const |
Returns whether or not the battler has chosen what to do on this turn.
Definition at line 25 of file Battler.cpp.
core::pplmn::BattlePeoplemon & core::battle::Battler::activePeoplemon | ( | ) |
Returns the peoplemon that is currently out.
Definition at line 59 of file Battler.cpp.
bool core::battle::Battler::canFight | ( | ) | const |
Returns true if the battler has at least one non-fainted peoplemon.
Definition at line 84 of file Battler.cpp.
bool core::battle::Battler::canSwitch | ( | ) | const |
Returns whether or not the battler has another peoplemon besides the active one.
Definition at line 91 of file Battler.cpp.
TurnAction core::battle::Battler::chosenAction | ( | ) | const |
Returns the action the battler is using this turn.
Definition at line 39 of file Battler.cpp.
core::item::Id core::battle::Battler::chosenItem | ( | ) | const |
Returns the item the battler is using this turn.
Definition at line 53 of file Battler.cpp.
int core::battle::Battler::chosenMove | ( | ) | const |
Returns the move the battler is using this turn.
Definition at line 46 of file Battler.cpp.
std::uint8_t core::battle::Battler::chosenPeoplemon | ( | ) | const |
Returns the peoplemon the battler is switching to this turn.
Definition at line 55 of file Battler.cpp.
int core::battle::Battler::getBroCount | ( | ) | const |
Returns the number of total bros in the party, excluding the active peoplemon.
Definition at line 154 of file Battler.cpp.
int core::battle::Battler::getFirstXpEarner | ( | ) | const |
Returns the index of the first peoplemon that should earn XP.
Definition at line 136 of file Battler.cpp.
int core::battle::Battler::getNextXpEarnerIndex | ( | int | ci | ) |
Returns the index of the next peoplemon that should earn XP.
ci | The current index XP earner |
Definition at line 145 of file Battler.cpp.
unsigned int core::battle::Battler::getPriority | ( | ) | const |
Returns the priority of the battler's action. Fight returns the move priority and other choices return 1000. Player goes first in case of tie.
Definition at line 70 of file Battler.cpp.
BattlerSubstate & core::battle::Battler::getSubstate | ( | ) |
Returns the state of this battler.
Definition at line 100 of file Battler.cpp.
const BattlerSubstate & core::battle::Battler::getSubstate | ( | ) | const |
Returns the state of this battler.
Definition at line 102 of file Battler.cpp.
void core::battle::Battler::init | ( | std::vector< core::pplmn::BattlePeoplemon > && | team, |
std::unique_ptr< BattlerController > && | controller | ||
) |
Initializes the battler with a team and a controller.
team | The team of peoplemon to use |
controller | The controller to make decisions |
Definition at line 14 of file Battler.cpp.
bool core::battle::Battler::isHost | ( | ) | const |
Returns whether or not this battler is the host.
Definition at line 164 of file Battler.cpp.
const std::string & core::battle::Battler::name | ( | ) | const |
Returns the name of the battler.
Definition at line 68 of file Battler.cpp.
void core::battle::Battler::notifyTurnBegin | ( | ) |
Notifies the battler that a turn has began.
Definition at line 21 of file Battler.cpp.
void core::battle::Battler::notifyTurnEnd | ( | ) |
Notifies the battler that a turn has ended.
Definition at line 23 of file Battler.cpp.
unsigned int core::battle::Battler::outNowIndex | ( | ) | const |
Returns the index of the peoplemon that is out now.
Definition at line 66 of file Battler.cpp.
std::vector< core::pplmn::BattlePeoplemon > & core::battle::Battler::peoplemon | ( | ) |
Returns all the peoplemon held by this battler.
Definition at line 57 of file Battler.cpp.
void core::battle::Battler::pickAction | ( | ) |
Initiates the process of selecting what to do on this turn.
Definition at line 31 of file Battler.cpp.
void core::battle::Battler::pickPeoplemon | ( | bool | fromFaint, |
bool | reviveOnly | ||
) |
Initiates the process of selecting a replacement peoplemon if the current one faints.
fromFaint | True if the current has fainted, false if the switch is for another reason |
reviveOnly | True if fainted peoplemon must be selected |
Definition at line 37 of file Battler.cpp.
int core::battle::Battler::prizeMoney | ( | ) | const |
Returns the amount of prize money awarded for defeating this battler.
Definition at line 118 of file Battler.cpp.
void core::battle::Battler::refresh | ( | ) |
Calls refresh on the controller. Should be called every update.
Definition at line 98 of file Battler.cpp.
bool core::battle::Battler::removeItem | ( | item::Id | item | ) |
Removes the given item from the battler's inventory.
item | The item to remove |
Definition at line 162 of file Battler.cpp.
void core::battle::Battler::resetXpEarners | ( | ) |
Resets who earns XP.
Definition at line 132 of file Battler.cpp.
unsigned int core::battle::Battler::selectRandomPeoplemon | ( | ) | const |
Returns the index of a random, living Peoplemon that is not currently out.
Definition at line 104 of file Battler.cpp.
void core::battle::Battler::setActivePeoplemon | ( | unsigned int | index | ) |
Sets the Peoplemon that is out now.
index | The index of the peoplemon that is out now |
Definition at line 61 of file Battler.cpp.
bool core::battle::Battler::shouldContinue | ( | ) | const |
Returns whether or not the player has chosen to continue.
Definition at line 114 of file Battler.cpp.
void core::battle::Battler::startChooseToContinue | ( | ) |
Begins to decide whether or not to continue.
Definition at line 116 of file Battler.cpp.
int core::battle::Battler::xpEarnerCount | ( | ) | const |
Returns how many of the current peoplemon should earn exp.
Definition at line 123 of file Battler.cpp.