kep-hack/engine/battle/moveEffects/one_hit_ko_effect.asm
xCrystal 77d0e5ff84 Rename battle files and split move effects Part 3
b.asm, b_2.asm, c.asm, and d.asm
2015-04-01 17:05:49 +02:00

37 lines
579 B
NASM

OneHitKOEffect_: ; 33f57 (c:7f57)
ld hl, W_DAMAGE
xor a
ld [hli], a
ld [hl], a ; set the damage output to zero
dec a
ld [wCriticalHitOrOHKO], a
ld hl, wBattleMonSpeed + 1
ld de, wEnemyMonSpeed + 1
ld a, [H_WHOSETURN] ; $fff3
and a
jr z, .asm_33f72
ld hl, wEnemyMonSpeed + 1
ld de, wBattleMonSpeed + 1
.asm_33f72
ld a, [de]
dec de
ld b, a
ld a, [hld]
sub b
ld a, [de]
ld b, a
ld a, [hl]
sbc b
jr c, .asm_33f8a
ld hl, W_DAMAGE
ld a, $ff
ld [hli], a
ld [hl], a
ld a, $2
ld [wCriticalHitOrOHKO], a
ret
.asm_33f8a
ld a, $1
ld [W_MOVEMISSED], a
ret