mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-16 21:32:18 +02:00
Add unlocked egg moves to relearnable moves on starters
This commit is contained in:
parent
6fa7412465
commit
6d52d8e8c0
@ -743,6 +743,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
return this.getLevelMoves(1, true).map(lm => lm[1]).filter(lm => !this.moveset.filter(m => m.moveId === lm).length).filter((move: Moves, i: integer, array: Moves[]) => array.indexOf(move) === i);
|
||||
}
|
||||
|
||||
getLearnableEggMoves(): Moves[] {
|
||||
return this.metBiome < 0 ? this.scene.gameData.getUnlockedEggMoves(this.species).filter(lm => !this.moveset.filter(m => m.moveId === lm).length).filter((move: Moves, i: integer, array: Moves[]) => array.indexOf(move) === i) : [];
|
||||
}
|
||||
|
||||
getTypes(includeTeraType = false, forDefend: boolean = false, ignoreOverride?: boolean): Type[] {
|
||||
const types = [];
|
||||
|
||||
|
@ -21,6 +21,7 @@ import { ModifierTier } from './modifier-tier';
|
||||
import { Nature, getNatureName, getNatureStatMultiplier } from '#app/data/nature';
|
||||
import i18next from '#app/plugins/i18n';
|
||||
import { getModifierTierTextTint } from '#app/ui/text';
|
||||
import { Biome } from '#app/data/enums/biome.js';
|
||||
|
||||
const outputModifierData = false;
|
||||
const useMaxWeightForOutput = false;
|
||||
@ -386,7 +387,7 @@ export class RememberMoveModifierType extends PokemonModifierType {
|
||||
constructor(localeKey: string, iconImage: string, group?: string) {
|
||||
super(localeKey, iconImage, (type, args) => new Modifiers.RememberMoveModifier(type, (args[0] as PlayerPokemon).id, (args[1] as integer)),
|
||||
(pokemon: PlayerPokemon) => {
|
||||
if (!pokemon.getLearnableLevelMoves().length)
|
||||
if (!pokemon.getLearnableLevelMoves().length && !pokemon.getLearnableEggMoves().length)
|
||||
return PartyUiHandler.NoEffectMessage;
|
||||
return null;
|
||||
}, group);
|
||||
|
@ -1195,8 +1195,10 @@ export class RememberMoveModifier extends ConsumablePokemonModifier {
|
||||
|
||||
apply(args: any[]): boolean {
|
||||
const pokemon = args[0] as PlayerPokemon;
|
||||
const moves = pokemon.getLearnableLevelMoves();
|
||||
moves.push(...pokemon.getLearnableEggMoves());
|
||||
|
||||
pokemon.scene.unshiftPhase(new LearnMovePhase(pokemon.scene, pokemon.scene.getParty().indexOf(pokemon), pokemon.getLearnableLevelMoves()[this.levelMoveIndex]));
|
||||
pokemon.scene.unshiftPhase(new LearnMovePhase(pokemon.scene, pokemon.scene.getParty().indexOf(pokemon), moves[this.levelMoveIndex]));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1253,7 +1253,7 @@ export class GameData {
|
||||
if (!this.starterData[speciesId].eggMoves)
|
||||
this.starterData[speciesId].eggMoves = 0;
|
||||
|
||||
const value = Math.pow(2, eggMoveIndex);
|
||||
const value = Math.pow(2, eggMoveIndex);
|
||||
|
||||
if (this.starterData[speciesId].eggMoves & value) {
|
||||
resolve(false);
|
||||
@ -1267,6 +1267,23 @@ export class GameData {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Moves}[] An array of every egg move the player has unlocked for a given species
|
||||
* @param species {PokemonSpecies} species to get the egg moves of
|
||||
*/
|
||||
getUnlockedEggMoves(species: PokemonSpecies): Moves[] {
|
||||
const unlockedEggMoves=[];
|
||||
const speciesId = species.getRootSpeciesId(true);
|
||||
if (speciesEggMoves.hasOwnProperty(speciesId) && this.starterData[speciesId].eggMoves){
|
||||
for (let eggMoveIndex = 0; eggMoveIndex < speciesEggMoves[speciesId].length; eggMoveIndex++){
|
||||
const value = Math.pow(2, eggMoveIndex);
|
||||
if (this.starterData[speciesId].eggMoves & value)
|
||||
unlockedEggMoves.push(speciesEggMoves[speciesId][eggMoveIndex]);
|
||||
}
|
||||
}
|
||||
return unlockedEggMoves;
|
||||
}
|
||||
|
||||
updateSpeciesDexIvs(speciesId: Species, ivs: integer[]): void {
|
||||
let dexEntry: DexEntry;
|
||||
do {
|
||||
|
@ -17,6 +17,7 @@ import { addWindow } from "./ui-theme";
|
||||
import { SpeciesFormChangeItemTrigger } from "../data/pokemon-forms";
|
||||
import { getVariantTint } from "#app/data/variant";
|
||||
import {Button} from "../enums/buttons";
|
||||
import { speciesEggMoves } from "#app/data/egg-moves.js";
|
||||
|
||||
const defaultMessage = 'Choose a Pokémon.';
|
||||
|
||||
@ -546,6 +547,8 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
const learnableLevelMoves = this.partyUiMode === PartyUiMode.REMEMBER_MOVE_MODIFIER
|
||||
? pokemon.getLearnableLevelMoves()
|
||||
: null;
|
||||
if (this.partyUiMode === PartyUiMode.REMEMBER_MOVE_MODIFIER) // Append egg moves to relearn options on starters
|
||||
learnableLevelMoves.push(...pokemon.getLearnableEggMoves());
|
||||
|
||||
const itemModifiers = this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER
|
||||
? this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
|
||||
@ -617,6 +620,7 @@ export default class PartyUiHandler extends MessageUiHandler {
|
||||
this.options.push(PartyOption.MOVE_1 + m);
|
||||
} else if (this.partyUiMode === PartyUiMode.REMEMBER_MOVE_MODIFIER) {
|
||||
const learnableMoves = pokemon.getLearnableLevelMoves();
|
||||
learnableMoves.push(...pokemon.getLearnableEggMoves())
|
||||
for (let m = 0; m < learnableMoves.length; m++)
|
||||
this.options.push(m);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user