2018-06-24 07:09:41 -07:00
|
|
|
BattleCommand_Mimic:
|
2018-01-26 08:36:00 -08:00
|
|
|
; mimic
|
|
|
|
|
|
|
|
call ClearLastMove
|
|
|
|
call BattleCommand_MoveDelay
|
2018-02-03 15:21:53 -08:00
|
|
|
ld a, [wAttackMissed]
|
2018-01-26 08:36:00 -08:00
|
|
|
and a
|
|
|
|
jr nz, .fail
|
2018-02-03 15:21:53 -08:00
|
|
|
ld hl, wBattleMonMoves
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBattleTurn]
|
2018-01-26 08:36:00 -08:00
|
|
|
and a
|
|
|
|
jr z, .player_turn
|
2018-02-03 15:21:53 -08:00
|
|
|
ld hl, wEnemyMonMoves
|
2018-01-26 08:36:00 -08:00
|
|
|
.player_turn
|
|
|
|
call CheckHiddenOpponent
|
|
|
|
jr nz, .fail
|
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
|
|
|
call GetBattleVar
|
|
|
|
and a
|
|
|
|
jr z, .fail
|
|
|
|
cp STRUGGLE
|
|
|
|
jr z, .fail
|
|
|
|
ld b, a
|
|
|
|
ld c, NUM_MOVES
|
|
|
|
.check_already_knows_move
|
|
|
|
ld a, [hli]
|
|
|
|
cp b
|
|
|
|
jr z, .fail
|
|
|
|
dec c
|
|
|
|
jr nz, .check_already_knows_move
|
|
|
|
dec hl
|
|
|
|
.find_mimic
|
|
|
|
ld a, [hld]
|
|
|
|
cp MIMIC
|
|
|
|
jr nz, .find_mimic
|
|
|
|
inc hl
|
|
|
|
ld a, BATTLE_VARS_LAST_COUNTER_MOVE_OPP
|
|
|
|
call GetBattleVar
|
|
|
|
ld [hl], a
|
2020-12-23 13:29:30 -08:00
|
|
|
ld [wNamedObjectIndex], a
|
2018-02-03 15:21:53 -08:00
|
|
|
ld bc, wBattleMonPP - wBattleMonMoves
|
2018-01-26 08:36:00 -08:00
|
|
|
add hl, bc
|
|
|
|
ld [hl], 5
|
|
|
|
call GetMoveName
|
|
|
|
call AnimateCurrentMove
|
2019-10-20 15:24:17 -07:00
|
|
|
ld hl, MimicLearnedMoveText
|
2019-04-08 05:15:10 -07:00
|
|
|
jp StdBattleTextbox
|
2018-01-26 08:36:00 -08:00
|
|
|
|
|
|
|
.fail
|
|
|
|
jp FailMimic
|