mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-21 06:49:35 +02:00
Prevent fainted pokemon from being spliced in hardcore
This commit is contained in:
parent
df73978bb4
commit
4de5572b0e
@ -1,22 +1,22 @@
|
|||||||
import { BattleType, FixedBattleConfig } from "#app/battle";
|
import { BooleanHolder, NumberHolder, randSeedItem } from "#app/utils";
|
||||||
import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
|
import i18next from "i18next";
|
||||||
import { speciesStarterCosts } from "#app/data/balance/starters";
|
import { defaultStarterSpecies, DexAttrProps, GameData } from "#app/system/game-data";
|
||||||
import { Nature } from "#app/data/nature";
|
|
||||||
import { pokemonFormChanges } from "#app/data/pokemon-forms";
|
|
||||||
import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
|
import PokemonSpecies, { getPokemonSpecies, getPokemonSpeciesForm } from "#app/data/pokemon-species";
|
||||||
import { Type } from "#app/data/type";
|
import { speciesStarterCosts } from "#app/data/balance/starters";
|
||||||
import Pokemon, { EnemyPokemon, PlayerPokemon, PokemonMove } from "#app/field/pokemon";
|
import Pokemon, { type EnemyPokemon, PokemonMove, type PlayerPokemon } from "#app/field/pokemon";
|
||||||
|
import { BattleType, FixedBattleConfig } from "#app/battle";
|
||||||
import Trainer, { TrainerVariant } from "#app/field/trainer";
|
import Trainer, { TrainerVariant } from "#app/field/trainer";
|
||||||
import { GameMode } from "#app/game-mode";
|
import { GameMode } from "#app/game-mode";
|
||||||
import { ModifierTypeOption } from "#app/modifier/modifier-type";
|
import { Type } from "#app/data/type";
|
||||||
import { defaultStarterSpecies, DexAttrProps, GameData } from "#app/system/game-data";
|
|
||||||
import { BooleanHolder, NumberHolder, randSeedItem } from "#app/utils";
|
|
||||||
import { Challenges } from "#enums/challenges";
|
import { Challenges } from "#enums/challenges";
|
||||||
import { TypeColor, TypeShadow } from "#enums/color";
|
|
||||||
import { Moves } from "#enums/moves";
|
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import { TrainerType } from "#enums/trainer-type";
|
import { TrainerType } from "#enums/trainer-type";
|
||||||
import i18next from "i18next";
|
import { Nature } from "#app/data/nature";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { TypeColor, TypeShadow } from "#enums/color";
|
||||||
|
import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
|
||||||
|
import { pokemonFormChanges } from "#app/data/pokemon-forms";
|
||||||
|
import type { ModifierTypeOption } from "#app/modifier/modifier-type";
|
||||||
|
|
||||||
/** A constant for the default max cost of the starting party before a run */
|
/** A constant for the default max cost of the starting party before a run */
|
||||||
const DEFAULT_PARTY_MAX_COST = 10;
|
const DEFAULT_PARTY_MAX_COST = 10;
|
||||||
@ -862,12 +862,18 @@ export class NoAutomaticHealChallenge extends Challenge {
|
|||||||
|
|
||||||
/** Challenge that removes the ability to revive fallen pokemon */
|
/** Challenge that removes the ability to revive fallen pokemon */
|
||||||
export class HardcoreChallenge extends Challenge {
|
export class HardcoreChallenge extends Challenge {
|
||||||
private itemBlackList = [ "modifierType:ModifierType.REVIVE", "modifierType:ModifierType.MAX_REVIVE", "modifierType:ModifierType.SACRED_ASH", "modifierType:ModifierType.REVIVER_SEED" ];
|
private readonly itemBlackList = [ "modifierType:ModifierType.REVIVE", "modifierType:ModifierType.MAX_REVIVE", "modifierType:ModifierType.SACRED_ASH", "modifierType:ModifierType.REVIVER_SEED" ];
|
||||||
|
private readonly moveBlacklist = [ Moves.REVIVAL_BLESSING ];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super(Challenges.HARDCORE, 1);
|
super(Challenges.HARDCORE, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override applyPokemonInBattle(pokemon: Pokemon, valid: BooleanHolder): boolean {
|
||||||
|
valid.value = !pokemon.isFainted();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
override applyRandomItemBlacklist(randomItem: ModifierTypeOption | null, isValid: BooleanHolder): boolean {
|
override applyRandomItemBlacklist(randomItem: ModifierTypeOption | null, isValid: BooleanHolder): boolean {
|
||||||
if (randomItem !== null) {
|
if (randomItem !== null) {
|
||||||
isValid.value = !this.itemBlackList.includes(randomItem.type.localeKey);
|
isValid.value = !this.itemBlackList.includes(randomItem.type.localeKey);
|
||||||
@ -881,8 +887,7 @@ export class HardcoreChallenge extends Challenge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override applyMoveBlacklist(move: PokemonMove, moveCanBeUsed: BooleanHolder): boolean {
|
override applyMoveBlacklist(move: PokemonMove, moveCanBeUsed: BooleanHolder): boolean {
|
||||||
const moveBlacklist = [ Moves.REVIVAL_BLESSING ];
|
moveCanBeUsed.value = !this.moveBlacklist.includes(move.moveId);
|
||||||
moveCanBeUsed.value = !moveBlacklist.includes(move.moveId);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,12 +391,14 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
this.clearOptions();
|
this.clearOptions();
|
||||||
} else {
|
} else {
|
||||||
this.clearOptions();
|
this.clearOptions();
|
||||||
this.showText(filterResult as string, undefined, () => this.showText("", 0), undefined, true);
|
this.showText(filterResult, undefined, () => this.showText("", 0), undefined, true);
|
||||||
}
|
}
|
||||||
ui.playSelect();
|
ui.playSelect();
|
||||||
return true;
|
return true;
|
||||||
} else if ((option !== PartyOption.SUMMARY && option !== PartyOption.UNPAUSE_EVOLUTION && option !== PartyOption.UNSPLICE && option !== PartyOption.RELEASE && option !== PartyOption.CANCEL && option !== PartyOption.RENAME)
|
} else if (
|
||||||
|| (option === PartyOption.RELEASE && this.partyUiMode === PartyUiMode.RELEASE)) {
|
![ PartyOption.SUMMARY, PartyOption.UNPAUSE_EVOLUTION, PartyOption.UNSPLICE, PartyOption.RELEASE, PartyOption.CANCEL, PartyOption.RENAME ].includes(option)
|
||||||
|
|| (option === PartyOption.RELEASE && this.partyUiMode === PartyUiMode.RELEASE)
|
||||||
|
) {
|
||||||
let filterResult: string | null;
|
let filterResult: string | null;
|
||||||
const getTransferrableItemsFromPokemon = (pokemon: PlayerPokemon) =>
|
const getTransferrableItemsFromPokemon = (pokemon: PlayerPokemon) =>
|
||||||
this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier && m.isTransferable && m.pokemonId === pokemon.id) as PokemonHeldItemModifier[];
|
this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier && m.isTransferable && m.pokemonId === pokemon.id) as PokemonHeldItemModifier[];
|
||||||
@ -865,6 +867,11 @@ export default class PartyUiHandler extends MessageUiHandler {
|
|||||||
this.options.push(PartyOption.TRANSFER);
|
this.options.push(PartyOption.TRANSFER);
|
||||||
break;
|
break;
|
||||||
case PartyUiMode.SPLICE:
|
case PartyUiMode.SPLICE:
|
||||||
|
const isAllowedInChallenge = new Utils.BooleanHolder(true);
|
||||||
|
applyChallenges(this.scene.gameMode, ChallengeType.POKEMON_IN_BATTLE, pokemon, isAllowedInChallenge);
|
||||||
|
if (!isAllowedInChallenge.value) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (this.transferMode) {
|
if (this.transferMode) {
|
||||||
if (this.cursor !== this.transferCursor) {
|
if (this.cursor !== this.transferCursor) {
|
||||||
this.options.push(PartyOption.SPLICE);
|
this.options.push(PartyOption.SPLICE);
|
||||||
|
Loading…
Reference in New Issue
Block a user