Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/battle/move_effects/reflect_light_screen.asm
1271 views
1
ReflectLightScreenEffect_:
2
ld hl, wPlayerBattleStatus3
3
ld de, wPlayerMoveEffect
4
ldh a, [hWhoseTurn]
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 EffectCallBattleCore
27
pop hl
28
jp PrintText
29
.moveFailed
30
ld c, 50
31
call DelayFrames
32
ld hl, PrintButItFailedText_
33
jp EffectCallBattleCore
34
35
LightScreenProtectedText:
36
text_far _LightScreenProtectedText
37
text_end
38
39
ReflectGainedArmorText:
40
text_far _ReflectGainedArmorText
41
text_end
42
43
EffectCallBattleCore:
44
ld b, BANK(BattleCore)
45
jp Bankswitch
46
47