summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorElectroDeoxys <ElectroDeoxys@gmail.com>2019-07-20 17:44:55 +0100
committerElectroDeoxys <ElectroDeoxys@gmail.com>2019-08-07 23:24:59 +0100
commitb44576919a9870d650367c12ebad0901f1f57496 (patch)
tree24a6e4289f2b21edc9962b7dd9a55dd71c5ab42c /src
parentab917ed13ba1957b0b476d0bc27e1163e235054b (diff)
Work on Func_15eae
Diffstat (limited to 'src')
-rw-r--r--src/engine/bank05.asm50
-rw-r--r--src/wram.asm22
2 files changed, 47 insertions, 25 deletions
diff --git a/src/engine/bank05.asm b/src/engine/bank05.asm
index 1f7bd12..796212c 100644
--- a/src/engine/bank05.asm
+++ b/src/engine/bank05.asm
@@ -387,7 +387,7 @@ Func_15b72 ; 15b72 (5:5b72)
Func_15d4f ; 15d4f (5:5d4f)
INCROM $15d4f, $15ea6
-; Copy cards from wDuelTempList to [de]
+; Copy cards from wDuelTempList to wHandTempList
CopyHandCardList: ; 15ea6 (5:5ea6)
ld a, [hli]
ld [de], a
@@ -398,26 +398,32 @@ CopyHandCardList: ; 15ea6 (5:5ea6)
Func_15eae: ; 15eae (5:5eae)
call CreateHandCardList
- call SortTempHandByList
+ call SortTempDeckByIdList
ld hl, wDuelTempList
- ld de, $ceda
+ ld de, wHandTempList
call CopyHandCardList
- ld hl, $ceda
-.asm_15ec0
+ ld hl, wHandTempList
+
+.next_card
ld a, [hli]
cp $ff
jp z, Func_15f4c
- ld [$cdf3], a
+
+ ld [wcdf3], a
push hl
call LoadCardDataToBuffer1_FromDeckIndex
ld a, [wLoadedCard1Type]
- cp $08
- jr nc, .asm_15f46
+ cp TYPE_ENERGY
+ jr nc, .skip
+ ; skip non-pokemon cards
+
ld a, [wLoadedCard1Stage]
or a
- jr nz, .asm_15f46
+ jr nz, .skip
+ ; skip non-basic pokemon
+
ld a, $82
- ld [$cdbe], a
+ ld [wcdbe], a
call Func_161d5
ld a, $ef
call GetTurnDuelistVariable
@@ -437,39 +443,39 @@ Func_15eae: ; 15eae (5:5eae)
ld a, $14
call Func_140fe
.asm_15f04
- ld a, [$cdf3]
+ ld a, [wcdf3]
call Func_163c9
call Func_1637b
jr nc, .asm_15f14
ld a, $14
call Func_140fe
.asm_15f14
- ld a, [$cdf3]
+ ld a, [wcdf3]
call Func_16422
jr nc, .asm_15f21
ld a, $14
call Func_140fe
.asm_15f21
- ld a, [$cdf3]
+ ld a, [wcdf3]
call Func_16451
jr nc, .asm_15f2e
ld a, $0a
call Func_140fe
.asm_15f2e
- ld a, [$cdbe]
+ ld a, [wcdbe]
cp $b4
- jr c, .asm_15f46
- ld a, [$cdf3]
+ jr c, .skip
+ ld a, [wcdf3]
ldh [hTemp_ffa0], a
call Func_1433d
- jr c, .asm_15f46
+ jr c, .skip
ld a, $01
bank1call AIMakeDecision
- jr c, .asm_15f4a
-.asm_15f46
+ jr c, .done
+.skip
pop hl
- jp .asm_15ec0
-.asm_15f4a
+ jp .next_card
+.done
pop hl
ret
@@ -483,7 +489,7 @@ Func_161d5 ; 161d5 (5:61d5)
; by wcdae and compares it to each card in hand.
; Sorts the hand in wDuelTempList so that the found card IDs
; are in the same order as the list pointed by de.
-SortTempHandByList: ; 1633f (5:633f)
+SortTempDeckByIdList: ; 1633f (5:633f)
ld a, [wcdaf]
or a
ret z
diff --git a/src/wram.asm b/src/wram.asm
index 8d742cb..0cdc0b9 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -1192,7 +1192,12 @@ wcdae:: ; cdae
wcdaf:: ; cdaf
ds $1
- ds $2b
+ ds $e
+
+wcdbe:: ; cdbe
+ ds $1
+
+ ds $1c
wcddb:: ; cddb
ds $1
@@ -1200,7 +1205,12 @@ wcddb:: ; cddb
wcddc:: ; cddc
ds $1
- ds $26
+ ds $16
+
+wcdf3:: ; cdf3
+ ds $1
+
+ ds $f
wce03:: ; ce03
ds $1
@@ -1510,7 +1520,13 @@ wcecc:: ; cecc
wcece:: ; cece
ds $2
- ds $47
+ ds $a
+
+; pointer to memory to store AI temporary hand card list
+wHandTempList:: ; ceda
+ ds $2
+
+ ds $3b
; used in bank2, probably related to wTempHandCardList (another temp list?)
wcf17:: ; cf17