summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElectroDeoxys <ElectroDeoxys@gmail.com>2019-07-25 13:06:08 +0100
committerElectroDeoxys <ElectroDeoxys@gmail.com>2019-08-07 23:24:59 +0100
commit11a1df484afd366c7934f5cbbfd62cdc656f6f7d (patch)
treeb51daa7907fb8e2cdc6f678e1e198c9ccab9ef18
parente1702ca1b0d7b5ef4b9721170fdc3072c9725d19 (diff)
Label StoreDefendingPokemonColorWRAndPrizeCards
-rw-r--r--src/engine/bank05.asm32
-rw-r--r--src/wram.asm14
2 files changed, 38 insertions, 8 deletions
diff --git a/src/engine/bank05.asm b/src/engine/bank05.asm
index f3eef74..089afda 100644
--- a/src/engine/bank05.asm
+++ b/src/engine/bank05.asm
@@ -115,8 +115,26 @@ Func_140fe: ; 140fe (5:40fe)
Func_1410a: ; 1410a (5:410a)
INCROM $1410a, $1411d
-Func_1411d: ; 1411d (5:411d)
- INCROM $1411d, $14226
+; stores defending Pokémon's weakness/resistance
+; and the number of prize cards in both sides
+StoreDefendingPokemonColorWRAndPrizeCards: ; 1411d (5:411d)
+ call SwapTurn
+ call GetArenaCardColor
+ call TranslateColorToWR
+ ld [wcdcf], a
+ call GetArenaCardWeakness
+ ld [wcdcf+1], a
+ call GetArenaCardResistance
+ ld [wcdcf+2], a
+ call CountPrizes
+ ld [wcdcf+3], a
+ call SwapTurn
+ call CountPrizes
+ ld [wcdcf+4], a
+ ret
+; 0x14145
+
+ INCROM $14145, $14226
Func_14226: ; 14226 (5:4226)
call CreateHandCardList
@@ -821,7 +839,7 @@ Func_158b2: ; 158b2 (5:58b2)
jp nz, .asm_15b2f
xor a
ld [$cdd7], a
- call Func_1411d
+ call StoreDefendingPokemonColorWRAndPrizeCards
ld a, $80
ld [wcdbe], a
ld a, [$cdb4]
@@ -917,14 +935,14 @@ Func_158b2: ; 158b2 (5:58b2)
ld a, $02
call Func_1410a
.asm_15980
- ld a, [$cdcf]
+ ld a, [wcdcf]
ld b, a
call GetArenaCardWeakness
and b
jr z, .asm_159ad
ld a, $02
call Func_140fe
- ld a, [$cdcf]
+ ld a, [wcdcf]
ld b, a
ld a, $bc
call GetTurnDuelistVariable
@@ -941,7 +959,7 @@ Func_158b2: ; 158b2 (5:58b2)
ld a, $03
call Func_1410a
.asm_159ad
- ld a, [$cdcf]
+ ld a, [wcdcf]
ld b, a
call GetArenaCardResistance
and b
@@ -992,7 +1010,7 @@ Func_158b2: ; 158b2 (5:58b2)
ld a, $03
call Func_1410a
.asm_15a0e
- ld a, [$cdcf]
+ ld a, [wcdcf]
ld b, a
ld a, $bc
call GetTurnDuelistVariable
diff --git a/src/wram.asm b/src/wram.asm
index d1ca05e..cc7129c 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -1206,7 +1206,19 @@ wTempLoadedMoveEnergyNeededAmount:: ; cdb7
wcdbe:: ; cdbe
ds $1
- ds $1c
+ ds $10
+
+; stores information about the defending Pokémon
+; and about the prize card count on both sides for AI
+; byte 0: player's active Pokémon color
+; byte 1: player's active Pokémon weakness
+; byte 2: player's active Pokémon resistance
+; byte 3: player's prize count
+; byte 4: opponent's prize count
+wcdcf:: ; cdcf
+ ds $5
+
+ ds $7
wcddb:: ; cddb
ds $1