mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-22 07:02:17 +13:00
Mystery Box bugfixes and improvements
- Meltan is now loaded in engine/battle/wild_encounters.asm, allowing its level to be fixed at 5 and avoiding various glitches. This also fixed the "running from Meltan ends the Mystery Box game" bug. - Candy Jar now gives a message when it's full, more transparent to the player. - Fixed a bug where the increment text wouldn't load properly, it was very silly.
This commit is contained in:
parent
3866a69a25
commit
0aab4fb5e8
3 changed files with 52 additions and 34 deletions
|
|
@ -20,7 +20,7 @@ TryDoWildEncounter:
|
|||
and a
|
||||
jr z, .next
|
||||
dec a
|
||||
jr z, .lastRepelStep
|
||||
jp z, .lastRepelStep
|
||||
ld [wRepelRemainingSteps], a
|
||||
.next
|
||||
; determine if wild pokemon can appear in the half-block we're standing in
|
||||
|
|
@ -53,10 +53,10 @@ TryDoWildEncounter:
|
|||
; ...as long as it's not Viridian Forest or Safari Zone.
|
||||
ld a, [wCurMap]
|
||||
cp FIRST_INDOOR_MAP ; is this an indoor map?
|
||||
jr c, .CantEncounter2
|
||||
jp c, .CantEncounter2
|
||||
ld a, [wCurMapTileset]
|
||||
cp FOREST ; Viridian Forest/Safari Zone
|
||||
jr z, .CantEncounter2
|
||||
jp z, .CantEncounter2
|
||||
ld a, [wGrassRate]
|
||||
.CanEncounter
|
||||
; compare encounter chance with a random number to determine if there will be an encounter
|
||||
|
|
@ -84,6 +84,13 @@ TryDoWildEncounter:
|
|||
; since the bottom right tile of a "left shore" half-block is $14 but the bottom left tile is not,
|
||||
; "left shore" half-blocks (such as the one in the east coast of Cinnabar) load grass encounters.
|
||||
.gotWildEncounterType
|
||||
; Meltan functionality.
|
||||
; This used to be in engine/battle/core.asm.
|
||||
; However, it was a bit buggy as the implementation was forced.
|
||||
; So instead, we do this:
|
||||
ld a, [wMysteryBoxActive] ; Load the box.
|
||||
cp $01 ; Check if it's active.
|
||||
jr z, .meltanEncounter ; If so, skip this.
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
|
|
@ -99,6 +106,25 @@ TryDoWildEncounter:
|
|||
ld a, [wCurEnemyLVL]
|
||||
cp b
|
||||
jr c, .CantEncounter2 ; repel prevents encounters if the leading party mon's level is higher than the wild mon
|
||||
jp .willEncounter
|
||||
.meltanEncounter ; needed this function as otherwise we really mess up regular processing for no reason
|
||||
ld a, $01
|
||||
ld [wDontSwitchOffMysteryBoxYet], a ; Using this variable here accounts for running from Meltan.
|
||||
ld b, 0
|
||||
add hl, bc
|
||||
ld a, 5
|
||||
ld [wCurEnemyLVL], a
|
||||
ld a, MELTAN
|
||||
ld [wcf91], a
|
||||
ld [wEnemyMonSpecies2], a
|
||||
ld a, [wRepelRemainingSteps]
|
||||
and a
|
||||
jr z, .willEncounter
|
||||
ld a, [wPartyMon1Level]
|
||||
ld b, a
|
||||
ld a, [wCurEnemyLVL]
|
||||
cp b
|
||||
jr c, .CantEncounter2
|
||||
jr .willEncounter
|
||||
.lastRepelStep
|
||||
ld [wRepelRemainingSteps], a
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue