summaryrefslogtreecommitdiff
path: root/engine/battle/move_effects/mimic.asm
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-01-26 11:36:00 -0500
committerRangi <remy.oukaour+rangi42@gmail.com>2018-01-26 11:36:00 -0500
commit0cf4eb68955952659b0e94fbeae0a75fe36255ae (patch)
treef38113626f149a5f71b01212a6440c0f8926b662 /engine/battle/move_effects/mimic.asm
parenta0cc4a33929f6aeb08a733c4a985c3bbb24ef55f (diff)
Move-unique effect commands consistently go in engine/battle/move_effects/
Diffstat (limited to 'engine/battle/move_effects/mimic.asm')
-rw-r--r--engine/battle/move_effects/mimic.asm52
1 files changed, 52 insertions, 0 deletions
diff --git a/engine/battle/move_effects/mimic.asm b/engine/battle/move_effects/mimic.asm
new file mode 100644
index 000000000..c1a3bc592
--- /dev/null
+++ b/engine/battle/move_effects/mimic.asm
@@ -0,0 +1,52 @@
+BattleCommand_Mimic: ; 36f46
+; mimic
+
+ call ClearLastMove
+ call BattleCommand_MoveDelay
+ ld a, [AttackMissed]
+ and a
+ jr nz, .fail
+ ld hl, BattleMonMoves
+ ld a, [hBattleTurn]
+ and a
+ jr z, .player_turn
+ ld hl, EnemyMonMoves
+.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
+ ld [wNamedObjectIndexBuffer], a
+ ld bc, BattleMonPP - BattleMonMoves
+ add hl, bc
+ ld [hl], 5
+ call GetMoveName
+ call AnimateCurrentMove
+ ld hl, LearnedMoveText
+ jp StdBattleTextBox
+
+.fail
+ jp FailMimic
+
+; 36f9d