pay_day_effect.asm 723 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. PayDayEffect_:
  2. xor a
  3. ld hl, wcd6d
  4. ld [hli], a
  5. ld a, [H_WHOSETURN]
  6. and a
  7. ld a, [wBattleMonLevel]
  8. jr z, .payDayEffect
  9. ld a, [wEnemyMonLevel]
  10. .payDayEffect
  11. ; level * 2
  12. add a
  13. ld [H_DIVIDEND + 3], a
  14. xor a
  15. ld [H_DIVIDEND], a
  16. ld [H_DIVIDEND + 1], a
  17. ld [H_DIVIDEND + 2], a
  18. ; convert to BCD
  19. ld a, 100
  20. ld [H_DIVISOR], a
  21. ld b, $4
  22. call Divide
  23. ld a, [H_QUOTIENT + 3]
  24. ld [hli], a
  25. ld a, [H_REMAINDER]
  26. ld [H_DIVIDEND + 3], a
  27. ld a, 10
  28. ld [H_DIVISOR], a
  29. ld b, $4
  30. call Divide
  31. ld a, [H_QUOTIENT + 3]
  32. swap a
  33. ld b, a
  34. ld a, [H_REMAINDER]
  35. add b
  36. ld [hl], a
  37. ld de, wTotalPayDayMoney + 2
  38. ld c, $3
  39. predef AddBCDPredef
  40. ld hl, CoinsScatteredText
  41. jp PrintText
  42. CoinsScatteredText:
  43. TX_FAR _CoinsScatteredText
  44. db "@"