2018-06-24 07:09:41 -07:00
|
|
|
BattleCommand_PainSplit:
|
2018-01-26 08:36:00 -08:00
|
|
|
; painsplit
|
|
|
|
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wAttackMissed]
|
2018-01-26 08:36:00 -08:00
|
|
|
and a
|
|
|
|
jp nz, .ButItFailed
|
|
|
|
call CheckSubstituteOpp
|
|
|
|
jp nz, .ButItFailed
|
|
|
|
call AnimateCurrentMove
|
2018-02-03 15:21:53 -08:00
|
|
|
ld hl, wBattleMonMaxHP + 1
|
|
|
|
ld de, wEnemyMonMaxHP + 1
|
2018-01-26 08:36:00 -08:00
|
|
|
call .PlayerShareHP
|
|
|
|
ld a, $1
|
|
|
|
ld [wWhichHPBar], a
|
|
|
|
hlcoord 10, 9
|
|
|
|
predef AnimateHPBar
|
2018-02-03 15:21:53 -08:00
|
|
|
ld hl, wEnemyMonHP
|
2018-01-26 08:36:00 -08:00
|
|
|
ld a, [hli]
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wBuffer4], a
|
2018-01-26 08:36:00 -08:00
|
|
|
ld a, [hli]
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wBuffer3], a
|
2018-01-26 08:36:00 -08:00
|
|
|
ld a, [hli]
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wBuffer2], a
|
2018-01-26 08:36:00 -08:00
|
|
|
ld a, [hl]
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wBuffer1], a
|
2018-01-26 08:36:00 -08: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 15:21:53 -08:00
|
|
|
ld [wBuffer1], a
|
2018-01-26 08:36:00 -08:00
|
|
|
ld a, [hld]
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wBuffer2], a
|
2018-01-26 08:36:00 -08:00
|
|
|
ld a, [hld]
|
|
|
|
ld b, a
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wBuffer3], a
|
2018-01-26 08:36:00 -08:00
|
|
|
ld a, [hl]
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wBuffer4], a
|
2018-01-26 08:36:00 -08:00
|
|
|
dec de
|
|
|
|
dec de
|
|
|
|
ld a, [de]
|
|
|
|
dec de
|
|
|
|
add b
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wCurDamage + 1], a
|
2018-01-26 08:36:00 -08:00
|
|
|
ld b, [hl]
|
|
|
|
ld a, [de]
|
|
|
|
adc b
|
|
|
|
srl a
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wCurDamage], a
|
|
|
|
ld a, [wCurDamage + 1]
|
2018-01-26 08:36:00 -08:00
|
|
|
rr a
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wCurDamage + 1], a
|
2018-01-26 08:36:00 -08:00
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
inc de
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.EnemyShareHP:
|
2018-01-26 08:36:00 -08:00
|
|
|
ld c, [hl]
|
|
|
|
dec hl
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wCurDamage + 1]
|
2018-01-26 08:36:00 -08:00
|
|
|
sub c
|
|
|
|
ld b, [hl]
|
|
|
|
dec hl
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wCurDamage]
|
2018-01-26 08:36:00 -08:00
|
|
|
sbc b
|
|
|
|
jr nc, .skip
|
|
|
|
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wCurDamage]
|
2018-01-26 08:36:00 -08:00
|
|
|
ld b, a
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wCurDamage + 1]
|
2018-01-26 08:36:00 -08:00
|
|
|
ld c, a
|
|
|
|
.skip
|
|
|
|
ld a, c
|
|
|
|
ld [hld], a
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wBuffer5], a
|
2018-01-26 08:36:00 -08:00
|
|
|
ld a, b
|
|
|
|
ld [hli], a
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wBuffer6], a
|
2018-01-26 08:36:00 -08:00
|
|
|
ret
|
|
|
|
|
|
|
|
.ButItFailed:
|
|
|
|
jp PrintDidntAffect2
|