update challenge type to ARENA_TAG from TRICK_ROOM

This commit is contained in:
KimJeongSun 2024-09-28 03:23:39 +09:00
parent 37e9fa8f08
commit 869535ab9e
2 changed files with 37 additions and 19 deletions

View File

@ -15,6 +15,9 @@ import { Moves } from "#app/enums/moves";
import { TypeColor, TypeShadow } from "#app/enums/color"; import { TypeColor, TypeShadow } from "#app/enums/color";
import { pokemonEvolutions } from "./pokemon-evolutions"; import { pokemonEvolutions } from "./pokemon-evolutions";
import { pokemonFormChanges } from "./pokemon-forms"; import { pokemonFormChanges } from "./pokemon-forms";
import { Arena } from "#app/field/arena";
import { ArenaTagType } from "#enums/arena-tag-type";
import { ArenaTagSide } from "./arena-tag";
/** 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;
@ -60,10 +63,10 @@ export enum ChallengeType {
*/ */
TYPE_EFFECTIVENESS, TYPE_EFFECTIVENESS,
/** /**
* Challenge that enables Trick Room in a run * Modifies the Arena Tags when a encounter starts
* @see {@link https://bulbapedia.bulbagarden.net/wiki/Trick_Room_(move)} * @see {@linkcode Challenge.applyArenaTag}
*/ */
TRICK_ROOM, ARENA_TAG,
/** /**
* Modifies what level the AI pokemon are. UNIMPLEMENTED. * Modifies what level the AI pokemon are. UNIMPLEMENTED.
*/ */
@ -342,11 +345,14 @@ export abstract class Challenge {
} }
/** /**
* An apply function for TRICK_ROOM challenges. Derived classes should alter this. * An apply function for ARENA_TAG challenges. Derived classes should alter this.
* @param isTrickRoom {@link Utils.BooleanHolder} Whether the battle is under the effect of Trick Room. * @param arena {@link Arena} The arena to apply the tag to.
* @returns `true` if this function did anything. * @param arenaTag {@link ArenaTagType} The arena tag to apply.
* @param turnCount {@link Number} The amount of turns the tag should last.
* @param side {@link ArenaTagSide} The side to apply the tag to. (optional)
* @returns {@link boolean} Whether this function did anything.
*/ */
applyTrickRoom(isTrickRoom: Utils.BooleanHolder): boolean { applyArenaTag(arena: Arena, arenaTag: ArenaTagType, turnCount: Number, side?: ArenaTagSide): boolean {
return false; return false;
} }
@ -727,17 +733,23 @@ export class TrickRoomChallenge extends Challenge {
newChallenge.severity = source.severity; newChallenge.severity = source.severity;
return newChallenge; return newChallenge;
} }
/** /**
* @override * @override
* this challenge inverts whether the battle is under the effect of Trick Room. * this challenge enables Trick Room arena tag when encounter starts
* @param isTrickRoom {@link Utils.BooleanHolder} Whether the battle is under the effect of Trick Room. * @see {@link https://bulbapedia.bulbagarden.net/wiki/Trick_Room_(move)}
*
* @param arena {@link Arena} The arena to apply the tag to.
* @param arenaTag {@link ArenaTagType} The arena tag to apply.
* @param turnCount {@link Number} The amount of turns the tag should last.
* @returns `true` if any challenge was successfully applied. * @returns `true` if any challenge was successfully applied.
*/ */
override applyTrickRoom(isTrickRoom: Utils.BooleanHolder): boolean { override applyArenaTag(arena: Arena, arenaTag: ArenaTagType, turnCount: Number): boolean {
isTrickRoom.value = !isTrickRoom.value; if (arenaTag === ArenaTagType.TRICK_ROOM) {
arena.addTag(ArenaTagType.TRICK_ROOM, turnCount.valueOf(), undefined, -1);
return true; return true;
} }
return false;
}
} }
/** /**
@ -868,13 +880,16 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
*/ */
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.TYPE_EFFECTIVENESS, effectiveness: Utils.NumberHolder): boolean; export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.TYPE_EFFECTIVENESS, effectiveness: Utils.NumberHolder): boolean;
/** /**
* Apply all challenges that modify Trick Room. * Apply all challenges that modify an arena tag when a encounter starts.
* @param gameMode The current {@linkcode GameMode} * @param gameMode The current {@linkcode GameMode}
* @param challengeType {@linkcode ChallengeType.TRICK_ROOM} * @param challengeType {@linkcode ChallengeType.ARENA_TAG}
* @param isTrickRoom {@linkcode Utils.BooleanHolder} Whether the battle is under the effect of Trick Room. * @param arena {@linkcode Arena} The arena to apply the tag to.
* @param arenaTag {@linkcode ArenaTagType} The arena tag to apply.
* @param turnCount {@linkcode Number} The amount of turns the tag should last.
* @param side {@linkcode ArenaTagSide} The side to apply the tag to. (optional)
* @returns `true` if any challenge was successfully applied. * @returns `true` if any challenge was successfully applied.
*/ */
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.TRICK_ROOM, isTrickRoom: Utils.BooleanHolder): boolean; export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.ARENA_TAG, arena: Arena, arenaTag: ArenaTagType, turnCount: Number, side?: ArenaTagSide): boolean;
/** /**
* Apply all challenges that modify what level AI are. * Apply all challenges that modify what level AI are.
* @param gameMode {@link GameMode} The current gameMode * @param gameMode {@link GameMode} The current gameMode
@ -959,8 +974,8 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
case ChallengeType.TYPE_EFFECTIVENESS: case ChallengeType.TYPE_EFFECTIVENESS:
ret ||= c.applyTypeEffectiveness(args[0]); ret ||= c.applyTypeEffectiveness(args[0]);
break; break;
case ChallengeType.TRICK_ROOM: case ChallengeType.ARENA_TAG:
ret ||= c.applyTrickRoom(args[0]); ret ||= c.applyArenaTag(args[0], args[1], args[2], args[3]);
break; break;
case ChallengeType.AI_LEVEL: case ChallengeType.AI_LEVEL:
ret ||= c.applyLevelChange(args[0], args[1], args[2], args[3]); ret ||= c.applyLevelChange(args[0], args[1], args[2], args[3]);

View File

@ -34,6 +34,8 @@ import { doTrainerExclamation } from "#app/data/mystery-encounters/utils/encount
import { getEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils"; import { getEncounterText } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases"; import { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
import { getGoldenBugNetSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils"; import { getGoldenBugNetSpecies } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import { applyChallenges, ChallengeType } from "#app/data/challenge";
import { ArenaTagType } from "#app/enums/arena-tag-type";
export class EncounterPhase extends BattlePhase { export class EncounterPhase extends BattlePhase {
private loaded: boolean; private loaded: boolean;
@ -421,6 +423,7 @@ export class EncounterPhase extends BattlePhase {
}); });
} }
} }
applyChallenges(this.scene.gameMode, ChallengeType.ARENA_TAG, this.scene.arena, ArenaTagType.TRICK_ROOM, Number.POSITIVE_INFINITY);
} }
end() { end() {