Apply Matthew's Suggestions Pt. 2

Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
This commit is contained in:
Amani H. 2025-08-06 22:22:50 -04:00 committed by GitHub
parent b17d682350
commit 4490e4e9bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 14 deletions

View File

@ -379,8 +379,8 @@ export abstract class Challenge {
/**
* An apply function for POKEMON_MOVE. Derived classes should alter this.
* @param _moveId - The move being checked
* @param _status - Whether the move can be used or not
* @param _moveId - The {@linkcode MoveId} being checked
* @param _status - A {@linkcode BooleanHolder} containing the move's usability status
* @returns Whether this function did anything
*/
applyPokemonMove(_moveId: MoveId, _status: BooleanHolder): boolean {

View File

@ -25,13 +25,17 @@ export class PartyHealPhase extends BattlePhase {
const preventRevive = new BooleanHolder(false);
applyChallenges(ChallengeType.PREVENT_REVIVE, preventRevive);
for (const pokemon of globalScene.getPlayerParty()) {
// Prevent reviving fainted pokemon during certain challenges
if (!(pokemon.isFainted() && preventRevive.value)) {
pokemon.hp = pokemon.getMaxHp();
pokemon.resetStatus(true, false, false, true);
for (const move of pokemon.moveset) {
move.ppUsed = 0;
}
pokemon.updateInfo(true);
continue;
}
pokemon.hp = pokemon.getMaxHp();
pokemon.resetStatus(true, false, false, true);
for (const move of pokemon.moveset) {
move.ppUsed = 0;
}
pokemon.updateInfo(true);
}
}
const healSong = globalScene.playSoundWithoutBgm("heal");

View File

@ -14,12 +14,12 @@ import { BooleanHolder, type NumberHolder } from "./common";
import { getPokemonSpecies } from "./pokemon-utils";
/**
* Apply all challenges that modify starter choice.
* @param challengeType {@link ChallengeType} ChallengeType.STARTER_CHOICE
* @param pokemon {@link PokemonSpecies} The pokemon to check the validity of.
* @param valid {@link BooleanHolder} A BooleanHolder, the value gets set to false if the pokemon isn't allowed.
* @param dexAttr {@link DexAttrProps} The dex attributes of the pokemon.
* @returns True if any challenge was successfully applied.
* @param challengeType - {@linkcode ChallengeType.STARTER_CHOICE}
* @param pokemon - The {@linkcode PokemonSpecies} to check the validity of
* @param valid - A {@linkcode BooleanHolder} holding the checked species' validity;
* will be set to `false` if the species is disallowed
* @param dexAttr - The {@linkcode DexAttrProps | Dex attributes} of the species
* @returns `true` if any challenge was successfully applied
*/
export function applyChallenges(
challengeType: ChallengeType.STARTER_CHOICE,