276 var16 startOffset = 0,
277 var16 nicknameStartOffset = 0,
278 var16 otNameStartOffset = 0,
280 var8 recordSize = 0x21);
286 var16 startOffset = 0,
287 var16 nicknameStartOffset = 0,
288 var16 otNameStartOffset = 0,
292 var8 recordSize = 0x21);
296 var16 startOffset = 0,
297 svar32 speciesStartOffset = 0,
298 var16 nicknameStartOffset = 0,
299 var16 otNameStartOffset = 0,
303 var8 recordSize = 0x21);
384 Q_INVOKABLE
int dvAt(
int ind);
385 Q_INVOKABLE
void dvSet(
int ind,
int val);
417 virtual void reset();
427 virtual void update(
bool resetHp =
false,
429 bool resetType =
false,
430 bool resetCatchRate =
false,
473 void changeMove(
int ind,
int moveID = 0,
int pp = 0,
int ppUp = 0);
The trainer's headline values: name, ID, money, coins, badges, starter.
A single Pokemon record – the most property-rich object in the tree.
PokemonMove * movesAt(int ind)
Move slot ind (GC-protected return).
bool isMaxPpUps()
All moves at max PP-Ups.
PokemonMove * moves[4]
The four move slots.
void rollShiny()
Randomize DVs until shiny.
void rollNonShiny()
Randomize DVs until not shiny.
void resetDVs()
Zero all DVs.
void type2ExplicitChanged()
void heal()
Pokecenter heal: full HP, clear status.
bool isValidBool()
Convenience bool form of isValid().
int dvAt(int ind)
DV value at ind.
void reRollDVs()
Randomize DVs.
void manualLevelChanged()
UI hook: level edited directly.
virtual void randomize(PlayerBasics *basics=nullptr)
Randomize this Pokemon (constrained).
void dvSet(int ind, int val)
Set DV ind.
void makeShiny()
Force DVs to a shiny combination.
bool isHealed()
Fully healed (HP + status). (heal() performs a Pokecenter heal.).
bool isMinEvs()
All stat-exp zero.
bool hasEvolution()
Species can evolve.
void reorderMove(int from, int to)
Reorder the filled move slots: take the move at from and re-insert it before slot to (drop-slot conve...
void resetEVs()
Zero all stat-exp.
int dvCount()
Number of stored DVs (maxDV).
bool hasDeEvolution()
Species has a pre-evolution.
int spdStat()
Computed Speed stat.
unsigned int expLevelRangeStart()
EXP at the start of the current level.
void maxLevel()
Set to level 100.
void evolve()
Evolve to the next species.
void cleanupMoves()
Remove invalid/duplicate moves.
bool hasTradeStatus(PlayerBasics *basics=nullptr)
Counts as traded relative to basics.
bool isMaxHp()
HP equals computed max.
bool isMaxedOut()
Level/EV/DV/PP all maxed.
protected::void speciesChanged()
int spStat()
Computed Special stat.
virtual void update(bool resetHp=false, bool resetExp=false, bool resetType=false, bool resetCatchRate=false, bool correctMoves=false)
Recompute derived stats.
void changeMove(int ind, int moveID=0, int pp=0, int ppUp=0)
Set move slot ind.
void pokemonResetChanged()
virtual SaveFileIterator * save(SaveFile *saveFile=nullptr, var16 startOffset=0, svar32 speciesStartOffset=0, var16 nicknameStartOffset=0, var16 otNameStartOffset=0, var8 index=0, var8 recordSize=0x21)
Flatten one Pokemon back to the save.
unsigned int levelToExp(int level=-1)
EXP needed for level (current level if -1).
void resetExp()
Reset EXP to the current level's baseline.
void randomizeMoves()
Randomize the move set.
int dexNum()
Pokedex number.
void correctTypes()
Reset type1/type2 to this species' DB-default type(s) (e.g.
void maxOut()
Max level/EV/DV/PP at once.
void manualSpeciesChanged()
UI hook: species edited directly.
void changeName(bool removeNickname=false)
Randomize or (if true) remove the nickname.
void correctMoves()
Repair move/PP inconsistencies.
void clearMoves()
Empty all move slots.
void changeTrade(bool removeTradeStatus=false, PlayerBasics *basics=nullptr)
Toggle traded status.
void unmakeShiny()
Force DVs to a non-shiny combination.
int movesCount()
Number of non-empty move slots.
void hasNicknameChanged()
void reRollEVs()
Randomize stat-exp.
void clearMovesButFirst()
Remove every move except the first one (slots 1..3 cleared).
bool isPokemonReset()
Matches the reset baseline.
virtual SaveFileIterator * load(SaveFile *saveFile=nullptr, var16 startOffset=0, var16 nicknameStartOffset=0, var16 otNameStartOffset=0, var8 index=0, var8 recordSize=0x21)
Expand one Pokemon from the save.
PokemonDBEntry * toData()
The species' DB entry for this mon.
PokemonDBEntry * isValid()
The species' DB entry, or null if not a real Pokedex species.
unsigned int expLevelRangeEnd()
EXP at the next level.
virtual void copyFrom(PokemonBox *pkmn)
Deep-copy another mon's values into this one.
void correctMoveAt(int ind)
Make the move in slot ind valid (PokemonMove::correctMove) THEN compact: correctMove can clear an inv...
static PokemonBox * newPokemon(PokemonRandom::PokemonRandom_ list=PokemonRandom::Random_Starters, PlayerBasics *basics=nullptr)
void maxEVs()
Max all stat-exp.
bool isMaxLevel()
Level 100.
bool hasNickname()
Carries a real nickname.
void resetPokemon()
Reset to the baseline state.
bool isShiny()
Shiny per the VC-era DV formula (see disclaimer above).
void changeOtData(bool removeOtData=false, PlayerBasics *basics=nullptr)
Randomize or remove OT data.
void setNature(int nature)
QString speciesName()
Species display name.
int atkStat()
Computed Attack stat.
void deleteMoveAt(int ind)
Delete the move in slot ind, then compact so there is no gap in the move list (the slots after it sli...
void deEvolve()
Revert to the prior species.
float expLevelRangePercent()
Fractional progress through the level.
var8 dv[maxDV]
Stored DVs (Atk/Def/Spd/Spc); HP DV is derived.
void maxDVs()
Max all DVs.
virtual bool isBoxMon()
True for a pure box mon; PokemonParty overrides to false.
void maxPpUps()
Max every move's PP-Ups.
int defStat()
Computed Defense stat.
bool isMaxDVs()
All DVs maxed.
int nonHpStat(PokemonStats::PokemonStats_ stat)
PokemonBox(SaveFile *saveFile=nullptr, var16 startOffset=0, var16 nicknameStartOffset=0, var16 otNameStartOffset=0, var8 index=0, var8 recordSize=0x21)
< Species id (raw save value).
bool isCorrected()
Values internally consistent (see correct* slots).
bool isMaxEVs()
All stat-exp maxed.
virtual void reset()
Blank this Pokemon.
int movesMax()
Move-slot capacity (maxMoves).
bool isAfflicted()
Has any status condition.
bool isMinDVs()
All DVs zero.
bool isMaxPP()
All moves at max PP.
The Pokemon database – all 151 species, keyed by name.
One of a Pokemon's four move slots: move id, PP, and PP-Ups.
int pp
Current PP (backs property).
protected::void moveIDChanged()
void raisePpUp()
+1 PP-Up.
PokemonBox * parentMon
Owning Pokemon (for cross-slot validation).
PokemonMove(PokemonBox *parentMon, var8 move=0, var8 pp=0, var8 ppUp=0)
< Move id (indexes the moves DB).
MoveDBEntry * toMove()
Resolve moveID to its DB entry.
bool isMaxPpUps()
Are PP-Ups at max?
void lowerPpUp()
-1 PP-Up.
QString moveType()
The move's elemental type name.
int moveID
Move id (backs property).
QVector< int > validMovesLeft()
Legal moves not already used by the mon.
int getMaxPP()
PP cap for this move given PP-Ups.
void resetPpUp()
PP-Ups to 0.
bool isInvalid()
Is the move id out of range / not a real move?
void randomize()
Pick a random valid move.
void maxPpUp()
Set PP-Ups to max.
bool isDuplicateMove()
Is this move a duplicate within the mon's set?
void onMoveIdChanged()
Recompute derived state after the move id changes.
int ppUp
PP-Ups (backs property).
QVector< int > allValidMoves()
Every legal move id for this slot.
void restorePP()
Refill PP to the cap.
bool isMaxPP()
Is current PP at the cap?
void correctMove()
Clamp/repair inconsistent values.
void changeMove(int move=0, int pp=0, int ppUp=0)
Replace this slot's values.
A moving cursor over a SaveFile, layering auto-advancing reads/writes on top of SaveFileToolset.
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Project-wide fixed-width integer aliases (var8, var16, ...).
svar32e svar32
Signed, exactly 32-bit (shorthand for svar32e).
var8e var8
Everyday 8-bit alias. Exact (not "fastest") to dodge the pointer-width bug noted above.
var16e var16
Everyday 16-bit alias. Exact width to avoid the "fastest" widening bug.
constexpr var8 maxMoves
Move slots per Pokemon.
constexpr var8 maxDV
DV entries stored (Atk/Def/Spd/Spc; HP DV is derived).
Import/export macro for the savefile library, plus the central list of QObject types kept deliberatel...
#define SAVEFILE_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
One move's static data (type, power, accuracy, PP, TM/HM), with links.
One species' complete static data – the richest entry in the db layer.
The 25 natures, QML-visible.
Scope selector for "new random Pokemon", QML-visible.
@ Random_Starters
A "startery"-feeling Pokemon (non-legendary base evo).
@ Random_All
Any species at all, including MissingNo / glitch mons.
@ Random_Pokedex
Any Pokedex species.
@ Random_Starters3
One of the three canonical starters.
The five battle stats, in their save/index order, exposed to QML.
@ Special
Special (single stat in Gen 1).
@ Defense
Physical defense.