summaryrefslogtreecommitdiff
path: root/battle/effects/rollout.asm
blob: 13c91a8d9927cce27d4e8d57b173c49e01f8acd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
BattleCommand5b: ; 37718
; checkcurl

	ld de, PlayerRolloutCount
	ld a, [hBattleTurn]
	and a
	jr z, .asm_37723
	ld de, EnemyRolloutCount

.asm_37723
	ld a, BATTLE_VARS_SUBSTATUS1
	call GetBattleVar
	bit SUBSTATUS_ENCORED, a
	jr z, .asm_37731

	ld b, $4 ; doturn
	jp SkipToBattleCommand

.asm_37731
	xor a
	ld [de], a
	ret
; 37734


BattleCommand5c: ; 37734
; rolloutpower

	ld a, BATTLE_VARS_STATUS
	call GetBattleVar
	and 7
	ret nz

	ld hl, PlayerRolloutCount
	ld a, [hBattleTurn]
	and a
	jr z, .asm_37747
	ld hl, EnemyRolloutCount

.asm_37747
	ld a, [hl]
	and a
	jr nz, .asm_37750
	ld a, 1
	ld [$c73e], a

.asm_37750
	ld a, [AttackMissed]
	and a
	jr z, .hit

	ld a, BATTLE_VARS_SUBSTATUS1
	call _GetBattleVar
	res 6, [hl]
	ret

.hit
	inc [hl]
	ld a, [hl]
	ld b, a
	cp $5
	jr c, .asm_3776e

	ld a, BATTLE_VARS_SUBSTATUS1
	call _GetBattleVar
	res 6, [hl]
	jr .asm_37775

.asm_3776e
	ld a, BATTLE_VARS_SUBSTATUS1
	call _GetBattleVar
	set 6, [hl]

.asm_37775
	ld a, BATTLE_VARS_SUBSTATUS2
	call GetBattleVar
	bit 0, a
	jr z, .asm_3777f
	inc b
.asm_3777f
	dec b
	jr z, .asm_37790

	ld hl, CurDamage + 1
	sla [hl]
	dec hl
	rl [hl]
	jr nc, .asm_3777f

	ld a, $ff
	ld [hli], a
	ld [hl], a

.asm_37790
	ret
; 37791