haze_effect.asm 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. HazeEffect_:
  2. ld a, $7
  3. ; store 7 on every stat mod
  4. ld hl, wPlayerMonAttackMod
  5. call ResetStatMods
  6. ld hl, wEnemyMonAttackMod
  7. call ResetStatMods
  8. ; copy unmodified stats to battle stats
  9. ld hl, wPlayerMonUnmodifiedAttack
  10. ld de, wBattleMonAttack
  11. call ResetStats
  12. ld hl, wEnemyMonUnmodifiedAttack
  13. ld de, wEnemyMonAttack
  14. call ResetStats
  15. ; cure non-volatile status, but only for the target
  16. ld hl, wEnemyMonStatus
  17. ld de, wEnemySelectedMove
  18. ld a, [H_WHOSETURN]
  19. and a
  20. jr z, .cureStatuses
  21. ld hl, wBattleMonStatus
  22. dec de ; wPlayerSelectedMove
  23. .cureStatuses
  24. ld a, [hl]
  25. ld [hl], $0
  26. and SLP | (1 << FRZ)
  27. jr z, .cureVolatileStatuses
  28. ; prevent the Pokemon from executing a move if it was asleep or frozen
  29. ld a, $ff
  30. ld [de], a
  31. .cureVolatileStatuses
  32. xor a
  33. ld [wPlayerDisabledMove], a
  34. ld [wEnemyDisabledMove], a
  35. ld hl, wPlayerDisabledMoveNumber
  36. ld [hli], a
  37. ld [hl], a
  38. ld hl, wPlayerBattleStatus1
  39. call CureVolatileStatuses
  40. ld hl, wEnemyBattleStatus1
  41. call CureVolatileStatuses
  42. ld hl, PlayCurrentMoveAnimation
  43. call CallBankF
  44. ld hl, StatusChangesEliminatedText
  45. jp PrintText
  46. CureVolatileStatuses:
  47. res CONFUSED, [hl]
  48. inc hl ; BATTSTATUS2
  49. ld a, [hl]
  50. ; clear USING_X_ACCURACY, PROTECTED_BY_MIST, GETTING_PUMPED, and SEEDED statuses
  51. and $ff ^((1 << USING_X_ACCURACY) | (1 << PROTECTED_BY_MIST) | (1 << GETTING_PUMPED) | (1 << SEEDED))
  52. ld [hli], a ; BATTSTATUS3
  53. ld a, [hl]
  54. and %11110000 | (1 << TRANSFORMED) ; clear Bad Poison, Reflect and Light Screen statuses
  55. ld [hl], a
  56. ret
  57. ResetStatMods:
  58. ld b, $8
  59. .loop
  60. ld [hli], a
  61. dec b
  62. jr nz, .loop
  63. ret
  64. ResetStats:
  65. ld b, $8
  66. .loop
  67. ld a, [hli]
  68. ld [de], a
  69. inc de
  70. dec b
  71. jr nz, .loop
  72. ret
  73. StatusChangesEliminatedText:
  74. TX_FAR _StatusChangesEliminatedText
  75. db "@"