shithub: pokecrystal

Download patch

ref: f369003a6ede2e9934766830d56c7ac22026ed25
parent: 80cf859cd31c3882f8c42dd19e56fcde02b8955c
author: Colton G. Rushton <colton51919@gmail.com>
date: Tue Jan 21 15:19:27 EST 2020

Add Dude full box glitch fix

Added a minor fix for the Dude full box glitch that was proposed by ISSOtm.

--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -68,6 +68,7 @@
 - [Swimming NPCs aren't limited by their movement radius](#swimming-npcs-arent-limited-by-their-movement-radius)
 - [`CheckOwnMon` only checks the first five letters of OT names](#checkownmon-only-checks-the-first-five-letters-of-ot-names)
 - [Catching a Transformed Pokémon always catches a Ditto](#catching-a-transformed-pokémon-always-catches-a-ditto)
+- [If your party and current PC box are full during the Dude's catching tutorial, his Poké Ball can't be used and may crash the game](#if-your-party-and-current-pc-box-are-full-during-the-dudes-catching-tutorial-his-poké-ball-cant-be-used-and-may-crash-the-game)
 - [Using a Park Ball in normal battles has a corrupt animation](#using-a-park-ball-in-normal-battles-has-a-corrupt-animation)
 - [`HELD_CATCH_CHANCE` has no effect](#held_catch_chance-has-no-effect)
 - [Only the first three evolution entries can have Stone compatibility reported correctly](#only-the-first-three-evolution-entries-can-have-stone-compatibility-reported-correctly)
@@ -1878,6 +1879,33 @@
 
  	pop af
  	ld [wEnemySubStatus5], a
+```
+
+
+## If your party and current PC box are full during the Dude's catching tutorial, his Poké Ball can't be used and may crash the game
+([Video](https://www.youtube.com/watch?v=A8zaTOkjKS4&t=407))
+
+**Fix:** Edit `PokeBallEffect` in [engine/items/item_effects.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/item_effects.asm):
+
+```diff
+     ld a, [wBattleMode]
+     dec a
+     jp nz, UseBallInTrainerBattle
+ 
++    ld a, [wBattleType]
++    cp BATTLETYPE_TUTORIAL
++    jr z, .room_in_party
++
+     ld a, [wPartyCount]
+     cp PARTY_LENGTH
+     jr nz, .room_in_party
+ 
+     ld a, BANK(sBoxCount)
+     call GetSRAMBank
+     ld a, [sBoxCount]
+     cp MONS_PER_BOX
+     call CloseSRAM
+     jp z, Ball_BoxIsFullMessage
 ```