Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
core::pplmn::Stats Struct Reference

Stats for Peoplemon. This struct is used for base stats, EVs, IVs, battle increases/decreases, and base stats. More...

#include <Stats.hpp>

Public Member Functions

 Stats ()
 Initializes all members to 0. More...
 
 Stats (Stat stat, int points)
 Construct Stats with all zeros except the given stat. More...
 
int sum () const
 Returns the sum of the 6 stats that are used for EV calculations. More...
 
void randomize ()
 Generates random IV stats. More...
 
void addEVs (const Stats &evs)
 Adds the given EV points to this set of stats while obeying the constraints on EV values and sums. More...
 
int & get (Stat stat)
 Returns a reference to the given stat. More...
 
int get (Stat stat) const
 Returns the given stat. More...
 

Static Public Member Functions

static float stageMultiplier (int stage)
 Returns the multiplier for a given stat increase/decrease. More...
 
static Stats computeStats (const Stats &base, const Stats &evs, const Stats &ivs, unsigned int level, const Stats &stages={})
 Helper method to compute a Peoplemon's current stats. More...
 
static const char * statToString (Stat stat)
 Converts the given stat to its string representation. More...
 

Public Attributes

int hp
 
int atk
 
int def
 
int spatk
 
int spdef
 
int spd
 

Static Public Attributes

static const std::array< Stat, 6 > IterableStats
 Helper array to iterate over stats in loop. More...
 
static constexpr int MaxEVSum = 510
 The maximum amount that EVs or IVs can sum to. More...
 
static constexpr int MaxEVStat = 255
 The maximum amount that a single EV can be. More...
 
static constexpr int MaxIVStat = 31
 The maximum amount that a single IV can be. More...
 

Detailed Description

Stats for Peoplemon. This struct is used for base stats, EVs, IVs, battle increases/decreases, and base stats.

Definition at line 19 of file Stats.hpp.

Constructor & Destructor Documentation

◆ Stats() [1/2]

core::pplmn::Stats::Stats ( )

Initializes all members to 0.

Definition at line 12 of file Stats.cpp.

◆ Stats() [2/2]

core::pplmn::Stats::Stats ( Stat  stat,
int  points 
)

Construct Stats with all zeros except the given stat.

Parameters
statThe single stat to populate
pointsThe points to put in that stat

Definition at line 20 of file Stats.cpp.

Member Function Documentation

◆ addEVs()

void core::pplmn::Stats::addEVs ( const Stats evs)

Adds the given EV points to this set of stats while obeying the constraints on EV values and sums.

Parameters
evsThe EVs to award

Definition at line 31 of file Stats.cpp.

◆ computeStats()

Stats core::pplmn::Stats::computeStats ( const Stats base,
const Stats evs,
const Stats ivs,
unsigned int  level,
const Stats stages = {} 
)
static

Helper method to compute a Peoplemon's current stats.

Parameters
baseBase stats for the Peoplemon to compute
evsThe EVs of the Peoplemon
ivsThe IVs of the Peoplemon
levelThe current level of the Peoplemon
stagesStat increases/decreases during battle
Returns
Stats The Peoplemon's current stats

Definition at line 49 of file Stats.cpp.

◆ get() [1/2]

int & core::pplmn::Stats::get ( Stat  stat)

Returns a reference to the given stat.

Definition at line 39 of file Stats.cpp.

◆ get() [2/2]

int core::pplmn::Stats::get ( Stat  stat) const

Returns the given stat.

Definition at line 44 of file Stats.cpp.

◆ randomize()

void core::pplmn::Stats::randomize ( )

Generates random IV stats.

Definition at line 27 of file Stats.cpp.

◆ stageMultiplier()

float core::pplmn::Stats::stageMultiplier ( int  stage)
static

Returns the multiplier for a given stat increase/decrease.

Parameters
stageThe current stat stage in range [-6, 6]
Returns
float The multiplier to apply

Definition at line 66 of file Stats.cpp.

◆ statToString()

const char * core::pplmn::Stats::statToString ( Stat  stat)
static

Converts the given stat to its string representation.

Parameters
statThe stat to convert
Returns
const char* The string representation of the stat

Definition at line 74 of file Stats.cpp.

◆ sum()

int core::pplmn::Stats::sum ( ) const

Returns the sum of the 6 stats that are used for EV calculations.

Returns
int The sum of each stat

Definition at line 25 of file Stats.cpp.

Member Data Documentation

◆ atk

int core::pplmn::Stats::atk

Definition at line 21 of file Stats.hpp.

◆ def

int core::pplmn::Stats::def

Definition at line 22 of file Stats.hpp.

◆ hp

int core::pplmn::Stats::hp

Definition at line 20 of file Stats.hpp.

◆ IterableStats

const std::array< Stat, 6 > core::pplmn::Stats::IterableStats
static

◆ MaxEVStat

constexpr int core::pplmn::Stats::MaxEVStat = 255
staticconstexpr

The maximum amount that a single EV can be.

Definition at line 110 of file Stats.hpp.

◆ MaxEVSum

constexpr int core::pplmn::Stats::MaxEVSum = 510
staticconstexpr

The maximum amount that EVs or IVs can sum to.

Definition at line 107 of file Stats.hpp.

◆ MaxIVStat

constexpr int core::pplmn::Stats::MaxIVStat = 31
staticconstexpr

The maximum amount that a single IV can be.

Definition at line 113 of file Stats.hpp.

◆ spatk

int core::pplmn::Stats::spatk

Definition at line 23 of file Stats.hpp.

◆ spd

int core::pplmn::Stats::spd

Definition at line 25 of file Stats.hpp.

◆ spdef

int core::pplmn::Stats::spdef

Definition at line 24 of file Stats.hpp.


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