diff options
author | yenatch <yenatch@gmail.com> | 2018-02-25 22:39:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-25 22:39:51 -0500 |
commit | 725148443f0ed0f70af747259ef49643359e92a2 (patch) | |
tree | 5f8ccf80489e0820934d40a732a5ce8d7f65e1e3 /engine/battle/move_effects/disable.asm | |
parent | f44f306cfd4b438d0ba2f56b61be4b118ef3274b (diff) | |
parent | 7453bd1aa8e55a1a9fcce7c69f62106f5e5f6e9c (diff) |
Merge pull request #476 from Rangi42/master
Resolve some issues; rename some maps; move more tables into data/; warp_def → warp_event (ready to merge)
Diffstat (limited to 'engine/battle/move_effects/disable.asm')
-rw-r--r-- | engine/battle/move_effects/disable.asm | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/engine/battle/move_effects/disable.asm b/engine/battle/move_effects/disable.asm new file mode 100644 index 000000000..5df785d24 --- /dev/null +++ b/engine/battle/move_effects/disable.asm @@ -0,0 +1,74 @@ +BattleCommand_Disable: ; 36fed +; disable + + ld a, [wAttackMissed] + and a + jr nz, .failed + + ld de, wEnemyDisableCount + ld hl, wEnemyMonMoves + ld a, [hBattleTurn] + and a + jr z, .got_moves + ld de, wPlayerDisableCount + ld hl, wBattleMonMoves +.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 + + ld a, [hBattleTurn] + and a + ld hl, wEnemyMonPP + jr z, .got_pp + ld hl, wBattleMonPP +.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 + ld hl, wDisabledMove + ld a, [hBattleTurn] + 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 + jp StdBattleTextBox + +.failed + jp FailMove + +; 3705c |