aboutsummaryrefslogtreecommitdiffstats
path: root/engine/battle/moveEffects/substitute_effect.asm
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2015-08-30 17:55:02 -0400
committerluckytyphlosion <alan.rj.huang@gmail.com>2015-08-30 17:55:02 -0400
commitd2ed7674f499b1fd6c4059da40b8b42c6bf96995 (patch)
treef581489b522fc647477d7b36dee072d553c44fd1 /engine/battle/moveEffects/substitute_effect.asm
parentMake pokeyellow build to baserom. (diff)
parentMerge pull request #114 from YamaArashi/master (diff)
downloadpokeyellow-d2ed7674f499b1fd6c4059da40b8b42c6bf96995.tar.gz
pokeyellow-d2ed7674f499b1fd6c4059da40b8b42c6bf96995.tar.xz
pokeyellow-d2ed7674f499b1fd6c4059da40b8b42c6bf96995.zip
Merge branch 'master' of https://github.com/iimarckus/pokered
Doesn't build.
Diffstat (limited to 'engine/battle/moveEffects/substitute_effect.asm')
-rw-r--r--engine/battle/moveEffects/substitute_effect.asm30
1 files changed, 14 insertions, 16 deletions
diff --git a/engine/battle/moveEffects/substitute_effect.asm b/engine/battle/moveEffects/substitute_effect.asm
index 8412e281..c72fffbe 100644
--- a/engine/battle/moveEffects/substitute_effect.asm
+++ b/engine/battle/moveEffects/substitute_effect.asm
@@ -11,15 +11,15 @@ SubstituteEffect_: ; 17dad (5:7dad)
ld de, wEnemySubstituteHP
ld bc, W_ENEMYBATTSTATUS2
.notEnemy
- ld a, [bc]
+ ld a, [bc]
bit HasSubstituteUp, a ; user already has substitute?
- jr nz, .alreadyHasSubstitute
+ jr nz, .alreadyHasSubstitute
; quarter health to remove from user
-; assumes max HP is 1023 or lower
+; assumes max HP is 1023 or lower
push bc
ld a, [hli]
ld b, [hl]
- srl a
+ srl a
rr b
srl a
rr b ; max hp / 4
@@ -27,37 +27,35 @@ SubstituteEffect_: ; 17dad (5:7dad)
ld de, wBattleMonHP - wBattleMonMaxHP
add hl, de ; point hl to current HP low byte
pop de
- ld a, b
+ ld a, b
ld [de], a ; save copy of HP to subtract in ccd7/ccd8 [how much HP substitute has]
ld a, [hld]
-; subtract [max hp / 4] to current HP
- sub b
+; subtract [max hp / 4] to current HP
+ sub b
ld d, a
ld a, [hl]
- sbc 0
+ sbc 0
pop bc
jr c, .notEnoughHP ; underflow means user would be left with negative health
; bug: since it only brances on carry, it will possibly leave user with 0 HP
.userHasZeroOrMoreHP
ldi [hl], a ; save resulting HP after substraction into current HP
- ld [hl], d
+ ld [hl], d
ld h, b
ld l, c
- set HasSubstituteUp, [hl]
- ld a, [W_OPTIONS]
+ set HasSubstituteUp, [hl]
+ ld a, [W_OPTIONS]
bit 7, a ; battle animation is enabled?
- ld hl, PlayCurrentMoveAnimation
+ ld hl, PlayCurrentMoveAnimation
ld b, BANK(PlayCurrentMoveAnimation)
jr z, .animationEnabled
- ld hl, AnimationSubstitute
+ ld hl, AnimationSubstitute
ld b, BANK(AnimationSubstitute)
.animationEnabled
call Bankswitch ; jump to routine depending on animation setting
ld hl, SubstituteText
call PrintText
- ld hl, DrawHUDsAndHPBars
- ld b, BANK(DrawHUDsAndHPBars)
- jp Bankswitch
+ jpab DrawHUDsAndHPBars
.alreadyHasSubstitute
ld hl, HasSubstituteText
jr .printText