Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | List of all members
core::pplmn::BattlePeoplemon Class Reference

Represents a Peoplemon in battle. Stores some extra state that only exists in battle. Wraps an underlying OwnedPeoplemon. More...

#include <BattlePeoplemon.hpp>

Public Member Functions

 BattlePeoplemon (OwnedPeoplemon *peoplemon)
 Construct a new Battle Peoplemon. More...
 
OwnedPeoplemonbase ()
 Returns the wrapped peoplemon. More...
 
const OwnedPeoplemonbase () const
 Returns the wrapped peoplemon. More...
 
const StatscurrentStats () const
 Returns the current stats of the peoplemon, including changes. More...
 
const BattleStatsbattleStages () const
 Returns the current battle-only stats of the peoplemon, including changes. More...
 
int getSpeed () const
 Returns the speed of this peoplemon, adjusted for ailments. More...
 
void applyDamage (int dmg)
 Applies damage to the peoplemon. Ensures that the hp does not go negative. More...
 
void giveHealth (int hp)
 Restores HP and ensures it does not go over max HP. More...
 
bool statChange (Stat stat, int diff)
 Apply a stage change to the given stat. More...
 
bool hasAilment (const battle::BattlerSubstate &state) const
 Returns whether or not the peoplemon has an ailment of any kind. More...
 
bool hasAilment (Ailment ail) const
 Returns true if the peoplemon has the specific ailment. More...
 
bool giveAilment (Ailment ail)
 Gives the peoplemon an ailment. More...
 
bool clearAilments (battle::BattlerSubstate *state)
 Clears all ailments the peoplemon has, including passive ailments if passed in. More...
 
SpecialAbility currentAbility () const
 Returns the current ability of this peoplemon. More...
 
void setCurrentAbility (SpecialAbility ability)
 Set an ability override, or None to fallback on the default. More...
 
void copyStages (const BattlePeoplemon &other)
 Copies the stat stages from the other peoplemon. More...
 
void resetStages ()
 Resets all stat stages. More...
 
void notifyInBattle ()
 Lets the peoplemon know that they have seen battle. More...
 
void resetSawBattle ()
 Resets that this peoplemon has seen battle. More...
 
bool hasSeenBattle () const
 Returns whether or not this peoplemon has seen battle (for exp gain) More...
 
std::int8_t & turnsUntilAwake ()
 The number of turns until the peoplemon wakes up. More...
 

Detailed Description

Represents a Peoplemon in battle. Stores some extra state that only exists in battle. Wraps an underlying OwnedPeoplemon.

Definition at line 25 of file BattlePeoplemon.hpp.

Constructor & Destructor Documentation

◆ BattlePeoplemon()

core::pplmn::BattlePeoplemon::BattlePeoplemon ( OwnedPeoplemon peoplemon)

Construct a new Battle Peoplemon.

Parameters
peoplemonThe peoplemon to wrap

Definition at line 11 of file BattlePeoplemon.cpp.

Member Function Documentation

◆ applyDamage()

void core::pplmn::BattlePeoplemon::applyDamage ( int  dmg)

Applies damage to the peoplemon. Ensures that the hp does not go negative.

Parameters
dmgThe amount of hp to reduce

Definition at line 27 of file BattlePeoplemon.cpp.

◆ base() [1/2]

OwnedPeoplemon & core::pplmn::BattlePeoplemon::base ( )

Returns the wrapped peoplemon.

Definition at line 19 of file BattlePeoplemon.cpp.

◆ base() [2/2]

const OwnedPeoplemon & core::pplmn::BattlePeoplemon::base ( ) const

Returns the wrapped peoplemon.

Definition at line 21 of file BattlePeoplemon.cpp.

◆ battleStages()

const BattleStats & core::pplmn::BattlePeoplemon::battleStages ( ) const

Returns the current battle-only stats of the peoplemon, including changes.

Definition at line 25 of file BattlePeoplemon.cpp.

◆ clearAilments()

bool core::pplmn::BattlePeoplemon::clearAilments ( battle::BattlerSubstate state)

Clears all ailments the peoplemon has, including passive ailments if passed in.

Parameters
stateOptional battler state
Returns
True if any ailments were cleared, false if already healthy

Definition at line 68 of file BattlePeoplemon.cpp.

◆ copyStages()

void core::pplmn::BattlePeoplemon::copyStages ( const BattlePeoplemon other)

Copies the stat stages from the other peoplemon.

Parameters
otherThe peoplemon to copy from

Definition at line 92 of file BattlePeoplemon.cpp.

◆ currentAbility()

SpecialAbility core::pplmn::BattlePeoplemon::currentAbility ( ) const

Returns the current ability of this peoplemon.

Definition at line 80 of file BattlePeoplemon.cpp.

◆ currentStats()

const Stats & core::pplmn::BattlePeoplemon::currentStats ( ) const

Returns the current stats of the peoplemon, including changes.

Definition at line 23 of file BattlePeoplemon.cpp.

◆ getSpeed()

int core::pplmn::BattlePeoplemon::getSpeed ( ) const

Returns the speed of this peoplemon, adjusted for ailments.

Definition at line 119 of file BattlePeoplemon.cpp.

◆ giveAilment()

bool core::pplmn::BattlePeoplemon::giveAilment ( Ailment  ail)

Gives the peoplemon an ailment.

Parameters
ailThe ailment to give
Returns
True if the ailment was given, false if an ailment is already present

Definition at line 61 of file BattlePeoplemon.cpp.

◆ giveHealth()

void core::pplmn::BattlePeoplemon::giveHealth ( int  hp)

Restores HP and ensures it does not go over max HP.

Parameters
hpThe amount of hp to restore

Definition at line 29 of file BattlePeoplemon.cpp.

◆ hasAilment() [1/2]

bool core::pplmn::BattlePeoplemon::hasAilment ( Ailment  ail) const

Returns true if the peoplemon has the specific ailment.

Parameters
ailThe ailment to check for
Returns
True if the peoplemon has it, false otherwise

Definition at line 59 of file BattlePeoplemon.cpp.

◆ hasAilment() [2/2]

bool core::pplmn::BattlePeoplemon::hasAilment ( const battle::BattlerSubstate state) const

Returns whether or not the peoplemon has an ailment of any kind.

Parameters
stateThe state of the battler the peoplemon belongs to

Definition at line 55 of file BattlePeoplemon.cpp.

◆ hasSeenBattle()

bool core::pplmn::BattlePeoplemon::hasSeenBattle ( ) const

Returns whether or not this peoplemon has seen battle (for exp gain)

Definition at line 115 of file BattlePeoplemon.cpp.

◆ notifyInBattle()

void core::pplmn::BattlePeoplemon::notifyInBattle ( )

Lets the peoplemon know that they have seen battle.

Definition at line 111 of file BattlePeoplemon.cpp.

◆ resetSawBattle()

void core::pplmn::BattlePeoplemon::resetSawBattle ( )

Resets that this peoplemon has seen battle.

Definition at line 113 of file BattlePeoplemon.cpp.

◆ resetStages()

void core::pplmn::BattlePeoplemon::resetStages ( )

Resets all stat stages.

Definition at line 98 of file BattlePeoplemon.cpp.

◆ setCurrentAbility()

void core::pplmn::BattlePeoplemon::setCurrentAbility ( SpecialAbility  ability)

Set an ability override, or None to fallback on the default.

Definition at line 82 of file BattlePeoplemon.cpp.

◆ statChange()

bool core::pplmn::BattlePeoplemon::statChange ( Stat  stat,
int  diff 
)

Apply a stage change to the given stat.

Parameters
statThe stat to change
diffThe number of stages to change by (negative to reduce)
Returns
True if the stat could be changed, false if not

Definition at line 31 of file BattlePeoplemon.cpp.

◆ turnsUntilAwake()

std::int8_t & core::pplmn::BattlePeoplemon::turnsUntilAwake ( )

The number of turns until the peoplemon wakes up.

Returns
std::int8_t&

Definition at line 124 of file BattlePeoplemon.cpp.


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