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

Represents an instance of a peoplemon. Can be a wild peoplemon, trainer, or player peoplemon. Only contains persistent data specific to the individual peoplemon. More...

#include <OwnedPeoplemon.hpp>

Public Member Functions

 OwnedPeoplemon ()
 Makes an empty peoplemon with id Unknown. More...
 
 OwnedPeoplemon (Id id, unsigned int level)
 Makes a peoplemon of the given type and level. More...
 
bool loadLegacyFile (const std::string &file)
 Loads the peoplemon from a legacy file. More...
 
Id id () const
 Returns the id of this peoplemon. More...
 
void evolve ()
 Changes this Peoplemon into it's evolved form if it has one. More...
 
const std::string & name () const
 Returns the name of this peoplemon, custom or defualt. More...
 
void setCustomName (const std::string &name)
 Sets a custom name for this peoplemon. More...
 
Type type () const
 Returns the type of the peoplemon. More...
 
unsigned int currentLevel () const
 Returns the current level of this peoplemon. More...
 
unsigned int evolveLevel () const
 Returns the level that this people can evolve at. More...
 
Id evolvesInto () const
 Returns the people that this evolves into. Returns Unknown if no evolution. More...
 
bool & pendingEvolution ()
 Flag set by battle controller when this people is able to evolve after battle. More...
 
bool pendingEvolution () const
 Flag set by battle controller when this people is able to evolve after battle. More...
 
unsigned int currentXP () const
 Returns the current XP of this peoplemon. More...
 
unsigned int nextLevelXP () const
 Returns the xp required to level up. More...
 
unsigned int awardXP (unsigned int xp)
 Award XP to this peoplemon. A return of 0 indicates that all XP has been awarded. Non zero indicates that the peoplemon should level up. More...
 
MoveId levelUp ()
 Levels up the peoplemon. More...
 
Stats currentStats () const
 Returns the computed stats for the peoplemon. Does not take into account changes during battle. More...
 
const StatscurrentEVs () const
 Returns the current EVs of this peoplemon. More...
 
const StatscurrentIVs () const
 Returns the current IVs of this peoplemon. More...
 
std::uint16_t & currentHp ()
 Access the current HP. More...
 
std::uint16_t currentHp () const
 Returns the current HP. 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...
 
void awardEVs (const Stats &evs)
 Award EVs to this peoplemon. More...
 
AilmentcurrentAilment ()
 Access the current ailment of this peoplemon. More...
 
Ailment currentAilment () const
 Access the current ailment of this peoplemon. More...
 
item::IdholdItem ()
 Access the current hold item of this peoplemon. More...
 
item::Id holdItem () const
 Access the current hold item of this peoplemon. More...
 
SpecialAbility ability () const
 Returns the special ability of this peoplemon. More...
 
const OwnedMoveknownMoves () const
 Returns the moves known by this Peoplemon. More...
 
OwnedMoveknownMoves ()
 Returns the moves known by this Peoplemon. More...
 
bool knowsMove (MoveId move) const
 Returns whether or not this peoplemon knows the given move. More...
 
void learnMove (MoveId move, unsigned int i)
 Teaches the peoplemon the given move, potentially replacing an existing one. More...
 
bool gainMove (MoveId move)
 Attempts to learn the given move if there is an open slot. More...
 
void heal ()
 Restores HP and removes ailments. More...
 
bool hasExpShare () const
 Returns whether or not this peoplemon has an EXP share. More...
 
unsigned int xpYield (bool isTrainer) const
 Returns the XP awarded by defeating this peoplemon. More...
 
OwnedMovefindMove (MoveId id)
 Returns the OwnedMove for the given move. More...
 
bool shakePasses (item::Id ball, int turnNumber, unsigned int opLevel)
 Performs the check that a shake would occur with the given peopleball. More...
 
bool canClone () const
 Returns whether or not this peoplemon can be cloned. More...
 

Friends

struct WildPeoplemon
 
class BattlePeoplemon
 
struct bl::serial::SerializableObject< OwnedPeoplemon >
 
class editor::component::OwnedPeoplemonWindow
 

Detailed Description

Represents an instance of a peoplemon. Can be a wild peoplemon, trainer, or player peoplemon. Only contains persistent data specific to the individual peoplemon.

Definition at line 44 of file OwnedPeoplemon.hpp.

Constructor & Destructor Documentation

◆ OwnedPeoplemon() [1/2]

core::pplmn::OwnedPeoplemon::OwnedPeoplemon ( )

Makes an empty peoplemon with id Unknown.

Definition at line 32 of file OwnedPeoplemon.cpp.

◆ OwnedPeoplemon() [2/2]

core::pplmn::OwnedPeoplemon::OwnedPeoplemon ( Id  id,
unsigned int  level 
)

Makes a peoplemon of the given type and level.

Parameters
idThe species of peoplemon to create
levelThe level to create at

Definition at line 41 of file OwnedPeoplemon.cpp.

Member Function Documentation

◆ ability()

SpecialAbility core::pplmn::OwnedPeoplemon::ability ( ) const

Returns the special ability of this peoplemon.

Returns
SpecialAbility The special ability of this peoplemon

Definition at line 202 of file OwnedPeoplemon.cpp.

◆ applyDamage()

void core::pplmn::OwnedPeoplemon::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 182 of file OwnedPeoplemon.cpp.

◆ awardEVs()

void core::pplmn::OwnedPeoplemon::awardEVs ( const Stats evs)

Award EVs to this peoplemon.

Parameters
evsThe EVs to add

Definition at line 192 of file OwnedPeoplemon.cpp.

◆ awardXP()

unsigned int core::pplmn::OwnedPeoplemon::awardXP ( unsigned int  xp)

Award XP to this peoplemon. A return of 0 indicates that all XP has been awarded. Non zero indicates that the peoplemon should level up.

Parameters
xpThe XP to award
Returns
The number of unused XP (overflow from a level up)

Definition at line 154 of file OwnedPeoplemon.cpp.

◆ canClone()

bool core::pplmn::OwnedPeoplemon::canClone ( ) const

Returns whether or not this peoplemon can be cloned.

Definition at line 282 of file OwnedPeoplemon.cpp.

◆ currentAilment() [1/2]

Ailment & core::pplmn::OwnedPeoplemon::currentAilment ( )

Access the current ailment of this peoplemon.

Definition at line 194 of file OwnedPeoplemon.cpp.

◆ currentAilment() [2/2]

Ailment core::pplmn::OwnedPeoplemon::currentAilment ( ) const

Access the current ailment of this peoplemon.

Definition at line 198 of file OwnedPeoplemon.cpp.

◆ currentEVs()

const Stats & core::pplmn::OwnedPeoplemon::currentEVs ( ) const

Returns the current EVs of this peoplemon.

Definition at line 176 of file OwnedPeoplemon.cpp.

◆ currentHp() [1/2]

std::uint16_t & core::pplmn::OwnedPeoplemon::currentHp ( )

Access the current HP.

Definition at line 180 of file OwnedPeoplemon.cpp.

◆ currentHp() [2/2]

std::uint16_t core::pplmn::OwnedPeoplemon::currentHp ( ) const

Returns the current HP.

Definition at line 190 of file OwnedPeoplemon.cpp.

◆ currentIVs()

const Stats & core::pplmn::OwnedPeoplemon::currentIVs ( ) const

Returns the current IVs of this peoplemon.

Definition at line 178 of file OwnedPeoplemon.cpp.

◆ currentLevel()

unsigned int core::pplmn::OwnedPeoplemon::currentLevel ( ) const

Returns the current level of this peoplemon.

Definition at line 140 of file OwnedPeoplemon.cpp.

◆ currentStats()

Stats core::pplmn::OwnedPeoplemon::currentStats ( ) const

Returns the computed stats for the peoplemon. Does not take into account changes during battle.

Definition at line 172 of file OwnedPeoplemon.cpp.

◆ currentXP()

unsigned int core::pplmn::OwnedPeoplemon::currentXP ( ) const

Returns the current XP of this peoplemon.

Definition at line 150 of file OwnedPeoplemon.cpp.

◆ evolve()

void core::pplmn::OwnedPeoplemon::evolve ( )

Changes this Peoplemon into it's evolved form if it has one.

Definition at line 126 of file OwnedPeoplemon.cpp.

◆ evolveLevel()

unsigned int core::pplmn::OwnedPeoplemon::evolveLevel ( ) const

Returns the level that this people can evolve at.

Definition at line 142 of file OwnedPeoplemon.cpp.

◆ evolvesInto()

Id core::pplmn::OwnedPeoplemon::evolvesInto ( ) const

Returns the people that this evolves into. Returns Unknown if no evolution.

Definition at line 144 of file OwnedPeoplemon.cpp.

◆ findMove()

OwnedMove * core::pplmn::OwnedPeoplemon::findMove ( MoveId  id)

Returns the OwnedMove for the given move.

Parameters
idThe move id to find
Returns
OwnedMove* The move itself, or nullptr if not found

Definition at line 253 of file OwnedPeoplemon.cpp.

◆ gainMove()

bool core::pplmn::OwnedPeoplemon::gainMove ( MoveId  move)

Attempts to learn the given move if there is an open slot.

Parameters
moveThe move to learn
Returns
True if learned, false if all moves full

Definition at line 217 of file OwnedPeoplemon.cpp.

◆ giveHealth()

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

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

Parameters
hpThe amount of hp to restore

Definition at line 188 of file OwnedPeoplemon.cpp.

◆ hasExpShare()

bool core::pplmn::OwnedPeoplemon::hasExpShare ( ) const

Returns whether or not this peoplemon has an EXP share.

Definition at line 232 of file OwnedPeoplemon.cpp.

◆ heal()

void core::pplmn::OwnedPeoplemon::heal ( )

Restores HP and removes ailments.

Definition at line 227 of file OwnedPeoplemon.cpp.

◆ holdItem() [1/2]

item::Id & core::pplmn::OwnedPeoplemon::holdItem ( )

Access the current hold item of this peoplemon.

Definition at line 196 of file OwnedPeoplemon.cpp.

◆ holdItem() [2/2]

item::Id core::pplmn::OwnedPeoplemon::holdItem ( ) const

Access the current hold item of this peoplemon.

Definition at line 200 of file OwnedPeoplemon.cpp.

◆ id()

Id core::pplmn::OwnedPeoplemon::id ( ) const

Returns the id of this peoplemon.

Returns
Id The id of this peoplemon

Definition at line 124 of file OwnedPeoplemon.cpp.

◆ knownMoves() [1/2]

OwnedMove * core::pplmn::OwnedPeoplemon::knownMoves ( )

Returns the moves known by this Peoplemon.

Definition at line 213 of file OwnedPeoplemon.cpp.

◆ knownMoves() [2/2]

const OwnedMove * core::pplmn::OwnedPeoplemon::knownMoves ( ) const

Returns the moves known by this Peoplemon.

Definition at line 211 of file OwnedPeoplemon.cpp.

◆ knowsMove()

bool core::pplmn::OwnedPeoplemon::knowsMove ( MoveId  move) const

Returns whether or not this peoplemon knows the given move.

Parameters
moveThe move to check for
Returns
True if known, false if unknown

Definition at line 204 of file OwnedPeoplemon.cpp.

◆ learnMove()

void core::pplmn::OwnedPeoplemon::learnMove ( MoveId  move,
unsigned int  i 
)

Teaches the peoplemon the given move, potentially replacing an existing one.

Parameters
moveThe move to learn
iThe index to place it, in range [0, 4)

Definition at line 215 of file OwnedPeoplemon.cpp.

◆ levelUp()

MoveId core::pplmn::OwnedPeoplemon::levelUp ( )

Levels up the peoplemon.

Returns
MoveId The move to learn, if any

Definition at line 244 of file OwnedPeoplemon.cpp.

◆ loadLegacyFile()

bool core::pplmn::OwnedPeoplemon::loadLegacyFile ( const std::string &  file)

Loads the peoplemon from a legacy file.

Parameters
filePath to the file, relative to the peoplemon directory
Returns
True on success, false on error

Definition at line 49 of file OwnedPeoplemon.cpp.

◆ name()

const std::string & core::pplmn::OwnedPeoplemon::name ( ) const

Returns the name of this peoplemon, custom or defualt.

Definition at line 132 of file OwnedPeoplemon.cpp.

◆ nextLevelXP()

unsigned int core::pplmn::OwnedPeoplemon::nextLevelXP ( ) const

Returns the xp required to level up.

Definition at line 152 of file OwnedPeoplemon.cpp.

◆ pendingEvolution() [1/2]

bool & core::pplmn::OwnedPeoplemon::pendingEvolution ( )

Flag set by battle controller when this people is able to evolve after battle.

Definition at line 148 of file OwnedPeoplemon.cpp.

◆ pendingEvolution() [2/2]

bool core::pplmn::OwnedPeoplemon::pendingEvolution ( ) const

Flag set by battle controller when this people is able to evolve after battle.

Definition at line 146 of file OwnedPeoplemon.cpp.

◆ setCustomName()

void core::pplmn::OwnedPeoplemon::setCustomName ( const std::string &  name)

Sets a custom name for this peoplemon.

Parameters
nameThe name. Pass empty to reset to default

Definition at line 138 of file OwnedPeoplemon.cpp.

◆ shakePasses()

bool core::pplmn::OwnedPeoplemon::shakePasses ( item::Id  ball,
int  turnNumber,
unsigned int  opLevel 
)

Performs the check that a shake would occur with the given peopleball.

Parameters
ballThe peopleball being used
turnNumberThe current turn of the battle
opLevelThe level of the peoplemon throwing the ball
Returns
True if the ball should shake, false if the peoplemon should break out

Definition at line 260 of file OwnedPeoplemon.cpp.

◆ type()

Type core::pplmn::OwnedPeoplemon::type ( ) const

Returns the type of the peoplemon.

Definition at line 136 of file OwnedPeoplemon.cpp.

◆ xpYield()

unsigned int core::pplmn::OwnedPeoplemon::xpYield ( bool  isTrainer) const

Returns the XP awarded by defeating this peoplemon.

Parameters
isTrainerTrue if commanded by a trainer, false otherwise
Returns
unsigned int The XP to award

Definition at line 237 of file OwnedPeoplemon.cpp.

Friends And Related Function Documentation

◆ BattlePeoplemon

friend class BattlePeoplemon
friend

Definition at line 335 of file OwnedPeoplemon.hpp.

◆ bl::serial::SerializableObject< OwnedPeoplemon >

friend struct bl::serial::SerializableObject< OwnedPeoplemon >
friend

Definition at line 335 of file OwnedPeoplemon.hpp.

◆ editor::component::OwnedPeoplemonWindow

Definition at line 337 of file OwnedPeoplemon.hpp.

◆ WildPeoplemon

friend struct WildPeoplemon
friend

Definition at line 334 of file OwnedPeoplemon.hpp.


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