aboutsummaryrefslogtreecommitdiffstats
path: root/engine/battle/move_effects/reflect_light_screen.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
committerdannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
commit5647ca687b92954dcf37a6ea6bfbc9a341c32de4 (patch)
treedde1937a1bfdb3a835f4155e1c2eb8f1aaf86f63 /engine/battle/move_effects/reflect_light_screen.asm
parentMerge pull request #55 from Deokishisu/patch-1 (diff)
downloadpokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.gz
pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.xz
pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.zip
Sync with pokered
Diffstat (limited to 'engine/battle/move_effects/reflect_light_screen.asm')
-rw-r--r--engine/battle/move_effects/reflect_light_screen.asm45
1 files changed, 45 insertions, 0 deletions
diff --git a/engine/battle/move_effects/reflect_light_screen.asm b/engine/battle/move_effects/reflect_light_screen.asm
new file mode 100644
index 00000000..c05055fa
--- /dev/null
+++ b/engine/battle/move_effects/reflect_light_screen.asm
@@ -0,0 +1,45 @@
+ReflectLightScreenEffect_:
+ ld hl, wPlayerBattleStatus3
+ ld de, wPlayerMoveEffect
+ ldh a, [hWhoseTurn]
+ and a
+ jr z, .reflectLightScreenEffect
+ ld hl, wEnemyBattleStatus3
+ ld de, wEnemyMoveEffect
+.reflectLightScreenEffect
+ ld a, [de]
+ cp LIGHT_SCREEN_EFFECT
+ jr nz, .reflect
+ bit HAS_LIGHT_SCREEN_UP, [hl] ; is mon already protected by light screen?
+ jr nz, .moveFailed
+ set HAS_LIGHT_SCREEN_UP, [hl] ; mon is now protected by light screen
+ ld hl, LightScreenProtectedText
+ jr .playAnim
+.reflect
+ bit HAS_REFLECT_UP, [hl] ; is mon already protected by reflect?
+ jr nz, .moveFailed
+ set HAS_REFLECT_UP, [hl] ; mon is now protected by reflect
+ ld hl, ReflectGainedArmorText
+.playAnim
+ push hl
+ ld hl, PlayCurrentMoveAnimation
+ call Bankswitch3DtoF
+ pop hl
+ jp PrintText
+.moveFailed
+ ld c, 50
+ call DelayFrames
+ ld hl, PrintButItFailedText_
+ jp Bankswitch3DtoF
+
+LightScreenProtectedText:
+ text_far _LightScreenProtectedText
+ text_end
+
+ReflectGainedArmorText:
+ text_far _ReflectGainedArmorText
+ text_end
+
+Bankswitch3DtoF:
+ ld b, BANK(BattleCore)
+ jp Bankswitch