From 79a2f4637c6c2f64a17264e5a66b297befc2d609 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Sat, 9 Dec 2023 10:03:36 -0500 Subject: [PATCH] Add logic for evolution-only moves --- src/evolution-phase.ts | 2 +- src/pokemon.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/evolution-phase.ts b/src/evolution-phase.ts index d97c6d217..f03c4e1df 100644 --- a/src/evolution-phase.ts +++ b/src/evolution-phase.ts @@ -104,7 +104,7 @@ export class EvolutionPhase extends BattlePhase { }); }); - const levelMoves = pokemon.getLevelMoves(this.lastLevel + 1); + const levelMoves = pokemon.getLevelMoves(this.lastLevel + 1, true); for (let lm of levelMoves) this.scene.unshiftPhase(new LearnMovePhase(this.scene, this.partyMemberIndex, lm)); this.scene.unshiftPhase(new EndEvolutionPhase(this.scene)); diff --git a/src/pokemon.ts b/src/pokemon.ts index 11294548b..3daff8807 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -524,7 +524,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } getLearnableLevelMoves(): Moves[] { - return this.getLevelMoves(1).filter(lm => !this.moveset.filter(m => m.moveId === lm).length).filter((move: Moves, i: integer, array: Moves[]) => array.indexOf(move) === i); + return this.getLevelMoves(1, true).filter(lm => !this.moveset.filter(m => m.moveId === lm).length).filter((move: Moves, i: integer, array: Moves[]) => array.indexOf(move) === i); } getTypes(ignoreOverride?: boolean): Type[] { @@ -614,7 +614,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { return null; } - getLevelMoves(startingLevel?: integer): Moves[] { + getLevelMoves(startingLevel?: integer, includeEvolutionMoves?: boolean): Moves[] { const ret: Moves[] = []; let levelMoves = this.getSpeciesForm().getLevelMoves(); if (!startingLevel) @@ -626,7 +626,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { levelMoves.shift(); while (fusionLevelMoves.length && fusionLevelMoves[0][0] < startingLevel) fusionLevelMoves.shift(); - for (let l = startingLevel; l <= this.level; l++) { + for (let l = includeEvolutionMoves ? 0 : startingLevel; l <= this.level; l++) { + if (l === 1 && startingLevel > 1) + l = startingLevel; while (levelMoves.length && levelMoves[0][0] === l) { const levelMove = levelMoves.shift(); if (!newLevelMoves.find(lm => lm[1] === levelMove[1]))