pret / pokecrystal

Disassembly of Pokémon Crystal
https://pret.github.io/pokecrystal/
2.11k stars 807 forks source link

[BUG] Receiving a gift mon without space in the party causes the mon to be generated without DVs #1044

Open Monstarules opened 1 year ago

Monstarules commented 1 year ago

We discovered this while working on the Modern Ancient Engine implementing the pokecrystal16 engine, and was replicated in Pokémon Orange and vanilla Pokémon Crystal.

In Pokémon Crystal, you cannot receive a gift Pokémon, or purchase a Pokémon from the Game Corner without having space in your party. The reason behind this is that there is no routine to generate DVs when the player receives a gift Pokémon that is sent immediately to the box. In later generations, this was fixed.

Rangi42 commented 1 year ago

To do: test what happens when a givepoke gift mon goes to the current PC box with a full party; and what happens when both the party and current PC box are full.

A valid fix may just be "always check VAR_PARTYCOUNT for PARTY_LENGTH before doing givepoke", if handling the Gen 2 PC would otherwise be too complicated.

aaaaaa123456789 commented 1 year ago

As far as I can tell, generating a Pokémon straight into the PC would give it zero DVs, since GivePoke calls LoadEnemyMon in that case out of battle, which I assume will have a value of zero in wBattleMode. I haven't tested this, though. I'm not sure if it can accidentally attempt to load a trainer mon instead, though.

Idain commented 1 year ago

A valid fix may just be "always check VAR_PARTYCOUNT for PARTY_LENGTH before doing givepoke", if handling the Gen 2 PC would otherwise be too complicated.

Which is funny, since that's what the vanilla game usually does.

vulcandth commented 1 year ago

Just now read this; yeah, I think i've encountered this before myself.