Fix Salac berry raising the wrong stat

This commit is contained in:
Flashfyre 2023-07-04 16:35:40 -04:00
parent 9212d3642a
commit e1b64e0623

View File

@ -12,9 +12,9 @@ export enum BerryType {
ENIGMA, ENIGMA,
LIECHI, LIECHI,
GANLON, GANLON,
SALAC,
PETAYA, PETAYA,
APICOT, APICOT,
SALAC,
LANSAT, LANSAT,
STARF STARF
} }
@ -33,9 +33,9 @@ export function getBerryEffectDescription(berryType: BerryType) {
return 'Restores 25% HP if hit by a super effective move'; return 'Restores 25% HP if hit by a super effective move';
case BerryType.LIECHI: case BerryType.LIECHI:
case BerryType.GANLON: case BerryType.GANLON:
case BerryType.SALAC:
case BerryType.PETAYA: case BerryType.PETAYA:
case BerryType.APICOT: case BerryType.APICOT:
case BerryType.SALAC:
const stat = (berryType - BerryType.LIECHI) as BattleStat; const stat = (berryType - BerryType.LIECHI) as BattleStat;
return `Raises ${getBattleStatName(stat)} if HP is below 25%`; return `Raises ${getBattleStatName(stat)} if HP is below 25%`;
case BerryType.LANSAT: case BerryType.LANSAT:
@ -57,9 +57,9 @@ export function getBerryPredicate(berryType: BerryType): BerryPredicate {
return (pokemon: Pokemon) => !!pokemon.turnData.attacksReceived.filter(a => a.result === HitResult.SUPER_EFFECTIVE).length; return (pokemon: Pokemon) => !!pokemon.turnData.attacksReceived.filter(a => a.result === HitResult.SUPER_EFFECTIVE).length;
case BerryType.LIECHI: case BerryType.LIECHI:
case BerryType.GANLON: case BerryType.GANLON:
case BerryType.SALAC:
case BerryType.PETAYA: case BerryType.PETAYA:
case BerryType.APICOT: case BerryType.APICOT:
case BerryType.SALAC:
return (pokemon: Pokemon) => { return (pokemon: Pokemon) => {
const battleStat = (berryType - BerryType.LIECHI) as BattleStat; const battleStat = (berryType - BerryType.LIECHI) as BattleStat;
return pokemon.getHpRatio() < 0.25 && pokemon.summonData.battleStats[battleStat] < 6; return pokemon.getHpRatio() < 0.25 && pokemon.summonData.battleStats[battleStat] < 6;
@ -92,9 +92,9 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc {
}; };
case BerryType.LIECHI: case BerryType.LIECHI:
case BerryType.GANLON: case BerryType.GANLON:
case BerryType.SALAC:
case BerryType.PETAYA: case BerryType.PETAYA:
case BerryType.APICOT: case BerryType.APICOT:
case BerryType.SALAC:
return (pokemon: Pokemon) => { return (pokemon: Pokemon) => {
const battleStat = (berryType - BerryType.LIECHI) as BattleStat; const battleStat = (berryType - BerryType.LIECHI) as BattleStat;
pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ battleStat ], 1)); pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), true, [ battleStat ], 1));