summaryrefslogtreecommitdiff
path: root/engine/events/poison.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/events/poison.asm')
-rw-r--r--engine/events/poison.asm41
1 files changed, 40 insertions, 1 deletions
diff --git a/engine/events/poison.asm b/engine/events/poison.asm
index 8bb756b5..9f3ad391 100644
--- a/engine/events/poison.asm
+++ b/engine/events/poison.asm
@@ -2,13 +2,20 @@ ApplyOutOfBattlePoisonDamage:
ld a, [wd730]
add a
jp c, .noBlackOut ; no black out if joypad states are being simulated
+ ld a, [wd492]
+ bit 7, a
+ jp nz, .noBlackOut
+ ld a, [wd72e]
+ bit 6, a
+ jp nz, .noBlackOut
ld a, [wPartyCount]
and a
jp z, .noBlackOut
call IncrementDayCareMonExp
+ call Func_c4c7
ld a, [wStepCounter]
and $3 ; is the counter a multiple of 4?
- jp nz, .noBlackOut ; only apply poison damage every fourth step
+ jp nz, .skipPoisonEffectAndSound ; only apply poison damage every fourth step
ld [wWhichPokemon], a
ld hl, wPartyMon1Status
ld de, wPartySpecies
@@ -54,6 +61,12 @@ ApplyOutOfBattlePoisonDamage:
ld a, TEXT_MON_FAINTED
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
+ callfar IsThisPartymonStarterPikachu_Party
+ jr nc, .curMonNotPlayerPikachu
+ ld e, $3
+ callfar PlayPikachuSoundClip
+ calladb_ModifyPikachuHappiness PIKAHAPPY_PSNFNT
+.curMonNotPlayerPikachu
pop de
pop hl
.nextMon
@@ -110,3 +123,29 @@ ApplyOutOfBattlePoisonDamage:
.done
ld [wOutOfBattleBlackout], a
ret
+
+Func_c4c7:
+ ld a, [wStepCounter]
+ and a
+ jr nz, .asm_c4de
+ call Random
+ and $1
+ jr z, .asm_c4de
+ calladb_ModifyPikachuHappiness $6
+.asm_c4de
+ ld hl, wPikachuMood
+ ld a, [hl]
+ cp $80
+ jr z, .asm_c4ef
+ jr c, .asm_c4ea
+ dec a
+ dec a
+.asm_c4ea
+ inc a
+ ld [hl], a
+ cp $80
+ ret nz
+.asm_c4ef
+ xor a
+ ld [wd49c], a
+ ret