diff --git a/src/data/ability.ts b/src/data/ability.ts index 0f87e7167d1..459bd4bcbf7 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -2273,16 +2273,17 @@ export class PostTurnLootAbAttr extends PostTurnAbAttr { } const randomIdx = Utils.randSeedInt(berriesEaten.length); - const chosenBerry = new BerryModifierType(berriesEaten[randomIdx]); + const chosenBerryType = berriesEaten[randomIdx] + const chosenBerry = new BerryModifierType(chosenBerryType); berriesEaten.splice(randomIdx) // Remove berry from memory const berryModifier = pokemon.scene.findModifier( - (m) => m instanceof BerryModifier && m.berryType === berriesEaten[randomIdx], + (m) => m instanceof BerryModifier && m.berryType === chosenBerryType, pokemon.isPlayer() ) as BerryModifier | undefined; if (!berryModifier) { - pokemon.scene.addModifier(new BerryModifier(chosenBerry, pokemon.id, berriesEaten[randomIdx], 1)); + pokemon.scene.addModifier(new BerryModifier(chosenBerry, pokemon.id, chosenBerryType, 1)); } else { berryModifier.stackCount++; } diff --git a/src/phases.ts b/src/phases.ts index d1dacee6f24..bec02390c72 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -2076,7 +2076,6 @@ export class TurnStartPhase extends FieldPhase { } } - this.scene.pushPhase(new BerryPhase(this.scene)); if (this.scene.arena.weather) this.scene.pushPhase(new WeatherEffectPhase(this.scene, this.scene.arena.weather)); @@ -2086,6 +2085,7 @@ export class TurnStartPhase extends FieldPhase { this.scene.pushPhase(new PostTurnStatusEffectPhase(this.scene, o)); } + this.scene.pushPhase(new BerryPhase(this.scene)); this.scene.pushPhase(new TurnEndPhase(this.scene)); this.end(); @@ -2098,7 +2098,9 @@ export class BerryPhase extends FieldPhase { super.start(); this.executeForAll((pokemon) => { - const hasUsableBerry = !!this.scene.findModifier((m) => m instanceof BerryModifier && m.shouldApply([pokemon]), pokemon.isPlayer()); + const hasUsableBerry = !!this.scene.findModifier((m) => { + return m instanceof BerryModifier && m.shouldApply([pokemon]); + }, pokemon.isPlayer()); if (hasUsableBerry) { const cancelled = new Utils.BooleanHolder(false);