Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ROMF:6038 FA BC D0 ld a,(d0bc) ;read base speed of monster from temporary RAM copy
- ROMF:603B 47 ld b,a
- ROMF:603C CB 38 slr b ;halve base speed immediately for some reason?
- ROMF:603E F0 F3 ld a,(ff00+f3) ;whose turn is it?
- ROMF:6040 A7 and a
- ROMF:6041 21 D4 CF ld hl,cfd4 ;player a stat addresses
- ROMF:6044 11 63 D0 ld de,d063
- ROMF:6047 28 06 jr z,604f(+)
- ROMF:6049 21 CE CF ld hl,cfce ;player b stat addresses
- ROMF:604C 11 68 D0 ld de,d068
- .+
- 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) ;test focus energy flag
- ROMF:6055 CB 57 bit 2,a ;bit2 is set when focus energy is active
- ROMF:6057 20 08 jr nz,6061(focus)
- ROMF:6059 CB 20 sla b ;double base speed (was previously halved, so it's restored but without bit0)
- ROMF:605B 30 06 jr nc,6063 ;overflow check
- ROMF:605D 06 FF ld b,ff ;cap base speed at 255
- ROMF:605F 18 02 jr 6063(skipFocus)
- .focus
- ROMF:6061 CB 38 slr b ;halve base speed (again), it's the focus energy glitch
- .skipFocus
- 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 (base spd)/512 probability
- 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 (base spd)/64 probability
- 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
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement