diff options
| author | xCrystal <rgr.crystal@gmail.com> | 2016-09-17 22:20:34 +0200 | 
|---|---|---|
| committer | xCrystal <rgr.crystal@gmail.com> | 2016-09-17 22:20:34 +0200 | 
| commit | 2163db9ef29abe6507a1da4c8e77fe8d3fd77df2 (patch) | |
| tree | 638496c1945b237ba6082533c8943967d4606889 /src | |
| parent | 3d80668e91fe1812c86b2f1517d75f547479de7b (diff) | |
Acid effect and CheckNoDamageOrEffect
Diffstat (limited to 'src')
| -rw-r--r-- | src/constants/duel_constants.asm | 19 | ||||
| -rw-r--r-- | src/data/effect_commands.asm | 2 | ||||
| -rw-r--r-- | src/engine/effect_functions.asm | 41 | ||||
| -rwxr-xr-x | src/engine/home.asm | 40 | ||||
| -rw-r--r-- | src/text/text2.asm | 2 | ||||
| -rwxr-xr-x | src/text/text_offsets.asm | 2 | 
6 files changed, 89 insertions, 17 deletions
| diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index 7976e38..e31bdf5 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -71,15 +71,16 @@ SUBSTATUS1_NO_DAMAGE_17 EQU $17  SUBSTATUS1_NEXT_TURN_DOUBLE_DAMAGE EQU $19  SUBSTATUS1_REDUCE_BY_10 EQU $1e -SUBSTATUS2_SMOKESCREEN  EQU $01 -SUBSTATUS2_SAND_ATTACK  EQU $02 -SUBSTATUS2_REDUCE_BY_20 EQU $03 -SUBSTATUS2_AMNESIA      EQU $04 -SUBSTATUS2_TAIL_WAG     EQU $05 -SUBSTATUS2_LEER         EQU $06 -SUBSTATUS2_POUNCE       EQU $07 -SUBSTATUS2_BONE_ATTACK  EQU $0b -SUBSTATUS2_GROWL        EQU $12 +SUBSTATUS2_SMOKESCREEN    EQU $01 +SUBSTATUS2_SAND_ATTACK    EQU $02 +SUBSTATUS2_REDUCE_BY_20   EQU $03 +SUBSTATUS2_AMNESIA        EQU $04 +SUBSTATUS2_TAIL_WAG       EQU $05 +SUBSTATUS2_LEER           EQU $06 +SUBSTATUS2_POUNCE         EQU $07 +SUBSTATUS2_UNABLE_RETREAT EQU $09 +SUBSTATUS2_BONE_ATTACK    EQU $0b +SUBSTATUS2_GROWL          EQU $12  SUBSTATUS5_THIS_TURN_DOUBLE_DAMAGE EQU 0 diff --git a/src/data/effect_commands.asm b/src/data/effect_commands.asm index 678900f..9616ea7 100644 --- a/src/data/effect_commands.asm +++ b/src/data/effect_commands.asm @@ -47,7 +47,7 @@ VictreebelLureEffectCommands:  	db  $00  VictreebelAcidEffectCommands: -	dbw $03, $477e +	dbw $03, AcidEffect  	db  $00  PinsirIronGripEffectCommands: 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 diff --git a/src/text/text2.asm b/src/text/text2.asm index 2ed2f39..9c6b04a 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -1,4 +1,4 @@ -Text00f5: ; 38000 (e:4000) +AcidCheckText: ; 38000 (e:4000)  	text "Acid check! If Heads,"  	line "unable to Retreat during next turn."  	done diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm index e33eae1..8ed6741 100755 --- a/src/text/text_offsets.asm +++ b/src/text/text_offsets.asm @@ -247,7 +247,7 @@ TextOffsets:: ; 34000 (d:4000)  	textpointer Text00f2  	textpointer Text00f3  	textpointer Text00f4 -	textpointer Text00f5 +	textpointer AcidCheckText  	textpointer Text00f6  	textpointer Text00f7  	textpointer Text00f8 | 
