Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2012
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. ROMF:6038 FA BC D0 ld a,(d0bc) ;read base speed of monster from temporary RAM copy
  2. ROMF:603B 47 ld b,a
  3. ROMF:603C CB 38 slr b ;halve base speed immediately for some reason?
  4. ROMF:603E F0 F3 ld a,(ff00+f3) ;whose turn is it?
  5. ROMF:6040 A7 and a
  6. ROMF:6041 21 D4 CF ld hl,cfd4 ;player a stat addresses
  7. ROMF:6044 11 63 D0 ld de,d063
  8. ROMF:6047 28 06 jr z,604f(+)
  9. ROMF:6049 21 CE CF ld hl,cfce ;player b stat addresses
  10. ROMF:604C 11 68 D0 ld de,d068
  11. .+
  12. ROMF:604F 3A ldd a,(hl) ;*read base power from RAM
  13. ROMF:6050 A7 and a
  14. ROMF:6051 C8 ret z ;do nothing if it's zero
  15. ROMF:6052 2B dec hl
  16. ROMF:6053 4E ld c,(hl) ;read move #
  17. ROMF:6054 1A ld a,(de) ;test focus energy flag
  18. ROMF:6055 CB 57 bit 2,a ;bit2 is set when focus energy is active
  19. ROMF:6057 20 08 jr nz,6061(focus)
  20. ROMF:6059 CB 20 sla b ;double base speed (was previously halved, so it's restored but without bit0)
  21. ROMF:605B 30 06 jr nc,6063 ;overflow check
  22. ROMF:605D 06 FF ld b,ff ;cap base speed at 255
  23. ROMF:605F 18 02 jr 6063(skipFocus)
  24. .focus
  25. ROMF:6061 CB 38 slr b ;halve base speed (again), it's the focus energy glitch
  26. .skipFocus
  27. ROMF:6063 21 8E 60 ld hl,608e(moveTable) ;table of high critical hit moves
  28. .loop
  29. ROMF:6066 2A ldi a,(hl) ;read move from move table
  30. ROMF:6067 B9 cp c ;matches the move about to be used?
  31. ROMF:6068 28 07 jr z,6071(highCritical)
  32. ROMF:606A 3C inc a ;FF terminates loop
  33. ROMF:606B 20 F9 jr nz,6066(loop)
  34. .break
  35. ROMF:606D CB 38 slr b ;/2 for regular move, effective (base spd)/512 probability
  36. ROMF:606F 18 0C jr 607d(skipHighCritical)
  37. .highCritical
  38. ROMF:6071 CB 20 sla b ;*2...
  39. ROMF:6073 30 02 jr nc,6077
  40. ROMF:6075 06 FF ld b,ff ;set to FF (max) on overflow
  41. ROMF:6077 CB 20 sla b ;*4 for high critical move effective (base spd)/64 probability
  42. ROMF:6079 30 02 jr nc,607d
  43. ROMF:607B 06 FF ld b,ff
  44. .skipHighCritical
  45. ROMF:607D CD 9B 6E call 6e9b ;random 8bit number
  46. ROMF:6080 CB 07 rlc a
  47. ROMF:6082 CB 07 rlc a
  48. ROMF:6084 CB 07 rlc a
  49. ROMF:6086 B8 cp b
  50. ROMF:6087 D0 ret nc ;no critical hit if no borrow (99.6% thing applies)
  51. ROMF:6088 3E 01 ld a,01
  52. ROMF:608A EA 5E D0 ld (d05e),a ;set critical hit flag
  53. ROMF:608D C9 ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement