[Feature] Updated Smeargle learnset to pre gen-9 implementation (#2986)
Updated Pokemon.getLevelMoves() Now enforces uniqueness AFTER filtering moves within the given range. This allows a pokemon to learn the same move at two different levels. Updated pokemon-level-moves.ts Changed Smeargle to learn Sketch at levels 11, 21, 31, ..., 91, instead of only at level 1.
This commit is contained in:
parent
39e7591d3b
commit
bbca34bfcd
|
@ -4074,11 +4074,18 @@ export const pokemonSpeciesLevelMoves: PokemonSpeciesLevelMoves = {
|
|||
[ 49, Moves.IMPRISON ],
|
||||
[ 55, Moves.DOUBLE_EDGE ],
|
||||
],
|
||||
// Reverting Smeargle back to pre gen9 implementation, to make it less dependent on access to Memory Mushrooms
|
||||
[Species.SMEARGLE]: [
|
||||
[ 1, Moves.SKETCH ],
|
||||
[ 1, Moves.SKETCH ],
|
||||
[ 1, Moves.SKETCH ],
|
||||
[ 1, Moves.SKETCH ],
|
||||
[ 11, Moves.SKETCH ],
|
||||
[ 21, Moves.SKETCH ],
|
||||
[ 31, Moves.SKETCH ],
|
||||
[ 41, Moves.SKETCH ],
|
||||
[ 51, Moves.SKETCH ],
|
||||
[ 61, Moves.SKETCH ],
|
||||
[ 71, Moves.SKETCH ],
|
||||
[ 81, Moves.SKETCH ],
|
||||
[ 91, Moves.SKETCH ],
|
||||
],
|
||||
[Species.TYROGUE]: [
|
||||
[ 1, Moves.TACKLE ],
|
||||
|
|
|
@ -1413,30 +1413,53 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
}
|
||||
}
|
||||
levelMoves.sort((lma: [integer, integer], lmb: [integer, integer]) => lma[0] > lmb[0] ? 1 : lma[0] < lmb[0] ? -1 : 0);
|
||||
const uniqueMoves: Moves[] = [];
|
||||
|
||||
|
||||
/**
|
||||
* Filter out moves not within the correct level range(s)
|
||||
* Includes moves below startingLevel, or of specifically level 0 if
|
||||
* includeRelearnerMoves or includeEvolutionMoves are true respectively
|
||||
*/
|
||||
levelMoves = levelMoves.filter(lm => {
|
||||
if (uniqueMoves.find(m => m === lm[1])) {
|
||||
return false;
|
||||
}
|
||||
uniqueMoves.push(lm[1]);
|
||||
return true;
|
||||
const level = lm[0];
|
||||
const isRelearner = level < startingLevel;
|
||||
const allowedEvolutionMove = (level === 0) && includeEvolutionMoves;
|
||||
|
||||
return !(level > this.level)
|
||||
&& (includeRelearnerMoves || !isRelearner || allowedEvolutionMove);
|
||||
});
|
||||
|
||||
/**
|
||||
* This must be done AFTER filtering by level, else if the same move shows up
|
||||
* in levelMoves multiple times all but the lowest level one will be skipped.
|
||||
* This causes problems when there are intentional duplicates (i.e. Smeargle with Sketch)
|
||||
*/
|
||||
if (levelMoves) {
|
||||
for (const lm of levelMoves) {
|
||||
const level = lm[0];
|
||||
if (!includeRelearnerMoves && ((level > 0 && level < startingLevel) || (!includeEvolutionMoves && level === 0) || level < 0)) {
|
||||
continue;
|
||||
} else if (level > this.level) {
|
||||
break;
|
||||
}
|
||||
ret.push(lm);
|
||||
}
|
||||
this.getUniqueMoves(levelMoves,ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for getLevelMoves.
|
||||
* Finds all non-duplicate items from the input, and pushes them into the output.
|
||||
* Two items count as duplicate if they have the same Move, regardless of level.
|
||||
*
|
||||
* @param levelMoves the input array to search for non-duplicates from
|
||||
* @param ret the output array to be pushed into.
|
||||
*/
|
||||
private getUniqueMoves(levelMoves: LevelMoves, ret: LevelMoves ): void {
|
||||
const uniqueMoves : Moves[] = [];
|
||||
for (const lm of levelMoves) {
|
||||
if (!uniqueMoves.find(m => m === lm[1])) {
|
||||
uniqueMoves.push(lm[1]);
|
||||
ret.push(lm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setMove(moveIndex: integer, moveId: Moves): void {
|
||||
const move = moveId ? new PokemonMove(moveId) : null;
|
||||
this.moveset[moveIndex] = move;
|
||||
|
|
Loading…
Reference in New Issue