Advertisement
KDLPro

AI vs. Player's stat boosts

Mar 17th, 2021
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. Is there anything wrong?```
  2. .checkstat
  3. ; Checks if Evasion is greater than 0
  4. ld a, [wEnemyEvaLevel]
  5. cp BASE_STAT_LEVEL
  6. ret c
  7. ; Checks if Accuracy is below -1
  8. ld a, [wEnemyAccLevel]
  9. cp BASE_STAT_LEVEL - 1
  10. jr c, .rollswitch
  11. ld hl, wPlayerStatLevels
  12. ld c, NUM_LEVEL_STATS - 1
  13. ld b, 0
  14. ; Check player's stat buffs
  15. .checkstatbuff
  16. ld a, [hli]
  17. sub BASE_STAT_LEVEL
  18. inc d
  19. ld e, a
  20. ; b holds the stat buffs
  21. ld a, [hl]
  22. cp BASE_STAT_LEVEL
  23. jr nc, .checkstatbuff
  24. ld a, b
  25. add e
  26. ld b, a
  27. dec c
  28. jr z, .checkplayerbuff
  29. jr .checkstatbuff
  30. ; Check AI's stat buffs
  31. ld hl, wEnemyStatLevels
  32. .checkplayerbuff
  33. ld a, [hli]
  34. sub BASE_STAT_LEVEL
  35. inc d
  36. ld e, a
  37. ; subtract from b the AI's stat buffs
  38. ld a, [hl]
  39. cp BASE_STAT_LEVEL
  40. jr nc, .cont_check
  41. ld a, b
  42. sub e
  43. ld b, a
  44. dec c
  45. jr z, .cont_check
  46. jr .checkplayerbuff
  47. .cont_check
  48. ; If player's buffs - AI's buffs > 1
  49. ; AI won't switch
  50. ld a, b
  51. cp 1
  52. jr c, .checkperish```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement