mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-18 14:22:19 +02:00
Clean up
This commit is contained in:
parent
59617cfb34
commit
8a62d54dfd
@ -92,7 +92,7 @@ export class SpeciesFormEvolution {
|
||||
public evoFormKey: string | null;
|
||||
public level: number;
|
||||
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 description = "";
|
||||
|
||||
@ -181,6 +181,7 @@ class TimeOfDayEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
class MoveEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
public 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));
|
||||
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("");
|
||||
@ -220,6 +221,7 @@ class FriendshipMoveTypeEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
public amount: number;
|
||||
public type: PokemonType;
|
||||
constructor(amount: number, type: PokemonType) {
|
||||
// TODO: Remove deprecated Challenge check
|
||||
super(p =>
|
||||
p.friendship >= amount &&
|
||||
(!!p.getMoveset().find(m => m?.getMove().type === type ||
|
||||
@ -269,6 +271,7 @@ class WeatherEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
class MoveTypeEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
public type: PokemonType;
|
||||
constructor(type: PokemonType) {
|
||||
// TODO: Remove deprecated Challenge check
|
||||
super(p => p.moveset.filter(m => m?.getMove().type === type).length > 0 ||
|
||||
(globalScene.gameMode.hasChallenge(Challenges.METRONOME) &&
|
||||
!!globalScene.getPlayerParty().find(p => p.getTypes(false, false, true).indexOf(type) > -1)));
|
||||
@ -290,6 +293,7 @@ class TreasureEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
class TyrogueEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
public move: Moves;
|
||||
constructor(move: Moves) {
|
||||
// TODO: Remove deprecated Challenge check
|
||||
super(p =>
|
||||
(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]) ||
|
||||
@ -316,6 +320,7 @@ class MoveTimeOfDayEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
public move: Moves;
|
||||
public timesOfDay: TimeOfDay[];
|
||||
constructor(move: Moves, tod: "day" | "night") {
|
||||
// TODO: Remove deprecated Challenge check
|
||||
if (tod === "day") {
|
||||
super(p =>
|
||||
(p.moveset.filter(m => m.moveId === move).length > 0 ||
|
||||
@ -350,6 +355,7 @@ class BiomeEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
|
||||
class DunsparceEvolutionCondition extends SpeciesEvolutionCondition {
|
||||
constructor() {
|
||||
// TODO: Remove deprecated Challenge check
|
||||
super(p => {
|
||||
let ret = false;
|
||||
if (p.moveset.filter(m => m.moveId === Moves.HYPER_DRILL).length > 0 || globalScene.gameMode.hasChallenge(Challenges.METRONOME)) {
|
||||
|
@ -114,7 +114,7 @@ export enum ChallengeType {
|
||||
*/
|
||||
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,
|
||||
/**
|
||||
@ -914,19 +914,22 @@ export class FreshStartChallenge extends Challenge {
|
||||
if (poolType !== ModifierPoolType.PLAYER) {
|
||||
return false;
|
||||
}
|
||||
let ret = false;
|
||||
let idx = modifierPool[ModifierTier.ULTRA].findIndex(
|
||||
p => p.modifierType === getModifierType(getModifierTypeFuncById("EVIOLITE")),
|
||||
);
|
||||
if (idx >= 0) {
|
||||
modifierPool[ModifierTier.ULTRA].splice(idx, 1);
|
||||
ret = true;
|
||||
}
|
||||
idx = modifierPool[ModifierTier.MASTER].findIndex(
|
||||
p => p.modifierType === getModifierType(getModifierTypeFuncById("MINI_BLACK_HOLE")),
|
||||
);
|
||||
if (idx >= 0) {
|
||||
modifierPool[ModifierTier.MASTER].splice(idx, 1);
|
||||
ret = true;
|
||||
}
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
override getDifficulty(): number {
|
||||
@ -1028,6 +1031,13 @@ export class MetronomeChallenge extends Challenge {
|
||||
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 {
|
||||
usedPP.value = 0;
|
||||
return true;
|
||||
@ -1037,6 +1047,7 @@ export class MetronomeChallenge extends Challenge {
|
||||
if (poolType !== ModifierPoolType.PLAYER) {
|
||||
return false;
|
||||
}
|
||||
let ret = false;
|
||||
const common_block = ["TM_COMMON", "ETHER", "MAX_ETHER"];
|
||||
const great_block = ["ELIXIR", "MAX_ELIXIR", "PP_UP", "MEMORY_MUSHROOM", "TM_GREAT"];
|
||||
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);
|
||||
if (idx >= 0) {
|
||||
modifierPool[ModifierTier.COMMON].splice(idx, 1);
|
||||
ret = true;
|
||||
}
|
||||
});
|
||||
great_block.map(b => {
|
||||
const idx = modifierPool[ModifierTier.GREAT].findIndex(p => p.modifierType.id === b);
|
||||
if (idx >= 0) {
|
||||
modifierPool[ModifierTier.GREAT].splice(idx, 1);
|
||||
ret = true;
|
||||
}
|
||||
});
|
||||
ultra_block.map(b => {
|
||||
const idx = modifierPool[ModifierTier.ULTRA].findIndex(p => p.modifierType.id === b);
|
||||
if (idx >= 0) {
|
||||
modifierPool[ModifierTier.ULTRA].splice(idx, 1);
|
||||
ret = true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
return ret;
|
||||
}
|
||||
|
||||
override applyShopModify(options: ModifierTypeOption[]): boolean {
|
||||
@ -1335,7 +1349,7 @@ export function applyChallenges(
|
||||
): 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 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
|
||||
|
@ -17,8 +17,6 @@ import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
||||
import { EndEvolutionPhase } from "#app/phases/end-evolution-phase";
|
||||
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 {
|
||||
protected pokemon: PlayerPokemon;
|
||||
|
@ -6,9 +6,8 @@ import { EvolutionPhase } from "#app/phases/evolution-phase";
|
||||
import { LearnMovePhase } from "#app/phases/learn-move-phase";
|
||||
import { PlayerPartyMemberPokemonPhase } from "#app/phases/player-party-member-pokemon-phase";
|
||||
import { LevelAchv } from "#app/system/achv";
|
||||
import { BooleanHolder, NumberHolder } from "#app/utils";
|
||||
import { NumberHolder } from "#app/utils";
|
||||
import i18next from "i18next";
|
||||
import { applyChallenges, ChallengeType } from "#app/data/challenge";
|
||||
|
||||
export class LevelUpPhase extends PlayerPartyMemberPokemonPhase {
|
||||
protected lastLevel: number;
|
||||
|
@ -43,7 +43,7 @@ import { MoveChargePhase } from "#app/phases/move-charge-phase";
|
||||
import { MoveEffectPhase } from "#app/phases/move-effect-phase";
|
||||
import { MoveEndPhase } from "#app/phases/move-end-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 { ArenaTagType } from "#enums/arena-tag-type";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
|
Loading…
Reference in New Issue
Block a user