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

This controller allows an AI to battle. More...

#include <AIController.hpp>

+ Inheritance diagram for core::battle::AIController:

Public Member Functions

 AIController (pplmn::Id wildId)
 Construct a new AIController for a wild peoplemon. More...
 
 AIController (const std::string &trainerName, const std::vector< item::Id > &items)
 Construct a new AIController with the given items. More...
 
virtual void refresh () override
 Does nothing. More...
 
virtual const std::string & name () const override
 Returns the name of the battler. More...
 
virtual ~AIController ()=default
 Destroy the AIController object. More...
 
virtual bool removeItem (item::Id item) override
 Removes the item from the battler's inventory. More...
 
virtual bool isHost () const override
 Returns false. 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 an AI to battle.

Definition at line 16 of file AIController.hpp.

Constructor & Destructor Documentation

◆ AIController() [1/2]

core::battle::AIController::AIController ( pplmn::Id  wildId)

Construct a new AIController for a wild peoplemon.

Parameters
wildIdThe id of the wild peoplemon

Definition at line 11 of file AIController.cpp.

◆ AIController() [2/2]

core::battle::AIController::AIController ( const std::string &  trainerName,
const std::vector< item::Id > &  items 
)

Construct a new AIController with the given items.

Parameters
trainerNameThe name of the trainer being controlled
itemsThe items that may be used in battle

Definition at line 14 of file AIController.cpp.

◆ ~AIController()

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

Destroy the AIController 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::AIController::isHost ( ) const
overridevirtual

Returns false.

Implements core::battle::BattlerController.

Definition at line 58 of file AIController.cpp.

◆ name()

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

Returns the name of the battler.

Implements core::battle::BattlerController.

Definition at line 18 of file AIController.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::AIController::refresh ( )
overridevirtual

Does nothing.

Implements core::battle::BattlerController.

Definition at line 20 of file AIController.cpp.

◆ removeItem()

bool core::battle::AIController::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 48 of file AIController.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: