Compare commits

...

24 Commits

Author SHA1 Message Date
Dobin Shin
0eaaa9e47e
Merge e669b828f2 into 4b70fab608 2025-06-20 10:03:53 -04:00
NightKev
4b70fab608
[Bug] Remove message for Rock Head activation (#6014) 2025-06-19 20:59:55 -07:00
dobin
e669b828f2 Update BattlerIndex import path 2025-06-13 17:07:23 +09:00
Dobin Shin
9e204bea5a
Merge branch 'beta' into fix-rattled-speed-stat-increase-delay 2025-06-13 17:06:15 +09:00
Dobin Shin
eeca119499
Merge branch 'beta' into fix-rattled-speed-stat-increase-delay 2025-06-09 20:26:24 +09:00
Dobin Shin
f68899c187
Delete cancelled.value = this.overwrites 2025-06-07 20:56:40 +09:00
Dobin Shin
d28aeef0e2
Merge pull request #1 from Bertie690/fix-rattled-speed-stat-increase-delay
PR Review for #5936
2025-06-07 20:54:08 +09:00
Dobin Shin
7925ff39da
Merge branch 'fix-rattled-speed-stat-increase-delay' into fix-rattled-speed-stat-increase-delay 2025-06-07 20:53:57 +09:00
NightKev
dcab1c46eb
Merge branch 'beta' into fix-rattled-speed-stat-increase-delay 2025-06-06 19:42:58 -07:00
NightKev
eb9c2a9024
Merge branch 'beta' into fix-rattled-speed-stat-increase-delay 2025-06-06 16:28:13 -07:00
NightKev
215741466a
Merge branch 'beta' into fix-rattled-speed-stat-increase-delay 2025-06-06 15:01:32 -07:00
NightKev
74ff6938e3
Fix style issues 2025-06-06 14:47:44 -07:00
Bertie690
f49e4d647e Added test for status moves 2025-06-06 13:52:02 -04:00
Bertie690
3a85c7830e Made Guard Dog use proper attribute; added test for on get hit effects 2025-06-06 13:51:55 -04:00
dobin
6bf78cd732 [TEST]: Ensure Rattled triggers from Intimidate before player switches out 2025-06-06 23:55:46 +09:00
dobin
92e45fba81 Early return when simulated is true 2025-06-06 14:58:26 +09:00
Dobin Shin
377f596778
Apply lint
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
2025-06-06 03:06:51 +09:00
Dobin Shin
3e1adaa015
Add battleStyle override
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
2025-06-06 03:06:00 +09:00
Dobin Shin
04d7606122
Update test utils
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
2025-06-06 03:04:30 +09:00
Dobin Shin
41b05f0ce3
Add comment justifying usage of runToSummon
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
2025-06-06 03:03:09 +09:00
Dobin Shin
fa22a7f3eb
Update test title
Co-authored-by: Bertie690 <136088738+Bertie690@users.noreply.github.com>
2025-06-06 03:01:55 +09:00
dobin
400733442e [TEST] Rattled should be activated after Intimidate 2025-06-06 00:53:57 +09:00
dobin
a201d2e6a1 [Bug] Fix rattled speed stat delay on SwitchSummonPhase 2025-06-05 19:16:44 +09:00
dobin
e8bc2fb736 [Bug] Fix rattled speed stat increase delay 2025-06-05 18:40:02 +09:00
2 changed files with 130 additions and 14 deletions

View File

@ -306,13 +306,6 @@ export class BlockRecoilDamageAttr extends AbAttr {
): void {
cancelled.value = true;
}
getTriggerMessage(pokemon: Pokemon, abilityName: string, ..._args: any[]) {
return i18next.t("abilityTriggers:blockRecoilDamage", {
pokemonName: getPokemonNameWithAffix(pokemon),
abilityName: abilityName,
});
}
}
/**
@ -3283,13 +3276,11 @@ export class IntimidateImmunityAbAttr extends AbAttr {
export class PostIntimidateStatStageChangeAbAttr extends AbAttr {
private stats: BattleStat[];
private stages: number;
private overwrites: boolean;
constructor(stats: BattleStat[], stages: number, overwrites?: boolean) {
constructor(stats: BattleStat[], stages: number) {
super(true);
this.stats = stats;
this.stages = stages;
this.overwrites = !!overwrites;
}
override apply(
@ -3300,7 +3291,7 @@ export class PostIntimidateStatStageChangeAbAttr extends AbAttr {
_args: any[],
): void {
if (!simulated) {
globalScene.phaseManager.pushNew(
globalScene.phaseManager.unshiftNew(
"StatStageChangePhase",
pokemon.getBattlerIndex(),
false,
@ -3308,7 +3299,6 @@ export class PostIntimidateStatStageChangeAbAttr extends AbAttr {
this.stages,
);
}
cancelled.value = this.overwrites;
}
}
@ -3519,7 +3509,6 @@ export class PostSummonStatStageChangeAbAttr extends PostSummonAbAttr {
const cancelled = new BooleanHolder(false);
if (this.intimidate) {
applyAbAttrs("IntimidateImmunityAbAttr", opponent, cancelled, simulated);
applyAbAttrs("PostIntimidateStatStageChangeAbAttr", opponent, cancelled, simulated);
if (opponent.getTag(BattlerTagType.SUBSTITUTE)) {
cancelled.value = true;
@ -3534,6 +3523,7 @@ export class PostSummonStatStageChangeAbAttr extends PostSummonAbAttr {
this.stages,
);
}
applyAbAttrs("PostIntimidateStatStageChangeAbAttr", opponent, cancelled, simulated);
}
}
}
@ -8893,7 +8883,8 @@ export function initAbilities() {
.attr(PostSummonStatStageChangeOnArenaAbAttr, ArenaTagType.TAILWIND)
.ignorable(),
new Ability(AbilityId.GUARD_DOG, 9)
.attr(PostIntimidateStatStageChangeAbAttr, [ Stat.ATK ], 1, true)
.attr(PostIntimidateStatStageChangeAbAttr, [ Stat.ATK ], 1)
.attr(IntimidateImmunityAbAttr)
.attr(ForceSwitchOutImmunityAbAttr)
.ignorable(),
new Ability(AbilityId.ROCKY_PAYLOAD, 9)

View File

@ -0,0 +1,125 @@
import { MoveId } from "#enums/move-id";
import { AbilityId } from "#enums/ability-id";
import { SpeciesId } from "#enums/species-id";
import GameManager from "#test/testUtils/gameManager";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import { BattleType } from "#enums/battle-type";
import { getStatKey, getStatStageChangeDescriptionKey, Stat } from "#enums/stat";
import { BattlerIndex } from "#enums/battler-index";
import i18next from "i18next";
import { getPokemonNameWithAffix } from "#app/messages";
describe("Abilities - Rattled", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override
.ability(AbilityId.RATTLED)
.battleType(BattleType.TRAINER)
.disableCrits()
.battleStyle("single")
.enemySpecies(SpeciesId.DUSKULL)
.enemyAbility(AbilityId.INTIMIDATE)
.enemyPassiveAbility(AbilityId.NO_GUARD);
});
it.each<{ type: string; move: MoveId }>([
{ type: "Bug", move: MoveId.TWINEEDLE },
{ type: "Ghost", move: MoveId.ASTONISH },
{ type: "Dark", move: MoveId.BEAT_UP },
])("should raise the user's Speed by 1 stage for each hit of a $type-type move", async ({ move }) => {
game.override.enemyAbility(AbilityId.BALL_FETCH);
await game.classicMode.startBattle([SpeciesId.GIMMIGHOUL]);
game.move.use(MoveId.SPLASH);
await game.move.forceEnemyMove(move);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
game.phaseInterceptor.clearLogs();
await game.phaseInterceptor.to("MoveEffectPhase");
const enemyHits = game.field.getEnemyPokemon().turnData.hitCount;
await game.phaseInterceptor.to("MoveEndPhase");
// Rattled should've raised speed once per hit, displaying a separate message each time
const gimmighoul = game.field.getPlayerPokemon();
expect(gimmighoul.getStatStage(Stat.SPD)).toBe(enemyHits);
expect(game.phaseInterceptor.log.filter(p => p === "ShowAbilityPhase")).toHaveLength(enemyHits);
expect(game.phaseInterceptor.log.filter(p => p === "StatStageChangePhase")).toHaveLength(enemyHits);
const statChangeText = i18next.t(getStatStageChangeDescriptionKey(1, true), {
pokemonNameWithAffix: getPokemonNameWithAffix(gimmighoul),
stats: i18next.t(getStatKey(Stat.SPD)),
count: 1,
});
expect(game.textInterceptor.logs.filter(t => t === statChangeText)).toHaveLength(enemyHits);
});
it.each<{ type: string; move: MoveId }>([
{ type: "Bug", move: MoveId.POWDER },
{ type: "Ghost", move: MoveId.CONFUSE_RAY },
{ type: "Dark", move: MoveId.TAUNT },
])("should not trigger from $type-type status moves", async ({ move }) => {
game.override.enemyAbility(AbilityId.BALL_FETCH);
await game.classicMode.startBattle([SpeciesId.GIMMIGHOUL]);
game.move.use(MoveId.SPLASH);
await game.move.forceEnemyMove(move);
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
await game.phaseInterceptor.to("MoveEndPhase");
const gimmighoul = game.field.getPlayerPokemon();
expect(gimmighoul.getStatStage(Stat.SPD)).toBe(0);
expect(game.phaseInterceptor.log).not.toContain("ShowAbilityPhase");
expect(game.phaseInterceptor.log).not.toContain("StatStageChangePhase");
});
it("should activate after Intimidate attack drop on initial send out", async () => {
// `runToSummon` used instead of `startBattle` to avoid skipping past initial "post send out" effects
await game.classicMode.runToSummon([SpeciesId.GIMMIGHOUL]);
// Intimidate
await game.phaseInterceptor.to("StatStageChangePhase");
const playerPokemon = game.field.getPlayerPokemon();
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(-1);
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(0);
game.phaseInterceptor.clearLogs();
// Rattled
await game.phaseInterceptor.to("StatStageChangePhase");
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(-1);
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
// Nothing but show/hide ability phases should be visible
for (const log of game.phaseInterceptor.log) {
expect(log).toBeOneOf(["ShowAbilityPhase", "HideAbilityPhase", "StatStageChangePhase", "MessagePhase"]);
}
});
it("should activate after Intimidate from enemy switch", async () => {
await game.classicMode.startBattle([SpeciesId.GIMMIGHOUL, SpeciesId.BULBASAUR]);
game.move.use(MoveId.SPLASH);
game.forceEnemyToSwitch();
await game.phaseInterceptor.to("StatStageChangePhase");
const playerPokemon = game.field.getPlayerPokemon();
expect(playerPokemon.getStatStage(Stat.ATK)).toBe(-2);
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(1);
await game.phaseInterceptor.to("StatStageChangePhase");
expect(playerPokemon.getStatStage(Stat.SPD)).toBe(2);
});
});