more bug fixes

This commit is contained in:
May Evans 2022-08-31 15:28:36 +01:00
parent 648289d4a9
commit a216a0f2e7
7 changed files with 30 additions and 6 deletions

View file

@ -780,6 +780,10 @@ FaintEnemyPokemon:
hlcoord 0, 0
lb bc, 4, 11
call ClearScreenArea
call AnyPartyAlive ; this fixes victory music playing at the wrong time ; PvK
ld a, d
and a
push af
ld a, [wIsInBattle]
dec a
jr z, .wild_win
@ -798,11 +802,14 @@ FaintEnemyPokemon:
jr .sfxplayed
.wild_win
call EndLowHealthAlarm
pop af
push af
ld a, MUSIC_DEFEATED_WILD_MON
call PlayBattleVictoryMusic
call nz, PlayBattleVictoryMusic
.sfxplayed
; bug: win sfx is played for wild battles before checking for player mon HP
; this can lead to odd scenarios where both player and enemy faint, as the win sfx plays yet the player never won the battle
; kep fixes this - PvK
ld hl, wBattleMonHP
ld a, [hli]
or [hl]
@ -812,9 +819,7 @@ FaintEnemyPokemon:
jr nz, .playermonnotfaint ; if so, don't call RemoveFaintedPlayerMon twice
call RemoveFaintedPlayerMon
.playermonnotfaint
call AnyPartyAlive
ld a, d
and a
pop af
ret z
ld hl, EnemyMonFaintedText
call PrintText