2018-06-24 14:09:41 +00:00
|
|
|
BattleCommand_Disable:
|
2018-01-26 16:36:00 +00:00
|
|
|
; disable
|
|
|
|
|
2018-02-03 23:21:53 +00:00
|
|
|
ld a, [wAttackMissed]
|
2018-01-26 16:36:00 +00:00
|
|
|
and a
|
|
|
|
jr nz, .failed
|
|
|
|
|
2018-02-03 23:21:53 +00:00
|
|
|
ld de, wEnemyDisableCount
|
|
|
|
ld hl, wEnemyMonMoves
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hBattleTurn]
|
2018-01-26 16:36:00 +00:00
|
|
|
and a
|
|
|
|
jr z, .got_moves
|
2018-02-03 23:21:53 +00:00
|
|
|
ld de, wPlayerDisableCount
|
|
|
|
ld hl, wBattleMonMoves
|
2018-01-26 16:36:00 +00:00
|
|
|
.got_moves
|
|
|
|
|
|
|
|
ld a, [de]
|
|
|
|
and a
|
|
|
|
jr nz, .failed
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
|
|
|
call GetBattleVar
|
|
|
|
and a
|
|
|
|
jr z, .failed
|
|
|
|
cp STRUGGLE
|
|
|
|
jr z, .failed
|
|
|
|
|
|
|
|
ld b, a
|
|
|
|
ld c, $ff
|
|
|
|
.loop
|
|
|
|
inc c
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr nz, .loop
|
|
|
|
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hBattleTurn]
|
2018-01-26 16:36:00 +00:00
|
|
|
and a
|
2018-02-03 23:21:53 +00:00
|
|
|
ld hl, wEnemyMonPP
|
2018-01-26 16:36:00 +00:00
|
|
|
jr z, .got_pp
|
2018-02-03 23:21:53 +00:00
|
|
|
ld hl, wBattleMonPP
|
2018-01-26 16:36:00 +00:00
|
|
|
.got_pp
|
|
|
|
ld b, 0
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .failed
|
|
|
|
.loop2
|
|
|
|
call BattleRandom
|
|
|
|
and 7
|
|
|
|
jr z, .loop2
|
|
|
|
inc a
|
|
|
|
inc c
|
|
|
|
swap c
|
|
|
|
add c
|
|
|
|
ld [de], a
|
|
|
|
call AnimateCurrentMove
|
2018-02-03 23:21:53 +00:00
|
|
|
ld hl, wDisabledMove
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hBattleTurn]
|
2018-01-26 16:36:00 +00:00
|
|
|
and a
|
|
|
|
jr nz, .got_disabled_move_pointer
|
|
|
|
inc hl
|
|
|
|
.got_disabled_move_pointer
|
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
|
|
|
call GetBattleVar
|
|
|
|
ld [hl], a
|
|
|
|
ld [wNamedObjectIndexBuffer], a
|
|
|
|
call GetMoveName
|
|
|
|
ld hl, WasDisabledText
|
2019-04-08 12:15:10 +00:00
|
|
|
jp StdBattleTextbox
|
2018-01-26 16:36:00 +00:00
|
|
|
|
|
|
|
.failed
|
|
|
|
jp FailMove
|