Peoplemon  0.1.0
Peoplemon 3 game source documentation
BattlePeoplemon.hpp
Go to the documentation of this file.
1 #ifndef CORE_PEOPLEMON_BATTLEPEOPLEMON_HPP
2 #define CORE_PEOPLEMON_BATTLEPEOPLEMON_HPP
3 
9 
10 namespace core
11 {
12 namespace battle
13 {
14 struct BattlerSubstate;
15 }
16 namespace pplmn
17 {
26 public:
32  BattlePeoplemon(OwnedPeoplemon* peoplemon);
33 
39 
44  const OwnedPeoplemon& base() const;
45 
50  const Stats& currentStats() const;
51 
56  const BattleStats& battleStages() const;
57 
62  int getSpeed() const;
63 
69  void applyDamage(int dmg);
70 
76  void giveHealth(int hp);
77 
85  bool statChange(Stat stat, int diff);
86 
93  bool hasAilment(const battle::BattlerSubstate& state) const;
94 
101  bool hasAilment(Ailment ail) const;
102 
109  bool giveAilment(Ailment ail);
110 
118 
124 
129  void setCurrentAbility(SpecialAbility ability);
130 
136  void copyStages(const BattlePeoplemon& other);
137 
142  void resetStages();
143 
148  void notifyInBattle();
149 
154  void resetSawBattle();
155 
160  bool hasSeenBattle() const;
161 
167  std::int8_t& turnsUntilAwake();
168 
169 private:
170  OwnedPeoplemon* ppl;
171  Stats cached;
172  Stats stages;
173  BattleStats stageOnlys;
174  SpecialAbility ability;
175  bool sawBattle;
176  std::int8_t _turnsUntilAwake;
177 
178  void refreshStats();
179 };
180 
181 } // namespace pplmn
182 } // namespace core
183 
184 #endif
Stat
Represents a single stat. Used as an offset to access Stats as an array.
Definition: Stat.hpp:16
Ailment
Represents an ailment that a Peoplemon can have.
Definition: Ailment.hpp:16
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...
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.
Definition: BattleStats.hpp:16
Represents an instance of a peoplemon. Can be a wild peoplemon, trainer, or player peoplemon....
Stats for Peoplemon. This struct is used for base stats, EVs, IVs, battle increases/decreases,...
Definition: Stats.hpp:19