diff options
author | Daniel Harding <33dannye@gmail.com> | 2020-05-16 21:42:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-16 21:42:24 -0500 |
commit | 8a924f1f783572ff395f617f99546b4c949c8b04 (patch) | |
tree | 1b6c7de331cb983256651b11b8adf413a3a434f1 /engine/battle/move_effects/disable.asm | |
parent | 88d7e9a34a8b610b358cec1ccc6660634ca9ce80 (diff) | |
parent | ed94962edf1668aba3f60938e8a5ba8040e2a59c (diff) |
Merge pull request #30 from entrpntr/spring-cleaning
Spring Cleaning
Diffstat (limited to 'engine/battle/move_effects/disable.asm')
-rw-r--r-- | engine/battle/move_effects/disable.asm | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/engine/battle/move_effects/disable.asm b/engine/battle/move_effects/disable.asm new file mode 100644 index 00000000..de6dbc60 --- /dev/null +++ b/engine/battle/move_effects/disable.asm @@ -0,0 +1,72 @@ +BattleCommand_Disable: +; disable + + ld a, [wAttackMissed] + and a + jr nz, .failed + + ld de, wEnemyDisableCount + ld hl, wEnemyMonMoves + ldh 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 + + ldh 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 + ldh 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 |