Path: blob/master/engine/battle/move_effects/one_hit_ko.asm
1271 views
OneHitKOEffect_:1ld hl, wDamage2xor a3ld [hli], a4ld [hl], a ; set the damage output to zero5dec a6ld [wCriticalHitOrOHKO], a7ld hl, wBattleMonSpeed + 18ld de, wEnemyMonSpeed + 19ldh a, [hWhoseTurn]10and a11jr z, .compareSpeed12ld hl, wEnemyMonSpeed + 113ld de, wBattleMonSpeed + 114.compareSpeed15; set damage to 65535 and OHKO flag is the user's current speed is higher than the target's16ld a, [de]17dec de18ld b, a19ld a, [hld]20sub b21ld a, [de]22ld b, a23ld a, [hl]24sbc b25jr c, .userIsSlower26ld hl, wDamage27ld a, $ff28ld [hli], a29ld [hl], a30ld a, $231ld [wCriticalHitOrOHKO], a32ret33.userIsSlower34; keep damage at 0 and set move missed flag if target's current speed is higher instead35ld a, $136ld [wMoveMissed], a37ret383940