Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ...
- ROMF:604F 3A ldd a,(hl) ;*read base power from RAM
- ROMF:6050 A7 and a
- ROMF:6051 C8 ret z ;do nothing if it's zero
- ROMF:6052 2B dec hl
- ROMF:6053 4E ld c,(hl) ;read move #
- ROMF:6054 1A ld a,(de)
- ROMF:6055 CB 57 bit 2,a
- ROMF:6057 20 08 jr nz,6061
- ROMF:6059 CB 20 sla b
- ROMF:605B 30 06 jr nc,6063
- ROMF:605D 06 FF ld b,ff
- ROMF:605F 18 02 jr 6063
- ROMF:6061 CB 38 slr b
- ROMF:6063 21 8E 60 ld hl,608e(moveTable) ;table of high critical hit moves
- .loop
- ROMF:6066 2A ldi a,(hl) ;read move from move table
- ROMF:6067 B9 cp c ;matches the move about to be used?
- ROMF:6068 28 07 jr z,6071(highCritical)
- ROMF:606A 3C inc a ;FF terminates loop
- ROMF:606B 20 F9 jr nz,6066(loop)
- .break
- ROMF:606D CB 38 slr b ;/2 for regular move (effective 1/512)
- ROMF:606F 18 0C jr 607d(skipHighCritical)
- .highCritical
- ROMF:6071 CB 20 sla b ;*2...
- ROMF:6073 30 02 jr nc,6077
- ROMF:6075 06 FF ld b,ff ;set to FF (max) on overflow
- ROMF:6077 CB 20 sla b ;*4 for high critical move (effective 1/64)
- ROMF:6079 30 02 jr nc,607d
- ROMF:607B 06 FF ld b,ff
- .skipHighCritical
- ROMF:607D CD 9B 6E call 6e9b ;random 8bit number? check later
- ROMF:6080 CB 07 rlc a
- ROMF:6082 CB 07 rlc a
- ROMF:6084 CB 07 rlc a
- ROMF:6086 B8 cp b
- ROMF:6087 D0 ret nc ;no critical hit if no borrow (99.6% thing applies)
- ROMF:6088 3E 01 ld a,01
- ROMF:608A EA 5E D0 ld (d05e),a ;set critical hit flag
- ROMF:608D C9 ret
- .moveTable:
- db $02,$4B,$98,$A3 ;karate chop,razor leaf,crabhammer,slash
- db $FF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement