2018-06-24 07:09:41 -07:00
|
|
|
BattleCommand_Encore:
|
2018-01-26 08:36:00 -08:00
|
|
|
; encore
|
|
|
|
|
2018-02-03 15:21:53 -08:00
|
|
|
ld hl, wEnemyMonMoves
|
|
|
|
ld de, wEnemyEncoreCount
|
2018-01-26 08:36:00 -08:00
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .ok
|
2018-02-03 15:21:53 -08:00
|
|
|
ld hl, wBattleMonMoves
|
|
|
|
ld de, wPlayerEncoreCount
|
2018-01-26 08:36:00 -08:00
|
|
|
.ok
|
|
|
|
ld a, BATTLE_VARS_LAST_MOVE_OPP
|
|
|
|
call GetBattleVar
|
|
|
|
and a
|
|
|
|
jp z, .failed
|
|
|
|
cp STRUGGLE
|
|
|
|
jp z, .failed
|
|
|
|
cp ENCORE
|
|
|
|
jp z, .failed
|
|
|
|
cp MIRROR_MOVE
|
|
|
|
jp z, .failed
|
|
|
|
ld b, a
|
|
|
|
|
|
|
|
.got_move
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr nz, .got_move
|
|
|
|
|
2018-02-03 15:21:53 -08:00
|
|
|
ld bc, wBattleMonPP - wBattleMonMoves - 1
|
2018-01-26 08:36:00 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and PP_MASK
|
|
|
|
jp z, .failed
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wAttackMissed]
|
2018-01-26 08:36:00 -08:00
|
|
|
and a
|
|
|
|
jp nz, .failed
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS5_OPP
|
|
|
|
call GetBattleVarAddr
|
|
|
|
bit SUBSTATUS_ENCORED, [hl]
|
|
|
|
jp nz, .failed
|
|
|
|
set SUBSTATUS_ENCORED, [hl]
|
|
|
|
call BattleRandom
|
|
|
|
and $3
|
|
|
|
inc a
|
|
|
|
inc a
|
|
|
|
inc a
|
|
|
|
ld [de], a
|
|
|
|
call CheckOpponentWentFirst
|
|
|
|
jr nz, .finish_move
|
|
|
|
ld a, [hBattleTurn]
|
|
|
|
and a
|
|
|
|
jr z, .force_last_enemy_move
|
|
|
|
|
|
|
|
push hl
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wLastPlayerMove]
|
2018-01-26 08:36:00 -08:00
|
|
|
ld b, a
|
|
|
|
ld c, 0
|
2018-02-03 15:21:53 -08:00
|
|
|
ld hl, wBattleMonMoves
|
2018-01-26 08:36:00 -08:00
|
|
|
.find_player_move
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr z, .got_player_move
|
|
|
|
inc c
|
|
|
|
ld a, c
|
|
|
|
cp NUM_MOVES
|
|
|
|
jr c, .find_player_move
|
|
|
|
pop hl
|
|
|
|
res SUBSTATUS_ENCORED, [hl]
|
|
|
|
xor a
|
|
|
|
ld [de], a
|
|
|
|
jr .failed
|
|
|
|
|
|
|
|
.got_player_move
|
|
|
|
pop hl
|
|
|
|
ld a, c
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wCurMoveNum], a
|
2018-01-26 08:36:00 -08:00
|
|
|
ld a, b
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wCurPlayerMove], a
|
2018-01-26 08:36:00 -08:00
|
|
|
dec a
|
|
|
|
ld de, wPlayerMoveStruct
|
|
|
|
call GetMoveData
|
|
|
|
jr .finish_move
|
|
|
|
|
|
|
|
.force_last_enemy_move
|
|
|
|
push hl
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wLastEnemyMove]
|
2018-01-26 08:36:00 -08:00
|
|
|
ld b, a
|
|
|
|
ld c, 0
|
2018-02-03 15:21:53 -08:00
|
|
|
ld hl, wEnemyMonMoves
|
2018-01-26 08:36:00 -08:00
|
|
|
.find_enemy_move
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr z, .got_enemy_move
|
|
|
|
inc c
|
|
|
|
ld a, c
|
|
|
|
cp NUM_MOVES
|
|
|
|
jr c, .find_enemy_move
|
|
|
|
pop hl
|
|
|
|
res SUBSTATUS_ENCORED, [hl]
|
|
|
|
xor a
|
|
|
|
ld [de], a
|
|
|
|
jr .failed
|
|
|
|
|
|
|
|
.got_enemy_move
|
|
|
|
pop hl
|
|
|
|
ld a, c
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wCurEnemyMoveNum], a
|
2018-01-26 08:36:00 -08:00
|
|
|
ld a, b
|
2018-02-03 15:21:53 -08:00
|
|
|
ld [wCurEnemyMove], a
|
2018-01-26 08:36:00 -08:00
|
|
|
dec a
|
|
|
|
ld de, wEnemyMoveStruct
|
|
|
|
call GetMoveData
|
|
|
|
|
|
|
|
.finish_move
|
|
|
|
call AnimateCurrentMove
|
|
|
|
ld hl, GotAnEncoreText
|
|
|
|
jp StdBattleTextBox
|
|
|
|
|
|
|
|
.failed
|
|
|
|
jp PrintDidntAffect2
|