If the Pokémon has used a Berry, there is a 50% chance of it being restored at the end of each turn. The held Berry is remembered even if it is not restored or if the Pokémon has switched out. Harvest will always activate in harsh sunlight.
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.
Relevant Code Points
Function 0x022562E8 contains all of the checks for end-of-turn abilities (e.g., Speed Boost). We need two things:
Add a check to this function to account for Harvest.
Add a variable somewhere in the server struct to track the berry which was most recently consumed. (needs to be associated with the party pokemon in some way)
Documentation
https://bulbapedia.bulbagarden.net/wiki/Harvest_(Ability)
Relevant Code Points
Function
0x022562E8
contains all of the checks for end-of-turn abilities (e.g., Speed Boost). We need two things:See Also
Pickup