Groundwork for the Candy Jar rework

This does everything except the incrementation.

If you defeat a Meltan, `wCandyJarCount` increments by 1, capping at 40. This is represented in-game as 10, going up to 400, simply by adding a 0 at the end. This, in effect, replicates the Meltan quest from Pokemon Go.

Once 40/400 is reached, the Candy Jar will become an evolution stone, evolving Meltan. Instead of consuming the Jar, the Candies inside are zeroed out.

Currently, the Candy Jar increments, but only once, thus why this is being committed on a separate branch. The bug appears to be at `engine\battle\core.asm`, line 842-861, likely 854-856. It's possible that it could be due to its position in WRAM, or that it's a `db` instead of a `dw`.
This commit is contained in:
Llinos Evans 2023-05-31 13:37:55 +01:00
parent 934f8adcac
commit 228de2b718
7 changed files with 93 additions and 16 deletions

View file

@ -839,6 +839,26 @@ FaintEnemyPokemon:
call PrintText
call PrintEmptyString
call SaveScreenTilesToBuffer1
; Meltan Candy functionality.
; The way this is done looks like it conflates 8- and 16-bit integers, but it never goes above 256, so it'll be fine.
ld a, [wEnemyMonSpecies] ; Load species.
cp $E7 ; Is it Meltan?
jr nz, .skip ; Continue as normal if not.
; For engine\overworld\clear_variables.asm
; Needed so the Mystery Box effect isn't cleared upon leaving battle.
ld a, $01
ld [wDontSwitchOffMysteryBoxYet], a
ld a, [wCandyJarCount]
inc a
ld [wCandyJarCount], a
ld hl, MeltanIncrement ; Load text to show it's going up.
call PrintText ; Yep text.
call PrintEmptyString ; vs text likes this.
.skip
xor a
ld [wBattleResult], a
ld a, [wCurMap]
@ -7173,3 +7193,8 @@ StupidBattleTentFix:
text "Oops! Better"
line "luck next time!"
prompt
MeltanIncrement:
text "<PLAYER> found"
line "10 MELTAN CANDY!"
prompt