From acd02f8efda14101dbcfd7a4edea68f5b216c242 Mon Sep 17 00:00:00 2001 From: singiamtel <47090312+singiamtel@users.noreply.github.com> Date: Wed, 3 Jan 2024 06:49:13 +0100 Subject: [PATCH] Fix Prankster info leak (#10065) * Fix prankster hint so it doesn't leak info * Fix condition * Add unit test to verify there's no hint --- sim/battle-actions.ts | 4 +++- test/sim/abilities/prankster.js | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sim/battle-actions.ts b/sim/battle-actions.ts index 2cc7e67b2b..d6b078a76d 100644 --- a/sim/battle-actions.ts +++ b/sim/battle-actions.ts @@ -662,7 +662,9 @@ export class BattleActions { } else if (this.battle.gen >= 7 && move.pranksterBoosted && pokemon.hasAbility('prankster') && !targets[i].isAlly(pokemon) && !this.dex.getImmunity('prankster', target)) { this.battle.debug('natural prankster immunity'); - if (!target.illusion) this.battle.hint("Since gen 7, Dark is immune to Prankster moves."); + if (target.illusion || !(move.status && !this.dex.getImmunity(move.status, target))) { + this.battle.hint("Since gen 7, Dark is immune to Prankster moves."); + } this.battle.add('-immune', target); hitResults[i] = false; } else { diff --git a/test/sim/abilities/prankster.js b/test/sim/abilities/prankster.js index 26092487b6..3a4113be2f 100644 --- a/test/sim/abilities/prankster.js +++ b/test/sim/abilities/prankster.js @@ -72,6 +72,15 @@ describe('Prankster', function () { assert(battle.p2.active[0].volatiles['encore'], `Meowstic should be encored`); assert.fullHP(battle.p1.active[0]); }); + + it('should not leak the ability via hint if the target is immune to the Status move', function () { + battle = common.createBattle([ + [{species: "Sableye", ability: 'prankster', moves: ['willowisp']}], + [{species: "Houndoom", ability: 'pressure', moves: ['willowisp']}], + ]); + battle.makeChoices('move willowisp', 'move willowisp'); + assert.false(battle.log.some(line => line.includes('hint')), `Prankster should not leak the ability via hint`); + }); }); describe('Prankster [Gen 6]', function () {