Skip to content

Commit

Permalink
Added documentation to RageTag, fixed open quote, and updates test
Browse files Browse the repository at this point in the history
  • Loading branch information
ElizaAlex committed Aug 22, 2024
1 parent cae113c commit fdca435
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 31 deletions.
19 changes: 19 additions & 0 deletions src/data/battler-tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,36 @@ 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 */
pokemon.scene.queueMessage(i18next.t("battlerTags:rageOnAdd", {
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;
Expand Down
2 changes: 1 addition & 1 deletion src/locales/de/battler-tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
50 changes: 20 additions & 30 deletions src/test/moves/rage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit fdca435

Please sign in to comment.