summaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/bank01.asm8
-rw-r--r--src/engine/deck_ai/deck_ai.asm1
-rw-r--r--src/engine/effect_functions.asm2
-rw-r--r--src/engine/home.asm40
4 files changed, 28 insertions, 23 deletions
diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm
index 7eb7340..8f780eb 100644
--- a/src/engine/bank01.asm
+++ b/src/engine/bank01.asm
@@ -353,7 +353,7 @@ DuelMainInterface: ; 426d (1:426d)
ld [wSkipDuelistIsThinkingDelay], a
ldtx hl, DuelistIsThinkingText
call DrawWideTextBox_PrintTextNoDelay
- call Func_2bbf
+ call AIDoAction_Turn
ld a, $ff
ld [wPlayerAttackingCardIndex], a
ld [wPlayerAttackingMoveIndex], a
@@ -1967,7 +1967,7 @@ ChooseInitialArenaAndBenchPokemon: ; 4cd5 (1:4cd5)
; AI opponent's turn
push af
push hl
- call Func_2bc3
+ call AIDoAction_StartDuel
pop hl
pop af
ld [hl], a
@@ -3757,7 +3757,7 @@ Func_5805: ; 5805 (1:5805)
call GetTurnDuelistVariable
cp DUELIST_TYPE_LINK_OPP
jr z, .link_opponent
- call Func_2bd7
+ call AIDoAction_TakePrize
ld c, DECK_SIZE
.asm_5858
call DoFrame
@@ -7492,7 +7492,7 @@ ReplaceKnockedOutPokemon: ; 6f23 (1:6f23)
.opponent
cp DUELIST_TYPE_LINK_OPP
jr z, .link_opponent
- call Func_2bcf
+ call AIDoAction_KOSwitch
ldh a, [hTemp_ffa0]
ldh [hTempPlayAreaLocation_ff9d], a
jr .replace_pokemon
diff --git a/src/engine/deck_ai/deck_ai.asm b/src/engine/deck_ai/deck_ai.asm
index a906472..c8b73f3 100644
--- a/src/engine/deck_ai/deck_ai.asm
+++ b/src/engine/deck_ai/deck_ai.asm
@@ -33,6 +33,7 @@ ENDM
; deck AIs are specialized to work on a given deck ID.
; they decide what happens during a turn, what Pokemon cards
; to pick during the start of the duel, etc.
+; the different scenarios these are used are listed in AIACTION_* constants.
; each of these have a pointer table with the following structure:
; dw .do_turn : never called;
;
diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm
index 762e82d..75b0f76 100644
--- a/src/engine/effect_functions.asm
+++ b/src/engine/effect_functions.asm
@@ -437,7 +437,7 @@ DuelistSelectForcedSwitch: ; 2c487 (b:4487)
; AI opponent
call SwapTurn
- bank1call Func_2bc7
+ bank1call AIDoAction_ForcedSwitch
call SwapTurn
ld a, [wPlayerAttackingMoveIndex]
diff --git a/src/engine/home.asm b/src/engine/home.asm
index c56e0c6..a9d28d6 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -8280,37 +8280,41 @@ LoadOpponentDeck: ; 2b78 (0:2b78)
ld [hl], a
ret
-Func_2bbf: ; 2bbf (0:2bbf)
- ld a, $1
- jr Func_2bdb
+AIDoAction_Turn: ; 2bbf (0:2bbf)
+ ld a, AIACTION_DO_TURN
+ jr AIDoAction
-Func_2bc3: ; 2bc3 (0:2bc3)
- ld a, $2
- jr Func_2bdb
+AIDoAction_StartDuel: ; 2bc3 (0:2bc3)
+ ld a, AIACTION_START_DUEL
+ jr AIDoAction
-Func_2bc7: ; 2bc7 (0:2bc7)
- ld a, $3
- call Func_2bdb
+AIDoAction_ForcedSwitch: ; 2bc7 (0:2bc7)
+ ld a, AIACTION_FORCED_SWITCH
+ call AIDoAction
ldh [hTempPlayAreaLocation_ff9d], a
ret
-Func_2bcf: ; 2bcf (0:2bcf)
- ld a, $4
- call Func_2bdb
+AIDoAction_KOSwitch: ; 2bcf (0:2bcf)
+ ld a, AIACTION_KO_SWITCH
+ call AIDoAction
ldh [hTemp_ffa0], a
ret
-Func_2bd7: ; 2bd7 (0:2bd7)
- ld a, $5
- jr Func_2bdb ; this line is not needed
+AIDoAction_TakePrize: ; 2bd7 (0:2bd7)
+ ld a, AIACTION_TAKE_PRIZE
+ jr AIDoAction ; this line is not needed
-Func_2bdb: ; 2bdb (0:2bdb)
+; calls the appropriate AI routine to handle action,
+; depending on the deck ID (see engine/deck_ai/deck_ai.asm)
+; input:
+; - a = AIACTION_* constant
+AIDoAction: ; 2bdb (0:2bdb)
ld c, a
; load bank for Opponent Deck pointer table
ldh a, [hBankROM]
push af
- ld a, BANK(PointerTable_14000)
+ ld a, BANK(DeckAIPointerTable)
call BankswitchROM
; load hl with the corresponding pointer
@@ -8318,7 +8322,7 @@ Func_2bdb: ; 2bdb (0:2bdb)
ld l, a
ld h, $0
add hl, hl ; two bytes per deck
- ld de, PointerTable_14000
+ ld de, DeckAIPointerTable
add hl, de
ld a, [hli]
ld h, [hl]