Harvest (05pyzfte)
0 ratingsMay create another Berry after one is used.
50% chance of creating another berry at the end of each turn. If the weather is harsh sunlight the berry is always created. It also increases the chance of encountering Grass-type Pokémon in the wild when lead in the party.
Harvest can recover Berries consumed by Fling and Natural Gift; however, Harvest cannot recover Berries transferred to another Pokémon, Berries destroyed by Incinerate, Berries knocked off with Knock Off, or Berries eaten with Bug Bite or Pluck. Harvest cannot restore a Berry if it is collected by a Pokémon with Pickup. If more than one Pokémon has Pickup or Harvest, the faster Pokémon will restore an item first.
Couldn't get this working quite right.
old code:
onTurnEnd: (game, mon) => {
if(mon.battle.previousTurnFlags.consumedHeldItem?.item?.category !== CATEGORIES.ITEMS.BERRIES.uid) {
return;
}
mon.abilityPopup();
mon.battle.heldItem = mon.item = mon.battle.previousTurnFlags.consumedHeldItem.item;
game.textbox.say(mon.getName() + "'s harvested a new " + mon.item.name + ".", () => game.endTurn());
}