2018-01-26 16:36:00 +00:00
|
|
|
BattleCommand_PainSplit: ; 35926
|
|
|
|
; painsplit
|
|
|
|
|
2018-02-03 23:21:53 +00:00
|
|
|
ld a, [wAttackMissed]
|
2018-01-26 16:36:00 +00:00
|
|
|
and a
|
|
|
|
jp nz, .ButItFailed
|
|
|
|
call CheckSubstituteOpp
|
|
|
|
jp nz, .ButItFailed
|
|
|
|
call AnimateCurrentMove
|
2018-02-03 23:21:53 +00:00
|
|
|
ld hl, wBattleMonMaxHP + 1
|
|
|
|
ld de, wEnemyMonMaxHP + 1
|
2018-01-26 16:36:00 +00:00
|
|
|
call .PlayerShareHP
|
|
|
|
ld a, $1
|
|
|
|
ld [wWhichHPBar], a
|
|
|
|
hlcoord 10, 9
|
|
|
|
predef AnimateHPBar
|
2018-02-03 23:21:53 +00:00
|
|
|
ld hl, wEnemyMonHP
|
2018-01-26 16:36:00 +00:00
|
|
|
ld a, [hli]
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wBuffer4], a
|
2018-01-26 16:36:00 +00:00
|
|
|
ld a, [hli]
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wBuffer3], a
|
2018-01-26 16:36:00 +00:00
|
|
|
ld a, [hli]
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wBuffer2], a
|
2018-01-26 16:36:00 +00:00
|
|
|
ld a, [hl]
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wBuffer1], a
|
2018-01-26 16:36:00 +00:00
|
|
|
call .EnemyShareHP
|
|
|
|
xor a
|
|
|
|
ld [wWhichHPBar], a
|
|
|
|
call ResetDamage
|
|
|
|
hlcoord 2, 2
|
|
|
|
predef AnimateHPBar
|
|
|
|
farcall _UpdateBattleHUDs
|
|
|
|
|
|
|
|
ld hl, SharedPainText
|
|
|
|
jp StdBattleTextBox
|
|
|
|
|
|
|
|
.PlayerShareHP:
|
|
|
|
ld a, [hld]
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wBuffer1], a
|
2018-01-26 16:36:00 +00:00
|
|
|
ld a, [hld]
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wBuffer2], a
|
2018-01-26 16:36:00 +00:00
|
|
|
ld a, [hld]
|
|
|
|
ld b, a
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wBuffer3], a
|
2018-01-26 16:36:00 +00:00
|
|
|
ld a, [hl]
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wBuffer4], a
|
2018-01-26 16:36:00 +00:00
|
|
|
dec de
|
|
|
|
dec de
|
|
|
|
ld a, [de]
|
|
|
|
dec de
|
|
|
|
add b
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wCurDamage + 1], a
|
2018-01-26 16:36:00 +00:00
|
|
|
ld b, [hl]
|
|
|
|
ld a, [de]
|
|
|
|
adc b
|
|
|
|
srl a
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wCurDamage], a
|
|
|
|
ld a, [wCurDamage + 1]
|
2018-01-26 16:36:00 +00:00
|
|
|
rr a
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wCurDamage + 1], a
|
2018-01-26 16:36:00 +00:00
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
|
|
|
|
.EnemyShareHP: ; 359ac
|
|
|
|
ld c, [hl]
|
|
|
|
dec hl
|
2018-02-03 23:21:53 +00:00
|
|
|
ld a, [wCurDamage + 1]
|
2018-01-26 16:36:00 +00:00
|
|
|
sub c
|
|
|
|
ld b, [hl]
|
|
|
|
dec hl
|
2018-02-03 23:21:53 +00:00
|
|
|
ld a, [wCurDamage]
|
2018-01-26 16:36:00 +00:00
|
|
|
sbc b
|
|
|
|
jr nc, .skip
|
|
|
|
|
2018-02-03 23:21:53 +00:00
|
|
|
ld a, [wCurDamage]
|
2018-01-26 16:36:00 +00:00
|
|
|
ld b, a
|
2018-02-03 23:21:53 +00:00
|
|
|
ld a, [wCurDamage + 1]
|
2018-01-26 16:36:00 +00:00
|
|
|
ld c, a
|
|
|
|
.skip
|
|
|
|
ld a, c
|
|
|
|
ld [hld], a
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wBuffer5], a
|
2018-01-26 16:36:00 +00:00
|
|
|
ld a, b
|
|
|
|
ld [hli], a
|
2018-02-03 23:21:53 +00:00
|
|
|
ld [wBuffer6], a
|
2018-01-26 16:36:00 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
; 359cd
|
|
|
|
|
|
|
|
.ButItFailed:
|
|
|
|
jp PrintDidntAffect2
|
|
|
|
|
|
|
|
; 359d0
|