prevent static wild mon NPCs from refusing to hide after battle

This commit is contained in:
jojobear13 2024-01-14 23:57:43 -06:00
parent dd71684561
commit 7d13d34093
2 changed files with 14 additions and 11 deletions

View file

@ -6981,6 +6981,9 @@ PlayMoveAnimation:
predef_jump MoveAnimation predef_jump MoveAnimation
InitBattle:: InitBattle::
xor a
ld [wWasTrainerBattle], a ;Remember to clear wWasTrainerBattle from any previous battles,
;because this new battle could be a static wild encounter.
ld a, [wCurOpponent] ld a, [wCurOpponent]
and a and a
jr z, DetermineWildOpponent jr z, DetermineWildOpponent

View file

@ -142,20 +142,20 @@ HideObject:
ld c, a ld c, a
ld b, FLAG_SET ld b, FLAG_SET
call MissableObjectFlagAction ; set "removed" flag call MissableObjectFlagAction ; set "removed" flag
call VerifyObjectState ; call VerifyObjectState
jr z, HideObject ; jr z, HideObject
jp UpdateSprites jp UpdateSprites
;returns z flag set if shown and z flag cleared if hidden ;returns z flag set if shown and z flag cleared if hidden
VerifyObjectState: ;VerifyObjectState:
ld hl, wMissableObjectFlags ; ld hl, wMissableObjectFlags
ld a, [wMissableObjectIndex] ; ld a, [wMissableObjectIndex]
ld c, a ; ld c, a
ld b, FLAG_TEST ; ld b, FLAG_TEST
call MissableObjectFlagAction ; call MissableObjectFlagAction
ld a, c ; ld a, c
and a ; and a
ret ; ret
MissableObjectFlagAction: MissableObjectFlagAction:
; identical to FlagAction ; identical to FlagAction