mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-21 00:59:29 +01:00
* Added `MoveUseType` and refactored MEP
* Fixed Wimp out tests & ME code
finally i think all the booleans are gone
i hope
* Added version migration for last resort and co.
buh gumbug
* Fixed various bugs and added tests for previous bugfixes
* Reverted a couple doc changes
* WIP
* Update pokemon-species.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Update pokemon-phase.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Fixed remaining tests (I think)
* Reverted rollout test changes
* Fixed command phase bug causing metronome test timeout
* Revert early_bird.test.ts
* Fix biome.jsonc
* Made `MoveUseType` start at 1
As per @DayKev's request
* Fixed a thing
* Fixed bolt beak condition to be marginally less jank
* Applied some review suggestions
* Reverted move phase operations
* Added helper functions complete with markdown tables
* Fixed things
* Update battler-tags.ts
* Fixed random issues
* Fixed code
* Fixed comment
* Fixed import issues
* Fix disable.test.ts conflicts
* Update instruct.test.ts
* Update `biome.jsonc`
* Renamed `MoveUseType` to `MoveUseMode`; applied review comments
* Fixed space
* Fixed phasemanager bugs
* Fixed instruct test to not bork
* Fixed gorilla tactics bug
* Battler Tags doc fixes
* Fixed formatting and suttff
* Minor comment updates and remove unused imports in `move.ts`
* Re-add `public`, remove unnecessary default value in `battler-tags.ts`
* Restore `{}` in `turn-start-phase.ts`
Fixes `lint/correctness/noSwitchDeclarations`
* Remove extra space in TSDoc in `move-phase.ts`
* Use `game.field` instead of `game.scene` in `instruct.test.ts`
Also `game.toEndOfTurn()` instead of
`game.phaseInterceptor.to("BerryPhase")`
* Use `game.field` instead of `game.scene` in `metronome.test.ts`
* Use `toEndOfTurn()` instead of `to("BerryPhase")` in `powder.test.ts`
* Convert `MoveUseMode` enum to `const` object
* Update move-phase.ts
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
* Add `enumValueToKey` utility function
* Apply Biome
---------
Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com>
49 lines
2.0 KiB
TypeScript
49 lines
2.0 KiB
TypeScript
import type { SessionSaveMigrator } from "#app/@types/SessionSaveMigrator";
|
|
import type { BattlerIndex } from "#enums/battler-index";
|
|
import type { TurnMove } from "#app/field/pokemon";
|
|
import type { MoveResult } from "#enums/move-result";
|
|
import type { SessionSaveData } from "#app/system/game-data";
|
|
import { MoveUseMode } from "#enums/move-use-mode";
|
|
import type { MoveId } from "#enums/move-id";
|
|
|
|
/** Prior signature of `TurnMove`; used to ensure parity */
|
|
interface OldTurnMove {
|
|
move: MoveId;
|
|
targets: BattlerIndex[];
|
|
result?: MoveResult;
|
|
turn?: number;
|
|
virtual?: boolean;
|
|
ignorePP?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Fix player pokemon move history entries with updated `MoveUseModes`,
|
|
* based on the prior values of `virtual` and `ignorePP`.
|
|
* Needed to ensure Last Resort and move-calling moves still work OK.
|
|
* @param data - {@linkcode SystemSaveData}
|
|
*/
|
|
const fixMoveHistory: SessionSaveMigrator = {
|
|
version: "1.10.0",
|
|
migrate: (data: SessionSaveData): void => {
|
|
const mapTurnMove = (tm: OldTurnMove): TurnMove => ({
|
|
move: tm.move,
|
|
targets: tm.targets,
|
|
result: tm.result,
|
|
turn: tm.turn,
|
|
// NOTE: This unfortuately has to mis-classify Dancer and Magic Bounce-induced moves as `FOLLOW_UP`,
|
|
// given we previously had _no way_ of distinguishing them from follow-up moves post hoc.
|
|
useMode: tm.virtual ? MoveUseMode.FOLLOW_UP : tm.ignorePP ? MoveUseMode.IGNORE_PP : MoveUseMode.NORMAL,
|
|
});
|
|
data.party.forEach(pkmn => {
|
|
pkmn.summonData.moveHistory = (pkmn.summonData.moveHistory as OldTurnMove[]).map(mapTurnMove);
|
|
pkmn.summonData.moveQueue = (pkmn.summonData.moveQueue as OldTurnMove[]).map(mapTurnMove);
|
|
});
|
|
data.enemyParty.forEach(pkmn => {
|
|
pkmn.summonData.moveHistory = (pkmn.summonData.moveHistory as OldTurnMove[]).map(mapTurnMove);
|
|
pkmn.summonData.moveQueue = (pkmn.summonData.moveQueue as OldTurnMove[]).map(mapTurnMove);
|
|
});
|
|
},
|
|
};
|
|
|
|
export const sessionMigrators: Readonly<SessionSaveMigrator[]> = [fixMoveHistory] as const;
|