From fdca4359a04a28007c71c11fc7dfe3643f34f53e Mon Sep 17 00:00:00 2001 From: Mason Date: Thu, 22 Aug 2024 15:51:12 -0400 Subject: [PATCH] Added documentation to RageTag, fixed open quote, and updates test --- src/data/battler-tags.ts | 19 +++++++++++++ src/locales/de/battler-tags.ts | 2 +- src/test/moves/rage.test.ts | 50 ++++++++++++++-------------------- 3 files changed, 40 insertions(+), 31 deletions(-) diff --git a/src/data/battler-tags.ts b/src/data/battler-tags.ts index 2bfcd16a86f..020f39c0e6d 100644 --- a/src/data/battler-tags.ts +++ b/src/data/battler-tags.ts @@ -205,10 +205,22 @@ export class ShellTrapTag extends BattlerTag { } } +/** + * BattlerTag implementing Rage + * Pokémon with this tag will recieve an attack boost when successfully damaged by an attacking move + * This tag will be lost if a target reaches the MOVE_EFFECT lapse condition with a move other than Rage + * @see {@link https://bulbapedia.bulbagarden.net/wiki/Rage_(move) | Rage} + */ export class RageTag extends BattlerTag { constructor() { super(BattlerTagType.RAGE,[BattlerTagLapseType.MOVE_EFFECT],1,Moves.RAGE); } + + /** + * Displays a message to show that the user has started Raging. + * This is message isn't displayed on cartridge, and was included for clarity during gameplay and while testing. + * @param pokemon {@linkcode Pokemon} the Pokémon this tag is being added to. + */ onAdd(pokemon: Pokemon) { super.onAdd(pokemon); /* This message might not exist on cartridge */ @@ -216,6 +228,13 @@ export class RageTag extends BattlerTag { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon)})); } + /** + * Checks to maintain a Pokémon should maintain their rage, and provides an attack boost when hit. + * @param pokemon {@linkcode Pokemon} The owner of this tag + * @param lapseType {@linkcode BattlerTagLapseType} the type of functionality invoked in battle + * @returns `true` if invoked with the MOVE_EFFECT lapse type and {@linkcode pokemon} most recently used Rage, + * or if invoked with the CUSTOM lapse type. false otherwise. + */ lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { if (lapseType === BattlerTagLapseType.MOVE_EFFECT) { return (pokemon.scene.getCurrentPhase() as MovePhase).move.getMove().id === Moves.RAGE; diff --git a/src/locales/de/battler-tags.ts b/src/locales/de/battler-tags.ts index 2be32f75ae2..543462399b4 100644 --- a/src/locales/de/battler-tags.ts +++ b/src/locales/de/battler-tags.ts @@ -68,7 +68,7 @@ export const battlerTags: SimpleTranslationEntries = { "saltCuredOnAdd": "{{pokemonNameWithAffix}} wurde eingepökelt!", "saltCuredLapse": "{{pokemonNameWithAffix}} wurde durch {{moveName}} verletzt!", "cursedOnAdd": "{{pokemonNameWithAffix}} nimmt einen Teil seiner KP und legt einen Fluch auf {{pokemonName}}!", - "stockpilingOnAdd": "{{pokemonNameWithAffix}} hortet {{stockpiledCount}}!"", + "stockpilingOnAdd": "{{pokemonNameWithAffix}} hortet {{stockpiledCount}}!", "rageOnAdd": "{{pokemonNameWithAffix}}'s rage is starting to build.", "rageOnHit": "{{pokemonNameWithAffix}}'s rage is building.", } as const; diff --git a/src/test/moves/rage.test.ts b/src/test/moves/rage.test.ts index fc9523953b7..236e940ff2c 100644 --- a/src/test/moves/rage.test.ts +++ b/src/test/moves/rage.test.ts @@ -9,9 +9,7 @@ import {StatusEffect} from "#enums/status-effect"; import {RageTag} from "#app/data/battler-tags"; import {PlayerPokemon} from "#app/field/pokemon"; import {Nature} from "#enums/nature"; -import {getMovePosition} from "#test/utils/gameManagerUtils"; import {CommandPhase} from "#app/phases/command-phase"; -import {SelectTargetPhase} from "#app/phases/select-target-phase"; import {BattlerIndex} from "#app/battle"; import {TurnEndPhase} from "#app/phases/turn-end-phase"; @@ -42,7 +40,6 @@ describe("Moves - Rage", () => { .ability(Abilities.UNNERVE) .starterSpecies(Species.BOLTUND) .moveset([Moves.RAGE, Moves.SPLASH, Moves.SPORE, Moves.VITAL_THROW]) - .enemyAbility(Abilities.NO_GUARD) .startingLevel(100) .enemyLevel(100) .disableCrits(); @@ -70,19 +67,19 @@ describe("Moves - Rage", () => { // Player Boltund uses Rage. Opponent Shuckle uses Tackle. // Boltund's attack is raised. - game.doAttack(0); + game.move.select(Moves.RAGE); await game.toNextTurn(); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(1); // Opponent Shuckle uses Tackle. Player Boltund uses Vital Throw (Negative Priority). // Boltund's attack is raised. - game.doAttack(3); + game.move.select(Moves.VITAL_THROW); await game.toNextTurn(); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(2); // Opponent Shuckle uses Tackle. Player Boltund uses Vital Throw (Negative Priority). // Boltund's attack not raised. - game.doAttack(3); + game.move.select(Moves.VITAL_THROW); await game.toNextTurn(); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(2); @@ -107,14 +104,14 @@ describe("Moves - Rage", () => { // Opponent Shuckle uses Rage. Ally Boltund uses Vital Throw. // Shuckle gets an Attack boost - game.doAttack(3); + game.move.select(Moves.VITAL_THROW); await game.toNextTurn(); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); expect(oppPokemon.summonData.battleStats[BattleStat.ATK]).toBe(1); // Ally Boltund uses Spore. Shuckle is asleep. // Shuckle does not get an attack boost. Shuckle still has the RageTag tag. - game.doAttack(2); + game.move.select(Moves.SPORE); await game.toNextTurn(); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); expect(oppPokemon.summonData.battleStats[BattleStat.ATK]).toBe(1); @@ -137,7 +134,7 @@ describe("Moves - Rage", () => { // Boltund uses rage, but it has no effect, Gastly uses Tackle // Boltund does not have RageTag or Attack boost. - game.doAttack(0); + game.move.select(Moves.RAGE); await game.toNextTurn(); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); expect(leadPokemon.getTag(RageTag)).toBeNull; @@ -153,21 +150,21 @@ describe("Moves - Rage", () => { async () => { game.override .enemySpecies(Species.REGIELEKI) - .enemyMoveset(fullOf(Moves.DIVE)); // Has semi-invulnerable turn + .enemyMoveset(fullOf(Moves.PHANTOM_FORCE)); // Has semi-invulnerable turn await game.startBattle(); const leadPokemon = game.scene.getPlayerPokemon()!; - // Regieliki uses Dive. Boltund uses Rage, but Regieleki is underwater + // Regieliki uses Fly. Boltund uses Rage, but Regieleki is invulnerable // Boltund does not gain RageTag or Attack boost - game.doAttack(0); + game.move.select(Moves.RAGE); await game.toNextTurn(); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); expect(leadPokemon.getTag(RageTag)).toBeNull; - // Regieleki finishes Dive, Boltund uses Rage + // Regieleki finishes Fly, Boltund uses Rage // Boltund gains RageTag, but no boost - game.doAttack(0); + game.move.select(Moves.RAGE); await game.toNextTurn(); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); expect(leadPokemon.getTag(RageTag)).toBeTruthy; @@ -179,21 +176,21 @@ describe("Moves - Rage", () => { async () => { game.override .enemySpecies(Species.SHUCKLE) - .enemyMoveset(fullOf(Moves.FLY)); // Has semi-invulnerable turn + .enemyMoveset(fullOf(Moves.PHANTOM_FORCE)); // Has semi-invulnerable turn await game.startBattle(); const leadPokemon = game.scene.getPlayerPokemon()!; - // Boltund uses Rage, Shuckle uses Dive + // Boltund uses Rage, Shuckle uses Fly // Boltund gains RageTag - game.doAttack(0); + game.move.select(Moves.RAGE); await game.toNextTurn(); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0); expect(leadPokemon.getTag(RageTag)).toBeTruthy; // Boltund uses Rage, Shuckle is underwater, Shuckle finishes Dive // Boltund gains gains boost, does not lose RageTag - game.doAttack(0); + game.move.select(Moves.RAGE); await game.toNextTurn(); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(1); expect(leadPokemon.getTag(RageTag)).toBeTruthy; @@ -217,14 +214,11 @@ describe("Moves - Rage", () => { const leadPokemon = game.scene.getParty()[0]; - game.doAttack(getMovePosition(game.scene, 0, Moves.RAGE)); - await game.phaseInterceptor.to(SelectTargetPhase, false); - game.doSelectTarget(BattlerIndex.ENEMY); + game.move.select(Moves.RAGE,1,BattlerIndex.ENEMY); await game.phaseInterceptor.to(CommandPhase); - game.doAttack(getMovePosition(game.scene, 1, Moves.MEMENTO)); - await game.phaseInterceptor.to(SelectTargetPhase, false); - game.doSelectTarget(BattlerIndex.ENEMY_2); + game.move.select(Moves.MEMENTO,1,BattlerIndex.ENEMY_2); + await game.phaseInterceptor.to(TurnEndPhase, false); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(2); @@ -251,14 +245,10 @@ describe("Moves - Rage", () => { leadPokemon.natureOverride = Nature.SASSY; game.scene.getParty()[1].natureOverride = Nature.JOLLY; - game.doAttack(getMovePosition(game.scene, 0, Moves.RAGE)); - await game.phaseInterceptor.to(SelectTargetPhase, false); - game.doSelectTarget(BattlerIndex.ENEMY); + game.move.select(Moves.RAGE,1,BattlerIndex.ENEMY); await game.phaseInterceptor.to(CommandPhase); - game.doAttack(getMovePosition(game.scene, 1, Moves.SPORE)); - await game.phaseInterceptor.to(SelectTargetPhase, false); - game.doSelectTarget(BattlerIndex.PLAYER); + game.move.select(Moves.SPORE,1,BattlerIndex.PLAYER); await game.phaseInterceptor.to(TurnEndPhase, false); expect(leadPokemon.summonData.battleStats[BattleStat.ATK]).toBe(0);