mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-08 08:29:37 +02:00
[Beta] Remove non-Legend Fresh Start option, fix starting movesets
https://github.com/pagefaultgames/pokerogue/pull/6196 * Remove non-Legend fresh start option, fix starting movesets * Move updateInfo call * Fix relearns counting for starter moves * Reduce array allocations and function calls
This commit is contained in:
parent
97ddcb711b
commit
1f5e089818
@ -4,7 +4,6 @@ import { defaultStarterSpecies } from "#app/constants";
|
|||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { pokemonEvolutions } from "#balance/pokemon-evolutions";
|
import { pokemonEvolutions } from "#balance/pokemon-evolutions";
|
||||||
import { speciesStarterCosts } from "#balance/starters";
|
import { speciesStarterCosts } from "#balance/starters";
|
||||||
import { getEggTierForSpecies } from "#data/egg";
|
|
||||||
import { pokemonFormChanges } from "#data/pokemon-forms";
|
import { pokemonFormChanges } from "#data/pokemon-forms";
|
||||||
import type { PokemonSpecies } from "#data/pokemon-species";
|
import type { PokemonSpecies } from "#data/pokemon-species";
|
||||||
import { getPokemonSpeciesForm } from "#data/pokemon-species";
|
import { getPokemonSpeciesForm } from "#data/pokemon-species";
|
||||||
@ -12,7 +11,6 @@ import { BattleType } from "#enums/battle-type";
|
|||||||
import { ChallengeType } from "#enums/challenge-type";
|
import { ChallengeType } from "#enums/challenge-type";
|
||||||
import { Challenges } from "#enums/challenges";
|
import { Challenges } from "#enums/challenges";
|
||||||
import { TypeColor, TypeShadow } from "#enums/color";
|
import { TypeColor, TypeShadow } from "#enums/color";
|
||||||
import { EggTier } from "#enums/egg-type";
|
|
||||||
import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves";
|
import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves";
|
||||||
import { ModifierTier } from "#enums/modifier-tier";
|
import { ModifierTier } from "#enums/modifier-tier";
|
||||||
import type { MoveId } from "#enums/move-id";
|
import type { MoveId } from "#enums/move-id";
|
||||||
@ -26,7 +24,7 @@ import type { Pokemon } from "#field/pokemon";
|
|||||||
import { Trainer } from "#field/trainer";
|
import { Trainer } from "#field/trainer";
|
||||||
import { PokemonMove } from "#moves/pokemon-move";
|
import { PokemonMove } from "#moves/pokemon-move";
|
||||||
import type { DexAttrProps, GameData } from "#system/game-data";
|
import type { DexAttrProps, GameData } from "#system/game-data";
|
||||||
import { BooleanHolder, type NumberHolder, randSeedItem } from "#utils/common";
|
import { BooleanHolder, isBetween, type NumberHolder, randSeedItem } from "#utils/common";
|
||||||
import { deepCopy } from "#utils/data";
|
import { deepCopy } from "#utils/data";
|
||||||
import { getPokemonSpecies } from "#utils/pokemon-utils";
|
import { getPokemonSpecies } from "#utils/pokemon-utils";
|
||||||
import { toCamelCase, toSnakeCase } from "#utils/strings";
|
import { toCamelCase, toSnakeCase } from "#utils/strings";
|
||||||
@ -685,14 +683,11 @@ export class SingleTypeChallenge extends Challenge {
|
|||||||
*/
|
*/
|
||||||
export class FreshStartChallenge extends Challenge {
|
export class FreshStartChallenge extends Challenge {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(Challenges.FRESH_START, 3);
|
super(Challenges.FRESH_START, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean {
|
applyStarterChoice(pokemon: PokemonSpecies, valid: BooleanHolder): boolean {
|
||||||
if (
|
if (this.value === 1 && !defaultStarterSpecies.includes(pokemon.speciesId)) {
|
||||||
(this.value === 1 && !defaultStarterSpecies.includes(pokemon.speciesId)) ||
|
|
||||||
(this.value === 2 && getEggTierForSpecies(pokemon) >= EggTier.EPIC)
|
|
||||||
) {
|
|
||||||
valid.value = false;
|
valid.value = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -708,12 +703,18 @@ export class FreshStartChallenge extends Challenge {
|
|||||||
pokemon.abilityIndex = pokemon.abilityIndex % 2; // Always base ability, if you set it to hidden it wraps to first ability
|
pokemon.abilityIndex = pokemon.abilityIndex % 2; // Always base ability, if you set it to hidden it wraps to first ability
|
||||||
pokemon.passive = false; // Passive isn't unlocked
|
pokemon.passive = false; // Passive isn't unlocked
|
||||||
pokemon.nature = Nature.HARDY; // Neutral nature
|
pokemon.nature = Nature.HARDY; // Neutral nature
|
||||||
pokemon.moveset = pokemon.species
|
let validMoves = pokemon.species
|
||||||
.getLevelMoves()
|
.getLevelMoves()
|
||||||
.filter(m => m[0] <= 5)
|
.filter(m => isBetween(m[0], 1, 5))
|
||||||
.map(lm => lm[1])
|
.map(lm => lm[1]);
|
||||||
.slice(0, 4)
|
// Filter egg moves out of the moveset
|
||||||
.map(m => new PokemonMove(m)); // No egg moves
|
pokemon.moveset = pokemon.moveset.filter(pm => validMoves.includes(pm.moveId));
|
||||||
|
if (pokemon.moveset.length < 4) {
|
||||||
|
// If there's empty slots fill with remaining valid moves
|
||||||
|
const existingMoveIds = pokemon.moveset.map(pm => pm.moveId);
|
||||||
|
validMoves = validMoves.filter(m => !existingMoveIds.includes(m));
|
||||||
|
pokemon.moveset = pokemon.moveset.concat(validMoves.map(m => new PokemonMove(m))).slice(0, 4);
|
||||||
|
}
|
||||||
pokemon.luck = 0; // No luck
|
pokemon.luck = 0; // No luck
|
||||||
pokemon.shiny = false; // Not shiny
|
pokemon.shiny = false; // Not shiny
|
||||||
pokemon.variant = 0; // Not shiny
|
pokemon.variant = 0; // Not shiny
|
||||||
|
@ -99,8 +99,12 @@ export class SelectStarterPhase extends Phase {
|
|||||||
starterPokemon.generateFusionSpecies(true);
|
starterPokemon.generateFusionSpecies(true);
|
||||||
}
|
}
|
||||||
starterPokemon.setVisible(false);
|
starterPokemon.setVisible(false);
|
||||||
applyChallenges(ChallengeType.STARTER_MODIFY, starterPokemon);
|
const chalApplied = applyChallenges(ChallengeType.STARTER_MODIFY, starterPokemon);
|
||||||
party.push(starterPokemon);
|
party.push(starterPokemon);
|
||||||
|
if (chalApplied) {
|
||||||
|
// If any challenges modified the starter, it should update
|
||||||
|
loadPokemonAssets.push(starterPokemon.updateInfo());
|
||||||
|
}
|
||||||
loadPokemonAssets.push(starterPokemon.loadAssets());
|
loadPokemonAssets.push(starterPokemon.loadAssets());
|
||||||
});
|
});
|
||||||
overrideModifiers();
|
overrideModifiers();
|
||||||
|
Loading…
Reference in New Issue
Block a user