Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
core::battle::BattlerController Class Referenceabstract

Base class for battlers in the game. This provides storage for peoplemon and turn choices. More...

#include <BattlerController.hpp>

+ Inheritance diagram for core::battle::BattlerController:

Public Member Functions

virtual ~BattlerController ()=default
 Destroy the Battler Controller object. More...
 
void setOwner (Battler &owner)
 Sets the owner of this controller. More...
 
virtual const std::string & name () const =0
 Returns the name of the battler. More...
 
virtual void refresh ()=0
 Method that allows controllers to poll status from non-callback based sources. 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...
 
bool shouldContinue () const
 Returns whether or not the player has chosen to continue. More...
 
void chooseToContinue ()
 Prompts the player to continue or not. More...
 
virtual bool removeItem (item::Id item)=0
 Removes the item from the battler's inventory. More...
 
virtual bool isHost () const =0
 Return whether or not the controlled battler is the host. More...
 

Protected Member Functions

 BattlerController ()
 Initializes the battler with the peoplemon available to it. More...
 
virtual void startChooseAction ()=0
 Base classes may override this to perform specific logic to occur when a turn is made. More...
 
virtual void startChoosePeoplemon (bool fromFaint, bool reviveOnly)=0
 Base classes may override this to perform specific logic when a peoplemon must be picked. More...
 
virtual void startChooseToContinue ()=0
 Prompts the player to continue or not. More...
 
void chooseMove (int move)
 Selects the move to use this turn when fighting. More...
 
void choosePeoplemon (std::uint8_t i)
 Selects the peoplemon to switch to. More...
 
void chooseItem (std::uint8_t pplIndex, core::item::Id item)
 Selects the item to use. More...
 
void chooseRun ()
 Chooses to run away. More...
 
void chooseGiveUp (bool yes)
 Choose whether to give up or not. More...
 

Protected Attributes

Battlerowner
 

Detailed Description

Base class for battlers in the game. This provides storage for peoplemon and turn choices.

Definition at line 20 of file BattlerController.hpp.

Constructor & Destructor Documentation

◆ ~BattlerController()

virtual core::battle::BattlerController::~BattlerController ( )
virtualdefault

Destroy the Battler Controller object.

◆ BattlerController()

core::battle::BattlerController::BattlerController ( )
protected

Initializes the battler with the peoplemon available to it.

Parameters
peoplemonThe peoplemon to use in battle

Definition at line 7 of file BattlerController.cpp.

Member Function Documentation

◆ actionSelected()

bool core::battle::BattlerController::actionSelected ( ) const

Returns whether or not the battler has chosen what to do on this turn.

Definition at line 14 of file BattlerController.cpp.

◆ chooseGiveUp()

void core::battle::BattlerController::chooseGiveUp ( bool  yes)
protected

Choose whether to give up or not.

Parameters
yesTrue to give up, false to continue

Definition at line 41 of file BattlerController.cpp.

◆ chooseItem()

void core::battle::BattlerController::chooseItem ( std::uint8_t  pplIndex,
core::item::Id  item 
)
protected

Selects the item to use.

Parameters
pplIndexIndex of the peoplemon to use the item on
itemThe item to use

Definition at line 58 of file BattlerController.cpp.

◆ chooseMove()

void core::battle::BattlerController::chooseMove ( int  move)
protected

Selects the move to use this turn when fighting.

Parameters
moveThe index of the move to use

Definition at line 46 of file BattlerController.cpp.

◆ choosePeoplemon()

void core::battle::BattlerController::choosePeoplemon ( std::uint8_t  i)
protected

Selects the peoplemon to switch to.

Parameters
iIndex of the peoplemon to switch to

Definition at line 52 of file BattlerController.cpp.

◆ chooseRun()

void core::battle::BattlerController::chooseRun ( )
protected

Chooses to run away.

Definition at line 65 of file BattlerController.cpp.

◆ chooseToContinue()

void core::battle::BattlerController::chooseToContinue ( )

Prompts the player to continue or not.

Definition at line 26 of file BattlerController.cpp.

◆ chosenAction()

TurnAction core::battle::BattlerController::chosenAction ( ) const

Returns the action the battler is using this turn.

Definition at line 33 of file BattlerController.cpp.

◆ chosenItem()

core::item::Id core::battle::BattlerController::chosenItem ( ) const

Returns the item the battler is using this turn.

Definition at line 37 of file BattlerController.cpp.

◆ chosenMove()

int core::battle::BattlerController::chosenMove ( ) const

Returns the move the battler is using this turn.

Definition at line 35 of file BattlerController.cpp.

◆ chosenPeoplemon()

std::uint8_t core::battle::BattlerController::chosenPeoplemon ( ) const

Returns the peoplemon the battler is switching to this turn.

Definition at line 39 of file BattlerController.cpp.

◆ isHost()

virtual bool core::battle::BattlerController::isHost ( ) const
pure virtual

Return whether or not the controlled battler is the host.

Implemented in core::battle::RemoteController, core::battle::PlayerController, and core::battle::AIController.

◆ name()

virtual const std::string& core::battle::BattlerController::name ( ) const
pure virtual

Returns the name of the battler.

Implemented in core::battle::RemoteController, core::battle::PlayerController, and core::battle::AIController.

◆ pickAction()

void core::battle::BattlerController::pickAction ( )

Initiates the process of selecting what to do on this turn.

Definition at line 16 of file BattlerController.cpp.

◆ pickPeoplemon()

void core::battle::BattlerController::pickPeoplemon ( bool  fromFaint,
bool  reviveOnly 
)

Initiates the process of selecting a replacement peoplemon if the current one faints.

Parameters
fromFaintTrue if the current has fainted, false if the switch is for another reason
reviveOnlyTrue if fainted peoplemon must be selected

Definition at line 21 of file BattlerController.cpp.

◆ refresh()

virtual void core::battle::BattlerController::refresh ( )
pure virtual

Method that allows controllers to poll status from non-callback based sources.

Implemented in core::battle::RemoteController, core::battle::PlayerController, and core::battle::AIController.

◆ removeItem()

virtual bool core::battle::BattlerController::removeItem ( item::Id  item)
pure virtual

Removes the item from the battler's inventory.

Parameters
itemThe item to remove
Returns
True if the item was removed, false otherwise

Implemented in core::battle::RemoteController, core::battle::PlayerController, and core::battle::AIController.

◆ setOwner()

void core::battle::BattlerController::setOwner ( Battler owner)

Sets the owner of this controller.

Parameters
ownerThe battler using this controller

Definition at line 12 of file BattlerController.cpp.

◆ shouldContinue()

bool core::battle::BattlerController::shouldContinue ( ) const

Returns whether or not the player has chosen to continue.

Definition at line 31 of file BattlerController.cpp.

◆ startChooseAction()

virtual void core::battle::BattlerController::startChooseAction ( )
protectedpure virtual

Base classes may override this to perform specific logic to occur when a turn is made.

◆ startChoosePeoplemon()

virtual void core::battle::BattlerController::startChoosePeoplemon ( bool  fromFaint,
bool  reviveOnly 
)
protectedpure virtual

Base classes may override this to perform specific logic when a peoplemon must be picked.

Parameters
fromFaintTrue if the current has fainted, false if the switch is for another reason
reviveOnlyTrue if fainted peoplemon must be selected

◆ startChooseToContinue()

virtual void core::battle::BattlerController::startChooseToContinue ( )
protectedpure virtual

Prompts the player to continue or not.

Member Data Documentation

◆ dontGiveUp

bool core::battle::BattlerController::dontGiveUp

Definition at line 190 of file BattlerController.hpp.

◆ move

int core::battle::BattlerController::move

Definition at line 189 of file BattlerController.hpp.

◆ owner

Battler* core::battle::BattlerController::owner
protected

Definition at line 119 of file BattlerController.hpp.

◆ useItem

core::item::Id core::battle::BattlerController::useItem

Definition at line 188 of file BattlerController.hpp.


The documentation for this class was generated from the following files: