summaryrefslogtreecommitdiff
path: root/battle/effects/protect.asm
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2017-12-28 01:30:36 -0500
committerGitHub <noreply@github.com>2017-12-28 01:30:36 -0500
commitda28d1a84b0499bead314e17ae2ff0d13eb03196 (patch)
treec212adfc53d1996c06f2e4be1d6e480e687a2ad8 /battle/effects/protect.asm
parentbad9e33530af8cdc29ce5629df682fc7915bfff0 (diff)
parent2c4777f3363cd64d05fb00084fd83dff8ac31674 (diff)
Merge pull request #437 from roukaour/master
Reorganize battle/; rename most "header" misnomers; gfx/pics → gfx/pokemon
Diffstat (limited to 'battle/effects/protect.asm')
-rw-r--r--battle/effects/protect.asm80
1 files changed, 0 insertions, 80 deletions
diff --git a/battle/effects/protect.asm b/battle/effects/protect.asm
deleted file mode 100644
index 568ac00f8..000000000
--- a/battle/effects/protect.asm
+++ /dev/null
@@ -1,80 +0,0 @@
-BattleCommand_Protect: ; 37618
-; protect
- call ProtectChance
- ret c
-
- ld a, BATTLE_VARS_SUBSTATUS1
- call GetBattleVarAddr
- set SUBSTATUS_PROTECT, [hl]
-
- call AnimateCurrentMove
-
- ld hl, ProtectedItselfText
- jp StdBattleTextBox
-; 3762c
-
-
-ProtectChance: ; 3762c
-
- ld de, PlayerProtectCount
- ld a, [hBattleTurn]
- and a
- jr z, .asm_37637
- ld de, EnemyProtectCount
-.asm_37637
-
- call CheckOpponentWentFirst
- jr nz, .failed
-
-; Can't have a substitute.
-
- ld a, BATTLE_VARS_SUBSTATUS4
- call GetBattleVar
- bit SUBSTATUS_SUBSTITUTE, a
- jr nz, .failed
-
-; Halve the chance of a successful Protect for each consecutive use.
-
- ld b, $ff
- ld a, [de]
- ld c, a
-.loop
- ld a, c
- and a
- jr z, .done
- dec c
-
- srl b
- ld a, b
- and a
- jr nz, .loop
- jr .failed
-.done
-
-.rand
- call BattleRandom
- and a
- jr z, .rand
-
- dec a
- cp b
- jr nc, .failed
-
-; Another consecutive Protect use.
-
- ld a, [de]
- inc a
- ld [de], a
-
- and a
- ret
-
-
-.failed
- xor a
- ld [de], a
- call AnimateFailedMove
- call PrintButItFailed
- scf
- ret
-; 3766f