3 #include <BLIB/Util/Random.hpp>
13 , cached(p->currentStats())
15 , ability(
Peoplemon::specialAbility(p->id()))
17 , _turnsUntilAwake(-1) {}
35 val = &stageOnlys.
evade;
38 val = &stageOnlys.
acc;
41 val = &stageOnlys.
crit;
44 val = &stages.
get(stat);
47 if (*val == -6 || *val == 6)
return false;
49 if (*val > 6) *val = 6;
50 if (*val < -6) *val = -6;
64 if (a ==
Ailment::Sleep) { _turnsUntilAwake = bl::util::Random::get<int>(0, 4); }
84 void BattlePeoplemon::refreshStats() {
94 stageOnlys = o.stageOnlys;
107 stageOnlys.
evade = 0;
Stat
Represents a single stat. Used as an offset to access Stats as an array.
Ailment
Represents an ailment that a Peoplemon can have.
SpecialAbility
Represents a special ability that a Peoplemon may have.
Core classes and functionality for both the editor and game.
Struct containing state specific to each battler. These states facilitate logic that takes place over...
pplmn::PassiveAilment ailments
Represents a Peoplemon in battle. Stores some extra state that only exists in battle....
bool giveAilment(Ailment ail)
Gives the peoplemon an ailment.
void setCurrentAbility(SpecialAbility ability)
Set an ability override, or None to fallback on the default.
void resetStages()
Resets all stat stages.
void copyStages(const BattlePeoplemon &other)
Copies the stat stages from the other peoplemon.
bool statChange(Stat stat, int diff)
Apply a stage change to the given stat.
void resetSawBattle()
Resets that this peoplemon has seen battle.
const BattleStats & battleStages() const
Returns the current battle-only stats of the peoplemon, including changes.
int getSpeed() const
Returns the speed of this peoplemon, adjusted for ailments.
OwnedPeoplemon & base()
Returns the wrapped peoplemon.
bool hasSeenBattle() const
Returns whether or not this peoplemon has seen battle (for exp gain)
std::int8_t & turnsUntilAwake()
The number of turns until the peoplemon wakes up.
bool clearAilments(battle::BattlerSubstate *state)
Clears all ailments the peoplemon has, including passive ailments if passed in.
const Stats & currentStats() const
Returns the current stats of the peoplemon, including changes.
void applyDamage(int dmg)
Applies damage to the peoplemon. Ensures that the hp does not go negative.
bool hasAilment(const battle::BattlerSubstate &state) const
Returns whether or not the peoplemon has an ailment of any kind.
void notifyInBattle()
Lets the peoplemon know that they have seen battle.
BattlePeoplemon(OwnedPeoplemon *peoplemon)
Construct a new Battle Peoplemon.
SpecialAbility currentAbility() const
Returns the current ability of this peoplemon.
void giveHealth(int hp)
Restores HP and ensures it does not go over max HP.
Stores stats that only exist during battle.
Represents an instance of a peoplemon. Can be a wild peoplemon, trainer, or player peoplemon....
const Stats & currentEVs() const
Returns the current EVs of this peoplemon.
Ailment & currentAilment()
Access the current ailment of this peoplemon.
void applyDamage(int dmg)
Applies damage to the peoplemon. Ensures that the hp does not go negative.
std::uint16_t & currentHp()
Access the current HP.
unsigned int currentLevel() const
Returns the current level of this peoplemon.
const Stats & currentIVs() const
Returns the current IVs of this peoplemon.
Id id() const
Returns the id of this peoplemon.
void giveHealth(int hp)
Restores HP and ensures it does not go over max HP.
Serves as the primary store of all Peoplemon information.
static const Stats & baseStats(Id id)
Returns the base stats for the given peoplemon.
Stats for Peoplemon. This struct is used for base stats, EVs, IVs, battle increases/decreases,...
int & get(Stat stat)
Returns a reference to the given stat.
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.