This commit is contained in:
AJ Fontaine 2025-03-29 21:31:38 -04:00
parent 59617cfb34
commit 8a62d54dfd
5 changed files with 27 additions and 10 deletions

View File

@ -92,7 +92,7 @@ export class SpeciesFormEvolution {
public evoFormKey: string | null; public evoFormKey: string | null;
public level: number; public level: number;
public item: EvolutionItem | null; public item: EvolutionItem | null;
public condition: SpeciesEvolutionCondition | null; public condition: SpeciesEvolutionCondition | null; // TODO: Add a ChallengeType to change evolution conditions based on what kind of condition it is (use an enum)
public wildDelay: SpeciesWildEvolutionDelay; public wildDelay: SpeciesWildEvolutionDelay;
public description = ""; public description = "";
@ -181,6 +181,7 @@ class TimeOfDayEvolutionCondition extends SpeciesEvolutionCondition {
class MoveEvolutionCondition extends SpeciesEvolutionCondition { class MoveEvolutionCondition extends SpeciesEvolutionCondition {
public move: Moves; public move: Moves;
constructor(move: Moves) { constructor(move: Moves) {
// TODO: Remove deprecated Challenge check
super(p => p.moveset.filter(m => m.moveId === move).length > 0 || globalScene.gameMode.hasChallenge(Challenges.METRONOME)); super(p => p.moveset.filter(m => m.moveId === move).length > 0 || globalScene.gameMode.hasChallenge(Challenges.METRONOME));
this.move = move; this.move = move;
const moveKey = Moves[this.move].split("_").filter(f => f).map((f, i) => i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()).join(""); const moveKey = Moves[this.move].split("_").filter(f => f).map((f, i) => i ? `${f[0]}${f.slice(1).toLowerCase()}` : f.toLowerCase()).join("");
@ -220,6 +221,7 @@ class FriendshipMoveTypeEvolutionCondition extends SpeciesEvolutionCondition {
public amount: number; public amount: number;
public type: PokemonType; public type: PokemonType;
constructor(amount: number, type: PokemonType) { constructor(amount: number, type: PokemonType) {
// TODO: Remove deprecated Challenge check
super(p => super(p =>
p.friendship >= amount && p.friendship >= amount &&
(!!p.getMoveset().find(m => m?.getMove().type === type || (!!p.getMoveset().find(m => m?.getMove().type === type ||
@ -269,6 +271,7 @@ class WeatherEvolutionCondition extends SpeciesEvolutionCondition {
class MoveTypeEvolutionCondition extends SpeciesEvolutionCondition { class MoveTypeEvolutionCondition extends SpeciesEvolutionCondition {
public type: PokemonType; public type: PokemonType;
constructor(type: PokemonType) { constructor(type: PokemonType) {
// TODO: Remove deprecated Challenge check
super(p => p.moveset.filter(m => m?.getMove().type === type).length > 0 || super(p => p.moveset.filter(m => m?.getMove().type === type).length > 0 ||
(globalScene.gameMode.hasChallenge(Challenges.METRONOME) && (globalScene.gameMode.hasChallenge(Challenges.METRONOME) &&
!!globalScene.getPlayerParty().find(p => p.getTypes(false, false, true).indexOf(type) > -1))); !!globalScene.getPlayerParty().find(p => p.getTypes(false, false, true).indexOf(type) > -1)));
@ -290,6 +293,7 @@ class TreasureEvolutionCondition extends SpeciesEvolutionCondition {
class TyrogueEvolutionCondition extends SpeciesEvolutionCondition { class TyrogueEvolutionCondition extends SpeciesEvolutionCondition {
public move: Moves; public move: Moves;
constructor(move: Moves) { constructor(move: Moves) {
// TODO: Remove deprecated Challenge check
super(p => super(p =>
(globalScene.gameMode.hasChallenge(Challenges.METRONOME) && ( // Metronome mode = no moves, do it the old fashioned way (globalScene.gameMode.hasChallenge(Challenges.METRONOME) && ( // Metronome mode = no moves, do it the old fashioned way
(move === Moves.LOW_SWEEP && p.stats[Stat.ATK] > p.stats[Stat.DEF]) || (move === Moves.LOW_SWEEP && p.stats[Stat.ATK] > p.stats[Stat.DEF]) ||
@ -316,6 +320,7 @@ class MoveTimeOfDayEvolutionCondition extends SpeciesEvolutionCondition {
public move: Moves; public move: Moves;
public timesOfDay: TimeOfDay[]; public timesOfDay: TimeOfDay[];
constructor(move: Moves, tod: "day" | "night") { constructor(move: Moves, tod: "day" | "night") {
// TODO: Remove deprecated Challenge check
if (tod === "day") { if (tod === "day") {
super(p => super(p =>
(p.moveset.filter(m => m.moveId === move).length > 0 || (p.moveset.filter(m => m.moveId === move).length > 0 ||
@ -350,6 +355,7 @@ class BiomeEvolutionCondition extends SpeciesEvolutionCondition {
class DunsparceEvolutionCondition extends SpeciesEvolutionCondition { class DunsparceEvolutionCondition extends SpeciesEvolutionCondition {
constructor() { constructor() {
// TODO: Remove deprecated Challenge check
super(p => { super(p => {
let ret = false; let ret = false;
if (p.moveset.filter(m => m.moveId === Moves.HYPER_DRILL).length > 0 || globalScene.gameMode.hasChallenge(Challenges.METRONOME)) { if (p.moveset.filter(m => m.moveId === Moves.HYPER_DRILL).length > 0 || globalScene.gameMode.hasChallenge(Challenges.METRONOME)) {

View File

@ -114,7 +114,7 @@ export enum ChallengeType {
*/ */
MODIFY_PP_USE, MODIFY_PP_USE,
/** /**
* Modifies modifier pools of specified type (PLEASE MODIFIER REWORK PLEASE I'M BEGGING YOU PLEASE PLEASE PLEASE PLEASE) * Modifies modifier pools of specified type
*/ */
MODIFIER_POOL_MODIFY, MODIFIER_POOL_MODIFY,
/** /**
@ -914,19 +914,22 @@ export class FreshStartChallenge extends Challenge {
if (poolType !== ModifierPoolType.PLAYER) { if (poolType !== ModifierPoolType.PLAYER) {
return false; return false;
} }
let ret = false;
let idx = modifierPool[ModifierTier.ULTRA].findIndex( let idx = modifierPool[ModifierTier.ULTRA].findIndex(
p => p.modifierType === getModifierType(getModifierTypeFuncById("EVIOLITE")), p => p.modifierType === getModifierType(getModifierTypeFuncById("EVIOLITE")),
); );
if (idx >= 0) { if (idx >= 0) {
modifierPool[ModifierTier.ULTRA].splice(idx, 1); modifierPool[ModifierTier.ULTRA].splice(idx, 1);
ret = true;
} }
idx = modifierPool[ModifierTier.MASTER].findIndex( idx = modifierPool[ModifierTier.MASTER].findIndex(
p => p.modifierType === getModifierType(getModifierTypeFuncById("MINI_BLACK_HOLE")), p => p.modifierType === getModifierType(getModifierTypeFuncById("MINI_BLACK_HOLE")),
); );
if (idx >= 0) { if (idx >= 0) {
modifierPool[ModifierTier.MASTER].splice(idx, 1); modifierPool[ModifierTier.MASTER].splice(idx, 1);
ret = true;
} }
return true; return ret;
} }
override getDifficulty(): number { override getDifficulty(): number {
@ -1028,6 +1031,13 @@ export class MetronomeChallenge extends Challenge {
return true; return true;
} }
/**
* Makes sure 0 PP is used, called when applying other PP usage modifiers such as Pressure
* @param _pokemon {@link Pokemon} unused
* @param _move {@link Moves} unused
* @param usedPP
* @returns true
*/
override applyModifyPPUsage(_pokemon: Pokemon, _move: Moves, usedPP: Utils.NumberHolder): boolean { override applyModifyPPUsage(_pokemon: Pokemon, _move: Moves, usedPP: Utils.NumberHolder): boolean {
usedPP.value = 0; usedPP.value = 0;
return true; return true;
@ -1037,6 +1047,7 @@ export class MetronomeChallenge extends Challenge {
if (poolType !== ModifierPoolType.PLAYER) { if (poolType !== ModifierPoolType.PLAYER) {
return false; return false;
} }
let ret = false;
const common_block = ["TM_COMMON", "ETHER", "MAX_ETHER"]; const common_block = ["TM_COMMON", "ETHER", "MAX_ETHER"];
const great_block = ["ELIXIR", "MAX_ELIXIR", "PP_UP", "MEMORY_MUSHROOM", "TM_GREAT"]; const great_block = ["ELIXIR", "MAX_ELIXIR", "PP_UP", "MEMORY_MUSHROOM", "TM_GREAT"];
const ultra_block = ["TM_ULTRA", "PP_MAX"]; const ultra_block = ["TM_ULTRA", "PP_MAX"];
@ -1045,21 +1056,24 @@ export class MetronomeChallenge extends Challenge {
const idx = modifierPool[ModifierTier.COMMON].findIndex(p => p.modifierType.id === b); const idx = modifierPool[ModifierTier.COMMON].findIndex(p => p.modifierType.id === b);
if (idx >= 0) { if (idx >= 0) {
modifierPool[ModifierTier.COMMON].splice(idx, 1); modifierPool[ModifierTier.COMMON].splice(idx, 1);
ret = true;
} }
}); });
great_block.map(b => { great_block.map(b => {
const idx = modifierPool[ModifierTier.GREAT].findIndex(p => p.modifierType.id === b); const idx = modifierPool[ModifierTier.GREAT].findIndex(p => p.modifierType.id === b);
if (idx >= 0) { if (idx >= 0) {
modifierPool[ModifierTier.GREAT].splice(idx, 1); modifierPool[ModifierTier.GREAT].splice(idx, 1);
ret = true;
} }
}); });
ultra_block.map(b => { ultra_block.map(b => {
const idx = modifierPool[ModifierTier.ULTRA].findIndex(p => p.modifierType.id === b); const idx = modifierPool[ModifierTier.ULTRA].findIndex(p => p.modifierType.id === b);
if (idx >= 0) { if (idx >= 0) {
modifierPool[ModifierTier.ULTRA].splice(idx, 1); modifierPool[ModifierTier.ULTRA].splice(idx, 1);
ret = true;
} }
}); });
return true; return ret;
} }
override applyShopModify(options: ModifierTypeOption[]): boolean { override applyShopModify(options: ModifierTypeOption[]): boolean {
@ -1335,7 +1349,7 @@ export function applyChallenges(
): boolean; ): boolean;
/** /**
* Apply all challenges that modify the horrific abomination that is the modifier pools * Apply all challenges that modify modifier pools //TODO: Modifier rework will need to look at this
* @param challengeType {@link ChallengeType} ChallengeType.MODIFIER_POOL_MODIFY * @param challengeType {@link ChallengeType} ChallengeType.MODIFIER_POOL_MODIFY
* @param poolType {@link ModifierPoolType} Which kind of pool is being changed (wild held items, player rewards etc) * @param poolType {@link ModifierPoolType} Which kind of pool is being changed (wild held items, player rewards etc)
* @param modifierPool {@link ModifierPool} The item pool the challenge may attempt to modify * @param modifierPool {@link ModifierPool} The item pool the challenge may attempt to modify

View File

@ -17,8 +17,6 @@ import { getPokemonNameWithAffix } from "#app/messages";
import { LearnMovePhase } from "#app/phases/learn-move-phase"; import { LearnMovePhase } from "#app/phases/learn-move-phase";
import { EndEvolutionPhase } from "#app/phases/end-evolution-phase"; import { EndEvolutionPhase } from "#app/phases/end-evolution-phase";
import { EVOLVE_MOVE } from "#app/data/balance/pokemon-level-moves"; import { EVOLVE_MOVE } from "#app/data/balance/pokemon-level-moves";
import { BooleanHolder } from "#app/utils";
import { applyChallenges, ChallengeType } from "#app/data/challenge";
export class EvolutionPhase extends Phase { export class EvolutionPhase extends Phase {
protected pokemon: PlayerPokemon; protected pokemon: PlayerPokemon;

View File

@ -6,9 +6,8 @@ import { EvolutionPhase } from "#app/phases/evolution-phase";
import { LearnMovePhase } from "#app/phases/learn-move-phase"; import { LearnMovePhase } from "#app/phases/learn-move-phase";
import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase"; import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase";
import { LevelAchv } from "#app/system/achv"; import { LevelAchv } from "#app/system/achv";
import { BooleanHolder, NumberHolder } from "#app/utils"; import { NumberHolder } from "#app/utils";
import i18next from "i18next"; import i18next from "i18next";
import { applyChallenges, ChallengeType } from "#app/data/challenge";
export class LevelUpPhase extends PlayerPartyMemberPokemonPhase { export class LevelUpPhase extends PlayerPartyMemberPokemonPhase {
protected lastLevel: number; protected lastLevel: number;

View File

@ -43,7 +43,7 @@ import { MoveChargePhase } from "#app/phases/move-charge-phase";
import { MoveEffectPhase } from "#app/phases/move-effect-phase"; import { MoveEffectPhase } from "#app/phases/move-effect-phase";
import { MoveEndPhase } from "#app/phases/move-end-phase"; import { MoveEndPhase } from "#app/phases/move-end-phase";
import { ShowAbilityPhase } from "#app/phases/show-ability-phase"; import { ShowAbilityPhase } from "#app/phases/show-ability-phase";
import { BooleanHolder, NumberHolder } from "#app/utils"; import { NumberHolder } from "#app/utils";
import { Abilities } from "#enums/abilities"; import { Abilities } from "#enums/abilities";
import { ArenaTagType } from "#enums/arena-tag-type"; import { ArenaTagType } from "#enums/arena-tag-type";
import { BattlerTagType } from "#enums/battler-tag-type"; import { BattlerTagType } from "#enums/battler-tag-type";