1 #ifndef CORE_PEOPLEMON_OWNEDPEOPLEMON_HPP
2 #define CORE_PEOPLEMON_OWNEDPEOPLEMON_HPP
4 #include <BLIB/Serialization.hpp>
18 class OwnedPeoplemonWindow;
35 class BattlePeoplemon;
85 const std::string&
name()
const;
149 unsigned int awardXP(
unsigned int xp);
295 unsigned int xpYield(
bool isTrainer)
const;
323 std::string customName;
348 struct SerializableObject<
core::pplmn::OwnedPeoplemon> :
public SerializableObjectBase {
356 SerializableField<1, OP, Id>
id;
358 SerializableField<3, OP, std::uint16_t>
level;
359 SerializableField<4, OP, std::uint32_t>
xp;
360 SerializableField<5, OP, std::uint16_t>
hp;
361 SerializableField<6, OP, Stats>
ivs;
362 SerializableField<7, OP, Stats>
evs;
363 SerializableField<8, OP, Move[4]>
moves;
365 SerializableField<10, OP, Item>
item;
368 : SerializableObjectBase(
"OwnedPeoplemon")
369 , id(
"id", *this, &
OP::_id, SerializableFieldBase::Required{})
370 , customName(
"name", *this, &
OP::customName, SerializableFieldBase::Required{})
371 , level(
"level", *this, &
OP::level, SerializableFieldBase::Required{})
372 , xp(
"xp", *this, &
OP::xp, SerializableFieldBase::Required{})
373 , hp(
"hp", *this, &
OP::hp, SerializableFieldBase::Required{})
374 , ivs(
"ivs", *this, &
OP::ivs, SerializableFieldBase::Required{})
375 , evs(
"evs", *this, &
OP::evs, SerializableFieldBase::Required{})
376 , moves(
"moves", *this, &
OP::moves, SerializableFieldBase::Required{})
377 , ailment(
"ailment", *this, &
OP::ailment, SerializableFieldBase::Required{})
378 , item(
"item", *this, &
OP::item, SerializableFieldBase::Required{}) {}
Id
Represents an item in its simplist form.
Ailment
Represents an ailment that a Peoplemon can have.
Type
Represents a type that a move or Peoplemon can be. Types may be combined.
SpecialAbility
Represents a special ability that a Peoplemon may have.
Core classes and functionality for both the editor and game.
All classes and functionality used for implementing the game editor.
Represents a Peoplemon in battle. Stores some extra state that only exists in battle....
Represents a move owned by a peoplemon.
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.
void evolve()
Changes this Peoplemon into it's evolved form if it has one.
Type type() const
Returns the type of the peoplemon.
bool loadLegacyFile(const std::string &file)
Loads the peoplemon from a legacy file.
bool & pendingEvolution()
Flag set by battle controller when this people is able to evolve after battle.
OwnedMove * findMove(MoveId id)
Returns the OwnedMove for the given move.
Ailment & currentAilment()
Access the current ailment of this peoplemon.
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 ...
SpecialAbility ability() const
Returns the special ability of this peoplemon.
void applyDamage(int dmg)
Applies damage to the peoplemon. Ensures that the hp does not go negative.
unsigned int nextLevelXP() const
Returns the xp required to level up.
void setCustomName(const std::string &name)
Sets a custom name for this peoplemon.
bool canClone() const
Returns whether or not this peoplemon can be cloned.
std::uint16_t & currentHp()
Access the current HP.
MoveId levelUp()
Levels up the peoplemon.
OwnedPeoplemon()
Makes an empty peoplemon with id Unknown.
unsigned int currentLevel() const
Returns the current level of this peoplemon.
const Stats & currentIVs() const
Returns the current IVs of this peoplemon.
bool gainMove(MoveId move)
Attempts to learn the given move if there is an open slot.
void awardEVs(const Stats &evs)
Award EVs to this peoplemon.
Stats currentStats() const
Returns the computed stats for the peoplemon. Does not take into account changes during battle.
Id id() const
Returns the id of this peoplemon.
bool hasExpShare() const
Returns whether or not this peoplemon has an EXP share.
bool knowsMove(MoveId move) const
Returns whether or not this peoplemon knows the given move.
bool shakePasses(item::Id ball, int turnNumber, unsigned int opLevel)
Performs the check that a shake would occur with the given peopleball.
void learnMove(MoveId move, unsigned int i)
Teaches the peoplemon the given move, potentially replacing an existing one.
unsigned int currentXP() const
Returns the current XP of this peoplemon.
unsigned int xpYield(bool isTrainer) const
Returns the XP awarded by defeating this peoplemon.
unsigned int evolveLevel() const
Returns the level that this people can evolve at.
void giveHealth(int hp)
Restores HP and ensures it does not go over max HP.
Id evolvesInto() const
Returns the people that this evolves into. Returns Unknown if no evolution.
const OwnedMove * knownMoves() const
Returns the moves known by this Peoplemon.
item::Id & holdItem()
Access the current hold item of this peoplemon.
void heal()
Restores HP and removes ailments.
const std::string & name() const
Returns the name of this peoplemon, custom or defualt.
SerializableField< 1, OP, Id > id
SerializableField< 8, OP, Move[4]> moves
SerializableField< 2, OP, std::string > customName
SerializableField< 9, OP, Ail > ailment
SerializableField< 3, OP, std::uint16_t > level
SerializableField< 6, OP, Stats > ivs
SerializableField< 10, OP, Item > item
SerializableField< 7, OP, Stats > evs
SerializableField< 4, OP, std::uint32_t > xp
SerializableField< 5, OP, std::uint16_t > hp
Stats for Peoplemon. This struct is used for base stats, EVs, IVs, battle increases/decreases,...
Template struct to generate OwnedPeoplemon for random encounters.
Window for editing owned Peoplemon.