From ede3aaec2b1ecdeddf242b09d3a36c03a0591b98 Mon Sep 17 00:00:00 2001 From: Kirk Scheibelhut Date: Sat, 30 May 2020 21:13:41 -0700 Subject: [PATCH] Include 1/4 HP restoring berries in EBC with Leppa Thanks pigeons and thimo for coming up with edge cases! https://replay.pokemonshowdown.com/gen8balancedhackmons-1124152144 --- sim/pokemon.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sim/pokemon.ts b/sim/pokemon.ts index 20e075a257..dc64e77c29 100644 --- a/sim/pokemon.ts +++ b/sim/pokemon.ts @@ -26,6 +26,12 @@ export interface EffectState { [k: string]: any; } +// Berries which restore PP/HP and thus inflict external staleness when given to an opponent as +// there are very few non-malicious competitive reasons to do so +const RESTORATIVE_BERRIES = new Set([ + 'leppaberry', 'aguavberry', 'enigmaberry', 'figyberry', 'iapapaberry', 'magoberry', 'sitrusberry', 'wikiberry', 'oranberry', +] as ID[]); + export class Pokemon { readonly side: Side; readonly battle: Battle; @@ -1506,7 +1512,7 @@ export class Pokemon { this.battle.singleEvent('Eat', item, this.itemData, this, source, sourceEffect); this.battle.runEvent('EatItem', this, null, null, item); - if (item.id === 'leppaberry') { + if (RESTORATIVE_BERRIES.has(item.id)) { switch (this.pendingStaleness) { case 'internal': if (this.staleness !== 'external') this.staleness = 'internal'; @@ -1588,7 +1594,7 @@ export class Pokemon { if (typeof item === 'string') item = this.battle.dex.getItem(item); const effectid = this.battle.effect ? this.battle.effect.id : ''; - if (item.id === 'leppaberry') { + if (RESTORATIVE_BERRIES.has('leppaberry' as ID)) { const inflicted = ['trick', 'switcheroo'].includes(effectid); const external = inflicted && source && source.side.id !== this.side.id; this.pendingStaleness = external ? 'external' : 'internal';