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

This controller allows the player to control a battler. More...

#include <PlayerController.hpp>

+ Inheritance diagram for core::battle::PlayerController:

Public Member Functions

 PlayerController (system::Player &player, view::PlayerMenu &menu)
 Construct a new Player Controller. More...
 
virtual ~PlayerController ()=default
 Destroy the Player Controller object. More...
 
virtual const std::string & name () const override
 Returns the name of the battler. More...
 
virtual void refresh () override
 Checks the menu state. More...
 
virtual bool removeItem (item::Id item) override
 Removes the item from the battler's inventory. More...
 
virtual bool isHost () const override
 Returns true. More...
 
void setOwner (Battler &owner)
 Sets the owner of this controller. 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...
 

Protected Member Functions

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

This controller allows the player to control a battler.

Definition at line 22 of file PlayerController.hpp.

Constructor & Destructor Documentation

◆ PlayerController()

core::battle::PlayerController::PlayerController ( system::Player player,
view::PlayerMenu menu 
)

Construct a new Player Controller.

Parameters
playerThe player system
menuThe menu to get player choices from

Definition at line 11 of file PlayerController.cpp.

◆ ~PlayerController()

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

Destroy the Player Controller object.

Member Function Documentation

◆ actionSelected()

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

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)
protectedinherited

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 
)
protectedinherited

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)
protectedinherited

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)
protectedinherited

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 ( )
protectedinherited

Chooses to run away.

Definition at line 65 of file BattlerController.cpp.

◆ chooseToContinue()

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

Prompts the player to continue or not.

Definition at line 26 of file BattlerController.cpp.

◆ chosenAction()

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

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
inherited

Returns the item the battler is using this turn.

Definition at line 37 of file BattlerController.cpp.

◆ chosenMove()

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

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
inherited

Returns the peoplemon the battler is switching to this turn.

Definition at line 39 of file BattlerController.cpp.

◆ isHost()

bool core::battle::PlayerController::isHost ( ) const
overridevirtual

Returns true.

Implements core::battle::BattlerController.

Definition at line 69 of file PlayerController.cpp.

◆ name()

const std::string & core::battle::PlayerController::name ( ) const
overridevirtual

Returns the name of the battler.

Implements core::battle::BattlerController.

Definition at line 9 of file PlayerController.cpp.

◆ pickAction()

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

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 
)
inherited

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()

void core::battle::PlayerController::refresh ( )
overridevirtual

Checks the menu state.

Implements core::battle::BattlerController.

Definition at line 16 of file PlayerController.cpp.

◆ removeItem()

bool core::battle::PlayerController::removeItem ( item::Id  item)
overridevirtual

Removes the item from the battler's inventory.

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

Implements core::battle::BattlerController.

Definition at line 67 of file PlayerController.cpp.

◆ setOwner()

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

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
inherited

Returns whether or not the player has chosen to continue.

Definition at line 31 of file BattlerController.cpp.

Member Data Documentation

◆ dontGiveUp

bool core::battle::BattlerController::dontGiveUp
inherited

Definition at line 190 of file BattlerController.hpp.

◆ move

int core::battle::BattlerController::move
inherited

Definition at line 189 of file BattlerController.hpp.

◆ owner

Battler* core::battle::BattlerController::owner
protectedinherited

Definition at line 119 of file BattlerController.hpp.

◆ useItem

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

Definition at line 188 of file BattlerController.hpp.


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