Skip to content

Commit

Permalink
Include 1/4 HP restoring berries in EBC with Leppa
Browse files Browse the repository at this point in the history
Thanks pigeons and thimo for coming up with edge cases!

https://replay.pokemonshowdown.com/gen8balancedhackmons-1124152144
  • Loading branch information
scheibo committed May 31, 2020
1 parent 54026a5 commit ede3aae
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sim/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit ede3aae

Please sign in to comment.