pokecrystal-board/battle/effects/rollout.asm

100 lines
1.4 KiB
NASM
Raw Normal View History

MAX_ROLLOUT_COUNT EQU 5
BattleCommand_CheckCurl: ; 37718
2013-12-01 11:19:57 -08:00
; checkcurl
ld de, PlayerRolloutCount
ld a, [hBattleTurn]
and a
jr z, .ok
2013-12-01 11:19:57 -08:00
ld de, EnemyRolloutCount
.ok
2013-12-01 11:19:57 -08:00
ld a, BATTLE_VARS_SUBSTATUS1
call GetBattleVar
bit SUBSTATUS_ROLLOUT, a
jr z, .reset
2013-12-01 11:19:57 -08:00
ld b, $4 ; doturn
jp SkipToBattleCommand
.reset
2013-12-01 11:19:57 -08:00
xor a
ld [de], a
ret
; 37734
BattleCommand_RolloutPower: ; 37734
2013-12-01 11:19:57 -08:00
; rolloutpower
ld a, BATTLE_VARS_STATUS
call GetBattleVar
and SLP
2013-12-01 11:19:57 -08:00
ret nz
ld hl, PlayerRolloutCount
ld a, [hBattleTurn]
and a
2016-01-09 13:28:22 -08:00
jr z, .got_rollout_count
2013-12-01 11:19:57 -08:00
ld hl, EnemyRolloutCount
2016-01-09 13:28:22 -08:00
.got_rollout_count
2013-12-01 11:19:57 -08:00
ld a, [hl]
and a
2016-01-09 13:28:22 -08:00
jr nz, .skip_set_rampage
2013-12-01 11:19:57 -08:00
ld a, 1
2016-01-09 13:28:22 -08:00
ld [wSomeoneIsRampaging], a
2013-12-01 11:19:57 -08:00
2016-01-09 13:28:22 -08:00
.skip_set_rampage
2013-12-01 11:19:57 -08:00
ld a, [AttackMissed]
and a
jr z, .hit
ld a, BATTLE_VARS_SUBSTATUS1
call GetBattleVarAddr
2013-12-01 11:19:57 -08:00
res 6, [hl]
ret
.hit
inc [hl]
ld a, [hl]
ld b, a
cp MAX_ROLLOUT_COUNT
2016-01-09 13:28:22 -08:00
jr c, .not_done_with_rollout
2013-12-01 11:19:57 -08:00
ld a, BATTLE_VARS_SUBSTATUS1
call GetBattleVarAddr
res SUBSTATUS_ROLLOUT, [hl]
2016-01-09 13:28:22 -08:00
jr .done_with_substatus_flag
2013-12-01 11:19:57 -08:00
2016-01-09 13:28:22 -08:00
.not_done_with_rollout
2013-12-01 11:19:57 -08:00
ld a, BATTLE_VARS_SUBSTATUS1
call GetBattleVarAddr
set SUBSTATUS_ROLLOUT, [hl]
2013-12-01 11:19:57 -08:00
2016-01-09 13:28:22 -08:00
.done_with_substatus_flag
2013-12-01 11:19:57 -08:00
ld a, BATTLE_VARS_SUBSTATUS2
call GetBattleVar
bit SUBSTATUS_CURLED, a
2016-01-09 13:28:22 -08:00
jr z, .not_curled
2013-12-01 11:19:57 -08:00
inc b
2016-01-09 13:28:22 -08:00
.not_curled
.loop
2013-12-01 11:19:57 -08:00
dec b
2016-01-09 13:28:22 -08:00
jr z, .done_damage
2013-12-01 11:19:57 -08:00
ld hl, CurDamage + 1
sla [hl]
dec hl
rl [hl]
2016-01-09 13:28:22 -08:00
jr nc, .loop
2013-12-01 11:19:57 -08:00
ld a, $ff
ld [hli], a
ld [hl], a
2016-01-09 13:28:22 -08:00
.done_damage
2013-12-01 11:19:57 -08:00
ret
; 37791