shithub: pokered

Download patch

ref: 3901d3ac17c89d760620fe92ea4d9283ad6ca949
parent: 419ea20764844a209e946c51290232fa5d7fd797
author: stag019 <stag019@gmail.com>
date: Thu Mar 22 01:28:55 EDT 2012

CheckTargetSubstitute from smkdan's docs.

hg-commit-id: 229bf9102cf7


--- a/main.asm
+++ b/main.asm
@@ -40993,7 +40993,7 @@
 
 INCBIN "baserom.gbc",$3f2e9,$3f30c - $3f2e9
 
-FreezeBurnParalyzeEffect:
+FreezeBurnParalyzeEffect: ;0x3f30c
 	xor a
 	ld [$cc5b], a
 	call $7b79			;test bit 4 of d063/d068 flags [target has substitute flag]
@@ -41053,7 +41053,7 @@
 	call $7bb9	;animation
 	ld hl, UnnamedText_3f3dd
 	jp PrintText
-opponentAttacker:
+opponentAttacker:	;0x3f382
 	ld a, [W_PLAYERMONSTATUS]	;this appears to the same as above with addresses swapped for opponent
 	and a
 	jp nz, CheckDefrost
@@ -41108,7 +41108,7 @@
 	db $50
 ; 0x3f3dd + 5 bytes
 
-CheckDefrost:
+CheckDefrost:	;0x3f3e2
 	and a, FRZ			;are they frozen?
 	ret z				;return if so
 						;not frozen
@@ -41273,7 +41273,19 @@
 	db $50
 ; 0x3fb74 + 5 bytes
 
-INCBIN "baserom.gbc",$3fb79,$3fbc8 - $3fb79
+CheckTargetSubstitute:	;0x3fb79
+	push hl
+	ld hl, $d068
+	ld a, [$ff00+$f3]	;whose turn?
+	and a
+	jr z, .next1\@
+	ld hl, $d063
+.next1\@
+	bit 4, [hl]			;test bit 4 in d063/d068 flags
+	pop hl
+	ret
+
+INCBIN "baserom.gbc",$3fb89,$3fbc8 - $3fb89
 
 SECTION "bank10",DATA,BANK[$10]