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 { pokemonEvolutions } from "./pokemon-evolutions";
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 */
const DEFAULT_PARTY_MAX_COST = 10;
@ -60,10 +63,10 @@ export enum ChallengeType {
*/
TYPE_EFFECTIVENESS,
/**
* Challenge that enables Trick Room in a run
* @see {@link https://bulbapedia.bulbagarden.net/wiki/Trick_Room_(move)}
* Modifies the Arena Tags when a encounter starts
* @see {@linkcode Challenge.applyArenaTag}
*/
TRICK_ROOM,
ARENA_TAG,
/**
* 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.
* @param isTrickRoom {@link Utils.BooleanHolder} Whether the battle is under the effect of Trick Room.
* @returns `true` if this function did anything.
* An apply function for ARENA_TAG challenges. Derived classes should alter this.
* @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.
* @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;
}
@ -727,16 +733,22 @@ export class TrickRoomChallenge extends Challenge {
newChallenge.severity = source.severity;
return newChallenge;
}
/**
* @override
* this challenge inverts whether the battle is under the effect of Trick Room.
* @param isTrickRoom {@link Utils.BooleanHolder} Whether the battle is under the effect of Trick Room.
* this challenge enables Trick Room arena tag when encounter starts
* @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.
*/
override applyTrickRoom(isTrickRoom: Utils.BooleanHolder): boolean {
isTrickRoom.value = !isTrickRoom.value;
return true;
override applyArenaTag(arena: Arena, arenaTag: ArenaTagType, turnCount: Number): boolean {
if (arenaTag === ArenaTagType.TRICK_ROOM) {
arena.addTag(ArenaTagType.TRICK_ROOM, turnCount.valueOf(), undefined, -1);
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;
/**
* 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 challengeType {@linkcode ChallengeType.TRICK_ROOM}
* @param isTrickRoom {@linkcode Utils.BooleanHolder} Whether the battle is under the effect of Trick Room.
* @param challengeType {@linkcode ChallengeType.ARENA_TAG}
* @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.
*/
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.
* @param gameMode {@link GameMode} The current gameMode
@ -959,8 +974,8 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
case ChallengeType.TYPE_EFFECTIVENESS:
ret ||= c.applyTypeEffectiveness(args[0]);
break;
case ChallengeType.TRICK_ROOM:
ret ||= c.applyTrickRoom(args[0]);
case ChallengeType.ARENA_TAG:
ret ||= c.applyArenaTag(args[0], args[1], args[2], args[3]);
break;
case ChallengeType.AI_LEVEL:
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 { MysteryEncounterPhase } from "#app/phases/mystery-encounter-phases";
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 {
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() {