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
This commit is contained in:
Kirk Scheibelhut 2020-05-30 21:13:41 -07:00
parent 54026a5cf7
commit ede3aaec2b

View File

@ -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';