Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds in-battle effect of Pickup, adds Harvest and Pickup tests #5170

Merged
merged 7 commits into from
Aug 16, 2024

Conversation

PhallenTree
Copy link

@PhallenTree PhallenTree commented Aug 14, 2024

  • Adds the following missing effects of Pickup:

Generation V-VIII
At the end of the turn in which another Pokémon used a one-time-use item (including throwing an item with Fling or using Natural Gift), a Pokémon with Pickup will collect the item if they are not holding anything. If more than one Pokémon has Pickup or Harvest, the faster Pokémon will restore an item first. If multiple items can be collected, the Pokémon will collect the item most recently consumed.

A single Pokémon's Pickup will not activate more than once per turn.

Pickup cannot collect an item if the Pokémon that consumed the item is no longer on the field at the end of the turn, or if the item has already been recovered (such as with Recycle, another Pokémon's Pickup, or Harvest). Pickup cannot collect an item that a Pokémon consumed before switching out, even if it switched back in again before the end of the turn. Pickup cannot collect items that have been destroyed with Incinerate, eaten with Bug Bite or Pluck, or knocked off with Knock Off. A popped Air Balloon cannot be collected.

A Pokémon may only have one consumed item at a time; if a Pokémon consumes an item, then obtains another item and consumes it, the original consumed item cannot be collected, even if the second item is collected or restored then swapped away. If the Pokémon obtains another item after consuming an item, Pickup can still collect the old item as long as the Pokémon does not consume the new one.

Generation IX
A Pokémon with Pickup recovers its consumed held item at the end of the turn in a battle against a wild Pokémon.

  • Adds Harvest and Pickup tests. Modified G-Max Replenish test due to Munchlax picking up an item before G-Max Replenish is used.

  • Fixes RandomUniformExcept not being inclusive on the higher boundary.

Issue(s) that this PR fixes

Fixes #3355

Discord contact info

PhallenTree

include/battle.h Outdated Show resolved Hide resolved
src/battle_util.c Outdated Show resolved Hide resolved
Copy link
Collaborator

@AlexOn1ine AlexOn1ine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, a couple minor test things.

test/battle/ability/pickup.c Show resolved Hide resolved
test/battle/ability/harvest.c Show resolved Hide resolved
test/battle/ability/harvest.c Show resolved Hide resolved
Copy link
Collaborator

@AlexOn1ine AlexOn1ine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thx!

One minor thing. Usually new features go to upcoming and master is for bugfixes but that's fine. Just a heads up for the future.

@AlexOn1ine AlexOn1ine merged commit ec3a86d into rh-hideout:master Aug 16, 2024
1 check passed
@hedara90 hedara90 added the category: ability Pertains to abilities label Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: ability Pertains to abilities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ABILITY_PICKUP doesn't have its in-battle effect
4 participants