reflect_light_screen_effect.asm 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. ReflectLightScreenEffect_:
  2. ld hl, wPlayerBattleStatus3
  3. ld de, wPlayerMoveEffect
  4. ld a, [H_WHOSETURN]
  5. and a
  6. jr z, .reflectLightScreenEffect
  7. ld hl, wEnemyBattleStatus3
  8. ld de, wEnemyMoveEffect
  9. .reflectLightScreenEffect
  10. ld a, [de]
  11. cp LIGHT_SCREEN_EFFECT
  12. jr nz, .reflect
  13. bit HAS_LIGHT_SCREEN_UP, [hl] ; is mon already protected by light screen?
  14. jr nz, .moveFailed
  15. set HAS_LIGHT_SCREEN_UP, [hl] ; mon is now protected by light screen
  16. ld hl, LightScreenProtectedText
  17. jr .playAnim
  18. .reflect
  19. bit HAS_REFLECT_UP, [hl] ; is mon already protected by reflect?
  20. jr nz, .moveFailed
  21. set HAS_REFLECT_UP, [hl] ; mon is now protected by reflect
  22. ld hl, ReflectGainedArmorText
  23. .playAnim
  24. push hl
  25. ld hl, PlayCurrentMoveAnimation
  26. call BankswitchEtoF
  27. pop hl
  28. jp PrintText
  29. .moveFailed
  30. ld c, 50
  31. call DelayFrames
  32. ld hl, PrintButItFailedText_
  33. jp BankswitchEtoF
  34. LightScreenProtectedText:
  35. TX_FAR _LightScreenProtectedText
  36. db "@"
  37. ReflectGainedArmorText:
  38. TX_FAR _ReflectGainedArmorText
  39. db "@"
  40. BankswitchEtoF:
  41. ld b, BANK(BattleCore)
  42. jp Bankswitch