summaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
authorxCrystal <rgr.crystal@gmail.com>2016-09-17 22:20:34 +0200
committerxCrystal <rgr.crystal@gmail.com>2016-09-17 22:20:34 +0200
commit2163db9ef29abe6507a1da4c8e77fe8d3fd77df2 (patch)
tree638496c1945b237ba6082533c8943967d4606889 /src/engine
parent3d80668e91fe1812c86b2f1517d75f547479de7b (diff)
Acid effect and CheckNoDamageOrEffect
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/effect_functions.asm41
-rwxr-xr-xsrc/engine/home.asm40
2 files changed, 76 insertions, 5 deletions
diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm
index 8ebacdc..a7d44d1 100644
--- a/src/engine/effect_functions.asm
+++ b/src/engine/effect_functions.asm
@@ -94,7 +94,33 @@ Func_2c09c: ; 2c09c (b:409c)
ret
; 0x2c0a2
-INCBIN "baserom.gbc",$2c0a2,$2c6f8 - $2c0a2
+INCBIN "baserom.gbc",$2c0a2,$2c149 - $2c0a2
+
+; apply a status condition identified by register a to the target if able
+ApplySubstatus2ToDefendingCard: ; 2c149 (b:4149)
+ push af
+ call CheckNoDamageOrEffect
+ jr c, .noDamageOrEffect
+ ld a, DUELVARS_ARENA_CARD_SUBSTATUS2
+ call GetNonTurnDuelistVariable
+ pop af
+ ld [hl], a
+ ld l, $f6
+ ld [hl], a
+ ret
+
+.noDamageOrEffect
+ pop af
+ push hl
+ bank1call $4f9d
+ pop hl
+ ld a, l
+ or h
+ call nz, DrawWideTextBox_PrintText
+ ret
+; 0x2c166
+
+INCBIN "baserom.gbc",$2c166,$2c6f8 - $2c166
SpitPoison_Poison50PercentEffect: ; 2c6f8 (b:46f8)
text_de PoisonCheckText
@@ -106,4 +132,15 @@ SpitPoison_Poison50PercentEffect: ; 2c6f8 (b:46f8)
ret
; 0x2c70a
-INCBIN "baserom.gbc",$2c70a,$30000 - $2c70a
+INCBIN "baserom.gbc",$2c70a,$2c77e - $2c70a
+
+AcidEffect: ; 2c77e (b:477e)
+ text_de AcidCheckText
+ call TossCoin_BankB
+ ret nc
+ ld a, SUBSTATUS2_UNABLE_RETREAT
+ call ApplySubstatus2ToDefendingCard
+ ret
+; 0x2c78b
+
+INCBIN "baserom.gbc",$2c78b,$30000 - $2c78b
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 66f78aa..e4dfde8 100755
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -3160,10 +3160,10 @@ ApplyAttachedDefender: ; 1a7e (0:1a7e)
ld d, a
ret
-SubstractHP: ; 1a96 (0:1a96)
; hl: address to substract HP from
; de: how much HP to substract (damage to deal)
-; returns carry if the HP does not become 0 as a result
+; returns carry if the HP does not become 0 as a result
+SubstractHP: ; 1a96 (0:1a96)
push hl
push de
ld a, [hl]
@@ -6475,7 +6475,41 @@ HandleTransparency: ; 348a (0:348a)
ret
; 0x34b7
-INCBIN "baserom.gbc",$34b7,$34e2 - $34b7
+; return carry and return the appropriate text pointer in hl if the target has an
+; special status or power that prevents any damage or effect done to it this turn
+CheckNoDamageOrEffect: ; 34b7 (0:34b7)
+ ld a, [wNoDamageOrEffect]
+ or a
+ ret z
+ bit 7, a
+ jr nz, .dontPrintText ; already been here so don't repeat the text
+ ld hl, wNoDamageOrEffect
+ set 7, [hl]
+ dec a
+ add a
+ ld e, a
+ ld d, $0
+ ld hl, NoDamageOrEffectTextPointerTable
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ scf
+ ret
+
+.dontPrintText
+ ld hl, $0000
+ scf
+ ret
+; 0x34d8
+
+NoDamageOrEffectTextPointerTable: ; 34d8 (0:34d8)
+ tx NoDamageOrEffectDueToAgilityText ; NO_DAMAGE_OR_EFFECT_AGILITY
+ tx NoDamageOrEffectDueToBarrierText ; NO_DAMAGE_OR_EFFECT_BARRIER
+ tx NoDamageOrEffectDueToFlyText ; NO_DAMAGE_OR_EFFECT_FLY
+ tx NoDamageOrEffectDueToTransparencyText ; NO_DAMAGE_OR_EFFECT_TRANSPARENCY
+ tx NoDamageOrEffectDueToNShieldText ; NO_DAMAGE_OR_EFFECT_NSHIELD
+; 0x34e2
Func_34e2: ; 34e2 (0:34e2)
ld a, $27