Skip to content
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
PokemonMove Class Reference

One of a Pokemon's four move slots: move id, PP, and PP-Ups. More...

#include <pokemonbox.h>

Inheritance diagram for PokemonMove:
Collaboration diagram for PokemonMove:

Public Member Functions

 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 isMaxPP ()
 Is current PP at the cap?
int getMaxPP ()
 PP cap for this move given PP-Ups.
bool isMaxPpUps ()
 Are PP-Ups at max?
bool isInvalid ()
 Is the move id out of range / not a real move?
QString moveType ()
 The move's elemental type name.
void onMoveIdChanged ()
 Recompute derived state after the move id changes.
QVector< int > allValidMoves ()
 Every legal move id for this slot.
QVector< int > validMovesLeft ()
 Legal moves not already used by the mon.
bool isDuplicateMove ()
 Is this move a duplicate within the mon's set?
protected::void moveIDChanged ()
void ppChanged ()
void ppUpChanged ()
void ppCapChanged ()
void invalidChanged ()
void randomize ()
 Pick a random valid move.
void maxPpUp ()
 Set PP-Ups to max.
void raisePpUp ()
 +1 PP-Up.
void lowerPpUp ()
 -1 PP-Up.
void resetPpUp ()
 PP-Ups to 0.
void restorePP ()
 Refill PP to the cap.
void changeMove (int move=0, int pp=0, int ppUp=0)
 Replace this slot's values.
void correctMove ()
 Clamp/repair inconsistent values.

Public Attributes

int moveID
 Move id (backs property).
int pp
 Current PP (backs property).
int ppUp
 PP-Ups (backs property).
PokemonBox * parentMon = nullptr
 Owning Pokemon (for cross-slot validation).

Detailed Description

One of a Pokemon's four move slots: move id, PP, and PP-Ups.

Carries the raw values plus a wall of computed QML properties (max-PP checks, validity, duplicate detection, type). Holds a back-pointer to its owning parentMon so it can validate against the Pokemon's full move set.

See also
PokemonBox, MoveDBEntry

Definition at line 132 of file pokemonbox.h.

Constructor & Destructor Documentation

◆ PokemonMove()

PokemonMove::PokemonMove ( PokemonBox * parentMon,
var8 move = 0,
var8 pp = 0,
var8 ppUp = 0 )

< Move id (indexes the moves DB).

Current PP. PP-Ups applied (0-3). < Is PP at its current cap? PP cap given PP-Ups. Are PP-Ups maxed (3)? < Is this move id invalid? Does the mon already know this move? The move's type name.

Parameters
parentMonOwning Pokemon.
move/pp/ppUpInitial raw values.

Definition at line 43 of file pokemonbox.cpp.

References moveID, moveIDChanged(), onMoveIdChanged(), parentMon, pp, ppCapChanged(), ppChanged(), ppUp, ppUpChanged(), and randomize().

Member Function Documentation

◆ allValidMoves()

QVector< int > PokemonMove::allValidMoves ( )

Every legal move id for this slot.

Definition at line 181 of file pokemonbox.cpp.

References parentMon.

Referenced by correctMove(), and validMovesLeft().

◆ changeMove()

void PokemonMove::changeMove ( int move = 0,
int pp = 0,
int ppUp = 0 )

Replace this slot's values.

Definition at line 245 of file pokemonbox.cpp.

References moveID, moveIDChanged(), pp, ppChanged(), ppUp, and ppUpChanged().

Referenced by invalidChanged().

◆ correctMove()

void PokemonMove::correctMove ( )

Clamp/repair inconsistent values.

Definition at line 257 of file pokemonbox.cpp.

References allValidMoves(), isDuplicateMove(), moveID, moveIDChanged(), parentMon, and validMovesLeft().

Referenced by invalidChanged().

◆ getMaxPP()

int PokemonMove::getMaxPP ( )

PP cap for this move given PP-Ups.

Definition at line 140 of file pokemonbox.cpp.

References ppUp, and toMove().

Referenced by isMaxPP(), onMoveIdChanged(), randomize(), and restorePP().

◆ invalidChanged()

void PokemonMove::invalidChanged ( )

◆ isDuplicateMove()

bool PokemonMove::isDuplicateMove ( )

Is this move a duplicate within the mon's set?

Definition at line 223 of file pokemonbox.cpp.

References parentMon.

Referenced by correctMove().

◆ isInvalid()

bool PokemonMove::isInvalid ( )

Is the move id out of range / not a real move?

Definition at line 158 of file pokemonbox.cpp.

References MoveDBEntry::glitch, moveID, and toMove().

Referenced by moveType(), and onMoveIdChanged().

◆ isMaxPP()

bool PokemonMove::isMaxPP ( )

Is current PP at the cap?

Definition at line 131 of file pokemonbox.cpp.

References getMaxPP(), and pp.

◆ isMaxPpUps()

bool PokemonMove::isMaxPpUps ( )

Are PP-Ups at max?

Definition at line 153 of file pokemonbox.cpp.

References ppUp.

◆ lowerPpUp()

void PokemonMove::lowerPpUp ( )

-1 PP-Up.

Definition at line 118 of file pokemonbox.cpp.

References ppUp, and ppUpChanged().

Referenced by invalidChanged().

◆ maxPpUp()

void PokemonMove::maxPpUp ( )

Set PP-Ups to max.

Definition at line 105 of file pokemonbox.cpp.

References ppUp, and ppUpChanged().

Referenced by invalidChanged().

◆ moveIDChanged()

protected::void PokemonMove::moveIDChanged ( )

◆ moveType()

QString PokemonMove::moveType ( )

The move's elemental type name.

Definition at line 163 of file pokemonbox.cpp.

References isInvalid(), moveID, TypeDBEntry::readable, toMove(), and MoveDBEntry::toType.

◆ onMoveIdChanged()

void PokemonMove::onMoveIdChanged ( )

Recompute derived state after the move id changes.

Definition at line 173 of file pokemonbox.cpp.

References getMaxPP(), isInvalid(), pp, and ppChanged().

Referenced by PokemonMove().

◆ ppCapChanged()

void PokemonMove::ppCapChanged ( )

◆ ppChanged()

void PokemonMove::ppChanged ( )

◆ ppUpChanged()

void PokemonMove::ppUpChanged ( )

◆ raisePpUp()

void PokemonMove::raisePpUp ( )

+1 PP-Up.

Definition at line 111 of file pokemonbox.cpp.

References ppUp, and ppUpChanged().

Referenced by invalidChanged().

◆ randomize()

◆ resetPpUp()

void PokemonMove::resetPpUp ( )

PP-Ups to 0.

Definition at line 125 of file pokemonbox.cpp.

References ppUp, and ppUpChanged().

Referenced by invalidChanged().

◆ restorePP()

void PokemonMove::restorePP ( )

Refill PP to the cap.

Definition at line 235 of file pokemonbox.cpp.

References getMaxPP(), pp, and ppChanged().

Referenced by invalidChanged().

◆ toMove()

MoveDBEntry * PokemonMove::toMove ( )

Resolve moveID to its DB entry.

Definition at line 77 of file pokemonbox.cpp.

References MovesDB::getIndAt(), MovesDB::inst(), and moveID.

Referenced by getMaxPP(), isInvalid(), and moveType().

◆ validMovesLeft()

QVector< int > PokemonMove::validMovesLeft ( )

Legal moves not already used by the mon.

Definition at line 208 of file pokemonbox.cpp.

References allValidMoves(), and parentMon.

Referenced by correctMove().

Member Data Documentation

◆ moveID

int PokemonMove::moveID

Move id (backs property).

Definition at line 185 of file pokemonbox.h.

Referenced by changeMove(), PokemonBox::copyFrom(), correctMove(), isInvalid(), moveType(), PokemonMove(), randomize(), and toMove().

◆ parentMon

PokemonBox* PokemonMove::parentMon = nullptr

Owning Pokemon (for cross-slot validation).

Definition at line 188 of file pokemonbox.h.

Referenced by allValidMoves(), correctMove(), isDuplicateMove(), PokemonMove(), and validMovesLeft().

◆ pp

int PokemonMove::pp

Current PP (backs property).

Definition at line 186 of file pokemonbox.h.

Referenced by changeMove(), PokemonBox::copyFrom(), invalidChanged(), isMaxPP(), onMoveIdChanged(), PokemonMove(), randomize(), and restorePP().

◆ ppUp

int PokemonMove::ppUp

The documentation for this class was generated from the following files:
  • projects/savefile/src/pse-savefile/expanded/fragments/pokemonbox.h
  • projects/savefile/src/pse-savefile/expanded/fragments/pokemonbox.cpp