Candy Jar in Indigo Plateau, plus improvements!

The Candy Jar is now obtainable in the Indigo Plateau, instead of being an item obtained from Chief. I've removed most Chief-related stuff but expect some instability after you beat him, as I don't believe I completely removed the function to call the text.

The Candy Jar will now not collect candies in the following instances;
- It isn't in the bag.
- The total would go over 40.
Just makes sense and ensures players are engaging with the proper intentions. The 40 total is necessary, as over 40 stops the jar from working. This does mean some candies are "lost", but the players see that.

There's a bug where Meltan will have the moves of the Pokemon it's replacing and I don't know why. I've tried a bunch of fixes in `LoadEnemyMonData` but it didn't seem to want to work.
This commit is contained in:
Llinos Evans 2023-06-01 18:40:32 +01:00
parent ed5e6b4867
commit 01737d7b77
8 changed files with 130 additions and 90 deletions

View file

@ -197,8 +197,7 @@ Known Bugs
- The Tradeback Tutor doesn't work properly with Rhydon for reasons likely related to its index number of 1.
- The Vermilion Passes are very unstable (Faraway warps are weird unless you battle, Citrine outright crashes).
- The Brunswick Trail Bird event is unfinished, Zapdos causes it to crash.
- Candy Jar is uncapped, needs to be capped at 40. Capping at 40 avoids potential overflows and the Jar not being able to evolve Meltan.
- Candy Jar does not get checked if it's in the bag when KOing Meltan, so it'll always increment. Keep for QoL?
- Meltan spawned via the Mystery Box will use the moves of the Pokemon they are replacing.
Evolution Methods for new Pokemon
====

View file

@ -12,9 +12,10 @@ IndigoPlateauLobby_Object:
object_event 7, 5, SPRITE_NURSE, STAY, DOWN, 1 ; person
object_event 4, 9, SPRITE_GYM_GUIDE, STAY, RIGHT, 2 ; person
object_event 5, 1, SPRITE_COOLTRAINER_F, STAY, DOWN, 3 ; person
object_event 0, 5, SPRITE_CLERK, STAY, RIGHT, 4 ; person
object_event 13, 6, SPRITE_LINK_RECEPTIONIST, STAY, DOWN, 5 ; person
object_event 10, 7, SPRITE_GAMEBOY_KID, STAY, DOWN, 6 ; Exeggutor Trader
object_event 8, 5, SPRITE_CHANSEY, STAY, DOWN, 7 ; Chansey
object_event 1, 10, SPRITE_YOUNGSTER, STAY, UP, 4 ; person
object_event 0, 5, SPRITE_CLERK, STAY, RIGHT, 5 ; person
object_event 13, 6, SPRITE_LINK_RECEPTIONIST, STAY, DOWN, 6 ; person
object_event 10, 7, SPRITE_GAMEBOY_KID, STAY, DOWN, 7 ; Exeggutor Trader
object_event 8, 5, SPRITE_CHANSEY, STAY, DOWN, 8 ; Chansey
def_warps_to INDIGO_PLATEAU_LOBBY

View file

@ -840,16 +840,23 @@ FaintEnemyPokemon:
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.
; Candy Jar functionality.
; This checks if the opponent is Meltan, the Jar isn't full, and it's in the bag.
; If so, it increments the amount of candies in the jar. Once full, it stops counting.
ld a, [wEnemyMonSpecies] ; Load species.
cp $E7 ; Is it Meltan?
jr nz, .skip ; Continue as normal if not.
ld b, CANDY_JAR ; Ok, we have a Meltan on our hands. Is the Jar in the bag?
call IsItemInBag ; Let's check.
jr z, .skip ; No? Skip all of this. No candies for you.
; Increment the Candy Jar count.
ld a, [wCandyJarCount]
inc a
ld [wCandyJarCount], a
ld a, [wCandyJarCount] ; Grab the jar.
cp 40 ; Do we have 40?
jr z, .skip ; If yes, no more candies.
inc a ; Increment candy count.
ld [wCandyJarCount], a ; Store candy count.
; For engine\overworld\clear_variables.asm
; Needed so the Mystery Box effect isn't cleared upon leaving battle.

View file

@ -1,15 +1,15 @@
Exception: STATUS_ACCESS_VIOLATION at rip=00100401246
rax=FFFFFFF7FFF8C381 rbx=000000000000006A rcx=0000000800000010
rdx=0000000000000000 rsi=0000000800063A0E rdi=0000000000000000
rax=FFFFFFF7FFF8BFA1 rbx=0000000000000D1B rcx=0000000800000010
rdx=0000000000000000 rsi=0000000800061DCE rdi=0000000000000000
r8 =00000000FFFFC7C4 r9 =0000000000000000 r10=0000000100000000
r11=0000000100401282 r12=0000000800073C80 r13=0000000100403148
r11=0000000100401282 r12=0000000800074060 r13=0000000100403148
r14=0000000000000000 r15=0000000000000001
rbp=0000000100403156 rsp=00000000FFFFCA60
program=C:\cygwin64\home\chipp\kep-hack\tools\scan_includes.exe, pid 1243, thread main
program=C:\cygwin64\home\chipp\kep-hack\tools\scan_includes.exe, pid 1116, thread main
cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame Function Args
00100403156 00100401246 (00800063A0E, 00000000022, 00100403166, 000FFFFCB90)
00100403156 00100401246 (00800061DCE, 00000000022, 00100403166, 000FFFFCB90)
00100403156 00100401409 (00000000000, 00100000001, 00180227860, 00100407000)
00100403178 00100401C87 (00000000020, 00000000000, 00180049B11, 00180048A70)
000FFFFCD30 00180049B7D (00000000000, 00000000000, 00000000000, 00000000000)

View file

@ -18,6 +18,7 @@ IndigoPlateauLobby_TextPointers:
dw IndigoHealNurseText
dw IndigoPlateauLobbyText2
dw IndigoPlateauLobbyText3
dw CandyJarGuy
dw IndigoCashierText
dw IndigoTradeNurseText
dw ExeggutorTrade
@ -51,3 +52,43 @@ IndigoPlateauLobbyText4:
text_asm
callfar PokecenterChanseyText
jp TextScriptEnd
CandyJarGuy:
text_asm
CheckEvent EVENT_GOT_CANDY_JAR
jr nz, .got_item
ld hl, CandyJarPreReceiveText
call PrintText
lb bc, CANDY_JAR, 1
call GiveItem
jr nc, .bag_full
ld hl, ReceivedCandyJarText
call PrintText
SetEvent EVENT_GOT_CANDY_JAR
jr .done
.bag_full
ld hl, CandyJarNoRoomText
call PrintText
jr .done
.got_item
ld hl, CandyJarExplanationText
call PrintText
.done
jp TextScriptEnd
CandyJarPreReceiveText:
text_far _CandyJarPreReceiveText
text_end
ReceivedCandyJarText:
text_far _ReceivedCandyJarText
sound_get_item_1
text_end
CandyJarExplanationText:
text_far _CandyJarExplanationText
text_end
CandyJarNoRoomText:
text_far _CandyJarNoRoomText
text_end

View file

@ -96,7 +96,7 @@ ChiefScript_That_Seems_Needed:
SilphGauntlet7F_TextPointers:
dw ChiefText1
dw ChiefText2
; dw ChiefText2
ChiefText1:
text_asm
@ -143,44 +143,44 @@ ChiefAfterBattleText:
text_far _ChiefAfterBattleText
text_end
ChiefText2:
text_asm
CheckEvent EVENT_GOT_CANDY_JAR
jr nz, .got_item
ld hl, CandyJarPreReceiveText
call PrintText
lb bc, CANDY_JAR, 1
call GiveItem
jr nc, .bag_full
ld hl, ReceivedCandyJarText
call PrintText
SetEvent EVENT_GOT_CANDY_JAR
jr .done
.bag_full
ld hl, CandyJarNoRoomText
call PrintText
jr .done
.got_item
ld hl, CandyJarExplanationText
call PrintText
.done
jp TextScriptEnd
;ChiefText2:
; text_asm
; CheckEvent EVENT_GOT_CANDY_JAR
; jr nz, .got_item
; ld hl, CandyJarPreReceiveText
; call PrintText
; lb bc, CANDY_JAR, 1
; call GiveItem
; jr nc, .bag_full
; ld hl, ReceivedCandyJarText
; call PrintText
; SetEvent EVENT_GOT_CANDY_JAR
; jr .done
;.bag_full
; ld hl, CandyJarNoRoomText
; call PrintText
; jr .done
;.got_item
; ld hl, CandyJarExplanationText
; call PrintText
;.done
; jp TextScriptEnd
CandyJarPreReceiveText:
text_far _CandyJarPreReceiveText
text_end
;CandyJarPreReceiveText:
; text_far _CandyJarPreReceiveText
; text_end
ReceivedCandyJarText:
text_far _ReceivedCandyJarText
sound_get_item_1
text_end
;ReceivedCandyJarText:
; text_far _ReceivedCandyJarText
; sound_get_item_1
; text_end
CandyJarExplanationText:
text_far _CandyJarExplanationText
text_end
;CandyJarExplanationText:
; text_far _CandyJarExplanationText
; text_end
CandyJarNoRoomText:
text_far _CandyJarNoRoomText
text_end
;CandyJarNoRoomText:
; text_far _CandyJarNoRoomText
; text_end
text_end
; text_end

View file

@ -23,3 +23,32 @@ _IndigoPlateauLobbyText3::
cont "next trainer!"
cont "Good luck!"
done
_CandyJarPreReceiveText::
text "I found this empty"
line "jar on the floor."
para "Mind taking it"
line "off my hands?"
prompt
_ReceivedCandyJarText::
text "<PLAYER> received"
line "@"
text_ram wStringBuffer
text "!@"
text_end
_CandyJarExplanationText::
text "Me and CRYITHAN"
line "are so ready for"
cont "the LEAGUE!"
para "Good luck to you!"
done
_CandyJarNoRoomText::
text "No room? Oh, what"
line "to do..."
done

View file

@ -73,40 +73,3 @@ _ChiefAfterBattleText::
done
_CandyJarPreReceiveText::
text "I want you to"
line "have this."
done
_ReceivedCandyJarText::
text "<PLAYER> received"
line "@"
text_ram wStringBuffer
text "!@"
text_end
_CandyJarExplanationText::
text "When researching"
line "MEW, GIOVANNI"
cont "discovered one"
cont "more mythical"
cont "#MON."
para "Its name is"
line "MELTAN. It loves"
cont "a certain kind"
cont "of CANDY."
para "Give it this"
line "JAR. It will"
cont "become extremely"
cont "powerful."
done
_CandyJarNoRoomText::
text "Ah, your BAG"
line "is full. I'll"
cont "hold onto this"
cont "for you, then."
done