summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshealyrd <esheal@outlook.com>2020-12-09 17:43:07 -0600
committerGitHub <noreply@github.com>2020-12-09 17:43:07 -0600
commit4ec556cda4c32dbdbf1787813187515192a9cd37 (patch)
treee58ab1a7b04427a7706176bb9adac8d0fdfdffaa /src
parent6c71c05f0e8a703c04f27dd73116c873ec3d61d7 (diff)
parentec1e57b155d040beeb309a1524d496c6582da384 (diff)
Merge branch 'master' into master
Diffstat (limited to 'src')
-rw-r--r--src/audio/music1.asm4
-rw-r--r--src/audio/music2.asm2
-rw-r--r--src/constants/animation_constants.asm4
-rw-r--r--src/constants/deck_ai_constants.asm122
-rw-r--r--src/constants/duel_constants.asm23
-rw-r--r--src/constants/name_constants.asm2
-rw-r--r--src/constants/npc_constants.asm27
-rw-r--r--src/constants/sfx_constants.asm1
-rw-r--r--src/constants/sprite_constants.asm77
-rw-r--r--src/data/deck_ai_pointers.asm110
-rw-r--r--src/data/map_objects.asm64
-rw-r--r--src/data/move_animations.asm2
-rw-r--r--src/data/npc_map_data.asm1
-rw-r--r--src/data/npcs.asm1375
-rw-r--r--src/engine/bank01.asm332
-rw-r--r--src/engine/bank02.asm9
-rw-r--r--src/engine/bank03.asm316
-rw-r--r--src/engine/bank04.asm237
-rw-r--r--src/engine/bank05.asm197
-rw-r--r--src/engine/bank06.asm26
-rw-r--r--src/engine/bank07.asm15
-rw-r--r--src/engine/bank08.asm160
-rw-r--r--src/engine/bank1c.asm1
-rw-r--r--src/engine/bank20.asm27
-rw-r--r--src/engine/booster_packs.asm2
-rw-r--r--src/engine/deck_ai/deck_ai.asm164
-rw-r--r--src/engine/deck_ai/decks/fire_charge.asm167
-rw-r--r--src/engine/deck_ai/decks/first_strike.asm159
-rw-r--r--src/engine/deck_ai/decks/flower_power.asm157
-rw-r--r--src/engine/deck_ai/decks/general.asm391
-rw-r--r--src/engine/deck_ai/decks/general_no_retreat.asm287
-rw-r--r--src/engine/deck_ai/decks/go_go_rain_dance.asm165
-rw-r--r--src/engine/deck_ai/decks/im_ronald.asm167
-rw-r--r--src/engine/deck_ai/decks/invincible_ronald.asm163
-rw-r--r--src/engine/deck_ai/decks/legendary_articuno.asm427
-rw-r--r--src/engine/deck_ai/decks/legendary_dragonite.asm340
-rw-r--r--src/engine/deck_ai/decks/legendary_moltres.asm360
-rw-r--r--src/engine/deck_ai/decks/legendary_ronald.asm414
-rw-r--r--src/engine/deck_ai/decks/legendary_zapdos.asm314
-rw-r--r--src/engine/deck_ai/decks/powerful_ronald.asm191
-rw-r--r--src/engine/deck_ai/decks/rock_crusher.asm155
-rw-r--r--src/engine/deck_ai/decks/sams_practice.asm428
-rw-r--r--src/engine/deck_ai/decks/strange_psyshock.asm169
-rw-r--r--src/engine/deck_ai/decks/wonders_of_science.asm161
-rw-r--r--src/engine/deck_ai/decks/zapping_selfdestruct.asm157
-rw-r--r--src/engine/effect_functions.asm47
-rw-r--r--src/engine/home.asm343
-rw-r--r--src/macros/data.asm4
-rw-r--r--src/macros/scripts.asm1
-rw-r--r--src/macros/text.asm2
-rw-r--r--src/macros/wram.asm30
-rw-r--r--src/text/text3.asm120
-rw-r--r--src/text/text_offsets.asm122
-rw-r--r--src/wram.asm34
54 files changed, 4234 insertions, 4541 deletions
diff --git a/src/audio/music1.asm b/src/audio/music1.asm
index 0407f6c..a3a6e9e 100644
--- a/src/audio/music1.asm
+++ b/src/audio/music1.asm
@@ -1150,7 +1150,7 @@ Music1_SetChannelStackPointer: ; f4705 (3d:4705)
ld [hl], d
ret
-Music1_PlayNextNote_pop ; f4710 (3d:4710)
+Music1_PlayNextNote_pop: ; f4710 (3d:4710)
pop hl
jp Music1_PlayNextNote
@@ -1321,7 +1321,7 @@ Func_f480a: ; f480a (3d:480a)
ld [de], a
.asm_f4829
ret
-asm_f482a
+asm_f482a:
xor a
ld [wddef], a
ld hl, rNR42
diff --git a/src/audio/music2.asm b/src/audio/music2.asm
index 499aafc..e13389e 100644
--- a/src/audio/music2.asm
+++ b/src/audio/music2.asm
@@ -1321,7 +1321,7 @@ Func_f880a: ; f880a (3e:480a)
ld [de], a
.asm_f8829
ret
-asm_f882a
+asm_f882a:
xor a
ld [wddef], a
ld hl, rNR42
diff --git a/src/constants/animation_constants.asm b/src/constants/animation_constants.asm
index f326d5e..bdf93f8 100644
--- a/src/constants/animation_constants.asm
+++ b/src/constants/animation_constants.asm
@@ -6,6 +6,6 @@ ANIM_FURY_SWEEPES EQU $24
; Special animations
ANIM_SHOW_DAMAGE EQU $09
-ANIM_SHAKE1 EQU $fa
+ANIM_SHAKE1 EQU $fa
ANIM_SHAKE2 EQU $fb
-ANIM_SHAKE3 EQU $fc \ No newline at end of file
+ANIM_SHAKE3 EQU $fc
diff --git a/src/constants/deck_ai_constants.asm b/src/constants/deck_ai_constants.asm
index ceae8ed..a0b87f7 100644
--- a/src/constants/deck_ai_constants.asm
+++ b/src/constants/deck_ai_constants.asm
@@ -1,61 +1,61 @@
-; wPreviousAIFlags and wCurrentAIFlags constants
-AI_FLAG_USED_PLUSPOWER EQU 1 << 0
-AI_FLAG_USED_SWITCH EQU 1 << 1
-AI_FLAG_USED_PROFESSOR_OAK EQU 1 << 2
-AI_FLAG_MODIFIED_HAND EQU 1 << 3
-AI_FLAG_USED_GUST_OF_WIND EQU 1 << 4
-
-; used as input for AIProcessEnergyCards to determine what to check
-; and whether to play card after the routine is over.
-; I suspect AI_ENERGY_FLAG_DONT_PLAY to be a flag to signal the routine
-; not to actually play the energy card after it's finished,
-; but AIProcessEnergyCards checks whether ANY flag is set in order
-; to decide not to play it, so it's redundant in the presence of another flag.
-AI_ENERGY_FLAG_DONT_PLAY EQU 1 << 0 ; whether to play energy card (?)
-AI_ENERGY_FLAG_SKIP_EVOLUTION EQU 1 << 1 ; whether to check if card has evolutions
-AI_ENERGY_FLAG_SKIP_ARENA_CARD EQU 1 << 7 ; whether to include Arena card in determining which card to attach energy
-
-; used to determine which Trainer cards for AI
-; to process in AIProcessHandTrainerCards.
-; these go in chronological order, except for
-; AI_TRAINER_CARD_PHASE_14 which happens just before AI attacks.
-; AI_TRAINER_CARD_PHASE_15 is reserved for Professor Oak card.
-; if Professor Oak is played, all other Trainer card phases
-; are processed again except AI_TRAINER_CARD_PHASE_15.
- const_def 1
- const AI_TRAINER_CARD_PHASE_01 ; $1
- const AI_TRAINER_CARD_PHASE_02 ; $2
- const AI_TRAINER_CARD_PHASE_03 ; $3
- const AI_TRAINER_CARD_PHASE_04 ; $4
- const AI_TRAINER_CARD_PHASE_05 ; $5
- const AI_TRAINER_CARD_PHASE_06 ; $6
- const AI_TRAINER_CARD_PHASE_07 ; $7
- const AI_TRAINER_CARD_PHASE_08 ; $8
- const AI_TRAINER_CARD_PHASE_09 ; $9
- const AI_TRAINER_CARD_PHASE_10 ; $a
- const AI_TRAINER_CARD_PHASE_11 ; $b
- const AI_TRAINER_CARD_PHASE_12 ; $c
- const AI_TRAINER_CARD_PHASE_13 ; $d
- const AI_TRAINER_CARD_PHASE_14 ; $e, just before attack
- const AI_TRAINER_CARD_PHASE_15 ; $f, for Professor Oak
-
-; used by wAIBarrierFlagCounter to determine
-; whether Player is running Mewtwo1 mill deck.
-; flag set means true, flag not set means false.
-AI_FLAG_MEWTWO_MILL EQU 1 << 7
-
-; defines the behaviour of HandleAIEnergyTrans, for determining
-; whether to move energy cards from the Bench to the Arena or vice-versa
-; and the number of energy cards needed for achieving that.
-AI_ENERGY_TRANS_RETREAT EQU $9 ; moves energy cards needed for Retreat Cost
-AI_ENERGY_TRANS_ATTACK EQU $d ; moves energy cards needed for second attack
-AI_ENERGY_TRANS_TO_BENCH EQU $e ; moves energy cards away from Arena card
-
-; used to know which AI routine to call in
-; the AIAction pointer tables in AIDoAction
- const_def 1
- const AIACTION_DO_TURN ; $1
- const AIACTION_START_DUEL ; $2
- const AIACTION_FORCED_SWITCH ; $3
- const AIACTION_KO_SWITCH ; $4
- const AIACTION_TAKE_PRIZE ; $5
+; wPreviousAIFlags and wCurrentAIFlags constants
+AI_FLAG_USED_PLUSPOWER EQU 1 << 0
+AI_FLAG_USED_SWITCH EQU 1 << 1
+AI_FLAG_USED_PROFESSOR_OAK EQU 1 << 2
+AI_FLAG_MODIFIED_HAND EQU 1 << 3
+AI_FLAG_USED_GUST_OF_WIND EQU 1 << 4
+
+; used as input for AIProcessEnergyCards to determine what to check
+; and whether to play card after the routine is over.
+; I suspect AI_ENERGY_FLAG_DONT_PLAY to be a flag to signal the routine
+; not to actually play the energy card after it's finished,
+; but AIProcessEnergyCards checks whether ANY flag is set in order
+; to decide not to play it, so it's redundant in the presence of another flag.
+AI_ENERGY_FLAG_DONT_PLAY EQU 1 << 0 ; whether to play energy card (?)
+AI_ENERGY_FLAG_SKIP_EVOLUTION EQU 1 << 1 ; whether to check if card has evolutions
+AI_ENERGY_FLAG_SKIP_ARENA_CARD EQU 1 << 7 ; whether to include Arena card in determining which card to attach energy
+
+; used to determine which Trainer cards for AI
+; to process in AIProcessHandTrainerCards.
+; these go in chronological order, except for
+; AI_TRAINER_CARD_PHASE_14 which happens just before AI attacks.
+; AI_TRAINER_CARD_PHASE_15 is reserved for Professor Oak card.
+; if Professor Oak is played, all other Trainer card phases
+; are processed again except AI_TRAINER_CARD_PHASE_15.
+ const_def 1
+ const AI_TRAINER_CARD_PHASE_01 ; $1
+ const AI_TRAINER_CARD_PHASE_02 ; $2
+ const AI_TRAINER_CARD_PHASE_03 ; $3
+ const AI_TRAINER_CARD_PHASE_04 ; $4
+ const AI_TRAINER_CARD_PHASE_05 ; $5
+ const AI_TRAINER_CARD_PHASE_06 ; $6
+ const AI_TRAINER_CARD_PHASE_07 ; $7
+ const AI_TRAINER_CARD_PHASE_08 ; $8
+ const AI_TRAINER_CARD_PHASE_09 ; $9
+ const AI_TRAINER_CARD_PHASE_10 ; $a
+ const AI_TRAINER_CARD_PHASE_11 ; $b
+ const AI_TRAINER_CARD_PHASE_12 ; $c
+ const AI_TRAINER_CARD_PHASE_13 ; $d
+ const AI_TRAINER_CARD_PHASE_14 ; $e, just before attack
+ const AI_TRAINER_CARD_PHASE_15 ; $f, for Professor Oak
+
+; used by wAIBarrierFlagCounter to determine
+; whether Player is running Mewtwo1 mill deck.
+; flag set means true, flag not set means false.
+AI_FLAG_MEWTWO_MILL EQU 1 << 7
+
+; defines the behaviour of HandleAIEnergyTrans, for determining
+; whether to move energy cards from the Bench to the Arena or vice-versa
+; and the number of energy cards needed for achieving that.
+AI_ENERGY_TRANS_RETREAT EQU $9 ; moves energy cards needed for Retreat Cost
+AI_ENERGY_TRANS_ATTACK EQU $d ; moves energy cards needed for second attack
+AI_ENERGY_TRANS_TO_BENCH EQU $e ; moves energy cards away from Arena card
+
+; used to know which AI routine to call in
+; the AIAction pointer tables in AIDoAction
+ const_def 1
+ const AIACTION_DO_TURN ; $1
+ const AIACTION_START_DUEL ; $2
+ const AIACTION_FORCED_SWITCH ; $3
+ const AIACTION_KO_SWITCH ; $4
+ const AIACTION_TAKE_PRIZE ; $5
diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm
index 344cff1..928e78c 100644
--- a/src/constants/duel_constants.asm
+++ b/src/constants/duel_constants.asm
@@ -118,8 +118,15 @@ PARALYZED EQU $03
POISONED EQU $80
DOUBLE_POISONED EQU $c0
-CNF_SLP_PRZ EQU $0f ; confused, asleep or paralyzed
-PSN_DBLPSN EQU $f0 ; poisoned or double poisoned
+
+DOUBLE_POISONED_F EQU 6
+POISONED_F EQU 7
+
+
+CNF_SLP_PRZ EQU $0f ; confused, asleep or paralyzed
+PSN_DBLPSN EQU $f0 ; poisoned or double poisoned
+PSN_DAMAGE EQU 10
+DBLPSN_DAMAGE EQU 20
; substatus conditions (DUELVARS_ARENA_CARD_SUBSTATUS*)
@@ -227,9 +234,9 @@ EFFECT_FAILED_UNSUCCESSFUL EQU $02
; wAnimationQueue length
ANIMATION_QUEUE_LENGTH EQU 7
-PRIZES_1 EQU $01
-PRIZES_2 EQU $02
-PRIZES_3 EQU $03
-PRIZES_4 EQU $04
-PRIZES_5 EQU $05
-PRIZES_6 EQU $06
+PRIZES_1 EQU $01
+PRIZES_2 EQU $02
+PRIZES_3 EQU $03
+PRIZES_4 EQU $04
+PRIZES_5 EQU $05
+PRIZES_6 EQU $06
diff --git a/src/constants/name_constants.asm b/src/constants/name_constants.asm
index 7d4370c..7728cca 100644
--- a/src/constants/name_constants.asm
+++ b/src/constants/name_constants.asm
@@ -3,4 +3,4 @@ NAME_BUFFER_LENGTH EQU 16
MAX_PLAYER_NAME_LENGTH EQU 6 * 2
MAX_DECK_NAME_LENGTH EQU 20 * 1 ; note that its unit is byte!
-NAMING_SCREEN_BUFFER_LENGTH EQU 24 \ No newline at end of file
+NAMING_SCREEN_BUFFER_LENGTH EQU 24
diff --git a/src/constants/npc_constants.asm b/src/constants/npc_constants.asm
index eb7b75b..4a64993 100644
--- a/src/constants/npc_constants.asm
+++ b/src/constants/npc_constants.asm
@@ -18,19 +18,19 @@ LOADED_NPC_LENGTH EQU const_value
; npc_struct constants
const_def
- const NPC_TRAINER_ID
- const NPC_DATA_FIELD_01 ; 01-03 Seem to relate to sprites
- const NPC_DATA_FIELD_02
+ const NPC_DATA_ID
+ const NPC_DATA_SPRITE_ID
+ const NPC_DATA_FIELD_02 ; 02-04 Seem to relate to sprites
const NPC_DATA_FIELD_03
const NPC_DATA_FIELD_04
- const NPC_DATA_OWSEQUENCE_PTR
+ const NPC_DATA_SCRIPT_PTR
const_value = const_value+1
const NPC_DATA_NAME_TEXT
const_value = const_value+1
- const NPC_DATA_BATTLE_PICTURE
- const NPC_DATA_FIELD_0A
- const NPC_DATA_FIELD_0B
- const NPC_DATA_FIELD_0C
+ const NPC_DATA_DUELIST_PICTURE
+ const NPC_DATA_DECK_ID
+ const NPC_DATA_DUEL_THEME_ID
+ const NPC_DATA_MATCH_START_ID
NPC_DATA_LENGTH EQU const_value
const_def 1
@@ -81,8 +81,8 @@ NPC_DATA_LENGTH EQU const_value
const NPC_RONALD1 ; $02
const NPC_ISHIHARA ; $03
const NPC_IMAKUNI ; $04
-const_value = const_value+1 ; DRMASON duplicate
-const_value = const_value+1 ; DRMASON duplicate
+ const NPC_05 ; $05 (unused)
+ const NPC_06 ; $06 (unused)
const NPC_SAM ; $07
const NPC_TECH1 ; $08
const NPC_TECH2 ; $09
@@ -186,10 +186,9 @@ const_value = const_value+1 ; DRMASON duplicate
const NPC_LEGENDARY_CARD_BOTTOM_LEFT ; $6b
const NPC_LEGENDARY_CARD_BOTTOM_RIGHT ; $6c
const NPC_LEGENDARY_CARD_RIGHT_SPARK ; $6d
- const NPC_11F49 ; $6e
-const_value = const_value+1 ; NPC_11F49 duplicate
+ const NPC_6E ; $6e (unused)
+ const NPC_6F ; $6f (unused)
const NPC_MURRAY2 ; $70
const NPC_RONALD2 ; $71
const NPC_RONALD3 ; $72
-const_value = const_value+1 ; NPC_11f49 duplicate
-
+ const NPC_73 ; $73 (unused)
diff --git a/src/constants/sfx_constants.asm b/src/constants/sfx_constants.asm
index 4745260..0a99f25 100644
--- a/src/constants/sfx_constants.asm
+++ b/src/constants/sfx_constants.asm
@@ -95,4 +95,3 @@
const SFX_5D ; $5d
const SFX_5E ; $5e
const SFX_5F ; $5f
-
diff --git a/src/constants/sprite_constants.asm b/src/constants/sprite_constants.asm
index dc051d9..df7abd9 100644
--- a/src/constants/sprite_constants.asm
+++ b/src/constants/sprite_constants.asm
@@ -3,20 +3,71 @@ SPRITE_ANIM_BUFFER_CAPACITY EQU 16 ; sprites
; sprite_anim_struct constants
const_def
- const SPRITE_ANIM_FIELD_00
- const SPRITE_ANIM_FIELD_01
+ const SPRITE_ANIM_ENABLED
+ const SPRITE_ANIM_ATTRIBUTES
const SPRITE_ANIM_COORD_X
const SPRITE_ANIM_COORD_Y
const SPRITE_ANIM_TILE_ID
- const SPRITE_ANIM_FIELD_05
- const SPRITE_ANIM_FIELD_06
- const SPRITE_ANIM_FIELD_07
- const SPRITE_ANIM_FIELD_08
- const SPRITE_ANIM_FIELD_09
- const SPRITE_ANIM_FIELD_0A
- const SPRITE_ANIM_FIELD_0B
- const SPRITE_ANIM_FIELD_0C
- const SPRITE_ANIM_FIELD_0D
- const SPRITE_ANIM_MOVEMENT_COUNTER
- const SPRITE_ANIM_FIELD_0F
+ const SPRITE_ANIM_ID
+ const SPRITE_ANIM_BANK
+ const SPRITE_ANIM_POINTER
+const_value = const_value+1 ; pointer
+ const SPRITE_ANIM_FRAME_OFFSET_POINTER
+const_value = const_value+1 ; pointer
+ const SPRITE_ANIM_FRAME_BANK
+ const SPRITE_ANIM_FRAME_DATA_POINTER
+const_value = const_value+1 ; pointer
+ const SPRITE_ANIM_COUNTER
+ const SPRITE_ANIM_FLAGS
SPRITE_ANIM_LENGTH EQU const_value
+
+; SPRITE_ANIM_FLAGS values
+ const_def
+ const SPRITE_ANIM_FLAG_X_SUBTRACT
+ const SPRITE_ANIM_FLAG_Y_SUBTRACT
+ const SPRITE_ANIM_FLAG_SPEED
+ const SPRITE_ANIM_FLAG_3
+ const SPRITE_ANIM_FLAG_4
+ const SPRITE_ANIM_FLAG_5
+ const SPRITE_ANIM_FLAG_6
+ const SPRITE_ANIM_FLAG_SKIP_DRAW
+
+SPRITE_FRAME_OFFSET_SIZE EQU 4
+
+ const_def 1
+ const SPRITE_RONALD ; $01
+ const SPRITE_DRMASON ; $02
+ const SPRITE_ISHIHARA ; $03
+ const SPRITE_IMAKUNI ; $04
+ const SPRITE_NIKKI ; $05
+ const SPRITE_RICK ; $06
+ const SPRITE_KEN ; $07
+ const SPRITE_AMY ; $08
+ const SPRITE_ISAAC ; $09
+ const SPRITE_MITCH ; $0A
+ const SPRITE_GENE ; $0B
+ const SPRITE_MURRAY ; $0C
+ const SPRITE_COURTNEY ; $0D
+ const SPRITE_STEVE ; $0E
+ const SPRITE_JACK ; $0F
+ const SPRITE_ROD ; $10
+ const SPRITE_BOY1 ; $11
+ const SPRITE_BOY2 ; $12
+ const SPRITE_BOY3 ; $13
+ const SPRITE_BUTCH ; $14
+ const SPRITE_BOY4 ; $15
+ const SPRITE_JOSHUA ; $16
+ const SPRITE_BOY5 ; $17
+ const SPRITE_TECH ; $18
+ const SPRITE_CHAP ; $19
+ const SPRITE_GUIDE ; $1A
+ const SPRITE_PAPPY ; $1B
+ const SPRITE_GIRL1 ; $1C
+ const SPRITE_GIRL2 ; $1D
+ const SPRITE_GIRL3 ; $1E
+ const SPRITE_GIRL4 ; $1F
+ const SPRITE_GIRL5 ; $20
+ const SPRITE_CLERK ; $21
+ const SPRITE_HOST ; $22
+ const SPRITE_WOMAN ; $23
+ const SPRITE_GRANNY ; $24
diff --git a/src/data/deck_ai_pointers.asm b/src/data/deck_ai_pointers.asm
index 4f00299..ba8fab7 100644
--- a/src/data/deck_ai_pointers.asm
+++ b/src/data/deck_ai_pointers.asm
@@ -1,55 +1,55 @@
-DeckAIPointerTable: ; 14000 (05:4000)
- dw AIActionTable_SamPractice ; SAMS_PRACTICE_DECK
- dw AIActionTable_GeneralDecks ; PRACTICE_PLAYER_DECK
- dw AIActionTable_GeneralDecks ; SAMS_NORMAL_DECK
- dw AIActionTable_GeneralDecks ; CHARMANDER_AND_FRIENDS_DECK
- dw AIActionTable_GeneralDecks ; CHARMANDER_EXTRA_DECK
- dw AIActionTable_GeneralDecks ; SQUIRTLE_AND_FRIENDS_DECK
- dw AIActionTable_GeneralDecks ; SQUIRTLE_EXTRA_DECK
- dw AIActionTable_GeneralDecks ; BULBASAUR_AND_FRIENDS_DECK
- dw AIActionTable_GeneralDecks ; BULBASAUR_EXTRA_DECK
- dw AIActionTable_GeneralDecks ; LIGHTNING_AND_FIRE_DECK
- dw AIActionTable_GeneralDecks ; WATER_AND_FIGHTING_DECK
- dw AIActionTable_GeneralDecks ; GRASS_AND_PSYCHIC_DECK
- dw AIActionTable_LegendaryMoltres ; LEGENDARY_MOLTRES_DECK
- dw AIActionTable_LegendaryZapdos ; LEGENDARY_ZAPDOS_DECK
- dw AIActionTable_LegendaryArticuno ; LEGENDARY_ARTICUNO_DECK
- dw AIActionTable_LegendaryDragonite ; LEGENDARY_DRAGONITE_DECK
- dw AIActionTable_FirstStrike ; FIRST_STRIKE_DECK
- dw AIActionTable_RockCrusher ; ROCK_CRUSHER_DECK
- dw AIActionTable_GoGoRainDance ; GO_GO_RAIN_DANCE_DECK
- dw AIActionTable_ZappingSelfdestruct ; ZAPPING_SELFDESTRUCT_DECK
- dw AIActionTable_FlowerPower ; FLOWER_POWER_DECK
- dw AIActionTable_StrangePsyshock ; STRANGE_PSYSHOCK_DECK
- dw AIActionTable_WondersOfScience ; WONDERS_OF_SCIENCE_DECK
- dw AIActionTable_FireCharge ; FIRE_CHARGE_DECK
- dw AIActionTable_ImRonald ; IM_RONALD_DECK
- dw AIActionTable_PowerfulRonald ; POWERFUL_RONALD_DECK
- dw AIActionTable_InvincibleRonald ; INVINCIBLE_RONALD_DECK
- dw AIActionTable_LegendaryRonald ; LEGENDARY_RONALD_DECK
- dw AIActionTable_GeneralNoRetreat ; MUSCLES_FOR_BRAINS_DECK
- dw AIActionTable_GeneralDecks ; HEATED_BATTLE_DECK
- dw AIActionTable_GeneralDecks ; LOVE_TO_BATTLE_DECK
- dw AIActionTable_GeneralDecks ; EXCAVATION_DECK
- dw AIActionTable_GeneralDecks ; BLISTERING_POKEMON_DECK
- dw AIActionTable_GeneralDecks ; HARD_POKEMON_DECK
- dw AIActionTable_GeneralDecks ; WATERFRONT_POKEMON_DECK
- dw AIActionTable_GeneralDecks ; LONELY_FRIENDS_DECK
- dw AIActionTable_GeneralDecks ; SOUND_OF_THE_WAVES_DECK
- dw AIActionTable_GeneralDecks ; PIKACHU_DECK
- dw AIActionTable_GeneralDecks ; BOOM_BOOM_SELFDESTRUCT_DECK
- dw AIActionTable_GeneralDecks ; POWER_GENERATOR_DECK
- dw AIActionTable_GeneralDecks ; ETCETERA_DECK
- dw AIActionTable_GeneralDecks ; FLOWER_GARDEN_DECK
- dw AIActionTable_GeneralDecks ; KALEIDOSCOPE_DECK
- dw AIActionTable_GeneralDecks ; GHOST_DECK
- dw AIActionTable_GeneralDecks ; NAP_TIME_DECK
- dw AIActionTable_GeneralDecks ; STRANGE_POWER_DECK
- dw AIActionTable_GeneralDecks ; FLYIN_POKEMON_DECK
- dw AIActionTable_GeneralDecks ; LOVELY_NIDORAN_DECK
- dw AIActionTable_GeneralDecks ; POISON_DECK
- dw AIActionTable_GeneralDecks ; ANGER_DECK
- dw AIActionTable_GeneralDecks ; FLAMETHROWER_DECK
- dw AIActionTable_GeneralDecks ; RESHUFFLE_DECK
- dw AIActionTable_GeneralNoRetreat ; IMAKUNI_DECK
-; 1406a
+DeckAIPointerTable: ; 14000 (05:4000)
+ dw AIActionTable_SamPractice ; SAMS_PRACTICE_DECK
+ dw AIActionTable_GeneralDecks ; PRACTICE_PLAYER_DECK
+ dw AIActionTable_GeneralDecks ; SAMS_NORMAL_DECK
+ dw AIActionTable_GeneralDecks ; CHARMANDER_AND_FRIENDS_DECK
+ dw AIActionTable_GeneralDecks ; CHARMANDER_EXTRA_DECK
+ dw AIActionTable_GeneralDecks ; SQUIRTLE_AND_FRIENDS_DECK
+ dw AIActionTable_GeneralDecks ; SQUIRTLE_EXTRA_DECK
+ dw AIActionTable_GeneralDecks ; BULBASAUR_AND_FRIENDS_DECK
+ dw AIActionTable_GeneralDecks ; BULBASAUR_EXTRA_DECK
+ dw AIActionTable_GeneralDecks ; LIGHTNING_AND_FIRE_DECK
+ dw AIActionTable_GeneralDecks ; WATER_AND_FIGHTING_DECK
+ dw AIActionTable_GeneralDecks ; GRASS_AND_PSYCHIC_DECK
+ dw AIActionTable_LegendaryMoltres ; LEGENDARY_MOLTRES_DECK
+ dw AIActionTable_LegendaryZapdos ; LEGENDARY_ZAPDOS_DECK
+ dw AIActionTable_LegendaryArticuno ; LEGENDARY_ARTICUNO_DECK
+ dw AIActionTable_LegendaryDragonite ; LEGENDARY_DRAGONITE_DECK
+ dw AIActionTable_FirstStrike ; FIRST_STRIKE_DECK
+ dw AIActionTable_RockCrusher ; ROCK_CRUSHER_DECK
+ dw AIActionTable_GoGoRainDance ; GO_GO_RAIN_DANCE_DECK
+ dw AIActionTable_ZappingSelfdestruct ; ZAPPING_SELFDESTRUCT_DECK
+ dw AIActionTable_FlowerPower ; FLOWER_POWER_DECK
+ dw AIActionTable_StrangePsyshock ; STRANGE_PSYSHOCK_DECK
+ dw AIActionTable_WondersOfScience ; WONDERS_OF_SCIENCE_DECK
+ dw AIActionTable_FireCharge ; FIRE_CHARGE_DECK
+ dw AIActionTable_ImRonald ; IM_RONALD_DECK
+ dw AIActionTable_PowerfulRonald ; POWERFUL_RONALD_DECK
+ dw AIActionTable_InvincibleRonald ; INVINCIBLE_RONALD_DECK
+ dw AIActionTable_LegendaryRonald ; LEGENDARY_RONALD_DECK
+ dw AIActionTable_GeneralNoRetreat ; MUSCLES_FOR_BRAINS_DECK
+ dw AIActionTable_GeneralDecks ; HEATED_BATTLE_DECK
+ dw AIActionTable_GeneralDecks ; LOVE_TO_BATTLE_DECK
+ dw AIActionTable_GeneralDecks ; EXCAVATION_DECK
+ dw AIActionTable_GeneralDecks ; BLISTERING_POKEMON_DECK
+ dw AIActionTable_GeneralDecks ; HARD_POKEMON_DECK
+ dw AIActionTable_GeneralDecks ; WATERFRONT_POKEMON_DECK
+ dw AIActionTable_GeneralDecks ; LONELY_FRIENDS_DECK
+ dw AIActionTable_GeneralDecks ; SOUND_OF_THE_WAVES_DECK
+ dw AIActionTable_GeneralDecks ; PIKACHU_DECK
+ dw AIActionTable_GeneralDecks ; BOOM_BOOM_SELFDESTRUCT_DECK
+ dw AIActionTable_GeneralDecks ; POWER_GENERATOR_DECK
+ dw AIActionTable_GeneralDecks ; ETCETERA_DECK
+ dw AIActionTable_GeneralDecks ; FLOWER_GARDEN_DECK
+ dw AIActionTable_GeneralDecks ; KALEIDOSCOPE_DECK
+ dw AIActionTable_GeneralDecks ; GHOST_DECK
+ dw AIActionTable_GeneralDecks ; NAP_TIME_DECK
+ dw AIActionTable_GeneralDecks ; STRANGE_POWER_DECK
+ dw AIActionTable_GeneralDecks ; FLYIN_POKEMON_DECK
+ dw AIActionTable_GeneralDecks ; LOVELY_NIDORAN_DECK
+ dw AIActionTable_GeneralDecks ; POISON_DECK
+ dw AIActionTable_GeneralDecks ; ANGER_DECK
+ dw AIActionTable_GeneralDecks ; FLAMETHROWER_DECK
+ dw AIActionTable_GeneralDecks ; RESHUFFLE_DECK
+ dw AIActionTable_GeneralNoRetreat ; IMAKUNI_DECK
+; 1406a
diff --git a/src/data/map_objects.asm b/src/data/map_objects.asm
index 1ac73fa..4749a19 100644
--- a/src/data/map_objects.asm
+++ b/src/data/map_objects.asm
@@ -47,7 +47,7 @@ MasonLabObjects: ; 13b04 (3:7b04)
db $ff
-
+
DeckMachineRoomObjects: ; 13b4d (3:7b4d)
db NORTH, 2, 2
dw Script_d932
@@ -151,7 +151,7 @@ DeckMachineRoomObjects: ; 13b4d (3:7b4d)
db $ff
-
+
IshiharasHouseObjects: ; 13c02 (3:7c02)
db NORTH, 6, 2
dw PrintInteractableObjectText
@@ -215,7 +215,7 @@ IshiharasHouseObjects: ; 13c02 (3:7c02)
db $ff
-
+
FightingClubLobbyObjects: ; 13c6f (3:7c6f)
db NORTH, 20, 2
dw PrintInteractableObjectText
@@ -240,16 +240,16 @@ FightingClubLobbyObjects: ; 13c6f (3:7c6f)
db NORTH, 6, 6
dw Script_fc52
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db NORTH, 10, 6
dw Func_fc7a
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db $ff
-
+
RockClubLobbyObjects: ; 13ca6 (3:7ca6)
db NORTH, 20, 2
dw PrintInteractableObjectText
@@ -274,16 +274,16 @@ RockClubLobbyObjects: ; 13ca6 (3:7ca6)
db NORTH, 6, 6
dw Script_fc52
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db NORTH, 10, 6
dw Func_fc7a
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db $ff
-
+
WaterClubLobbyObjects: ; 13cdd (3:7cdd)
db NORTH, 20, 2
dw PrintInteractableObjectText
@@ -308,16 +308,16 @@ WaterClubLobbyObjects: ; 13cdd (3:7cdd)
db NORTH, 6, 6
dw Script_fc52
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db NORTH, 10, 6
dw Func_fc7a
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db $ff
-
+
LightningClubLobbyObjects: ; 13d14 (3:7d14)
db NORTH, 20, 2
dw PrintInteractableObjectText
@@ -342,16 +342,16 @@ LightningClubLobbyObjects: ; 13d14 (3:7d14)
db NORTH, 6, 6
dw Script_fc52
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db NORTH, 10, 6
dw Func_fc7a
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db $ff
-
+
GrassClubLobbyObjects: ; 13d4b (3:7d4b)
db NORTH, 20, 2
dw PrintInteractableObjectText
@@ -376,16 +376,16 @@ GrassClubLobbyObjects: ; 13d4b (3:7d4b)
db NORTH, 6, 6
dw Script_fc52
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db NORTH, 10, 6
dw Func_fc7a
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db $ff
-
+
PsychicClubLobbyObjects: ; 13d82 (3:7d82)
db NORTH, 20, 2
dw PrintInteractableObjectText
@@ -410,16 +410,16 @@ PsychicClubLobbyObjects: ; 13d82 (3:7d82)
db NORTH, 6, 6
dw Script_fc52
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db NORTH, 10, 6
dw Func_fc7a
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db $ff
-
+
ScienceClubLobbyObjects: ; 13db9 (3:7db9)
db NORTH, 20, 2
dw PrintInteractableObjectText
@@ -444,16 +444,16 @@ ScienceClubLobbyObjects: ; 13db9 (3:7db9)
db NORTH, 6, 6
dw Script_fc52
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db NORTH, 10, 6
dw Func_fc7a
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db $ff
-
+
FireClubLobbyObjects: ; 13df0 (3:7df0)
db NORTH, 20, 2
dw PrintInteractableObjectText
@@ -478,16 +478,16 @@ FireClubLobbyObjects: ; 13df0 (3:7df0)
db NORTH, 6, 6
dw Script_fc52
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db NORTH, 10, 6
dw Func_fc7a
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db $ff
-
+
ChallengeHallLobbyObjects: ; 13e27 (3:7e27)
db NORTH, 20, 2
dw PrintInteractableObjectText
@@ -512,16 +512,16 @@ ChallengeHallLobbyObjects: ; 13e27 (3:7e27)
db NORTH, 6, 6
dw Script_fc52
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db NORTH, 10, 6
dw Func_fc7a
tx Text041b
- tx Text03b0
+ tx ClerkNPCName
db $ff
-
+
PokemonDomeEntranceObjects: ; 13e5e (3:7e5e)
db NORTH, 2, 2
dw PrintInteractableObjectText
@@ -581,7 +581,7 @@ PokemonDomeEntranceObjects: ; 13e5e (3:7e5e)
db $ff
-
+
HallOfHonorObjects: ; 13ec2 (3:7ec2)
; Legendary Cards
db NORTH, 10, 10
@@ -606,5 +606,3 @@ HallOfHonorObjects: ; 13ec2 (3:7ec2)
tx Text041a
db $ff
-
-
diff --git a/src/data/move_animations.asm b/src/data/move_animations.asm
index c384cd8..f774afa 100644
--- a/src/data/move_animations.asm
+++ b/src/data/move_animations.asm
@@ -911,4 +911,4 @@ MoveAnimation_5668:
anim_end
MoveAnimation_5673:
- anim_end \ No newline at end of file
+ anim_end
diff --git a/src/data/npc_map_data.asm b/src/data/npc_map_data.asm
index bc09d07..7c01e72 100644
--- a/src/data/npc_map_data.asm
+++ b/src/data/npc_map_data.asm
@@ -416,4 +416,3 @@ HallOfHonorNPCS: ; 7adf (4:13adf)
db NPC_LEGENDARY_CARD_RIGHT_SPARK, $0e, $0a, SOUTH
dw $0000
db $00
-
diff --git a/src/data/npcs.asm b/src/data/npcs.asm
index 334fd85..7880a8b 100644
--- a/src/data/npcs.asm
+++ b/src/data/npcs.asm
@@ -1,1409 +1,1520 @@
; When you press the A button in front of something it will find a data entry somewhere on this list
; it will then jump to the pointer in the data item. All jumps lead to an RST20 operation.
; The Deck IDs are used for the challenge hall
-NPCDataTable:
- dw DrMasonData
- dw DrMasonData
- dw Ronald1Data
- dw IshiharaData
- dw ImakuniData
- dw DrMasonData
- dw DrMasonData
- dw SamData
- dw Tech1Data
- dw Tech2Data
- dw Tech3Data
- dw Tech4Data
- dw Tech5Data
- dw Tech6Data
- dw Clerk1Data
- dw Clerk2Data
- dw Clerk3Data
- dw Clerk4Data
- dw Clerk5Data
- dw Clerk6Data
- dw Clerk7Data
- dw Clerk8Data
- dw Clerk9Data
- dw ChrisData
- dw MichaelData
- dw JessicaData
- dw MitchData
- dw MatthewData
- dw RyanData
- dw AndrewData
- dw GeneData
- dw SaraData
- dw AmandaData
- dw JoshuaData
- dw AmyData
- dw JenniferData
- dw NicholasData
- dw BrandonData
- dw IsaacData
- dw BrittanyData
- dw KristinData
- dw HeatherData
- dw NikkiData
- dw RobertData
- dw DanielData
- dw StephanieData
- dw Murray1Data
- dw JosephData
- dw DavidData
- dw ErikData
- dw RickData
- dw JohnData
- dw AdamData
- dw JonathanData
- dw KenData
- dw CourtneyData
- dw SteveData
- dw JackData
- dw RodData
- dw Clerk10Data
- dw GiftCenterClerkData
- dw Man1Data
- dw Woman1Data
- dw Chap1Data
- dw Gal1Data
- dw Lass1Data
- dw Chap2Data
- dw Lass2Data
- dw Pappy1Data
- dw Lad1Data
- dw Lad2Data
- dw Chap3Data
- dw Clerk12Data
- dw Clerk13Data
- dw HostData
- dw Specs1Data
- dw ButchData
- dw Granny1Data
- dw Lass3Data
- dw Man2Data
- dw Pappy2Data
- dw Lass4Data
- dw Hood1Data
- dw Granny2Data
- dw Gal2Data
- dw Lad3Data
- dw Gal3Data
- dw Chap4Data
- dw Man3Data
- dw Specs2Data
- dw Specs3Data
- dw Woman2Data
- dw ManiaData
- dw Pappy3Data
- dw Gal4Data
- dw ChampData
- dw Hood2Data
- dw Lass5Data
- dw Chap5Data
- dw AaronData
- dw GuideData
- dw Tech7Data
- dw Tech8Data
- dw Data_11f18 ; these actually are used for the effects around the legendary cards
- dw Data_11f1f
- dw Data_11f26
- dw Data_11f2d
- dw Data_11f34
- dw Data_11f3b
- dw Data_11f42
- dw Data_11f49
- dw Data_11f49
- dw Murray2Data
- dw Ronald2Data
- dw Ronald3Data
- dw Data_11f49
-DrMasonData:
+NPCHeaderPointers:
+ dw DrMasonNPCHeader
+ dw DrMasonNPCHeader
+ dw Ronald1NPCHeader
+ dw IshiharaNPCHeader
+ dw ImakuniNPCHeader
+ dw DrMasonNPCHeader
+ dw DrMasonNPCHeader
+ dw SamNPCHeader
+ dw Tech1NPCHeader
+ dw Tech2NPCHeader
+ dw Tech3NPCHeader
+ dw Tech4NPCHeader
+ dw Tech5NPCHeader
+ dw Tech6NPCHeader
+ dw Clerk1NPCHeader
+ dw Clerk2NPCHeader
+ dw Clerk3NPCHeader
+ dw Clerk4NPCHeader
+ dw Clerk5NPCHeader
+ dw Clerk6NPCHeader
+ dw Clerk7NPCHeader
+ dw Clerk8NPCHeader
+ dw Clerk9NPCHeader
+ dw ChrisNPCHeader
+ dw MichaelNPCHeader
+ dw JessicaNPCHeader
+ dw MitchNPCHeader
+ dw MatthewNPCHeader
+ dw RyanNPCHeader
+ dw AndrewNPCHeader
+ dw GeneNPCHeader
+ dw SaraNPCHeader
+ dw AmandaNPCHeader
+ dw JoshuaNPCHeader
+ dw AmyNPCHeader
+ dw JenniferNPCHeader
+ dw NicholasNPCHeader
+ dw BrandonNPCHeader
+ dw IsaacNPCHeader
+ dw BrittanyNPCHeader
+ dw KristinNPCHeader
+ dw HeatherNPCHeader
+ dw NikkiNPCHeader
+ dw RobertNPCHeader
+ dw DanielNPCHeader
+ dw StephanieNPCHeader
+ dw Murray1NPCHeader
+ dw JosephNPCHeader
+ dw DavidNPCHeader
+ dw ErikNPCHeader
+ dw RickNPCHeader
+ dw JohnNPCHeader
+ dw AdamNPCHeader
+ dw JonathanNPCHeader
+ dw KenNPCHeader
+ dw CourtneyNPCHeader
+ dw SteveNPCHeader
+ dw JackNPCHeader
+ dw RodNPCHeader
+ dw Clerk10NPCHeader
+ dw GiftCenterClerkNPCHeader
+ dw Man1NPCHeader
+ dw Woman1NPCHeader
+ dw Chap1NPCHeader
+ dw Gal1NPCHeader
+ dw Lass1NPCHeader
+ dw Chap2NPCHeader
+ dw Lass2NPCHeader
+ dw Pappy1NPCHeader
+ dw Lad1NPCHeader
+ dw Lad2NPCHeader
+ dw Chap3NPCHeader
+ dw Clerk12NPCHeader
+ dw Clerk13NPCHeader
+ dw HostNPCHeader
+ dw Specs1NPCHeader
+ dw ButchNPCHeader
+ dw Granny1NPCHeader
+ dw Lass3NPCHeader
+ dw Man2NPCHeader
+ dw Pappy2NPCHeader
+ dw Lass4NPCHeader
+ dw Hood1NPCHeader
+ dw Granny2NPCHeader
+ dw Gal2NPCHeader
+ dw Lad3NPCHeader
+ dw Gal3NPCHeader
+ dw Chap4NPCHeader
+ dw Man3NPCHeader
+ dw Specs2NPCHeader
+ dw Specs3NPCHeader
+ dw Woman2NPCHeader
+ dw ManiaNPCHeader
+ dw Pappy3NPCHeader
+ dw Gal4NPCHeader
+ dw ChampNPCHeader
+ dw Hood2NPCHeader
+ dw Lass5NPCHeader
+ dw Chap5NPCHeader
+ dw AaronNPCHeader
+ dw GuideNPCHeader
+ dw Tech7NPCHeader
+ dw Tech8NPCHeader
+ dw TorchNPCHeader
+ dw LegendaryCardTopLeftNPCHeader
+ dw LegendaryCardTopRightNPCHeader
+ dw LegendaryCardLeftSparkNPCHeader
+ dw LegendaryCardBottomLeftNPCHeader
+ dw LegendaryCardBottomRightNPCHeader
+ dw LegendaryCardRightSparkNPCHeader
+ dw DummyNPCHeader
+ dw DummyNPCHeader
+ dw Murray2NPCHeader
+ dw Ronald2NPCHeader
+ dw Ronald3NPCHeader
+ dw DummyNPCHeader
+
+DrMasonNPCHeader:
db NPC_DRMASON
- db $02
+ db SPRITE_DRMASON
db $00
- db $26
+ db $26 ; palette and animation
db $00
- dw $5727 ; Pointer to Script
- tx Text03ac
+ dw Script_DrMason
+ tx DrMasonNPCName
db $00
db $00
db $00
db $00
-Ronald1Data:
+
+Ronald1NPCHeader:
db NPC_RONALD1
- db $01
+ db SPRITE_RONALD
db $04
db $0e
db $00
- dw Script_Ronald ; Pointer to Script
- tx Text03ad
+ dw Script_Ronald
+ tx RonaldNPCName
db RONALD_PIC
db INVINCIBLE_RONALD_DECK_ID
- db $0f
- db $16
-Ronald2Data:
+ db MUSIC_RONALD
+ db MUSIC_MATCH_START_2
+
+Ronald2NPCHeader:
db NPC_RONALD2
- db $01
+ db SPRITE_RONALD
db $04
db $0e
db $00
- dw Script_Ronald ; Pointer to Script
- tx Text03ad
+ dw Script_Ronald
+ tx RonaldNPCName
db RONALD_PIC
db INVINCIBLE_RONALD_DECK_ID
- db $0f
- db $16
-Ronald3Data:
+ db MUSIC_RONALD
+ db MUSIC_MATCH_START_2
+
+Ronald3NPCHeader:
db NPC_RONALD3
- db $01
+ db SPRITE_RONALD
db $04
db $0e
db $00
- dw Script_Ronald ; Pointer to Script
- tx Text03ad
+ dw Script_Ronald
+ tx RonaldNPCName
db RONALD_PIC
db INVINCIBLE_RONALD_DECK_ID
- db $0f
- db $16
-IshiharaData:
+ db MUSIC_RONALD
+ db MUSIC_MATCH_START_2
+
+IshiharaNPCHeader:
db NPC_ISHIHARA
- db $03
+ db SPRITE_ISHIHARA
db $04
db $22
db $00
- dw Script_Ishihara ; Pointer to Script
- tx Text03ae
+ dw Script_Ishihara
+ tx IshiharaNPCName
db $00
db $00
db $00
db $00
-ImakuniData:
+
+ImakuniNPCHeader:
db NPC_IMAKUNI
- db $04
+ db SPRITE_IMAKUNI
db $00
db $0e
db $00
- dw Script_Imakuni ; Pointer to Script
- tx Text03af
+ dw Script_Imakuni
+ tx ImakuniNPCName
db IMAKUNI_PIC
db IMAKUNI_DECK_ID
- db $10
- db $15
-SamData:
+ db MUSIC_IMAKUNI
+ db MUSIC_MATCH_START_1
+
+SamNPCHeader:
db NPC_SAM
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $561d ; Pointer to Script
- tx Text03b1
+ dw Script_Sam
+ tx SamNPCName
db SAM_PIC
db SAMS_NORMAL_DECK_ID
- db $02
- db $15
-Tech1Data:
+ db MUSIC_DUEL_THEME_1
+ db MUSIC_MATCH_START_1
+
+Tech1NPCHeader:
db NPC_TECH1
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $5583 ; Pointer to Script
- tx Text03b2
+ dw Script_Tech1
+ tx TechNPCName
db $00
db $00
db $00
db $00
-Tech2Data:
+
+Tech2NPCHeader:
db NPC_TECH2
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $55ca ; Pointer to Script
- tx Text03b2
+ dw Script_Tech2
+ tx TechNPCName
db $00
db $00
db $00
db $00
-Tech3Data:
+
+Tech3NPCHeader:
db NPC_TECH3
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $55d5 ; Pointer to Script
- tx Text03b2
+ dw Script_Tech3
+ tx TechNPCName
db $00
db $00
db $00
db $00
-Tech4Data:
+
+Tech4NPCHeader:
db NPC_TECH4
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $55e0 ; Pointer to Script
- tx Text03b2
+ dw Script_Tech4
+ tx TechNPCName
db $00
db $00
db $00
db $00
-Tech5Data:
+
+Tech5NPCHeader:
db NPC_TECH5
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $55f9 ; Pointer to Script
- tx Text03b2
+ dw Script_Tech5
+ tx TechNPCName
db $00
db $00
db $00
db $00
-Tech6Data:
+
+Tech6NPCHeader:
db NPC_TECH6
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $58bb ; Pointer to Script
- tx Text03b2
+ dw Script_Tech6
+ tx TechNPCName
db $00
db $00
db $00
db $00
-Clerk1Data:
+
+Clerk1NPCHeader:
db NPC_CLERK1
- db $21
+ db SPRITE_CLERK
db $0a
db $30
db $00
- dw Script_Clerk1 ; Pointer to Script
- tx Text03b3
+ dw Script_Clerk1
+ tx ClerkNPCName2
db $00
db $00
db $00
db $00
-Clerk2Data:
+
+Clerk2NPCHeader:
db NPC_CLERK2
- db $21
+ db SPRITE_CLERK
db $0a
db $30
db $00
- dw $5ed1 ; Pointer to Script
- tx Text03b3
+ dw Script_Clerk2
+ tx ClerkNPCName2
db $00
db $00
db $00
db $00
-Clerk3Data:
+
+Clerk3NPCHeader:
db NPC_CLERK3
- db $21
+ db SPRITE_CLERK
db $0a
db $30
db $00
- dw $609e ; Pointer to Script
- tx Text03b3
+ dw Script_Clerk3
+ tx ClerkNPCName2
db $00
db $00
db $00
db $00
-Clerk4Data:
+
+Clerk4NPCHeader:
db NPC_CLERK4
- db $21
+ db SPRITE_CLERK
db $0a
db $30
db $00
- dw $6369 ; Pointer to Script
- tx Text03b3
+ dw Script_Clerk4
+ tx ClerkNPCName2
db $00
db $00
db $00
db $00
-Clerk5Data:
+
+Clerk5NPCHeader:
db NPC_CLERK5
- db $21
+ db SPRITE_CLERK
db $0a
db $30
db $00
- dw $6566 ; Pointer to Script
- tx Text03b3
+ dw Script_Clerk5
+ tx ClerkNPCName2
db $00
db $00
db $00
db $00
-Clerk6Data:
+
+Clerk6NPCHeader:
db NPC_CLERK6
- db $21
+ db SPRITE_CLERK
db $0a
db $30
db $00
- dw $684c ; Pointer to Script
- tx Text03b3
+ dw Script_Clerk6
+ tx ClerkNPCName2
db $00
db $00
db $00
db $00
-Clerk7Data:
+
+Clerk7NPCHeader:
db NPC_CLERK7
- db $21
+ db SPRITE_CLERK
db $0a
db $30
db $00
- dw $6b53 ; Pointer to Script
- tx Text03b3
+ dw Script_Clerk7
+ tx ClerkNPCName2
db $00
db $00
db $00
db $00
-Clerk8Data:
+
+Clerk8NPCHeader:
db NPC_CLERK8
- db $21
+ db SPRITE_CLERK
db $0a
db $30
db $00
- dw $6d45 ; Pointer to Script
- tx Text03b3
+ dw Script_Clerk8
+ tx ClerkNPCName2
db $00
db $00
db $00
db $00
-Clerk9Data:
+
+Clerk9NPCHeader:
db NPC_CLERK9
- db $21
+ db SPRITE_CLERK
db $0a
db $30
db $00
- dw Script_Clerk9 ; Pointer to Script
- tx Text03b3
+ dw Script_Clerk9
+ tx ClerkNPCName2
db $00
db $00
db $00
db $00
-ChrisData:
+
+ChrisNPCHeader:
db NPC_CHRIS
- db $15
+ db SPRITE_BOY4
db $00
db $26
db $00
- dw $5ef2 ; Pointer to Script
- tx Text03b4
+ dw Script_Chris
+ tx ChrisNPCName
db CHRIS_PIC
db MUSCLES_FOR_BRAINS_DECK_ID
- db $03
- db $15
-MichaelData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+MichaelNPCHeader:
db NPC_MICHAEL
- db $15
+ db SPRITE_BOY4
db $00
db $26
db $00
- dw $6573 ; Pointer to Script
- tx Text03b5
+ dw Script_Michael
+ tx MichaelNPCName
db MICHAEL_PIC
db HEATED_BATTLE_DECK_ID
- db $03
- db $15
-JessicaData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+JessicaNPCHeader:
db NPC_JESSICA
- db $1f
+ db SPRITE_GIRL4
db $04
db $1a
db $00
- dw $6d96 ; Pointer to Script
- tx Text03b6
+ dw Script_Jessica
+ tx JessicaNPCName
db JESSICA_PIC
db LOVE_TO_BATTLE_DECK_ID
- db $03
- db $15
-MitchData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+MitchNPCHeader:
db NPC_MITCH
- db $0a
+ db SPRITE_MITCH
db $00
db $0e
db $00
- dw Script_Mitch ; Pointer to Script
- tx Text03b7
+ dw Script_Mitch
+ tx MitchNPCName
db MITCH_PIC
db FIRST_STRIKE_DECK_ID
- db $03
- db $16
-MatthewData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_2
+
+MatthewNPCHeader:
db NPC_MATTHEW
- db $15
+ db SPRITE_BOY4
db $00
db $16
db $00
- dw $5f39 ; Pointer to Script
- tx Text03b8
+ dw Script_Matthew
+ tx MatthewNPCName
db MATTHEW_PIC
db HARD_POKEMON_DECK_ID
- db $03
- db $15
-RyanData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+RyanNPCHeader:
db NPC_RYAN
- db $11
+ db SPRITE_BOY1
db $00
db $26
db $00
- dw $5ff0 ; Pointer to Script
- tx Text03b9
+ dw Script_Ryan
+ tx RyanNPCName
db RYAN_PIC
db EXCAVATION_DECK_ID
- db $03
- db $15
-AndrewData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+AndrewNPCHeader:
db NPC_ANDREW
- db $1a
+ db SPRITE_GUIDE
db $00
db $16
db $00
- dw $6017 ; Pointer to Script
- tx Text03ba
+ dw Script_Andrew
+ tx AndrewNPCName
db ANDREW_PIC
db BLISTERING_POKEMON_DECK_ID
- db $03
- db $15
-GeneData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+GeneNPCHeader:
db NPC_GENE
- db $0b
+ db SPRITE_GENE
db $04
db $1e
db $00
- dw $603e ; Pointer to Script
- tx Text03bb
+ dw Script_Gene
+ tx GeneNPCName
db GENE_PIC
db ROCK_CRUSHER_DECK_ID
- db $03
- db $16
-SaraData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_2
+
+SaraNPCHeader:
db NPC_SARA
- db $20
+ db SPRITE_GIRL5
db $00
db $0e
db $00
- dw Script_Sara ; Pointer to Script
- tx Text03bc
+ dw Script_Sara
+ tx SaraNPCName
db SARA_PIC
db WATERFRONT_POKEMON_DECK_ID
- db $03
- db $15
-AmandaData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+AmandaNPCHeader:
db NPC_AMANDA
- db $20
+ db SPRITE_GIRL5
db $00
db $16
db $00
- dw Script_Amanda ; Pointer to Script
- tx Text03bd
- db AMANDA_PIC ; battle profile picture
+ dw Script_Amanda
+ tx AmandaNPCName
+ db AMANDA_PIC
db LONELY_FRIENDS_DECK_ID
- db $03
- db $15
-JoshuaData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+JoshuaNPCHeader:
db NPC_JOSHUA
- db $16
+ db SPRITE_JOSHUA
db $00
db $26
db $00
- dw Script_Joshua ; Pointer to Script
- tx Text03be
+ dw Script_Joshua
+ tx JoshuaNPCName
db JOSHUA_PIC
db SOUND_OF_THE_WAVES_DECK_ID
- db $03
- db $15
-AmyData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+AmyNPCHeader:
db NPC_AMY
- db $08
+ db SPRITE_AMY
db $08
db $2e
db $10
- dw Script_Amy ; Pointer to Script
- tx Text03bf
+ dw Script_Amy
+ tx AmyNPCName
db AMY_PIC
db GO_GO_RAIN_DANCE_DECK_ID
- db $03
- db $16
-JenniferData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_2
+
+JenniferNPCHeader:
db NPC_JENNIFER
- db $1c
+ db SPRITE_GIRL1
db $04
db $0e
db $00
- dw $6408 ; Pointer to Script
- tx Text03c0
+ dw Script_Jennifer
+ tx JenniferNPCName
db JENNIFER_PIC
db PIKACHU_DECK_ID
- db $03
- db $15
-NicholasData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+NicholasNPCHeader:
db NPC_NICHOLAS
- db $17
+ db SPRITE_BOY5
db $04
db $1e
db $00
- dw $642f ; Pointer to Script
- tx Text03c1
+ dw Script_Nicholas
+ tx NicholasNPCName
db NICHOLAS_PIC
db BOOM_BOOM_SELFDESTRUCT_DECK_ID
- db $03
- db $15
-BrandonData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+BrandonNPCHeader:
db NPC_BRANDON
- db $17
+ db SPRITE_BOY5
db $04
db $1e
db $00
- dw $6456 ; Pointer to Script
- tx Text03c2
+ dw Script_Brandon
+ tx BrandonNPCName
db BRANDON_PIC
db POWER_GENERATOR_DECK_ID
- db $03
- db $15
-IsaacData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+IsaacNPCHeader:
db NPC_ISAAC
- db $09
+ db SPRITE_ISAAC
db $00
db $16
db $00
- dw $64ad ; Pointer to Script
- tx Text03c3
+ dw Script_Isaac
+ tx IsaacNPCName
db ISAAC_PIC
db ZAPPING_SELFDESTRUCT_DECK_ID
- db $03
- db $16
-BrittanyData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_2
+
+BrittanyNPCHeader:
db NPC_BRITTANY
- db $1c
+ db SPRITE_GIRL1
db $04
db $0e
db $00
- dw Script_Brittany ; Pointer to Script
- tx Text03c4
+ dw Script_Brittany
+ tx BrittanyNPCName
db BRITTANY_PIC
db ETCETERA_DECK_ID
- db $03
- db $15
-KristinData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+KristinNPCHeader:
db NPC_KRISTIN
- db $1e
+ db SPRITE_GIRL3
db $00
db $1e
db $00
- dw $6701 ; Pointer to Script
- tx Text03c5
+ dw Script_Kristin
+ tx KristinNPCName
db KRISTIN_PIC
db FLOWER_GARDEN_DECK_ID
- db $03
- db $15
-HeatherData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+HeatherNPCHeader:
db NPC_HEATHER
- db $1d
+ db SPRITE_GIRL2
db $04
db $22
db $00
- dw $6745 ; Pointer to Script
- tx Text03c6
+ dw Script_Heather
+ tx HeatherNPCName
db HEATHER_PIC
db KALEIDOSCOPE_DECK_ID
- db $03
- db $15
-NikkiData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+NikkiNPCHeader:
db NPC_NIKKI
- db $05
+ db SPRITE_NIKKI
db $00
db $1a
db $00
- dw $679e ; Pointer to Script
- tx Text03c7
+ dw Script_Nikki
+ tx NikkiNPCName
db NIKKI_PIC
db FLOWER_POWER_DECK_ID
- db $03
- db $16
-RobertData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_2
+
+RobertNPCHeader:
db NPC_ROBERT
- db $11
+ db SPRITE_BOY1
db $04
db $16
db $00
- dw $6980 ; Pointer to Script
- tx Text03c8
+ dw Script_Robert
+ tx RobertNPCName
db ROBERT_PIC
db GHOST_DECK_ID
- db $03
- db $15
-DanielData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+DanielNPCHeader:
db NPC_DANIEL
- db $12
+ db SPRITE_BOY2
db $04
db $1a
db $00
- dw $6a60 ; Pointer to Script
- tx Text03c9
+ dw Script_Daniel
+ tx DanielNPCName
db DANIEL_PIC
db NAP_TIME_DECK_ID
- db $03
- db $15
-StephanieData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+StephanieNPCHeader:
db NPC_STEPHANIE
- db $1c
+ db SPRITE_GIRL1
db $04
db $0e
db $00
- dw $6aa2 ; Pointer to Script
- tx Text03ca
+ dw Script_Stephanie
+ tx StephanieNPCName
db STEPHANIE_PIC
db STRANGE_POWER_DECK_ID
- db $03
- db $15
-Murray1Data:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+Murray1NPCHeader:
db NPC_MURRAY1
- db $0c
+ db SPRITE_MURRAY
db $00
db $12
db $00
- dw $6adf ; Pointer to Script
- tx Text03cb
+ dw Script_Murray1
+ tx MurrayNPCName
db MURRAY_PIC
db STRANGE_PSYSHOCK_DECK_ID
- db $03
- db $16
-Murray2Data:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_2
+
+Murray2NPCHeader:
db NPC_MURRAY2
- db $0c
+ db SPRITE_MURRAY
db $03
db $15
db $10
- dw $6adf ; Pointer to Script
- tx Text03cb
+ dw Script_Murray2
+ tx MurrayNPCName
db MURRAY_PIC
db STRANGE_PSYSHOCK_DECK_ID
- db $03
- db $16
-JosephData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_2
+
+JosephNPCHeader:
db NPC_JOSEPH
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $6cdb ; Pointer to Script
- tx Text03cc
+ dw Script_Joseph
+ tx JosephNPCName
db JOSEPH_PIC
db FLYIN_POKEMON_DECK_ID
- db $03
- db $15
-DavidData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+DavidNPCHeader:
db NPC_DAVID
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $6c11 ; Pointer to Script
- tx Text03cd
+ dw Script_David
+ tx DavidNPCName
db DAVID_PIC
db LOVELY_NIDORAN_DECK_ID
- db $03
- db $15
-ErikData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+ErikNPCHeader:
db NPC_ERIK
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $6c42 ; Pointer to Script
- tx Text03ce
+ dw Script_Erik
+ tx ErikNPCName
db ERIK_PIC
db POISON_DECK_ID
- db $03
- db $15
-RickData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+RickNPCHeader:
db NPC_RICK
- db $06
+ db SPRITE_RICK
db $00
db $0e
db $00
- dw $6c67 ; Pointer to Script
- tx Text03cf
+ dw Script_Rick
+ tx RickNPCName
db RICK_PIC
db WONDERS_OF_SCIENCE_DECK_ID
- db $03
- db $16
-JohnData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_2
+
+JohnNPCHeader:
db NPC_JOHN
- db $12
+ db SPRITE_BOY2
db $04
db $1a
db $00
- dw $6eb3 ; Pointer to Script
- tx Text03d0
+ dw Script_John
+ tx JohnNPCName
db JOHN_PIC
db ANGER_DECK_ID
- db $03
- db $15
-AdamData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+AdamNPCHeader:
db NPC_ADAM
- db $13
+ db SPRITE_BOY3
db $00
db $22
db $00
- dw $6ed8 ; Pointer to Script
- tx Text03d1
+ dw Script_Adam
+ tx AdamNPCName
db ADAM_PIC
db FLAMETHROWER_DECK_ID
- db $03
- db $15
-JonathanData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+JonathanNPCHeader:
db NPC_JONATHAN
- db $11
+ db SPRITE_BOY1
db $04
db $16
db $00
- dw $6efd ; Pointer to Script
- tx Text03d2
+ dw Script_Jonathan
+ tx JonathanNPCName
db JONATHAN_PIC
db RESHUFFLE_DECK_ID
- db $03
- db $15
-KenData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_1
+
+KenNPCHeader:
db NPC_KEN
- db $07
+ db SPRITE_KEN
db $04
db $1e
db $00
- dw Script_Ken ; Pointer to Script
- tx Text03d3
+ dw Script_Ken
+ tx KenNPCName
db KEN_PIC
db FIRE_CHARGE_DECK_ID
- db $03
- db $16
-CourtneyData:
+ db MUSIC_DUEL_THEME_2
+ db MUSIC_MATCH_START_2
+
+CourtneyNPCHeader:
db NPC_COURTNEY
- db $0d
+ db SPRITE_COURTNEY
db $00
db $12
db $00
- dw $771f ; Pointer to Script
- tx Text03d4
+ dw Script_Courtney
+ tx CourtneyNPCName
db COURTNEY_PIC
db LEGENDARY_MOLTRES_DECK_ID
- db $04
- db $17
-SteveData:
+ db MUSIC_DUEL_THEME_3
+ db MUSIC_MATCH_START_3
+
+SteveNPCHeader:
db NPC_STEVE
- db $0e
+ db SPRITE_STEVE
db $00
db $2a
db $00
- dw $772a ; Pointer to Script
- tx Text03d5
+ dw Script_Steve
+ tx SteveNPCName
db STEVE_PIC
db LEGENDARY_ZAPDOS_DECK_ID
- db $04
- db $17
-JackData:
+ db MUSIC_DUEL_THEME_3
+ db MUSIC_MATCH_START_3
+
+JackNPCHeader:
db NPC_JACK
- db $0f
+ db SPRITE_JACK
db $00
db $26
db $00
- dw $7735 ; Pointer to Script
- tx Text03d6
+ dw Script_Jack
+ tx JackNPCName
db JACK_PIC
db LEGENDARY_ARTICUNO_DECK_ID
- db $04
- db $17
-RodData:
+ db MUSIC_DUEL_THEME_3
+ db MUSIC_MATCH_START_3
+
+RodNPCHeader:
db NPC_ROD
- db $10
+ db SPRITE_ROD
db $00
db $0e
db $00
- dw $7740 ; Pointer to Script
- tx Text03d7
+ dw Script_Rod
+ tx RodNPCName
db ROD_PIC
db LEGENDARY_DRAGONITE_DECK_ID
- db $04
- db $17
-Clerk10Data:
+ db MUSIC_DUEL_THEME_3
+ db MUSIC_MATCH_START_3
+
+Clerk10NPCHeader:
db NPC_CLERK10
- db $21
+ db SPRITE_CLERK
db $0a
db $30
db $00
- dw NoOverworldSequence ; Pointer to Script
- tx Text03b0
+ dw Script_Clerk10
+ tx ClerkNPCName
db $00
db $00
db $00
db $00
-GiftCenterClerkData:
+
+GiftCenterClerkNPCHeader:
db NPC_GIFT_CENTER_CLERK
- db $21
+ db SPRITE_CLERK
db $0a
db $30
db $00
- dw NoOverworldSequence ; Pointer to Script
- tx Text03b0
+ dw Script_GiftCenterClerk
+ tx ClerkNPCName
db $00
db $00
db $00
db $00
-Man1Data:
+
+Man1NPCHeader:
db NPC_MAN1
- db $1a
+ db SPRITE_GUIDE
db $00
db $16
db $00
- dw $5c76 ; Pointer to Script
- tx Text03d8
+ dw Script_Man1
+ tx ManNPCName
db $00
db $00
db $00
db $00
-Woman1Data:
+
+Woman1NPCHeader:
db NPC_WOMAN1
- db $23
+ db SPRITE_WOMAN
db $04
db $1e
db $00
- dw $5f83 ; Pointer to Script
- tx Text03d9
+ dw Script_Woman1
+ tx WomanNPCName
db $00
db $00
db $00
db $00
-Chap1Data:
+
+Chap1NPCHeader:
db NPC_CHAP1
- db $19
+ db SPRITE_CHAP
db $00
db $1a
db $00
- dw $5fc0 ; Pointer to Script
- tx Text03da
+ dw Script_Chap1
+ tx ChapNPCName
db $00
db $00
db $00
db $00
-Gal1Data:
+
+Gal1NPCHeader:
db NPC_GAL1
- db $22
+ db SPRITE_HOST
db $00
db $16
db $00
- dw Script_Gal1 ; Pointer to Script
- tx Text03db
+ dw Script_Gal1
+ tx GalNPCName
db $00
db $00
db $00
db $00
-Lass1Data:
+
+Lass1NPCHeader:
db NPC_LASS1
- db $1e
+ db SPRITE_GIRL3
db $00
db $1e
db $00
- dw Script_Lass1 ; Pointer to Script
- tx Text03dc
+ dw Script_Lass1
+ tx LassNPCName
db $00
db $00
db $00
db $00
-Chap2Data:
+
+Chap2NPCHeader:
db NPC_CHAP2
- db $19
+ db SPRITE_CHAP
db $00
db $1a
db $00
- dw $639a ; Pointer to Script
- tx Text03da
+ dw Script_Chap2
+ tx ChapNPCName
db $00
db $00
db $00
db $00
-Lass2Data:
+
+Lass2NPCHeader:
db NPC_LASS2
- db $1e
+ db SPRITE_GIRL3
db $00
db $1e
db $00
- dw Script_e61f ; Pointer to Script
- tx Text03dc
+ dw Script_Lass2
+ tx LassNPCName
db $00
db $00
db $00
db $00
-Pappy1Data:
+
+Pappy1NPCHeader:
db NPC_PAPPY1
- db $1b
+ db SPRITE_PAPPY
db $00
db $22
db $00
- dw $69a5 ; Pointer to Script
- tx Text03dd
+ dw Script_Pappy1
+ tx PappyNPCName
db $00
db $00
db $00
db $00
-Lad1Data:
+
+Lad1NPCHeader:
db NPC_LAD1
- db $12
+ db SPRITE_BOY2
db $04
db $1a
db $00
- dw $6b84 ; Pointer to Script
- tx Text03de
+ dw Script_Lad1
+ tx LadNPCName
db $00
db $00
db $00
db $00
-Lad2Data:
+
+Lad2NPCHeader:
db NPC_LAD2
- db $11
+ db SPRITE_BOY1
db $04
db $16
db $00
- dw $6e2c ; Pointer to Script
- tx Text03de
+ dw Script_Lad2
+ tx LadNPCName
db $00
db $00
db $00
db $00
-Chap3Data:
+
+Chap3NPCHeader:
db NPC_CHAP3
- db $19
+ db SPRITE_CHAP
db $00
db $1a
db $00
- dw $6de8 ; Pointer to Script
- tx Text03da
+ dw Script_Chap3
+ tx ChapNPCName
db $00
db $00
db $00
db $00
-Clerk12Data:
+
+Clerk12NPCHeader:
db NPC_CLERK12
- db $22
+ db SPRITE_HOST
db $00
db $16
db $00
- dw Script_Clerk12 ; Pointer to Script
- tx Text03b3
+ dw Script_Clerk12
+ tx ClerkNPCName2
db $00
db $00
db $00
db $00
-Clerk13Data:
+
+Clerk13NPCHeader:
db NPC_CLERK13
- db $22
+ db SPRITE_HOST
db $00
db $16
db $00
- dw Script_Clerk13 ; Pointer to Script
- tx Text03b3
+ dw Script_Clerk13
+ tx ClerkNPCName2
db $00
db $00
db $00
db $00
-HostData:
+
+HostNPCHeader:
db NPC_HOST
- db $22
+ db SPRITE_HOST
db $00
db $16
db $00
- dw Script_HostStubbed ; Pointer to Script
- tx Text03df
+ dw Script_Host
+ tx HostNPCName
db $00
db $00
db $00
db $00
-Specs1Data:
+
+Specs1NPCHeader:
db NPC_SPECS1
- db $13
+ db SPRITE_BOY3
db $00
db $22
db $00
- dw $5d82 ; Pointer to Script
- tx Text03e0
+ dw Script_Specs1
+ tx SpecsNPCName
db $00
db $00
db $00
db $00
-ButchData:
+
+ButchNPCHeader:
db NPC_BUTCH
- db $14
+ db SPRITE_BUTCH
db $00
db $16
db $00
- dw $5d8d ; Pointer to Script
- tx Text03e1
+ dw Script_Butch
+ tx ButchNPCName
db $00
db $00
db $00
db $00
-Granny1Data:
+
+Granny1NPCHeader:
db NPC_GRANNY1
- db $24
+ db SPRITE_GRANNY
db $00
db $16
db $00
- dw $5d9f ; Pointer to Script
- tx Text03e5
+ dw Script_Granny1
+ tx GrannyNPCName
db $00
db $00
db $00
db $00
-Lass3Data:
+
+Lass3NPCHeader:
db NPC_LASS3
- db $1d
+ db SPRITE_GIRL2
db $04
db $22
db $00
- dw $5fd2 ; Pointer to Script
- tx Text03dc
+ dw Script_Lass3
+ tx LassNPCName
db $00
db $00
db $00
db $00
-Man2Data:
+
+Man2NPCHeader:
db NPC_MAN2
- db $1a
+ db SPRITE_GUIDE
db $00
db $16
db $00
- dw Script_Man2 ; Pointer to Script
- tx Text03d8
+ dw Script_Man2
+ tx ManNPCName
db $00
db $00
db $00
db $00
-Pappy2Data:
+
+Pappy2NPCHeader:
db NPC_PAPPY2
- db $1b
+ db SPRITE_PAPPY
db $00
db $22
db $00
- dw Script_Pappy2 ; Pointer to Script
- tx Text03dd
+ dw Script_Pappy2
+ tx PappyNPCName
db $00
db $00
db $00
db $00
-Lass4Data:
+
+Lass4NPCHeader:
db NPC_LASS4
- db $1d
+ db SPRITE_GIRL2
db $04
db $22
db $00
- dw $63d9 ; Pointer to Script
- tx Text03dc
+ dw Script_Lass4
+ tx LassNPCName
db $00
db $00
db $00
db $00
-Hood1Data:
+
+Hood1NPCHeader:
db NPC_HOOD1
- db $17
+ db SPRITE_BOY5
db $04
db $1e
db $00
- dw $63dd ; Pointer to Script
- tx Text03e2
+ dw Script_Hood1
+ tx HoodNPCName
db $00
db $00
db $00
db $00
-Granny2Data:
+
+Granny2NPCHeader:
db NPC_GRANNY2
- db $24
+ db SPRITE_GRANNY
db $00
db $16
db $00
- dw $66d8 ; Pointer to Script
- tx Text03e5
+ dw Script_Granny2
+ tx GrannyNPCName
db $00
db $00
db $00
db $00
-Gal2Data:
+
+Gal2NPCHeader:
db NPC_GAL2
- db $22
+ db SPRITE_HOST
db $00
db $16
db $00
- dw $66e3 ; Pointer to Script
- tx Text03db
+ dw Script_Gal2
+ tx GalNPCName
db $00
db $00
db $00
db $00
-Lad3Data:
+
+Lad3NPCHeader:
db NPC_LAD3
- db $12
+ db SPRITE_BOY2
db $04
db $1a
db $00
- dw $6850 ; Pointer to Script
- tx Text03de
+ dw Script_Lad3
+ tx LadNPCName
db $00
db $00
db $00
db $00
-Gal3Data:
+
+Gal3NPCHeader:
db NPC_GAL3
- db $22
+ db SPRITE_HOST
db $00
db $16
db $00
- dw $6a30 ; Pointer to Script
- tx Text03db
+ dw Script_Gal3
+ tx GalNPCName
db $00
db $00
db $00
db $00
-Chap4Data:
+
+Chap4NPCHeader:
db NPC_CHAP4
- db $19
+ db SPRITE_CHAP
db $00
db $1a
db $00
- dw $6a3b ; Pointer to Script
- tx Text03da
+ dw Script_Chap4
+ tx ChapNPCName
db $00
db $00
db $00
db $00
-Man3Data:
+
+Man3NPCHeader:
db NPC_MAN3
- db $1a
+ db SPRITE_GUIDE
db $00
db $16
db $00
- dw $6bc1 ; Pointer to Script
- tx Text03d8
+ dw Script_Man3
+ tx ManNPCName
db $00
db $00
db $00
db $00
-Specs2Data:
+
+Specs2NPCHeader:
db NPC_SPECS2
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $6bc5 ; Pointer to Script
- tx Text03e0
+ dw Script_Specs2
+ tx SpecsNPCName
db $00
db $00
db $00
db $00
-Specs3Data:
+
+Specs3NPCHeader:
db NPC_SPECS3
- db $13
+ db SPRITE_BOY3
db $00
db $22
db $00
- dw $6bed ; Pointer to Script
- tx Text03e0
+ dw Script_Specs3
+ tx SpecsNPCName
db $00
db $00
db $00
db $00
-Woman2Data:
+
+Woman2NPCHeader:
db NPC_WOMAN2
- db $23
+ db SPRITE_WOMAN
db $04
db $1e
db $00
- dw NoOverworldSequence ; Pointer to Script
- tx Text03d9
+ dw Script_Woman2
+ tx WomanNPCName
db $00
db $00
db $00
db $00
-ManiaData:
+
+ManiaNPCHeader:
db NPC_MANIA
- db $15
+ db SPRITE_BOY4
db $00
db $26
db $00
- dw $6e88 ; Pointer to Script
- tx Text03e4
+ dw Script_Mania
+ tx ManiaNPCName
db $00
db $00
db $00
db $00
-Pappy3Data:
+
+Pappy3NPCHeader:
db NPC_PAPPY3
- db $1b
+ db SPRITE_PAPPY
db $00
db $22
db $00
- dw Script_Pappy3 ; Pointer to Script
- tx Text03dd
+ dw Script_Pappy3
+ tx PappyNPCName
db $00
db $00
db $00
db $00
-Gal4Data:
+
+Gal4NPCHeader:
db NPC_GAL4
- db $22
+ db SPRITE_HOST
db $00
db $16
db $00
- dw Script_Gal4 ; Pointer to Script
- tx Text03db
+ dw Script_Gal4
+ tx GalNPCName
db $00
db $00
db $00
db $00
-ChampData:
+
+ChampNPCHeader:
db NPC_CHAMP
- db $15
+ db SPRITE_BOY4
db $00
db $26
db $00
- dw Script_Champ ; Pointer to Script
- tx Text03e3
+ dw Script_Champ
+ tx ChampNPCName
db $00
db $00
db $00
db $00
-Hood2Data:
+
+Hood2NPCHeader:
db NPC_HOOD2
- db $17
+ db SPRITE_BOY5
db $04
db $1e
db $00
- dw Script_Hood2 ; Pointer to Script
- tx Text03e2
+ dw Script_Hood2
+ tx HoodNPCName
db $00
db $00
db $00
db $00
-Lass5Data:
+
+Lass5NPCHeader:
db NPC_LASS5
- db $1f
+ db SPRITE_GIRL4
db $04
db $1a
db $00
- dw Script_Lass5 ; Pointer to Script
- tx Text03dc
+ dw Script_Lass5
+ tx LassNPCName
db $00
db $00
db $00
db $00
-Chap5Data:
+
+Chap5NPCHeader:
db NPC_CHAP5
- db $19
+ db SPRITE_CHAP
db $00
db $1a
db $00
- dw Script_Chap5 ; Pointer to Script
- tx Text03da
+ dw Script_Chap5
+ tx ChapNPCName
db $00
db $00
db $00
db $00
-AaronData:
+
+AaronNPCHeader:
db NPC_AARON
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $58dd ; Pointer to Script
- tx Text03e7
+ dw Script_Aaron
+ tx AaronNPCName
db AARON_PIC
db LIGHTNING_AND_FIRE_DECK_ID
- db $02
- db $15
-GuideData:
+ db MUSIC_DUEL_THEME_1
+ db MUSIC_MATCH_START_1
+
+GuideNPCHeader:
db NPC_GUIDE
- db $1a
+ db SPRITE_GUIDE
db $00
db $16
db $00
- dw Script_Guide ; Pointer to Script
- tx Text03e6
+ dw Script_Guide
+ tx GuideNPCName
db $00
db $00
db $00
db $00
-Tech7Data:
+
+Tech7NPCHeader:
db NPC_TECH7
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $58c6 ; Pointer to Script
- tx Text03b2
+ dw Script_Tech7
+ tx TechNPCName
db $00
db $00
db $00
db $00
-Tech8Data:
+
+Tech8NPCHeader:
db NPC_TECH8
- db $18
+ db SPRITE_TECH
db $00
db $0e
db $00
- dw $58d1 ; Pointer to Script
- tx Text03b2
+ dw Script_Tech8
+ tx TechNPCName
db $00
db $00
db $00
db $00
-Data_11f18:
+
+TorchNPCHeader:
db NPC_TORCH
db $26
db $3a
db $3a
db $10
- dw NoOverworldSequence ; Pointer to Script
-Data_11f1f:
+ dw Script_Torch
+
+LegendaryCardTopLeftNPCHeader:
db NPC_LEGENDARY_CARD_TOP_LEFT
db $27
db $3b
db $41
db $50
- dw NoOverworldSequence ; Pointer to Script
-Data_11f26:
+ dw Script_LegendaryCardTopLeft
+
+LegendaryCardTopRightNPCHeader:
db NPC_LEGENDARY_CARD_TOP_RIGHT
db $27
db $3c
db $42
db $50
- dw NoOverworldSequence ; Pointer to Script
-Data_11f2d:
+ dw Script_LegendaryCardTopRight
+
+LegendaryCardLeftSparkNPCHeader:
db NPC_LEGENDARY_CARD_LEFT_SPARK
db $27
db $3d
db $43
db $50
- dw NoOverworldSequence ; Pointer to Script
-Data_11f34:
+ dw Script_LegendaryCardLeftSpark
+
+LegendaryCardBottomLeftNPCHeader:
db NPC_LEGENDARY_CARD_BOTTOM_LEFT
db $27
db $3e
db $44
db $50
- dw NoOverworldSequence ; Pointer to Script
-Data_11f3b:
+ dw Script_LegendaryCardBottomLeft
+
+LegendaryCardBottomRightNPCHeader:
db NPC_LEGENDARY_CARD_BOTTOM_RIGHT
db $27
db $3f
db $45
db $50
- dw NoOverworldSequence ; Pointer to Script
-Data_11f42:
+ dw Script_LegendaryCardBottomRight
+
+LegendaryCardRightSparkNPCHeader:
db NPC_LEGENDARY_CARD_RIGHT_SPARK
db $27
db $40
db $46
db $50
- dw NoOverworldSequence ; Pointer to Script
-Data_11f49:
+ dw Script_LegendaryCardRightSpark
+
+DummyNPCHeader:
db $00
db $00
db $00
diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm
index 090ecf0..c4a6b27 100644
--- a/src/engine/bank01.asm
+++ b/src/engine/bank01.asm
@@ -51,11 +51,9 @@ SetupResetBackUpRamScreen: ; 405a (1:405a)
lb de, $38, $7f
call SetupText
ret
-; 0x406e
CommentedOut_406e: ; 406e (1:406e)
ret
-; 0x406f
; try to resume a saved duel from the main menu
TryContinueDuel: ; 406f (1:406f)
@@ -78,14 +76,12 @@ _ContinueDuel: ; 407a (1:407a)
ld [wDuelFinished], a
call DuelMainInterface
jp MainDuelLoop.between_turns
-; 0x4097
HandleFailedToContinueDuel: ; 4097 (1:4097)
call DrawWideTextBox_WaitForInput
call ResetSerial
scf
ret
-; 0x409f
; this function begins the duel after the opponent's graphics, name and deck have been introduced
; loads both player's decks and sets up the variables and resources required to begin a duel.
@@ -130,7 +126,7 @@ StartDuel: ; 409f (1:409f)
; fallthrough
; the loop returns here after every turn switch
-MainDuelLoop ; 40ee (1:40ee)
+MainDuelLoop: ; 40ee (1:40ee)
xor a
ld [wCurrentDuelMenuItem], a
call UpdateSubstatusConditions_StartOfTurn
@@ -274,7 +270,6 @@ MainDuelLoop ; 40ee (1:40ee)
call Func_4b60
jp nc, MainDuelLoop
ret
-; 0x420b
; empty the screen, and setup text and graphics for a duel
SetupDuel: ; 420b (1:420b)
@@ -288,7 +283,6 @@ SetupDuel: ; 420b (1:420b)
call SetupText
call EnableLCD
ret
-; 0x4225
; handle the turn of the duelist identified by hWhoseTurn.
; if player's turn, display the animation of the player drawing the card at
@@ -420,7 +414,6 @@ Func_42fd: ; 42fd (1:42fd)
ld a, OPPACTION_DRAW_CARD
call SetOppAction_SerialSendDuelData
jp PrintDuelMenuAndHandleInput.menu_items_printed
-; 0x430b
; triggered by pressing B + UP in the duel menu
DuelMenuShortcut_OpponentPlayArea: ; 430b (1:430b)
@@ -472,7 +465,6 @@ OpenNonTurnHolderHandScreen_Simple: ; 4345 (1:4345)
call SwapTurn
call OpenTurnHolderHandScreen_Simple
jp SwapTurn
-; 0x434e
; draw the turn holder's hand screen. simpler version of OpenPlayerHandScreen
; used only for checking the cards rather than for playing them.
@@ -487,7 +479,6 @@ OpenTurnHolderHandScreen_Simple: ; 434e (1:434e)
.no_cards_in_hand
ldtx hl, NoCardsInHandText
jp DrawWideTextBox_WaitForInput
-; 0x4364
; triggered by pressing B + START in the duel menu
DuelMenuShortcut_OpponentActivePokemon: ; 4364 (1:4364)
@@ -495,13 +486,11 @@ DuelMenuShortcut_OpponentActivePokemon: ; 4364 (1:4364)
call OpenActivePokemonScreen
call SwapTurn
jp DuelMainInterface
-; 0x4370
; triggered by pressing START in the duel menu
DuelMenuShortcut_PlayerActivePokemon: ; 4370 (1:4370)
call OpenActivePokemonScreen
jp DuelMainInterface
-; 0x4376
; draw the turn holder's active Pokemon screen if it exists
OpenActivePokemonScreen: ; 4376 (1:4376)
@@ -517,7 +506,6 @@ OpenActivePokemonScreen: ; 4376 (1:4376)
ld [hl], a ; wCurPlayAreaY
call OpenCardPage_FromCheckPlayArea
ret
-; 0x438e
; triggered by selecting the "Pkmn Power" item in the duel menu
DuelMenu_PkmnPower: ; 438e (1:438e)
@@ -701,7 +689,6 @@ ReloadCardListScreen: ; 44d2 (1:44d2)
; skip doing the things that have already been done when initially opened
call DrawCardListScreenLayout
jp OpenPlayerHandScreen.handle_input
-; 0x44db
; place a basic Pokemon card on the arena or bench, or place an stage 1 or 2
; Pokemon card over a Pokemon card already in play to evolve it.
@@ -806,7 +793,6 @@ PlayPokemonCard: ; 44db (1:44db)
call DrawWideTextBox_WaitForInput
scf
ret
-; 0x4585
; triggered by selecting the "Check" item in the duel menu
DuelMenu_Check: ; 4585 (1:4585)
@@ -819,7 +805,6 @@ DuelMenuShortcut_BothActivePokemon: ; 458e (1:458e)
call Func_3b31
call Func_4597
jp DuelMainInterface
-; 0x4597
Func_4597: ; 4597 (1:4597)
call OpenInPlayAreaScreen_FromSelectButton
@@ -830,7 +815,6 @@ Func_4597: ; 4597 (1:4597)
call Func_45a9
call SwapTurn
ret
-; 0x45a9
Func_45a9: ; 45a9 (1:45a9)
call HasAlivePokemonInPlayArea
@@ -842,7 +826,6 @@ Func_45a9: ; 45a9 (1:45a9)
ret z
scf
ret
-; 0x45bb
; check if the turn holder's arena Pokemon is unable to retreat due to
; some status condition or due the bench containing no alive Pokemon.
@@ -877,7 +860,6 @@ CheckAbleToRetreat: ; 45bb (1:45bb)
.done
scf
ret
-; 0x45f4
; check if the turn holder's arena Pokemon has enough energies attached to it
; in order to retreat. Return carry if it doesn't.
@@ -898,7 +880,6 @@ CheckIfEnoughEnergiesToRetreat: ; 45f4 (1:45f4)
ld [wEnergyCardsRequiredToRetreat], a
or a
ret
-; 0x4611
; display the screen that prompts the player to select energy cards to discard
; in order to retreat a Pokemon card. also handle input in order to display
@@ -960,7 +941,6 @@ DisplayRetreatScreen: ; 4611 (1:4611)
ld [$ff00+c], a
or a
ret
-; 0x4673
; display the screen that prompts the player to select energy cards to discard
; in order to retreat a Pokemon card or use an attack like Ember. includes the
@@ -999,7 +979,6 @@ DisplayEnergyDiscardMenu: ; 4693 (1:4693)
ld a, 4
ld [wCardListIndicatorYPosition], a
ret
-; 0x46b7
; if [wcbfa] non-0:
; prints "[wcbfb]/[wcbfa]" at 16,16, where [wcbfb] is the total amount
@@ -1039,7 +1018,6 @@ HandleEnergyDiscardMenuInput: ; 46b7 (1:46b7)
.return_carry
scf
ret
-; 0x46f3
EnergyDiscardCardListParameters:
db 1, 5 ; cursor x, cursor y
@@ -1348,7 +1326,6 @@ CheckIfEnoughEnergiesToMove: ; 488f (1:488f)
pop bc
pop hl
ret
-; 0x48ac
; check if a pokemon card has enough energy attached to it in order to use a move
; input:
@@ -1413,7 +1390,6 @@ _CheckIfEnoughEnergiesToMove: ; 48ac (1:48ac)
.not_usable_or_not_enough_energies
scf
jr .done
-; 0x4900
; given the amount of energies of a specific type required for an attack in the
; lower nybble of register a, test if the pokemon card has enough energies of that type
@@ -1440,7 +1416,6 @@ CheckIfEnoughEnergiesOfType: ; 4900 (1:4900)
inc hl
or a
ret
-; 0x4918
; return carry and the corresponding text in hl if the turn holder's
; arena Pokemon card is paralyzed or asleep.
@@ -1529,7 +1504,6 @@ DisplayDrawOneCardScreen: ; 4933 (1:4933)
pop de
pop hl
ret
-; 0x49a8
Func_49a8: ; 49a8 (1:49a8)
call Func_3b21
@@ -1550,7 +1524,6 @@ Func_49a8: ; 49a8 (1:49a8)
.asm_49c6
call Func_3b31
ret
-; 0x49ca
; prints, for each duelist, the number of cards in the hand along with the
; hand icon, and the number of cards in the deck, along with the deck icon,
@@ -1570,7 +1543,6 @@ PrintDeckAndHandIconsAndNumberOfCards: ; 49ca (1:49ca)
call PrintPlayerNumberOfHandAndDeckCards
call PrintOpponentNumberOfHandAndDeckCards
ret
-; 0x49ed
; prints, for each duelist, the number of cards in the hand, and the number
; of cards in the deck, according to their placement in the draw card(s) screen.
@@ -1617,7 +1589,6 @@ PrintOpponentNumberOfHandAndDeckCards:
ld a, e
lb bc, 11, 3
jp WriteTwoDigitNumberInTxSymbolFormat
-; 0x4a35
DeckAndHandIconsTileData:
; x, y, tiles[], 0
@@ -1682,7 +1653,6 @@ DrawDuelistPortraitsAndNames: ; 4a97 (1:4a97)
; middle line
call DrawDuelHorizontalSeparator
ret
-; 0x4ad6
; print the number of prizes left, of active Pokemon, and of cards left in the deck
; of both duelists. this is called when the duel ends.
@@ -1694,7 +1664,6 @@ PrintDuelResultStats: ; 4ad6 (1:4ad6)
call PrintDuelistResultStats
call SwapTurn
ret
-; 0x4ae9
; print, at d,e, the number of prizes left, of active Pokemon, and of cards left in
; the deck of the turn duelist. b,c are used throughout as input coords for
@@ -1736,7 +1705,6 @@ PrintDuelistResultStats: ; 4ae9 (1:4ae9)
ldtx hl, CardsText
call InitTextPrinting_ProcessTextFromID
ret
-; 0x4b2c
; display the animation of the player drawing the card at hTempCardIndex_ff98
DisplayPlayerDrawCardScreen: ; 4b2c (1:4b2c)
@@ -1751,7 +1719,6 @@ DisplayCardDetailScreen: ; 4b31 (1:4b31)
call LoadCardDataToBuffer1_FromDeckIndex
call _DisplayCardDetailScreen
ret
-; 0x4b38
Func_4b38: ; 4b38 (1:4b38)
ld a, [wDuelTempList]
@@ -1769,7 +1736,6 @@ Func_4b38: ; 4b38 (1:4b38)
ldtx hl, YouReceivedTheseCardsText
call DrawWideTextBox_WaitForInput
ret
-; 0x4b60
Func_4b60: ; 4b60 (1:4b60)
call InitializeDuelVariables
@@ -1950,7 +1916,6 @@ Func_4b60: ; 4b60 (1:4b60)
db $06, $07, $0d, $04
db $05, $08, $0e, $03
db $06, $08, $0d, $03
-; 0x4cd5
; have the turn duelist place, at the beginning of the duel, the active Pokemon
; and 0 more bench Pokemon, all of which must be basic Pokemon cards.
@@ -2061,7 +2026,6 @@ ChooseInitialArenaAndBenchPokemon: ; 4cd5 (1:4cd5)
jr c, .bench_loop
or a
ret
-; 0x4d97
; the turn duelist shuffles the deck unless it's a practice duel, then draws 7 cards
; returns $00 in a and carry if no basic Pokemon cards are drawn, and $01 in a otherwise
@@ -2135,7 +2099,6 @@ IsLoadedCard1BasicPokemon: ; 4dd1 (1:4dd1)
ld a, $01
or a
ret ; nz
-; 0x4df3
DisplayNoBasicPokemonInHandScreenAndText: ; 4df3 (1:4df3)
ldtx hl, ThereAreNoBasicPokemonInHand
@@ -2149,7 +2112,6 @@ PrintReturnCardsToDeckDrawAgain: ; 4dfc (1:4dfc)
call DrawWideTextBox_WaitForInput
call ExchangeRNG
ret
-; 0x4e06
; display a bare list of seven hand cards of the turn duelist, and the duelist's name above
; used to let the player know that there are no basic Pokemon in the hand and need to redraw
@@ -2171,7 +2133,6 @@ DisplayNoBasicPokemonInHandScreen: ; 4e06 (1:4e06)
call EnableLCD
call WaitForWideTextBoxInput
ret
-; 0x4e37
NoBasicPokemonCardListParameters:
db 1, 3 ; cursor x, cursor y
@@ -2201,7 +2162,6 @@ DisplayPracticeDuelPlayerHandScreen: ; 4e40 (1:4e40)
call PrintTextNoDelay
call EnableLCD
ret
-; 0x4e6e
Func_4e6e: ; 4e6e (1:4e6e)
ld b, $51
@@ -2304,7 +2264,6 @@ Func_4e98: ; 4e98 (1:4e98)
call Func_3b31
pop bc
ret
-; 0x4f2d
Func_4f2d: ; 4f2d (1:4f2d)
ld a, [wDuelDisplayedScreen]
@@ -2362,7 +2321,6 @@ Func_4f2d: ; 4f2d (1:4f2d)
jr nz, .asm_4f94
ld a, $01
ret
-; 0x4f9d
; draw the main scene during a duel, except the contents of the bottom text box,
; which depend on the type of duelist holding the turn.
@@ -2436,7 +2394,6 @@ DrawDuelMainScene: ; 4f9d (1:4f9d)
call DrawWideTextBox
call EnableLCD
ret
-; 0x503a
; draws the main elements of the main duel interface, including HUDs, HPs, card names
; and color symbols, attached cards, and other information, of both duelists.
@@ -2480,7 +2437,6 @@ DrawDuelHUDs: ; 503a (1:503a)
call CheckPrintDoublePoisoned ; if double poisoned, print a second poison icon
call SwapTurn
ret
-; 0x5093
DrawDuelHUD: ; 5093 (1:5093)
ld hl, wHUDEnergyAndHPBarsX
@@ -2616,7 +2572,6 @@ DrawDuelHUD: ; 5093 (1:5093)
call WriteByteToBGMap0
.done
ret
-; 0x516f
; draws an horizonal line that separates the arena side of each duelist
; also colorizes the line on CGB
@@ -2631,7 +2586,6 @@ DrawDuelHorizontalSeparator: ; 516f (1:516f)
call WriteDataBlocksToBGMap0
call BankswitchVRAM0
ret
-; 0x5188
DuelEAndHPTileData: ; 5188 (1:5188)
; x, y, tiles[], 0
@@ -2640,7 +2594,6 @@ DuelEAndHPTileData: ; 5188 (1:5188)
db 9, 8, SYM_E, 0
db 9, 9, SYM_HP, 0
db $ff
-; 0x5199
DuelHorizontalSeparatorTileData: ; 5199 (1:5199)
; x, y, tiles[], 0
@@ -2649,7 +2602,6 @@ DuelHorizontalSeparatorTileData: ; 5199 (1:5199)
db 9, 6, $33, $34, 0
db 9, 7, $35, $36, $37, $37, $37, $37, $37, $37, $37, $37, $37, 0
db $ff
-; 0x51c0
DuelHorizontalSeparatorCGBPalData: ; 51c0 (1:51c0)
; x, y, pals[], 0
@@ -2658,7 +2610,6 @@ DuelHorizontalSeparatorCGBPalData: ; 51c0 (1:51c0)
db 9, 6, $02, $02, 0
db 9, 7, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, 0
db $ff
-; 0x51e7
; if this is a practice duel, execute the practice duel action at wPracticeDuelAction
; if not a practice duel, always return nc
@@ -2671,7 +2622,6 @@ DoPracticeDuelAction: ; 51e7 (1:51e7)
ld a, [wPracticeDuelAction]
ld hl, PracticeDuelActionTable
jp JumpToFunctionInTable
-; 0x51f8
PracticeDuelActionTable: ; 51f8 (1:51f8)
dw $0000
@@ -2685,14 +2635,12 @@ PracticeDuelActionTable: ; 51f8 (1:51f8)
dw PracticeDuel_RepeatInstructions
dw PracticeDuel_PlayStaryuFromBench
dw PracticeDuel_ReplaceKnockedOutPokemon
-; 0x520e
PracticeDuel_DrawSevenCards: ; 520e (1:520e)
call DisplayPracticeDuelPlayerHandScreen
call EnableLCD
ldtx hl, DrawSevenCardsPracticeDuelText
jp PrintPracticeDuelDrMasonInstructions
-; 0x521a
PracticeDuel_PlayGoldeen: ; 521a (1:521a)
ld a, [wLoadedCard1ID]
@@ -2702,14 +2650,12 @@ PracticeDuel_PlayGoldeen: ; 521a (1:521a)
ldtx de, DrMasonText
scf
jp PrintPracticeDuelDrMasonInstructions
-; 0x522a
PracticeDuel_PutStaryuInBench: ; 522a (1:522a)
call DisplayPracticeDuelPlayerHandScreen
call EnableLCD
ldtx hl, PutPokemonOnBenchPracticeDuelText
jp PrintPracticeDuelDrMasonInstructions
-; 0x5236
PracticeDuel_VerifyInitialPlay: ; 5236 (1:5236)
ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
@@ -2719,7 +2665,6 @@ PracticeDuel_VerifyInitialPlay: ; 5236 (1:5236)
ldtx hl, ChooseStaryuPracticeDuelText
scf
jp PrintPracticeDuelDrMasonInstructions
-; 0x5245
PracticeDuel_DonePuttingOnBench: ; 5245 (1:5245)
call DisplayPracticeDuelPlayerHandScreen
@@ -2728,7 +2673,6 @@ PracticeDuel_DonePuttingOnBench: ; 5245 (1:5245)
ld [wPracticeDuelTurn], a
ldtx hl, PressBToFinishPracticeDuelText
jp PrintPracticeDuelDrMasonInstructions
-; 0x5256
PracticeDuel_PrintTurnInstructions: ; 5256 (1:5256)
call DrawPracticeDuelInstructionsTextBox
@@ -2749,7 +2693,6 @@ PracticeDuel_PrintTurnInstructions: ; 5256 (1:5256)
call PrintScrollableText_WithTextBoxLabel_NoWait
call YesOrNoMenu
jp PrintPracticeDuelInstructionsForCurrentTurn
-; 0x5278
PracticeDuel_VerifyPlayerTurnActions: ; 5278 (1:5278)
ld a, [wDuelTurns]
@@ -2773,7 +2716,6 @@ PracticeDuel_RepeatInstructions: ; 5284 (1:5284)
; return carry in order to repeat instructions
scf
ret
-; 0x529b
PracticeDuel_PlayStaryuFromBench: ; 529b (1:529b)
ld a, [wDuelTurns]
@@ -2787,7 +2729,6 @@ PracticeDuel_PlayStaryuFromBench: ; 529b (1:529b)
call EnableLCD
ld hl, PracticeDuelText_SamTurn4
jp PrintPracticeDuelInstructions
-; 0x52b0
PracticeDuel_ReplaceKnockedOutPokemon: ; 52b0 (1:52b0)
ldh a, [hTempPlayAreaLocation_ff9d]
@@ -2806,7 +2747,6 @@ PrintPracticeDuelDrMasonInstructions: ; 52bc (1:52bc)
call PrintScrollableText_WithTextBoxLabel
pop af
ret
-; 0x52c5
PracticeDuelTextPointerTable: ; 52c5 (1:52c5)
dw PracticeDuelText_Turn1
@@ -2817,7 +2757,6 @@ PracticeDuelTextPointerTable: ; 52c5 (1:52c5)
dw PracticeDuelText_Turn6
dw PracticeDuelText_Turn7
dw PracticeDuelText_Turn8
-; 0x52d5
practicetext: MACRO
db \1 ; Y coord to place the point-by-point instruction
@@ -2906,7 +2845,6 @@ PrintPracticeDuelInstructionsTextBoxLabel: ; 535d (1:535d)
lb de, 1, 0
ldtx hl, ReplaceDueToKnockoutPracticeDuelText
jp InitTextPrinting_ProcessTextFromID
-; 0x5382
; print the instructions of the current practice duel turn, taken from
; one of the structs in PracticeDuelTextPointerTable.
@@ -2986,7 +2924,6 @@ PrintPracticeDuelInstructions_Fast: ; 53da (1:53da)
ld d, 1
call PrintPracticeDuelNumberedInstruction
jr PrintPracticeDuelInstructions_Fast
-; 0x53e6
; print a practice duel point-by-point instruction at d,e, with text id at hl,
; that has been read from an entry of PracticeDuelText_*
@@ -3005,7 +2942,6 @@ PrintPracticeDuelNumberedInstruction: ; 53e6 (1:53e6)
call SetOneLineSeparation
pop hl
ret
-; 0x53fa
Func_53fa: ; 53fa (1:53fa)
ld a, $01
@@ -3032,7 +2968,6 @@ Func_53fa: ; 53fa (1:53fa)
xor a
ldh [hffb0], a
ret
-; 0x541f
PracticeDuelTurnVerificationPointerTable: ; 541f (1:541f)
dw PracticeDuelVerify_Turn1
@@ -3049,7 +2984,6 @@ PracticeDuelVerify_Turn1: ; 542f (1:542f)
cp GOLDEEN
jp nz, ReturnWrongAction
ret
-; 0x5438
PracticeDuelVerify_Turn2: ; 5438 (1:5438)
ld a, [wTempCardID_ccc2]
@@ -3064,7 +2998,6 @@ PracticeDuelVerify_Turn2: ; 5438 (1:5438)
or a
jr z, ReturnWrongAction
ret
-; 0x5454
PracticeDuelVerify_Turn3: ; 5454 (1:5454)
ld a, [wTempCardID_ccc2]
@@ -3076,7 +3009,6 @@ PracticeDuelVerify_Turn3: ; 5454 (1:5454)
or a
jr z, ReturnWrongAction
ret
-; 0x5467
PracticeDuelVerify_Turn4: ; 5467 (1:5467)
ld a, [wPlayerNumberOfPokemonInPlayArea]
@@ -3094,7 +3026,6 @@ PracticeDuelVerify_Turn4: ; 5467 (1:5467)
cp 1
jr nz, ReturnWrongAction
ret
-; 0x5488
PracticeDuelVerify_Turn5: ; 5488 (1:5488)
ld e, PLAY_AREA_ARENA
@@ -3106,7 +3037,6 @@ PracticeDuelVerify_Turn5: ; 5488 (1:5488)
cp STARYU
jr nz, ReturnWrongAction
ret
-; 0x549c
PracticeDuelVerify_Turn6: ; 549c (1:549c)
ld e, PLAY_AREA_ARENA
@@ -3121,7 +3051,6 @@ PracticeDuelVerify_Turn6: ; 549c (1:549c)
cp STARYU
jr nz, ReturnWrongAction
ret
-; 0x54b7
PracticeDuelVerify_Turn7Or8: ; 54b7 (1:54b7)
ld a, [wTempCardID_ccc2]
@@ -3135,7 +3064,6 @@ PracticeDuelVerify_Turn7Or8: ; 54b7 (1:54b7)
ReturnWrongAction:
scf
ret
-; 0x54c8
; display BOXMSG_PLAYERS_TURN or BOXMSG_OPPONENTS_TURN and print
; DuelistTurnText in a textbox. also call ExchangeRNG.
@@ -3153,12 +3081,10 @@ DisplayDuelistTurnScreen: ; 54c8 (1:54c8)
call DrawWideTextBox_WaitForInput
call ExchangeRNG
ret
-; 0x54e2
Unknown_54e2: ; 54e2 (1:54e2)
; ???
db $00, $0c, $06, $0f, $00, $00, $00
-; 0x54e9
DuelMenuData: ; 54e9 (1:54e9)
; x, y, text id
@@ -3169,7 +3095,6 @@ DuelMenuData: ; 54e9 (1:54e9)
textitem 9, 16, PKMNPowerText
textitem 15, 16, DoneText
db $ff
-; 0x5502
; display the screen that prompts the player to choose a Pokemon card to
; place in the arena or in the bench at the beginning of the duel.
@@ -3216,7 +3141,6 @@ DisplayPlaceInitialPokemonCardsScreen: ; 5502 (1:5502)
call nz, SortHandCardsByID
pop af
ret
-; 0x5542
Func_5542: ; 5542 (1:5542)
call CreateDiscardPileCardList
@@ -3225,7 +3149,6 @@ Func_5542: ; 5542 (1:5542)
call SetDiscardPileScreenTexts
call DisplayCardList
ret
-; 0x5550
; draw the turn holder's discard pile screen
OpenDiscardPileScreen: ; 5550 (1:5550)
@@ -3243,7 +3166,6 @@ OpenDiscardPileScreen: ; 5550 (1:5550)
call DrawWideTextBox_WaitForInput
scf
ret
-; 0x556d
; set wCardListHeaderText and SetCardListInfoBoxText to the text
; that correspond to the Discard Pile screen
@@ -3257,7 +3179,6 @@ SetDiscardPileScreenTexts: ; 556d (1:556d)
ldtx hl, ChooseTheCardYouWishToExamineText
call SetCardListHeaderText
ret
-; 0x5580
SetCardListHeaderText: ; 5580 (1:5580)
ld a, e
@@ -3272,14 +3193,12 @@ SetCardListInfoBoxText: ; 5588 (1:5588)
ld a, h
ld [wCardListInfoBoxText + 1], a
ret
-; 0x5591
Func_5591: ; 5591 (1:5591)
call InitAndDrawCardListScreenLayout
ld a, SELECT_CHECK
ld [wCardListItemSelectionMenuType], a
ret
-; 0x559a
; draw the layout of the screen that displays the player's Hand card list or a
; Discard Pile card list, including a bottom-right image of the current card.
@@ -3334,7 +3253,6 @@ DrawCardListScreenLayout:
ret z
or a
ret
-; 0x55f0
; displays a list of cards and handles input in order to navigate through the list,
; select a card, open a card page, etc.
@@ -3447,7 +3365,6 @@ DisplayCardList: ; 55f0 (1:55f0)
ldh a, [hCurMenuItem]
scf
ret
-; 0x5690
Func_5690: ; 5690 (1:5690)
ldh a, [hDPadHeld]
@@ -3459,7 +3376,6 @@ Func_5690: ; 5690 (1:5690)
xor a
ldh [hffb0], a
ret
-; 0x56a0
; prints the text ID at wCardListHeaderText at 1,1
; and the text ID at wCardListInfoBoxText at 1,14
@@ -3480,7 +3396,6 @@ PrintCardListHeaderAndInfoBoxTexts: ; 56a0 (1:56a0)
call InitTextPrinting
call PrintTextNoDelay
ret
-; 0x56c2
; display the SELECT|CHECK or PLAY|CHECK menu when a card of a list is selected
; and handle input. return carry if b is pressed.
@@ -3522,7 +3437,6 @@ CardListItemSelectionMenu: ; 56c2 (1:56c2)
.b_pressed
scf
ret
-; 0x5708
ItemSelectionMenuParameters: ; 5708 (1:5708)
db 1, 14 ; corsor x, cursor y
@@ -3531,7 +3445,6 @@ ItemSelectionMenuParameters: ; 5708 (1:5708)
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw $0000 ; function pointer if non-0
-; 0x5710
CardListParameters: ; 5710 (1:5710)
db 1, 3 ; cursor x, cursor y
@@ -3541,7 +3454,6 @@ CardListParameters: ; 5710 (1:5710)
db SYM_CURSOR_R ; cursor tile number
db SYM_SPACE ; tile behind cursor
dw CardListFunction ; function pointer if non-0
-; 0x5719
; return carry if any of the buttons is pressed, and load the graphics
; of the card pointed to by the cursor whenever a d-pad key is released.
@@ -3566,7 +3478,6 @@ CardListFunction: ; 5719 (1:5719)
call LoadSelectedCardGfx
or a
ret
-; 0x5735
Func_5735: ; 5735 (1:5735)
ld hl, wcbd8
@@ -3577,12 +3488,10 @@ Func_5735: ; 5735 (1:5735)
ld a, 1
ld [wSortCardListByID], a
ret
-; 0x5744
Func_5744: ; 5744 (1:5744)
ld hl, wcbd8
jp CallIndirect
-; 0x574a
Func_574a: ; 574a (1:574a)
lb bc, 1, 2
@@ -3602,7 +3511,6 @@ Func_574a: ; 574a (1:574a)
jr .next
.done
ret
-; 0x5762
; draw the card page of the card at wLoadedCard1 and listen for input
; in order to switch the page or to exit.
@@ -3679,7 +3587,6 @@ OpenCardPage: ; 5779 (1:5779)
jr .input_loop
.done
ret
-; 0x57cd
; display the previous valid card page of the card at wLoadedCard1 if bit D_LEFT_F
; of a is set, and the first or next valid card page otherwise.
@@ -3698,7 +3605,6 @@ DisplayCardPageOnLeftOrRightPressed: ; 57cd (1:57cd)
call DisplayPreviousCardPage
call c, DisplayCardPage
ret
-; 0x57df
Func_57df: ; 57df (1:57df)
push hl
@@ -3716,7 +3622,6 @@ Func_57df: ; 57df (1:57df)
call SetOneLineSeparation
call WaitForWideTextBoxInput
ret
-; 0x5805
Func_5805: ; 5805 (1:5805)
call Func_3b31
@@ -3786,14 +3691,12 @@ Func_5805: ; 5805 (1:5805)
ldtx hl, DrewNPrizesText
call DrawWideTextBox_WaitForInput
jr .asm_582f
-; 0x588a
Func_588a: ; 588a (1:588a)
ld l, PLAYER_TURN
ldh a, [hWhoseTurn]
ld h, a
jp DrawYourOrOppPlayAreaScreen_Bank0
-; 0x5892
; display the previous valid card page
DisplayPreviousCardPage: ; 5892 (1:5892)
@@ -3815,7 +3718,6 @@ DisplayCardPage: ; 589c (1:589c)
call EnableLCD
or a
ret
-; 0x58aa
; load the tiles and palette of the card selected in card list screen
LoadSelectedCardGfx: ; 58aa (1:58aa)
@@ -3828,7 +3730,6 @@ LoadSelectedCardGfx: ; 58aa (1:58aa)
call SetBGP6OrSGB3ToCardPalette
call FlushAllPalettesOrSendPal23Packet
ret
-; 0x58c2
CardPageDisplayPointerTable: ; 58c2 (1:58c2)
dw DrawDuelMainScene
@@ -3847,7 +3748,6 @@ CardPageDisplayPointerTable: ; 58c2 (1:58c2)
dw DisplayCardPage_TrainerPage1 ; CARDPAGE_TRAINER_1
dw DisplayCardPage_TrainerPage2 ; CARDPAGE_TRAINER_2
dw DrawDuelMainScene
-; 0x58e2
; given the current card page at [wCardPageNumber], go to the next valid card page or load
; the first valid card page of the current card at wLoadedCard1 if [wCardPageNumber] == 0
@@ -3883,7 +3783,6 @@ GoToFirstOrNextCardPage: ; 58e2 (1:58e2)
.set_card_page
ld [wCardPageNumber], a
ret
-; 0x5911
; given the current card page at [wCardPageNumber], go to the previous
; valid card page for the current card at wLoadedCard1
@@ -3910,7 +3809,6 @@ GoToPreviousCardPage: ; 5911 (1:5911)
.stay
scf
ret
-; 0x5930
; check if the card page trying to switch to is valid for the card at wLoadedCard1
; return with the equivalent to one of these three actions:
@@ -3920,7 +3818,6 @@ GoToPreviousCardPage: ; 5911 (1:5911)
SwitchCardPage: ; 5930 (1:5930)
ld hl, CardPageSwitchPointerTable
jp JumpToFunctionInTable
-; 0x5936
CardPageSwitchPointerTable: ; 5936 (1:5936)
dw CardPageSwitch_00
@@ -3939,21 +3836,18 @@ CardPageSwitchPointerTable: ; 5936 (1:5936)
dw CardPageSwitch_EnergyOrTrainerPage1 ; CARDPAGE_TRAINER_1
dw CardPageSwitch_TrainerPage2 ; CARDPAGE_TRAINER_2
dw CardPageSwitch_TrainerEnd
-; 0x5956
; return with CARDPAGE_POKEMON_DESCRIPTION
CardPageSwitch_00: ; 5956 (1:5956)
ld a, CARDPAGE_POKEMON_DESCRIPTION
scf
ret
-; 0x595a
; return with current page
CardPageSwitch_PokemonOverviewOrDescription: ; 595a (1:595a)
ld a, $1
or a
ret ; nz
-; 0x595e
; return with current page if [wLoadedCard1Move1Name] non-0
; (if card has at least one move)
@@ -3983,63 +3877,54 @@ CheckCardPageExists: ; 5970 (1:5970)
ld a, [hli]
or [hl]
ret
-; 0x5973
; return with CARDPAGE_POKEMON_OVERVIEW
CardPageSwitch_PokemonEnd: ; 5973 (1:5973)
ld a, CARDPAGE_POKEMON_OVERVIEW
scf
ret
-; 0x5977
; return with CARDPAGE_ENERGY + 1
CardPageSwitch_08: ; 5977 (1:5977)
ld a, CARDPAGE_ENERGY + 1
scf
ret
-; 0x597b
; return with current page
CardPageSwitch_EnergyOrTrainerPage1: ; 597b (1:597b)
ld a, $1
or a
ret ; nz
-; 0x597f
; return with current page if [wLoadedCard1NonPokemonDescription + 2] non-0
; (if this trainer card has a two-page description)
CardPageSwitch_TrainerPage2: ; 597f (1:597f)
ld hl, wLoadedCard1NonPokemonDescription + 2
jr CheckCardPageExists
-; 0x5984
; return with CARDPAGE_ENERGY
CardPageSwitch_EnergyEnd: ; 5984 (1:5984)
ld a, CARDPAGE_ENERGY
scf
ret
-; 0x5988
; return with CARDPAGE_TRAINER_2
CardPageSwitch_0c: ; 5988 (1:5988)
ld a, CARDPAGE_TRAINER_2
scf
ret
-; 0x598c
; return with CARDPAGE_TRAINER_1
CardPageSwitch_TrainerEnd: ; 598c (1:598c)
ld a, CARDPAGE_TRAINER_1
scf
ret
-; 0x5990
ZeroObjectPositionsAndToggleOAMCopy: ; 5990 (1:5990)
call ZeroObjectPositions
ld a, $01
ld [wVBlankOAMCopyToggle], a
ret
-; 0x5999
; place OAM for a 8x6 image, using object size 8x16 and obj palette 1.
; d, e: X Position and Y Position of the top-left corner.
@@ -4074,7 +3959,6 @@ PlaceCardImageOAM: ; 5999 (1:5999)
ld a, $01
ld [wVBlankOAMCopyToggle], a
ret
-; 0x59c2
; given the deck index of a card in the play area (i.e. -1 indicates empty)
; load the graphics (tiles and palette) of the card to de
@@ -4095,7 +3979,6 @@ LoadLoaded1CardGfx: ; 59ca (1:59ca)
lb bc, $30, TILE_SIZE
call LoadCardGfx
ret
-; 0x59d7
SetBGP7OrSGB2ToCardPalette: ; 59d7 (1:59d7)
ld a, [wConsole]
@@ -4117,7 +4000,6 @@ SetBGP7OrSGB2ToCardPalette: ; 59d7 (1:59d7)
dec b
jr nz, .copy_pal_loop
ret
-; 0x59f5
SetBGP6OrSGB3ToCardPalette: ; 59f5 (1:59f5)
ld a, [wConsole]
@@ -4134,7 +4016,6 @@ SetSGB3ToCardPalette: ; 5a04 (1:5a04)
ld de, wTempSGBPacket + 9 ; Pal Packet color #4 (PAL23's SGB3)
ld b, 6
jr SetBGP7OrSGB2ToCardPalette.copy_pal_loop
-; 0x5a0e
SetOBP1OrSGB3ToCardPalette: ; 5a0e (1:5a0e)
ld a, $e4
@@ -4164,7 +4045,6 @@ CopyCGBCardPalette: ; 5a1e (1:5a1e)
dec b
jr nz, .copy_pal_loop
ret
-; 0x5a34
FlushAllPalettesOrSendPal23Packet: ; 5a34 (1:5a34)
ld a, [wConsole]
@@ -4190,7 +4070,6 @@ FlushAllPalettesOrSendPal23Packet: ; 5a34 (1:5a34)
ld [wTempSGBPacket + $f], a
call SendSGB
ret
-; 0x5a56
ApplyBGP6OrSGB3ToCardImage: ; 5a56 (1:5a56)
ld a, [wConsole]
@@ -4209,7 +4088,6 @@ SendCardAttrBlkPacket: ; 5a67 (1:5a67)
call CreateCardAttrBlkPacket
call SendSGB
ret
-; 0x5a6e
ApplyBGP7OrSGB2ToCardImage: ; 5a6e (1:5a6e)
ld a, [wConsole]
@@ -4223,7 +4101,6 @@ ApplyBGP7OrSGB2ToCardImage: ; 5a6e (1:5a6e)
.sgb
ld a, 2 << 0 + 2 << 2 ; Color Palette Designation
jr SendCardAttrBlkPacket
-; 0x5a81
Func_5a81: ; 5a81 (1:5a81)
ld a, [wConsole]
@@ -4250,7 +4127,6 @@ Func_5a81: ; 5a81 (1:5a81)
pop hl
call SendSGB
ret
-; 0x5ab5
CreateCardAttrBlkPacket: ; 5ab5 (1:5ab5)
; sgb ATTR_BLK, 1 ; sgb_command, length
@@ -4269,7 +4145,6 @@ CreateCardAttrBlkPacket: ; 5ab5 (1:5ab5)
ld [hli], a
pop hl
ret
-; 0x5ac9
CreateCardAttrBlkPacket_DataSet: ; 5ac9 (1:5ac9)
; Control Code, Color Palette Designation, X1, Y1, X2, Y2
@@ -4289,7 +4164,6 @@ CreateCardAttrBlkPacket_DataSet: ; 5ac9 (1:5ac9)
add e
ld [hli], a
ret
-; 0x5adb
; given the 8x6 card image with coordinates at de, fill its BGMap attributes with a
ApplyCardCGBAttributes: ; 5adb (1:5adb)
@@ -4299,7 +4173,6 @@ ApplyCardCGBAttributes: ; 5adb (1:5adb)
call FillRectangle
call BankswitchVRAM0
ret
-; 0x5aeb
; set the default game palettes for all three systems
; BGP and OBP0 on DMG
@@ -4352,7 +4225,6 @@ SetDefaultPalettes: ; 5aeb (1:5aeb)
dec c
jr nz, .copy_de_to_hl
ret
-; 0x5b44
CGBDefaultPalettes: ; 5b44 (1:5b44)
; BGP0 and OBP0
@@ -4372,7 +4244,7 @@ CGBDefaultPalettes: ; 5b44 (1:5b44)
rgb 0, 0, 0
; BGP3
rgb 28, 28, 24
- rgb 22, 0 ,22
+ rgb 22, 0, 22
rgb 27, 7, 3
rgb 0, 0, 0
; BGP4
@@ -4395,7 +4267,6 @@ Pal01Packet_Default: ; 5b6c (1:5b6c)
JPWriteByteToBGMap0: ; 5b7a (1:5b7a)
jp WriteByteToBGMap0
-; 0x5b7d
DisplayCardPage_PokemonOverview: ; 5b7d (1:5b7d)
ld a, [wCardPageType]
@@ -4503,7 +4374,6 @@ DisplayCardPage_PokemonOverview: ; 5b7d (1:5b7d)
ld a, e
call PrintCardPageWeaknessesOrResistances
ret
-; 0x5c33
; displays the name, damage, and energy cost of a move or Pokemon power.
; used in the Attack menu and in the card page of a Pokemon.
@@ -4587,7 +4457,6 @@ PrintMoveOrPkmnPowerInformation: ; 5c33 (1:5c33)
call InitTextPrinting_ProcessTextFromID
pop bc
ret
-; 0x5c9c
; print the number of energies required of color (type) e, and return e ++ (next color).
; the requirement of the current color is provided as input in the lower nybble of a.
@@ -4605,7 +4474,6 @@ PrintEnergiesOfColor: ; 5c9c (1:5c9c)
jr nz, .print_energies_loop
pop de
ret
-; 0x5cac
; print the weaknesses or resistances of a Pokemon card, given in a, at b,c
PrintCardPageWeaknessesOrResistances: ; 5cac (1:5cac)
@@ -4631,7 +4499,6 @@ PrintCardPageWeaknessesOrResistances: ; 5cac (1:5cac)
pop de
pop bc
ret
-; 0x5cc4
; prints surrounding box, card name at 5,1, type, set 2, and rarity.
; used in all CARDPAGE_POKEMON_* and MOVEPAGE_*, except in
@@ -4655,7 +4522,6 @@ PrintPokemonCardPageGenericInformation: ; 5cc4 (1:5cc4)
call JPWriteByteToBGMap0
call DrawCardPageSet2AndRarityIcons
ret
-; 0x5cec
; draws the 20x18 surrounding box and also colorizes the card image
DrawCardPageSurroundingBox: ; 5cec (1:5cec)
@@ -4670,7 +4536,6 @@ DrawCardPageSurroundingBox: ; 5cec (1:5cec)
lb de, 6, 4
call ApplyBGP6OrSGB3ToCardImage
ret
-; 0x5d05
CardPageRetreatWRTextData: ; 5d05 (1:5d05)
textitem 1, 14, RetreatCostText
@@ -4732,7 +4597,6 @@ PrintMoveOrNonPokemonCardDescription: ; 5d49 (1:5d49)
lb de, 1, 11
call PrintMoveOrCardDescription
ret
-; 0x5d54
DisplayCardPage_PokemonDescription: ; 5d54 (1:5d54)
; print surrounding box, card name at 5,1, type, set 2, and rarity
@@ -4794,7 +4658,6 @@ DisplayCardPage_PokemonDescription: ; 5d54 (1:5d54)
call ProcessTextFromPointerToID
call SetOneLineSeparation
ret
-; 0x5dd3
; given a card rarity constant in a, and CardRarityTextIDs in hl,
; print the text character associated to it at d,e
@@ -4806,7 +4669,6 @@ PrintCardPageRarityIcon: ; 5dd3 (1:5dd3)
add hl, bc
call InitTextPrinting_ProcessTextFromPointerToID
ret
-; 0x5ddd
; prints the card's set 2 icon and the full width text character of the card's rarity
DrawCardPageSet2AndRarityIcons: ; 5ddd (1:5ddd)
@@ -4826,7 +4688,6 @@ DrawCardPageSet2AndRarityIcons: ; 5ddd (1:5ddd)
cp PROMOSTAR
call nz, PrintCardPageRarityIcon
ret
-; 0x5e02
CardPageLengthWeightTextData: ; 5e02 (1:5e02)
textitem 1, 11, LengthText
@@ -4843,7 +4704,6 @@ CardRarityTextIDs: ; 5e14 (1:5e14)
tx CircleRarityText ; CIRCLE
tx DiamondRarityText ; DIAMOND
tx StarRarityText ; STAR
-; 0x5e1c
DisplayCardPage_TrainerPage1: ; 5e1c (1:5e1c)
xor a ; HEADER_TRAINER
@@ -4888,7 +4748,6 @@ DisplayEnergyOrTrainerCardPage: ; 5e2d (1:5e2d)
pop hl
call PrintMoveOrNonPokemonCardDescription
ret
-; 0x5e5f
; display the card details of the card in wLoadedCard1
; print the text at hl
@@ -4903,7 +4762,6 @@ _DisplayCardDetailScreen: ; 5e5f (1:5e5f)
pop hl
call DrawWideTextBox_WaitForInput
ret
-; 0x5e75
; draw a large picture of the card loaded in wLoadedCard1, including its image
; and a header indicating the type of card (TRAINER, ENERGY, PoKéMoN)
@@ -4935,7 +4793,6 @@ DrawLargePictureOfCard: ; 5e75 (1:5e75)
lb de, 6, 3
call ApplyBGP6OrSGB3ToCardImage
ret
-; 0x5eb7
LargeCardTileData: ; 5eb7 (1:5eb7)
db 5, 0, $d0, $d4, $d4, $d4, $d4, $d4, $d4, $d4, $d4, $d1, 0 ; top border
@@ -4953,7 +4810,6 @@ LargeCardTileData: ; 5eb7 (1:5eb7)
db 14, 10, $d7, 0 ; empty line 2 (right)
db 5, 11, $d2, $d5, $d5, $d5, $d5, $d5, $d5, $d5, $d5, $d3, 0 ; bottom border
db $ff
-; 0x5f4a
; print lines of text with no separation between them
SetNoLineSeparation: ; 5f4a (1:5f4a)
@@ -4963,13 +4819,11 @@ SetNoLineSeparation: ; 5f4a (1:5f4a)
SetLineSeparation: ; 5f4c (1:5f4c)
ld [wLineSeparation], a
ret
-; 0x5f50
; separate lines of text by an empty line
SetOneLineSeparation: ; 5f50 (1:5f50)
xor a
jr SetLineSeparation
-; 0x5f53
; given a number in hl, print it divided by 10 at b,c, with decimal part
; separated by a dot (unless it's 0). used to print a Pokemon card's weight.
@@ -5025,7 +4879,6 @@ PrintPokemonCardWeight: ; 5f53 (1:5f53)
add d
ld d, a
ret
-; 0x5f9a
; given a number in h and another in l, print them formatted as <l>'<h>" at b,c.
; used to print the length (feet and inches) of a Pokemon card.
@@ -5072,7 +4925,6 @@ PrintPokemonCardLength: ; 5f9a (1:5f9a)
pop bc
inc b
ret
-; 0x5fd9
; return carry if the turn holder has any Pokemon with non-zero HP on the bench.
; return how many Pokemon with non-zero HP in b.
@@ -5116,7 +4968,6 @@ _HasAlivePokemonInPlayArea: ; 5fde (1:5fde)
ret nz
scf
ret
-; 0x6008
OpenPlayAreaScreenForViewing: ; 6008 (1:6008)
ld a, START + A_BUTTON
@@ -5216,7 +5067,6 @@ DisplayPlayAreaScreen: ; 600e (1:600e)
ldh [hCurMenuItem], a
scf
ret
-; 0x60be
PlayAreaScreenMenuParameters_ActivePokemonIncluded: ; 60be (1:60be)
db 0, 0 ; cursor x, cursor y
@@ -5245,7 +5095,6 @@ PlayAreaScreenMenuFunction: ; 60ce (1:60ce)
.start_or_a
scf
ret
-; 0x60dd
Func_60dd: ; 60dd (1:60dd)
ld a, [wcbd4]
@@ -5295,7 +5144,6 @@ Func_60dd: ; 60dd (1:60dd)
.asm_6132
call OpenTurnHolderHandScreen_Simple
jr .asm_60f2
-; 0x6137
Func_6137: ; 6137 (1:6137)
ldh a, [hDPadHeld]
@@ -5333,7 +5181,6 @@ Func_615c:
ld e, 16
lb bc, SYM_CURSOR_R, SYM_SPACE
jp SetCursorParametersForTextBox
-; 0x616e
Func_616e: ; 616e (1:616e)
ldh [hTempPlayAreaLocation_ff9d], a
@@ -5357,7 +5204,6 @@ Func_6186:
ld [hl], a
call PrintPlayAreaCardInformationAndLocation
ret
-; 0x6194
Func_6194: ; 6194 (1:6194)
call Func_6186
@@ -5366,7 +5212,6 @@ Func_6194: ; 6194 (1:6194)
ld d, 0
call SetCursorParametersForTextBox_Default
ret
-; 0x61a1
Func_61a1: ; 61a1 (1:61a1)
xor a
@@ -5379,7 +5224,6 @@ Func_61a1: ; 61a1 (1:61a1)
call LoadDuelCardSymbolTiles
call LoadDuelCheckPokemonScreenTiles
ret
-; 0x61b8
; for each turn holder's play area Pokemon card, print the name, level,
; face down stage card, color symbol, status symbol (if any), pluspower/defender
@@ -5393,7 +5237,6 @@ PrintPlayAreaCardList_EnableLCD: ; 61b8 (1:61b8)
call EnableLCD
ld a, [wNumPlayAreaItems]
ret
-; 0x61c7
; for each turn holder's play area Pokemon card, print the name, level,
; face down stage card, color symbol, status symbol (if any), pluspower/defender
@@ -5463,7 +5306,6 @@ PrintPlayAreaCardList: ; 61c7 (1:61c7)
dec b
jr nz, .shift_back_loop
ret
-; 0x622a
; print a turn holder's play area Pokemon card's name, level, face down stage card,
; color symbol, status symbol (if any), pluspower/defender symbols (if any),
@@ -5513,7 +5355,6 @@ PrintPlayAreaCardLocation: ; 6238 (1:6238)
add d
call WriteByteToBGMap0
ret
-; 0x6264
PlayAreaLocationTileNumbers: ; 6264 (1:6264)
db $e0, $e1, $e2, $00 ; ACT
@@ -5580,7 +5421,6 @@ PrintPlayAreaCardInformation: ; 627c (1:627c)
ldtx hl, KnockOutText
call InitTextPrinting_ProcessTextFromID
ret
-; 0x62d5
; print a turn holder's play area Pokemon card's name, level, face down stage card,
; color symbol, status symbol (if any), and pluspower/defender symbols (if any).
@@ -5711,7 +5551,6 @@ PrintPlayAreaCardHeader: ; 62d5 (1:62d5)
call WriteByteToBGMap0
.not_defender
ret
-; 0x63b3
FaceDownCardTileNumbers: ; 63b3 (1:63b3)
; starting tile number, cgb palette (grey, yellow/red, green/blue, pink/orange)
@@ -5719,7 +5558,6 @@ FaceDownCardTileNumbers: ; 63b3 (1:63b3)
db $d4, $02 ; stage 1
db $d8, $01 ; stage 2
db $dc, $01 ; stage 2 special
-; 0x63bb
; given a card's status in a, print the Poison symbol at bc if it's poisoned
CheckPrintPoisoned: ; 63bb (1:63bb)
@@ -5732,7 +5570,6 @@ CheckPrintPoisoned: ; 63bb (1:63bb)
call WriteByteToBGMap0
pop af
ret
-; 0x63c7
; given a card's status in a, print the Poison symbol at bc if it's double poisoned
CheckPrintDoublePoisoned: ; 63c7 (1:63c7)
@@ -5740,7 +5577,6 @@ CheckPrintDoublePoisoned: ; 63c7 (1:63c7)
and DOUBLE_POISONED & (POISONED ^ $ff)
jr nz, CheckPrintPoisoned.poison ; double poisoned (print SYM_POISONED)
jr CheckPrintPoisoned.print ; not double poisoned (print SYM_SPACE)
-; 0x63ce
; given a card's status in a, print the Confusion, Sleep, or Paralysis symbol at bc
; for each of those status that is active
@@ -5763,7 +5599,6 @@ CheckPrintCnfSlpPrz: ; 63ce (1:63ce)
.status_symbols
; NO_STATUS, CONFUSED, ASLEEP, PARALYZED
db SYM_SPACE, SYM_CONFUSED, SYM_ASLEEP, SYM_PARALYZED
-; 0x63e6
; print the symbols of the attached energies of a turn holder's play area card
; input:
@@ -5836,7 +5671,6 @@ DisplayUsePokemonPowerScreen: ; 6510 (1:6510)
ld hl, wLoadedCard1Move1Description
call PrintMoveOrCardDescription
ret
-; 0x653e
; print the description of a move, a Pokemon power, or a trainer or energy card
; x,y coordinates of where to start printing the text are given at de
@@ -5856,7 +5690,6 @@ PrintMoveOrCardDescription: ; 653e (1:653e)
call ProcessTextFromID
call SetOneLineSeparation
ret
-; 0x6558
; moves the cards loaded by deck index at hTempRetreatCostCards to the discard pile
DiscardRetreatCostCards: ; 6558 (1:6558)
@@ -5867,7 +5700,6 @@ DiscardRetreatCostCards: ; 6558 (1:6558)
ret z
call PutCardInDiscardPile
jr .discard_loop
-; 0x6564
; moves the discard pile cards that were loaded to hTempRetreatCostCards back to the active Pokemon.
; this exists because they will be discarded again during the call to AttemptRetreat, so
@@ -5885,7 +5717,6 @@ ReturnRetreatCostCardsToArena: ; 6564 (1:6564)
call PutHandCardInPlayArea
pop hl
jr .loop
-; 0x657a
; discard retreat cost energy cards and attempt retreat of the arena card.
; return carry if unable to retreat this turn due to unsuccessful confusion check
@@ -5910,7 +5741,6 @@ AttemptRetreat: ; 657a (1:657a)
xor a
ld [wGotHeadsFromConfusionCheckDuringRetreat], a
ret
-; 0x659f
; given a number between 0-255 in a, converts it to TX_SYMBOL format,
; and writes it to wStringBuffer + 2 and to the BGMap0 address at bc.
@@ -5930,7 +5760,6 @@ WriteTwoByteNumberInTxSymbolFormat: ; 659f (1:659f)
pop bc
pop de
ret
-; 0x65b7
; given a number between 0-99 in a, converts it to TX_SYMBOL format,
; and writes it to wStringBuffer + 3 and to the BGMap0 address at bc.
@@ -5952,7 +5781,6 @@ WriteTwoDigitNumberInTxSymbolFormat: ; 65b7 (1:65b7)
pop de
pop hl
ret
-; 0x65d1
; convert the number at hl to TX_SYMBOL text format and write it to wStringBuffer
; replace leading zeros with SYM_SPACE
@@ -5998,7 +5826,6 @@ TwoByteNumberToTxSymbol_TrimLeadingZeros_Bank1: ; 65d1 (1:65d1)
sbc b
ld h, a
ret
-; 0x6614
; input d, e: max. HP, current HP
DrawHPBar: ; 6614 (1:6614)
@@ -6025,7 +5852,6 @@ DrawHPBar: ; 6614 (1:6614)
sub MAX_HP / HP_BAR_LENGTH
jr nz, .tile_loop
ret
-; 0x6635
; when an opponent's Pokemon card attacks, this displays a screen
; containing the description and information of the used move
@@ -6052,7 +5878,6 @@ DisplayOpponentUsedMoveScreen: ; 6635 (1:6635)
ld hl, wLoadedMoveDescription
call PrintMoveOrCardDescription
ret
-; 0x666a
; display card detail when a trainer card is used, and print "Used xxx"
; hTempCardIndex_ff9f contains the card's deck index
@@ -6061,7 +5886,6 @@ DisplayUsedTrainerCardDetailScreen: ; 666a (1:666a)
ldtx hl, UsedText
call DisplayCardDetailScreen
ret
-; 0x6673
; prints the name and description of a trainer card, along with the
; "Used xxx" text in a text box. this function is used to show the player
@@ -6082,7 +5906,6 @@ PrintUsedTrainerCardDescription: ; 6673 (1:6673)
ldtx hl, UsedText
call DrawWideTextBox_WaitForInput
ret
-; 0x669d
; save data of the current duel to sCurrentDuel
; byte 0 is $01, bytes 1 and 2 are the checksum, byte 3 is [wDuelType]
@@ -6152,7 +5975,6 @@ SaveDuelDataToDE: ; 66a4 (1:66a4)
ld [hl], a ; sCurrentDuelData
call DisableSRAM
ret
-; 0x66e9
Func_66e9: ; 66e9 (1:66e9)
ld hl, sCurrentDuel
@@ -6165,7 +5987,6 @@ Func_66e9: ; 66e9 (1:66e9)
call Func_3a40
or a
ret
-; 0x66ff
; load the data saved in sCurrentDuelData to WRAM according to the distribution
; of DuelDataToSave. assumes saved data exists and that the checksum is valid.
@@ -6206,7 +6027,6 @@ LoadSavedDuelData: ; 66ff (1:66ff)
.done
call DisableSRAM
ret
-; 0x6729
DuelDataToSave: ; 6729 (1:6729)
; dw address, number_of_bytes_to_copy
@@ -6218,7 +6038,6 @@ DuelDataToSave: ; 6729 (1:6729)
dw wRNG1, wRNGCounter + $1 - wRNG1
dw wcda5, $0010
dw $0000
-; 0x6747
; return carry if there is no data saved at sCurrentDuel or if the checksum isn't correct,
; or if the value saved from wDuelType is DUELTYPE_LINK
@@ -6272,7 +6091,6 @@ ValidateSavedDuelData: ; 6759 (1:6759)
call DisableSRAM
pop de
ret
-; 0x6785
; discard data of a duel that was saved by SaveDuelData, by setting the first byte
; of sCurrentDuel to $00, and zeroing the checksum (next two bytes)
@@ -6285,7 +6103,6 @@ DiscardSavedDuelData: ; 6785 (1:6785)
ld [hl], a
call DisableSRAM
ret
-; 0x6793
; loads a player deck (sDeck*Cards) from SRAM to wPlayerDeck
; sCurrentlySelectedDeck determines which sDeck*Cards source (0-3)
@@ -6307,7 +6124,6 @@ LoadPlayerDeck: ; 6793 (1:6793)
jr nz, .copy_cards_loop
call DisableSRAM
ret
-; 0x67b2
; returns carry if wSkipDelayAllowed is non-0 and B is being held in order to branch
; out of the caller's wait frames loop. probably only used for debugging.
@@ -6320,7 +6136,6 @@ CheckSkipDelayAllowed: ; 67b2 (1:67b2)
ret z
scf
ret
-; 0x67be
; related to AI taking their turn in a duel
; called multiple times during one AI turn
@@ -6360,7 +6175,6 @@ AIMakeDecision: ; 67be (1:67be)
.turn_ended
scf
ret
-; 0x67fb
Func_67fb: ; 67fb (1:67fb)
ld a, 10
@@ -6397,7 +6211,6 @@ Func_67fb: ; 67fb (1:67fb)
.asm_6839
call OpenTurnHolderHandScreen_Simple
jr .asm_6829
-; 0x683e
Func_683e: ; 683e (1:683e)
ldh a, [hDPadHeld]
@@ -6422,7 +6235,6 @@ Func_6850: ; 6850 (1:6850)
ld e, 16
lb bc, SYM_CURSOR_R, SYM_SPACE
jp SetCursorParametersForTextBox
-; 0x6862
Func_6862: ; 6862 (1:6862)
ld [wcbff], a
@@ -6481,7 +6293,6 @@ Func_6862: ; 6862 (1:6862)
.right_pressed
call OpenNonTurnHolderDiscardPileScreen
jr .return_carry
-; 0x68c6
Func_68c6: ; 68c6 (1:68c6)
call Func_3b31
@@ -6496,7 +6307,6 @@ Func_68c6: ; 68c6 (1:68c6)
inc hl
ld [hl], d
ret
-; 0x68dd
ResetDoFrameFunction_Bank1: ; 68dd (1:68dd)
xor a
@@ -6504,7 +6314,6 @@ ResetDoFrameFunction_Bank1: ; 68dd (1:68dd)
ld [hli], a
ld [hl], a
ret
-; 0x68e4
; print the AttachedEnergyToPokemonText, given the energy card to attach in hTempCardIndex_ff98,
; and the PLAY_AREA_* of the turn holder's Pokemon to attach the energy to in hTempPlayAreaLocation_ff9d
@@ -6518,7 +6327,6 @@ PrintAttachedEnergyToPokemon: ; 68e4 (1:68e4)
ldtx hl, AttachedEnergyToPokemonText
call DrawWideTextBox_WaitForInput
ret
-; 0x68fa
; print the PokemonEvolvedIntoPokemonText, given the Pokemon card to evolve in wccee,
; and the evolved Pokemon card in hTempCardIndex_ff98. also play a sound effect.
@@ -6532,7 +6340,6 @@ PrintPokemonEvolvedIntoPokemon: ; 68fa (1:68fa)
ldtx hl, PokemonEvolvedIntoPokemonText
call DrawWideTextBox_WaitForInput
ret
-; 0x6911
; handle the opponent's turn in a link duel
; loop until either [wOpponentTurnEnded] or [wDuelFinished] is non-0
@@ -6572,7 +6379,6 @@ DoLinkOpponentTurn: ; 6911 (1:6911)
or [hl]
jr z, .link_opp_turn_loop
ret
-; 0x695e
; actions for the opponent's turn
; on a link duel, this is referenced by DoLinkOpponentTurn in a loop (on each opponent's HandleTurn)
@@ -6606,7 +6412,6 @@ OppAction_DrawCard: ; 698c (1:698c)
call DrawCardFromDeck
call nc, AddCardToHand
ret
-; 0x6993
OppAction_FinishTurnWithoutAttacking: ; 6993 (1:6993)
call DrawDuelMainScene
@@ -6616,7 +6421,6 @@ OppAction_FinishTurnWithoutAttacking: ; 6993 (1:6993)
ld a, 1
ld [wOpponentTurnEnded], a
ret
-; 0x69a5
; attach an energy card from hand to the arena or a benched Pokemon
OppAction_PlayEnergyCard: ; 69a5 (1:69a5)
@@ -6634,7 +6438,6 @@ OppAction_PlayEnergyCard: ; 69a5 (1:69a5)
ld [wAlreadyPlayedEnergy], a
call DrawDuelMainScene
ret
-; 0x69c5
; evolve a Pokemon card in the arena or in the bench
OppAction_EvolvePokemonCard: ; 69c5 (1:69c5)
@@ -6649,7 +6452,6 @@ OppAction_EvolvePokemonCard: ; 69c5 (1:69c5)
call Func_161e
call DrawDuelMainScene
ret
-; 0x69e0
; place a basic Pokemon card from hand in the bench
OppAction_PlayBasicPokemonCard: ; 69e0 (1:69e0)
@@ -6666,7 +6468,6 @@ OppAction_PlayBasicPokemonCard: ; 69e0 (1:69e0)
call Func_161e
call DrawDuelMainScene
ret
-; 0x69ff
; attempt the retreat of the active Pokemon card
; if successful, discard the required energy cards for retreat and
@@ -6691,7 +6492,6 @@ OppAction_AttemptRetreat: ; 69ff (1:69ff)
pop hl
call DrawWideTextBox_WaitForInput_Bank1
ret
-; 0x6a23
; play trainer card from hand
OppAction_PlayTrainerCard: ; 6a23 (1:6a23)
@@ -6702,7 +6502,6 @@ OppAction_PlayTrainerCard: ; 6a23 (1:6a23)
ld a, $01
ld [wSkipDuelistIsThinkingDelay], a
ret
-; 0x6a35
; execute the effect commands of the trainer card that is being played
; used only for Trainer cards, as a continuation of OppAction_PlayTrainerCard
@@ -6717,7 +6516,6 @@ OppAction_ExecuteTrainerCardEffectCommands: ; 6a35 (1:6a35)
call ExchangeRNG
call DrawDuelMainScene
ret
-; 0x6a4e
; begin the execution of an attack and handle the attack being
; possibly unsuccessful due to Sand Attack or Smokescreen
@@ -6754,7 +6552,6 @@ OppAction_BeginUseAttack: ; 6a4e (1:6a4e)
ld a, 1
ld [wOpponentTurnEnded], a
ret
-; 0x6a8c
; display the attack used by the opponent, and handle
; EFFECTCMDTYPE_DISCARD_ENERGY and confusion damage to self
@@ -6776,14 +6573,12 @@ OppAction_UseAttack: ; 6a8c (1:6a8c)
ld a, 1
ld [wOpponentTurnEnded], a
ret
-; 0x6ab1
OppAction_PlayAttackAnimationDealAttackDamage: ; 6ab1 (1:6ab1)
call PlayAttackAnimation_DealAttackDamage
ld a, 1
ld [wOpponentTurnEnded], a
ret
-; 0x6aba
; force the player to switch the active Pokemon with a benched Pokemon
OppAction_ForceSwitchActive: ; 6aba (1:6aba)
@@ -6800,7 +6595,6 @@ OppAction_ForceSwitchActive: ; 6aba (1:6aba)
ldh a, [hTempPlayAreaLocation_ff9d]
call SerialSendByte
ret
-; 0x6ad9
OppAction_UsePokemonPower: ; 6ad9 (1:6ad9)
ldh a, [hTempCardIndex_ff9f]
@@ -6823,7 +6617,6 @@ OppAction_UsePokemonPower: ; 6ad9 (1:6ad9)
ld a, $01
ld [wSkipDuelistIsThinkingDelay], a
ret
-; 0x6b07
; execute the EFFECTCMDTYPE_BEFORE_DAMAGE command of the used Pokemon Power
OppAction_ExecutePokemonPowerEffect: ; 6b07 (1:6b07)
@@ -6833,7 +6626,6 @@ OppAction_ExecutePokemonPowerEffect: ; 6b07 (1:6b07)
ld a, $01
ld [wSkipDuelistIsThinkingDelay], a
ret
-; 0x6b15
; execute the EFFECTCMDTYPE_AFTER_DAMAGE command of the used Pokemon Power
OppAction_6b15: ; 6b15 (1:6b15)
@@ -6842,12 +6634,10 @@ OppAction_6b15: ; 6b15 (1:6b15)
ld a, $01
ld [wSkipDuelistIsThinkingDelay], a
ret
-; 0x6b20
OppAction_DrawDuelMainScene: ; 6b20 (1:6b20)
call DrawDuelMainScene
ret
-; 0x6b24
OppAction_TossCoinATimes: ; 6b24 (1:6b24)
call SerialRecv8Bytes
@@ -6855,7 +6645,6 @@ OppAction_TossCoinATimes: ; 6b24 (1:6b24)
ld a, $01
ld [wSkipDuelistIsThinkingDelay], a
ret
-; 0x6b30
OppAction_6b30: ; 6b30 (1:6b30)
ldh a, [hWhoseTurn]
@@ -6866,7 +6655,6 @@ OppAction_6b30: ; 6b30 (1:6b30)
pop af
ldh [hWhoseTurn], a
ret
-; 0x6b3e
OppAction_6b3e: ; 6b3e (1:6b3e)
call DrawDuelMainScene
@@ -6896,11 +6684,9 @@ OppAction_6b3e: ; 6b3e (1:6b3e)
ld a, c
ld [wccf0], a
ret
-; 0x6b7d
OppAction_NoAction: ; 6b7d (1:6b7d)
ret
-; 0x6b7e
; load the text ID of the card name with deck index given in a to TxRam2
; also loads the card to wLoadedCard1
@@ -6911,7 +6697,6 @@ LoadCardNameToTxRam2: ; 6b7e (1:6b7e)
ld a, [wLoadedCard1Name + 1]
ld [wTxRam2 + 1], a
ret
-; 0x6b8e
; load the text ID of the card name with deck index given in a to TxRam2_b
; also loads the card to wLoadedCard1
@@ -6922,12 +6707,10 @@ LoadCardNameToTxRam2_b: ; 6b8e (1:6b8e)
ld a, [wLoadedCard1Name + 1]
ld [wTxRam2_b + 1], a
ret
-; 0x6b9e
DrawWideTextBox_WaitForInput_Bank1: ; 6b9e (1:6b9e)
call DrawWideTextBox_WaitForInput
ret
-; 0x6ba2
Func_6ba2: ; 6ba2 (1:6ba2)
call DrawWideTextBox_PrintText
@@ -6936,7 +6719,6 @@ Func_6ba2: ; 6ba2 (1:6ba2)
ret z
call WaitForWideTextBoxInput
ret
-; 0x6baf
; apply and/or refresh status conditions and other events that trigger between turns
HandleBetweenTurnsEvents: ; 6baf (1:6baf)
@@ -6973,7 +6755,7 @@ HandleBetweenTurnsEvents: ; 6baf (1:6baf)
ld a, [hl]
or a
jr z, .asm_6c1a
- call $6d3f
+ call Func_6d3f
jr c, .asm_6c1a
call Func_6cfa
ld a, [hl]
@@ -7001,7 +6783,7 @@ HandleBetweenTurnsEvents: ; 6baf (1:6baf)
ld a, [hl]
or a
jr z, .asm_6c3a
- call $6d3f
+ call Func_6d3f
jr c, .asm_6c3a
call Func_6cfa
.asm_6c3a
@@ -7009,7 +6791,6 @@ HandleBetweenTurnsEvents: ; 6baf (1:6baf)
call SwapTurn
call $6e4c
ret
-; 0x6c44
; discard any PLUSPOWER attached to the turn holder's arena and/or bench Pokemon
DiscardAttachedPluspowers: ; 6c44 (1:6c44)
@@ -7023,7 +6804,6 @@ DiscardAttachedPluspowers: ; 6c44 (1:6c44)
jr nz, .unattach_pluspower_loop
ld de, PLUSPOWER
jp MoveCardToDiscardPileIfInArena
-; 0x6c56
; discard any DEFENDER attached to the turn holder's arena and/or bench Pokemon
DiscardAttachedDefenders: ; 6c56 (1:6c56)
@@ -7037,7 +6817,6 @@ DiscardAttachedDefenders: ; 6c56 (1:6c56)
jr nz, .unattach_defender_loop
ld de, DEFENDER
jp MoveCardToDiscardPileIfInArena
-; 0x6c68
; return carry if the turn holder's arena Pokemon card is asleep, poisoned, or double poisoned.
; also, if confused, paralyzed, or asleep, return the status condition in a.
@@ -7059,7 +6838,6 @@ IsArenaPokemonAsleepOrPoisoned: ; 6c68 (1:6c68)
.set_carry
scf
ret
-; 0x6c7e
Func_6c7e: ; 6c7e (1:6c7e)
ld a, [wDuelDisplayedScreen]
@@ -7082,7 +6860,6 @@ Func_6c7e: ; 6c7e (1:6c7e)
call DrawDuelHUDs
call SwapTurn
ret
-; 0x6cab
Func_6cab: ; 6cab (1:6cab)
push af
@@ -7113,7 +6890,6 @@ Func_6cab: ; 6cab (1:6cab)
jr c, .asm_6cd8
call Func_6c7e.asm_6c98
ret
-; 0x6ce4
; prints the name of the card at wTempNonTurnDuelistCardID in a text box
Func_6ce4: ; 6ce4 (1:6ce4)
@@ -7129,7 +6905,6 @@ Func_6ce4: ; 6ce4 (1:6ce4)
pop hl
call DrawWideTextBox_PrintText
ret
-; 0x6cfa
Func_6cfa: ; 6cfa (1:6cfa)
ld a, [hl]
@@ -7172,7 +6947,45 @@ Func_6cfa: ; 6cfa (1:6cfa)
ret
; 0x6d3f
- INCROM $6d3f, $6d84
+Func_6d3f: ; 6d3f (1:6d3f)
+ or a
+ bit POISONED_F , [hl]
+ ret z
+ push hl
+ bit DOUBLE_POISONED_F, [hl]
+ ld a, PSN_DAMAGE
+ ldtx hl, Received10DamageDueToPoisonText
+ jr z, .not_double_poisoned
+ ld a, DBLPSN_DAMAGE
+ ldtx hl, Received20DamageDueToPoisonText
+.not_double_poisoned
+ push af
+ ld [wd4b1], a
+ xor a
+ ld [wd4b2], a
+ push hl
+ call Func_6c7e
+ pop hl
+ call Func_6ce4
+ ld a, $05
+ call Func_6cab
+ pop af
+ ld e, a
+ ld d, $00
+ ld a, DUELVARS_ARENA_CARD_HP
+ call GetTurnDuelistVariable
+ call SubstractHP
+ push hl
+ ld a, $8c
+ call Func_6cab
+ pop hl
+ call PrintKnockedOutIfHLZero
+ push af
+ call WaitForWideTextBoxInput
+ pop af
+ pop hl
+ ret
+; 0x6d84
; given the deck index of a turn holder's card in register a,
; and a pointer in hl to the wLoadedCard* buffer where the card data is loaded,
@@ -7221,16 +7034,16 @@ ConvertSpecialTrainerCardToPokemon: ; 6d84 (1:6d84)
ret
.trainer_to_pkmn_data
- db 10 ; CARD_DATA_HP
- ds $07 ; CARD_DATA_MOVE1_NAME - (CARD_DATA_HP + 1)
- tx DiscardName ; CARD_DATA_MOVE1_NAME
- tx DiscardDescription ; CARD_DATA_MOVE1_DESCRIPTION
- ds $03 ; CARD_DATA_MOVE1_CATEGORY - (CARD_DATA_MOVE1_DESCRIPTION + 2)
- db POKEMON_POWER ; CARD_DATA_MOVE1_CATEGORY
- dw TrainerCardAsPokemonEffectCommands ; CARD_DATA_MOVE1_EFFECT_COMMANDS
- ds $18 ; CARD_DATA_RETREAT_COST - (CARD_DATA_MOVE1_EFFECT_COMMANDS + 2)
- db UNABLE_RETREAT ; CARD_DATA_RETREAT_COST
- ds $0d ; PKMN_CARD_DATA_LENGTH - (CARD_DATA_RETREAT_COST + 1)
+ db 10 ; CARD_DATA_HP
+ ds $07 ; CARD_DATA_MOVE1_NAME - (CARD_DATA_HP + 1)
+ tx DiscardName ; CARD_DATA_MOVE1_NAME
+ tx DiscardDescription ; CARD_DATA_MOVE1_DESCRIPTION
+ ds $03 ; CARD_DATA_MOVE1_CATEGORY - (CARD_DATA_MOVE1_DESCRIPTION + 2)
+ db POKEMON_POWER ; CARD_DATA_MOVE1_CATEGORY
+ dw TrainerCardAsPokemonEffectCommands ; CARD_DATA_MOVE1_EFFECT_COMMANDS
+ ds $18 ; CARD_DATA_RETREAT_COST - (CARD_DATA_MOVE1_EFFECT_COMMANDS + 2)
+ db UNABLE_RETREAT ; CARD_DATA_RETREAT_COST
+ ds $0d ; PKMN_CARD_DATA_LENGTH - (CARD_DATA_RETREAT_COST + 1)
; this function applies status conditions to the defending Pokemon,
; returned by the effect functions in wEffectFunctionsFeedback
@@ -7281,7 +7094,6 @@ Func_6df1: ; 6df1 (1:6df1)
jr .asm_6e23
.asm_6e37
ret
-; 0x6e38
; apply the status condition at hl+1 to the arena Pokemon
; discard the arena Pokemon's status conditions contained in the bitmask at hl
@@ -7301,7 +7113,6 @@ ApplyStatusConditionToArenaPokemon: ; 6e38 (1:6e38)
inc hl
ld [de], a
ret
-; 0x6e49
Func_6e49: ; 6e49 (1:6e49)
call HandleDestinyBondSubstatus
@@ -7369,7 +7180,6 @@ Func_6e49: ; 6e49 (1:6e49)
ld [wDuelFinished], a
scf
jr .asm_6eb2
-; 0x6ed2
Data_6ed2: ; 6ed2 (1:6ed2)
db DUEL_NOT_FINISHED, TURN_PLAYER_LOST, TURN_PLAYER_WON, TURN_PLAYER_TIED
@@ -7390,21 +7200,18 @@ ClearDamageReductionSubstatus2OfKnockedOutPokemon: ; 6ee2 (1:6ee2)
ret nz
call ClearDamageReductionSubstatus2
ret
-; 0x6ef6
Func_6ef6: ; 6ef6 (1:6ef6)
call Func_6fa5
ld hl, wcce8
rl [hl]
ret
-; 0x6eff
Func_6eff: ; 6eff (1:6eff)
call ReplaceKnockedOutPokemon
ld hl, wcce8
rl [hl]
ret
-; 0x6f08
; for each Pokemon in the turn holder's play area (arena and bench),
; move that card to the discard pile if its HP is 0
@@ -7429,7 +7236,6 @@ MoveAllTurnHolderKnockedOutPokemonToDiscardPile: ; 6f08 (1:6f08)
dec d
jr nz, .loop
ret
-; 0x6f23
; have the turn holder replace the arena Pokemon card when it's been knocked out.
; if there are no Pokemon cards in the turn holder's bench, return carry.
@@ -7505,7 +7311,6 @@ ReplaceKnockedOutPokemon: ; 6f23 (1:6f23)
call SerialRecv8Bytes
ldh [hTempPlayAreaLocation_ff9d], a
jr .replace_pokemon
-; 0x6fa5
Func_6fa5: ; 6fa5 (1:6fa5)
call CountKnockedOutPokemon
@@ -7523,7 +7328,6 @@ Func_6fa5: ; 6fa5 (1:6fa5)
call SwapTurn
scf
ret
-; 0x6fc7
; return in wNumberPrizeCardsToTake the amount of Pokemon in the turn holder's
; play area that are still there despite having 0 HP.
@@ -7563,7 +7367,6 @@ CountKnockedOutPokemon: ; 6fc7 (1:6fc7)
ret z
scf
ret
-; 0x6ff7
Func_6ff7: ; 6ff7 (1:6ff7)
ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
@@ -7581,7 +7384,6 @@ Func_6ff7: ; 6ff7 (1:6ff7)
.non_zero_hp
or a
ret
-; 0x700a
; print one of the "There was no effect from" texts depending
; on the value at wNoEffectFromStatus (NO_STATUS or a status condition constant)
@@ -7619,10 +7421,9 @@ PrintThereWasNoEffectFromStatusText: ; 700a (1:700a)
ret z
ldtx hl, ThereWasNoEffectFromToxicText
ret
-; 0x7045
; returns carry if card at hTempPlayAreaLocation_ff9d
-; is a basic card.
+; is a basic card.
; otherwise, lists the card indices of all stages in
; that card location, and returns the card one
; stage below.
@@ -7700,7 +7501,6 @@ GetCardOneStageBelow: ; 7045 (1:7045)
ld e, a
or a
ret
-; 0x70aa
; initializes variables when a duel begins, such as zeroing wDuelFinished or wDuelTurns,
; and setting wDuelType based on wPlayerDuelistType and wOpponentDuelistType
@@ -7731,7 +7531,6 @@ InitVariablesToBeginDuel: ; 70aa (1:70aa)
.set_duel_type
ld [wDuelType], a
ret
-; 0x70e6
; init variables that last a single player's turn
InitVariablesToBeginTurn: ; 70e6 (1:70e6)
@@ -7742,7 +7541,6 @@ InitVariablesToBeginTurn: ; 70e6 (1:70e6)
ldh a, [hWhoseTurn]
ld [wWhoseTurn], a
ret
-; 0x70f6
; make all Pokemon in the turn holder's play area able to evolve. called from the
; player's second turn on, in order to allow evolution of all Pokemon already played.
@@ -7758,7 +7556,6 @@ SetAllPlayAreaPokemonCanEvolve: ; 70f6 (1:70f6)
dec c
jr nz, .next_pkmn_loop
ret
-; 0x7107
; initializes duel variables such as cards in deck and in hand, or Pokemon in play area
; player turn: [c200, c2ff]
@@ -7801,7 +7598,6 @@ InitializeDuelVariables: ; 7107 (1:7107)
dec c
jr nz, .init_play_area
ret
-; 0x7133
; draw [wDuelInitialPrizes] cards from the turn holder's deck and place them as prizes:
; write their deck indexes to DUELVARS_PRIZE_CARDS, set their location to
@@ -7834,11 +7630,9 @@ InitTurnDuelistPrizes: ; 7133 (1:7133)
ld l, DUELVARS_PRIZES
ld [hl], a
ret
-; 0x715a
PrizeBitmasks: ; 715a (1:715a)
db %0, %1, %11, %111, %1111, %11111, %111111
-; 0x7161
; update the turn holder's DUELVARS_PRIZES following that duelist
; drawing a number of prizes equal to register a
@@ -7860,7 +7654,6 @@ TakeAPrizes: ; 7161 (1:7161)
call GetTurnDuelistVariable
ld [hl], b
ret
-; 0x717a
; clear the non-turn holder's duelvars starting at DUELVARS_ARENA_CARD_DISABLED_MOVE_INDEX
; these duelvars only last a two-player turn at most.
@@ -7877,7 +7670,6 @@ ClearNonTurnTemporaryDuelvars: ; 717a (1:717a)
ld [hli], a
ld [hl], a
ret
-; 0x7189
; same as ClearNonTurnTemporaryDuelvars, except the non-turn holder's arena
; Pokemon status condition is copied to wccc5
@@ -7887,7 +7679,6 @@ ClearNonTurnTemporaryDuelvars_CopyStatus: ; 7189 (1:7189)
ld [wccc5], a
call ClearNonTurnTemporaryDuelvars
ret
-; 0x7195
; update non-turn holder's DUELVARS_ARENA_CARD_LAST_TURN_DAMAGE
; if wccef == 0: set to [wDealtDamage]
@@ -7908,7 +7699,6 @@ Func_7195: ; 7195 (1:7195)
ld [hli], a
ld [hl], a
ret
-; 0x71ad
_TossCoin: ; 71ad (1:71ad)
ld [wcd9c], a
@@ -8115,7 +7905,6 @@ Func_7415: ; 7415 (1:7415)
xor a
ld [wce7e], a
ret
-; 0x741a
Func_741a: ; 741a (1:741a)
ld hl, wEffectFunctionsFeedbackIndex
@@ -8165,7 +7954,6 @@ Func_741a: ; 741a (1:741a)
jr .loop
.done
ret
-; 0x7469
; this is a simple version of PlayAttackAnimation_DealAttackDamage that doesn't
; take into account status conditions, damage modifiers, etc, for damage calculation.
@@ -8187,7 +7975,6 @@ PlayAttackAnimation_DealAttackDamageSimple: ; 7469 (1:7469)
pop de
pop hl
ret
-; 0x7484
; if [wLoadedMoveAnimation] != 0, wait until the animation is over
WaitMoveAnimation: ; 7484 (1:7484)
@@ -8201,7 +7988,6 @@ WaitMoveAnimation: ; 7484 (1:7484)
jr c, .anim_loop
pop de
ret
-; 0x7494
; play move animation
; input:
@@ -8254,7 +8040,9 @@ PlayMoveAnimation: ; 7494 (1:7494)
INCROM $74dc, $7571
Func_7571: ; 7571 (1:7571)
- INCROM $7571, $7576
+ farcall Func_19c20
+ ret
+; 0x7576
Func_7576: ; 7576 (1:7576)
farcall Func_1991f
@@ -8264,17 +8052,17 @@ Func_7576: ; 7576 (1:7576)
INCROM $757b, $758f
Func_758f: ; 758f (1:758f)
- INCROM $758f, $7594
+ farcall Func_1a4cf
+ ret
+; 0x7594
Func_7594: ; 7594 (1:7594)
farcall Func_1a61f
ret
-; 0x7599
Func_7599: ; 7599 (1:7599)
farcall Func_1a68d
ret
-; 0x759e
rept $a62
db $ff
diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm
index 5a7761e..eefd707 100644
--- a/src/engine/bank02.asm
+++ b/src/engine/bank02.asm
@@ -794,7 +794,7 @@ DrawPlayArea_PrizeCards: ; 8464 (2:4464)
pop af
ret
-PrizeCardsCoordinateData_YourOrOppPlayArea: ; 0x84b4 (2:44b4)
+PrizeCardsCoordinateData_YourOrOppPlayArea: ; 84b4 (2:44b4)
; x and y coordinates for player prize cards
.player
db 2, 1
@@ -813,7 +813,7 @@ PrizeCardsCoordinateData_YourOrOppPlayArea: ; 0x84b4 (2:44b4)
db 5, 15
; used by Func_833c
-PrizeCardsCoordinateData_2: ; 0x84cc (2:44cc)
+PrizeCardsCoordinateData_2: ; 84cc (2:44cc)
; x and y coordinates for player prize cards
.player
db 6, 0
@@ -831,7 +831,7 @@ PrizeCardsCoordinateData_2: ; 0x84cc (2:44cc)
db 0, 18
db 0, 16
-PrizeCardsCoordinateData_InPlayArea: ; 0x84e4 (2:44e4)
+PrizeCardsCoordinateData_InPlayArea: ; 84e4 (2:44e4)
; x and y coordinates for player prize cards
.player
db 9, 1
@@ -1826,14 +1826,13 @@ ZeroObjectPositionsWithCopyToggleOn: ; 8aa1 (2:4aa1)
ld a, $01
ld [wVBlankOAMCopyToggle], a
ret
-; 0x8aaa
Func_8aaa: ; 8aaa (2:4aaa)
INCROM $8aaa, $8b85
Func_8b85: ; 8b85 (2:4b85)
INCROM $8b85, $8c8e
-
+
OpenGlossaryScreen_TransitionTable:
cursor_transition $08, $28, $00, $04, $01, $05, $05
cursor_transition $08, $38, $00, $00, $02, $06, $06
diff --git a/src/engine/bank03.asm b/src/engine/bank03.asm
index 62b0709..47d9590 100644
--- a/src/engine/bank03.asm
+++ b/src/engine/bank03.asm
@@ -309,7 +309,7 @@ Func_c258: ; c258 (3:4258)
ldh a, [hffb0]
push af
ld a, $2
-asm_c25d
+asm_c25d:
ldh [hffb0], a
push hl
call Func_c268
@@ -681,7 +681,7 @@ Func_c58b: ; c58b (3:458b)
call GetPermissionOfMapPosition
and $10
push af
- ld c, SPRITE_ANIM_FIELD_0F
+ ld c, SPRITE_ANIM_FLAGS
call GetSpriteAnimBufferProperty
pop af
ld a, [hl]
@@ -747,7 +747,7 @@ UpdatePlayerSprite: ; c5e9 (3:45e9)
ld b, a
ld a, [wPlayerDirection]
add b
- farcall Func_12ab5
+ farcall StartNewSpriteAnimation
pop bc
ret
@@ -790,10 +790,10 @@ AttemptPlayerMovement: ; c619 (3:4619)
ld [wPlayerCurrentlyMoving], a
ld a, $10
ld [wd338], a
- ld c, SPRITE_ANIM_FIELD_0F
+ ld c, SPRITE_ANIM_FLAGS
call GetSpriteAnimBufferProperty
set 2, [hl]
- ld c, SPRITE_ANIM_MOVEMENT_COUNTER
+ ld c, SPRITE_ANIM_COUNTER
call GetSpriteAnimBufferProperty
ld a, $4
ld [hl], a
@@ -847,7 +847,7 @@ Func_c687: ; c687 (3:4687)
ld a, [wd339]
call Func_c694
pop bc
- ret
+ ret
Func_c694: ; c694 (3:4694)
push hl
@@ -920,10 +920,10 @@ Func_c6dc: ; c6dc (3:46dc)
Func_c6f7: ; c6f7 (3:46f7)
ld a, [wPlayerSpriteIndex]
ld [wWhichSprite], a
- ld c, SPRITE_ANIM_FIELD_0F
+ ld c, SPRITE_ANIM_FLAGS
call GetSpriteAnimBufferProperty
res 2, [hl]
- ld c, SPRITE_ANIM_MOVEMENT_COUNTER
+ ld c, SPRITE_ANIM_COUNTER
call GetSpriteAnimBufferProperty
ld a, $ff
ld [hl], a
@@ -1160,7 +1160,6 @@ Func_c8ba: ; c8ba (3:48ba)
call DoFrameIfLCDEnabled
call $2c62
ret
-; 0xc8ed
Func_c8ed: ; c8ed (3:48ed)
push hl
@@ -1433,7 +1432,6 @@ GetEventFlagValue: ; ca6c (3:4a6c)
pop hl
or a
ret
-; 0xca84
ZeroStackFlagValue2: ; ca84 (3:4a84)
call GetByteAfterCall
@@ -1491,7 +1489,6 @@ GetByteAfterCall: ; cab3 (3:4ab3)
pop bc
pop hl
ret
-; 0xcac2
MaxStackFlagValue: ; cac2 (3:4ac2)
call GetByteAfterCall
@@ -1503,7 +1500,6 @@ MaxOutEventFlag: ; cac5 (3:4ac5)
call SetEventFlagValue
pop bc
ret
-; 0xcacd
ZeroStackFlagValue: ; cacd (3:4acd)
call GetByteAfterCall
@@ -1559,7 +1555,6 @@ TryGiveMedalPCPacks: ; cad8 (3:4ad8)
pop bc
pop hl
ret
-; 0xcb15
MedalEventFlags: ; cb15 (3:4b15)
db EVENT_FLAG_08
@@ -1734,7 +1729,16 @@ Func_cc32: ; cc32 (3:4c32)
; Used for things that are represented as NPCs but don't have a Script
; EX: Clerks and legendary cards that interact through Level Objects
-NoOverworldSequence: ; cc3e (3:4c3e)
+Script_Clerk10: ; cc3e (3:4c3e)
+Script_GiftCenterClerk: ; cc3e (3:4c3e)
+Script_Woman2: ; cc3e (3:4c3e)
+Script_Torch: ; cc3e (3:4c3e)
+Script_LegendaryCardTopLeft: ; cc3e (3:4c3e)
+Script_LegendaryCardTopRight: ; cc3e (3:4c3e)
+Script_LegendaryCardLeftSpark: ; cc3e (3:4c3e)
+Script_LegendaryCardBottomLeft: ; cc3e (3:4c3e)
+Script_LegendaryCardBottomRight: ; cc3e (3:4c3e)
+Script_LegendaryCardRightSpark: ; cc3e (3:4c3e)
call CloseAdvancedDialogueBox
ret
@@ -1920,7 +1924,7 @@ ScriptCommand_StartBattle: ; cd01 (3:4d01)
ld l, LOADED_NPC_ID
call GetItemInLoadedNPCIndex
ld a, [hl]
-asm_cd2f
+asm_cd2f:
ld [wd0c4], a
ld [wcc14], a
push af
@@ -2103,7 +2107,7 @@ ScriptCommand_MoveWramNPC: ; ce52 (3:4e52)
; Executes movement on an arbitrary NPC using values in a and on the stack
; Changes and fixes Temp NPC using stack values
-ExecuteArbitraryNPCMovementFromStack
+ExecuteArbitraryNPCMovementFromStack:
ld [wTempNPC], a
call FindLoadedNPC
call ExecuteNPCMovement
@@ -2219,21 +2223,21 @@ ScriptCommand_CheckIfCardInCollection: ; cf12 (3:4f12)
ld a, c
call GetCardCountInCollection
-asm_cf16
+asm_cf16:
or a
jr nz, asm_cf1f
-asm_cf19
+asm_cf19:
call SetScriptControlByteFail
jp IncreaseScriptPointerBy4
-asm_cf1f
+asm_cf1f:
call SetScriptControlBytePass
call GetScriptArgs2AfterPointer
jr z, asm_cf2a
jp SetScriptPointer
-asm_cf2a
+asm_cf2a:
jp IncreaseScriptPointerBy4
ScriptCommand_CheckRawAmountOfCardsOwned: ; cf2d (3:4f2d)
@@ -2640,7 +2644,7 @@ Func_d1b3: ; d1b3 (3:51b3)
.asm_d1c3
ld hl, $51dc
-asm_d1c6
+asm_d1c6:
ld e, a
add a
add e
@@ -2917,7 +2921,7 @@ ScriptCommand_TryGivePCPack: ; d3c9 (3:53c9)
jp IncreaseScriptPointerBy2
ScriptCommand_nop: ; d3d1 (3:53d1)
- jp IncreaseScriptPointerBy1
+ jp IncreaseScriptPointerBy1
Func_d3d4: ; d3d4 (3:53d4)
ld a, [wd693]
@@ -3037,11 +3041,11 @@ ScriptCommand_JumpIfFlagEqual: ; d484 (3:5484)
cp c
jr z, ScriptEventPassedTryJump
-ScriptEventFailedNoJump ; d48a (3:548a)
+ScriptEventFailedNoJump: ; d48a (3:548a)
call SetScriptControlByteFail
jp IncreaseScriptPointerBy5
-ScriptEventPassedTryJump ; d490 (3:5490)
+ScriptEventPassedTryJump: ; d490 (3:5490)
call SetScriptControlBytePass
call GetScriptArgs3AfterPointer
jr z, .noJumpAddress
@@ -3109,7 +3113,6 @@ ScriptCommand_JumpIfFlagZero2:
.fail
call SetScriptControlByteFail
jp IncreaseScriptPointerBy4
-; 0xd4ec
LoadOverworld: ; d4ec (3:54ec)
call Func_d4fb
@@ -3208,7 +3211,26 @@ Script_ChallengeMachine: ; d57d (3:557d)
run_command Func_d43d
run_command ScriptCommand_QuitScriptFully
- INCROM $d583, $d753
+Script_Tech1: ; d583 (3:5583)
+ INCROM $d583, $d5ca
+
+Script_Tech2: ; d5ca (3:55ca)
+ INCROM $d5ca, $d5d5
+
+Script_Tech3: ; d5d5 (3:55d5)
+ INCROM $d5d5, $d5e0
+
+Script_Tech4: ; d5e0 (3:55e0)
+ INCROM $d5e0, $d5f9
+
+Script_Tech5: ; d5f9 (3:55f9)
+ INCROM $d5f9, $d61d
+
+Script_Sam: ; d61d (3:561d)
+ INCROM $d61d, $d727
+
+Script_DrMason: ; d727 (3:5727)
+ INCROM $d727, $d753
Script_EnterLabFirstTime: ; d753 (3:5753)
start_script
@@ -3503,7 +3525,19 @@ NPCMovement_d896: ; d896 (3:5896)
db $ff
; 0xd89f
- INCROM $d89f, $d932
+ INCROM $d89f, $d8bb
+
+Script_Tech6: ; d8bb (3:58bb)
+ INCROM $d8bb, $d8c6
+
+Script_Tech7: ; d8c6 (3:58c6)
+ INCROM $d8c6, $d8d1
+
+Script_Tech8: ; d8d1 (3:58d1)
+ INCROM $d8d1, $d8dd
+
+Script_Aaron: ; d8dd (3:58dd)
+ INCROM $d8dd, $d932
Script_d932: ; d932 (3:5932)
start_script
@@ -3799,7 +3833,6 @@ Script_Ronald: ; dc4b (3:5c4b)
.ows_dc60
run_command ScriptCommand_PrintTextQuitFully
tx Text0743
-; 0xdc63
; could be a commented function, or could be placed by mistake from
; someone thinking that the Ronald script ended with more code execution
@@ -3821,6 +3854,7 @@ FightingClubLobbyAfterDuel: ; dc68 (3:5c68)
dw Script_LostToImakuni
db $00
+Script_Man1: ; dc76 (3:5c76)
INCROM $dc76, $dd0d
Script_Imakuni: ; dd0d (3:5d0d)
@@ -3851,7 +3885,6 @@ Script_Imakuni: ; dd0d (3:5d0d)
db IMAKUNI_DECK_ID
db MUSIC_IMAKUNI
run_command ScriptCommand_QuitScriptFully
-; 0xdd2d
Script_BeatImakuni: ; dd2d (3:5d2d)
start_script
@@ -3929,9 +3962,8 @@ ScriptJump_ImakuniCommon: ; dd60 (3:5d60)
db $09
run_command Func_d41d
run_command ScriptCommand_QuitScriptFully
-; 0xdd78
-NPCMovement_dd78 ; dd78 (3:5d78)
+NPCMovement_dd78: ; dd78 (3:5d78)
db SOUTH
db SOUTH
db SOUTH
@@ -3943,7 +3975,16 @@ NPCMovement_dd78 ; dd78 (3:5d78)
db EAST
db $ff
- INCROM $dd82, $dda3
+Script_Specs1: ; dd82 (3:5d82)
+ INCROM $dd82, $dd8d
+
+Script_Butch: ; dd8d (3:5d8d)
+ INCROM $dd8d, $dd9f
+
+Script_Granny1: ; dd9f (3:5d9f)
+ INCROM $dd9f, $ddc3
+
+
FightingClubAfterDuel: ; dda3 (3:5da3)
ld hl, .after_duel_table
@@ -4105,7 +4146,10 @@ Script_Mitch_PrintTrainHarderText
tx Text0488
; 0xde43
- INCROM $de43, $ded5
+ INCROM $de43, $ded1
+
+Script_Clerk2: ; ded1 (3:5ed1)
+ INCROM $ded1, $ded5
RockClubLobbyAfterDuel; ded5 (3:5ed5)
@@ -4129,8 +4173,36 @@ RockClubLobbyAfterDuel; ded5 (3:5ed5)
db $00
; 0xdee9
- INCROM $dee9, $e0a2
+ INCROM $dee9, $def2
+
+Script_Chris: ; def2 (3:5ef2)
+ INCROM $def2, $df39
+Script_Matthew: ; df39 (3:5f39)
+ INCROM $df39, $df83
+
+Script_Woman1: ; df83 (3:5f83)
+ INCROM $df83, $dfc0
+
+Script_Chap1: ; dfc0 (3:5fc0)
+ INCROM $dfc0, $dfd2
+
+Script_Lass3: ; dfd2 (3:5fd2)
+ INCROM $dfd2, $dff0
+
+Script_Ryan: ; dff0 (3:5ff0)
+ INCROM $dff0, $e017
+
+Script_Andrew: ; e017 (3:6017)
+ INCROM $e017, $e03e
+
+Script_Gene: ; e03e (3:603e)
+ INCROM $e03e, $e09e
+
+Script_Clerk3: ; e09e (3:609e)
+ INCROM $e09e, $e0a2
+
+
WaterClubLobbyAfterDuel: ; e0a2 (3:60a2)
ld hl, .after_duel_table
call FindEndOfBattleScript
@@ -4145,6 +4217,7 @@ WaterClubLobbyAfterDuel: ; e0a2 (3:60a2)
db $00
; 0xe0b0
+
Preload_ImakuniInWaterClubLobby: ; e0b0 (3:60b0)
get_flag_value EVENT_IMAKUNI_STATE
cp IMAKUNI_TALKED
@@ -4162,7 +4235,6 @@ Preload_ImakuniInWaterClubLobby: ; e0b0 (3:60b0)
ld [wd111], a
scf
ret
-; 0xe0cf
Script_Gal1: ; e0cf (3:60cf)
start_script
@@ -4780,6 +4852,7 @@ ScriptJump_TalkToAmyAgain: ; e356 (3:6356)
run_command ScriptCommand_QuitScriptFully
; 0xe369
+Script_Clerk4: ; e369 (3:6369)
INCROM $e369, $e36d
LightningClubLobbyAfterDuel: ; e36d (3:636d)
@@ -4796,7 +4869,28 @@ LightningClubLobbyAfterDuel: ; e36d (3:636d)
db $00
; 0xe37B
- INCROM $e37B, $e525
+ INCROM $e37B, $e39a
+
+Script_Chap2: ; e39a (3:639a)
+ INCROM $e39a, $e3d9
+
+Script_Lass4: ; e3d9 (3:63d9)
+ INCROM $e3d9, $e3dd
+
+Script_Hood1: ; e3dd (3:63dd)
+ INCROM $e3dd, $e408
+
+Script_Jennifer: ; e408 (3:6408)
+ INCROM $e408, $e42f
+
+Script_Nicholas: ; e42f (3:642f)
+ INCROM $e42f, $e456
+
+Script_Brandon: ; e456 (3:6456)
+ INCROM $e456, $e4ad
+
+Script_Isaac: ; e4ad (3:64ad)
+ INCROM $e4ad, $e525
GrassClubEntranceAfterDuel: ; e525 (3:6525)
ld hl, GrassClubEntranceAfterDuelTable
@@ -4832,7 +4926,6 @@ FindEndOfBattleScript: ; e52c (3:652c)
inc hl
ld b, [hl]
jp SetNextNPCAndScript
-; 0xe553
GrassClubEntranceAfterDuelTable: ; e553 (3:6553)
db NPC_MICHAEL
@@ -4851,7 +4944,11 @@ GrassClubEntranceAfterDuelTable: ; e553 (3:6553)
dw Script_LostToSecondRonaldFight
db $00
- INCROM $e566, $e5c4
+Script_Clerk5: ; e566 (3:6566)
+ INCROM $e566, $e573
+
+Script_Michael: ; e573 (3:6573)
+ INCROM $e573, $e5c4
GrassClubLobbyAfterDuel: ; e5c4 (3:65c4)
ld hl, .after_duel_table
@@ -4910,13 +5007,13 @@ Script_BeatBrittany: ; e5ee (3:65ee)
run_command ScriptCommand_JumpIfFlagNotLessThan
db EVENT_FLAG_35
db $02
- dw .finishSequence
+ dw .finishScript
run_command ScriptCommand_JumpIfFlagZero2
db EVENT_FLAG_3A
- dw .finishSequence
+ dw .finishScript
run_command ScriptCommand_JumpIfFlagZero2
db EVENT_FLAG_3B
- dw .finishSequence
+ dw .finishScript
run_command ScriptCommand_SetFlagValue
db EVENT_FLAG_35
db $01
@@ -4924,20 +5021,19 @@ Script_BeatBrittany: ; e5ee (3:65ee)
db EVENT_FLAG_1E
run_command ScriptCommand_PrintTextString
tx Text06e8
-.finishSequence
+.finishScript
run_command ScriptCommand_QuitScriptFully
Script_LostToBrittany: ; e618 (3:6618)
start_script
run_command ScriptCommand_PrintTextQuitFully
tx Text06e9
-; 0xe61c
Script_e61c: ; e61c (3:661c)
run_command ScriptCommand_PrintTextQuitFully
tx Text06ea
-Script_e61f: ; e61f (3:661f)
+Script_Lass2: ; e61f (3:661f)
start_script
run_command ScriptCommand_JumpIfFlagNonzero2
db EVENT_FLAG_04
@@ -5104,7 +5200,20 @@ Script_e61f: ; e61f (3:661f)
tx Text06f3
; 0xe6d8
- INCROM $e6d8, $e7f6
+Script_Granny2: ; e6d8 (3:66d8)
+ INCROM $e6d8, $e6e3
+
+Script_Gal2: ; e6e3 (3:66e3)
+ INCROM $e6e3, $e701
+
+Script_Kristin: ; e701 (3:6701)
+ INCROM $e701, $e745
+
+Script_Heather: ; e745 (3:6745)
+ INCROM $e745, $e79e
+
+Script_Nikki: ; e79e (3:679e)
+ INCROM $e79e, $e7f6
ClubEntranceAfterDuel: ; e7f6 (3:67f6)
ld hl, .after_duel_table
@@ -5123,7 +5232,7 @@ ClubEntranceAfterDuel: ; e7f6 (3:67f6)
db $00
; A Ronald is already loaded or not loaded depending on Pre-Load scripts
-; in data/npc_map_data.asm. This just starts a sequence if possible.
+; in data/npc_map_data.asm. This just starts a script if possible.
LoadClubEntrance: ; e809 (3:6809)
call TryFirstRonaldFight
call TrySecondRonaldFight
@@ -5161,7 +5270,11 @@ TrySecondRonaldFight: ; e837 (3:6837)
jp SetNextNPCAndScript
; 0xe84c
- INCROM $e84c, $e862
+Script_Clerk6: ; e84c (3:684c)
+ INCROM $e84c, $e850
+
+Script_Lad3: ; e850 (3:6850)
+ INCROM $e850, $e862
Script_FirstRonaldEncounter: ; e862 (3:6862)
start_script
@@ -5275,7 +5388,7 @@ Script_LostToFirstRonaldFight: ; e8f7 (3:68f7)
run_command ScriptCommand_PrintTextString
tx Text064e
-ScriptJump_FinishedFirstRonaldFight
+ScriptJump_FinishedFirstRonaldFight:
run_command ScriptCommand_SetFlagValue
db EVENT_FLAG_4C
db $02
@@ -5368,7 +5481,7 @@ Script_LostToSecondRonaldFight: ; e955 (3:6955)
run_command ScriptCommand_PrintTextString
tx Text0653
-ScriptJump_FinishedSecondRonaldFight ; e959 (3:6959)
+ScriptJump_FinishedSecondRonaldFight: ; e959 (3:6959)
run_command ScriptCommand_SetFlagValue
db EVENT_FLAG_4D
db $02
@@ -5380,6 +5493,7 @@ ScriptJump_FinishedSecondRonaldFight ; e959 (3:6959)
run_command ScriptCommand_QuitScriptFully
; 0xe963
+
PsychicClubLobbyAfterDuel: ; e963 (3:6963)
ld hl, .after_duel_table
call FindEndOfBattleScript
@@ -5394,7 +5508,35 @@ PsychicClubLobbyAfterDuel: ; e963 (3:6963)
dw $69a1
db $00
- INCROM $e971, $eb57
+ INCROM $e971, $e980
+
+Script_Robert: ; e980 (3:6980)
+ INCROM $e980, $e9a5
+
+Script_Pappy1: ; e9a5 (3:69a5)
+ INCROM $e9a5, $ea30
+
+Script_Gal3: ; ea30 (3:6a30)
+ INCROM $ea30, $ea3b
+
+Script_Chap4: ; ea3b (3:6a3b)
+ INCROM $ea3b, $ea60
+
+Script_Daniel: ; ea60 (3:6a60)
+ INCROM $ea60, $eaa2
+
+Script_Stephanie: ; eaa2 (3:6aa2)
+ INCROM $eaa2, $eadf
+
+Script_Murray2: ; eadf (3:6adf)
+ INCROM $eadf, $eadf
+
+Script_Murray1: ; eadf (3:6adf)
+ INCROM $eadf, $eb53
+
+Script_Clerk7: ; eb53 (3:6b53)
+ INCROM $eb53, $eb57
+
ScienceClubLobbyAfterDuel; eb57 (3:6b57)
ld hl, .after_duel_table
@@ -5411,7 +5553,34 @@ ScienceClubLobbyAfterDuel; eb57 (3:6b57)
db $00
; 0xeb65
- INCROM $eb65, $ed49
+ INCROM $eb65, $eb84
+
+Script_Lad1: ; eb84 (3:6b84)
+ INCROM $eb84, $ebc1
+
+Script_Man3: ; ebc1 (3:6bc1)
+ INCROM $ebc1, $ebc5
+
+Script_Specs2: ; ebc5 (3:6bc5)
+ INCROM $ebc5, $ebed
+
+Script_Specs3: ; ebed (3:6bed)
+ INCROM $ebed, $ec11
+
+Script_David: ; ec11 (3:6c11)
+ INCROM $ec11, $ec42
+
+Script_Erik: ; ec42 (3:6c42)
+ INCROM $ec42, $ec67
+
+Script_Rick: ; ec67 (3:6c67)
+ INCROM $ec67, $ecdb
+
+Script_Joseph: ; ecdb (3:6cdb)
+ INCROM $ecdb, $ed45
+
+Script_Clerk8: ; ed45 (3:6d45)
+ INCROM $ed45, $ed49
FireClubLobbyAfterDuel: ; ed49 (3:6d49)
ld hl, .after_duel_table
@@ -5428,7 +5597,6 @@ FireClubLobbyAfterDuel: ; ed49 (3:6d49)
; 0xed57
-
FireClubPressedA: ; ed57 (3:6d57)
ld hl, SlowpokePaintingObjectTable
call FindExtraInteractableObjects
@@ -5475,7 +5643,16 @@ FindExtraInteractableObjects: ; ed64 (3:6d64)
ret
; 0xed8d
- INCROM $ed8d, $ee76
+ INCROM $ed8d, $ed96
+
+Script_Jessica: ; ed96 (3:6d96)
+ INCROM $ed96, $ede8
+
+Script_Chap3: ; ede8 (3:6de8)
+ INCROM $ede8, $ee2c
+
+Script_Lad2: ; ee2c (3:6e2c)
+ INCROM $ee2c, $ee76
Script_ee76: ; ee76 (3:6e76)
start_script
@@ -5498,9 +5675,11 @@ Script_ee76: ; ee76 (3:6e76)
run_command ScriptCommand_QuitScriptFully
; 0xee88
+Script_Mania: ; ee88 (3:6e88)
INCROM $ee88, $ee93
-FireClubAfterDuel: ; ee93 (3:6e93)
+
+FireClubAfterDuel: ;ee93 (3:6e93)
ld hl, .after_duel_table
call FindEndOfBattleScript
ret
@@ -5529,7 +5708,14 @@ FireClubAfterDuel: ; ee93 (3:6e93)
db $00
; 0xeeb3
- INCROM $eeb3, $ef22
+Script_John: ; eeb3 (3:6eb3)
+ INCROM $eeb3, $eed8
+
+Script_Adam: ; eed8 (3:6ed8)
+ INCROM $eed8, $eefd
+
+Script_Jonathan: ; eefd (3:6efd)
+ INCROM $eefd, $ef22
Script_Ken: ; ef22 (3:6f22)
start_script
@@ -5920,7 +6106,6 @@ Func_f121: ; f121 (3:7121)
jr nz, .asm_f123
or a
ret
-; 0xf146
Unknown_f146: ; f146 (3:7146)
INCROM $f146, $f156
@@ -5975,7 +6160,6 @@ Preload_Guide: ; f270 (3:7270)
.asm_f281
scf
ret
-; 0xf283
Script_Guide: ; f283 (3:7283)
start_script
@@ -6185,7 +6369,7 @@ NPCMovement_f34e: ; f34e (3:734e)
db SOUTH
db $ff
-Script_HostStubbed: ; f352 (3:7352)
+Script_Host: ; f352 (3:7352)
ret
Script_f353: ; f353 (3:7353)
@@ -6427,7 +6611,7 @@ Script_f433: ; f433 (3:7433)
run_command ScriptCommand_Jump
dw WonAtChallengeHall.ows_f4a4
-WonAtChallengeHall; f441 (3:7441)
+WonAtChallengeHall: ; f441 (3:7441)
start_script
run_command ScriptCommand_DoFrames
db 20
@@ -6754,7 +6938,19 @@ Script_f631: ; f631 (3:7631)
ret
; 0xf63c
- INCROM $f63c, $fbdb
+ INCROM $f63c, $f71f
+
+Script_Courtney: ; f71f (3:771f)
+ INCROM $f71f, $f72a
+
+Script_Steve: ; f72a (3:772a)
+ INCROM $f72a, $f735
+
+Script_Jack: ; f735 (3:7735)
+ INCROM $f735, $f740
+
+Script_Rod: ; f740 (3:7740)
+ INCROM $f740, $fbdb
HallOfHonorLoadMap: ; fbdb (3:7bdb)
ld a, SFX_10
diff --git a/src/engine/bank04.asm b/src/engine/bank04.asm
index 76ba2a3..f52cd44 100644
--- a/src/engine/bank04.asm
+++ b/src/engine/bank04.asm
@@ -509,7 +509,7 @@ Func_10fbc: ; 10fbc (4:4fbc)
ld b, $37
.asm_10fd8
ld a, b
- farcall Func_12ab5
+ farcall StartNewSpriteAnimation
ret
Func_10fde: ; 10fde (4:4fde)
@@ -529,12 +529,12 @@ Func_10fde: ; 10fde (4:4fde)
.asm_10ffe
ld a, b
ld [wd33c], a
- call Func_12ab5
+ call StartNewSpriteAnimation
ld a, $3e
farcall GetEventFlagValue
or a
jr nz, .asm_11015
- ld c, SPRITE_ANIM_FIELD_0F
+ ld c, SPRITE_ANIM_FLAGS
call GetSpriteAnimBufferProperty
set 7, [hl]
.asm_11015
@@ -545,7 +545,7 @@ Func_11016: ; 11016 (4:5016)
ld [wWhichSprite], a
ld a, [wd33c]
inc a
- call Func_12ab5
+ call StartNewSpriteAnimation
ret
Func_11024: ; 11024 (4:5024)
@@ -553,7 +553,7 @@ Func_11024: ; 11024 (4:5024)
call PlaySFX
ld a, [wPlayerSpriteIndex]
ld [wWhichSprite], a
- ld c, SPRITE_ANIM_FIELD_0F
+ ld c, SPRITE_ANIM_FLAGS
call GetSpriteAnimBufferProperty
set 2, [hl]
ld hl, Unknown_1229f
@@ -832,20 +832,19 @@ Func_1157c: ; 1157c (4:557c)
.asm_1159f
call $5238
ret
-; 0x115a3
Func_115a3: ; 115a3 (4:55a3)
INCROM $115a3, $1162a
INCLUDE "data/map_scripts.asm"
-; loads a pointer into hl found on NPCDataTable
-GetNPCDataPointer: ; 1184a (4:584a)
+; loads a pointer into hl found on NPCHeaderPointers
+GetNPCHeaderPointer: ; 1184a (4:584a)
; this may have been a macro
rlca
- add LOW(NPCDataTable)
+ add LOW(NPCHeaderPointers)
ld l, a
- ld a, HIGH(NPCDataTable)
+ ld a, HIGH(NPCHeaderPointers)
adc $00
ld h, a
ld a, [hli]
@@ -856,7 +855,7 @@ GetNPCDataPointer: ; 1184a (4:584a)
LoadNPCSpriteData: ; 11857 (4:5857)
push hl
push bc
- call GetNPCDataPointer
+ call GetNPCHeaderPointer
ld a, [hli]
ld [wTempNPC], a
ld a, [hli]
@@ -881,8 +880,8 @@ LoadNPCSpriteData: ; 11857 (4:5857)
; Loads Name into wCurrentNPCNameTx and gets Script ptr into bc
GetNPCNameAndScript: ; 1187d (4:587d)
push hl
- call GetNPCDataPointer
- ld bc, NPC_DATA_OWSEQUENCE_PTR
+ call GetNPCHeaderPointer
+ ld bc, NPC_DATA_SCRIPT_PTR
add hl, bc
ld c, [hl]
inc hl
@@ -899,7 +898,7 @@ GetNPCNameAndScript: ; 1187d (4:587d)
SetNPCDialogName: ; 11893 (4:5893)
push hl
push bc
- call GetNPCDataPointer
+ call GetNPCHeaderPointer
ld bc, NPC_DATA_NAME_TEXT
add hl, bc
ld a, [hli]
@@ -913,7 +912,7 @@ SetNPCDialogName: ; 11893 (4:5893)
Func_118a7: ; 118a7 (4:58a7)
push hl
push bc
- call GetNPCDataPointer
+ call GetNPCHeaderPointer
ld bc, $0007
add hl, bc
ld a, [hli]
@@ -929,7 +928,7 @@ Func_118a7: ; 118a7 (4:58a7)
Func_118bf: ; 118bf (4:58bf)
push hl
push bc
- call GetNPCDataPointer
+ call GetNPCHeaderPointer
ld bc, $000a
add hl, bc
ld a, [hli]
@@ -944,7 +943,7 @@ Func_118d3: ; 118d3 (4:58d3)
push hl
push bc
push af
- call GetNPCDataPointer
+ call GetNPCHeaderPointer
ld bc, $000c
add hl, bc
ld a, [hli]
@@ -953,9 +952,9 @@ Func_118d3: ; 118d3 (4:58d3)
cp $2
jr nz, .asm_118f2
ld a, [wCurMap]
- cp $20
+ cp POKEMON_DOME
jr nz, .asm_118f2
- ld a, $17
+ ld a, MUSIC_MATCH_START_3
ld [wMatchStartTheme], a
.asm_118f2
@@ -1244,7 +1243,7 @@ CreateSpriteAndAnimBufferEntry: ; 1299f (4:699f)
push bc
push hl
call Func_12c05
- ld [wd5d3], a
+ ld [wCurrSpriteTileID], a
xor a
ld [wWhichSprite], a
call GetFirstSpriteAnimBufferProperty
@@ -1284,13 +1283,13 @@ FillNewSpriteAnimBufferEntry: ; 129d9 (4:69d9)
dec c
jr nz, .clearSpriteAnimBufferEntryLoop
pop hl
- ld bc, SPRITE_ANIM_FIELD_05 - 1
+ ld bc, SPRITE_ANIM_ID - 1
add hl, bc
- ld a, [wd5d3]
+ ld a, [wCurrSpriteTileID]
ld [hli], a
ld a, $ff
ld [hl], a
- ld bc, SPRITE_ANIM_MOVEMENT_COUNTER - SPRITE_ANIM_FIELD_05
+ ld bc, SPRITE_ANIM_COUNTER - SPRITE_ANIM_ID
add hl, bc
ld a, $ff
ld [hl], a
@@ -1301,41 +1300,145 @@ FillNewSpriteAnimBufferEntry: ; 129d9 (4:69d9)
INCROM $129fa, $12a21
-Func_12a21: ; 12a21 (4:6a21)
- INCROM $12a21, $12ab5
+HandleAllSpriteAnimations: ; 12a21 (4:6a21)
+ push af
+ ld a, [wd5d7] ; skip animating this frame if enabled
+ or a
+ jr z, .continue
+ pop af
+ ret
+.continue
+ pop af
+ push af
+ push bc
+ push de
+ push hl
+ call ZeroObjectPositions
+ xor a
+ ld [wWhichSprite], a
+ call GetFirstSpriteAnimBufferProperty
+.spriteLoop
+ ld a, [hl]
+ or a
+ jr z, .nextSprite ; skip if SPRITE_ANIM_ENABLED is 0
+ call TryHandleSpriteAnimationFrame
+ call LoadSpriteDataForAnimationFrame
+.nextSprite
+ ld bc, SPRITE_ANIM_LENGTH
+ add hl, bc
+ ld a, [wWhichSprite]
+ inc a
+ ld [wWhichSprite], a
+ cp SPRITE_ANIM_BUFFER_CAPACITY
+ jr nz, .spriteLoop
+ ld hl, wVBlankOAMCopyToggle
+ inc [hl]
+ pop hl
+ pop de
+ pop bc
+ pop af
+ ret
-Func_12ab5: ; 12ab5 (4:6ab5)
+LoadSpriteDataForAnimationFrame: ; 12a5b (4:6a5b)
+ push hl
+ push bc
+ inc hl
+ ld a, [hli]
+ ld [wCurrSpriteAttributes], a
+ ld a, [hli]
+ ld [wCurrSpriteXPos], a
+ ld a, [hli]
+ ld [wCurrSpriteYPos], a
+ ld a, [hl]
+ ld [wCurrSpriteTileID], a
+ ld bc, SPRITE_ANIM_FLAGS - SPRITE_ANIM_TILE_ID
+ add hl, bc
+ ld a, [hl]
+ and 1 << SPRITE_ANIM_FLAG_SKIP_DRAW
+ jr nz, .quit
+ ld bc, SPRITE_ANIM_FRAME_BANK - SPRITE_ANIM_FLAGS
+ add hl, bc
+ ld a, [hli]
+ ld [wd5d6], a
+ or a
+ jr z, .quit
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ call DrawSpriteAnimationFrame
+.quit
+ pop bc
+ pop hl
+ ret
+
+; decrements the given sprite's movement counter (2x if SPRITE_ANIM_FLAG_SPEED is set)
+; moves to the next animation frame if necessary
+TryHandleSpriteAnimationFrame: ; 12a8b (4:6a8b)
+ push hl
+ push bc
+ push de
+ push hl
+ ld d, 1
+ ld bc, SPRITE_ANIM_FLAGS
+ add hl, bc
+ bit SPRITE_ANIM_FLAG_SPEED, [hl]
+ jr z, .skipSpeedIncrease
+ inc d
+.skipSpeedIncrease
+ pop hl
+ ld bc, SPRITE_ANIM_COUNTER
+ add hl, bc
+ ld a, [hl]
+ cp $ff
+ jr z, .exit
+ sub d
+ ld [hl], a
+ jr z, .doNextAnimationFrame
+ jr nc, .exit
+.doNextAnimationFrame
+ ld bc, SPRITE_ANIM_ENABLED - SPRITE_ANIM_COUNTER
+ add hl, bc
+ call HandleAnimationFrame
+.exit
+ pop de
+ pop bc
+ pop hl
+ ret
+
+StartNewSpriteAnimation: ; 12ab5 (4:6ab5)
push hl
push af
- ld c, SPRITE_ANIM_FIELD_05
+ ld c, SPRITE_ANIM_ID
call GetSpriteAnimBufferProperty
pop af
cp [hl]
pop hl
ret z
push hl
- call Func_12ae2
- call Func_12b13
+ call LoadSpriteAnimPointers
+ call HandleAnimationFrame
pop hl
ret
; 0x12ac9
INCROM $12ac9, $12ae2
-Func_12ae2: ; 12ae2 (4:6ae2)
+; Given an animation ID, fills the current sprite's Animation Pointer and Frame Offset Pointer
+; a - Animation ID for current sprite
+LoadSpriteAnimPointers: ; 12ae2 (4:6ae2)
push bc
push af
call GetFirstSpriteAnimBufferProperty
pop af
push hl
- ld bc, $0005
+ ld bc, SPRITE_ANIM_ID
add hl, bc
ld [hli], a
push hl
- ld l, $6
+ ld l, 6 ; 4th entry in MapDataPointers
farcall GetMapDataPointer
- farcall Func_80229
- pop hl
+ farcall LoadGraphicsPointerFromHL
+ pop hl ; hl is animation bank
ld a, [wTempPointerBank]
ld [hli], a
ld a, [wTempPointer]
@@ -1354,60 +1457,63 @@ Func_12ae2: ; 12ae2 (4:6ae2)
pop bc
ret
-Func_12b13: ; 12b13 (4:6b13)
+; hl - beginning of current sprite_anim_buffer
+; Handles a full animation frame using all values in animation structure
+; (frame data offset, anim counter, X Mov, Y Mov)
+HandleAnimationFrame: ; 12b13 (4:6b13)
push bc
push de
push hl
-.asm_12b16
+.tryHandlingFrame
push hl
- ld bc, $0006
+ ld bc, SPRITE_ANIM_BANK
add hl, bc
ld a, [hli]
ld [wTempPointerBank], a
inc hl
inc hl
- ld a, [hl]
+ ld a, [hl] ; SPRITE_ANIM_FRAME_OFFSET_POINTER
ld [wTempPointer], a
- add $4
+ add SPRITE_FRAME_OFFSET_SIZE ; advance FRAME_OFFSET_POINTER by 1 frame, 4 bytes
ld [hli], a
ld a, [hl]
ld [wTempPointer + 1], a
- adc $0
+ adc 0
ld [hl], a
ld de, wd23e
- ld bc, $0004
+ ld bc, SPRITE_FRAME_OFFSET_SIZE
call CopyBankedDataToDE
- pop hl
+ pop hl ; beginning of current sprite_anim_buffer
ld de, wd23e
ld a, [de]
- call Func_12b6a
+ call GetAnimFramePointerFromOffset
inc de
ld a, [de]
- call Func_12b89
- jr c, .asm_12b16
+ call SetAimationCounterAndLoop
+ jr c, .tryHandlingFrame
inc de
- ld bc, $0002
+ ld bc, SPRITE_ANIM_COORD_X
add hl, bc
push hl
- ld bc, $000d
+ ld bc, SPRITE_ANIM_FLAGS - SPRITE_ANIM_COORD_X
add hl, bc
ld b, [hl]
pop hl
ld a, [de]
- bit 0, b
- jr z, .asm_12b5a
+ bit SPRITE_ANIM_FLAG_X_SUBTRACT, b
+ jr z, .addXOffset
cpl
inc a
-.asm_12b5a
+.addXOffset
add [hl]
ld [hli], a
inc de
ld a, [de]
- bit 1, b
- jr z, .asm_12b64
+ bit SPRITE_ANIM_FLAG_Y_SUBTRACT, b
+ jr z, .addYOffset
cpl
inc a
-.asm_12b64
+.addYOffset
add [hl]
ld [hl], a
pop hl
@@ -1415,13 +1521,16 @@ Func_12b13: ; 12b13 (4:6b13)
pop bc
ret
-Func_12b6a: ; 12b6a (4:6b6a)
+; Calls GetAnimationFramePointer after setting up wTempPointerBank and wd4ca
+; a - frame offset from Animation Data
+; hl - beginning of Sprite Anim Buffer
+GetAnimFramePointerFromOffset: ; 12b6a (4:6b6a)
ld [wd4ca], a
push hl
push bc
push de
push hl
- ld bc, $0006
+ ld bc, SPRITE_ANIM_BANK
add hl, bc
ld a, [hli]
ld [wTempPointerBank], a
@@ -1430,34 +1539,36 @@ Func_12b6a: ; 12b6a (4:6b6a)
ld a, [hli]
ld [wTempPointer + 1], a
pop hl
- call Func_3d72
+ call GetAnimationFramePointer ; calls with the original map data script pointer/bank
pop de
pop bc
pop hl
ret
-Func_12b89: ; 12b89 (4:6b89)
+; Sets the animation counter for the current sprite. If the value is zero, loop the animation
+; a - new animation counter
+SetAimationCounterAndLoop: ; 12b89 (4:6b89)
push hl
push bc
- ld bc, $000e
+ ld bc, SPRITE_ANIM_COUNTER
add hl, bc
ld [hl], a
or a
- jr nz, .asm_12ba4
- ld bc, $fff9
+ jr nz, .exit
+ ld bc, SPRITE_ANIM_POINTER - SPRITE_ANIM_COUNTER
add hl, bc
ld a, [hli]
- add $3
+ add 3 ; skip base bank/pointer at beginning of data structure
ld c, a
ld a, [hli]
- adc $0
+ adc 0
ld b, a
ld a, c
ld [hli], a
ld a, b
ld [hl], a
scf
-.asm_12ba4
+.exit
pop bc
pop hl
ret
diff --git a/src/engine/bank05.asm b/src/engine/bank05.asm
index 762d5c8..6af2582 100644
--- a/src/engine/bank05.asm
+++ b/src/engine/bank05.asm
@@ -26,35 +26,30 @@ AIActionTable_Unreferenced: ; 1406a (5:406a)
ld a, OPPACTION_FINISH_NO_ATTACK
bank1call AIMakeDecision
ret
-; 0x1409e
.star_duel ; 1409e (5:409e)
call AIPlayInitialBasicCards
ret
-; 0x140a2
.forced_switch ; 140a2 (5:40a2)
call AIDecideBenchPokemonToSwitchTo
ret
-; 0x140a6
.ko_switch ; 140a6 (5:40a6)
call AIDecideBenchPokemonToSwitchTo
ret
-; 0x140aa
.take_prize ; 140aa (5:40aa)
call AIPickPrizeCards
ret
-; 0x140ae
; returns carry if damage dealt from any of
; a card's moves KOs defending Pokémon
; outputs index of the move that KOs
; input:
-; [hTempPlayAreaLocation_ff9d] = location of attacking card to consider
+; [hTempPlayAreaLocation_ff9d] = location of attacking card to consider
; output:
-; [wSelectedAttack] = move index that KOs
+; [wSelectedAttack] = move index that KOs
CheckIfAnyMoveKnocksOutDefendingCard: ; 140ae (5:40ae)
xor a ; first move
call CheckIfMoveKnocksOutDefendingCard
@@ -72,7 +67,6 @@ CheckIfMoveKnocksOutDefendingCard: ; 140b5 (5:40b5)
ret nz
scf
ret
-; 0x140c5
; returns carry if any of the defending Pokémon's attacks
; brings card at hTempPlayAreaLocation_ff9d down
@@ -96,7 +90,6 @@ CheckIfAnyDefendingPokemonAttackDealsSameDamageAsHP: ; 140c5 (5:40c5)
.true
scf
ret
-; 0x140df
; checks AI scores for all benched Pokémon
; returns the location of the card with highest score
@@ -126,12 +119,11 @@ FindHighestBenchScore: ; 140df (5:40df)
ldh [hTempPlayAreaLocation_ff9d], a
or a
ret
-; 0x140fe
; adds a to wAIScore
; if there's overflow, it's capped at $ff
; output:
-; a = a + wAIScore (capped at $ff)
+; a = a + wAIScore (capped at $ff)
AddToAIScore: ; 140fe (5:40fe)
push hl
ld hl, wAIScore
@@ -142,7 +134,6 @@ AddToAIScore: ; 140fe (5:40fe)
ld [hl], a
pop hl
ret
-; 0x1410a
; subs a from wAIScore
; if there's underflow, it's capped at $00
@@ -162,7 +153,6 @@ SubFromAIScore: ; 1410a (5:410a)
pop de
pop hl
ret
-; 0x1411d
; loads defending Pokémon's weakness/resistance
; and the number of prize cards in both sides
@@ -181,7 +171,6 @@ LoadDefendingPokemonColorWRAndPrizeCards: ; 1411d (5:411d)
call CountPrizes
ld [wAIOpponentPrizeCount], a
ret
-; 0x14145
; called when AI has chosen its attack.
; executes all effects and damage.
@@ -220,7 +209,6 @@ AITryUseAttack: ; 14145 (5:4145)
ld a, OPPACTION_ATTACK_ANIM_AND_DAMAGE
bank1call AIMakeDecision
ret
-; 0x14184
; return carry if any of the following is satisfied:
; - deck index in a corresponds to a double colorless energy card;
@@ -284,7 +272,7 @@ CheckIfEnergyIsUseful: ; 14184 (5:4184)
pop de
or a
ret
-
+
.check_energy
ld a, d
cp e
@@ -293,7 +281,6 @@ CheckIfEnergyIsUseful: ; 14184 (5:4184)
pop de
scf
ret
-; 0x141da
; pick a random Pokemon in the bench.
; output:
@@ -305,7 +292,6 @@ PickRandomBenchPokemon: ; 141da (5:41da)
call Random
inc a
ret
-; 0x141e5
AIPickPrizeCards: ; 141e5 (5:41e5)
ld a, [wNumberPrizeCardsToTake]
@@ -320,7 +306,6 @@ AIPickPrizeCards: ; 141e5 (5:41e5)
jr nz, .loop
.done
ret
-; 0x141f8
; picks a prize card at random
; and adds it to the hand.
@@ -367,7 +352,6 @@ AIPickPrizeCards: ; 141e5 (5:41e5)
db $1 << 5
db $1 << 6
db $1 << 7
-; 0x14226
; routine for AI to play all Basic cards from its hand
; in the beginning of the Duel.
@@ -394,7 +378,6 @@ AIPlayInitialBasicCards: ; 14226 (5:4226)
call PutHandPokemonCardInPlayArea
pop hl
jr .check_for_next_card
-; 0x1424b
; returns carry if Pokémon at hTempPlayAreaLocation_ff9d
; can't use a move or if that selected move doesn't have enough energy
@@ -422,14 +405,13 @@ CheckIfSelectedMoveIsUnusable: ; 1424b (5:424b)
ld a, EFFECTCMDTYPE_INITIAL_EFFECT_1
call TryExecuteEffectCommandFunction
ret c
-
+
.bench
call CheckEnergyNeededForAttack
ret c ; can't be used
ld a, MOVE_FLAG2_ADDRESS | FLAG_2_BIT_5_F
call CheckLoadedMoveFlag
ret
-; 0x14279
; load selected move from Pokémon in hTempPlayAreaLocation_ff9d
; and checks if there is enough energy to execute the selected move
@@ -440,7 +422,7 @@ CheckIfSelectedMoveIsUnusable: ; 1424b (5:424b)
; b = basic energy still needed
; c = colorless energy still needed
; e = output of ConvertColorToEnergyCardID, or $0 if not a move
-; carry set if no move
+; carry set if no move
; OR if it's a Pokémon Power
; OR if not enough energy for move
CheckEnergyNeededForAttack: ; 14279 (5:4279)
@@ -463,7 +445,7 @@ CheckEnergyNeededForAttack: ; 14279 (5:4279)
ld e, c
scf
ret
-
+
.is_attack
ldh a, [hTempPlayAreaLocation_ff9d]
ld e, a
@@ -479,7 +461,7 @@ CheckEnergyNeededForAttack: ; 14279 (5:4279)
ld de, wLoadedMoveEnergyCost
ld b, 0
ld c, (NUM_TYPES / 2) - 1
-
+
.loop
; check all basic energy cards except colorless
ld a, [de]
@@ -498,7 +480,7 @@ CheckEnergyNeededForAttack: ; 14279 (5:4279)
; will always just return the result for one type of basic energy,
; while all others will necessarily have an energy cost of 0
; if moves are added to the game with energy requirements of
-; two different basic energy types, then this routine only accounts
+; two different basic energy types, then this routine only accounts
; for the type with the highest index
; colorless
@@ -534,16 +516,15 @@ CheckEnergyNeededForAttack: ; 14279 (5:4279)
ld d, 0
scf
ret
-; 0x142f4
-; takes as input the energy cost of a move for a
+; takes as input the energy cost of a move for a
; particular energy, stored in the lower nibble of a
; if the move costs some amount of this energy, the lower nibble of a != 0,
; and this amount is stored in wTempLoadedMoveEnergyCost
; sets carry flag if not enough energy of this type attached
; input:
-; a = this energy cost of move (lower nibble)
-; [hl] = attached energy
+; a = this energy cost of move (lower nibble)
+; [hl] = attached energy
; output:
; carry set if not enough of this energy type attached
CheckIfEnoughParticularAttachedEnergy: ; 142f4 (5:42f4)
@@ -569,7 +550,6 @@ CheckIfEnoughParticularAttachedEnergy: ; 142f4 (5:42f4)
inc b
scf
ret
-; 0x1430f
; input:
; a = energy type
@@ -661,7 +641,6 @@ CheckIfCardCanBePlayed: ; 1433d (5:433d)
ld a, EFFECTCMDTYPE_INITIAL_EFFECT_1
call TryExecuteEffectCommandFunction
ret
-; 0x1438c
; loads all the energy cards
; in hand in wDuelTempList
@@ -704,7 +683,6 @@ CreateEnergyCardListFromHand: ; 1438c (5:438c)
cp $ff
ccf
ret
-; 0x143bf
; looks for card ID in hand and
; sets carry if a card wasn't found
@@ -752,7 +730,6 @@ LookForCardIDInHand: ; 143bf (5:43bf)
pop hl
or a
ret
-; 0x143e5
; stores in wDamage, wAIMinDamage and wAIMaxDamage the calculated damage
; done to the defending Pokémon by a given card and move
@@ -799,7 +776,7 @@ EstimateDamage_VersusDefendingCard: ; 143e5 (5:43e5)
ld a, [wDamage]
ld [wAIMinDamage], a
ld [wAIMaxDamage], a
-
+
.calculation
; if temp. location is active, damage calculation can be done directly...
ldh a, [hTempPlayAreaLocation_ff9d]
@@ -966,7 +943,6 @@ _CalculateDamage_VersusDefendingPokemon: ; 14462 (5:4462)
ld a, $ff
ld [hl], a
ret
-; 0x1450b
; stores in wDamage, wAIMinDamage and wAIMaxDamage the calculated damage
; done to the Pokémon at hTempPlayAreaLocation_ff9d
@@ -1070,9 +1046,9 @@ EstimateDamage_FromDefendingPokemon: ; 1450b (5:450b)
; and poison damage for two turns
; and outputs the result capped at a max of $ff
; input:
-; [wAIMinDamage] = base damage
-; [wAIMaxDamage] = base damage
-; [wDamage] = base damage
+; [wAIMinDamage] = base damage
+; [wAIMaxDamage] = base damage
+; [wDamage] = base damage
; [hTempPlayAreaLocation_ff9d] = location of card to calculate
; damage as the receiver
CalculateDamage_FromDefendingPokemon: ; 1458c (5:458c)
@@ -1207,7 +1183,6 @@ CalculateDamage_FromDefendingPokemon: ; 1458c (5:458c)
ld a, $ff
ld [hl], a
ret
-; 0x14663
AIProcessHandTrainerCards: ; 14663 (5:4663)
farcall _AIProcessHandTrainerCards
@@ -1243,7 +1218,6 @@ LookForCardIDInHandList_Bank5: ; 155d2 (5:55d2)
ldh a, [hTempCardIndex_ff98]
scf
ret
-; 0x155ef
; returns carry if card ID in a
; is found in Play Area, starting with
@@ -1280,7 +1254,6 @@ LookForCardIDInPlayArea_Bank5: ; 155ef (5:55ef)
ld a, b
scf
ret
-; 0x15612
; check if energy card ID in e is in AI hand and,
; if so, attaches it to card ID in d in Play Area.
@@ -1305,7 +1278,6 @@ AIAttachEnergyInHandToCardInPlayArea: ; 15612 (5:5612)
ld a, OPPACTION_PLAY_ENERGY
bank1call AIMakeDecision
ret
-; 0x1562b
; same as AIAttachEnergyInHandToCardInPlayArea but
; only look for card ID in the Bench.
@@ -1317,7 +1289,6 @@ AIAttachEnergyInHandToCardInBench: ; 1562b (5:562b)
ret nc
ld b, PLAY_AREA_BENCH_1
jr AIAttachEnergyInHandToCardInPlayArea.attach
-; 0x15636
InitAIDuelVars: ; 15636 (5:5636)
ld a, $10
@@ -1417,7 +1388,6 @@ InitAITurnVars: ; 15649 (5:5649)
ld [wAIBarrierFlagCounter], a
.done
ret
-; 0x156c3
; load selected move from Pokémon in hTempPlayAreaLocation_ff9d,
; gets an energy card to discard and subsequently
@@ -1430,7 +1400,7 @@ InitAITurnVars: ; 15649 (5:5649)
; b = basic energy still needed
; c = colorless energy still needed
; e = output of ConvertColorToEnergyCardID, or $0 if not a move
-; carry set if no move
+; carry set if no move
; OR if it's a Pokémon Power
; OR if not enough energy for move
CheckEnergyNeededForAttackAfterDiscard: ; 156c3 (5:56c3)
@@ -1534,7 +1504,6 @@ CheckEnergyNeededForAttackAfterDiscard: ; 156c3 (5:56c3)
ld d, 0
scf
ret
-; 0x1575e
; zeroes a bytes starting at hl
ClearMemory_Bank5: ; 1575e (5:575e)
@@ -1551,7 +1520,6 @@ ClearMemory_Bank5: ; 1575e (5:575e)
pop bc
pop af
ret
-; 0x1576b
; returns in a the tens digit of value in a
CalculateByteTensDigit: ; 1576b (5:576b)
@@ -1566,13 +1534,12 @@ CalculateByteTensDigit: ; 1576b (5:576b)
ld a, c
pop bc
ret
-; 0x15778
; returns in a the result of
; dividing b by a, rounded down
; input:
-; a = divisor
-; b = dividend
+; a = divisor
+; b = dividend
CalculateBDividedByA_Bank5: ; 15778 (5:5778)
push bc
ld c, a
@@ -1588,7 +1555,6 @@ CalculateBDividedByA_Bank5: ; 15778 (5:5778)
ld a, c
pop bc
ret
-; 0x15787
; returns in a the number of energy cards attached
; to Pokémon in location held by e
@@ -1603,7 +1569,7 @@ CountNumberOfEnergyCardsAttached: ; 15787 (5:5787)
ld a, [wTotalAttachedEnergies]
or a
ret z
-
+
xor a
push hl
push bc
@@ -1623,7 +1589,6 @@ CountNumberOfEnergyCardsAttached: ; 15787 (5:5787)
pop bc
pop hl
ret
-; 0x157a3
; returns carry if any card with ID in e is found
; in card location in a
@@ -1660,7 +1625,6 @@ CheckIfAnyCardIDinLocation: ; 157a3 (5:57a3)
ld a, e
scf
ret
-; 0x157c6
; counts total number of energy cards in opponent's hand
; plus all the cards attached in Turn Duelist's Play Area.
@@ -1699,7 +1663,6 @@ CountOppEnergyCardsInHandAndAttached: ; 157c6 (5:57c6)
dec d
jr nz, .loop_play_area
ret
-; 0x157f3
; returns carry if any card with ID in e is found
; in the list that is pointed by hl.
@@ -1751,7 +1714,6 @@ RemoveCardIDInList: ; 157f3 (5:57f3)
pop hl
or a
ret
-; 0x1581b
; play Pokemon cards from the hand to set the starting
; Play Area of Boss decks.
@@ -1787,7 +1749,6 @@ TrySetUpBossStartingPlayArea: ; 1581b (5:581b)
.set_carry
scf
ret
-; 0x1583f
; runs through input card ID list in de.
; plays to Play Area first card that is found in hand.
@@ -1825,7 +1786,6 @@ TrySetUpBossStartingPlayArea: ; 1581b (5:581b)
.not_found
scf
ret
-; 0x1585b
Func_1585b: ; 1585b (5:585b)
INCROM $1585b, $158b2
@@ -1884,7 +1844,7 @@ AIDecideWhetherToRetreat: ; 158b2 (5:58b2)
jr nc, .active_cant_ko_1
ld a, 35
call SubFromAIScore
-
+
.active_cant_ko_1
call CheckIfDefendingPokemonCanKnockOut
jr nc, .defending_cant_ko
@@ -2264,7 +2224,6 @@ AIDecideWhetherToRetreat: ; 158b2 (5:58b2)
pop de
jr nc, .loop_ko_3
jr .set_carry
-; 0x15b54
; if player's turn and loaded move is not a Pokémon Power OR
; if opponent's turn and wcddb == 0
@@ -2291,7 +2250,6 @@ Func_15b54: ; 15b54 (5:5b54)
ld a, %10000000
ld [wcdda], a
ret
-; 0x15b72
; calculates AI score for bench Pokémon
; returns in a and [hTempPlayAreaLocation_ff9d] the
@@ -2595,7 +2553,6 @@ AIDecideBenchPokemonToSwitchTo: ; 15b72 (5:5b72)
xor a
ld [wcdb4], a
jp FindHighestBenchScore
-; 0x15d4f
; handles AI action of retreating Arena Pokémon
; and chooses which energy cards to discard.
@@ -2755,7 +2712,7 @@ AITryToRetreat: ; 15d4f (5:5d4f)
; second, shuffle attached cards and discard energy cards
; that are not of the same type as the Pokémon
-; the exception for this are cards that are needed for
+; the exception for this are cards that are needed for
; some attacks but are not of the same color as the Pokémon
; (i.e. Psyduck's Headache attack)
; and energy cards attached to Eevee corresponding to a
@@ -2842,7 +2799,6 @@ AITryToRetreat: ; 15d4f (5:5d4f)
bank1call AIMakeDecision
or a
ret
-; 0x15ea6
; Copy cards from wDuelTempList in hl to wHandTempList in de
CopyHandCardList: ; 15ea6 (5:5ea6)
@@ -3174,7 +3130,7 @@ AIDecideEvolution: ; 15f4c (5:5f4c)
call CalculateByteTensDigit
call SubFromAIScore
-; if is Mysterious Fossil or
+; if is Mysterious Fossil or
; wLoadedCard1Unknown2 is set to $02,
; raise AI score
.check_mysterious_fossil
@@ -3363,7 +3319,7 @@ Func_16120: ; 16120 (5:6120)
ret
; if Dragonair is active, check its damage in HP
-; if this result is >= 50,
+; if this result is >= 50,
; and if at least 3 energy cards attached,
; check if there's a Muk in any duelist's Play Area
.is_active
@@ -3377,7 +3333,6 @@ Func_16120: ; 16120 (5:6120)
cp 3
jr c, .lower_score
jr .check_muk
-; 0x161d5
; determine AI score for the legendary cards
; Moltres, Zapdos and Articuno
@@ -3416,7 +3371,7 @@ Func_161d5: ; 161d5 (5:61d5)
jr nc, .subtract
call AIDecideWhetherToRetreat
jr c, .subtract
-
+
; checks for player's active card status
ld a, DUELVARS_ARENA_CARD_STATUS
call GetNonTurnDuelistVariable
@@ -3481,7 +3436,6 @@ Func_161d5: ; 161d5 (5:61d5)
call CountPokemonIDInBothPlayAreas
jr c, .subtract
ret
-; 0x16270
; check if player's active Pokémon is Mr Mime
; if it isn't, set carry
@@ -3508,7 +3462,6 @@ CheckDamageToMrMime: ; 16270 (5:6270)
.set_carry
scf
ret
-; 0x1628f
; returns carry if arena card
; can knock out defending Pokémon
@@ -3521,11 +3474,10 @@ CheckIfActiveCardCanKnockOut: ; 1628f (5:628f)
jp c, .fail
scf
ret
-
+
.fail
or a
ret
-; 0x162a1
; outputs carry if any of the active Pokémon attacks
; can be used and are not residual
@@ -3556,11 +3508,10 @@ CheckIfActivePokemonCanUseAnyNonResidualMove: ; 162a1 (5:62a1)
.ok
scf
ret
-; 0x162c8
; looks for energy card(s) in hand depending on
; what is needed for selected card, for both moves
-; - if one basic energy is required, look for that energy;
+; - if one basic energy is required, look for that energy;
; - if one colorless is required, create a list at wDuelTempList
; of all energy cards;
; - if two colorless are required, look for double colorless;
@@ -3618,11 +3569,10 @@ LookForEnergyNeededInHand: ; 162c8 (5:62c8)
call LookForCardIDInHandList_Bank5
ret c
jr .no_carry
-; 0x16311
; looks for energy card(s) in hand depending on
; what is needed for selected card and move
-; - if one basic energy is required, look for that energy;
+; - if one basic energy is required, look for that energy;
; - if one colorless is required, create a list at wDuelTempList
; of all energy cards;
; - if two colorless are required, look for double colorless;
@@ -3665,9 +3615,8 @@ LookForEnergyNeededForMoveInHand: ; 16311 (5:6311)
call LookForCardIDInHandList_Bank5
ret c
jr .done
-; 0x1633f
-; goes through $00 terminated list pointed
+; goes through $00 terminated list pointed
; by wAICardListPlayFromHandPriority 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.
@@ -3726,13 +3675,12 @@ SortTempHandByIDList: ; 1633f (5:633f)
.not_same
inc hl
jr .next_hand_card
-; 0x1637b
; looks for energy card(s) in list at wDuelTempList
; depending on energy flags set in a
; return carry if successful in finding card
; input:
-; a = energy flags needed
+; a = energy flags needed
CheckEnergyFlagsNeededInList: ; 1637b (5:637b)
ld e, a
ld hl, wDuelTempList
@@ -3791,7 +3739,6 @@ CheckEnergyFlagsNeededInList: ; 1637b (5:637b)
.no_carry
or a
ret
-; 0x163c9
; returns in a the energy cost of both moves from card index in a
; represented by energy flags
@@ -3813,7 +3760,6 @@ GetMovesEnergyCostBits: ; 163c9 (5:63c9)
pop bc
or b
ret
-; 0x163dd
; returns in a the energy cost of a move in [hl]
; represented by energy flags
@@ -3880,7 +3826,6 @@ GetEnergyCostBits: ; 163dd (5:63dd)
.done
ld a, c
ret
-; 0x16422
; set carry flag if any card in
; wDuelTempList evolves card index in a
@@ -3925,7 +3870,6 @@ CheckForEvolutionInList: ; 16422 (5:6422)
ld [hl], a
or a
ret
-; 0x16451
; set carry if it finds an evolution for
; the card index in a in the deck
@@ -3977,9 +3921,8 @@ CheckForEvolutionInDeck: ; 16451 (5:6451)
ld a, e
scf
ret
-; 0x16488
-Func_16488 ; 16488 (5:6488)
+Func_16488: ; 16488 (5:6488)
INCROM $16488, $164a1
; have AI choose an energy card to play, but do not play it.
@@ -4048,9 +3991,8 @@ RetrievePlayAreaAIScoreFromBackup1: ; 164d3 (5:64d3)
ld [wAIScore], a
pop af
ret
-; 0x164e8
-; have AI decide whether to play energy card from hand
+; have AI decide whether to play energy card from hand
; and determine which card is best to attach it.
AIProcessAndTryToPlayEnergy: ; 164e8 (5:64e8)
xor a
@@ -4302,7 +4244,7 @@ AIProcessEnergyCards: ; 164fc (5:64fc)
ld a, $80
sub b
call SubFromAIScore
-
+
.skip_boss_deck
ld a, 1
call AddToAIScore
@@ -4313,7 +4255,7 @@ AIProcessEnergyCards: ; 164fc (5:64fc)
call DetermineAIScoreOfMoveEnergyRequirement
ld a, $01 ; second move
call DetermineAIScoreOfMoveEnergyRequirement
-
+
; store bench score for this card.
.store_score
ldh a, [hTempPlayAreaLocation_ff9d]
@@ -4352,7 +4294,6 @@ AIProcessEnergyCards: ; 164fc (5:64fc)
.no_carry
or a
ret
-; 0x16695
; checks score related to selected move,
; in order to determine whether to play energy card.
@@ -4552,7 +4493,6 @@ DetermineAIScoreOfMoveEnergyRequirement: ; 16695 (5:6695)
pop af
ld [hl], a
ret
-; 0x167b5
; returns in hTempPlayAreaLocation_ff9d the Play Area location
; of the card with the highest Play Area AI score, unless
@@ -4630,7 +4570,6 @@ FindPlayAreaCardWithHighestAIScore: ; 167b5 (5:67b5)
.no_carry
or a
ret
-; 0x16805
; returns carry if there's an evolution card
; that can evolve card in hTempPlayAreaLocation_ff9d,
@@ -4670,7 +4609,6 @@ CheckIfEvolutionNeedsEnergyForMove: ; 16805 (5:6805)
ld [hl], a
scf
ret
-; 0x1683b
; returns in e the card ID of the energy required for
; the Discard/Energy Boost attack loaded in wSelectedAttack.
@@ -4680,7 +4618,7 @@ CheckIfEvolutionNeedsEnergyForMove: ; 16805 (5:6805)
; output:
; b = 1 if needs color energy, 0 otherwise;
; c = 1 if only needs colorless energy, 0 otherwise;
-; carry set if not Zapdos2's Thunderbolt attack.
+; carry set if not Zapdos2's Thunderbolt attack.
GetEnergyCardForDiscardOrEnergyBoostAttack: ; 1683b (5:683b)
; load card ID and check selected move index.
ldh a, [hTempPlayAreaLocation_ff9d]
@@ -4763,7 +4701,6 @@ GetEnergyCardForDiscardOrEnergyBoostAttack: ; 1683b (5:683b)
lb bc, $00, $01
scf
ret
-; 0x1689f
; called after the AI has decided which card to attach
; energy from hand. AI does checks to determine whether
@@ -4929,7 +4866,6 @@ AITryToPlayEnergyCard: ; 1689f (5:689f)
or a
jp z, .second_attack
ret
-; 0x1696e
; check if playing certain decks so that AI can decide whether to play
; double colorless to some specific cards.
@@ -4938,7 +4874,7 @@ AITryToPlayEnergyCard: ; 1689f (5:689f)
; return carry if there's a double colorless in hand to attach
; and it's one of the card IDs from these decks.
; output:
-; [hTemp_ffa0] = card index of double colorless in hand;
+; [hTemp_ffa0] = card index of double colorless in hand;
; carry set if can play energy card.
CheckSpecificDecksToAttachDoubleColorless: ; 1696e (5:696e)
push bc
@@ -5016,7 +4952,6 @@ CheckSpecificDecksToAttachDoubleColorless: ; 1696e (5:696e)
call GetCardIDFromDeckIndex
ld a, e
ret
-; 0x169ca
; have AI choose an attack to use, but do not execute it.
; return carry if an attack is chosen.
@@ -5059,7 +4994,6 @@ RetrievePlayAreaAIScoreFromBackup2: ; 169e3 (5:69e3)
ld [wAIScore], a
pop af
ret
-; 0x169f8
; have AI choose and execute an attack.
; return carry if an attack was chosen and attempted.
@@ -5122,7 +5056,7 @@ AIProcessAttacks: ; 169fc (5:69fc)
or a
jr z, .attack_chosen
call CheckWhetherToSwitchToFirstAttack
-
+
.attack_chosen
; check whether to execute the attack chosen
ld a, [wAIExecuteProcessedAttack]
@@ -5189,7 +5123,6 @@ AIProcessAttacks: ; 169fc (5:69fc)
inc [hl]
or a
ret
-; 0x16a86
; determines the AI score of attack index in a
; of card in Play Area location hTempPlayAreaLocation_ff9d.
@@ -5268,7 +5201,7 @@ GetAIScoreOfAttack: ; 16a86 (5:6a86)
; raise AI score by the number of damage counters that this move deals.
; if no damage is dealt, subtract AI score. in case wDamage is zero
; but wMaxDamage is not, then encourage move afterwards.
-; otherwise, if wMaxDamage is also zero, check for damage against
+; otherwise, if wMaxDamage is also zero, check for damage against
; player's bench, and encourage move in case there is.
.check_damage
xor a
@@ -5317,7 +5250,7 @@ GetAIScoreOfAttack: ; 16a86 (5:6a86)
ld a, e
call CalculateByteTensDigit
call SubFromAIScore
-
+
push de
ld a, MOVE_FLAG1_ADDRESS | HIGH_RECOIL_F
call CheckLoadedMoveFlag
@@ -5639,7 +5572,7 @@ GetAIScoreOfAttack: ; 16a86 (5:6a86)
; isn't (doubly) poisoned already.
; if opposing Pokémon is only poisoned and not double poisoned,
; and this move has FLAG_2_BIT_6 set, discourage it
-; (possibly to make Nidoking's Toxic attack less likely to be chosen
+; (possibly to make Nidoking's Toxic attack less likely to be chosen
; if the other Pokémon is poisoned.)
ld a, MOVE_FLAG1_ADDRESS | INFLICT_POISON_F
call CheckLoadedMoveFlag
@@ -5741,7 +5674,6 @@ GetAIScoreOfAttack: ; 16a86 (5:6a86)
.done
ret
-; 0x16dcd
; this function handles moves with the FLAG_3_BIT_1 set,
; and makes specific checks in each of these moves
@@ -5845,7 +5777,7 @@ HandleNidoranFCallForFamily:
; checks for certain card IDs of Fighting color in deck.
; if any of them are found, return a score of
; $80 + slots available in bench.
-HandleMarowak1CallForFriend
+HandleMarowak1CallForFriend:
ld e, GEODUDE
ld a, CARD_LOCATION_DECK
call CheckIfAnyCardIDinLocation
@@ -6044,7 +5976,7 @@ HandleNinetalesMixUp: ; 16f4e (5:6f4e)
or a
jr nz, .loop_hand
; is a basic Pokémon card
- inc b
+ inc b
jr .loop_hand
.tally_basic_cards
ld a, b
@@ -6143,7 +6075,6 @@ HandleHyperBeam: ; 17005 (5:7005)
.keep_score
ld a, $80
ret
-; 0x17019
; called when second attack is determined by AI to have
; more AI score than the first attack, so that it checks
@@ -6194,9 +6125,8 @@ CheckWhetherToSwitchToFirstAttack: ; 17019 (5:7019)
ld a, $01
ld [wSelectedAttack], a
ret
-; 0x17057
-; returns carry if there are
+; returns carry if there are
; any basic Pokémon cards in deck.
CheckIfAnyBasicPokemonInDeck: ; 17057 (5:7057)
ld e, 0
@@ -6226,7 +6156,6 @@ CheckIfAnyBasicPokemonInDeck: ; 17057 (5:7057)
.set_carry
scf
ret
-; 0x17080
; checks in other Play Area for non-basic cards.
; afterwards, that card is checked for damage,
@@ -6280,7 +6209,7 @@ LookForCardThatIsKnockedOutOnDevolution: ; 17080 (5:7080)
ldh [hTempPlayAreaLocation_ff9d], a
or a
ret
-
+
.set_carry
call SwapTurn
pop af
@@ -6288,7 +6217,6 @@ LookForCardThatIsKnockedOutOnDevolution: ; 17080 (5:7080)
ld a, c
scf
ret
-; 0x170c9
; returns carry if the following conditions are met:
; - arena card HP >= half max HP
@@ -6331,7 +6259,6 @@ CheckIfArenaCardIsAtHalfHPCanEvolveAndUseSecondMove: ; 170c9 (5:70c9)
.no_carry
or a
ret
-; 0x17101
; count Pokemon in the Bench that
; meet the following conditions:
@@ -6418,7 +6345,6 @@ CountNumberOfSetUpBenchPokemon: ; 17101 (5:7101)
ret z
scf
ret
-; 0x17161
; handles AI logic to determine some selections regarding certain attacks,
; if any of these attacks were chosen to be used.
@@ -6433,7 +6359,6 @@ AISelectSpecialAttackParameters: ; 17161 (5:7161)
ld a, b
ld [wSelectedAttack], a
ret
-; 0x1716e
.SelectAttackParameters: ; 1716e (5:716e)
ld a, DUELVARS_ARENA_CARD
@@ -6551,7 +6476,6 @@ AISelectSpecialAttackParameters: ; 17161 (5:7161)
ldh [hTempPlayAreaLocation_ffa1], a
scf
ret
-; 0x171fb
; return carry if Pokémon at play area location
; in hTempPlayAreaLocation_ff9d does not have
@@ -6604,7 +6528,7 @@ CheckIfNoSurplusEnergyForMove: ; 171fb (5:71fb)
inc de
dec c
jr nz, .loop
-
+
; colorless
ld a, [de]
swap a
@@ -6622,17 +6546,16 @@ CheckIfNoSurplusEnergyForMove: ; 171fb (5:71fb)
; exactly the amount of energy needed
scf
ret
-; 0x17258
-; takes as input the energy cost of a move for a
+; takes as input the energy cost of a move for a
; particular energy, stored in the lower nibble of a
; if the move costs some amount of this energy, the lower nibble of a != 0,
; and this amount is stored in wTempLoadedMoveEnergyCost
; also adds the amount of energy still needed
; to wTempLoadedMoveEnergyNeededAmount
; input:
-; a = this energy cost of move (lower nibble)
-; [hl] = attached energy
+; a = this energy cost of move (lower nibble)
+; [hl] = attached energy
; output:
; carry set if not enough of this energy type attached
CalculateParticularAttachedEnergyNeeded: ; 17258 (5:7258)
@@ -6656,7 +6579,6 @@ CalculateParticularAttachedEnergyNeeded: ; 17258 (5:7258)
pop bc
ld [wTempLoadedMoveEnergyNeededAmount], a
jr .done
-; 0x17274
; return carry if there is a card that
; can evolve a Pokémon in hand or deck.
@@ -6709,7 +6631,6 @@ CheckCardEvolutionInHandOrDeck: ; 17274 (5:7274)
ld a, e
scf
ret
-; 0x172af
; sets up the inital hand of boss deck.
; always draws at least 2 Basic Pokemon cards and 2 Energy cards.
@@ -6843,7 +6764,6 @@ SetUpBossStartingHandAndDeck: ; 172af (5:72af)
dec b
jr nz, .draw_loop
ret
-; 0x17366
; expectation: return carry if card ID corresponding
; to the input deck index is listed in wAICardListAvoidPrize;
@@ -6879,12 +6799,11 @@ SetUpBossStartingHandAndDeck: ; 172af (5:72af)
pop hl
or a
ret
-; 0x17383
; returns carry if Pokemon at PLAY_AREA* in a
; can damage defending Pokémon with any of its moves
; input:
-; a = location of card to check
+; a = location of card to check
CheckIfCanDamageDefendingPokemon: ; 17383 (5:7383)
ldh [hTempPlayAreaLocation_ff9d], a
xor a ; first move
@@ -6914,7 +6833,6 @@ CheckIfCanDamageDefendingPokemon: ; 17383 (5:7383)
.set_carry
scf
ret
-; 0x173b1
; checks if defending Pokémon can knock out
; card at hTempPlayAreaLocation_ff9d with any of its moves
@@ -6958,7 +6876,6 @@ CheckIfDefendingPokemonCanKnockOut: ; 173b1 (5:73b1)
.set_carry
scf
ret
-; 0x173e4
; return carry if defending Pokémon can knock out
; card at hTempPlayAreaLocation_ff9d
@@ -6997,7 +6914,6 @@ CheckIfDefendingPokemonCanKnockOutWithMove: ; 173e4 (5:73e4)
.done
or a
ret
-; 0x17414
; sets carry if Opponent's deck ID
; is between LEGENDARY_MOLTRES_DECK_ID (inclusive)
@@ -7018,7 +6934,6 @@ CheckIfOpponentHasBossDeckID: ; 17414 (5:7414)
pop af
or a
ret
-; 0x17426
; sets carry if not a boss fight
; and if s0a00a == 0
@@ -7037,7 +6952,6 @@ CheckIfNotABossDeckID: ; 17426 (5:7426)
.set_carry
scf
ret
-; 0x1743b
; probability to return carry:
; - 50% if deck AI is playing is on the list;
@@ -7085,7 +6999,6 @@ AIChooseRandomlyNotToDoAction: ; 1743b (5:743b)
pop de
pop hl
ret
-; 0x17474
; checks if any bench Pokémon has same ID
; as input, and sets carry if it has more than
@@ -7132,7 +7045,7 @@ CheckForBenchIDAtHalfHPAndCanUseSecondMove: ; 17474 (5:7474)
ld hl, wcdf9
cp [hl]
jr nz, .loop
-
+
ld a, c
ldh [hTempPlayAreaLocation_ff9d], a
ld a, $01 ; second move
@@ -7154,7 +7067,6 @@ CheckForBenchIDAtHalfHPAndCanUseSecondMove: ; 17474 (5:7474)
ret z
scf
ret
-; 0x174cd
; add 5 to wPlayAreaEnergyAIScore AI score corresponding to all cards
; in bench that have same ID as register a
@@ -7186,7 +7098,6 @@ RaiseAIScoreToAllMatchingIDsInBench: ; 174cd (5:74cd)
ld [hl], a
pop hl
jr .loop
-; 0x174f2
; goes through each play area Pokémon, and
; for all cards of the same ID, determine which
@@ -7291,7 +7202,7 @@ Func_174f2: ; 174f2 (5:74f2)
ld a, [de]
or a
jr z, .check_next
-; decrease score
+; decrease score
dec [hl]
jr .check_next
.card_with_highest
@@ -7310,7 +7221,6 @@ Func_174f2: ; 174f2 (5:74f2)
pop de
pop hl
jp .loop_play_area
-; 0x17583
; loads wcdea + play area location in e
; with nenergy * 2 + $80 - floor(dam / 10)
@@ -7340,7 +7250,6 @@ Func_17583: ; 17583 (5:7583)
pop de
pop hl
ret
-; 0x175a8
; counts how many play area locations in wcdea
; are != 0, and outputs result in a
@@ -7361,7 +7270,6 @@ Func_175a8: ; 175a8 (5:75a8)
ld a, d
cp 2
ret
-; 0x175bd
; handle how AI scores giving out Energy Cards
; when using Legendary Articuno deck
@@ -7373,7 +7281,6 @@ HandleLegendaryArticunoEnergyScoring: ; 175bd (5:75bd)
.articuno_deck
call ScoreLegendaryArticunoCards
ret
-; 0x175c9
-Func_175c9 ; 175c9 (5:75c9)
+Func_175c9: ; 175c9 (5:75c9)
INCROM $175c9, $18000
diff --git a/src/engine/bank06.asm b/src/engine/bank06.asm
index 19f5e1f..7833675 100644
--- a/src/engine/bank06.asm
+++ b/src/engine/bank06.asm
@@ -150,7 +150,6 @@ _CopyCardNameAndLevel_HalfwidthText:
pop de
pop bc
ret
-; 0x180d5
; this function is called when the player is shown the "In Play Area" screen.
; it can be called with either the select button (DuelMenuShortcut_BothActivePokemon),
@@ -717,7 +716,7 @@ OpenInPlayAreaScreen_HandleInput: ; 183bb (6:43bb)
or a
ret
-ZeroObjectPositionsAndToggleOAMCopy_Bank6 ; 184bf (6:44bf)
+ZeroObjectPositionsAndToggleOAMCopy_Bank6: ; 184bf (6:44bf)
call ZeroObjectPositions
ld a, $01
ld [wVBlankOAMCopyToggle], a
@@ -1523,7 +1522,13 @@ Func_19a12: ; 19a12 (6:5a12)
ret
; 0x19a1f
- INCROM $19a1f, $1a61f
+ INCROM $19a1f, $19c20
+
+Func_19c20: ; 19c20 (6:5c20)
+ INCROM $19c20, $1a4cf
+
+Func_1a4cf: ; 1a4cf (6:64cf)
+ INCROM $1a4cf, $1a61f
Func_1a61f: ; 1a61f (6:661f)
push af
@@ -1582,7 +1587,6 @@ Func_1a61f: ; 1a61f (6:661f)
call ResumeSong
bank1call OpenCardPage_FromHand
ret
-; 0x1a68d
Func_1a68d: ; 1a68d (6:668d)
ld a, $c2 ; player's turn
@@ -1613,14 +1617,14 @@ Func_1a68d: ; 1a68d (6:668d)
ld [de], a
lb de, $38, $9f
call SetupText
- bank1call InitAndDrawCardListScreenLayout
+ bank1call InitAndDrawCardListScreenLayout
ldtx hl, ChooseTheCardYouWishToExamineText
ldtx de, Text0196
bank1call SetCardListHeaderText
ld a, A_BUTTON | START
ld [wNoItemSelectionMenuKeys], a
- bank1call DisplayCardList
- ret
+ bank1call DisplayCardList
+ ret
CommentedOut_1a6cc: ; 1a6cc (6:66cc)
ret
@@ -1975,7 +1979,7 @@ PrintPlayerNameFromInput:
rept 10
textfw3 "_"
endr
- done
+ done
; check if button pressed.
; if pressed, set the carry bit on.
@@ -2566,8 +2570,8 @@ KeyboardData_Player: ; (6:6baf)
kbitem $04, $12, $37, $00, TX_FULLWIDTH3, "I"
kbitem $06, $12, $38, $00, TX_FULLWIDTH3, "R"
kbitem $08, $12, $39, $00, "n"
- kbitem $0a, $12, $3a, $00, "c"
- kbitem $0c, $12, $3b, $00, "p"
+ kbitem $0a, $12, $3a, $00, "c"
+ kbitem $0c, $12, $3b, $00, "p"
kbitem $10, $0f, $01, $09, $0000
kbitem $00, $00, $00, $00, $0000
@@ -2749,7 +2753,7 @@ LoadHalfWidthTextCursorTile:
.data
rept TILE_SIZE
- db $f0
+ db $f0
endr
; it's only for naming the deck.
diff --git a/src/engine/bank07.asm b/src/engine/bank07.asm
index 45cc8b1..af41613 100644
--- a/src/engine/bank07.asm
+++ b/src/engine/bank07.asm
@@ -319,14 +319,13 @@ Func_1c58e: ; 1c58e (7:458e)
add [hl]
inc hl
.asm_1c5ae
- farcall Func_12ab5
+ farcall StartNewSpriteAnimation
.quit
pop af
ld [wWhichSprite], a
pop bc
pop hl
ret
-; 0x1c5b9
Func_1c5b9: ; 1c5b9 (7:45b9)
INCROM $1c5b9, $1c5e9
@@ -518,7 +517,7 @@ Func_1c78d: ; 1c78d (7:478d)
Func_1c7de: ; 1c7de (7:47de)
ld a, [wc3b7]
and $20
- ret
+ ret
; 0x1c7e4
INCROM $1c7e4, $1c82e
@@ -580,7 +579,7 @@ Func_1c8ef: ; 1c8ef (7:48ef)
ld a, [wd421]
or a
jr z, .check_to_play_sfx
-
+
push hl
ld bc, $0003
add hl, bc
@@ -653,8 +652,8 @@ Func_1c94a:
ld [wd42b], a
call Func_1c980
pop af
-
- farcall Func_12ab5
+
+ farcall StartNewSpriteAnimation
or a
jr .return
@@ -667,7 +666,7 @@ Func_1c980: ; 1c980 (7:4980)
push hl
push bc
ld a, [wAnimationQueue]
- ld c, SPRITE_ANIM_FIELD_01
+ ld c, SPRITE_ANIM_ATTRIBUTES
call GetSpriteAnimBufferProperty_SpriteInA
call Func_1c9a2
@@ -679,7 +678,7 @@ Func_1c980: ; 1c980 (7:4980)
ld [hli], a
ld [hl], c
pop af
-
+
ld bc, $000c
add hl, bc
ld c, a
diff --git a/src/engine/bank08.asm b/src/engine/bank08.asm
index 1bb06a3..272f7c7 100644
--- a/src/engine/bank08.asm
+++ b/src/engine/bank08.asm
@@ -194,7 +194,6 @@ _AIProcessHandTrainerCards: ; 200e5 (8:40e5)
.pop_hl
pop hl
jp .loop_hand
-; 0x201b5
; makes AI use Potion card.
AIPlay_Potion: ; 201b5 (8:41b5)
@@ -212,7 +211,6 @@ AIPlay_Potion: ; 201b5 (8:41b5)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x201d1
; if AI doesn't decide to retreat this card,
; check if defending Pokémon can KO active card
@@ -256,7 +254,6 @@ AIDecide_Potion1: ; 201d1 (8:41d1)
.no_carry
or a
ret
-; 0x20204
; finds a card in Play Area to use Potion on.
; output:
@@ -310,7 +307,7 @@ AIDecide_Potion2: ; 20204 (8:4204)
call GetTurnDuelistVariable
cp $ff
ret z
- call .check_boost_if_taken_damage
+ call .check_boost_if_taken_damage
jr c, .has_boost_damage
call GetCardDamage
cp 20 ; if damage >= 20
@@ -356,7 +353,6 @@ AIDecide_Potion2: ; 20204 (8:4204)
.no_carry
or a
ret
-; 0x2027e
; return carry if either of the attacks are usable
; and have the BOOST_IF_TAKEN_DAMAGE effect.
@@ -385,7 +381,6 @@ AIDecide_Potion2: ; 20204 (8:4204)
pop de
scf
ret
-; 0x202a8
; makes AI use Super Potion card.
AIPlay_SuperPotion: ; 202a8 (8:42a8)
@@ -406,7 +401,6 @@ AIPlay_SuperPotion: ; 202a8 (8:42a8)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x202cc
; if AI doesn't decide to retreat this card and card has
; any energy cards attached, check if defending Pokémon can KO
@@ -451,7 +445,6 @@ AIDecide_SuperPotion1: ; 202cc (8:42cc)
.no_carry
or a
ret
-; 0x20305
; returns carry if card has energies attached.
.check_attached_energy ; 20305 (8:4305)
@@ -461,7 +454,6 @@ AIDecide_SuperPotion1: ; 202cc (8:42cc)
ret z
scf
ret
-; 0x2030f
; finds a card in Play Area to use Super Potion on.
; output:
@@ -568,7 +560,6 @@ AIDecide_SuperPotion2: ; 2030f (8:430f)
.no_carry
or a
ret
-; 0x20394
; returns carry if card has energies attached.
.check_attached_energy ; 20394 (8:4394)
@@ -578,7 +569,6 @@ AIDecide_SuperPotion2: ; 2030f (8:430f)
ret z
scf
ret
-; 0x2039e
; return carry if either of the attacks are usable
; and have the BOOST_IF_TAKEN_DAMAGE effect.
@@ -607,7 +597,6 @@ AIDecide_SuperPotion2: ; 2030f (8:430f)
pop de
scf
ret
-; 0x203c8
; returns carry if discarding energy card renders any attack unusable,
; given that they have enough energy to be used before discarding.
@@ -642,7 +631,6 @@ AIDecide_SuperPotion2: ; 2030f (8:430f)
pop de
scf
ret
-; 0x203f8
AIPlay_Defender: ; 203f8 (8:43f8)
ld a, [wAITrainerCardToPlay]
@@ -652,7 +640,6 @@ AIPlay_Defender: ; 203f8 (8:43f8)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x20406
; returns carry if using Defender can prevent a KO
; by the defending Pokémon.
@@ -738,7 +725,6 @@ AIDecide_Defender1: ; 20406 (8:4406)
.no_carry
or a
ret
-; 0x20486
; return carry if using Defender prevents Pokémon
; from being knocked out by an attack with recoil.
@@ -813,7 +799,6 @@ AIDecide_Defender2: ; 20486 (8:4486)
.no_carry
or a
ret
-; 0x204e8
AIPlay_Pluspower: ; 204e8 (8:44e8)
ld a, [wCurrentAIFlags]
@@ -826,7 +811,6 @@ AIPlay_Pluspower: ; 204e8 (8:44e8)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x20501
; returns carry if using a Pluspower can KO defending Pokémon
; if active card cannot KO without the boost.
@@ -901,7 +885,6 @@ AIDecide_Pluspower1: ; 20501 (8:4501)
ld a, SECOND_ATTACK
scf
ret
-; 0x20562
; return carry if move is useable and KOs
; defending Pokémon with Pluspower boost.
@@ -929,7 +912,6 @@ AIDecide_Pluspower1: ; 20501 (8:4501)
.unusable
or a
ret
-; 0x20589
; returns carry if Pluspower boost does
; not exceed 30 damage when facing Mr. Mime.
@@ -949,7 +931,6 @@ AIDecide_Pluspower1: ; 20501 (8:4501)
; damage is >= 30 but not Mr. Mime
scf
ret
-; 0x205a5
; returns carry 7/10 of the time
; if selected move is useable, can't KO without Pluspower boost
@@ -970,7 +951,6 @@ AIDecide_Pluspower2: ; 205a5 (8:45a5)
.no_carry
or a
ret
-; 0x205bb
; returns carry if Pluspower boost does
; not exceed 30 damage when facing Mr. Mime.
@@ -990,7 +970,6 @@ AIDecide_Pluspower2: ; 205a5 (8:45a5)
; damage is >= 30 but not Mr. Mime
scf
ret
-; 0x205d7
; return carry if move is useable but cannot KO.
.check_can_ko ; 205d7 (8:45d7)
@@ -1011,7 +990,6 @@ AIDecide_Pluspower2: ; 205a5 (8:45a5)
.unuseable
or a
ret
-; 0x205f6
; return carry 7/10 of the time if
; move is useable and minimum damage > 0.
@@ -1027,7 +1005,6 @@ AIDecide_Pluspower2: ; 205a5 (8:45a5)
call Random
cp 3
ret
-; 0x20612
AIPlay_Switch: ; 20612 (8:4612)
ld a, [wCurrentAIFlags]
@@ -1042,7 +1019,6 @@ AIPlay_Switch: ; 20612 (8:4612)
xor a
ld [wcdb4], a
ret
-; 0x2062e
; returns carry if the active card has less energy cards
; than the retreat cost and if AI can't play an energy
@@ -1092,7 +1068,6 @@ AIDecide_Switch: ; 2062e (8:462e)
farcall AIDecideBenchPokemonToSwitchTo
ccf
ret
-; 0x20666
AIPlay_GustOfWind: ; 20666 (8:4666)
ld a, [wCurrentAIFlags]
@@ -1105,7 +1080,6 @@ AIPlay_GustOfWind: ; 20666 (8:4666)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x2067e
AIDecide_GustOfWind: ; 2067e (8:467e)
ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
@@ -1481,7 +1455,6 @@ AIDecide_GustOfWind: ; 2067e (8:467e)
pop bc
scf
ret
-; 0x2086d
AIPlay_Bill: ; 2086d (8:486d)
ld a, [wAITrainerCardToPlay]
@@ -1489,7 +1462,6 @@ AIPlay_Bill: ; 2086d (8:486d)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x20878
; return carry if cards in deck > 9
AIDecide_Bill: ; 20878 (8:4878)
@@ -1497,7 +1469,6 @@ AIDecide_Bill: ; 20878 (8:4878)
call GetTurnDuelistVariable
cp DECK_SIZE - 9
ret
-; 0x20880
AIPlay_EnergyRemoval: ; 20880 (8:4880)
ld a, [wAITrainerCardToPlay]
@@ -1509,7 +1480,6 @@ AIPlay_EnergyRemoval: ; 20880 (8:4880)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x20895
; picks an energy card in the player's Play Area to remove
AIDecide_EnergyRemoval: ; 20895 (8:4895)
@@ -1712,7 +1682,6 @@ AIDecide_EnergyRemoval: ; 20895 (8:4895)
.skip_2
pop de
ret
-; 0x20994
AIPlay_SuperEnergyRemoval: ; 20994 (8:4994)
ld a, [wAITrainerCardToPlay]
@@ -1732,7 +1701,6 @@ AIPlay_SuperEnergyRemoval: ; 20994 (8:4994)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x209bc
; picks two energy cards in the player's Play Area to remove
AIDecide_SuperEnergyRemoval: ; 209bc (8:49bc)
@@ -1746,7 +1714,7 @@ AIDecide_SuperEnergyRemoval: ; 209bc (8:49bc)
call GetTurnDuelistVariable
cp $ff
jr z, .exit
-
+
ld d, a
push de
call .LookForNonDoubleColorless
@@ -1949,7 +1917,6 @@ AIDecide_SuperEnergyRemoval: ; 209bc (8:49bc)
pop de
scf
ret
-; 0x20ac1
; stores in wce06 the highest damaging attack
; for the card in play area location in e
@@ -2001,7 +1968,6 @@ AIDecide_SuperEnergyRemoval: ; 209bc (8:49bc)
.skip_2
pop de
ret
-; 0x20b06
AIPlay_PokemonBreeder: ; 20b06 (8:4b06)
ld a, [wAITrainerCardToPlay]
@@ -2013,7 +1979,6 @@ AIPlay_PokemonBreeder: ; 20b06 (8:4b06)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x20b1b
AIDecide_PokemonBreeder: ; 20b1b (8:4b1b)
call IsPrehistoricPowerActive
@@ -2357,7 +2322,6 @@ AIDecide_PokemonBreeder: ; 20b1b (8:4b1b)
pop af
scf
ret
-; 0x20cae
AIPlay_ProfessorOak: ; 20cae (8:4cae)
ld a, [wCurrentAIFlags]
@@ -2368,7 +2332,6 @@ AIPlay_ProfessorOak: ; 20cae (8:4cae)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x20cc1
; sets carry if AI determines a score of playing
; Professor Oak is over a certain threshold.
@@ -2537,7 +2500,6 @@ AIDecide_ProfessorOak: ; 20cc1 (8:4cc1)
.set_carry
scf
ret
-; 0x20d9d
; return carry if there's a card in the hand that
; can evolve the card in Play Area location in e.
@@ -2578,7 +2540,6 @@ AIDecide_ProfessorOak: ; 20cc1 (8:4cc1)
scf
ret
-; 0x20dc3
; handles Legendary Articuno Deck AI logic.
.HandleLegendaryArticunoDeck ; 20dc3 (8:4dc3)
@@ -2646,7 +2607,6 @@ AIDecide_ProfessorOak: ; 20cc1 (8:4cc1)
.no_carry_articuno
or a
ret
-; 0x20e11
; handles Excavation deck AI logic.
; sets score depending on whether there's no
@@ -2668,7 +2628,6 @@ AIDecide_ProfessorOak: ; 20cc1 (8:4cc1)
ld a, $1e
ld [wce06], a
jp .check_cards_hand
-; 0x20e2c
; handles Wonders of Science AI logic.
; if there's either Grimer or Muk in hand,
@@ -2688,7 +2647,6 @@ AIDecide_ProfessorOak: ; 20cc1 (8:4cc1)
.found_grimer_or_muk
or a
ret
-; 0x20e44
AIPlay_EnergyRetrieval: ; 20e44 (8:4e44)
ld a, [wCurrentAIFlags]
@@ -2710,7 +2668,6 @@ AIPlay_EnergyRetrieval: ; 20e44 (8:4e44)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x20e6e
; checks whether AI can play Energy Retrieval and
; picks the energy cards from the discard pile,
@@ -2847,7 +2804,6 @@ AIDecide_EnergyRetrieval: ; 20e6e (8:4e6e)
ld a, [wce06]
scf
ret
-; 0x20f27
; remove an element from the list
; and shortens it accordingly
@@ -2870,7 +2826,6 @@ RemoveCardFromList: ; 20f27 (8:4f27)
pop hl
pop de
ret
-; 0x20f38
; finds duplicates in card list in hl.
; if a duplicate of Pokemon cards are found, return in
@@ -2947,7 +2902,6 @@ FindDuplicateCards: ; 20f38 (8:4f38)
; of either Pokemon or Non-Pokemon cards
or a
ret
-; 0x20f80
AIPlay_SuperEnergyRetrieval: ; 20f80 (8:4f80)
ld a, [wCurrentAIFlags]
@@ -2979,7 +2933,6 @@ AIPlay_SuperEnergyRetrieval: ; 20f80 (8:4f80)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x20fc1
AIDecide_SuperEnergyRetrieval: ; 20fc1 (8:4fc1)
; return no carry if no cards in hand
@@ -3160,7 +3113,6 @@ AIDecide_SuperEnergyRetrieval: ; 20fc1 (8:4fc1)
ld a, [wce06]
scf
ret
-; 0x210d5
; finds the card with deck index a in list hl,
; and removes it from the list.
@@ -3179,7 +3131,6 @@ FindAndRemoveCardFromList: ; 210d5 (8:50d5)
call RemoveCardFromList
pop hl
ret
-; 0x210e0
AIPlay_PokemonCenter: ; 210e0 (8:50e0)
ld a, [wAITrainerCardToPlay]
@@ -3187,7 +3138,6 @@ AIPlay_PokemonCenter: ; 210e0 (8:50e0)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x210eb
AIDecide_PokemonCenter: ; 210eb (8:50eb)
xor a
@@ -3280,7 +3230,6 @@ AIDecide_PokemonCenter: ; 210eb (8:50eb)
.no_carry
or a
ret
-; 0x21170
AIPlay_ImposterProfessorOak: ; 21170 (8:5170)
ld a, [wAITrainerCardToPlay]
@@ -3288,7 +3237,6 @@ AIPlay_ImposterProfessorOak: ; 21170 (8:5170)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x2117b
; sets carry depending on player's number of cards
; in deck in in hand.
@@ -3318,7 +3266,6 @@ AIDecide_ImposterProfessorOak: ; 2117b (8:517b)
.set_carry
scf
ret
-; 0x2119a
AIPlay_EnergySearch: ; 2119a (8:519a)
ld a, [wAITrainerCardToPlay]
@@ -3328,7 +3275,6 @@ AIPlay_EnergySearch: ; 2119a (8:519a)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x211aa
; AI checks for playing Energy Search
AIDecide_EnergySearch: ; 211aa (8:51aa)
@@ -3390,7 +3336,6 @@ AIDecide_EnergySearch: ; 211aa (8:51aa)
jr c, .no_carry
scf
ret
-; 0x211f1
; return carry if cards in wDuelTempList are not
; useful to any of the Play Area Pokemon
@@ -3441,7 +3386,6 @@ AIDecide_EnergySearch: ; 211aa (8:51aa)
scf
ret
-; 0x2122e
; checks whether there are useful energies
; only for Fire and Lightning type Pokemon cards
@@ -3505,7 +3449,6 @@ AIDecide_EnergySearch: ; 211aa (8:51aa)
; for Fire/Lightning type Pokemon card.
scf
ret
-; 0x21273
; checks whether there are useful energies
; only for Grass type Pokemon cards
@@ -3566,7 +3509,6 @@ AIDecide_EnergySearch: ; 211aa (8:51aa)
; for Grass type Pokemon card.
scf
ret
-; 0x212b4
AIPlay_Pokedex: ; 212b4 (8:52b4)
ld a, [wAITrainerCardToPlay]
@@ -3586,7 +3528,6 @@ AIPlay_Pokedex: ; 212b4 (8:52b4)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x212dc
AIDecide_Pokedex: ; 212dc (8:52dc)
ld a, [wAIPokedexCounter]
@@ -3616,7 +3557,6 @@ AIDecide_Pokedex: ; 212dc (8:52dc)
ld a, [wOpponentDeckID]
cp WONDERS_OF_SCIENCE_DECK_ID
jp PickPokedexCards ; bug, should be jp nz
-; 0x212ff
; picks order of the cards in deck from the effects of Pokedex.
; prioritises Pokemon cards, then Trainer cards, then energy cards.
@@ -3739,7 +3679,6 @@ PickPokedexCards_Unreferenced: ; 212ff (8:52ff)
.done
scf
ret
-; 0x21383
.GetCardType ; 21383 (8:5383)
push bc
@@ -3749,7 +3688,6 @@ PickPokedexCards_Unreferenced: ; 212ff (8:52ff)
pop de
pop bc
ret
-; 0x2138e
; picks order of the cards in deck from the effects of Pokedex.
; prioritises energy cards, then Pokemon cards, then Trainer cards.
@@ -3871,7 +3809,6 @@ PickPokedexCards: ; 2138e (8:538e)
.done
scf
ret
-; 0x21412
.GetCardType ; 21412 (8:5412)
push bc
@@ -3881,7 +3818,6 @@ PickPokedexCards: ; 2138e (8:538e)
pop de
pop bc
ret
-; 0x2141d
AIPlay_FullHeal: ; 2141d (8:541d)
ld a, [wAITrainerCardToPlay]
@@ -3889,7 +3825,6 @@ AIPlay_FullHeal: ; 2141d (8:541d)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x21428
AIDecide_FullHeal: ; 21428 (8:5428)
ld a, DUELVARS_ARENA_CARD_STATUS
@@ -3976,7 +3911,6 @@ AIDecide_FullHeal: ; 21428 (8:5428)
jr nz, .set_carry
; if not, return no carry.
jr .no_carry
-; 0x21497
AIPlay_MrFuji: ; 21497 (8:5497)
ld a, [wAITrainerCardToPlay]
@@ -3986,7 +3920,6 @@ AIPlay_MrFuji: ; 21497 (8:5497)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x214a7
; AI logic for playing Mr Fuji
AIDecide_MrFuji: ; 214a7 (8:54a7)
@@ -4050,7 +3983,6 @@ AIDecide_MrFuji: ; 214a7 (8:54a7)
scf
ret
-; 0x214f1
AIPlay_ScoopUp: ; 214f1 (8:54f1)
ld a, [wAITrainerCardToPlay]
@@ -4062,7 +3994,6 @@ AIPlay_ScoopUp: ; 214f1 (8:54f1)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x21506
AIDecide_ScoopUp: ; 21506 (8:5506)
xor a
@@ -4156,7 +4087,7 @@ AIDecide_ScoopUp: ; 21506 (8:5506)
; this deck will use Scoop Up on a benched Articuno2.
; it checks if the defending Pokemon is a Snorlax,
; but interestingly does not check for Muk in both Play Areas.
-; will also use Scoop Up on
+; will also use Scoop Up on
.HandleLegendaryArticuno
; if less than 3 Play Area Pokemon cards, skip.
ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
@@ -4236,7 +4167,6 @@ AIDecide_ScoopUp: ; 21506 (8:5506)
pop af
scf
ret
-; 0x215e7
; this deck will use Scoop Up on a benched Articuno2, Zapdos3 or Molres2.
; interestingly, does not check for Muk in both Play Areas.
@@ -4260,7 +4190,6 @@ AIDecide_ScoopUp: ; 21506 (8:5506)
call LookForCardIDInPlayArea_Bank8
jr c, .check_attached_energy
jp .no_carry
-; 0x2160f
AIPlay_Maintenance: ; 2160f (8:560f)
ld a, [wCurrentAIFlags]
@@ -4275,7 +4204,6 @@ AIPlay_Maintenance: ; 2160f (8:560f)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x2162c
; AI logic for playing Maintenance
AIDecide_Maintenance: ; 2162c (8:562c)
@@ -4359,7 +4287,6 @@ AIDecide_Maintenance: ; 2162c (8:562c)
; two cards were found, return carry.
scf
ret
-; 0x2169a
AIPlay_Recycle: ; 2169a (8:569a)
ld a, [wAITrainerCardToPlay]
@@ -4377,7 +4304,6 @@ AIPlay_Recycle: ; 2169a (8:569a)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x216b8
; lists cards to look for in the Discard Pile.
; has priorities for Ghost Deck, and a "default" priority list
@@ -4500,7 +4426,6 @@ AIDecide_Recycle: ; 216b8 (8:56b8)
ld a, b
ld [wce08 + 4], a
jr .loop_2
-; 0x21755
AIPlay_Lass: ; 21755 (8:5755)
ld a, [wCurrentAIFlags]
@@ -4511,7 +4436,6 @@ AIPlay_Lass: ; 21755 (8:5755)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x21768
AIDecide_Lass: ; 21768 (8:5768)
; skip if player has less than 7 cards in hand
@@ -4542,7 +4466,6 @@ AIDecide_Lass: ; 21768 (8:5768)
.set_carry
scf
ret
-; 0x2178f
AIPlay_ItemFinder: ; 2178f (8:578f)
ld a, [wCurrentAIFlags]
@@ -4559,7 +4482,6 @@ AIPlay_ItemFinder: ; 2178f (8:578f)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x217b1
; checks whether there's Energy Removal in Discard Pile.
; if so, find duplicate cards in hand to discard
@@ -4635,7 +4557,6 @@ AIDecide_ItemFinder: ; 217b1 (8:57b1)
.no_carry
or a
ret
-; 0x21813
AIPlay_Imakuni: ; 21813 (8:5813)
ld a, [wAITrainerCardToPlay]
@@ -4643,7 +4564,6 @@ AIPlay_Imakuni: ; 21813 (8:5813)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x2181e
; only sets carry if Active card is not confused.
AIDecide_Imakuni: ; 2181e (8:581e)
@@ -4657,7 +4577,6 @@ AIDecide_Imakuni: ; 2181e (8:581e)
.confused
or a
ret
-; 0x2182d
AIPlay_Gambler: ; 2182d (8:582d)
ld a, [wCurrentAIFlags]
@@ -4695,7 +4614,6 @@ AIPlay_Gambler: ; 2182d (8:582d)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x21875
; checks whether to play Gambler.
; aside from Imakuni?, all other opponents only
@@ -4731,7 +4649,6 @@ AIDecide_Gambler: ; 21875 (8:5875)
.set_carry
scf
ret
-; 0x21899
AIPlay_Revive: ; 21899 (8:5899)
ld a, [wAITrainerCardToPlay]
@@ -4741,7 +4658,6 @@ AIPlay_Revive: ; 21899 (8:5899)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x218a9
; checks certain cards in Discard Pile to use Revive on.
; suitable for Muscle For Brains deck only.
@@ -4789,7 +4705,6 @@ AIDecide_Revive: ; 218a9 (8:58a9)
.no_carry
or a
ret
-; 0x218d8
AIPlay_PokemonFlute: ; 218d8 (8:58d8)
ld a, [wAITrainerCardToPlay]
@@ -4799,7 +4714,6 @@ AIPlay_PokemonFlute: ; 218d8 (8:58d8)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x218e8
AIDecide_PokemonFlute: ; 218e8 (8:58e8)
; if player has no Discard Pile, skip.
@@ -4896,7 +4810,6 @@ AIDecide_PokemonFlute: ; 218e8 (8:58e8)
ld a, b
scf
ret
-; 0x21977
AIPlay_ClefairyDollOrMysteriousFossil: ; 21977 (8:5977)
ld a, [wAITrainerCardToPlay]
@@ -4904,7 +4817,6 @@ AIPlay_ClefairyDollOrMysteriousFossil: ; 21977 (8:5977)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x21982
; AI logic for playing Clefairy Doll
AIDecide_ClefairyDollOrMysteriousFossil: ; 21982 (8:5982)
@@ -4936,7 +4848,6 @@ AIDecide_ClefairyDollOrMysteriousFossil: ; 21982 (8:5982)
.no_carry
or a
ret
-; 0x219a6
AIPlay_Pokeball: ; 219a6 (8:59a6)
ld a, [wAITrainerCardToPlay]
@@ -4955,7 +4866,6 @@ AIPlay_Pokeball: ; 219a6 (8:59a6)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x219c6
AIDecide_Pokeball: ; 219c6 (8:59c6)
; go to the routines associated with deck ID
@@ -5157,7 +5067,6 @@ AIDecide_Pokeball: ; 219c6 (8:59c6)
call LookForCardIDInDeck_GivenCardIDInHand
ret c
ret
-; 0x21b12
AIPlay_ComputerSearch: ; 21b12 (8:5b12)
ld a, [wCurrentAIFlags]
@@ -5174,7 +5083,6 @@ AIPlay_ComputerSearch: ; 21b12 (8:5b12)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x21b34
; checks what Deck ID AI is playing and handle
; them in their own routine.
@@ -5514,7 +5422,6 @@ AIDecide_ComputerSearch_FireCharge: ; 21cbb (8:5cbb)
ld a, [wce06]
scf
ret
-; 0x21d1e
AIDecide_ComputerSearch_Anger: ; 21d1e (8:5d1e)
; for each of the following cards,
@@ -5575,7 +5482,6 @@ AIDecide_ComputerSearch_Anger: ; 21d1e (8:5d1e)
ld a, [wce06]
scf
ret
-; 0x21d7a
AIPlay_PokemonTrader: ; 21d7a (8:5d7a)
ld a, [wAITrainerCardToPlay]
@@ -5587,7 +5493,6 @@ AIPlay_PokemonTrader: ; 21d7a (8:5d7a)
ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS
bank1call AIMakeDecision
ret
-; 0x21d8f
AIDecide_PokemonTrader: ; 21d8f (8:5d8f)
; each deck has their own routine for picking
@@ -5686,7 +5591,6 @@ AIDecide_PokemonTrader_LegendaryArticuno: ; 21dd5 (8:5dd5)
.set_carry
scf
ret
-; 0x21e24
AIDecide_PokemonTrader_LegendaryDragonite: ; 21e24 (8:5e24)
; if has less than 5 cards of energy
@@ -5784,7 +5688,6 @@ AIDecide_PokemonTrader_LegendaryDragonite: ; 21e24 (8:5e24)
.set_carry
scf
ret
-; 0x21ec9
AIDecide_PokemonTrader_LegendaryRonald: ; 21ec9 (8:5ec9)
; for each of the following cards,
@@ -5855,7 +5758,6 @@ AIDecide_PokemonTrader_LegendaryRonald: ; 21ec9 (8:5ec9)
.set_carry
scf
ret
-; 0x21f41
AIDecide_PokemonTrader_BlisteringPokemon: ; 21f41 (8:5f41)
; for each of the following cards,
@@ -5901,7 +5803,6 @@ AIDecide_PokemonTrader_BlisteringPokemon: ; 21f41 (8:5f41)
.set_carry
scf
ret
-; 0x21f85
AIDecide_PokemonTrader_SoundOfTheWaves: ; 21f85 (8:5f85)
; for each of the following cards,
@@ -5978,7 +5879,6 @@ AIDecide_PokemonTrader_SoundOfTheWaves: ; 21f85 (8:5f85)
.set_carry
scf
ret
-; 0x2200b
AIDecide_PokemonTrader_PowerGenerator: ; 2200b (8:600b)
; for each of the following cards,
@@ -6070,7 +5970,6 @@ AIDecide_PokemonTrader_PowerGenerator: ; 2200b (8:600b)
.set_carry
scf
ret
-; 0x220a8
AIDecide_PokemonTrader_FlowerGarden: ; 220a8 (8:60a8)
; for each of the following cards,
@@ -6140,7 +6039,6 @@ AIDecide_PokemonTrader_FlowerGarden: ; 220a8 (8:60a8)
.found
scf
ret
-; 0x22122
AIDecide_PokemonTrader_StrangePower: ; 22122 (8:6122)
; looks for a Pokemon in hand to trade with Mr Mime in deck.
@@ -6158,7 +6056,6 @@ AIDecide_PokemonTrader_StrangePower: ; 22122 (8:6122)
.no_carry
or a
ret
-; 0x22133
AIDecide_PokemonTrader_Flamethrower: ; 22133 (8:6133)
; for each of the following cards,
@@ -6220,7 +6117,6 @@ AIDecide_PokemonTrader_Flamethrower: ; 22133 (8:6133)
.set_carry
scf
ret
-; 0x2219b
; handle AI routines for Energy Trans.
; uses AI_ENERGY_TRANS_* constants as input:
@@ -6364,7 +6260,6 @@ HandleAIEnergyTrans: ; 2219b (8:619b)
ld a, OPPACTION_DUEL_MAIN_SCENE
bank1call AIMakeDecision
ret
-; 0x22246
; checks if the Arena card needs energy for its second attack,
; and if it does, return carry if transferring Grass energy from Bench
@@ -6425,7 +6320,6 @@ HandleAIEnergyTrans: ; 2219b (8:619b)
scf
ret
-; 0x22286
; outputs in a the number of Grass energy cards
; currently attached to Bench cards.
@@ -6455,7 +6349,6 @@ HandleAIEnergyTrans: ; 2219b (8:619b)
jr nz, .count_loop
ld a, d
ret
-; 0x222a9
; returns carry if there are enough Grass energy cards in Bench
; to satisfy the retreat cost of the Arena card.
@@ -6489,7 +6382,6 @@ HandleAIEnergyTrans: ; 2219b (8:619b)
.retreat_false
or a
ret
-; 0x222ca
; AI logic to determine whether to use Energy Trans Pkmn Power
; to transfer energy cards attached from the Arena Pokemon to
@@ -6628,7 +6520,6 @@ AIEnergyTransTransferEnergyToBench: ; 222ca (8:62ca)
ld a, OPPACTION_DUEL_MAIN_SCENE
bank1call AIMakeDecision
ret
-; 0x2237f
; handles AI logic for using some Pkmn Powers.
; Pkmn Powers handled here are:
@@ -6731,7 +6622,6 @@ HandleAIPkmnPowers: ; 2237f (8:637f)
.done
pop bc
ret
-; 0x22402
; checks whether AI uses Heal on Pokemon in Play Area.
; input:
@@ -6753,7 +6643,6 @@ HandleAIHeal: ; 22402 (8:6402)
ld a, OPPACTION_DUEL_MAIN_SCENE
bank1call AIMakeDecision
ret
-; 0x22422
; finds a target suitable for AI to use Heal on.
; only heals Arena card if the Defending Pokemon
@@ -6838,7 +6727,6 @@ HandleAIHeal: ; 22402 (8:6402)
.not_found
or a
ret
-; 0x22476
; checks whether AI uses Shift.
; input:
@@ -6895,7 +6783,6 @@ HandleAIShift: ; 22476 (8:6476)
ld a, OPPACTION_DUEL_MAIN_SCENE
bank1call AIMakeDecision
ret
-; 0x224c6
; returns carry if turn Duelist has a Pokemon
; with same color as wAIDefendingPokemonWeakness.
@@ -6921,7 +6808,6 @@ HandleAIShift: ; 22476 (8:6476)
.false
or a
ret
-; 0x224e6
; checks whether AI uses Peek.
; input:
@@ -7005,7 +6891,6 @@ HandleAIPeek: ; 224e6 (8:64e6)
ld a, OPPACTION_DUEL_MAIN_SCENE
bank1call AIMakeDecision
ret
-; 0x2255d
; checks whether AI uses Strange Behavior.
; input:
@@ -7072,7 +6957,6 @@ HandleAIStrangeBehavior: ; 2255d (8:655d)
ld a, OPPACTION_DUEL_MAIN_SCENE
bank1call AIMakeDecision
ret
-; 0x225b5
; checks whether AI uses Curse.
; input:
@@ -7176,7 +7060,6 @@ HandleAICurse: ; 225b5 (8:65b5)
ld a, OPPACTION_DUEL_MAIN_SCENE
bank1call AIMakeDecision
ret
-; 0x2262d
; handles AI logic for Cowardice
HandleAICowardice: ; 2262d (8:662d)
@@ -7224,7 +7107,6 @@ HandleAICowardice: ; 2262d (8:662d)
cp b
jr nz, .loop
ret
-; 0x22671
; checks whether AI uses Cowardice.
; return carry if Pkmn Power was used.
@@ -7265,7 +7147,6 @@ HandleAICowardice: ; 2262d (8:662d)
bank1call AIMakeDecision
scf
ret
-; 0x226a3
; AI logic for Damage Swap to transfer damage from Arena card
; to a card in Bench with more than 10 HP remaining
@@ -7368,7 +7249,6 @@ HandleAIDamageSwap: ; 226a3 (8:66a3)
.no_more_target
pop de
jr .done
-; 0x2273c
; looks for a target in the bench to receive damage counters.
; returns carry if one is found, and outputs remaining HP in a.
@@ -7438,7 +7318,6 @@ HandleAIDamageSwap: ; 226a3 (8:66a3)
.set_carry
scf
ret
-; 0x22790
; handles AI logic for attaching energy cards
; in Go Go Rain Dance deck.
@@ -7459,7 +7338,6 @@ HandleAIGoGoRainDanceEnergy: ; 22790 (8:6790)
farcall AIProcessAndTryToPlayEnergy
jr c, .loop
ret
-; 0x227a9
; runs through Player's whole deck and
; sets carry if there's any Pokemon other
@@ -7493,7 +7371,6 @@ CheckIfPlayerHasPokemonOtherThanMewtwo1: ; 227a9 (8:67a9)
call SwapTurn
scf
ret
-; 0x227d3
; returns no carry if, given the Player is using a Mewtwo1 mill deck,
; the AI already has a Bench fully set up, in which case it
@@ -7534,7 +7411,6 @@ HandleAIAntiMewtwoDeckStrategy: ; 227d3 (8:67d3)
.set_carry
scf
ret
-; 0x227f6
; lists in wDuelTempList all the basic energy cards
; in card location of a.
@@ -7600,7 +7476,6 @@ FindBasicEnergyCardsInLocation: ; 227f6 (8:67f6)
.set_carry
scf
ret
-; 0x2282e
; returns in a the card index of energy card
; attached to Pokémon in Play Area location a,
@@ -7657,7 +7532,6 @@ AIPickEnergyCardToDiscard: ; 2282e (8:682e)
.no_energy
ld a, $ff
ret
-; 0x22875
; returns in a the deck index of an energy card attached to card
; in player's Play Area location a to remove.
@@ -7737,7 +7611,6 @@ PickAttachedEnergyCardToRemove: ; 22875 (8:6875)
.no_energy
ld a, $ff
ret
-; 0x228d1
; stores in wTempAI and wCurCardCanAttack the deck indices
; of energy cards attached to card in Play Area location a.
@@ -7858,7 +7731,6 @@ PickTwoAttachedEnergyCards: ; 228d1 (8:68d1)
.not_enough
ld a, $ff
ret
-; 0x2297b
; copies $ff terminated buffer from hl to de
CopyBuffer: ; 2297b (8:697b)
@@ -7868,7 +7740,6 @@ CopyBuffer: ; 2297b (8:697b)
ret z
inc de
jr CopyBuffer
-; 0x22983
; zeroes a bytes starting at hl
ClearMemory_Bank8: ; 22983 (8:6983)
@@ -7885,13 +7756,12 @@ ClearMemory_Bank8: ; 22983 (8:6983)
pop bc
pop af
ret
-; 0x22990
; counts number of energy cards found in hand
; and outputs result in a
; sets carry if none are found
; output:
-; a = number of energy cards found
+; a = number of energy cards found
CountOppEnergyCardsInHand: ; 22990 (8:6990)
farcall CreateEnergyCardListFromHand
ret c
@@ -7905,13 +7775,12 @@ CountOppEnergyCardsInHand: ; 22990 (8:6990)
ld a, b
or a
ret
-; 0x229a3
; converts HP in a to number of equivalent damage counters
; input:
-; a = HP
+; a = HP
; output:
-; a = number of damage counters
+; a = number of damage counters
ConvertHPToCounters: ; 229a3 (8:69a3)
push bc
ld c, 0
@@ -7924,7 +7793,6 @@ ConvertHPToCounters: ; 229a3 (8:69a3)
ld a, c
pop bc
ret
-; 0x229b0
; calculates floor(hl / 10)
CalculateWordTensDigit: ; 229b0 (8:69b0)
@@ -7941,7 +7809,6 @@ CalculateWordTensDigit: ; 229b0 (8:69b0)
pop de
pop bc
ret
-; 0x229c1
; returns in a division of b by a
CalculateBDividedByA_Bank8: ; 229c1 (8:69c1)
@@ -7959,7 +7826,6 @@ CalculateBDividedByA_Bank8: ; 229c1 (8:69c1)
ld a, c
pop bc
ret
-; 0x229d0
; returns in a the deck index of the first
; instance of card with ID equal to the ID in e
@@ -7998,14 +7864,13 @@ LookForCardIDInLocation: ; 229d0 (8:69d0)
ld a, e
scf
ret
-; 0x229f3
; return carry if card ID loaded in a is found in hand
; and outputs in a the deck index of that card
; input:
; a = card ID
; output:
-; a = card deck index, if found
+; a = card deck index, if found
; carry set if found
LookForCardIDInHandList_Bank8: ; 229f3 (8:69f3)
ld [wTempCardIDToLook], a
@@ -8027,7 +7892,6 @@ LookForCardIDInHandList_Bank8: ; 229f3 (8:69f3)
ldh a, [hTempCardIndex_ff98]
scf
ret
-; 0x22a10
; searches in deck for card ID 1 in a, and
; if found, searches in Hand/Play Area for card ID 2 in b, and
@@ -8077,7 +7941,6 @@ LookForCardIDInDeck_GivenCardIDInHandAndPlayArea: ; 22a10 (8:6a10)
.no_carry
or a
ret
-; 0x22a39
; returns carry if card ID in a
; is found in Play Area or in hand
@@ -8096,7 +7959,6 @@ LookForCardIDInHandAndPlayArea: ; 22a39 (8:6a39)
ret c
or a
ret
-; 0x22a49
; searches in deck for card ID 1 in a, and
; if found, searches in Hand Area for card ID 2 in b, and
@@ -8145,7 +8007,6 @@ LookForCardIDInDeck_GivenCardIDInHand: ; 22a49 (8:6a49)
.no_carry
or a
ret
-; 0x22a72
; returns carry if card ID in a
; is found in Play Area, starting with
@@ -8183,7 +8044,6 @@ LookForCardIDInPlayArea_Bank8: ; 22a72 (8:6a72)
ld a, b
scf
ret
-; 0x22a95
; runs through list avoiding card in e.
; removes first card in list not equal to e
@@ -8264,7 +8124,6 @@ RemoveFromListDifferentCardOfGivenType: ; 22a95 (8:6a95)
pop hl
or a
ret
-; 0x22ae0
; used in Pokemon Trader checks to look for a specific
; card in the deck to trade with a card in hand that
@@ -8324,7 +8183,6 @@ LookForCardIDToTradeWithDifferentHandCard: ; 22ae0 (8:6ae0)
.no_carry
or a
ret
-; 0x22b1f
; returns carry if at least one card in the hand
; has the card ID of input. Outputs its index.
@@ -8358,7 +8216,6 @@ CheckIfHasCardIDInHand: ; 22b1f (8:6b1f)
ldh a, [hTempCardIndex_ff98]
scf
ret
-; 0x22b45
; outputs in a total number of Pokemon cards in hand
; plus Pokemon in Turn Duelist's Play Area.
@@ -8383,7 +8240,6 @@ CountPokemonCardsInHandAndInPlayArea: ; 22b45 (8:6b45)
.done
ld a, [wTempAI]
ret
-; 0x22b6f
; returns carry if a duplicate Pokemon card is found in hand.
; outputs in a the deck index of one of them.
@@ -8438,7 +8294,6 @@ FindDuplicatePokemonCards: ; 22b6f (8:6b6f)
.no_carry
or a
ret
-; 0x22bad
; return carry flag if move is not high recoil.
Func_22bad: ; 22bad (8:6bad)
@@ -8454,7 +8309,6 @@ Func_22bad: ; 22bad (8:6bad)
call CheckLoadedMoveFlag
ccf
ret
-; 0x22bc6
rept $143a
db $ff
diff --git a/src/engine/bank1c.asm b/src/engine/bank1c.asm
index 7fa5bf4..cff0a96 100644
--- a/src/engine/bank1c.asm
+++ b/src/engine/bank1c.asm
@@ -20,7 +20,6 @@ Func_70018: ; 70018 (1c:4018)
ld a, $0
call Func_70044
ret
-; 0x70024
AtrcEnPacket_Disable: ; 70024 (1c:4024)
sgb ATRC_EN, 1 ; sgb_command, length
diff --git a/src/engine/bank20.asm b/src/engine/bank20.asm
index b656f90..14292f9 100644
--- a/src/engine/bank20.asm
+++ b/src/engine/bank20.asm
@@ -136,7 +136,6 @@ Func_800e0: ; 800e0 (20:40e0)
jr nz, .asm_800fe
pop hl
ret
-; 0x80148
Func_80148: ; 80148 (20:4148)
ld a, [$d291]
@@ -276,6 +275,8 @@ Func_801f1: ; 801f1 (20:41f1)
pop hl
ret
+; l - map data offset (0,2,4,6,8 for banks 0,1,2,3,4)
+; a - map index (inside of the given bank)
GetMapDataPointer: ; 8020f (20:420f)
push bc
push af
@@ -296,13 +297,14 @@ GetMapDataPointer: ; 8020f (20:420f)
pop bc
ret
-Func_80229: ; 80229 (20:4229)
+; Loads a pointer from [hl] to wTempPointer. Adds the graphics bank offset ($20)
+LoadGraphicsPointerFromHL: ; 80229 (20:4229)
ld a, [hli]
ld [wTempPointer], a
ld a, [hli]
ld [wTempPointer + 1], a
ld a, [hli]
- add $20
+ add BANK(MapDataPointers)
ld [wTempPointerBank], a
ret
; 0x80238
@@ -313,7 +315,7 @@ Func_8025b: ; 8025b (20:425b)
push hl
ld l, $4
call GetMapDataPointer
- call Func_80229
+ call LoadGraphicsPointerFromHL
ld a, [hl]
push af
ld [wd4c8], a
@@ -330,7 +332,7 @@ Func_80274: ; 80274 (20:4274)
Func_80279: ; 80279 (20:4279)
call Func_802bb
-asm_8027c
+asm_8027c:
push hl
push bc
push de
@@ -390,7 +392,7 @@ Func_803b9: ; 803b9 (20:43b9)
ld l, $00
ld a, [wd131]
call GetMapDataPointer
- call Func_80229
+ call LoadGraphicsPointerFromHL
ld a, [hl]
ld [$d239], a
ret
@@ -515,15 +517,19 @@ Func_80baa: ; 80baa (20:4baa)
INCROM $80c21, $80e5a
-Unknown_80e5a: ; 80e5a (20:4e5a)
- INCROM $80e5a, $80e5d
+SpriteNullAnimationPointer: ; 80e5a (20:4e5a)
+ dw SpriteNullAnimationFrame
+
+SpriteNullAnimationFrame:
+ db 0
; might be closer to "screen specific data" than map data
+; data in each section is 4 bytes long.
MapDataPointers: ; 80e5d (20:4e5d)
dw MapDataPointers_80e67
dw MapDataPointers_8100f
dw MapDataPointers_8116b
- dw MapDataPointers_81333
+ dw SpriteAnimationPointers
dw MapDataPointers_81697
MapDataPointers_80e67: ; 80e67 (20:4e67)
@@ -535,7 +541,8 @@ MapDataPointers_8100f: ; 8100f (20:500f)
MapDataPointers_8116b: ; 8116b (20:516b)
INCROM $8116b, $81333
-MapDataPointers_81333: ; 81333 (20:5333)
+; pointer low, pointer high, bank (minus $20), unknown
+SpriteAnimationPointers: ; 81333 (20:5333)
INCROM $81333, $81697
MapDataPointers_81697: ; 81697 (20:5697)
diff --git a/src/engine/booster_packs.asm b/src/engine/booster_packs.asm
index 040e612..8e7d0c2 100644
--- a/src/engine/booster_packs.asm
+++ b/src/engine/booster_packs.asm
@@ -509,7 +509,7 @@ InitBoosterData: ; 1e430 (7:6430)
call FindBoosterDataPointer
ld de, wBoosterData_Set
ld bc, wBoosterData_TypeChances - wBoosterData_Set + NUM_BOOSTER_CARD_TYPES ; Pack2 - Pack1
- call CopyDataHLtoDE ; load booster pack data to wram
+ call CopyDataHLtoDE ; load booster pack data to wram
call LoadRarityAmountsToWram
ld bc, $0
ld d, NUM_BOOSTER_CARD_TYPES
diff --git a/src/engine/deck_ai/deck_ai.asm b/src/engine/deck_ai/deck_ai.asm
index c8b73f3..97093c7 100644
--- a/src/engine/deck_ai/deck_ai.asm
+++ b/src/engine/deck_ai/deck_ai.asm
@@ -1,82 +1,82 @@
-; AI card retreat score bonus
-; when the AI retreat routine runs through the Bench to choose
-; a Pokemon to switch to, it looks up in this list and if
-; a card ID matches, applies a retreat score bonus to this card.
-; positive (negative) means more (less) likely to switch to this card.
-ai_retreat: MACRO
- db \1 ; card ID
- db $80 + \2 ; retreat score (ranges between -128 and 127)
-ENDM
-
-; AI card energy attach score bonus
-; when the AI energy attachment routine runs through the Play Area to choose
-; a Pokemon to attach an energy card, it looks up in this list and if
-; a card ID matches, skips this card if the maximum number of energy
-; cards attached has been reached. If it hasn't been reached, additionally
-; applies a positive (or negative) AI score to attach energy to this card.
-ai_energy: MACRO
- db \1 ; card ID
- db \2 ; maximum number of attached cards
- db $80 + \3 ; energy score (ranges between -128 and 127)
-ENDM
-
-; stores in WRAM pointer to data in argument
-; e.g. store_list_pointer wSomeListPointer, SomeData
-store_list_pointer: MACRO
- ld hl, \1
- ld de, \2
- ld [hl], e
- inc hl
- ld [hl], d
-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;
-;
-; dw .do_turn : called to handle the main turn logic, from the beginning
-; of the turn up to the attack (or lack thereof);
-;
-; dw .start_duel : called at the start of the duel to initialize some
-; variables and optionally set up CPU hand and deck;
-;
-; dw .forced_switch : logic to determine what Pokemon to pick when there's
-; an effect that forces AI to switch to Bench card;
-;
-; dw .ko_switch : logic for picking which card to use after a KO;
-;
-; dw .take_prize : logic to decide which prize card to pick.
-
-; optionally, decks can also declare card lists that will add
-; more specialized logic during various generic AI routines,
-; and read during the .start_duel routines.
-; the pointers to these lists are stored in memory:
-; wAICardListAvoidPrize : list of cards to avoid being placed as prize;
-; wAICardListArenaPriority : priority list of Arena card at duel start;
-; wAICardListBenchPriority : priority list of Bench cards at duel start;
-; wAICardListPlayFromHandPriority : priority list of cards to play from hand;
-; wAICardListRetreatBonus : scores given to certain cards for retreat;
-; wAICardListEnergyBonus : max number of energy cards and card scores.
-
-INCLUDE "engine/deck_ai/decks/general.asm"
-INCLUDE "engine/deck_ai/decks/sams_practice.asm"
-INCLUDE "engine/deck_ai/decks/general_no_retreat.asm"
-INCLUDE "engine/deck_ai/decks/legendary_moltres.asm"
-INCLUDE "engine/deck_ai/decks/legendary_zapdos.asm"
-INCLUDE "engine/deck_ai/decks/legendary_articuno.asm"
-INCLUDE "engine/deck_ai/decks/legendary_dragonite.asm"
-INCLUDE "engine/deck_ai/decks/first_strike.asm"
-INCLUDE "engine/deck_ai/decks/rock_crusher.asm"
-INCLUDE "engine/deck_ai/decks/go_go_rain_dance.asm"
-INCLUDE "engine/deck_ai/decks/zapping_selfdestruct.asm"
-INCLUDE "engine/deck_ai/decks/flower_power.asm"
-INCLUDE "engine/deck_ai/decks/strange_psyshock.asm"
-INCLUDE "engine/deck_ai/decks/wonders_of_science.asm"
-INCLUDE "engine/deck_ai/decks/fire_charge.asm"
-INCLUDE "engine/deck_ai/decks/im_ronald.asm"
-INCLUDE "engine/deck_ai/decks/powerful_ronald.asm"
-INCLUDE "engine/deck_ai/decks/invincible_ronald.asm"
-INCLUDE "engine/deck_ai/decks/legendary_ronald.asm"
+; AI card retreat score bonus
+; when the AI retreat routine runs through the Bench to choose
+; a Pokemon to switch to, it looks up in this list and if
+; a card ID matches, applies a retreat score bonus to this card.
+; positive (negative) means more (less) likely to switch to this card.
+ai_retreat: MACRO
+ db \1 ; card ID
+ db $80 + \2 ; retreat score (ranges between -128 and 127)
+ENDM
+
+; AI card energy attach score bonus
+; when the AI energy attachment routine runs through the Play Area to choose
+; a Pokemon to attach an energy card, it looks up in this list and if
+; a card ID matches, skips this card if the maximum number of energy
+; cards attached has been reached. If it hasn't been reached, additionally
+; applies a positive (or negative) AI score to attach energy to this card.
+ai_energy: MACRO
+ db \1 ; card ID
+ db \2 ; maximum number of attached cards
+ db $80 + \3 ; energy score (ranges between -128 and 127)
+ENDM
+
+; stores in WRAM pointer to data in argument
+; e.g. store_list_pointer wSomeListPointer, SomeData
+store_list_pointer: MACRO
+ ld hl, \1
+ ld de, \2
+ ld [hl], e
+ inc hl
+ ld [hl], d
+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;
+;
+; dw .do_turn : called to handle the main turn logic, from the beginning
+; of the turn up to the attack (or lack thereof);
+;
+; dw .start_duel : called at the start of the duel to initialize some
+; variables and optionally set up CPU hand and deck;
+;
+; dw .forced_switch : logic to determine what Pokemon to pick when there's
+; an effect that forces AI to switch to Bench card;
+;
+; dw .ko_switch : logic for picking which card to use after a KO;
+;
+; dw .take_prize : logic to decide which prize card to pick.
+
+; optionally, decks can also declare card lists that will add
+; more specialized logic during various generic AI routines,
+; and read during the .start_duel routines.
+; the pointers to these lists are stored in memory:
+; wAICardListAvoidPrize : list of cards to avoid being placed as prize;
+; wAICardListArenaPriority : priority list of Arena card at duel start;
+; wAICardListBenchPriority : priority list of Bench cards at duel start;
+; wAICardListPlayFromHandPriority : priority list of cards to play from hand;
+; wAICardListRetreatBonus : scores given to certain cards for retreat;
+; wAICardListEnergyBonus : max number of energy cards and card scores.
+
+INCLUDE "engine/deck_ai/decks/general.asm"
+INCLUDE "engine/deck_ai/decks/sams_practice.asm"
+INCLUDE "engine/deck_ai/decks/general_no_retreat.asm"
+INCLUDE "engine/deck_ai/decks/legendary_moltres.asm"
+INCLUDE "engine/deck_ai/decks/legendary_zapdos.asm"
+INCLUDE "engine/deck_ai/decks/legendary_articuno.asm"
+INCLUDE "engine/deck_ai/decks/legendary_dragonite.asm"
+INCLUDE "engine/deck_ai/decks/first_strike.asm"
+INCLUDE "engine/deck_ai/decks/rock_crusher.asm"
+INCLUDE "engine/deck_ai/decks/go_go_rain_dance.asm"
+INCLUDE "engine/deck_ai/decks/zapping_selfdestruct.asm"
+INCLUDE "engine/deck_ai/decks/flower_power.asm"
+INCLUDE "engine/deck_ai/decks/strange_psyshock.asm"
+INCLUDE "engine/deck_ai/decks/wonders_of_science.asm"
+INCLUDE "engine/deck_ai/decks/fire_charge.asm"
+INCLUDE "engine/deck_ai/decks/im_ronald.asm"
+INCLUDE "engine/deck_ai/decks/powerful_ronald.asm"
+INCLUDE "engine/deck_ai/decks/invincible_ronald.asm"
+INCLUDE "engine/deck_ai/decks/legendary_ronald.asm"
diff --git a/src/engine/deck_ai/decks/fire_charge.asm b/src/engine/deck_ai/decks/fire_charge.asm
index 454f731..4253d55 100644
--- a/src/engine/deck_ai/decks/fire_charge.asm
+++ b/src/engine/deck_ai/decks/fire_charge.asm
@@ -1,86 +1,81 @@
-AIActionTable_FireCharge: ; 15232 (5:5232)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 1523e (5:523e)
- call AIMainTurnLogic
- ret
-; 0x15242
-
-.start_duel ; 15242 (5:5242)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x15253
-
-.forced_switch ; 15253 (5:5253)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x15257
-
-.ko_switch ; 15257 (5:5257)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x1525b
-
-.take_prize ; 1525b (5:525b)
- call AIPickPrizeCards
- ret
-; 0x1525f
-
-.list_arena ; 1525f (5:525f)
- db JIGGLYPUFF3
- db CHANSEY
- db TAUROS
- db MAGMAR1
- db JIGGLYPUFF1
- db GROWLITHE
- db $00
-
-.list_bench ; 15266 (5:5266)
- db JIGGLYPUFF3
- db CHANSEY
- db GROWLITHE
- db MAGMAR1
- db JIGGLYPUFF1
- db TAUROS
- db $00
-
-.list_retreat ; 1526e (5:526e)
- ai_retreat JIGGLYPUFF1, -1
- ai_retreat CHANSEY, -1
- ai_retreat GROWLITHE, -1
- db $00
-
-.list_energy ; 15274 (5:5274)
- ai_energy GROWLITHE, 3, +0
- ai_energy ARCANINE2, 4, +0
- ai_energy MAGMAR1, 3, +0
- ai_energy JIGGLYPUFF1, 3, +0
- ai_energy JIGGLYPUFF3, 2, +0
- ai_energy WIGGLYTUFF, 3, +0
- ai_energy CHANSEY, 4, +0
- ai_energy TAUROS, 3, +0
- db $00
-
-.list_prize ; 1528d (5:528d)
- db GAMBLER
- db $00
-
-.store_list_pointers ; 1528f (5:528f)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x152bd
+AIActionTable_FireCharge: ; 15232 (5:5232)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 1523e (5:523e)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 15242 (5:5242)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 15253 (5:5253)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 15257 (5:5257)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 1525b (5:525b)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 1525f (5:525f)
+ db JIGGLYPUFF3
+ db CHANSEY
+ db TAUROS
+ db MAGMAR1
+ db JIGGLYPUFF1
+ db GROWLITHE
+ db $00
+
+.list_bench ; 15266 (5:5266)
+ db JIGGLYPUFF3
+ db CHANSEY
+ db GROWLITHE
+ db MAGMAR1
+ db JIGGLYPUFF1
+ db TAUROS
+ db $00
+
+.list_retreat ; 1526e (5:526e)
+ ai_retreat JIGGLYPUFF1, -1
+ ai_retreat CHANSEY, -1
+ ai_retreat GROWLITHE, -1
+ db $00
+
+.list_energy ; 15274 (5:5274)
+ ai_energy GROWLITHE, 3, +0
+ ai_energy ARCANINE2, 4, +0
+ ai_energy MAGMAR1, 3, +0
+ ai_energy JIGGLYPUFF1, 3, +0
+ ai_energy JIGGLYPUFF3, 2, +0
+ ai_energy WIGGLYTUFF, 3, +0
+ ai_energy CHANSEY, 4, +0
+ ai_energy TAUROS, 3, +0
+ db $00
+
+.list_prize ; 1528d (5:528d)
+ db GAMBLER
+ db $00
+
+.store_list_pointers ; 1528f (5:528f)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+; 0x152bd
diff --git a/src/engine/deck_ai/decks/first_strike.asm b/src/engine/deck_ai/decks/first_strike.asm
index 6d2906c..9f5934d 100644
--- a/src/engine/deck_ai/decks/first_strike.asm
+++ b/src/engine/deck_ai/decks/first_strike.asm
@@ -1,82 +1,77 @@
-AIActionTable_FirstStrike: ; 14e89 (5:4e89)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 14e95 (5:4e95)
- call AIMainTurnLogic
- ret
-; 0x14e99
-
-.start_duel ; 14e99 (5:4e99)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x14eaa
-
-.forced_switch ; 14eaa (5:4eaa)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14eae
-
-.ko_switch ; 14eae (5:4eae)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14eb2
-
-.take_prize ; 14eb2 (5:4eb2)
- call AIPickPrizeCards
- ret
-; 0x14eb6
-
-.list_arena ; 14eb6 (5:1eb6)
- db HITMONCHAN
- db MACHOP
- db HITMONLEE
- db MANKEY
- db $00
-
-.list_bench ; 14ebb (5:1ebb)
- db MACHOP
- db HITMONLEE
- db HITMONCHAN
- db MANKEY
- db $00
-
-.list_retreat ; 14ec0 (5:1ec0)
- ai_retreat MACHOP, -1
- ai_retreat MACHOKE, -1
- ai_retreat MANKEY, -2
- db $00
-
-.list_energy ; 14ec7 (5:1ec7)
- ai_energy MACHOP, 3, +0
- ai_energy MACHOKE, 4, +0
- ai_energy MACHAMP, 4, -1
- ai_energy HITMONCHAN, 3, +0
- ai_energy HITMONLEE, 3, +0
- ai_energy MANKEY, 2, -1
- ai_energy PRIMEAPE, 3, -1
- db $00
-
-.list_prize ; 14edd (5:1edd)
- db HITMONLEE
- db HITMONCHAN
- db $00
-
-.store_list_pointers ; 14ee0 (5:4ee0)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x14f0e
+AIActionTable_FirstStrike: ; 14e89 (5:4e89)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 14e95 (5:4e95)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 14e99 (5:4e99)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 14eaa (5:4eaa)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 14eae (5:4eae)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 14eb2 (5:4eb2)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 14eb6 (5:1eb6)
+ db HITMONCHAN
+ db MACHOP
+ db HITMONLEE
+ db MANKEY
+ db $00
+
+.list_bench ; 14ebb (5:1ebb)
+ db MACHOP
+ db HITMONLEE
+ db HITMONCHAN
+ db MANKEY
+ db $00
+
+.list_retreat ; 14ec0 (5:1ec0)
+ ai_retreat MACHOP, -1
+ ai_retreat MACHOKE, -1
+ ai_retreat MANKEY, -2
+ db $00
+
+.list_energy ; 14ec7 (5:1ec7)
+ ai_energy MACHOP, 3, +0
+ ai_energy MACHOKE, 4, +0
+ ai_energy MACHAMP, 4, -1
+ ai_energy HITMONCHAN, 3, +0
+ ai_energy HITMONLEE, 3, +0
+ ai_energy MANKEY, 2, -1
+ ai_energy PRIMEAPE, 3, -1
+ db $00
+
+.list_prize ; 14edd (5:1edd)
+ db HITMONLEE
+ db HITMONCHAN
+ db $00
+
+.store_list_pointers ; 14ee0 (5:4ee0)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+; 0x14f0e
diff --git a/src/engine/deck_ai/decks/flower_power.asm b/src/engine/deck_ai/decks/flower_power.asm
index 566d064..47bbd55 100644
--- a/src/engine/deck_ai/decks/flower_power.asm
+++ b/src/engine/deck_ai/decks/flower_power.asm
@@ -1,81 +1,76 @@
-AIActionTable_FlowerPower: ; 1509b (5:509b)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 150a7 (5:50a7)
- call AIMainTurnLogic
- ret
-; 0x150ab
-
-.start_duel ; 150ab (5:50ab)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x150bc
-
-.forced_switch ; 150bc (5:50bc)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x150c0
-
-.ko_switch ; 150c0 (5:50c0)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x150c4
-
-.take_prize ; 150c4 (5:50c4)
- call AIPickPrizeCards
- ret
-; 0x150c8
-
-.list_arena ; 150c8 (5:50c8)
- db ODDISH
- db EXEGGCUTE
- db BULBASAUR
- db $00
-
-.list_bench ; 150cc (5:50cc)
- db BULBASAUR
- db EXEGGCUTE
- db ODDISH
- db $00
-
-.list_retreat ; 150cf (5:50cf)
- ai_retreat GLOOM, -2
- ai_retreat VILEPLUME, -2
- ai_retreat BULBASAUR, -2
- ai_retreat IVYSAUR, -2
- db $00
-
-.list_energy ; 150d9 (5:50d9)
- ai_energy BULBASAUR, 3, +0
- ai_energy IVYSAUR, 4, +0
- ai_energy VENUSAUR2, 4, +0
- ai_energy ODDISH, 2, +0
- ai_energy GLOOM, 3, -1
- ai_energy VILEPLUME, 3, -1
- ai_energy EXEGGCUTE, 3, +0
- ai_energy EXEGGUTOR, 22, +0
- db $00
-
-.list_prize ; 150f2 (5:50f2)
- db VENUSAUR2
- db $00
-
-.store_list_pointers ; 150f4 (5:50f4)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x15122
+AIActionTable_FlowerPower: ; 1509b (5:509b)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 150a7 (5:50a7)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 150ab (5:50ab)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 150bc (5:50bc)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 150c0 (5:50c0)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 150c4 (5:50c4)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 150c8 (5:50c8)
+ db ODDISH
+ db EXEGGCUTE
+ db BULBASAUR
+ db $00
+
+.list_bench ; 150cc (5:50cc)
+ db BULBASAUR
+ db EXEGGCUTE
+ db ODDISH
+ db $00
+
+.list_retreat ; 150cf (5:50cf)
+ ai_retreat GLOOM, -2
+ ai_retreat VILEPLUME, -2
+ ai_retreat BULBASAUR, -2
+ ai_retreat IVYSAUR, -2
+ db $00
+
+.list_energy ; 150d9 (5:50d9)
+ ai_energy BULBASAUR, 3, +0
+ ai_energy IVYSAUR, 4, +0
+ ai_energy VENUSAUR2, 4, +0
+ ai_energy ODDISH, 2, +0
+ ai_energy GLOOM, 3, -1
+ ai_energy VILEPLUME, 3, -1
+ ai_energy EXEGGCUTE, 3, +0
+ ai_energy EXEGGUTOR, 22, +0
+ db $00
+
+.list_prize ; 150f2 (5:50f2)
+ db VENUSAUR2
+ db $00
+
+.store_list_pointers ; 150f4 (5:50f4)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+; 0x15122
diff --git a/src/engine/deck_ai/decks/general.asm b/src/engine/deck_ai/decks/general.asm
index 1bfc3e0..dd9060e 100644
--- a/src/engine/deck_ai/decks/general.asm
+++ b/src/engine/deck_ai/decks/general.asm
@@ -1,196 +1,195 @@
-; AI logic used by general decks
-AIActionTable_GeneralDecks: ; 14668 (05:4668)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 14674 (5:4674)
- call AIMainTurnLogic
- ret
-
-.start_duel ; 14678 (5:4678)
- call InitAIDuelVars
- call AIPlayInitialBasicCards
- ret
-
-.forced_switch ; 1467f (5:467f)
- call AIDecideBenchPokemonToSwitchTo
- ret
-
-.ko_switch ; 14683 (5:4683)
- call AIDecideBenchPokemonToSwitchTo
- ret
-
-.take_prize: ; 14687 (5:4687)
- call AIPickPrizeCards
- ret
-
-; handle AI routines for a whole turn
-AIMainTurnLogic: ; 1468b (5:468b)
-; initialize variables
- call InitAITurnVars
- ld a, AI_TRAINER_CARD_PHASE_01
- call AIProcessHandTrainerCards
- farcall HandleAIAntiMewtwoDeckStrategy
- jp nc, .try_attack
-; handle Pkmn Powers
- farcall HandleAIGoGoRainDanceEnergy
- farcall HandleAIDamageSwap
- farcall HandleAIPkmnPowers
- ret c ; return if turn ended
- farcall HandleAICowardice
-; process Trainer cards
-; phase 2 through 4.
- ld a, AI_TRAINER_CARD_PHASE_02
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_03
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_04
- call AIProcessHandTrainerCards
-; play Pokemon from hand
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
-; process Trainer cards
-; phase 5 through 12.
- ld a, AI_TRAINER_CARD_PHASE_05
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_06
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_07
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_08
- call AIProcessHandTrainerCards
- call AIProcessRetreat
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_11
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_12
- call AIProcessHandTrainerCards
-; play Energy card if possible
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_energy_attach_1
- call AIProcessAndTryToPlayEnergy
-.skip_energy_attach_1
-; play Pokemon from hand again
- call AIDecidePlayPokemonCard
-; handle Pkmn Powers again
- farcall HandleAIDamageSwap
- farcall HandleAIPkmnPowers
- ret c ; return if turn ended
- farcall HandleAIGoGoRainDanceEnergy
- ld a, AI_ENERGY_TRANS_ATTACK
- farcall HandleAIEnergyTrans
-; process Trainer cards phases 13 and 15
- ld a, AI_TRAINER_CARD_PHASE_13
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_15
- call AIProcessHandTrainerCards
-; if used Professor Oak, process new hand
-; if not, then proceed to attack.
- ld a, [wPreviousAIFlags]
- and AI_FLAG_USED_PROFESSOR_OAK
- jr z, .try_attack
- ld a, AI_TRAINER_CARD_PHASE_01
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_02
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_03
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_04
- call AIProcessHandTrainerCards
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
- ld a, AI_TRAINER_CARD_PHASE_05
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_06
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_07
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_08
- call AIProcessHandTrainerCards
- call AIProcessRetreat
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_11
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_12
- call AIProcessHandTrainerCards
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_energy_attach_2
- call AIProcessAndTryToPlayEnergy
-.skip_energy_attach_2
- call AIDecidePlayPokemonCard
- farcall HandleAIDamageSwap
- farcall HandleAIPkmnPowers
- ret c ; return if turn ended
- farcall HandleAIGoGoRainDanceEnergy
- ld a, AI_ENERGY_TRANS_ATTACK
- farcall HandleAIEnergyTrans
- ld a, AI_TRAINER_CARD_PHASE_13
- call AIProcessHandTrainerCards
- ; skip AI_TRAINER_CARD_PHASE_15
-.try_attack
- ld a, AI_ENERGY_TRANS_TO_BENCH
- farcall HandleAIEnergyTrans
-; attack if possible, if not,
-; finish turn without attacking.
- call AIProcessAndTryToUseAttack
- ret c ; return if AI attacked
- ld a, OPPACTION_FINISH_NO_ATTACK
- bank1call AIMakeDecision
- ret
-; 0x14786
-
-; handles AI retreating logic
-AIProcessRetreat: ; 14786 (5:4786)
- ld a, [wAIRetreatedThisTurn]
- or a
- ret nz ; return, already retreated this turn
-
- call AIDecideWhetherToRetreat
- ret nc ; return if not retreating
-
- call AIDecideBenchPokemonToSwitchTo
- ret c ; return if no Bench Pokemon
-
-; store Play Area to retreat to and
-; set wAIRetreatedThisTurn to true
- ld [wAIPlayAreaCardToSwitch], a
- ld a, $01
- ld [wAIRetreatedThisTurn], a
-
-; if AI can use Switch from hand, use it instead...
- ld a, AI_TRAINER_CARD_PHASE_09
- call AIProcessHandTrainerCards
- ld a, [wPreviousAIFlags]
- and AI_FLAG_USED_SWITCH
- jr nz, .used_switch
-; ... else try retreating normally.
- ld a, [wAIPlayAreaCardToSwitch]
- call AITryToRetreat
- ret
-
-.used_switch
-; if AI used switch, unset its AI flag
- ld a, [wPreviousAIFlags]
- and ~AI_FLAG_USED_SWITCH ; clear Switch flag
- ld [wPreviousAIFlags], a
-
-; bug, this doesn't make sense being here, since at this point
-; Switch Trainer card was already used to retreat the Pokemon.
-; what the routine will do is just transfer Energy cards to
-; the Arena Pokemon for the purpose of retreating, and
-; then not actually retreat, resulting in unusual behaviour.
-; this would only work placed right after the AI checks whether
-; they have Switch card in hand to use and doesn't have one.
-; (and probably that was the original intention.)
- ld a, AI_ENERGY_TRANS_RETREAT ; retreat
- farcall HandleAIEnergyTrans
- ret
-; 0x147bd
+; AI logic used by general decks
+AIActionTable_GeneralDecks: ; 14668 (05:4668)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 14674 (5:4674)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 14678 (5:4678)
+ call InitAIDuelVars
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 1467f (5:467f)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 14683 (5:4683)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize: ; 14687 (5:4687)
+ call AIPickPrizeCards
+ ret
+
+; handle AI routines for a whole turn
+AIMainTurnLogic: ; 1468b (5:468b)
+; initialize variables
+ call InitAITurnVars
+ ld a, AI_TRAINER_CARD_PHASE_01
+ call AIProcessHandTrainerCards
+ farcall HandleAIAntiMewtwoDeckStrategy
+ jp nc, .try_attack
+; handle Pkmn Powers
+ farcall HandleAIGoGoRainDanceEnergy
+ farcall HandleAIDamageSwap
+ farcall HandleAIPkmnPowers
+ ret c ; return if turn ended
+ farcall HandleAICowardice
+; process Trainer cards
+; phase 2 through 4.
+ ld a, AI_TRAINER_CARD_PHASE_02
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_03
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_04
+ call AIProcessHandTrainerCards
+; play Pokemon from hand
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+; process Trainer cards
+; phase 5 through 12.
+ ld a, AI_TRAINER_CARD_PHASE_05
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_06
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_07
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_08
+ call AIProcessHandTrainerCards
+ call AIProcessRetreat
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_11
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_12
+ call AIProcessHandTrainerCards
+; play Energy card if possible
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_energy_attach_1
+ call AIProcessAndTryToPlayEnergy
+.skip_energy_attach_1
+; play Pokemon from hand again
+ call AIDecidePlayPokemonCard
+; handle Pkmn Powers again
+ farcall HandleAIDamageSwap
+ farcall HandleAIPkmnPowers
+ ret c ; return if turn ended
+ farcall HandleAIGoGoRainDanceEnergy
+ ld a, AI_ENERGY_TRANS_ATTACK
+ farcall HandleAIEnergyTrans
+; process Trainer cards phases 13 and 15
+ ld a, AI_TRAINER_CARD_PHASE_13
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_15
+ call AIProcessHandTrainerCards
+; if used Professor Oak, process new hand
+; if not, then proceed to attack.
+ ld a, [wPreviousAIFlags]
+ and AI_FLAG_USED_PROFESSOR_OAK
+ jr z, .try_attack
+ ld a, AI_TRAINER_CARD_PHASE_01
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_02
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_03
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_04
+ call AIProcessHandTrainerCards
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+ ld a, AI_TRAINER_CARD_PHASE_05
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_06
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_07
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_08
+ call AIProcessHandTrainerCards
+ call AIProcessRetreat
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_11
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_12
+ call AIProcessHandTrainerCards
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_energy_attach_2
+ call AIProcessAndTryToPlayEnergy
+.skip_energy_attach_2
+ call AIDecidePlayPokemonCard
+ farcall HandleAIDamageSwap
+ farcall HandleAIPkmnPowers
+ ret c ; return if turn ended
+ farcall HandleAIGoGoRainDanceEnergy
+ ld a, AI_ENERGY_TRANS_ATTACK
+ farcall HandleAIEnergyTrans
+ ld a, AI_TRAINER_CARD_PHASE_13
+ call AIProcessHandTrainerCards
+ ; skip AI_TRAINER_CARD_PHASE_15
+.try_attack
+ ld a, AI_ENERGY_TRANS_TO_BENCH
+ farcall HandleAIEnergyTrans
+; attack if possible, if not,
+; finish turn without attacking.
+ call AIProcessAndTryToUseAttack
+ ret c ; return if AI attacked
+ ld a, OPPACTION_FINISH_NO_ATTACK
+ bank1call AIMakeDecision
+ ret
+
+; handles AI retreating logic
+AIProcessRetreat: ; 14786 (5:4786)
+ ld a, [wAIRetreatedThisTurn]
+ or a
+ ret nz ; return, already retreated this turn
+
+ call AIDecideWhetherToRetreat
+ ret nc ; return if not retreating
+
+ call AIDecideBenchPokemonToSwitchTo
+ ret c ; return if no Bench Pokemon
+
+; store Play Area to retreat to and
+; set wAIRetreatedThisTurn to true
+ ld [wAIPlayAreaCardToSwitch], a
+ ld a, $01
+ ld [wAIRetreatedThisTurn], a
+
+; if AI can use Switch from hand, use it instead...
+ ld a, AI_TRAINER_CARD_PHASE_09
+ call AIProcessHandTrainerCards
+ ld a, [wPreviousAIFlags]
+ and AI_FLAG_USED_SWITCH
+ jr nz, .used_switch
+; ... else try retreating normally.
+ ld a, [wAIPlayAreaCardToSwitch]
+ call AITryToRetreat
+ ret
+
+.used_switch
+; if AI used switch, unset its AI flag
+ ld a, [wPreviousAIFlags]
+ and ~AI_FLAG_USED_SWITCH ; clear Switch flag
+ ld [wPreviousAIFlags], a
+
+; bug, this doesn't make sense being here, since at this point
+; Switch Trainer card was already used to retreat the Pokemon.
+; what the routine will do is just transfer Energy cards to
+; the Arena Pokemon for the purpose of retreating, and
+; then not actually retreat, resulting in unusual behaviour.
+; this would only work placed right after the AI checks whether
+; they have Switch card in hand to use and doesn't have one.
+; (and probably that was the original intention.)
+ ld a, AI_ENERGY_TRANS_RETREAT ; retreat
+ farcall HandleAIEnergyTrans
+ ret
+; 0x147bd
diff --git a/src/engine/deck_ai/decks/general_no_retreat.asm b/src/engine/deck_ai/decks/general_no_retreat.asm
index e735076..4b962d4 100644
--- a/src/engine/deck_ai/decks/general_no_retreat.asm
+++ b/src/engine/deck_ai/decks/general_no_retreat.asm
@@ -1,146 +1,141 @@
-; acts just like a general deck AI except never retreats
-AIActionTable_GeneralNoRetreat: ; 148dc (5:48dc)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 148e8 (5:48e8)
- call AIDoTurn_GeneralNoRetreat
- ret
-; 0x148ec
-
-.start_duel ; 148ec (5:48ec)
- call InitAIDuelVars
- call AIPlayInitialBasicCards
- ret
-; 0x148f3
-
-.forced_switch ; 148f3 (5:48f3)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x148f7
-
-.ko_switch ; 148f7 (5:48f7)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x148fb
-
-.take_prize ; 148fb (5:48fb)
- call AIPickPrizeCards
- ret
-; 0x148ff
-
-AIDoTurn_GeneralNoRetreat: ; 148ff (5:48ff)
-; initialize variables
- call InitAITurnVars
- ld a, AI_TRAINER_CARD_PHASE_01
- call AIProcessHandTrainerCards
- farcall HandleAIAntiMewtwoDeckStrategy
- jp nc, .try_attack
-; handle Pkmn Powers
- farcall HandleAIGoGoRainDanceEnergy
- farcall HandleAIDamageSwap
- farcall HandleAIPkmnPowers
- ret c ; return if turn ended
- farcall HandleAICowardice
-; process Trainer cards
-; phase 2 through 4.
- ld a, AI_TRAINER_CARD_PHASE_02
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_03
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_04
- call AIProcessHandTrainerCards
-; play Pokemon from hand
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
-; process Trainer cards
-; phase 5 through 12.
- ld a, AI_TRAINER_CARD_PHASE_05
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_06
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_07
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_08
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_11
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_12
- call AIProcessHandTrainerCards
-; play Energy card if possible
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_energy_attach_1
- call AIProcessAndTryToPlayEnergy
-.skip_energy_attach_1
-; play Pokemon from hand again
- call AIDecidePlayPokemonCard
-; handle Pkmn Powers again
- farcall HandleAIDamageSwap
- farcall HandleAIPkmnPowers
- ret c ; return if turn ended
- farcall HandleAIGoGoRainDanceEnergy
- ld a, AI_ENERGY_TRANS_ATTACK
- farcall HandleAIEnergyTrans
-; process Trainer cards phases 13 and 15
- ld a, AI_TRAINER_CARD_PHASE_13
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_15
- call AIProcessHandTrainerCards
-; if used Professor Oak, process new hand
-; if not, then proceed to attack.
- ld a, [wPreviousAIFlags]
- and AI_FLAG_USED_PROFESSOR_OAK
- jr z, .try_attack
- ld a, AI_TRAINER_CARD_PHASE_01
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_02
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_03
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_04
- call AIProcessHandTrainerCards
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
- ld a, AI_TRAINER_CARD_PHASE_05
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_06
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_07
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_08
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_11
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_12
- call AIProcessHandTrainerCards
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_energy_attach_2
- call AIProcessAndTryToPlayEnergy
-.skip_energy_attach_2
- call AIDecidePlayPokemonCard
- farcall HandleAIDamageSwap
- farcall HandleAIPkmnPowers
- ret c ; return if turn ended
- farcall HandleAIGoGoRainDanceEnergy
- ld a, AI_TRAINER_CARD_PHASE_13
- call AIProcessHandTrainerCards
- ; skip AI_TRAINER_CARD_PHASE_15
-.try_attack
-; attack if possible, if not,
-; finish turn without attacking.
- call AIProcessAndTryToUseAttack
- ret c ; return if turn ended
- ld a, OPPACTION_FINISH_NO_ATTACK
- bank1call AIMakeDecision
- ret
-; 0x149e8
+; acts just like a general deck AI except never retreats
+AIActionTable_GeneralNoRetreat: ; 148dc (5:48dc)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 148e8 (5:48e8)
+ call AIDoTurn_GeneralNoRetreat
+ ret
+
+.start_duel ; 148ec (5:48ec)
+ call InitAIDuelVars
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 148f3 (5:48f3)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 148f7 (5:48f7)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 148fb (5:48fb)
+ call AIPickPrizeCards
+ ret
+
+AIDoTurn_GeneralNoRetreat: ; 148ff (5:48ff)
+; initialize variables
+ call InitAITurnVars
+ ld a, AI_TRAINER_CARD_PHASE_01
+ call AIProcessHandTrainerCards
+ farcall HandleAIAntiMewtwoDeckStrategy
+ jp nc, .try_attack
+; handle Pkmn Powers
+ farcall HandleAIGoGoRainDanceEnergy
+ farcall HandleAIDamageSwap
+ farcall HandleAIPkmnPowers
+ ret c ; return if turn ended
+ farcall HandleAICowardice
+; process Trainer cards
+; phase 2 through 4.
+ ld a, AI_TRAINER_CARD_PHASE_02
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_03
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_04
+ call AIProcessHandTrainerCards
+; play Pokemon from hand
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+; process Trainer cards
+; phase 5 through 12.
+ ld a, AI_TRAINER_CARD_PHASE_05
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_06
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_07
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_08
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_11
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_12
+ call AIProcessHandTrainerCards
+; play Energy card if possible
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_energy_attach_1
+ call AIProcessAndTryToPlayEnergy
+.skip_energy_attach_1
+; play Pokemon from hand again
+ call AIDecidePlayPokemonCard
+; handle Pkmn Powers again
+ farcall HandleAIDamageSwap
+ farcall HandleAIPkmnPowers
+ ret c ; return if turn ended
+ farcall HandleAIGoGoRainDanceEnergy
+ ld a, AI_ENERGY_TRANS_ATTACK
+ farcall HandleAIEnergyTrans
+; process Trainer cards phases 13 and 15
+ ld a, AI_TRAINER_CARD_PHASE_13
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_15
+ call AIProcessHandTrainerCards
+; if used Professor Oak, process new hand
+; if not, then proceed to attack.
+ ld a, [wPreviousAIFlags]
+ and AI_FLAG_USED_PROFESSOR_OAK
+ jr z, .try_attack
+ ld a, AI_TRAINER_CARD_PHASE_01
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_02
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_03
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_04
+ call AIProcessHandTrainerCards
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+ ld a, AI_TRAINER_CARD_PHASE_05
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_06
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_07
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_08
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_11
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_12
+ call AIProcessHandTrainerCards
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_energy_attach_2
+ call AIProcessAndTryToPlayEnergy
+.skip_energy_attach_2
+ call AIDecidePlayPokemonCard
+ farcall HandleAIDamageSwap
+ farcall HandleAIPkmnPowers
+ ret c ; return if turn ended
+ farcall HandleAIGoGoRainDanceEnergy
+ ld a, AI_TRAINER_CARD_PHASE_13
+ call AIProcessHandTrainerCards
+ ; skip AI_TRAINER_CARD_PHASE_15
+.try_attack
+; attack if possible, if not,
+; finish turn without attacking.
+ call AIProcessAndTryToUseAttack
+ ret c ; return if turn ended
+ ld a, OPPACTION_FINISH_NO_ATTACK
+ bank1call AIMakeDecision
+ ret
+; 0x149e8
diff --git a/src/engine/deck_ai/decks/go_go_rain_dance.asm b/src/engine/deck_ai/decks/go_go_rain_dance.asm
index 006bbdc..cf18893 100644
--- a/src/engine/deck_ai/decks/go_go_rain_dance.asm
+++ b/src/engine/deck_ai/decks/go_go_rain_dance.asm
@@ -1,85 +1,80 @@
-AIActionTable_GoGoRainDance: ; 14f8f (5:4f8f)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 14f9b (5:4f9b)
- call AIMainTurnLogic
- ret
-; 0x14f9f
-
-.start_duel ; 14f9f (5:4f9f)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x14fb0
-
-.forced_switch ; 14fb0 (5:4fb0)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14fb4
-
-.ko_switch ; 14fb4 (5:4fb4)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14fb8
-
-.take_prize ; 14fb8 (5:4fb8)
- call AIPickPrizeCards
- ret
-; 0x14fbc
-
-.list_arena ; 14fbc (5:4fbc)
- db LAPRAS
- db HORSEA
- db GOLDEEN
- db SQUIRTLE
- db $00
-
-.list_bench ; 14fc1 (5:4fc1)
- db SQUIRTLE
- db HORSEA
- db GOLDEEN
- db LAPRAS
- db $00
-
-.list_retreat ; 14fc6 (5:4fc6)
- ai_retreat SQUIRTLE, -3
- ai_retreat WARTORTLE, -2
- ai_retreat HORSEA, -1
- db $00
-
-.list_energy ; 14fcd (5:4fcd)
- ai_energy SQUIRTLE, 2, +0
- ai_energy WARTORTLE, 3, +0
- ai_energy BLASTOISE, 5, +0
- ai_energy GOLDEEN, 1, +0
- ai_energy SEAKING, 2, +0
- ai_energy HORSEA, 2, +0
- ai_energy SEADRA, 3, +0
- ai_energy LAPRAS, 3, +0
- db $00
-
-.list_prize ; 14fe6 (5:4fe6)
- db GAMBLER
- db ENERGY_RETRIEVAL
- db SUPER_ENERGY_RETRIEVAL
- db BLASTOISE
- db $00
-
-.store_list_pointers ; 14feb (5:4feb)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x15019
+AIActionTable_GoGoRainDance: ; 14f8f (5:4f8f)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 14f9b (5:4f9b)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 14f9f (5:4f9f)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 14fb0 (5:4fb0)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 14fb4 (5:4fb4)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 14fb8 (5:4fb8)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 14fbc (5:4fbc)
+ db LAPRAS
+ db HORSEA
+ db GOLDEEN
+ db SQUIRTLE
+ db $00
+
+.list_bench ; 14fc1 (5:4fc1)
+ db SQUIRTLE
+ db HORSEA
+ db GOLDEEN
+ db LAPRAS
+ db $00
+
+.list_retreat ; 14fc6 (5:4fc6)
+ ai_retreat SQUIRTLE, -3
+ ai_retreat WARTORTLE, -2
+ ai_retreat HORSEA, -1
+ db $00
+
+.list_energy ; 14fcd (5:4fcd)
+ ai_energy SQUIRTLE, 2, +0
+ ai_energy WARTORTLE, 3, +0
+ ai_energy BLASTOISE, 5, +0
+ ai_energy GOLDEEN, 1, +0
+ ai_energy SEAKING, 2, +0
+ ai_energy HORSEA, 2, +0
+ ai_energy SEADRA, 3, +0
+ ai_energy LAPRAS, 3, +0
+ db $00
+
+.list_prize ; 14fe6 (5:4fe6)
+ db GAMBLER
+ db ENERGY_RETRIEVAL
+ db SUPER_ENERGY_RETRIEVAL
+ db BLASTOISE
+ db $00
+
+.store_list_pointers ; 14feb (5:4feb)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+; 0x15019
diff --git a/src/engine/deck_ai/decks/im_ronald.asm b/src/engine/deck_ai/decks/im_ronald.asm
index c140f1d..8d8de6d 100644
--- a/src/engine/deck_ai/decks/im_ronald.asm
+++ b/src/engine/deck_ai/decks/im_ronald.asm
@@ -1,86 +1,81 @@
-AIActionTable_ImRonald: ; 152bd (5:52bd)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 152c9 (5:52c9)
- call AIMainTurnLogic
- ret
-; 0x152cd
-
-.start_duel ; 152cd (5:52cd)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x152de
-
-.forced_switch ; 152de (5:52de)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x152e2
-
-.ko_switch ; 152e2 (5:52e2)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x152e6
-
-.take_prize ; 152e6 (5:52e6)
- call AIPickPrizeCards
- ret
-; 0x152ea
-
-.list_arena ; 152ea (5:52ea)
- db LAPRAS
- db SEEL
- db CHARMANDER
- db CUBONE
- db SQUIRTLE
- db GROWLITHE
- db $00
-
-.list_bench ; 152f1 (5:52f1)
- db CHARMANDER
- db SQUIRTLE
- db SEEL
- db CUBONE
- db GROWLITHE
- db LAPRAS
- db $00
-
-.list_retreat ; 152f8 (5:52f8)
- db $00
-
-.list_energy ; 152f9 (5:52f9)
- ai_energy CHARMANDER, 3, +0
- ai_energy CHARMELEON, 5, +0
- ai_energy GROWLITHE, 2, +0
- ai_energy ARCANINE2, 4, +0
- ai_energy SQUIRTLE, 2, +0
- ai_energy WARTORTLE, 3, +0
- ai_energy SEEL, 3, +0
- ai_energy DEWGONG, 4, +0
- ai_energy LAPRAS, 3, +0
- ai_energy CUBONE, 3, +0
- ai_energy MAROWAK1, 3, +0
- db $00
-
-.list_prize ; 1531b (5:531b)
- db LAPRAS
- db $00
-
-.store_list_pointers ; 1531d (5:531d)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x1534b
+AIActionTable_ImRonald: ; 152bd (5:52bd)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 152c9 (5:52c9)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 152cd (5:52cd)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 152de (5:52de)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 152e2 (5:52e2)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 152e6 (5:52e6)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 152ea (5:52ea)
+ db LAPRAS
+ db SEEL
+ db CHARMANDER
+ db CUBONE
+ db SQUIRTLE
+ db GROWLITHE
+ db $00
+
+.list_bench ; 152f1 (5:52f1)
+ db CHARMANDER
+ db SQUIRTLE
+ db SEEL
+ db CUBONE
+ db GROWLITHE
+ db LAPRAS
+ db $00
+
+.list_retreat ; 152f8 (5:52f8)
+ db $00
+
+.list_energy ; 152f9 (5:52f9)
+ ai_energy CHARMANDER, 3, +0
+ ai_energy CHARMELEON, 5, +0
+ ai_energy GROWLITHE, 2, +0
+ ai_energy ARCANINE2, 4, +0
+ ai_energy SQUIRTLE, 2, +0
+ ai_energy WARTORTLE, 3, +0
+ ai_energy SEEL, 3, +0
+ ai_energy DEWGONG, 4, +0
+ ai_energy LAPRAS, 3, +0
+ ai_energy CUBONE, 3, +0
+ ai_energy MAROWAK1, 3, +0
+ db $00
+
+.list_prize ; 1531b (5:531b)
+ db LAPRAS
+ db $00
+
+.store_list_pointers ; 1531d (5:531d)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+; 0x1534b
diff --git a/src/engine/deck_ai/decks/invincible_ronald.asm b/src/engine/deck_ai/decks/invincible_ronald.asm
index 0a55461..c228577 100644
--- a/src/engine/deck_ai/decks/invincible_ronald.asm
+++ b/src/engine/deck_ai/decks/invincible_ronald.asm
@@ -1,84 +1,79 @@
-AIActionTable_InvincibleRonald: ; 153e8 (5:53e8)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 153f4 (5:53f4)
- call AIMainTurnLogic
- ret
-; 0x153f8
-
-.start_duel ; 153f8 (5:53f8)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x15409
-
-.forced_switch ; 15409 (5:5409)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x1540d
-
-.ko_switch ; 1540d (5:540d)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x15411
-
-.take_prize ; 15411 (5:5411)
- call AIPickPrizeCards
- ret
-; 0x15415
-
-.list_arena ; 15415 (5:5415)
- db KANGASKHAN
- db MAGMAR2
- db CHANSEY
- db GEODUDE
- db SCYTHER
- db GRIMER
- db $00
-
-.list_bench ; 1541c (5:541c)
- db GRIMER
- db SCYTHER
- db GEODUDE
- db CHANSEY
- db MAGMAR2
- db KANGASKHAN
- db $00
-
-.list_retreat ; 15423 (5:5423)
- ai_retreat GRIMER, -1
- db $00
-
-.list_energy ; 15426 (5:5426)
- ai_energy GRIMER, 1, -1
- ai_energy MUK, 3, -1
- ai_energy SCYTHER, 4, +1
- ai_energy MAGMAR2, 2, +0
- ai_energy GEODUDE, 2, +0
- ai_energy GRAVELER, 3, +0
- ai_energy CHANSEY, 4, +0
- ai_energy KANGASKHAN, 4, -1
- db $00
-
-.list_prize ; 1543f (5:543f)
- db GAMBLER
- db $00
-
-.store_list_pointers ; 15441 (5:5441)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x1546f
+AIActionTable_InvincibleRonald: ; 153e8 (5:53e8)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 153f4 (5:53f4)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 153f8 (5:53f8)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 15409 (5:5409)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 1540d (5:540d)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 15411 (5:5411)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 15415 (5:5415)
+ db KANGASKHAN
+ db MAGMAR2
+ db CHANSEY
+ db GEODUDE
+ db SCYTHER
+ db GRIMER
+ db $00
+
+.list_bench ; 1541c (5:541c)
+ db GRIMER
+ db SCYTHER
+ db GEODUDE
+ db CHANSEY
+ db MAGMAR2
+ db KANGASKHAN
+ db $00
+
+.list_retreat ; 15423 (5:5423)
+ ai_retreat GRIMER, -1
+ db $00
+
+.list_energy ; 15426 (5:5426)
+ ai_energy GRIMER, 1, -1
+ ai_energy MUK, 3, -1
+ ai_energy SCYTHER, 4, +1
+ ai_energy MAGMAR2, 2, +0
+ ai_energy GEODUDE, 2, +0
+ ai_energy GRAVELER, 3, +0
+ ai_energy CHANSEY, 4, +0
+ ai_energy KANGASKHAN, 4, -1
+ db $00
+
+.list_prize ; 1543f (5:543f)
+ db GAMBLER
+ db $00
+
+.store_list_pointers ; 15441 (5:5441)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+; 0x1546f
diff --git a/src/engine/deck_ai/decks/legendary_articuno.asm b/src/engine/deck_ai/decks/legendary_articuno.asm
index 183ab62..62ee246 100644
--- a/src/engine/deck_ai/decks/legendary_articuno.asm
+++ b/src/engine/deck_ai/decks/legendary_articuno.asm
@@ -1,217 +1,210 @@
-AIActionTable_LegendaryArticuno: ; 14c0b (5:4c0b)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 14c17 (5:4c17)
- call AIDoTurn_LegendaryArticuno
- ret
-; 0x14c1b
-
-.start_duel ; 14c1b (5:4c1b)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x14c2c
-
-.forced_switch ; 14c2c (5:4c2c)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14c30
-
-.ko_switch ; 14c30 (5:4c30)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14c34
-
-.take_prize ; 14c34 (5:4c34)
- call AIPickPrizeCards
- ret
-; 0x14c38
-
-.list_arena ; 14c38 (5:4c38)
- db CHANSEY
- db LAPRAS
- db DITTO
- db SEEL
- db ARTICUNO1
- db ARTICUNO2
- db $00
-
-.list_bench ; 14c3f (5:4c3f)
- db ARTICUNO1
- db SEEL
- db LAPRAS
- db CHANSEY
- db DITTO
- db $00
-
-.list_retreat ; 14c45 (5:4c45)
- ai_retreat SEEL, -3
- ai_retreat DITTO, -3
- db $00
-
-.list_energy ; 14c4a (5:4c4a)
- ai_energy SEEL, 3, +1
- ai_energy DEWGONG, 4, +0
- ai_energy LAPRAS, 3, +0
- ai_energy ARTICUNO1, 4, +1
- ai_energy ARTICUNO2, 3, +0
- ai_energy CHANSEY, 0, -8
- ai_energy DITTO, 3, +0
- db $00
-
-.list_prize ; 14c60 (5:4c60)
- db GAMBLER
- db ARTICUNO2
- db $00
-
-.store_list_pointers ; 14c63 (5:4c63)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x14c91
-
-; this routine handles how Legendary Articuno
-; prioritises playing energy cards to each Pokémon.
-; first, it makes sure that all Lapras have at least
-; 3 energy cards before moving on to Articuno,
-; and then to Dewgong and Seel
-ScoreLegendaryArticunoCards: ; 14c91 (5:4c91)
- call SwapTurn
- call CountPrizes
- call SwapTurn
- cp 3
- ret c
-
-; player prizes >= 3
-; if Lapras has more than half HP and
-; can use second move, check next for Articuno
-; otherwise, check if Articuno or Dewgong
-; have more than half HP and can use second move
-; and if so, the next Pokémon to check is Lapras
- ld a, LAPRAS
- call CheckForBenchIDAtHalfHPAndCanUseSecondMove
- jr c, .articuno
- ld a, ARTICUNO1
- call CheckForBenchIDAtHalfHPAndCanUseSecondMove
- jr c, .lapras
- ld a, DEWGONG
- call CheckForBenchIDAtHalfHPAndCanUseSecondMove
- jr c, .lapras
- jr .articuno
-
-; the following routines check for certain card IDs in bench
-; and call RaiseAIScoreToAllMatchingIDsInBench if these are found.
-; for Lapras, an additional check is made to its
-; attached energy count, which skips calling the routine
-; if this count is >= 3
-.lapras
- ld a, LAPRAS
- ld b, PLAY_AREA_BENCH_1
- call LookForCardIDInPlayArea_Bank5
- jr nc, .articuno
- ld e, a
- call CountNumberOfEnergyCardsAttached
- cp 3
- jr nc, .articuno
- ld a, LAPRAS
- call RaiseAIScoreToAllMatchingIDsInBench
- ret
-
-.articuno
- ld a, ARTICUNO1
- ld b, PLAY_AREA_BENCH_1
- call LookForCardIDInPlayArea_Bank5
- jr nc, .dewgong
- ld a, ARTICUNO1
- call RaiseAIScoreToAllMatchingIDsInBench
- ret
-
-.dewgong
- ld a, DEWGONG
- ld b, PLAY_AREA_BENCH_1
- call LookForCardIDInPlayArea_Bank5
- jr nc, .seel
- ld a, DEWGONG
- call RaiseAIScoreToAllMatchingIDsInBench
- ret
-
-.seel
- ld a, SEEL
- ld b, PLAY_AREA_BENCH_1
- call LookForCardIDInPlayArea_Bank5
- ret nc
- ld a, SEEL
- call RaiseAIScoreToAllMatchingIDsInBench
- ret
-; 0x14cf7
-
-AIDoTurn_LegendaryArticuno: ; 14cf7 (5:4cf7)
-; initialize variables
- call InitAITurnVars
- ld a, AI_TRAINER_CARD_PHASE_01
- call AIProcessHandTrainerCards
- farcall HandleAIAntiMewtwoDeckStrategy
- jp nc, .try_attack
-; process Trainer cards
- ld a, AI_TRAINER_CARD_PHASE_02
- call AIProcessHandTrainerCards
-; play Pokemon from hand
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
- call AIProcessRetreat
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
-; play Energy card if possible
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_energy_attach_1
- call AIProcessAndTryToPlayEnergy
-.skip_energy_attach_1
-; play Pokemon from hand again
- call AIDecidePlayPokemonCard
-; process Trainer cards phases 13 and 15
- ld a, AI_TRAINER_CARD_PHASE_13
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_15
- call AIProcessHandTrainerCards
-; if used Professor Oak, process new hand
- ld a, [wPreviousAIFlags]
- and AI_FLAG_USED_PROFESSOR_OAK
- jr z, .try_attack
- ld a, AI_TRAINER_CARD_PHASE_01
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_02
- call AIProcessHandTrainerCards
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
- call AIProcessRetreat
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_energy_attach_2
- call AIProcessAndTryToPlayEnergy
-.skip_energy_attach_2
- call AIDecidePlayPokemonCard
-.try_attack
-; attack if possible, if not,
-; finish turn without attacking.
- call AIProcessAndTryToUseAttack
- ret c ; return if turn ended
- ld a, OPPACTION_FINISH_NO_ATTACK
- bank1call AIMakeDecision
- ret
-; 0x14d60
+AIActionTable_LegendaryArticuno: ; 14c0b (5:4c0b)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 14c17 (5:4c17)
+ call AIDoTurn_LegendaryArticuno
+ ret
+
+.start_duel ; 14c1b (5:4c1b)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 14c2c (5:4c2c)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 14c30 (5:4c30)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 14c34 (5:4c34)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 14c38 (5:4c38)
+ db CHANSEY
+ db LAPRAS
+ db DITTO
+ db SEEL
+ db ARTICUNO1
+ db ARTICUNO2
+ db $00
+
+.list_bench ; 14c3f (5:4c3f)
+ db ARTICUNO1
+ db SEEL
+ db LAPRAS
+ db CHANSEY
+ db DITTO
+ db $00
+
+.list_retreat ; 14c45 (5:4c45)
+ ai_retreat SEEL, -3
+ ai_retreat DITTO, -3
+ db $00
+
+.list_energy ; 14c4a (5:4c4a)
+ ai_energy SEEL, 3, +1
+ ai_energy DEWGONG, 4, +0
+ ai_energy LAPRAS, 3, +0
+ ai_energy ARTICUNO1, 4, +1
+ ai_energy ARTICUNO2, 3, +0
+ ai_energy CHANSEY, 0, -8
+ ai_energy DITTO, 3, +0
+ db $00
+
+.list_prize ; 14c60 (5:4c60)
+ db GAMBLER
+ db ARTICUNO2
+ db $00
+
+.store_list_pointers ; 14c63 (5:4c63)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+
+; this routine handles how Legendary Articuno
+; prioritises playing energy cards to each Pokémon.
+; first, it makes sure that all Lapras have at least
+; 3 energy cards before moving on to Articuno,
+; and then to Dewgong and Seel
+ScoreLegendaryArticunoCards: ; 14c91 (5:4c91)
+ call SwapTurn
+ call CountPrizes
+ call SwapTurn
+ cp 3
+ ret c
+
+; player prizes >= 3
+; if Lapras has more than half HP and
+; can use second move, check next for Articuno
+; otherwise, check if Articuno or Dewgong
+; have more than half HP and can use second move
+; and if so, the next Pokémon to check is Lapras
+ ld a, LAPRAS
+ call CheckForBenchIDAtHalfHPAndCanUseSecondMove
+ jr c, .articuno
+ ld a, ARTICUNO1
+ call CheckForBenchIDAtHalfHPAndCanUseSecondMove
+ jr c, .lapras
+ ld a, DEWGONG
+ call CheckForBenchIDAtHalfHPAndCanUseSecondMove
+ jr c, .lapras
+ jr .articuno
+
+; the following routines check for certain card IDs in bench
+; and call RaiseAIScoreToAllMatchingIDsInBench if these are found.
+; for Lapras, an additional check is made to its
+; attached energy count, which skips calling the routine
+; if this count is >= 3
+.lapras
+ ld a, LAPRAS
+ ld b, PLAY_AREA_BENCH_1
+ call LookForCardIDInPlayArea_Bank5
+ jr nc, .articuno
+ ld e, a
+ call CountNumberOfEnergyCardsAttached
+ cp 3
+ jr nc, .articuno
+ ld a, LAPRAS
+ call RaiseAIScoreToAllMatchingIDsInBench
+ ret
+
+.articuno
+ ld a, ARTICUNO1
+ ld b, PLAY_AREA_BENCH_1
+ call LookForCardIDInPlayArea_Bank5
+ jr nc, .dewgong
+ ld a, ARTICUNO1
+ call RaiseAIScoreToAllMatchingIDsInBench
+ ret
+
+.dewgong
+ ld a, DEWGONG
+ ld b, PLAY_AREA_BENCH_1
+ call LookForCardIDInPlayArea_Bank5
+ jr nc, .seel
+ ld a, DEWGONG
+ call RaiseAIScoreToAllMatchingIDsInBench
+ ret
+
+.seel
+ ld a, SEEL
+ ld b, PLAY_AREA_BENCH_1
+ call LookForCardIDInPlayArea_Bank5
+ ret nc
+ ld a, SEEL
+ call RaiseAIScoreToAllMatchingIDsInBench
+ ret
+
+AIDoTurn_LegendaryArticuno: ; 14cf7 (5:4cf7)
+; initialize variables
+ call InitAITurnVars
+ ld a, AI_TRAINER_CARD_PHASE_01
+ call AIProcessHandTrainerCards
+ farcall HandleAIAntiMewtwoDeckStrategy
+ jp nc, .try_attack
+; process Trainer cards
+ ld a, AI_TRAINER_CARD_PHASE_02
+ call AIProcessHandTrainerCards
+; play Pokemon from hand
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+ call AIProcessRetreat
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+; play Energy card if possible
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_energy_attach_1
+ call AIProcessAndTryToPlayEnergy
+.skip_energy_attach_1
+; play Pokemon from hand again
+ call AIDecidePlayPokemonCard
+; process Trainer cards phases 13 and 15
+ ld a, AI_TRAINER_CARD_PHASE_13
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_15
+ call AIProcessHandTrainerCards
+; if used Professor Oak, process new hand
+ ld a, [wPreviousAIFlags]
+ and AI_FLAG_USED_PROFESSOR_OAK
+ jr z, .try_attack
+ ld a, AI_TRAINER_CARD_PHASE_01
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_02
+ call AIProcessHandTrainerCards
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+ call AIProcessRetreat
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_energy_attach_2
+ call AIProcessAndTryToPlayEnergy
+.skip_energy_attach_2
+ call AIDecidePlayPokemonCard
+.try_attack
+; attack if possible, if not,
+; finish turn without attacking.
+ call AIProcessAndTryToUseAttack
+ ret c ; return if turn ended
+ ld a, OPPACTION_FINISH_NO_ATTACK
+ bank1call AIMakeDecision
+ ret
+; 0x14d60
diff --git a/src/engine/deck_ai/decks/legendary_dragonite.asm b/src/engine/deck_ai/decks/legendary_dragonite.asm
index d320440..7090e50 100644
--- a/src/engine/deck_ai/decks/legendary_dragonite.asm
+++ b/src/engine/deck_ai/decks/legendary_dragonite.asm
@@ -1,173 +1,167 @@
-AIActionTable_LegendaryDragonite: ; 14d60 (05:4d60)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 14d6c (5:4d6c)
- call AIDoTurn_LegendaryDragonite
- ret
-; 0x14d70
-
-.start_duel ; 14d70 (5:4d70)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x14d81
-
-.forced_switch ; 14d81 (5:4d81)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14d85
-
-.ko_switch ; 14d85 (5:4d85)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14d89
-
-.take_prize ; 14d89 (5:4d89)
- call AIPickPrizeCards
- ret
-; 0x14d8d
-
-.list_arena ; 14d8d (5:4d8d)
- db KANGASKHAN
- db LAPRAS
- db CHARMANDER
- db DRATINI
- db MAGIKARP
- db $00
-
-.list_bench ; 14d93 (5:4d93)
- db CHARMANDER
- db MAGIKARP
- db DRATINI
- db LAPRAS
- db KANGASKHAN
- db $00
-
-.list_retreat ; 14d99 (5:4d99)
- ai_retreat CHARMANDER, -1
- ai_retreat MAGIKARP, -5
- db $00
-
-.list_energy ; 14d9e (5:4d9e)
- ai_energy CHARMANDER, 3, +1
- ai_energy CHARMELEON, 4, +1
- ai_energy CHARIZARD, 5, +0
- ai_energy MAGIKARP, 3, +1
- ai_energy GYARADOS, 4, -1
- ai_energy DRATINI, 2, +0
- ai_energy DRAGONAIR, 4, +0
- ai_energy DRAGONITE1, 3, -1
- ai_energy KANGASKHAN, 2, -2
- ai_energy LAPRAS, 3, +0
- db $00
-
-.list_prize ; 14dbd (5:4dbd)
- db GAMBLER
- db DRAGONITE1
- db KANGASKHAN
- db $00
-
-.store_list_pointers ; 14dc1 (5:4dc1)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x14def
-
-AIDoTurn_LegendaryDragonite: ; 14def (5:4def)
-; initialize variables
- call InitAITurnVars
- ld a, AI_TRAINER_CARD_PHASE_01
- call AIProcessHandTrainerCards
- farcall HandleAIAntiMewtwoDeckStrategy
- jp nc, .try_attack
-; process Trainer cards
- ld a, AI_TRAINER_CARD_PHASE_02
- call AIProcessHandTrainerCards
-; play Pokemon from hand
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
- ld a, AI_TRAINER_CARD_PHASE_07
- call AIProcessHandTrainerCards
- call AIProcessRetreat
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_11
- call AIProcessHandTrainerCards
-; play Energy card if possible
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_energy_attach_1
-
-; if Arena card is Kangaskhan and doens't
-; have Energy cards attached, try attaching from hand.
-; otherwise run normal AI energy attach routine.
- ld a, DUELVARS_ARENA_CARD
- call GetTurnDuelistVariable
- call GetCardIDFromDeckIndex
- ld a, KANGASKHAN
- cp e
- jr nz, .attach_normally
- call CreateEnergyCardListFromHand
- jr c, .skip_energy_attach_1
- ld e, PLAY_AREA_ARENA
- call CountNumberOfEnergyCardsAttached
- or a
- jr nz, .attach_normally
- xor a
- ldh [hTempPlayAreaLocation_ff9d], a
- call AITryToPlayEnergyCard
- jr c, .skip_energy_attach_1
-.attach_normally
- call AIProcessAndTryToPlayEnergy
-
-.skip_energy_attach_1
-; play Pokemon from hand again
- call AIDecidePlayPokemonCard
- ld a, AI_TRAINER_CARD_PHASE_15
- call AIProcessHandTrainerCards
-; if used Professor Oak, process new hand
-; if not, then proceed to attack.
- ld a, [wPreviousAIFlags]
- and AI_FLAG_USED_PROFESSOR_OAK
- jr z, .try_attack
- ld a, AI_TRAINER_CARD_PHASE_01
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_02
- call AIProcessHandTrainerCards
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
- ld a, AI_TRAINER_CARD_PHASE_07
- call AIProcessHandTrainerCards
- call AIProcessRetreat
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_11
- call AIProcessHandTrainerCards
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_energy_attach_2
- call AIProcessAndTryToPlayEnergy
-.skip_energy_attach_2
- call AIDecidePlayPokemonCard
-.try_attack
-; attack if possible, if not,
-; finish turn without attacking.
- call AIProcessAndTryToUseAttack
- ret c ; return if turn ended
- ld a, OPPACTION_FINISH_NO_ATTACK
- bank1call AIMakeDecision
- ret
-; 0x14e89
+AIActionTable_LegendaryDragonite: ; 14d60 (05:4d60)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 14d6c (5:4d6c)
+ call AIDoTurn_LegendaryDragonite
+ ret
+
+.start_duel ; 14d70 (5:4d70)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 14d81 (5:4d81)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 14d85 (5:4d85)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 14d89 (5:4d89)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 14d8d (5:4d8d)
+ db KANGASKHAN
+ db LAPRAS
+ db CHARMANDER
+ db DRATINI
+ db MAGIKARP
+ db $00
+
+.list_bench ; 14d93 (5:4d93)
+ db CHARMANDER
+ db MAGIKARP
+ db DRATINI
+ db LAPRAS
+ db KANGASKHAN
+ db $00
+
+.list_retreat ; 14d99 (5:4d99)
+ ai_retreat CHARMANDER, -1
+ ai_retreat MAGIKARP, -5
+ db $00
+
+.list_energy ; 14d9e (5:4d9e)
+ ai_energy CHARMANDER, 3, +1
+ ai_energy CHARMELEON, 4, +1
+ ai_energy CHARIZARD, 5, +0
+ ai_energy MAGIKARP, 3, +1
+ ai_energy GYARADOS, 4, -1
+ ai_energy DRATINI, 2, +0
+ ai_energy DRAGONAIR, 4, +0
+ ai_energy DRAGONITE1, 3, -1
+ ai_energy KANGASKHAN, 2, -2
+ ai_energy LAPRAS, 3, +0
+ db $00
+
+.list_prize ; 14dbd (5:4dbd)
+ db GAMBLER
+ db DRAGONITE1
+ db KANGASKHAN
+ db $00
+
+.store_list_pointers ; 14dc1 (5:4dc1)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+
+AIDoTurn_LegendaryDragonite: ; 14def (5:4def)
+; initialize variables
+ call InitAITurnVars
+ ld a, AI_TRAINER_CARD_PHASE_01
+ call AIProcessHandTrainerCards
+ farcall HandleAIAntiMewtwoDeckStrategy
+ jp nc, .try_attack
+; process Trainer cards
+ ld a, AI_TRAINER_CARD_PHASE_02
+ call AIProcessHandTrainerCards
+; play Pokemon from hand
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+ ld a, AI_TRAINER_CARD_PHASE_07
+ call AIProcessHandTrainerCards
+ call AIProcessRetreat
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_11
+ call AIProcessHandTrainerCards
+; play Energy card if possible
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_energy_attach_1
+
+; if Arena card is Kangaskhan and doens't
+; have Energy cards attached, try attaching from hand.
+; otherwise run normal AI energy attach routine.
+ ld a, DUELVARS_ARENA_CARD
+ call GetTurnDuelistVariable
+ call GetCardIDFromDeckIndex
+ ld a, KANGASKHAN
+ cp e
+ jr nz, .attach_normally
+ call CreateEnergyCardListFromHand
+ jr c, .skip_energy_attach_1
+ ld e, PLAY_AREA_ARENA
+ call CountNumberOfEnergyCardsAttached
+ or a
+ jr nz, .attach_normally
+ xor a
+ ldh [hTempPlayAreaLocation_ff9d], a
+ call AITryToPlayEnergyCard
+ jr c, .skip_energy_attach_1
+.attach_normally
+ call AIProcessAndTryToPlayEnergy
+
+.skip_energy_attach_1
+; play Pokemon from hand again
+ call AIDecidePlayPokemonCard
+ ld a, AI_TRAINER_CARD_PHASE_15
+ call AIProcessHandTrainerCards
+; if used Professor Oak, process new hand
+; if not, then proceed to attack.
+ ld a, [wPreviousAIFlags]
+ and AI_FLAG_USED_PROFESSOR_OAK
+ jr z, .try_attack
+ ld a, AI_TRAINER_CARD_PHASE_01
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_02
+ call AIProcessHandTrainerCards
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+ ld a, AI_TRAINER_CARD_PHASE_07
+ call AIProcessHandTrainerCards
+ call AIProcessRetreat
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_11
+ call AIProcessHandTrainerCards
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_energy_attach_2
+ call AIProcessAndTryToPlayEnergy
+.skip_energy_attach_2
+ call AIDecidePlayPokemonCard
+.try_attack
+; attack if possible, if not,
+; finish turn without attacking.
+ call AIProcessAndTryToUseAttack
+ ret c ; return if turn ended
+ ld a, OPPACTION_FINISH_NO_ATTACK
+ bank1call AIMakeDecision
+ ret
+; 0x14e89
diff --git a/src/engine/deck_ai/decks/legendary_moltres.asm b/src/engine/deck_ai/decks/legendary_moltres.asm
index cb38668..2f67c3e 100644
--- a/src/engine/deck_ai/decks/legendary_moltres.asm
+++ b/src/engine/deck_ai/decks/legendary_moltres.asm
@@ -1,183 +1,177 @@
-AIActionTable_LegendaryMoltres: ; 149e8 (05:49e8)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 149f4 (5:49f4)
- call AIDoTurn_LegendaryMoltres
- ret
-; 0x149f8
-
-.start_duel ; 149f8 (5:49f8)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc ; Play Area set up was successful
- call AIPlayInitialBasicCards
- ret
-; 0x14a09
-
-.forced_switch ; 14a09 (5:4a09)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14a0d
-
-.ko_switch ; 14a0d (5:4a0d)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14a11
-
-.take_prize ; 14a11 (5:4a11)
- call AIPickPrizeCards
- ret
-; 0x14a15
-
-.list_arena ; 14a15 (5:4a15)
- db MAGMAR2
- db GROWLITHE
- db VULPIX
- db MAGMAR1
- db MOLTRES1
- db MOLTRES2
- db $00
-
-.list_bench ; 14a1c (5:4a1c)
- db MOLTRES1
- db VULPIX
- db GROWLITHE
- db MAGMAR2
- db MAGMAR1
- db $00
-
-.list_play_hand ; 14a22 (5:4a22)
- db MOLTRES2
- db MOLTRES1
- db VULPIX
- db GROWLITHE
- db MAGMAR2
- db MAGMAR1
- db $00
-
-.list_retreat ; 14a29 (5:4a29)
- ai_retreat GROWLITHE, -5
- ai_retreat VULPIX, -5
- db $00
-
-.list_energy ; 14a2e (5:4a2e)
- ai_energy VULPIX, 3, +0
- ai_energy NINETAILS2, 3, +1
- ai_energy GROWLITHE, 3, +1
- ai_energy ARCANINE2, 4, +1
- ai_energy MAGMAR1, 4, -1
- ai_energy MAGMAR2, 1, -1
- ai_energy MOLTRES2, 3, +2
- ai_energy MOLTRES1, 4, +2
- db $00
-
-.list_prize ; 14a47 (5:4a47)
- db ENERGY_REMOVAL
- db MOLTRES2
- db $00
-
-.store_list_pointers ; 14a4a (5:4a4a)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_play_hand
- store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x14a81
-
-AIDoTurn_LegendaryMoltres: ; 14a81 (5:4a81)
-; initialize variables
- call InitAITurnVars
- farcall HandleAIAntiMewtwoDeckStrategy
- jp nc, .try_attack
-; process Trainer cards
-; phase 2 through 4.
- ld a, AI_TRAINER_CARD_PHASE_02
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_04
- call AIProcessHandTrainerCards
-
-; check if AI can play Moltres2
-; from hand and if so, play it.
- ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
- call GetTurnDuelistVariable
- cp MAX_PLAY_AREA_POKEMON
- jr nc, .skip_moltres ; skip if bench is full
- ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK
- call GetTurnDuelistVariable
- cp DECK_SIZE - 9
- jr nc, .skip_moltres ; skip if cards in deck <= 9
- ld a, MUK
- call CountPokemonIDInBothPlayAreas
- jr c, .skip_moltres ; skip if Muk in play
- ld a, MOLTRES2
- call LookForCardIDInHandList_Bank5
- jr nc, .skip_moltres ; skip if no Moltres2 in hand
- ldh [hTemp_ffa0], a
- ld a, OPPACTION_PLAY_BASIC_PKMN
- bank1call AIMakeDecision
-
-.skip_moltres
-; play Pokemon from hand
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
-; process Trainer cards
- ld a, AI_TRAINER_CARD_PHASE_05
- call AIProcessHandTrainerCards
- call AIProcessRetreat
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_11
- call AIProcessHandTrainerCards
-; play Energy card if possible
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_attach_energy
-
-; if Magmar2 is the Arena card and has no energy attached,
-; try attaching an energy card to it from the hand.
-; otherwise, run normal AI energy attach routine.
- ld a, DUELVARS_ARENA_CARD
- call GetTurnDuelistVariable
- call GetCardIDFromDeckIndex
- ld a, MAGMAR2
- cp e
- jr nz, .attach_normally
- ; Magmar2 is the Arena card
- call CreateEnergyCardListFromHand
- jr c, .skip_attach_energy
- ld e, PLAY_AREA_ARENA
- call CountNumberOfEnergyCardsAttached
- or a
- jr nz, .attach_normally
- xor a ; PLAY_AREA_ARENA
- ldh [hTempPlayAreaLocation_ff9d], a
- call AITryToPlayEnergyCard
- jr c, .skip_attach_energy
-
-.attach_normally
-; play Energy card if possible
- call AIProcessAndTryToPlayEnergy
-.skip_attach_energy
-; try playing Pokemon cards from hand again
- call AIDecidePlayPokemonCard
- ld a, AI_TRAINER_CARD_PHASE_13
- call AIProcessHandTrainerCards
-
-.try_attack
-; attack if possible, if not,
-; finish turn without attacking.
- call AIProcessAndTryToUseAttack
- ret c
- ld a, OPPACTION_FINISH_NO_ATTACK
- bank1call AIMakeDecision
- ret
-; 0x14b0f
+AIActionTable_LegendaryMoltres: ; 149e8 (05:49e8)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 149f4 (5:49f4)
+ call AIDoTurn_LegendaryMoltres
+ ret
+
+.start_duel ; 149f8 (5:49f8)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc ; Play Area set up was successful
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 14a09 (5:4a09)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 14a0d (5:4a0d)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 14a11 (5:4a11)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 14a15 (5:4a15)
+ db MAGMAR2
+ db GROWLITHE
+ db VULPIX
+ db MAGMAR1
+ db MOLTRES1
+ db MOLTRES2
+ db $00
+
+.list_bench ; 14a1c (5:4a1c)
+ db MOLTRES1
+ db VULPIX
+ db GROWLITHE
+ db MAGMAR2
+ db MAGMAR1
+ db $00
+
+.list_play_hand ; 14a22 (5:4a22)
+ db MOLTRES2
+ db MOLTRES1
+ db VULPIX
+ db GROWLITHE
+ db MAGMAR2
+ db MAGMAR1
+ db $00
+
+.list_retreat ; 14a29 (5:4a29)
+ ai_retreat GROWLITHE, -5
+ ai_retreat VULPIX, -5
+ db $00
+
+.list_energy ; 14a2e (5:4a2e)
+ ai_energy VULPIX, 3, +0
+ ai_energy NINETAILS2, 3, +1
+ ai_energy GROWLITHE, 3, +1
+ ai_energy ARCANINE2, 4, +1
+ ai_energy MAGMAR1, 4, -1
+ ai_energy MAGMAR2, 1, -1
+ ai_energy MOLTRES2, 3, +2
+ ai_energy MOLTRES1, 4, +2
+ db $00
+
+.list_prize ; 14a47 (5:4a47)
+ db ENERGY_REMOVAL
+ db MOLTRES2
+ db $00
+
+.store_list_pointers ; 14a4a (5:4a4a)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_play_hand
+ store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+
+AIDoTurn_LegendaryMoltres: ; 14a81 (5:4a81)
+; initialize variables
+ call InitAITurnVars
+ farcall HandleAIAntiMewtwoDeckStrategy
+ jp nc, .try_attack
+; process Trainer cards
+; phase 2 through 4.
+ ld a, AI_TRAINER_CARD_PHASE_02
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_04
+ call AIProcessHandTrainerCards
+
+; check if AI can play Moltres2
+; from hand and if so, play it.
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ cp MAX_PLAY_AREA_POKEMON
+ jr nc, .skip_moltres ; skip if bench is full
+ ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK
+ call GetTurnDuelistVariable
+ cp DECK_SIZE - 9
+ jr nc, .skip_moltres ; skip if cards in deck <= 9
+ ld a, MUK
+ call CountPokemonIDInBothPlayAreas
+ jr c, .skip_moltres ; skip if Muk in play
+ ld a, MOLTRES2
+ call LookForCardIDInHandList_Bank5
+ jr nc, .skip_moltres ; skip if no Moltres2 in hand
+ ldh [hTemp_ffa0], a
+ ld a, OPPACTION_PLAY_BASIC_PKMN
+ bank1call AIMakeDecision
+
+.skip_moltres
+; play Pokemon from hand
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+; process Trainer cards
+ ld a, AI_TRAINER_CARD_PHASE_05
+ call AIProcessHandTrainerCards
+ call AIProcessRetreat
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_11
+ call AIProcessHandTrainerCards
+; play Energy card if possible
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_attach_energy
+
+; if Magmar2 is the Arena card and has no energy attached,
+; try attaching an energy card to it from the hand.
+; otherwise, run normal AI energy attach routine.
+ ld a, DUELVARS_ARENA_CARD
+ call GetTurnDuelistVariable
+ call GetCardIDFromDeckIndex
+ ld a, MAGMAR2
+ cp e
+ jr nz, .attach_normally
+ ; Magmar2 is the Arena card
+ call CreateEnergyCardListFromHand
+ jr c, .skip_attach_energy
+ ld e, PLAY_AREA_ARENA
+ call CountNumberOfEnergyCardsAttached
+ or a
+ jr nz, .attach_normally
+ xor a ; PLAY_AREA_ARENA
+ ldh [hTempPlayAreaLocation_ff9d], a
+ call AITryToPlayEnergyCard
+ jr c, .skip_attach_energy
+
+.attach_normally
+; play Energy card if possible
+ call AIProcessAndTryToPlayEnergy
+.skip_attach_energy
+; try playing Pokemon cards from hand again
+ call AIDecidePlayPokemonCard
+ ld a, AI_TRAINER_CARD_PHASE_13
+ call AIProcessHandTrainerCards
+
+.try_attack
+; attack if possible, if not,
+; finish turn without attacking.
+ call AIProcessAndTryToUseAttack
+ ret c
+ ld a, OPPACTION_FINISH_NO_ATTACK
+ bank1call AIMakeDecision
+ ret
+; 0x14b0f
diff --git a/src/engine/deck_ai/decks/legendary_ronald.asm b/src/engine/deck_ai/decks/legendary_ronald.asm
index 2721ba9..5272f81 100644
--- a/src/engine/deck_ai/decks/legendary_ronald.asm
+++ b/src/engine/deck_ai/decks/legendary_ronald.asm
@@ -1,210 +1,204 @@
-AIActionTable_LegendaryRonald: ; 1546f (5:546f)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 1547b (5:547b)
- call AIDoTurn_LegendaryRonald
- ret
-; 0x1547f
-
-.start_duel ; 1547f (5:547f)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x15490
-
-.forced_switch ; 15490 (5:5490)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x15494
-
-.ko_switch ; 15494 (5:5494)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x15498
-
-.take_prize ; 15498 (5:5498)
- call AIPickPrizeCards
- ret
-; 0x1549c
-
-.list_arena ; 1549c (5:549c)
- db KANGASKHAN
- db DRATINI
- db EEVEE
- db ZAPDOS3
- db ARTICUNO2
- db MOLTRES2
- db $00
-
-.list_bench ; 154a3 (5:54a3)
- db KANGASKHAN
- db DRATINI
- db EEVEE
- db $00
-
-.list_play_hand ; 154a7 (5:54a7)
- db MOLTRES2
- db ZAPDOS3
- db KANGASKHAN
- db DRATINI
- db EEVEE
- db ARTICUNO2
- db $00
-
-.list_retreat ; 154ae (5:54ae)
- ai_retreat EEVEE, -2
- db $00
-
-.list_energy ; 154b1 (5:54b1)
- ai_energy FLAREON1, 3, +0
- ai_energy MOLTRES2, 3, +0
- ai_energy VAPOREON1, 3, +0
- ai_energy ARTICUNO2, 0, -8
- ai_energy JOLTEON1, 4, +0
- ai_energy ZAPDOS3, 0, -8
- ai_energy KANGASKHAN, 4, -1
- ai_energy EEVEE, 3, +0
- ai_energy DRATINI, 3, +0
- ai_energy DRAGONAIR, 4, +0
- ai_energy DRAGONITE1, 3, +0
- db $00
-
-.list_prize ; 154d3 (5:54d3)
- db MOLTRES2
- db ARTICUNO2
- db ZAPDOS3
- db DRAGONITE1
- db GAMBLER
- db $00
-
-.store_list_pointers ; 154d9 (5:54d9)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_play_hand
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x15507
-
-AIDoTurn_LegendaryRonald: ; 15507 (5:5507)
-; initialize variables
- call InitAITurnVars
-; process Trainer cards
- ld a, AI_TRAINER_CARD_PHASE_01
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_02
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_04
- call AIProcessHandTrainerCards
-
-; check if AI can play Moltres2
-; from hand and if so, play it.
- ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
- call GetTurnDuelistVariable
- cp MAX_PLAY_AREA_POKEMON
- jr nc, .skip_moltres_1 ; skip if bench is full
- ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK
- call GetTurnDuelistVariable
- cp DECK_SIZE - 9
- jr nc, .skip_moltres_1 ; skip if cards in deck <= 9
- ld a, MUK
- call CountPokemonIDInBothPlayAreas
- jr c, .skip_moltres_1 ; skip if Muk in play
- ld a, MOLTRES2
- call LookForCardIDInHandList_Bank5
- jr nc, .skip_moltres_1 ; skip if no Moltres2 in hand
- ldh [hTemp_ffa0], a
- ld a, OPPACTION_PLAY_BASIC_PKMN
- bank1call AIMakeDecision
-
-.skip_moltres_1
-; play Pokemon from hand
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
-; process Trainer cards
- ld a, AI_TRAINER_CARD_PHASE_05
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_07
- call AIProcessHandTrainerCards
- call AIProcessRetreat
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
-; play Energy card if possible
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_attach_energy_1
- call AIProcessAndTryToPlayEnergy
-.skip_attach_energy_1
-; try playing Pokemon cards from hand again
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
- ld a, AI_TRAINER_CARD_PHASE_15
-; if used Professor Oak, process new hand
-; if not, then proceed to attack.
- call AIProcessHandTrainerCards
- ld a, [wPreviousAIFlags]
- and AI_FLAG_USED_PROFESSOR_OAK
- jr z, .try_attack
- ld a, AI_TRAINER_CARD_PHASE_01
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_02
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_04
- call AIProcessHandTrainerCards
-
-; check if AI can play Moltres2
-; from hand and if so, play it.
- ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
- call GetTurnDuelistVariable
- cp MAX_PLAY_AREA_POKEMON
- jr nc, .skip_moltres_2 ; skip if bench is full
- ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK
- call GetTurnDuelistVariable
- cp DECK_SIZE - 9
- jr nc, .skip_moltres_2 ; skip if cards in deck <= 9
- ld a, MUK
- call CountPokemonIDInBothPlayAreas
- jr c, .skip_moltres_2 ; skip if Muk in play
- ld a, MOLTRES2
- call LookForCardIDInHandList_Bank5
- jr nc, .skip_moltres_2 ; skip if no Moltres2 in hand
- ldh [hTemp_ffa0], a
- ld a, OPPACTION_PLAY_BASIC_PKMN
- bank1call AIMakeDecision
-
-.skip_moltres_2
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
- ld a, AI_TRAINER_CARD_PHASE_05
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_07
- call AIProcessHandTrainerCards
- call AIProcessRetreat
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_attach_energy_2
- call AIProcessAndTryToPlayEnergy
-.skip_attach_energy_2
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
-.try_attack
-; attack if possible, if not,
-; finish turn without attacking.
- call AIProcessAndTryToUseAttack
- ret c ; return if turn ended
- ld a, OPPACTION_FINISH_NO_ATTACK
- bank1call AIMakeDecision
- ret
-; 0x155d2
+AIActionTable_LegendaryRonald: ; 1546f (5:546f)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 1547b (5:547b)
+ call AIDoTurn_LegendaryRonald
+ ret
+
+.start_duel ; 1547f (5:547f)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 15490 (5:5490)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 15494 (5:5494)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 15498 (5:5498)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 1549c (5:549c)
+ db KANGASKHAN
+ db DRATINI
+ db EEVEE
+ db ZAPDOS3
+ db ARTICUNO2
+ db MOLTRES2
+ db $00
+
+.list_bench ; 154a3 (5:54a3)
+ db KANGASKHAN
+ db DRATINI
+ db EEVEE
+ db $00
+
+.list_play_hand ; 154a7 (5:54a7)
+ db MOLTRES2
+ db ZAPDOS3
+ db KANGASKHAN
+ db DRATINI
+ db EEVEE
+ db ARTICUNO2
+ db $00
+
+.list_retreat ; 154ae (5:54ae)
+ ai_retreat EEVEE, -2
+ db $00
+
+.list_energy ; 154b1 (5:54b1)
+ ai_energy FLAREON1, 3, +0
+ ai_energy MOLTRES2, 3, +0
+ ai_energy VAPOREON1, 3, +0
+ ai_energy ARTICUNO2, 0, -8
+ ai_energy JOLTEON1, 4, +0
+ ai_energy ZAPDOS3, 0, -8
+ ai_energy KANGASKHAN, 4, -1
+ ai_energy EEVEE, 3, +0
+ ai_energy DRATINI, 3, +0
+ ai_energy DRAGONAIR, 4, +0
+ ai_energy DRAGONITE1, 3, +0
+ db $00
+
+.list_prize ; 154d3 (5:54d3)
+ db MOLTRES2
+ db ARTICUNO2
+ db ZAPDOS3
+ db DRAGONITE1
+ db GAMBLER
+ db $00
+
+.store_list_pointers ; 154d9 (5:54d9)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_play_hand
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+
+AIDoTurn_LegendaryRonald: ; 15507 (5:5507)
+; initialize variables
+ call InitAITurnVars
+; process Trainer cards
+ ld a, AI_TRAINER_CARD_PHASE_01
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_02
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_04
+ call AIProcessHandTrainerCards
+
+; check if AI can play Moltres2
+; from hand and if so, play it.
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ cp MAX_PLAY_AREA_POKEMON
+ jr nc, .skip_moltres_1 ; skip if bench is full
+ ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK
+ call GetTurnDuelistVariable
+ cp DECK_SIZE - 9
+ jr nc, .skip_moltres_1 ; skip if cards in deck <= 9
+ ld a, MUK
+ call CountPokemonIDInBothPlayAreas
+ jr c, .skip_moltres_1 ; skip if Muk in play
+ ld a, MOLTRES2
+ call LookForCardIDInHandList_Bank5
+ jr nc, .skip_moltres_1 ; skip if no Moltres2 in hand
+ ldh [hTemp_ffa0], a
+ ld a, OPPACTION_PLAY_BASIC_PKMN
+ bank1call AIMakeDecision
+
+.skip_moltres_1
+; play Pokemon from hand
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+; process Trainer cards
+ ld a, AI_TRAINER_CARD_PHASE_05
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_07
+ call AIProcessHandTrainerCards
+ call AIProcessRetreat
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+; play Energy card if possible
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_attach_energy_1
+ call AIProcessAndTryToPlayEnergy
+.skip_attach_energy_1
+; try playing Pokemon cards from hand again
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+ ld a, AI_TRAINER_CARD_PHASE_15
+; if used Professor Oak, process new hand
+; if not, then proceed to attack.
+ call AIProcessHandTrainerCards
+ ld a, [wPreviousAIFlags]
+ and AI_FLAG_USED_PROFESSOR_OAK
+ jr z, .try_attack
+ ld a, AI_TRAINER_CARD_PHASE_01
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_02
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_04
+ call AIProcessHandTrainerCards
+
+; check if AI can play Moltres2
+; from hand and if so, play it.
+ ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
+ call GetTurnDuelistVariable
+ cp MAX_PLAY_AREA_POKEMON
+ jr nc, .skip_moltres_2 ; skip if bench is full
+ ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK
+ call GetTurnDuelistVariable
+ cp DECK_SIZE - 9
+ jr nc, .skip_moltres_2 ; skip if cards in deck <= 9
+ ld a, MUK
+ call CountPokemonIDInBothPlayAreas
+ jr c, .skip_moltres_2 ; skip if Muk in play
+ ld a, MOLTRES2
+ call LookForCardIDInHandList_Bank5
+ jr nc, .skip_moltres_2 ; skip if no Moltres2 in hand
+ ldh [hTemp_ffa0], a
+ ld a, OPPACTION_PLAY_BASIC_PKMN
+ bank1call AIMakeDecision
+
+.skip_moltres_2
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+ ld a, AI_TRAINER_CARD_PHASE_05
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_07
+ call AIProcessHandTrainerCards
+ call AIProcessRetreat
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_attach_energy_2
+ call AIProcessAndTryToPlayEnergy
+.skip_attach_energy_2
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+.try_attack
+; attack if possible, if not,
+; finish turn without attacking.
+ call AIProcessAndTryToUseAttack
+ ret c ; return if turn ended
+ ld a, OPPACTION_FINISH_NO_ATTACK
+ bank1call AIMakeDecision
+ ret
+; 0x155d2
diff --git a/src/engine/deck_ai/decks/legendary_zapdos.asm b/src/engine/deck_ai/decks/legendary_zapdos.asm
index cfa60be..3a74ac6 100644
--- a/src/engine/deck_ai/decks/legendary_zapdos.asm
+++ b/src/engine/deck_ai/decks/legendary_zapdos.asm
@@ -1,160 +1,154 @@
-AIActionTable_LegendaryZapdos: ; 14b0f (05:4b0f)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 14b1b (5:4b1b)
- call AIDoTurn_LegendaryZapdos
- ret
-; 0x14b1f
-
-.start_duel ; 14b1f (5:4b1f)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x14b30
-
-.forced_switch ; 14b30 (5:4b30)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14b34
-
-.ko_switch ; 14b34 (5:4b34)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14b38
-
-.take_prize ; 14b38 (5:4b38)
- call AIPickPrizeCards
- ret
-; 0x14b3c
-
-.list_arena ; 14b3c (5:4b3c)
- db ELECTABUZZ2
- db VOLTORB
- db EEVEE
- db ZAPDOS1
- db ZAPDOS2
- db ZAPDOS3
- db $00
-
-.list_bench ; 14b43 (5:4b43)
- db ZAPDOS2
- db ZAPDOS1
- db EEVEE
- db VOLTORB
- db ELECTABUZZ2
- db $00
-
-.list_retreat ; 14b49 (5:4b49)
- ai_retreat EEVEE, -5
- ai_retreat VOLTORB, -5
- ai_retreat ELECTABUZZ2, -5
- db $00
-
-.list_energy ; 14b50 (5:4b50)
- ai_energy VOLTORB, 1, -1
- ai_energy ELECTRODE1, 3, +0
- ai_energy ELECTABUZZ2, 2, -1
- ai_energy JOLTEON2, 3, +1
- ai_energy ZAPDOS1, 4, +2
- ai_energy ZAPDOS2, 4, +2
- ai_energy ZAPDOS3, 3, +1
- ai_energy EEVEE, 3, +0
- db $00
-
-.list_prize ; 14b69 (5:4b69)
- db GAMBLER
- db ZAPDOS3
- db $00
-
-.store_list_pointers ; 14b6c (5:4b6c)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x14b9a
-
-AIDoTurn_LegendaryZapdos: ; 14b9a (5:4b9a)
-; initialize variables
- call InitAITurnVars
- farcall HandleAIAntiMewtwoDeckStrategy
- jp nc, .try_attack
-; process Trainer cards
- ld a, AI_TRAINER_CARD_PHASE_01
- call AIProcessHandTrainerCards
- ld a, AI_TRAINER_CARD_PHASE_04
- call AIProcessHandTrainerCards
-; play Pokemon from hand
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
- ld a, AI_TRAINER_CARD_PHASE_07
- call AIProcessHandTrainerCards
- call AIProcessRetreat
- ld a, AI_TRAINER_CARD_PHASE_10
- call AIProcessHandTrainerCards
-; play Energy card if possible.
- ld a, [wAlreadyPlayedEnergy]
- or a
- jr nz, .skip_energy_attach
-
-; if Arena card is Voltorb and there's Electrode1 in hand,
-; or if it's Electabuzz, try attaching Energy card
-; to the Arena card if it doesn't have any energy attached.
-; Otherwise if Energy card is not needed,
-; go through normal AI energy attach routine.
- ld a, DUELVARS_ARENA_CARD
- call GetTurnDuelistVariable
- call GetCardIDFromDeckIndex
- ld a, VOLTORB
- cp e
- jr nz, .check_electabuzz
- ld a, ELECTRODE1
- call LookForCardIDInHandList_Bank5
- jr nc, .attach_normally
- jr .voltorb_or_electabuzz
-.check_electabuzz
- ld a, ELECTABUZZ2
- cp e
- jr nz, .attach_normally
-
-.voltorb_or_electabuzz
- call CreateEnergyCardListFromHand
- jr c, .skip_energy_attach
- ld e, PLAY_AREA_ARENA
- call CountNumberOfEnergyCardsAttached
- or a
- jr nz, .attach_normally
- xor a ; PLAY_AREA_ARENA
- ldh [hTempPlayAreaLocation_ff9d], a
- call AITryToPlayEnergyCard
- jr c, .skip_energy_attach
-
-.attach_normally
- call AIProcessAndTryToPlayEnergy
-
-.skip_energy_attach
-; play Pokemon from hand again
- call AIDecidePlayPokemonCard
- ret c ; return if turn ended
- ld a, AI_TRAINER_CARD_PHASE_13
- call AIProcessHandTrainerCards
-.try_attack
-; attack if possible, if not,
-; finish turn without attacking.
- call AIProcessAndTryToUseAttack
- ret c ; return if turn ended
- ld a, OPPACTION_FINISH_NO_ATTACK
- bank1call AIMakeDecision
- ret
-; 0x14c0b
+AIActionTable_LegendaryZapdos: ; 14b0f (05:4b0f)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 14b1b (5:4b1b)
+ call AIDoTurn_LegendaryZapdos
+ ret
+
+.start_duel ; 14b1f (5:4b1f)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 14b30 (5:4b30)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 14b34 (5:4b34)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 14b38 (5:4b38)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 14b3c (5:4b3c)
+ db ELECTABUZZ2
+ db VOLTORB
+ db EEVEE
+ db ZAPDOS1
+ db ZAPDOS2
+ db ZAPDOS3
+ db $00
+
+.list_bench ; 14b43 (5:4b43)
+ db ZAPDOS2
+ db ZAPDOS1
+ db EEVEE
+ db VOLTORB
+ db ELECTABUZZ2
+ db $00
+
+.list_retreat ; 14b49 (5:4b49)
+ ai_retreat EEVEE, -5
+ ai_retreat VOLTORB, -5
+ ai_retreat ELECTABUZZ2, -5
+ db $00
+
+.list_energy ; 14b50 (5:4b50)
+ ai_energy VOLTORB, 1, -1
+ ai_energy ELECTRODE1, 3, +0
+ ai_energy ELECTABUZZ2, 2, -1
+ ai_energy JOLTEON2, 3, +1
+ ai_energy ZAPDOS1, 4, +2
+ ai_energy ZAPDOS2, 4, +2
+ ai_energy ZAPDOS3, 3, +1
+ ai_energy EEVEE, 3, +0
+ db $00
+
+.list_prize ; 14b69 (5:4b69)
+ db GAMBLER
+ db ZAPDOS3
+ db $00
+
+.store_list_pointers ; 14b6c (5:4b6c)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+
+AIDoTurn_LegendaryZapdos: ; 14b9a (5:4b9a)
+; initialize variables
+ call InitAITurnVars
+ farcall HandleAIAntiMewtwoDeckStrategy
+ jp nc, .try_attack
+; process Trainer cards
+ ld a, AI_TRAINER_CARD_PHASE_01
+ call AIProcessHandTrainerCards
+ ld a, AI_TRAINER_CARD_PHASE_04
+ call AIProcessHandTrainerCards
+; play Pokemon from hand
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+ ld a, AI_TRAINER_CARD_PHASE_07
+ call AIProcessHandTrainerCards
+ call AIProcessRetreat
+ ld a, AI_TRAINER_CARD_PHASE_10
+ call AIProcessHandTrainerCards
+; play Energy card if possible.
+ ld a, [wAlreadyPlayedEnergy]
+ or a
+ jr nz, .skip_energy_attach
+
+; if Arena card is Voltorb and there's Electrode1 in hand,
+; or if it's Electabuzz, try attaching Energy card
+; to the Arena card if it doesn't have any energy attached.
+; Otherwise if Energy card is not needed,
+; go through normal AI energy attach routine.
+ ld a, DUELVARS_ARENA_CARD
+ call GetTurnDuelistVariable
+ call GetCardIDFromDeckIndex
+ ld a, VOLTORB
+ cp e
+ jr nz, .check_electabuzz
+ ld a, ELECTRODE1
+ call LookForCardIDInHandList_Bank5
+ jr nc, .attach_normally
+ jr .voltorb_or_electabuzz
+.check_electabuzz
+ ld a, ELECTABUZZ2
+ cp e
+ jr nz, .attach_normally
+
+.voltorb_or_electabuzz
+ call CreateEnergyCardListFromHand
+ jr c, .skip_energy_attach
+ ld e, PLAY_AREA_ARENA
+ call CountNumberOfEnergyCardsAttached
+ or a
+ jr nz, .attach_normally
+ xor a ; PLAY_AREA_ARENA
+ ldh [hTempPlayAreaLocation_ff9d], a
+ call AITryToPlayEnergyCard
+ jr c, .skip_energy_attach
+
+.attach_normally
+ call AIProcessAndTryToPlayEnergy
+
+.skip_energy_attach
+; play Pokemon from hand again
+ call AIDecidePlayPokemonCard
+ ret c ; return if turn ended
+ ld a, AI_TRAINER_CARD_PHASE_13
+ call AIProcessHandTrainerCards
+.try_attack
+; attack if possible, if not,
+; finish turn without attacking.
+ call AIProcessAndTryToUseAttack
+ ret c ; return if turn ended
+ ld a, OPPACTION_FINISH_NO_ATTACK
+ bank1call AIMakeDecision
+ ret
+; 0x14c0b
diff --git a/src/engine/deck_ai/decks/powerful_ronald.asm b/src/engine/deck_ai/decks/powerful_ronald.asm
index d99f87f..9f1b0f3 100644
--- a/src/engine/deck_ai/decks/powerful_ronald.asm
+++ b/src/engine/deck_ai/decks/powerful_ronald.asm
@@ -1,98 +1,93 @@
-AIActionTable_PowerfulRonald: ; 1534b (5:534b)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 15357 (5:5357)
- call AIMainTurnLogic
- ret
-; 0x1535b
-
-.start_duel ; 1535b (5:535b)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x1536c
-
-.forced_switch ; 1536c (5:536c)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x15370
-
-.ko_switch ; 15370 (5:5370)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x15374
-
-.take_prize ; 15374 (5:5374)
- call AIPickPrizeCards
- ret
-; 0x15378
-
-.list_arena ; 15378 (5:5378)
- db KANGASKHAN
- db ELECTABUZZ2
- db HITMONCHAN
- db MR_MIME
- db LICKITUNG
- db HITMONLEE
- db TAUROS
- db JYNX
- db MEWTWO1
- db DODUO
- db $00
-
-.list_bench ; 15383 (5:5383)
- db KANGASKHAN
- db HITMONLEE
- db HITMONCHAN
- db TAUROS
- db DODUO
- db JYNX
- db MEWTWO1
- db ELECTABUZZ2
- db MR_MIME
- db LICKITUNG
- db $00
-
-.list_retreat ; 1538e (5:538e)
- ai_retreat KANGASKHAN, -1
- ai_retreat DODUO, -1
- ai_retreat DODRIO, -1
- db $00
-
-.list_energy ; 15395 (5:5395)
- ai_energy ELECTABUZZ2, 2, +1
- ai_energy HITMONLEE, 3, +1
- ai_energy HITMONCHAN, 3, +1
- ai_energy MR_MIME, 2, +0
- ai_energy JYNX, 3, +0
- ai_energy MEWTWO1, 2, +0
- ai_energy DODUO, 3, -1
- ai_energy DODRIO, 3, -1
- ai_energy LICKITUNG, 2, +0
- ai_energy KANGASKHAN, 4, -1
- ai_energy TAUROS, 3, +0
- db $00
-
-.list_prize ; 153b7 (5:53b7)
- db GAMBLER
- db ENERGY_REMOVAL
- db $00
-
-.store_list_pointers ; 153ba (5:53ba)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x153e8
+AIActionTable_PowerfulRonald: ; 1534b (5:534b)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 15357 (5:5357)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 1535b (5:535b)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 1536c (5:536c)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 15370 (5:5370)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 15374 (5:5374)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 15378 (5:5378)
+ db KANGASKHAN
+ db ELECTABUZZ2
+ db HITMONCHAN
+ db MR_MIME
+ db LICKITUNG
+ db HITMONLEE
+ db TAUROS
+ db JYNX
+ db MEWTWO1
+ db DODUO
+ db $00
+
+.list_bench ; 15383 (5:5383)
+ db KANGASKHAN
+ db HITMONLEE
+ db HITMONCHAN
+ db TAUROS
+ db DODUO
+ db JYNX
+ db MEWTWO1
+ db ELECTABUZZ2
+ db MR_MIME
+ db LICKITUNG
+ db $00
+
+.list_retreat ; 1538e (5:538e)
+ ai_retreat KANGASKHAN, -1
+ ai_retreat DODUO, -1
+ ai_retreat DODRIO, -1
+ db $00
+
+.list_energy ; 15395 (5:5395)
+ ai_energy ELECTABUZZ2, 2, +1
+ ai_energy HITMONLEE, 3, +1
+ ai_energy HITMONCHAN, 3, +1
+ ai_energy MR_MIME, 2, +0
+ ai_energy JYNX, 3, +0
+ ai_energy MEWTWO1, 2, +0
+ ai_energy DODUO, 3, -1
+ ai_energy DODRIO, 3, -1
+ ai_energy LICKITUNG, 2, +0
+ ai_energy KANGASKHAN, 4, -1
+ ai_energy TAUROS, 3, +0
+ db $00
+
+.list_prize ; 153b7 (5:53b7)
+ db GAMBLER
+ db ENERGY_REMOVAL
+ db $00
+
+.store_list_pointers ; 153ba (5:53ba)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+; 0x153e8
diff --git a/src/engine/deck_ai/decks/rock_crusher.asm b/src/engine/deck_ai/decks/rock_crusher.asm
index f4e79d8..7e5cb0a 100644
--- a/src/engine/deck_ai/decks/rock_crusher.asm
+++ b/src/engine/deck_ai/decks/rock_crusher.asm
@@ -1,80 +1,75 @@
-AIActionTable_RockCrusher: ; 14f0e (5:4f0e)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 14f1a (5:4f1a)
- call AIMainTurnLogic
- ret
-; 0x14f1e
-
-.start_duel ; 14f1e (5:4f1e)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x14f2f
-
-.forced_switch ; 14f2f (5:4f2f)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14f33
-
-.ko_switch ; 14f33 (5:4f33)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x14f37
-
-.take_prize ; 14f37 (5:4f37)
- call AIPickPrizeCards
- ret
-; 0x14f3b
-
-.list_arena ; 14f3b (5:4f3b)
- db RHYHORN
- db ONIX
- db GEODUDE
- db DIGLETT
- db $00
-
-.list_bench ; 14f40 (5:4f40)
- db DIGLETT
- db GEODUDE
- db RHYHORN
- db ONIX
- db $00
-
-.list_retreat ; 14f45 (5:4f45)
- ai_retreat DIGLETT, -1
- db $00
-
-.list_energy ; 14f48 (5:4f48)
- ai_energy DIGLETT, 3, +1
- ai_energy DUGTRIO, 4, +0
- ai_energy GEODUDE, 2, +1
- ai_energy GRAVELER, 3, +0
- ai_energy GOLEM, 4, +0
- ai_energy ONIX, 2, -1
- ai_energy RHYHORN, 3, +0
- db $00
-
-.list_prize ; 14f5e (5:4f5e)
- db ENERGY_REMOVAL
- db RHYHORN
- db $00
-
-.store_list_pointers ; 14f61 (5:4f61)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x14f8f
+AIActionTable_RockCrusher: ; 14f0e (5:4f0e)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 14f1a (5:4f1a)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 14f1e (5:4f1e)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 14f2f (5:4f2f)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 14f33 (5:4f33)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 14f37 (5:4f37)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 14f3b (5:4f3b)
+ db RHYHORN
+ db ONIX
+ db GEODUDE
+ db DIGLETT
+ db $00
+
+.list_bench ; 14f40 (5:4f40)
+ db DIGLETT
+ db GEODUDE
+ db RHYHORN
+ db ONIX
+ db $00
+
+.list_retreat ; 14f45 (5:4f45)
+ ai_retreat DIGLETT, -1
+ db $00
+
+.list_energy ; 14f48 (5:4f48)
+ ai_energy DIGLETT, 3, +1
+ ai_energy DUGTRIO, 4, +0
+ ai_energy GEODUDE, 2, +1
+ ai_energy GRAVELER, 3, +0
+ ai_energy GOLEM, 4, +0
+ ai_energy ONIX, 2, -1
+ ai_energy RHYHORN, 3, +0
+ db $00
+
+.list_prize ; 14f5e (5:4f5e)
+ db ENERGY_REMOVAL
+ db RHYHORN
+ db $00
+
+.store_list_pointers ; 14f61 (5:4f61)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+; 0x14f8f
diff --git a/src/engine/deck_ai/decks/sams_practice.asm b/src/engine/deck_ai/decks/sams_practice.asm
index 2ce0060..b7642a8 100644
--- a/src/engine/deck_ai/decks/sams_practice.asm
+++ b/src/engine/deck_ai/decks/sams_practice.asm
@@ -1,222 +1,206 @@
-; AI for Sam's practice duel, which handles his scripted actions.
-; will act as a normal duelist AI after turn 7.
-AIActionTable_SamPractice: ; 147bd (05:47bd)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 147c9 (5:47c9)
- call IsAIPracticeScriptedTurn
- jr nc, .scripted_1
-; not scripted, use AI main turn logic
- call AIMainTurnLogic
- ret
-.scripted_1 ; use scripted actions instead
- call AIPerformSciptedTurn
- ret
-; 0x147d6
-
-.start_duel ; 147d6 (5:47d6)
- call SetSamsStartingPlayArea
- ret
-; 0x147da
-
-.forced_switch ; 147da (5:47da)
- call IsAIPracticeScriptedTurn
- jr nc, .scripted_2
- call AIDecideBenchPokemonToSwitchTo
- ret
-.scripted_2
- call PickRandomBenchPokemon
- ret
-; 0x147e7
-
-.ko_switch: ; 147e7 (5:47e7)
- call IsAIPracticeScriptedTurn
- jr nc, .scripted_3
- call AIDecideBenchPokemonToSwitchTo
- ret
-.scripted_3
- call GetPlayAreaLocationOfRaticateOrRattata
- ret
-; 0x147f4
-
-.take_prize: ; 147f4 (5:47f4)
- call AIPickPrizeCards
- ret
-; 0x147f8
-
-; returns carry if number of turns
-; the AI has taken >= 7.
-; used to know whether AI Sam is still
-; doing scripted turns.
-IsAIPracticeScriptedTurn: ; 147f8 (5:47f8)
- ld a, [wDuelTurns]
- srl a
- cp 7
- ccf
- ret
-; 0x14801
-
-; places one Machop from the hand to the Play Area
-; and sets the number of prizes to 2.
-SetSamsStartingPlayArea: ; 14801 (5:4801)
- call CreateHandCardList
- ld hl, wDuelTempList
-.loop_hand
- ld a, [hli]
- ldh [hTempCardIndex_ff98], a
- cp $ff
- ret z
- call LoadCardDataToBuffer1_FromDeckIndex
- cp MACHOP
- jr nz, .loop_hand
- ldh a, [hTempCardIndex_ff98]
- call PutHandPokemonCardInPlayArea
- ld a, 2
- ld [wDuelInitialPrizes], a
- ret
-; 0x1481f
-
-; outputs in a Play Area location of Raticate or Rattata
-; in the Bench. If neither is found, just output PLAY_AREA_BENCH_1.
-GetPlayAreaLocationOfRaticateOrRattata: ; 1481f (5:481f)
- ld a, RATICATE
- ld b, PLAY_AREA_BENCH_1
- call LookForCardIDInPlayArea_Bank5
- cp $ff
- jr nz, .found
- ld a, RATTATA
- ld b, PLAY_AREA_BENCH_1
- call LookForCardIDInPlayArea_Bank5
- cp $ff
- jr nz, .found
- ld a, PLAY_AREA_BENCH_1
-.found
- ldh [hTempPlayAreaLocation_ff9d], a
- ret
-; 0x1483a
-
-; has AI execute some scripted actions depending on Duel turn.
-AIPerformSciptedTurn: ; 1483a (5:483a)
- ld a, [wDuelTurns]
- srl a
- ld hl, .scripted_actions_list
- call JumpToFunctionInTable
-
-; always attack with Arena card's first attack.
-; if it's unusable end turn without attacking.
- xor a
- ldh [hTempPlayAreaLocation_ff9d], a
- ld [wSelectedAttack], a
- call CheckIfSelectedMoveIsUnusable
- jr c, .unusable
- call AITryUseAttack
- ret
-
-.unusable
- ld a, OPPACTION_FINISH_NO_ATTACK
- bank1call AIMakeDecision
- ret
-; 0x1485a
-
-.scripted_actions_list ; 1485a (05:485a)
- dw .turn_1
- dw .turn_2
- dw .turn_3
- dw .turn_4
- dw .turn_5
- dw .turn_6
- dw .turn_7
-; 0x14868
-
-.turn_1 ; 14868 (5:4868)
- ld d, MACHOP
- ld e, FIGHTING_ENERGY
- call AIAttachEnergyInHandToCardInPlayArea
- ret
-; 0x14870
-
-.turn_2 ; 14870 (5:4870)
- ld a, RATTATA
- call LookForCardIDInHandList_Bank5
- ldh [hTemp_ffa0], a
- ld a, OPPACTION_PLAY_BASIC_PKMN
- bank1call AIMakeDecision
- ld d, RATTATA
- ld e, FIGHTING_ENERGY
- call AIAttachEnergyInHandToCardInPlayArea
- ret
-; 0x14884
-
-.turn_3 ; 14884 (5:4884)
- ld a, RATTATA
- ld b, PLAY_AREA_ARENA
- call LookForCardIDInPlayArea_Bank5
- ldh [hTempPlayAreaLocation_ffa1], a
- ld a, RATICATE
- call LookForCardIDInHandList_Bank5
- ldh [hTemp_ffa0], a
- ld a, OPPACTION_EVOLVE_PKMN
- bank1call AIMakeDecision
- ld d, RATICATE
- ld e, LIGHTNING_ENERGY
- call AIAttachEnergyInHandToCardInPlayArea
- ret
-; 0x148a1
-
-.turn_4 ; 148a1 (5:48a1)
- ld d, RATICATE
- ld e, LIGHTNING_ENERGY
- call AIAttachEnergyInHandToCardInPlayArea
- ret
-; 0x148a9
-
-.turn_5 ; 148a9 (5:48a9)
- ld a, MACHOP
- call LookForCardIDInHandList_Bank5
- ldh [hTemp_ffa0], a
- ld a, OPPACTION_PLAY_BASIC_PKMN
- bank1call AIMakeDecision
- ld d, MACHOP
- ld e, FIGHTING_ENERGY
- call AIAttachEnergyInHandToCardInBench
-
-; this is a bug, it's attempting to compare a card ID with a deck index.
-; the intention was to change the card to switch to depending on whether
-; the first Machop was KO'd at this point in the Duel or not.
-; because of the buggy comparison, this will always jump the
-; 'inc a' instruction and switch to PLAY_AREA_BENCH_1.
-; in a normal Practice Duel following Dr. Mason's instructions,
-; this will always lead to the AI correctly switching Raticate with Machop,
-; but in case of a "Free" Duel where the first Machop is not KO'd,
-; the intention was to switch to PLAY_AREA_BENCH_2 instead.
-; but due to 'inc a' always being skipped, it will switch to Raticate.
- ld a, DUELVARS_ARENA_CARD
- call GetTurnDuelistVariable
- cp MACHOP ; wrong
- ld a, PLAY_AREA_BENCH_1
- jr nz, .retreat
- inc a ; PLAY_AREA_BENCH_2
-
-.retreat
- call AITryToRetreat
- ret
-; 0x148cc
-
-.turn_6 ; 148cc (5:48cc)
- ld d, MACHOP
- ld e, FIGHTING_ENERGY
- call AIAttachEnergyInHandToCardInPlayArea
- ret
-; 0x148d4
-
-.turn_7 ; 148d4 (5:48d4)
- ld d, MACHOP
- ld e, FIGHTING_ENERGY
- call AIAttachEnergyInHandToCardInPlayArea
- ret
-; 0x148dc
+; AI for Sam's practice duel, which handles his scripted actions.
+; will act as a normal duelist AI after turn 7.
+AIActionTable_SamPractice: ; 147bd (05:47bd)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 147c9 (5:47c9)
+ call IsAIPracticeScriptedTurn
+ jr nc, .scripted_1
+; not scripted, use AI main turn logic
+ call AIMainTurnLogic
+ ret
+.scripted_1 ; use scripted actions instead
+ call AIPerformSciptedTurn
+ ret
+
+.start_duel ; 147d6 (5:47d6)
+ call SetSamsStartingPlayArea
+ ret
+
+.forced_switch ; 147da (5:47da)
+ call IsAIPracticeScriptedTurn
+ jr nc, .scripted_2
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+.scripted_2
+ call PickRandomBenchPokemon
+ ret
+
+.ko_switch: ; 147e7 (5:47e7)
+ call IsAIPracticeScriptedTurn
+ jr nc, .scripted_3
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+.scripted_3
+ call GetPlayAreaLocationOfRaticateOrRattata
+ ret
+
+.take_prize: ; 147f4 (5:47f4)
+ call AIPickPrizeCards
+ ret
+
+; returns carry if number of turns
+; the AI has taken >= 7.
+; used to know whether AI Sam is still
+; doing scripted turns.
+IsAIPracticeScriptedTurn: ; 147f8 (5:47f8)
+ ld a, [wDuelTurns]
+ srl a
+ cp 7
+ ccf
+ ret
+
+; places one Machop from the hand to the Play Area
+; and sets the number of prizes to 2.
+SetSamsStartingPlayArea: ; 14801 (5:4801)
+ call CreateHandCardList
+ ld hl, wDuelTempList
+.loop_hand
+ ld a, [hli]
+ ldh [hTempCardIndex_ff98], a
+ cp $ff
+ ret z
+ call LoadCardDataToBuffer1_FromDeckIndex
+ cp MACHOP
+ jr nz, .loop_hand
+ ldh a, [hTempCardIndex_ff98]
+ call PutHandPokemonCardInPlayArea
+ ld a, 2
+ ld [wDuelInitialPrizes], a
+ ret
+
+; outputs in a Play Area location of Raticate or Rattata
+; in the Bench. If neither is found, just output PLAY_AREA_BENCH_1.
+GetPlayAreaLocationOfRaticateOrRattata: ; 1481f (5:481f)
+ ld a, RATICATE
+ ld b, PLAY_AREA_BENCH_1
+ call LookForCardIDInPlayArea_Bank5
+ cp $ff
+ jr nz, .found
+ ld a, RATTATA
+ ld b, PLAY_AREA_BENCH_1
+ call LookForCardIDInPlayArea_Bank5
+ cp $ff
+ jr nz, .found
+ ld a, PLAY_AREA_BENCH_1
+.found
+ ldh [hTempPlayAreaLocation_ff9d], a
+ ret
+
+; has AI execute some scripted actions depending on Duel turn.
+AIPerformSciptedTurn: ; 1483a (5:483a)
+ ld a, [wDuelTurns]
+ srl a
+ ld hl, .scripted_actions_list
+ call JumpToFunctionInTable
+
+; always attack with Arena card's first attack.
+; if it's unusable end turn without attacking.
+ xor a
+ ldh [hTempPlayAreaLocation_ff9d], a
+ ld [wSelectedAttack], a
+ call CheckIfSelectedMoveIsUnusable
+ jr c, .unusable
+ call AITryUseAttack
+ ret
+
+.unusable
+ ld a, OPPACTION_FINISH_NO_ATTACK
+ bank1call AIMakeDecision
+ ret
+
+.scripted_actions_list ; 1485a (05:485a)
+ dw .turn_1
+ dw .turn_2
+ dw .turn_3
+ dw .turn_4
+ dw .turn_5
+ dw .turn_6
+ dw .turn_7
+
+.turn_1 ; 14868 (5:4868)
+ ld d, MACHOP
+ ld e, FIGHTING_ENERGY
+ call AIAttachEnergyInHandToCardInPlayArea
+ ret
+
+.turn_2 ; 14870 (5:4870)
+ ld a, RATTATA
+ call LookForCardIDInHandList_Bank5
+ ldh [hTemp_ffa0], a
+ ld a, OPPACTION_PLAY_BASIC_PKMN
+ bank1call AIMakeDecision
+ ld d, RATTATA
+ ld e, FIGHTING_ENERGY
+ call AIAttachEnergyInHandToCardInPlayArea
+ ret
+
+.turn_3 ; 14884 (5:4884)
+ ld a, RATTATA
+ ld b, PLAY_AREA_ARENA
+ call LookForCardIDInPlayArea_Bank5
+ ldh [hTempPlayAreaLocation_ffa1], a
+ ld a, RATICATE
+ call LookForCardIDInHandList_Bank5
+ ldh [hTemp_ffa0], a
+ ld a, OPPACTION_EVOLVE_PKMN
+ bank1call AIMakeDecision
+ ld d, RATICATE
+ ld e, LIGHTNING_ENERGY
+ call AIAttachEnergyInHandToCardInPlayArea
+ ret
+
+.turn_4 ; 148a1 (5:48a1)
+ ld d, RATICATE
+ ld e, LIGHTNING_ENERGY
+ call AIAttachEnergyInHandToCardInPlayArea
+ ret
+
+.turn_5 ; 148a9 (5:48a9)
+ ld a, MACHOP
+ call LookForCardIDInHandList_Bank5
+ ldh [hTemp_ffa0], a
+ ld a, OPPACTION_PLAY_BASIC_PKMN
+ bank1call AIMakeDecision
+ ld d, MACHOP
+ ld e, FIGHTING_ENERGY
+ call AIAttachEnergyInHandToCardInBench
+
+; this is a bug, it's attempting to compare a card ID with a deck index.
+; the intention was to change the card to switch to depending on whether
+; the first Machop was KO'd at this point in the Duel or not.
+; because of the buggy comparison, this will always jump the
+; 'inc a' instruction and switch to PLAY_AREA_BENCH_1.
+; in a normal Practice Duel following Dr. Mason's instructions,
+; this will always lead to the AI correctly switching Raticate with Machop,
+; but in case of a "Free" Duel where the first Machop is not KO'd,
+; the intention was to switch to PLAY_AREA_BENCH_2 instead.
+; but due to 'inc a' always being skipped, it will switch to Raticate.
+ ld a, DUELVARS_ARENA_CARD
+ call GetTurnDuelistVariable
+ cp MACHOP ; wrong
+ ld a, PLAY_AREA_BENCH_1
+ jr nz, .retreat
+ inc a ; PLAY_AREA_BENCH_2
+
+.retreat
+ call AITryToRetreat
+ ret
+
+.turn_6 ; 148cc (5:48cc)
+ ld d, MACHOP
+ ld e, FIGHTING_ENERGY
+ call AIAttachEnergyInHandToCardInPlayArea
+ ret
+
+.turn_7 ; 148d4 (5:48d4)
+ ld d, MACHOP
+ ld e, FIGHTING_ENERGY
+ call AIAttachEnergyInHandToCardInPlayArea
+ ret
+; 0x148dc
diff --git a/src/engine/deck_ai/decks/strange_psyshock.asm b/src/engine/deck_ai/decks/strange_psyshock.asm
index 309ef11..1ab948c 100644
--- a/src/engine/deck_ai/decks/strange_psyshock.asm
+++ b/src/engine/deck_ai/decks/strange_psyshock.asm
@@ -1,87 +1,82 @@
-AIActionTable_StrangePsyshock: ; 15122 (5:5122)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 1512e (5:512e)
- call AIMainTurnLogic
- ret
-; 0x15132
-
-.start_duel ; 15132 (5:5132)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x15143
-
-.forced_switch ; 15143 (5:5143)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x15147
-
-.ko_switch ; 15147 (5:5147)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x1514b
-
-.take_prize ; 1514b (5:514b)
- call AIPickPrizeCards
- ret
-; 0x1514f
-
-.list_arena ; 1514f (5:514f)
- db KANGASKHAN
- db CHANSEY
- db SNORLAX
- db MR_MIME
- db ABRA
- db $00
-
-.list_bench ; 15155 (5:5155)
- db ABRA
- db MR_MIME
- db KANGASKHAN
- db SNORLAX
- db CHANSEY
- db $00
-
-.list_retreat ; 1515b (5:515b)
- ai_retreat ABRA, -3
- ai_retreat SNORLAX, -3
- ai_retreat KANGASKHAN, -1
- ai_retreat CHANSEY, -1
- db $00
-
-.list_energy ; 15164 (5:5164)
- ai_energy ABRA, 3, +1
- ai_energy KADABRA, 3, +0
- ai_energy ALAKAZAM, 3, +0
- ai_energy MR_MIME, 2, +0
- ai_energy CHANSEY, 2, -2
- ai_energy KANGASKHAN, 4, -2
- ai_energy SNORLAX, 0, -8
- db $00
-
-.list_prize ; 1517a (5:517a)
- db GAMBLER
- db MR_MIME
- db ALAKAZAM
- db SWITCH
- db $00
-
-.store_list_pointers ; 1517f (5:517f)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x151ad
+AIActionTable_StrangePsyshock: ; 15122 (5:5122)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 1512e (5:512e)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 15132 (5:5132)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 15143 (5:5143)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 15147 (5:5147)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 1514b (5:514b)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 1514f (5:514f)
+ db KANGASKHAN
+ db CHANSEY
+ db SNORLAX
+ db MR_MIME
+ db ABRA
+ db $00
+
+.list_bench ; 15155 (5:5155)
+ db ABRA
+ db MR_MIME
+ db KANGASKHAN
+ db SNORLAX
+ db CHANSEY
+ db $00
+
+.list_retreat ; 1515b (5:515b)
+ ai_retreat ABRA, -3
+ ai_retreat SNORLAX, -3
+ ai_retreat KANGASKHAN, -1
+ ai_retreat CHANSEY, -1
+ db $00
+
+.list_energy ; 15164 (5:5164)
+ ai_energy ABRA, 3, +1
+ ai_energy KADABRA, 3, +0
+ ai_energy ALAKAZAM, 3, +0
+ ai_energy MR_MIME, 2, +0
+ ai_energy CHANSEY, 2, -2
+ ai_energy KANGASKHAN, 4, -2
+ ai_energy SNORLAX, 0, -8
+ db $00
+
+.list_prize ; 1517a (5:517a)
+ db GAMBLER
+ db MR_MIME
+ db ALAKAZAM
+ db SWITCH
+ db $00
+
+.store_list_pointers ; 1517f (5:517f)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+; 0x151ad
diff --git a/src/engine/deck_ai/decks/wonders_of_science.asm b/src/engine/deck_ai/decks/wonders_of_science.asm
index e11a829..24ad09d 100644
--- a/src/engine/deck_ai/decks/wonders_of_science.asm
+++ b/src/engine/deck_ai/decks/wonders_of_science.asm
@@ -1,83 +1,78 @@
-AIActionTable_WondersOfScience: ; 151ad (5:51ad)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 151b9 (5:51b9)
- call AIMainTurnLogic
- ret
-; 0x151bd
-
-.start_duel ; 151bd (5:51bd)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x151ce
-
-.forced_switch ; 151ce (5:51ce)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x151d2
-
-.ko_switch ; 151d2 (5:51d2)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x151d6
-
-.take_prize ; 151d6 (5:51d6)
- call AIPickPrizeCards
- ret
-; 0x151da
-
-.list_arena ; 151da (5:51da)
- db MEWTWO1
- db MEWTWO3
- db MEWTWO2
- db GRIMER
- db KOFFING
- db PORYGON
- db $00
-
-.list_bench ; 151e1 (5:51e1)
- db GRIMER
- db KOFFING
- db MEWTWO3
- db MEWTWO2
- db MEWTWO1
- db PORYGON
- db $00
-
-.list_retreat ; 151e8 (5:51e8)
- db $00
-
-.list_energy ; 151e9 (5:51e9)
- ai_energy GRIMER, 3, +0
- ai_energy MUK, 4, +0
- ai_energy KOFFING, 2, +0
- ai_energy WEEZING, 3, +0
- ai_energy MEWTWO1, 2, -1
- ai_energy MEWTWO3, 2, -1
- ai_energy MEWTWO2, 2, -1
- ai_energy PORYGON, 2, -1
- db $00
-
-.list_prize ; 15202 (5:5202)
- db MUK
- db $00
-
-.store_list_pointers ; 15204 (5:5204)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x15232
+AIActionTable_WondersOfScience: ; 151ad (5:51ad)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 151b9 (5:51b9)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 151bd (5:51bd)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 151ce (5:51ce)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 151d2 (5:51d2)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 151d6 (5:51d6)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 151da (5:51da)
+ db MEWTWO1
+ db MEWTWO3
+ db MEWTWO2
+ db GRIMER
+ db KOFFING
+ db PORYGON
+ db $00
+
+.list_bench ; 151e1 (5:51e1)
+ db GRIMER
+ db KOFFING
+ db MEWTWO3
+ db MEWTWO2
+ db MEWTWO1
+ db PORYGON
+ db $00
+
+.list_retreat ; 151e8 (5:51e8)
+ db $00
+
+.list_energy ; 151e9 (5:51e9)
+ ai_energy GRIMER, 3, +0
+ ai_energy MUK, 4, +0
+ ai_energy KOFFING, 2, +0
+ ai_energy WEEZING, 3, +0
+ ai_energy MEWTWO1, 2, -1
+ ai_energy MEWTWO3, 2, -1
+ ai_energy MEWTWO2, 2, -1
+ ai_energy PORYGON, 2, -1
+ db $00
+
+.list_prize ; 15202 (5:5202)
+ db MUK
+ db $00
+
+.store_list_pointers ; 15204 (5:5204)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+; 0x15232
diff --git a/src/engine/deck_ai/decks/zapping_selfdestruct.asm b/src/engine/deck_ai/decks/zapping_selfdestruct.asm
index 6675c52..b924061 100644
--- a/src/engine/deck_ai/decks/zapping_selfdestruct.asm
+++ b/src/engine/deck_ai/decks/zapping_selfdestruct.asm
@@ -1,81 +1,76 @@
-AIActionTable_ZappingSelfdestruct: ; 15019 (5:5019)
- dw .do_turn ; unused
- dw .do_turn
- dw .start_duel
- dw .forced_switch
- dw .ko_switch
- dw .take_prize
-
-.do_turn ; 15025 (5:5025)
- call AIMainTurnLogic
- ret
-; 0x15029
-
-.start_duel ; 15029 (5:5029)
- call InitAIDuelVars
- call .store_list_pointers
- call SetUpBossStartingHandAndDeck
- call TrySetUpBossStartingPlayArea
- ret nc
- call AIPlayInitialBasicCards
- ret
-; 0x1503a
-
-.forced_switch ; 1503a (5:503a)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x1503e
-
-.ko_switch ; 1503e (5:503e)
- call AIDecideBenchPokemonToSwitchTo
- ret
-; 0x15042
-
-.take_prize ; 15042 (5:5042)
- call AIPickPrizeCards
- ret
-; 0x15046
-
-.list_arena ; 15046 (5:5046)
- db KANGASKHAN
- db ELECTABUZZ2
- db TAUROS
- db MAGNEMITE1
- db VOLTORB
- db $00
-
-.list_bench ; 1504c (5:504c)
- db MAGNEMITE1
- db VOLTORB
- db ELECTABUZZ2
- db TAUROS
- db KANGASKHAN
- db $00
-
-.list_retreat ; 15052 (5:5052)
- ai_retreat VOLTORB, -1
- db $00
-
-.list_energy ; 15055 (5:5055)
- ai_energy MAGNEMITE1, 3, +1
- ai_energy MAGNETON1, 4, +0
- ai_energy VOLTORB, 3, +1
- ai_energy ELECTRODE1, 3, +0
- ai_energy ELECTABUZZ2, 1, +0
- ai_energy KANGASKHAN, 2, -2
- ai_energy TAUROS, 3, +0
- db $00
-
-.list_prize ; 1506b (5:506b)
- db KANGASKHAN
- db $00
-
-.store_list_pointers ; 1506d (5:506d)
- store_list_pointer wAICardListAvoidPrize, .list_prize
- store_list_pointer wAICardListArenaPriority, .list_arena
- store_list_pointer wAICardListBenchPriority, .list_bench
- store_list_pointer wAICardListPlayFromHandPriority, .list_bench
- ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
- store_list_pointer wAICardListEnergyBonus, .list_energy
- ret
-; 0x1509b
+AIActionTable_ZappingSelfdestruct: ; 15019 (5:5019)
+ dw .do_turn ; unused
+ dw .do_turn
+ dw .start_duel
+ dw .forced_switch
+ dw .ko_switch
+ dw .take_prize
+
+.do_turn ; 15025 (5:5025)
+ call AIMainTurnLogic
+ ret
+
+.start_duel ; 15029 (5:5029)
+ call InitAIDuelVars
+ call .store_list_pointers
+ call SetUpBossStartingHandAndDeck
+ call TrySetUpBossStartingPlayArea
+ ret nc
+ call AIPlayInitialBasicCards
+ ret
+
+.forced_switch ; 1503a (5:503a)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.ko_switch ; 1503e (5:503e)
+ call AIDecideBenchPokemonToSwitchTo
+ ret
+
+.take_prize ; 15042 (5:5042)
+ call AIPickPrizeCards
+ ret
+
+.list_arena ; 15046 (5:5046)
+ db KANGASKHAN
+ db ELECTABUZZ2
+ db TAUROS
+ db MAGNEMITE1
+ db VOLTORB
+ db $00
+
+.list_bench ; 1504c (5:504c)
+ db MAGNEMITE1
+ db VOLTORB
+ db ELECTABUZZ2
+ db TAUROS
+ db KANGASKHAN
+ db $00
+
+.list_retreat ; 15052 (5:5052)
+ ai_retreat VOLTORB, -1
+ db $00
+
+.list_energy ; 15055 (5:5055)
+ ai_energy MAGNEMITE1, 3, +1
+ ai_energy MAGNETON1, 4, +0
+ ai_energy VOLTORB, 3, +1
+ ai_energy ELECTRODE1, 3, +0
+ ai_energy ELECTABUZZ2, 1, +0
+ ai_energy KANGASKHAN, 2, -2
+ ai_energy TAUROS, 3, +0
+ db $00
+
+.list_prize ; 1506b (5:506b)
+ db KANGASKHAN
+ db $00
+
+.store_list_pointers ; 1506d (5:506d)
+ store_list_pointer wAICardListAvoidPrize, .list_prize
+ store_list_pointer wAICardListArenaPriority, .list_arena
+ store_list_pointer wAICardListBenchPriority, .list_bench
+ store_list_pointer wAICardListPlayFromHandPriority, .list_bench
+ ; missing store_list_pointer wAICardListRetreatBonus, .list_retreat
+ store_list_pointer wAICardListEnergyBonus, .list_energy
+ ret
+; 0x1509b
diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm
index dae33a0..4ed3dbe 100644
--- a/src/engine/effect_functions.asm
+++ b/src/engine/effect_functions.asm
@@ -83,21 +83,17 @@ ApplyStatusEffect:
inc [hl]
scf
ret
-; 0x2c07e
TossCoin_BankB: ; 2c07e (b:407e)
call TossCoin
ret
-; 0x2c082
TossCoinATimes_BankB: ; 2c082 (b:4082)
call TossCoinATimes
ret
-; 0x2c086
CommentedOut_2c086: ; 2c086 (b:4086)
ret
-; 0x2c087
Func_2c087: ; 2c087 (b:4087)
xor a
@@ -116,19 +112,16 @@ Func_2c08c:
call SerialSend8Bytes
call TossCoinATimes
ret
-; 0x2c09c
SetNoEffectFromStatus: ; 2c09c (b:409c)
ld a, EFFECT_FAILED_NO_EFFECT
ld [wEffectFailed], a
ret
-; 0x2c0a2
SetWasUnsuccessful: ; 2c0a2 (b:40a2)
ld a, EFFECT_FAILED_UNSUCCESSFUL
ld [wEffectFailed], a
ret
-; 0x2c0a8
Func_2c0a8: ; 2c0a8 (b:40a8)
ldh a, [hTemp_ffa0]
@@ -143,14 +136,12 @@ Func_2c0a8: ; 2c0a8 (b:40a8)
ldh [hTemp_ffa0], a
ld a, c
ret
-; 0x2c0bd
Func_2c0bd: ; 2c0bd (b:40bd)
call ExchangeRNG
bank1call Func_4f2d
call ShuffleDeck
ret
-; 0x2c0c7
Func_2c0c7: ; 2c0c7 (b:40c7)
ld a, DUELVARS_DUELIST_TYPE
@@ -162,16 +153,15 @@ Func_2c0c7: ; 2c0c7 (b:40c7)
.player
scf
ret
-; 0x2c0d4
; Sets some flags for AI use
; if target poisoned
-; [wAIMinDamage] <- [wDamage]
-; [wAIMaxDamage] <- [wDamage]
+; [wAIMinDamage] <- [wDamage]
+; [wAIMaxDamage] <- [wDamage]
; else
-; [wAIMinDamage] <- [wDamage] + d
-; [wAIMaxDamage] <- [wDamage] + e
-; [wDamage] <- [wDamage] + a
+; [wAIMinDamage] <- [wDamage] + d
+; [wAIMaxDamage] <- [wDamage] + e
+; [wDamage] <- [wDamage] + a
Func_2c0d4: ; 2c0d4 (b:40d4)
push af
ld a, DUELVARS_ARENA_CARD_STATUS
@@ -199,7 +189,6 @@ Func_2c0e9: ; 2c0e9 (b:40e9)
add [hl]
ld [hl], a
ret
-; 0x2c0fb
; Sets some flags for AI use
; [wDamage] <- a
@@ -214,7 +203,6 @@ Func_2c0fb: ; 2c0fb (b:40fb)
ld a, e
ld [wAIMaxDamage], a
ret
-; 0x2c10b
Func_2c10b: ; 2c10b (b:410b)
ldh [hTempPlayAreaLocation_ff9d], a
@@ -222,7 +210,6 @@ Func_2c10b: ; 2c10b (b:410b)
bank1call PrintPlayAreaCardList_EnableLCD
bank1call Func_6194
ret
-; 0x2c117
; deal damage to all the turn holder's benched Pokemon
; input: a = amount of damage to deal to each Pokemon
@@ -243,7 +230,6 @@ DealDamageToAllBenchedPokemon: ; 2c117 (b:4117)
dec c
jr nz, .loop
ret
-; 0x2c12e
Func_2c12e: ; 2c12e (b:412e)
ld [wLoadedMoveAnimation], a
@@ -255,7 +241,6 @@ Func_2c12e: ; 2c12e (b:412e)
bank1call PlayMoveAnimation
bank1call WaitMoveAnimation
ret
-; 0x2c140
; apply a status condition of type 1 identified by register a to the target
ApplySubstatus1ToDefendingCard: ; 2c140 (b:4140)
@@ -265,7 +250,6 @@ ApplySubstatus1ToDefendingCard: ; 2c140 (b:4140)
pop af
ld [hli], a
ret
-; 0x2c149
; apply a status condition of type 2 identified by register a to the target,
; unless prevented by wNoDamageOrEffect
@@ -290,7 +274,6 @@ ApplySubstatus2ToDefendingCard: ; 2c149 (b:4149)
or h
call nz, DrawWideTextBox_PrintText
ret
-; 0x2c166
; overwrites in wDamage, wAIMinDamage and wAIMaxDamage
; with the value in a.
@@ -336,7 +319,6 @@ HandleSwitchDefendingPokemonEffect: ; 2c1ec (b:41ec)
inc a
ld [wccef], a
ret
-; 0x2c216
; returns carry if Defending has No Damage or Effect
; if so, print its appropriate text.
@@ -483,7 +465,6 @@ SpitPoison_AIEffect: ; 2c6f0 (b:46f0)
ld a, 5
lb de, 0, 10
jp Func_2c0fb
-; 0x2c6f8
; If heads, defending Pokemon becomes poisoned
SpitPoison_Poison50PercentEffect: ; 2c6f8 (b:46f8)
@@ -494,7 +475,6 @@ SpitPoison_Poison50PercentEffect: ; 2c6f8 (b:46f8)
ld [wLoadedMoveAnimation], a
call SetNoEffectFromStatus
ret
-; 0x2c70a
; outputs in hTemp_ffa0 the result of the coin toss
; (0 = tails, 1 = heads) and, in case it was heads,
@@ -522,7 +502,6 @@ TerrorStrike_50PercentSelectSwitchPokemon: ; 2c70a (b:470a)
ldh a, [hTempPlayAreaLocation_ff9d]
ldh [hTempPlayAreaLocation_ffa1], a
ret
-; 0x2c726
; if coin toss was heads and it's possible,
; switch Defending Pokemon
@@ -533,13 +512,11 @@ TerrorStrike_SwitchDefendingPokemon: ; 2c726 (b:4726)
ldh a, [hTempPlayAreaLocation_ffa1]
call HandleSwitchDefendingPokemonEffect
ret
-; 0x2c730
PoisonFang_AIEffect: ; 2c730 (b:4730)
ld a, 10
lb de, 10, 10
jp Func_2c0d4
-; 0x2c738
WeepinbellPoisonPowder_AIEffect: ; 2c738 (b:4738)
ld a, 5
@@ -557,13 +534,11 @@ AcidEffect: ; 2c77e (b:477e)
ld a, SUBSTATUS2_UNABLE_RETREAT
call ApplySubstatus2ToDefendingCard
ret
-; 0x2c78b
GloomPoisonPowder_AIEffect: ; 2c78b (b:478b)
ld a, 10
lb de, 10, 10
jp Func_2c0d4
-; 0x2c793
; Defending Pokemon and user become confused
FoulOdorEffect: ; 2c793 (b:4793)
@@ -572,7 +547,6 @@ FoulOdorEffect: ; 2c793 (b:4793)
call ConfusionEffect
call SwapTurn
ret
-; 0x2c7a0
; If heads, prevent all damage done to user next turn
KakunaStiffenEffect: ; 2c7a0 (b:47a0)
@@ -584,7 +558,6 @@ KakunaStiffenEffect: ; 2c7a0 (b:47a0)
ld a, SUBSTATUS1_NO_DAMAGE_STIFFEN
call ApplySubstatus1ToDefendingCard
ret
-; 0x2c7b4
KakunaPoisonPowder_AIEffect: ; 2c7b4 (b:47b4)
ld a, 5
@@ -602,7 +575,6 @@ SwordsDanceEffect: ; 2c7d0 (b:47d0)
ld a, SUBSTATUS1_NEXT_TURN_DOUBLE_DAMAGE
call ApplySubstatus1ToDefendingCard
ret
-; 0x2c7dc
; If heads, defending Pokemon becomes confused
ZubatSupersonicEffect: ; 2c7dc (b:47dc)
@@ -617,7 +589,6 @@ Twineedle_AIEffect: ; 2c7ed (b:47ed)
ld a, 30
lb de, 0, 60
jp Func_2c0fb
-; 0x2c7f5
; Flip 2 coins; deal 30x number of heads
Twineedle_MultiplierEffect: ; 2c7f5 (b:47f5)
@@ -640,7 +611,6 @@ FoulGas_AIEffect: ; 2c822 (b:4822)
ld a, 5
lb de, 0, 10
jp Func_2c0e9
-; 0x2c82a
; If heads, defending Pokemon becomes poisoned. If tails, defending Pokemon becomes confused
FoulGas_PoisonOrConfusionEffect: ; 2c82a (b:482a)
@@ -648,7 +618,6 @@ FoulGas_PoisonOrConfusionEffect: ; 2c82a (b:482a)
call TossCoin_BankB
jp c, PoisonEffect
jp ConfusionEffect
-; 0x2c836
; an exact copy of KakunaStiffenEffect
; If heads, prevent all damage done to user next turn
@@ -682,7 +651,6 @@ BigEggsplosion_AIEffect: ; 2c925 (b:4925)
xor a
ld [wAIMinDamage], a
ret
-; 0x2c944
; Flip coins equal to attached energies; deal 20x number of heads
BigEggsplosion_MultiplierEffect: ; 2c944 (b:4944)
@@ -711,13 +679,11 @@ SetDamageToATimes20: ; 2c958 (b:4958)
ld a, h
ld [wDamage + 1], a
ret
-; 0x2c96b
Thrash_AIEffect: ; 2c96b (b:496b)
ld a, 35
lb de, 30, 40
jp Func_2c0fb
-; 0x2c973
; If heads 10 more damage; if tails, 10 damage to itself
Thrash_ModifierEffect: ; 2c973 (b:4973)
@@ -728,7 +694,6 @@ Thrash_ModifierEffect: ; 2c973 (b:4973)
ld a, 10
call AddToDamage
ret
-; 0x2c982
Func_2c982: ; 2c982 (b:4982)
ldh a, [hTemp_ffa0]
@@ -737,13 +702,11 @@ Func_2c982: ; 2c982 (b:4982)
ld a, 10
call Func_1955
ret
-; 0x2c98c
Toxic_AIEffect: ; 2c98c (b:498c)
ld a, 20
lb de, 20, 20
jp Func_2c0e9
-; 0x2c994
; Defending Pokémon becomes poisoned, but takes 20 damage (double poisoned)
Toxic_DoublePoisonEffect: ; 2c994 (b:4994)
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 78e0bf1..ff887fd 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -414,10 +414,10 @@ SetupPalettes: ; 036a (0:036a)
ret
InitialPalette: ; 0399 (0:0399)
- rgb 28,28,24
- rgb 21,21,16
- rgb 10,10,08
- rgb 00,00,00
+ rgb 28, 28, 24
+ rgb 21, 21, 16
+ rgb 10, 10, 08
+ rgb 00, 00, 00
; clear VRAM tile data ([wTileMapFill] should be an empty tile)
SetupVRAM: ; 03a1 (0:03a1)
@@ -861,7 +861,6 @@ CallIndirect: ; 05b6 (0:05b6)
CallHL: ; 05c1 (0:05c1)
jp hl
-; 0x5c2
; converts the two-digit BCD number provided in a to text (ascii) format,
; writes them to [wStringBuffer] and [wStringBuffer + 1], and to the BGMap0 address at bc
@@ -882,7 +881,6 @@ WriteTwoDigitBCDNumber: ; 05c2 (0:05c2)
pop bc
pop hl
ret
-; 0x5db
; converts the one-digit BCD number provided in the lower nybble of a to text
; (ascii) format, and writes it to [wStringBuffer] and to the BGMap0 address at bc
@@ -903,7 +901,6 @@ WriteOneDigitBCDNumber: ; 05db (0:05db)
pop bc
pop hl
ret
-; 0x5f4
; converts the four-digit BCD number provided in h and l to text (ascii) format,
; writes them to [wStringBuffer] through [wStringBuffer + 3], and to the BGMap0 address at bc
@@ -929,7 +926,6 @@ WriteFourDigitBCDNumber: ; 05f4 (0:05f4)
pop bc
pop hl
ret
-; 0x614
; given two BCD digits in the two nybbles of register a,
; write them in text (ascii) format to hl (most significant nybble first).
@@ -952,7 +948,6 @@ WriteBCDDigitInTextFormat:
.write_num
ld [hli], a
ret
-; 0x627
; converts the one-byte number at a to text (ascii) format,
; and writes it to [wStringBuffer] and the BGMap0 address at bc
@@ -978,7 +973,6 @@ WriteOneByteNumber: ; 0627 (0:0627)
pop hl
pop bc
ret
-; 0x650
; converts the two-byte number at hl to text (ascii) format,
; and writes it to [wStringBuffer] and the BGMap0 address at bc
@@ -993,7 +987,6 @@ WriteTwoByteNumber: ; 0650 (0:0650)
call JPHblankCopyDataHLtoDE
pop bc
ret
-; 0x663
; convert the number at hl to text (ascii) format and write it to de
TwoByteNumberToText: ; 0663 (0:0663)
@@ -1027,7 +1020,6 @@ TwoByteNumberToText: ; 0663 (0:0663)
sbc b
ld h, a
ret
-; 0x695
; reads structs:
; x (1 byte), y (1 byte), data (n bytes), $00
@@ -1040,7 +1032,6 @@ WriteDataBlocksToBGMap0: ; 0695 (0:0695)
bit 7, [hl] ; check for $ff
jr z, WriteDataBlocksToBGMap0
ret
-; 0x69d
; reads struct:
; x (1 byte), y (1 byte), data (n bytes), $00
@@ -1079,7 +1070,6 @@ WriteDataBlockToBGMap0: ; 069d (0:069d)
ld b, 0
add hl, bc ; point to next structure
ret
-; 0x6c3
; writes a to [v*BGMap0 + BG_MAP_WIDTH * c + b]
WriteByteToBGMap0: ; 06c3 (0:06c3)
@@ -1119,7 +1109,6 @@ HblankWriteByteToBGMap0: ; 06d9
pop de
pop hl
ret
-; 0x6ee
; copy a bytes of data from hl to vBGMap0 address pointed to by coord at bc
CopyDataToBGMap0: ; 06ee (0:06ee)
@@ -1133,7 +1122,6 @@ CopyDataToBGMap0: ; 06ee (0:06ee)
call SafeCopyDataHLtoDE
pop bc
ret
-; 0x6fc
; copy b bytes of data from hl to de
; if LCD on, copy during h-blank only
@@ -1150,7 +1138,6 @@ SafeCopyDataHLtoDE: ; 6fc (0:6fc)
ret
JPHblankCopyDataHLtoDE: ; 0709 (0:0709)
jp HblankCopyDataHLtoDE
-; 0x70c
; copy c bytes of data from hl to de, b times.
; used to copy gfx data with c = TILE_SIZE
@@ -1247,7 +1234,6 @@ BankpushROM: ; 0745 (0:0745)
call BankswitchROM
pop bc
ret
-; 0x76f
; switch to rombank a,
; return old rombank id on top-of-stack
@@ -1277,7 +1263,6 @@ BankpushROM2: ; 076f (0:076f)
call BankswitchROM
pop bc
ret
-; 0x78e
; restore rombank from top-of-stack
BankpopROM: ; 078e (0:078e)
@@ -1355,7 +1340,6 @@ BankswitchVRAM: ; 07d6 (0:07d6)
ldh [hBankVRAM], a
ld [rVBK], a
ret
-; 0x7db
; switch to CGB Normal Speed Mode if playing on CGB and current mode is Double Speed Mode
SwitchToCGBNormalSpeed: ; 7db (0:7db)
@@ -1488,7 +1472,6 @@ HtimesL: ; 0879 (0:0879)
jr nz, .asm_883
pop de
ret
-; 0x88f
; return a random number between 0 and a (exclusive) in a
Random: ; 088f (0:088f)
@@ -1500,7 +1483,6 @@ Random: ; 088f (0:088f)
ld a, h
pop hl
ret
-; 0x89b
; get the next random numbers of the wRNG1 and wRNG2 sequences
UpdateRNGSources: ; 089b (0:089b)
@@ -1657,7 +1639,6 @@ Func_08ef: ; 08ef (0:08ef)
inc hl
ld a, [hli]
jr .asm_93c
-; 0x950
; set attributes for [hl] sprites starting from wOAM + [wOAMOffset] / 4
; return carry if reached end of wOAM before finishing
@@ -1701,7 +1682,6 @@ SetManyObjectsAttributes: ; 950 (0:950)
pop hl
scf
jr .done
-; 0x97f
; for the sprite at wOAM + [wOAMOffset] / 4, set its attributes from registers e, d, c, b
; return carry if [wOAMOffset] > 40 * 4 (beyond the end of wOAM)
@@ -1729,7 +1709,6 @@ SetOneObjectAttributes: ; 097f (0:097f)
pop hl
scf
ret
-; 0x99c
; set the Y Position and X Position of all sprites in wOAM to $00
ZeroObjectPositions: ; 099c (0:099c)
@@ -1791,7 +1770,6 @@ Bank1Call_FarCall_Common: ; 09ce (0:09ce)
pop de
pop hl
ret
-; 0x9dc
; switch to the ROM bank at sp+4
SwitchToBankAtSP: ; 9dc (0:9dc)
@@ -1805,7 +1783,6 @@ SwitchToBankAtSP: ; 9dc (0:9dc)
inc sp
inc sp
ret
-; 0x9e9
; RST28
; this function affects the stack so that it returns
@@ -2097,7 +2074,6 @@ Func_0bcb: ; 0bcb (0:0bcb)
call SendSGB
ei
ret
-; 0xc08
; loops 63000 * bc cycles (~15 * bc ms)
Wait: ; 0c08 (0:0c08)
@@ -2159,7 +2135,6 @@ HblankCopyDataDEtoHL: ; 0c32 (0:0c32)
jr nz, .loop
pop bc
ret
-; 0xc4b
; returns a *= 10
ATimes10: ; 0c4b (0:0c4b)
@@ -2171,7 +2146,6 @@ ATimes10: ; 0c4b (0:0c4b)
add a
pop de
ret
-; 0xc53
; returns hl *= 10
HLTimes10: ; 0c53 (0:0c53)
@@ -2186,7 +2160,6 @@ HLTimes10: ; 0c53 (0:0c53)
add hl, hl
pop de
ret
-; 0xc5f
; returns a /= 10
; returns carry if a % 10 >= 5
@@ -2201,7 +2174,6 @@ ADividedBy10: ; 0c5f (0:0c5f)
ld a, e
pop de
ret
-; 0xc6c
; Save a pointer to a list, given at de, to wListPointer
SetListPointer: ; 0c6c (0:0c6c)
@@ -2212,7 +2184,6 @@ SetListPointer: ; 0c6c (0:0c6c)
ld [hl], d
pop hl
ret
-; 0xc75
; Return the current element of the list at wListPointer,
; and advance the list to the next element
@@ -2234,7 +2205,6 @@ SetListToNextPosition: ; 0c7f (0:0c7f)
pop de
pop hl
ret
-; 0xc85
; Set the current element of the list at wListPointer to a,
; and advance the list to the next element
@@ -2248,7 +2218,6 @@ SetNextElementOfList: ; 0c85 (0:0c85)
ld [de], a
inc de
jr SetListToNextPosition
-; 0xc91
; called at roughly 240Hz by TimerHandler
SerialTimerHandler: ; 0c91 (0:0c91)
@@ -2286,7 +2255,6 @@ SerialTimerHandler: ; 0c91 (0:0c91)
.clear_timeout_counter
ld [hl], $0
ret
-; 0xcc5
Func_0cc5: ; 0cc5 (0:0cc5)
ld hl, wSerialRecvCounter
@@ -2346,7 +2314,6 @@ Func_0cc5: ; 0cc5 (0:0cc5)
ld [wSerialOp], a
scf
ret
-; 0xd26
SerialHandler: ; 0d26 (0:0d26)
push af
@@ -2679,7 +2646,6 @@ SerialSendBytes: ; 0ebf (0:0ebf)
pop bc
scf
ret
-; 0xed5
; receive bc bytes in wSerialRecvBuf and save them to hl
SerialRecvBytes: ; 0ed5 (0:0ed5)
@@ -2706,7 +2672,6 @@ SerialRecvBytes: ; 0ed5 (0:0ed5)
pop bc
scf
ret
-; 0xef1
Func_0ef1: ; 0ef1 (0:0ef1)
ld de, wcb79
@@ -2726,7 +2691,6 @@ Func_0ef1: ; 0ef1 (0:0ef1)
ld [de], a
or a
ret
-; 0xf05
Func_0f05: ; 0f05 (0:0f05)
push hl
@@ -2747,7 +2711,6 @@ Func_0f05: ; 0f05 (0:0f05)
push hl
scf
ret
-; 0xf1d
Func_0f1d: ; 0f1d (0:0f1d)
ld a, [wSerialFlags]
@@ -2765,7 +2728,6 @@ Func_0f1d: ; 0f1d (0:0f1d)
ld sp, hl
scf
ret
-; 0xf35
; load the number at wSerialFlags (error code?) to TxRam3, print
; TransmissionErrorText, exit the duel, and reset serial registers.
@@ -2834,7 +2796,6 @@ SetOppAction_SerialSendDuelData: ; 0f7f (0:0f7f)
pop bc
pop hl
ret
-; 0xf9b
; receive 10 bytes of data from wSerialRecvBuf and store them into hOppActionTableIndex,
; hTempCardIndex_ff9f, hTemp_ffa0, and hTempPlayAreaLocation_ffa1,
@@ -2849,7 +2810,6 @@ SerialRecvDuelData: ; 0f9b (0:0f9b)
pop bc
pop hl
ret
-; 0xfac
; serial send 8 bytes at f, a, l, h, e, d, c, b
; only during a duel against a link opponent
@@ -2902,7 +2862,6 @@ SerialSend8Bytes: ; 0fac (0:0fac)
pop hl
pop af
ret
-; 0xfe9
; serial recv 8 bytes to f, a, l, h, e, d, c, b
SerialRecv8Bytes: ; 0fe9 (0:0fe9)
@@ -2932,7 +2891,6 @@ SerialRecv8Bytes: ; 0fe9 (0:0fe9)
pop hl
pop af
ret
-; 0x100b
; save duel state to SRAM
; called between each two-player turn, just after player draws card (ROM bank 1 loaded)
@@ -3038,7 +2996,6 @@ CopyDeckData: ; 1072 (0:1072)
debug_ret
scf
ret
-; 0x10aa
; return, in register a, the amount of prizes that the turn holder has not yet drawn
CountPrizes: ; 10aa (0:10aa)
@@ -3055,7 +3012,6 @@ CountPrizes: ; 10aa (0:10aa)
jr nz, .count_loop
pop hl
ret
-; 0x10bc
; shuffles the turn holder's deck
; if less than 60 cards remain in the deck, it makes sure that the rest are ignored
@@ -3097,7 +3053,6 @@ DrawCardFromDeck: ; 10cf (0:10cf)
pop hl
scf
ret
-; 0x10e8
; add a card to the top of the turn holder's deck
; the card is identified by register a, which contains the deck index (0-59) of the card
@@ -3117,7 +3072,6 @@ ReturnCardToDeck: ; 10e8 (0:10e8)
ld a, l
pop hl
ret
-; 0x10fc
; search a card in the turn holder's deck, extract it, and set its location to
; CARD_LOCATION_JUST_DRAWN. AddCardToHand is meant to be called next.
@@ -3155,7 +3109,6 @@ SearchCardInDeckAndAddToHand: ; 10fc (0:10fc)
pop hl
pop af
ret
-; 0x1123
; adds a card to the turn holder's hand and increments the number of cards in the hand
; the card is identified by register a, which contains the deck index (0-59) of the card
@@ -3181,7 +3134,6 @@ AddCardToHand: ; 1123 (0:1123)
pop hl
pop af
ret
-; 0x1139
; removes a card from the turn holder's hand and decrements the number of cards in the hand
; the card is identified by register a, which contains the deck index (0-59) of the card
@@ -3220,7 +3172,6 @@ RemoveCardFromHand: ; 1139 (0:1139)
pop hl
pop af
ret
-; 0x1160
; moves a card to the turn holder's discard pile, as long as it is in the hand
; the card is identified by register a, which contains the deck index (0-59) of the card
@@ -3252,7 +3203,6 @@ PutCardInDiscardPile: ; 116a (0:116a)
pop hl
pop af
ret
-; 0x1182
; search a card in the turn holder's discard pile, extract it, and set its location to
; CARD_LOCATION_JUST_DRAWN. AddCardToHand is meant to be called next.
@@ -3288,7 +3238,6 @@ MoveDiscardPileCardToHand: ; 1182 (0:1182)
pop de
pop hl
ret
-; 0x11a5
; return in the z flag whether turn holder's prize a (0-7) has been drawn or not
; z: drawn, nz: not drawn
@@ -3308,7 +3257,6 @@ CheckPrizeTaken: ; 11a5 (0:11a5)
PowersOf2:
db $01, $02, $04, $08, $10, $20, $40, $80
-; 0x11bf
; fill wDuelTempList with the turn holder's discard pile cards (their 0-59 deck indexes)
; return carry if the turn holder has no cards in the discard pile
@@ -3338,7 +3286,6 @@ CreateDiscardPileCardList: ; 11bf (0:11bf)
ret nz
scf
ret
-; 0x11df
; fill wDuelTempList with the turn holder's remaining deck cards (their 0-59 deck indexes)
; return carry if the turn holder has no cards left in the deck
@@ -3374,7 +3321,6 @@ CreateDeckCardList: ; 11df (0:11df)
ld [wDuelTempList], a
scf
ret
-; 0x120a
; fill wDuelTempList with the turn holder's energy cards
; in the arena or in a bench slot (their 0-59 deck indexes).
@@ -3415,7 +3361,6 @@ CreateArenaOrBenchEnergyCardList: ; 120a (0:120a)
.no_energies_found
scf
ret
-; 0x123b
; fill wDuelTempList with the turn holder's hand cards (their 0-59 deck indexes)
; return carry if the turn holder has no cards in hand
@@ -3446,7 +3391,6 @@ CreateHandCardList: ; 123b (0:123b)
ret nz
scf
ret
-; 0x1258
; sort the turn holder's hand cards by ID (highest to lowest ID)
; makes use of wDuelTempList
@@ -3469,7 +3413,6 @@ SortHandCardsByID: ; 1258 (0:1258)
dec b
jr nz, .loop2
ret
-; 0x1271
; returns:
; b = turn holder's number of cards in hand (DUELVARS_NUMBER_OF_CARDS_IN_HAND)
@@ -3524,7 +3467,6 @@ ShuffleCards: ; 127f (0:127f)
pop de
pop hl
ret
-; 0x12a3
; sort a $ff-terminated list of deck index cards by ID (lowest to highest ID).
; the list is wDuelTempList.
@@ -3608,7 +3550,6 @@ SortCardsInListByID_CheckForListTerminator: ; 12ef (0:12ef)
bit 7, [hl] ; $ff is the list terminator
jr z, SortCardsInListByID
ret
-; 0x12fa
; returns, in register bc, the id of the card with the deck index specified in register a
; preserves hl
@@ -3619,7 +3560,6 @@ GetCardIDFromDeckIndex_bc: ; 12fa (0:12fa)
ld b, $0
pop hl
ret
-; 0x1303
; return [wDuelTempList + a] in a and in hTempCardIndex_ff98
GetCardInDuelTempList_OnlyDeckIndex: ; 1303 (0:1303)
@@ -3634,7 +3574,6 @@ GetCardInDuelTempList_OnlyDeckIndex: ; 1303 (0:1303)
pop de
pop hl
ret
-; 0x1312
; given the deck index (0-59) of a card in [wDuelTempList + a], return:
; - the id of the card with that deck index in register de
@@ -3651,7 +3590,6 @@ GetCardInDuelTempList: ; 1312 (0:1312)
pop hl
ldh a, [hTempCardIndex_ff98]
ret
-; 0x1324
; returns, in register de, the id of the card with the deck index (0-59) specified by register a
; preserves af and hl
@@ -3664,7 +3602,6 @@ GetCardIDFromDeckIndex: ; 1324 (0:1324)
pop hl
pop af
ret
-; 0x132f
; remove card c from wDuelTempList (it contains a $ff-terminated list of deck indexes)
RemoveCardFromDuelTempList: ; 132f (0:132f)
@@ -3698,7 +3635,6 @@ RemoveCardFromDuelTempList: ; 132f (0:132f)
pop de
pop hl
ret
-; 0x1351
; return the number of cards in wDuelTempList in a
CountCardsInDuelTempList: ; 1351 (0:1351)
@@ -3715,7 +3651,6 @@ CountCardsInDuelTempList: ; 1351 (0:1351)
pop bc
pop hl
ret
-; 0x1362
; returns, in register a, the id of the card with the deck index (0-59) specified in register a
_GetCardIDFromDeckIndex: ; 1362 (0:1362)
@@ -3766,7 +3701,6 @@ LoadCardDataToBuffer2_FromDeckIndex: ; 138c (0:138c)
pop de
pop hl
ret
-; 0x13a2
; evolve a turn holder's Pokemon card in the play area slot determined by hTempPlayAreaLocation_ff9d
; into another turn holder's Pokemon card identifier by it's deck index (0-59) in hTempCardIndex_ff98.
@@ -3826,7 +3760,6 @@ EvolvePokemonCard: ; 13a2 (0:13a2)
; never executed
scf
ret
-; 0x13f7
; check if the turn holder's Pokemon card at e can evolve into the turn holder's Pokemon card d.
; e is the play area location offset (PLAY_AREA_*) of the Pokemon trying to evolve.
@@ -3869,7 +3802,6 @@ CheckIfCanEvolveInto: ; 13f7 (0:13f7)
xor a
scf
ret
-; 0x142b
; check if the turn holder's Pokemon card at e can evolve this turn, and is a basic
; Pokemon card that whose second stage evolution is the turn holder's Pokemon card d.
@@ -3912,7 +3844,6 @@ CheckIfCanEvolveInto_BasicToStage2: ; 142b (0:142b)
xor a
scf
ret
-; 0x1461
; clear the status, all substatuses, and temporary duelvars of the turn holder's
; arena Pokemon. called when sending a new Pokemon into the arena.
@@ -3945,7 +3876,6 @@ ClearAllStatusConditions: ; 1461 (0:1461)
ld [hl], a
pop hl
ret
-; 0x1485
; Removes a Pokemon card from the hand and places it in the arena or first available bench slot.
; If the Pokemon is placed in the arena, the status conditions of the player's arena card are zeroed.
@@ -4006,7 +3936,6 @@ PutHandPokemonCardInPlayArea: ; 1485 (0:1485)
pop af
scf
ret
-; 0x14d2
; Removes a card from the hand and changes its location to arena or bench. Given that
; DUELVARS_ARENA_CARD or DUELVARS_BENCH aren't affected, this function is meant for energy and trainer cards.
@@ -4022,7 +3951,6 @@ PutHandCardInPlayArea: ; 14d2 (0:14d2)
or CARD_LOCATION_PLAY_AREA
ld [hl], a
ret
-; 0x14dd
; move the Pokemon card of the turn holder in the
; PLAY_AREA_* location given in e to the discard pile
@@ -4046,7 +3974,6 @@ MovePlayAreaCardToDiscardPile: ; 14dd (0:14dd)
cp DECK_SIZE
jr c, .next_card
ret
-; 0x14f8
; init a turn holder's play area slot to empty
; which slot (arena or benchx) is determined by the play area location offset (PLAY_AREA_*) in e
@@ -4071,7 +3998,6 @@ EmptyPlayAreaSlot: ; 14f8 (0:14f8)
ld l, a
ld [hl], d
ret
-; 0x151e
; shift play area Pokemon of both players to the first available play area (arena + benchx) slots
ShiftAllPokemonToFirstPlayAreaSlots: ; 151e (0:151e)
@@ -4080,7 +4006,6 @@ ShiftAllPokemonToFirstPlayAreaSlots: ; 151e (0:151e)
call ShiftTurnPokemonToFirstPlayAreaSlots
call SwapTurn
ret
-; 0x152b
; shift play area Pokemon of the turn holder to the first available play area (arena + benchx) slots
ShiftTurnPokemonToFirstPlayAreaSlots: ; 152b (0:152b)
@@ -4099,7 +4024,6 @@ ShiftTurnPokemonToFirstPlayAreaSlots: ; 152b (0:152b)
cp MAX_PLAY_AREA_POKEMON
jr nz, .next_play_area_slot
ret
-; 0x1543
; swap the data of the turn holder's arena Pokemon card with the
; data of the turn holder's Pokemon card in play area e.
@@ -4178,7 +4102,6 @@ SwapPlayAreaPokemon: ; 1548 (0:1548)
pop af
ld [hl], a
ret
-; 0x159f
; Find which and how many energy cards are attached to the turn holder's Pokemon card in the arena,
; or a Pokemon card in the bench, depending on the value of register e.
@@ -4248,7 +4171,6 @@ GetPlayAreaCardAttachedEnergies: ; 159f (0:159f)
pop de
pop hl
ret
-; 0x15ef
; returns in a how many times card e can be found in location b
; e = card id to search
@@ -4299,7 +4221,6 @@ GetNonTurnDuelistVariable: ; 1611 (0:1611)
.ok
ld a, [hl]
ret
-; 0x161e
; when playing a Pokemon card, initializes some variables according to the
; card played, and checks if the played card has Pokemon Power to show it to
@@ -4374,7 +4295,6 @@ Func_161e: ; 161e (0:161e)
ld a, EFFECTCMDTYPE_PKMN_POWER_TRIGGER
call TryExecuteEffectCommandFunction
ret
-; 0x16ad
; copies, given a card identified by register a (card ID):
; - e into wSelectedAttack and d into hTempCardIndex_ff9f
@@ -4714,7 +4634,6 @@ CheckSelfConfusionDamage: ; 18d7 (0:18d7)
.no_confusion_damage
or a
ret
-; 0x18f9
; play the trainer card with deck index at hTempCardIndex_ff98.
; a trainer card is like a move effect, with its own effect commands.
@@ -4756,7 +4675,6 @@ PlayTrainerCard: ; 18f9 (0:18f9)
.done
or a
ret
-; 0x1944
; loads the effect commands of a (trainer or energy) card with deck index (0-59) at hTempCardIndex_ff9f
; into wLoadedMoveEffectCommands. in practice, only used for trainer cards
@@ -4771,7 +4689,6 @@ LoadNonPokemonCardEffectCommands: ; 1944 (0:1944)
ld a, [hl]
ld [de], a
ret
-; 0x1955
Func_1955: ; 1955 (0:1955)
push af
@@ -5044,7 +4961,6 @@ PrintKnockedOut: ; 1ad3 (0:1ad3)
jr nz, .wait_frames
scf
ret
-; 0x1af3
; deal damage to turn holder's Pokemon card at play area location at b (PLAY_AREA_*).
; damage to deal is given in de.
@@ -5140,7 +5056,6 @@ DealDamageToPlayAreaPokemon: ; 1af3 (0:1af3)
pop de
pop hl
ret
-; 0x1b8d
; draw duel main scene, then print the "<Pokemon Lvxx>'s <attack>" text
; The Pokemon's name is the turn holder's arena Pokemon, and the
@@ -5217,7 +5132,6 @@ Func_1bca: ; 1bca (0:1bca)
call DrawWideTextBox_PrintText
scf
ret
-; 0x1c05
; return in a the retreat cost of the turn holder's arena or bench Pokemon
; given the PLAY_AREA_* value in hTempPlayAreaLocation_ff9d
@@ -5228,7 +5142,6 @@ GetPlayAreaCardRetreatCost: ; 1c05 (0:1c05)
call LoadCardDataToBuffer1_FromDeckIndex
call GetLoadedCard1RetreatCost
ret
-; 0x1c13
; move the turn holder's card with ID at de to the discard pile
; if it's currently in the arena.
@@ -5258,7 +5171,6 @@ MoveCardToDiscardPileIfInArena: ; 1c13 (0:1c13)
cp DECK_SIZE
jr c, .next_card
ret
-; 0x1c35
; calculate damage of card at CARD_LOCATION_* in e
; return the result in a
@@ -5280,7 +5192,6 @@ GetCardDamage: ; 1c35 (0:1c35)
pop de
pop hl
ret
-; 0x1c50
; check if a flag of wLoadedMove is set
; input:
@@ -5316,7 +5227,6 @@ CheckLoadedMoveFlag: ; 1c50 (0:1c50)
pop de
pop hl
ret
-; 0x1c72
; returns [hWhoseTurn] <-- ([hWhoseTurn] ^ $1)
; As a side effect, this also returns a duelist variable in a similar manner to
@@ -5559,7 +5469,6 @@ RemoveCardFromCollection: ; 1d91 (0:1d91)
call DisableSRAM
pop hl
ret
-; 0x1da4
; return the amount of different cards that the player has collected in d
; return NUM_CARDS in e, minus 1 if VENUSAUR1 or MEW2 has not been collected (minus 2 if neither)
@@ -5590,7 +5499,6 @@ GetCardAlbumProgress: ; 1da4 (0:1da4)
call DisableSRAM
pop hl
ret
-; 0x1dca
; copy c bytes of data from de to hl
; if LCD on, copy during h-blank only
@@ -5974,7 +5882,6 @@ FillRectangle: ; 1f5f (0:1f5f)
add sp, $24
pop de
ret
-; 0x1f96
Func_1f96: ; 1f96 (0:1f96)
add sp, -10
@@ -6108,7 +6015,6 @@ Func_1f96: ; 1f96 (0:1f96)
add sp, 10
scf
ret
-; 0x2046
Func_2046: ; 2046 (0:2046)
ld hl, sp+3
@@ -6140,7 +6046,6 @@ Func_2057: ; 2057 (0:2057)
ld a, e
call HblankWriteByteToBGMap0
ret
-; 0x2066
; loads the four tiles of the card set 2 icon constant provided in register a
; returns carry if the specified set does not have an icon
@@ -6174,7 +6079,6 @@ LoadDuelDrawCardsScreenTiles: ; 208d (0:208d)
ld de, v0Tiles1 + $74 tiles
ld b, $08
jp CopyFontsOrDuelGraphicsTiles
-; 0x2098
; loads the 8 tiles that make up the border of the main duel menu as well as the border
; of a large card picture (displayed after drawing the card or placing it in the arena).
@@ -6183,7 +6087,6 @@ LoadCardOrDuelMenuBorderTiles: ; 2098 (0:2098)
ld de, v0Tiles1 + $50 tiles
ld b, $08
jr CopyFontsOrDuelGraphicsTiles
-; 0x20a2
; loads the graphics of a card type header, used to display a picture of a card after drawing it
; or placing it in the arena. register e determines which header (TRAINER, ENERGY, PoKéMoN)
@@ -6195,7 +6098,6 @@ LoadCardTypeHeaderTiles: ; 20a2 (0:20a2)
ld de, v0Tiles1 + $60 tiles
ld b, $10
jr CopyFontsOrDuelGraphicsTiles
-; 0x20b0
; loads the symbols that are displayed near the names of a list of cards in the hand or discard pile
LoadDuelCardSymbolTiles: ; 20b0 (0:20b0)
@@ -6286,7 +6188,6 @@ CopyFontsOrDuelGraphicsTiles: ; 2121 (0:2121)
call CopyGfxData
call BankpopROM
ret
-; 0x212f
; this function copies gfx data into sram
Func_212f: ; 212f (0:212f)
@@ -6315,7 +6216,6 @@ Func_212f: ; 212f (0:212f)
ld de, $b100
ld b, $30
jr CopyFontsOrDuelGraphicsTiles
-; 0x2167
; load the graphics and draw the duel box message given a BOXMSC_* constant in a
DrawDuelBoxMessage: ; 2167 (0:2167)
@@ -6335,7 +6235,6 @@ DrawDuelBoxMessage: ; 2167 (0:2167)
lb bc, 10, 4
lb de, 5, 4
jp FillRectangle
-; 0x2189
; load the tiles for the latin, katakana, and hiragana fonts into VRAM
; from gfx/fonts/full_width/3.1bpp and gfx/fonts/full_width/4.t3.1bpp
@@ -6355,7 +6254,6 @@ LoadFullWidthFontTiles: ; 2189 (0:2189)
call Copy1bppTiles
call BankpopROM
ret
-; 0x21ab
; copy 128 1bpp tiles from de to hl as 2bpp
Copy1bppTiles: ; 21ab (0:21ab)
@@ -6372,7 +6270,6 @@ Copy1bppTiles: ; 21ab (0:21ab)
dec b
jr nz, .tile_loop
ret
-; 0x21ba
; similar to ProcessText except it calls InitTextPrinting first
; with the first two bytes of hl being used to set hTextBGMap0Address.
@@ -6843,7 +6740,6 @@ GetTextLengthInHalfTiles: ; 23d3 (0:23d3)
pop de
pop hl
ret
-; 0x23fd
; copy text of maximum length a (in tiles) from hl to de, then terminate
; the text with TX_END if it doesn't contain it already.
@@ -6926,7 +6822,6 @@ CopyTextData: ; 23fd (0:23fd)
pop bc
or a
ret
-; 0x245d
; convert the number at hl to TX_SYMBOL text format and write it to wStringBuffer
; replace leading zeros with SYM_SPACE
@@ -7185,7 +7080,6 @@ GetFullWidthFontTileOffset: ; 256d (0:256d)
add hl, hl
add hl, bc
ret
-; 0x2589
; pointers to VRAM?
Unknown_2589: ; 2589 (0:2589)
@@ -7238,7 +7132,6 @@ Unknown_2589: ; 2589 (0:2589)
dw $98fc
dw $9940
dw $ffff
-; 0x25ea
; initializes parameters for a card list (e.g. list of hand cards in a duel, or booster pack cards)
; input:
@@ -7276,7 +7169,6 @@ InitializeCardListParameters: ; 25ea (0:25ea)
ld a, 1
ld [wYDisplacementBetweenMenuItems], a
ret
-; 0x2626
; similar to HandleMenuInput, but conveniently returns parameters related to the
; state of the list in a, d, and e if A or B were pressed. also returns carry
@@ -7292,7 +7184,6 @@ HandleCardListInput: ; 2626 (0:2626)
ldh a, [hCurMenuItem]
scf
ret
-; 0x2636
; initializes parameters for a menu, given the 8 bytes starting at hl,
; which are loaded to the following addresses:
@@ -7544,7 +7435,6 @@ HandleDuelMenuInput: ; 271a (0:271a)
ld e, a
or a
ret
-; 0x278d
DuelMenuCursorCoords: ; 278d (0:278d)
db 2, 14 ; Hand
@@ -7645,7 +7535,6 @@ ReloadCardListItems:
jr nz, .next_card
.done
ret
-; 0x2827
; reload a list of cards, except don't print their names
Func_2827: ; 2827 (0:2827)
@@ -7655,7 +7544,6 @@ Func_2827: ; 2827 (0:2827)
xor a
ldh [hffb0], a
ret
-; 0x2832
; convert the number at a to TX_SYMBOL text format and write it to wDefaultText
; if the first digit is a 0, delete it and shift the number one tile to the left
@@ -7670,7 +7558,6 @@ OneByteNumberToTxSymbol_TrimLeadingZerosAndAlign: ; 2832 (0:2832)
ld [hl], SYM_SPACE
.not_zero
ret
-; 0x283f
; this function is always loaded to wMenuFunctionPointer by PrintCardListItems
; takes care of things like handling page scrolling and calling the function at wListFunctionPointer
@@ -7840,7 +7727,6 @@ CardListMenuFunction: ; 283f (0:283f)
ldh [hCurMenuItem], a
scf
ret
-; 0x296a
; convert the number at a to TX_SYMBOL text format and write it to wDefaultText
; replace leading zeros with SYM_SPACE
@@ -7851,7 +7737,6 @@ OneByteNumberToTxSymbol_TrimLeadingZeros: ; 296a (0:296a)
ret nz
ld [hl], SYM_SPACE
ret
-; 0x2974
; convert the number at a to TX_SYMBOL text format and write it to wDefaultText
OneByteNumberToTxSymbol: ; 2974 (0:2974)
@@ -7869,7 +7754,6 @@ OneByteNumberToTxSymbol: ; 2974 (0:2974)
ld [hl], SYM_SPACE
pop hl
ret
-; 0x2988
; translate the TYPE_* constant in wLoadedCard1Type to an index for CardSymbolTable
CardTypeToSymbolID: ; 2988 (0:2988)
@@ -7888,7 +7772,6 @@ CardTypeToSymbolID: ; 2988 (0:2988)
ld a, [wLoadedCard1Stage] ; different symbol for each evolution stage
add 8
ret
-; 0x299f
; return the entry in CardSymbolTable of the TYPE_* constant in wLoadedCard1Type
; also return the first byte of said entry (starting tile number) in a
@@ -7901,7 +7784,6 @@ GetCardSymbolData: ; 299f (0:299f)
add hl, bc
ld a, [hl]
ret
-; 0x29ac
; draw, at de, the 2x2 tile card symbol associated to the TYPE_* constant in wLoadedCard1Type
DrawCardSymbol: ; 29ac (0:29ac)
@@ -7934,7 +7816,6 @@ DrawCardSymbol: ; 29ac (0:29ac)
pop de
pop hl
ret
-; 0x29dd
CardSymbolTable:
; starting tile number, cgb palette (grey, yellow/red, green/blue, pink/orange)
@@ -7956,7 +7837,6 @@ CardSymbolTable:
CopyCardNameAndLevel: ; 29f5 (0:29f5)
farcall _CopyCardNameAndLevel
ret
-; 0x29fa
; sets cursor parameters for navigating in a text box, but using
; default values for the cursor tile (SYM_CURSOR_R) and the tile behind it (SYM_SPACE).
@@ -8004,14 +7884,12 @@ SetCursorParametersForTextBox: ; 2a1a (0:2a1a)
ld [hl], c ; wTileBehindCursor
ld [wCursorBlinkCounter], a
ret
-; 0x2a30
; draw a 20x6 text box aligned to the bottom of the screen,
; print the text at hl without letter delay, and wait for A or B pressed
DrawWideTextBox_PrintTextNoDelay_Wait: ; 2a30 (0:2a30)
call DrawWideTextBox_PrintTextNoDelay
jp WaitForWideTextBoxInput
-; 0x2a36
; draw a 20x6 text box aligned to the bottom of the screen
; and print the text at hl without letter delay
@@ -8134,7 +8012,6 @@ TwoItemHorizontalMenu: ; 2ad0 (0:2ad0)
ld [wCurMenuItem], a
call EnableLCD
jp HandleYesOrNoMenu.refresh_menu
-; 0x2aeb
YesOrNoMenuWithText_SetCursorToYes: ; 2aeb (0:2aeb)
ld a, $01
@@ -8225,13 +8102,11 @@ PrintYesOrNoItems: ; 2b66 (0:2b66)
ldtx hl, YesOrNoText
call InitTextPrinting_ProcessTextFromID
ret
-; 0x2b70
ContinueDuel: ; 2b70 (0:2b70)
ld a, BANK(_ContinueDuel)
call BankswitchROM
jp _ContinueDuel
-; 0x2b78
; loads opponent deck at wOpponentDeckID to wOpponentDeck, and initializes wPlayerDuelistType.
; on a duel against Sam, also loads PRACTICE_PLAYER_DECK to wPlayerDeck.
@@ -8400,7 +8275,6 @@ ProcessTextFromID: ; 2c29 (0:2c29)
pop af
call BankswitchROM
ret
-; 0x2c37
; return, in a, the number of lines of the text given in hl as an ID
; this is calculated by counting the amount of '\n' characters and adding 1 to the result
@@ -8436,7 +8310,6 @@ CountLinesOfTextFromID: ; 2c37 (0:2c37)
pop de
pop hl
ret
-; 0x2c62
; call PrintScrollableText with text box label, then wait for the
; player to press A or B to advance the printed text
@@ -8864,7 +8737,6 @@ CopyText: ; 2e89 (0:2e89)
cp OPPONENT_TURN
jp z, CopyOpponentName
jp CopyPlayerName
-; 0x2ea9
; copy text of maximum length a (in tiles) from its ID at hl to de,
; then terminate the text with TX_END if it doesn't contain it already.
@@ -8880,7 +8752,6 @@ CopyTextData_FromTextID: ; 2ea9 (0:2ea9)
pop af
call BankswitchROM
ret
-; 0x2ebb
; text id (usually of a card name) for TX_RAM2
LoadTxRam2: ; 2ebb (0:2ebb)
@@ -8897,7 +8768,6 @@ LoadTxRam3: ; 2ec4 (0:2ec4)
ld a, h
ld [wTxRam3 + 1], a
ret
-; 0x2ecd
; load data of card with text id of name at de to wLoadedCard1
LoadCardDataToBuffer1_FromName: ; 2ecd (0:2ecd)
@@ -8944,7 +8814,6 @@ LoadCardDataToBuffer1_FromName: ; 2ecd (0:2ecd)
.done
call BankpopROM
ret
-; 0x2f0a
; load data of card with id at e to wLoadedCard2
LoadCardDataToBuffer2_FromCardID: ; 2f0a (0:2f0a)
@@ -9721,7 +9590,6 @@ HandleDamageReductionExceptSubstatus2: ; 3269 (0:3269)
ld e, l
ld d, h
ret
-; 0x32f7
; check for Invisible Wall, Kabuto Armor, NShield, or Transparency, in order to
; possibly reduce or make zero the damage at de.
@@ -9743,7 +9611,6 @@ HandleDamageReductionOrNoDamageFromPkmnPowerEffects: ; 32f7 (0:32f7)
; if carry was set due to NShield or Transparency, damage is 0
ld de, 0
ret
-; 0x3317
; when MACHAMP is damaged, if its Strikes Back is active, the
; attacking Pokemon (turn holder's arena Pokemon) takes 10 damage.
@@ -9806,7 +9673,6 @@ HandleStrikesBack_AgainstDamagingMove: ; 3317 (0:3317)
pop de
pop hl
ret
-; 0x337f
; return carry if NShield or Transparency activate (if MEW1 or HAUNTER1 is
; the turn holder's arena Pokemon), and print their corresponding text if so
@@ -9848,7 +9714,6 @@ HandleNShieldAndTransparency: ; 337f (0:337f)
ld [wNoDamageOrEffect], a
ldtx hl, NoDamageOrEffectDueToTransparencyText
jr .print_text
-; 0x33c1
; return carry if the turn holder's arena Pokemon is under a condition that makes
; it unable to attack. also return in hl the text id to be displayed
@@ -10010,7 +9875,6 @@ HandleTransparency: ; 348a (0:348a)
ldtx hl, NoDamageOrEffectDueToTransparencyText
scf
ret
-; 0x34b7
; return carry and return the appropriate text id in hl if the target has an
; special status or power that prevents any damage or effect done to it this turn
@@ -10039,7 +9903,6 @@ CheckNoDamageOrEffect: ; 34b7 (0:34b7)
ld hl, $0000
scf
ret
-; 0x34d8
NoDamageOrEffectTextIDTable: ; 34d8 (0:34d8)
tx NoDamageOrEffectDueToAgilityText ; NO_DAMAGE_OR_EFFECT_AGILITY
@@ -10047,7 +9910,6 @@ NoDamageOrEffectTextIDTable: ; 34d8 (0:34d8)
tx NoDamageOrEffectDueToFlyText ; NO_DAMAGE_OR_EFFECT_FLY
tx NoDamageOrEffectDueToTransparencyText ; NO_DAMAGE_OR_EFFECT_TRANSPARENCY
tx NoDamageOrEffectDueToNShieldText ; NO_DAMAGE_OR_EFFECT_NSHIELD
-; 0x34e2
; return carry if turn holder has Omanyte and its Clairvoyance Pkmn Power is active
IsClairvoyanceActive: ; 34e2 (0:34e2)
@@ -10152,7 +10014,6 @@ CountPokemonIDInPlayArea: ; 3525 (0:3525)
pop de
pop hl
ret
-; 0x356a
; return, in a, the retreat cost of the card in wLoadedCard1,
; adjusting for any Dodrio's Retreat Aid Pkmn Power that is active.
@@ -10187,7 +10048,6 @@ GetLoadedCard1RetreatCost: ; 356a (0:356a)
ret nc
xor a
ret
-; 0x3597
; return carry if the turn holder's arena Pokemon is affected by Acid and can't retreat
CheckCantRetreatDueToAcid: ; 3597 (0:3597)
@@ -10203,7 +10063,6 @@ CheckCantRetreatDueToAcid: ; 3597 (0:3597)
ldtx hl, UnableToRetreatDueToAcidText
scf
ret
-; 0x35a9
; return carry if the turn holder is affected by Headache and trainer cards can't be used
CheckCantUseTrainerDueToHeadache: ; 35a9 (0:35a9)
@@ -10215,7 +10074,6 @@ CheckCantUseTrainerDueToHeadache: ; 35a9 (0:35a9)
ldtx hl, UnableToUseTrainerDueToHeadacheText
scf
ret
-; 0x35b7
; return carry if any duelist has Aerodactyl and its Prehistoric Power Pkmn Power is active
IsPrehistoricPowerActive: ; 35b7 (0:35b7)
@@ -10227,7 +10085,6 @@ IsPrehistoricPowerActive: ; 35b7 (0:35b7)
ldtx hl, UnableToEvolveDueToPrehistoricPowerText
ccf
ret
-; 0x35c7
; clears some SUBSTATUS2 conditions from the turn holder's active Pokemon.
; more specifically, those conditions that reduce the damage from an attack
@@ -10251,7 +10108,6 @@ ClearDamageReductionSubstatus2: ; 35c7 (0:35c7)
.zero
ld [hl], 0
ret
-; 0x35e6
; clears the SUBSTATUS1 and updates the double damage condition of the player about to start his turn
UpdateSubstatusConditions_StartOfTurn: ; 35e6 (0:35e6)
@@ -10284,7 +10140,6 @@ UpdateSubstatusConditions_EndOfTurn: ; 35fa (0:35fa)
ret z
res SUBSTATUS3_THIS_TURN_DOUBLE_DAMAGE, [hl]
ret
-; 0x3615
; return carry if turn holder has Blastoise and its Rain Dance Pkmn Power is active
IsRainDanceActive: ; 3615 (0:3615)
@@ -10295,7 +10150,6 @@ IsRainDanceActive: ; 3615 (0:3615)
call CountPokemonIDInBothPlayAreas
ccf
ret
-; 0x3622
; return carry if card at [hTempCardIndex_ff98] is a water energy card AND
; if card at [hTempPlayAreaLocation_ff9d] is a water Pokemon card.
@@ -10314,7 +10168,6 @@ CheckRainDanceScenario: ; 3622 (0:3622)
.done
or a
ret
-; 0x363b
; if the defending (non-turn) card's HP is 0 and the attacking (turn) card's HP
; is not, the attacking card faints if it was affected by destiny bond
@@ -10354,7 +10207,6 @@ HandleDestinyBondSubstatus: ; 363b (0:363b)
ldtx hl, KnockedOutDueToDestinyBondText
call DrawWideTextBox_WaitForInput
ret
-; 0x367b
; when MACHAMP is damaged, if its Strikes Back is active, the
; attacking Pokemon (turn holder's arena Pokemon) takes 10 damage.
@@ -10410,7 +10262,6 @@ ApplyStrikesBack_AgainstResidualMove: ; 36a2 (0:36a2)
call DrawDuelHUDs
scf
ret
-; 0x36d9
; if the id of the card provided in register a as a deck index is MUK,
; clear the changed type of all arena and bench Pokemon
@@ -10432,7 +10283,6 @@ ClearChangedTypesIfMuk: ; 36d9 (0:36d9)
dec c
jr nz, .zero_changed_types_loop
ret
-; 0x36f6
; return the turn holder's arena card's color in a, accounting for Venomoth's Shift Pokemon Power if active
GetArenaCardColor: ; 36f6 (0:36f6)
@@ -10473,7 +10323,6 @@ GetPlayAreaCardColor: ; 36f7 (0:36f7)
pop hl
and $f
ret
-; 0x3729
; return in a the weakness of the turn holder's arena or benchx Pokemon given the PLAY_AREA_* value in a
; if a == 0 and [DUELVARS_ARENA_CARD_CHANGED_WEAKNESS] != 0,
@@ -10499,7 +10348,6 @@ GetCardWeakness:
call LoadCardDataToBuffer2_FromDeckIndex
ld a, [wLoadedCard2Weakness]
ret
-; 0x3743
; return in a the resistance of the turn holder's arena or benchx Pokemon given the PLAY_AREA_* value in a
; if a == 0 and [DUELVARS_ARENA_CARD_CHANGED_RESISTANCE] != 0,
@@ -10525,7 +10373,6 @@ GetCardResistance:
call LoadCardDataToBuffer2_FromDeckIndex
ld a, [wLoadedCard2Resistance]
ret
-; 0x375d
; this function checks if turn holder's CHARIZARD energy burn is active, and if so, turns
; all energies at wAttachedEnergies except double colorless energies into fire energies
@@ -10549,7 +10396,6 @@ HandleEnergyBurn: ; 375d (0:375d)
ld a, [wTotalAttachedEnergies]
ld [wAttachedEnergies], a
ret
-; 0x377f
SetupSound: ; 377f (0:377f)
farcall _SetupSound
@@ -10584,7 +10430,6 @@ PauseSong: ; 379b (0:379b)
ResumeSong: ; 37a0 (0:37a0)
farcall _ResumeSong
ret
-; 0x37a5
Func_37a5: ; 37a5 (0:37a5)
ldh a, [hBankROM]
@@ -10606,7 +10451,6 @@ Func_37a5: ; 37a5 (0:37a5)
pop af
call BankswitchROM
ret
-; 0x37c5
Func_37c5: ; 37c5 (0:37c5)
ld c, $08
@@ -10666,7 +10510,6 @@ Func_37c5: ; 37c5 (0:37c5)
dec c
jr nz, .asm_37c7
ret
-; 0x380e
Func_380e: ; 380e (0:380e)
ld a, [wd0c1]
@@ -10829,7 +10672,6 @@ GetPermissionOfMapPosition: ; 3927 (0:3927)
ld a, [hl]
pop hl
ret
-; 0x392e
; set to a the permission byte corresponding to the current map's x,y coordinates at bc
SetPermissionOfMapPosition: ; 392e (0:392e)
@@ -10840,7 +10682,6 @@ SetPermissionOfMapPosition: ; 392e (0:392e)
ld [hl], a
pop hl
ret
-; 0x3937
; set the permission byte corresponding to the current map's x,y coordinates at bc
; to the value of register a anded by its current value
@@ -10858,7 +10699,6 @@ UpdatePermissionOfMapPosition: ; 3937 (0:3937)
pop bc
pop hl
ret
-; 0x3946
; returns in hl the address within wPermissionMap that corresponds to
; the current map's x,y coordinates at bc
@@ -10982,7 +10822,6 @@ FindLoadedNPC: ; 39c3 (0:39c3)
pop bc
pop hl
ret
-; 0x39ea
Func_39ea: ; 39ea (0:39ea)
push bc
@@ -10997,7 +10836,6 @@ Func_39ea: ; 39ea (0:39ea)
ld a, c
pop bc
ret
-; 0x39fc
Func_39fc: ; 39fc (0:39fc)
push hl
@@ -11048,17 +10886,14 @@ Func_3a3b: ; 3a3b (0:3a3b)
Func_3a40: ; 3a40 (0:3a40)
farcall Func_11430
ret
-; 0x3a45
Func_3a45: ; 3a45 (0:3a45)
farcall Func_11343
ret
-; 0x3a4a
Func_3a4a: ; 3a4a (0:3a4a)
farcall Func_115a3
ret
-; 0x3a4f
Func_3a4f: ; 3a4f (0:3a4f)
push af
@@ -11072,7 +10907,6 @@ Func_3a4f: ; 3a4f (0:3a4f)
pop bc
pop af
ret
-; 0x3a5e
HandleMoveModeAPress: ; 3a5e (0:3a5e)
ldh a, [hBankROM]
@@ -11167,12 +11001,10 @@ GetMapScriptPointer: ; 3abd (0:3abd)
ccf
pop bc
ret
-; 0x3ae8
Func_3ae8: ; 3ae8 (0:3ae8)
farcall Func_11f4e
ret
-; 0x3aed
; finds a Script from the first byte and puts the next two bytes (usually arguments?) into cb
RunOverworldScript: ; 3aed (0:3aed)
@@ -11201,7 +11033,6 @@ RunOverworldScript: ; 3aed (0:3aed)
call BankswitchROM
pop bc
jp hl
-; 0x3b11
Func_3b11: ; 3b11 (0:3b11)
ldh a, [hBankROM]
@@ -11212,7 +11043,6 @@ Func_3b11: ; 3b11 (0:3b11)
pop af
call BankswitchROM
ret
-; 0x3b21
Func_3b21: ; 3b21 (0:3b21)
ldh a, [hBankROM]
@@ -11294,7 +11124,6 @@ Func_3b6a: ; 3b6a (0:3b6a)
pop af
call BankswitchROM
ret
-; 0x3ba2
Func_3ba2: ; 3ba2 (0:3ba2)
ldh a, [hBankROM]
@@ -11306,7 +11135,6 @@ Func_3ba2: ; 3ba2 (0:3ba2)
pop af
call BankswitchROM
ret
-; 0x3bb5
Func_3bb5: ; 3bb5 (0:3bb5)
xor a
@@ -11322,7 +11150,6 @@ Func_3bb5: ; 3bb5 (0:3bb5)
ld a, $80
ld [wd4c0], a
ret
-; 0x3bd2
; writes from hl the pointer to the function to be called by DoFrame
SetDoFrameFunction: ; 3bd2 (0:3bd2)
@@ -11338,7 +11165,6 @@ ResetDoFrameFunction: ; 3bdb (0:3bdb)
call SetDoFrameFunction
pop hl
ret
-; 0x3be4
Func_3be4: ; 3be4 (0:3be4)
ldh a, [hBankROM]
@@ -11349,7 +11175,6 @@ Func_3be4: ; 3be4 (0:3be4)
pop af
call BankswitchROM
ret
-; 0x3bf5
; Copies bc bytes from [wTempPointer] to de
CopyBankedDataToDE: ; 3bf5 (0:3bf5)
@@ -11367,7 +11192,6 @@ CopyBankedDataToDE: ; 3bf5 (0:3bf5)
pop af
call BankswitchROM
ret
-; 0x3c10
; fill bc bytes of data at hl with a
FillMemoryWithA: ; 3c10 (0:3c10)
@@ -11386,7 +11210,6 @@ FillMemoryWithA: ; 3c10 (0:3c10)
pop de
pop hl
ret
-; 0x3c1f
; fill 2*bc bytes of data at hl with d,e
FillMemoryWithDE: ; 3c1f (0:3c1f)
@@ -11404,7 +11227,6 @@ FillMemoryWithDE: ; 3c1f (0:3c1f)
pop bc
pop hl
ret
-; 0x3c2d
Func_3c2d: ; 3c2d (0:3c2d)
push hl
@@ -11424,15 +11246,12 @@ Func_3c2d: ; 3c2d (0:3c2d)
pop af
pop hl
ret
-; 0x3c45
CallHL2: ; 3c45 (0:3c45)
jp hl
-; 0x3c46
CallBC: ; 3c46 (0:3c46)
retbc
-; 0x3c48
DoFrameIfLCDEnabled: ; 3c48 (0:3c48)
push af
@@ -11485,7 +11304,6 @@ DivideBCbyDE: ; 3c5a (0:3c5a)
CallPlaySong: ; 3c83 (0:3c83)
call PlaySong
ret
-; 0x3c87
Func_3c87: ; 3c87 (0:3c87)
push af
@@ -11495,7 +11313,6 @@ Func_3c87: ; 3c87 (0:3c87)
call WaitForSongToFinish
call ResumeSong
ret
-; 0x3c96
WaitForSongToFinish: ; 3c96 (0:3c96)
call DoFrameIfLCDEnabled
@@ -11522,141 +11339,144 @@ Func_3ca4: ; 3ca4 (0:3ca4)
Func_3cb4: ; 3cb4 (0:3cb4)
ldh a, [hBankROM]
push af
- ld a, BANK(Func_12a21)
+ ld a, BANK(HandleAllSpriteAnimations)
call BankswitchROM
- call Func_12a21
+ call HandleAllSpriteAnimations
pop af
call BankswitchROM
ret
-; 0x3cc4
-; refresh sprites?
-Func_3cc4: ; 3cc4 (0:3cc4)
+; hl - pointer to animation frame
+; wd5d6 - bank of animation frame
+DrawSpriteAnimationFrame: ; 3cc4 (0:3cc4)
ldh a, [hBankROM]
push af
ld a, [wd5d6]
call BankswitchROM
- ld a, [wd5d1]
+ ld a, [wCurrSpriteXPos]
cp $f0
- ld a, $00
- jr c, .asm_3cd7
+ ld a, 0
+ jr c, .notNearRight
dec a
-.asm_3cd7
- ld [wd5d4], a
- ld a, [wd5d2]
+.notNearRight
+ ld [wCurrSpriteRightEdgeCheck], a
+ ld a, [wCurrSpriteYPos]
cp $f0
- ld a, $00
- jr c, .asm_3ce4
+ ld a, 0
+ jr c, .setBottomEdgeCheck
dec a
-.asm_3ce4
- ld [wd5d5], a
+.setBottomEdgeCheck
+ ld [wCurrSpriteBottomEdgeCheck], a
ld a, [hli]
or a
jp z, .done
ld c, a
-.asm_3ced
+.loop
push bc
push hl
- ld b, $00
+ ld b, 0
bit 7, [hl]
- jr z, .asm_3cf6
+ jr z, .beginY
dec b
-.asm_3cf6
- ld a, [wd5d0]
- bit 6, a
- jr z, .asm_3d10
+.beginY
+ ld a, [wCurrSpriteAttributes]
+ bit OAM_Y_FLIP, a
+ jr z, .unflippedY
ld a, [hl]
- add $08
+ add 8 ; size of a tile
ld c, a
- ld a, $00
+ ld a, 0
adc b
ld b, a
- ld a, [wd5d2]
+ ld a, [wCurrSpriteYPos]
sub c
ld e, a
- ld a, [wd5d5]
+ ld a, [wCurrSpriteBottomEdgeCheck]
sbc b
- jr .asm_3d19
-.asm_3d10
- ld a, [wd5d2]
+ jr .finishYPosition
+.unflippedY
+ ld a, [wCurrSpriteYPos]
add [hl]
ld e, a
- ld a, [wd5d5]
+ ld a, [wCurrSpriteBottomEdgeCheck]
adc b
-.asm_3d19
+.finishYPosition
or a
- jr nz, .asm_3d64
+ jr nz, .endCurrentIteration
inc hl
- ld b, $00
+ ld b, 0
bit 7, [hl]
- jr z, .asm_3d24
+ jr z, .beginX
dec b
-.asm_3d24
- ld a, [wd5d0]
- bit 5, a
- jr z, .asm_3d3e
+.beginX
+ ld a, [wCurrSpriteAttributes]
+ bit OAM_X_FLIP, a
+ jr z, .unflippedX
ld a, [hl]
- add $08
+ add 8 ; size of a tile
ld c, a
- ld a, $00
+ ld a, 0
adc b
ld b, a
- ld a, [wd5d1]
+ ld a, [wCurrSpriteXPos]
sub c
ld d, a
- ld a, [wd5d4]
+ ld a, [wCurrSpriteRightEdgeCheck]
sbc b
- jr .asm_3d47
-.asm_3d3e
- ld a, [wd5d1]
+ jr .finishXPosition
+.unflippedX
+ ld a, [wCurrSpriteXPos]
add [hl]
ld d, a
- ld a, [wd5d4]
+ ld a, [wCurrSpriteRightEdgeCheck]
adc b
-.asm_3d47
+.finishXPosition
or a
- jr nz, .asm_3d64
+ jr nz, .endCurrentIteration
inc hl
- ld a, [wd5d3]
+ ld a, [wCurrSpriteTileID]
add [hl]
ld c, a
inc hl
- ld a, [wd5d0]
+ ld a, [wCurrSpriteAttributes]
add [hl]
- and $17
+ and OAM_PALETTE | (1 << OAM_OBP_NUM)
ld b, a
- ld a, [wd5d0]
+ ld a, [wCurrSpriteAttributes]
xor [hl]
- and $e0
+ and (1 << OAM_X_FLIP) | (1 << OAM_Y_FLIP) | (1 << OAM_PRIORITY)
or b
ld b, a
inc hl
call SetOneObjectAttributes
-.asm_3d64
+.endCurrentIteration
pop hl
- ld bc, $4
+ ld bc, 4 ; size of info for one sub tile
add hl, bc
pop bc
dec c
- jr nz, .asm_3ced
+ jr nz, .loop
.done
pop af
call BankswitchROM
ret
-; 0x3d72
-Func_3d72: ; 3d72 (0:3d72)
+; Loads a pointer to the current animation frame into SPRITE_ANIM_FRAME_DATA_POINTER using
+; the current frame's offset
+; [wd4ca] - current frame offset
+; wTempPointer* - Pointer to current Animation
+GetAnimationFramePointer: ; 3d72 (0:3d72)
ldh a, [hBankROM]
push af
push hl
push hl
ld a, [wd4ca]
cp $ff
- jr nz, .asm_3d84
- ld de, Unknown_80e5a
+ jr nz, .useLoadedOffset
+ ld de, SpriteNullAnimationPointer
xor a
- jr .asm_3da1
-.asm_3d84
+ jr .loadPointer
+.useLoadedOffset
ld a, [wTempPointer]
ld l, a
ld a, [wTempPointer + 1]
@@ -11672,13 +11492,13 @@ Func_3d72: ; 3d72 (0:3d72)
ld e, a
inc hl
ld a, [hl]
- adc $0
+ adc 0
ld d, a
pop af
-.asm_3da1
- add BANK(Unknown_80e5a)
+.loadPointer
+ add BANK(SpriteNullAnimationPointer)
pop hl
- ld bc, $000b
+ ld bc, SPRITE_ANIM_FRAME_BANK
add hl, bc
ld [hli], a
call BankswitchROM
@@ -11694,7 +11514,7 @@ Func_3d72: ; 3d72 (0:3d72)
GetFirstSpriteAnimBufferProperty: ; 3db7 (0:3db7)
push bc
- ld c, SPRITE_ANIM_FIELD_00
+ ld c, SPRITE_ANIM_ENABLED
call GetSpriteAnimBufferProperty
pop bc
ret
@@ -11724,29 +11544,26 @@ GetSpriteAnimBufferProperty_SpriteInA:
add hl, bc
pop bc
ret
-; 0x3ddb
Func_3ddb: ; 3ddb (0:3ddb)
push hl
push bc
- ld c, SPRITE_ANIM_FIELD_0F
+ ld c, SPRITE_ANIM_FLAGS
call GetSpriteAnimBufferProperty_SpriteInA
res 2, [hl]
pop bc
pop hl
ret
-; 0x3de7
Func_3de7: ; 3de7 (0:3de7)
push hl
push bc
- ld c, SPRITE_ANIM_FIELD_0F
+ ld c, SPRITE_ANIM_FLAGS
call GetSpriteAnimBufferProperty_SpriteInA
set 2, [hl]
pop bc
pop hl
ret
-; 0x3df3
Func_3df3: ; 3df3 (0:3df3)
push af
@@ -11765,7 +11582,6 @@ Func_3df3: ; 3df3 (0:3df3)
pop af
ld a, [wd61b]
ret
-; 0x3e10
; draws player's portrait at b,c
Func_3e10: ; 3e10 (0:3e10)
@@ -11790,7 +11606,6 @@ Func_3e2a: ; 3e2a (0:3e2a)
ld [wd61e], a
ld a, $63
jr Func_3e17
-; 0x3e31
Func_3e31: ; 3e31 (0:3e31)
ldh a, [hBankROM]
@@ -11802,7 +11617,6 @@ Func_3e31: ; 3e31 (0:3e31)
pop af
call BankswitchROM
ret
-; 0x3e44
; something window scroll
Func_3e44: ; 3e44 (0:3e44)
@@ -11860,7 +11674,6 @@ Func_3e44: ; 3e44 (0:3e44)
pop hl
pop af
ret
-; 0x3ea6
; apply background scroll for lines 0 to 96 using the values at BGScrollData
; skip if wApplyBGScroll is non-0
@@ -11915,7 +11728,6 @@ ApplyBackgroundScroll: ; 3ea6 (0:3ea6)
pop hl
pop af
ret
-; 0x3ef8
BGScrollData: ; 3ef8 (0:3ef8)
db 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3
@@ -11951,7 +11763,6 @@ GetNextBackgroundScroll: ; 3f38 (0:3f38)
sra a
.done
ret
-; 0x3f5a
; enable lcdc interrupt on LYC=LC coincidence
EnableInt_LYCoincidence: ; 3f5a (0:3f5a)
@@ -11963,7 +11774,6 @@ EnableInt_LYCoincidence: ; 3f5a (0:3f5a)
set INT_LCD_STAT, [hl]
pop hl
ret
-; 0x3f68
; disable lcdc interrupt and the LYC=LC coincidence trigger
DisableInt_LYCoincidence: ; 3f68 (0:3f68)
@@ -11975,7 +11785,6 @@ DisableInt_LYCoincidence: ; 3f68 (0:3f68)
res INT_LCD_STAT, [hl]
pop hl
ret
-; 0x3f76
rept $6a
db $ff
diff --git a/src/macros/data.asm b/src/macros/data.asm
index f2a2210..d08ec4e 100644
--- a/src/macros/data.asm
+++ b/src/macros/data.asm
@@ -56,7 +56,7 @@ textpointer: MACRO
dw ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) & $ffff
db ((\1 + ($4000 * (BANK(\1) - 1))) - (TextOffsets + ($4000 * (BANK(TextOffsets) - 1)))) >> 16
const \1_
-GLOBAL \1_
+EXPORT \1_
ENDM
energy: MACRO
@@ -99,4 +99,4 @@ cursor_transition: MACRO
db \4
shift
endr
-ENDM \ No newline at end of file
+ENDM
diff --git a/src/macros/scripts.asm b/src/macros/scripts.asm
index 083f213..73bb09e 100644
--- a/src/macros/scripts.asm
+++ b/src/macros/scripts.asm
@@ -118,4 +118,3 @@ ENDM
const ScriptCommand_EndScriptLoop8_index ; $65
const ScriptCommand_EndScriptLoop9_index ; $66
const ScriptCommand_EndScriptLoop10_index ; $67
-
diff --git a/src/macros/text.asm b/src/macros/text.asm
index 8ad94e8..2b29afe 100644
--- a/src/macros/text.asm
+++ b/src/macros/text.asm
@@ -85,4 +85,4 @@ ENDM
ldfw3: MACRO
ld \1, (TX_FULLWIDTH3 << 8) | STRCAT("FW3_", \2)
-ENDM \ No newline at end of file
+ENDM
diff --git a/src/macros/wram.asm b/src/macros/wram.asm
index c8b9a88..8545972 100644
--- a/src/macros/wram.asm
+++ b/src/macros/wram.asm
@@ -46,24 +46,20 @@ text_header: MACRO
\1RomBank:: ds 1
ENDM
-; TODO: Figure out what the rest are for
sprite_anim_struct: MACRO
-\1Field0x00:: ds 1
-\1Field0x01:: ds 1 ; movement handling / palette
-\1CoordX:: ds 1
-\1CoordY:: ds 1
-\1TileID:: ds 1
-\1Field0x05:: ds 1
-\1Field0x06:: ds 1
-\1Field0x07:: ds 1
-\1Field0x08:: ds 1
-\1Field0x09:: ds 1
-\1Field0x0a:: ds 1
-\1Field0x0b:: ds 1
-\1Field0x0c:: ds 1
-\1Field0x0d:: ds 1
-\1MovementCounter:: ds 1
-\1Field0x0f:: ds 1
+\1Enabled:: ds 1
+\1Attributes:: ds 1
+\1CoordX:: ds 1
+\1CoordY:: ds 1
+\1TileID:: ds 1
+\1ID:: ds 1
+\1Bank:: ds 1
+\1Pointer:: ds 2
+\1FrameOffsetPointer:: ds 2
+\1FrameBank:: ds 1
+\1FrameDataPointer:: ds 2
+\1Counter:: ds 1
+\1Flags:: ds 1
ENDM
loaded_npc_struct: MACRO
diff --git a/src/text/text3.asm b/src/text/text3.asm
index 78c22de..4d3fccf 100644
--- a/src/text/text3.asm
+++ b/src/text/text3.asm
@@ -1620,243 +1620,243 @@ Text03ab: ; 3f663 (f:7663)
text "LABORATORY"
done
-Text03ac: ; 3f66f (f:766f)
+DrMasonNPCName: ; 3f66f (f:766f)
text "Dr. Mason"
done
-Text03ad: ; 3f67a (f:767a)
+RonaldNPCName: ; 3f67a (f:767a)
text "Ronald"
done
-Text03ae: ; 3f682 (f:7682)
+IshiharaNPCName: ; 3f682 (f:7682)
text "ISHIHARA"
done
-Text03af: ; 3f68c (f:768c)
+ImakuniNPCName: ; 3f68c (f:768c)
text "Imakuni?"
done
-Text03b0: ; 3f696 (f:7696)
+ClerkNPCName: ; 3f696 (f:7696)
text "CLERK"
done
-Text03b1: ; 3f69d (f:769d)
+SamNPCName: ; 3f69d (f:769d)
text "Sam"
done
-Text03b2: ; 3f6a2 (f:76a2)
+TechNPCName: ; 3f6a2 (f:76a2)
text "TECH"
done
-Text03b3: ; 3f6a8 (f:76a8)
+ClerkNPCName2: ; 3f6a8 (f:76a8)
text "CLERK"
done
-Text03b4: ; 3f6af (f:76af)
+ChrisNPCName: ; 3f6af (f:76af)
text "Chris"
done
-Text03b5: ; 3f6b6 (f:76b6)
+MichaelNPCName: ; 3f6b6 (f:76b6)
text "Michael"
done
-Text03b6: ; 3f6bf (f:76bf)
+JessicaNPCName: ; 3f6bf (f:76bf)
text "Jessica"
done
-Text03b7: ; 3f6c8 (f:76c8)
+MitchNPCName: ; 3f6c8 (f:76c8)
text "Mitch"
done
-Text03b8: ; 3f6cf (f:76cf)
+MatthewNPCName: ; 3f6cf (f:76cf)
text "Matthew"
done
-Text03b9: ; 3f6d8 (f:76d8)
+RyanNPCName: ; 3f6d8 (f:76d8)
text "Ryan"
done
-Text03ba: ; 3f6de (f:76de)
+AndrewNPCName: ; 3f6de (f:76de)
text "Andrew"
done
-Text03bb: ; 3f6e6 (f:76e6)
+GeneNPCName: ; 3f6e6 (f:76e6)
text "Gene"
done
-Text03bc: ; 3f6ec (f:76ec)
+SaraNPCName: ; 3f6ec (f:76ec)
text "Sara"
done
-Text03bd: ; 3f6f2 (f:76f2)
+AmandaNPCName: ; 3f6f2 (f:76f2)
text "Amanda"
done
-Text03be: ; 3f6fa (f:76fa)
+JoshuaNPCName: ; 3f6fa (f:76fa)
text "Joshua"
done
-Text03bf: ; 3f702 (f:7702)
+AmyNPCName: ; 3f702 (f:7702)
text "Amy"
done
-Text03c0: ; 3f707 (f:7707)
+JenniferNPCName: ; 3f707 (f:7707)
text "Jennifer"
done
-Text03c1: ; 3f711 (f:7711)
+NicholasNPCName: ; 3f711 (f:7711)
text "Nicholas"
done
-Text03c2: ; 3f71b (f:771b)
+BrandonNPCName: ; 3f71b (f:771b)
text "Brandon"
done
-Text03c3: ; 3f724 (f:7724)
+IsaacNPCName: ; 3f724 (f:7724)
text "Isaac"
done
-Text03c4: ; 3f72b (f:772b)
+BrittanyNPCName: ; 3f72b (f:772b)
text "Brittany"
done
-Text03c5: ; 3f735 (f:7735)
+KristinNPCName: ; 3f735 (f:7735)
text "Kristin"
done
-Text03c6: ; 3f73e (f:773e)
+HeatherNPCName: ; 3f73e (f:773e)
text "Heather"
done
-Text03c7: ; 3f747 (f:7747)
+NikkiNPCName: ; 3f747 (f:7747)
text "Nikki"
done
-Text03c8: ; 3f74e (f:774e)
+RobertNPCName: ; 3f74e (f:774e)
text "Robert"
done
-Text03c9: ; 3f756 (f:7756)
+DanielNPCName: ; 3f756 (f:7756)
text "Daniel"
done
-Text03ca: ; 3f75e (f:775e)
+StephanieNPCName: ; 3f75e (f:775e)
text "Stephanie"
done
-Text03cb: ; 3f769 (f:7769)
+MurrayNPCName: ; 3f769 (f:7769)
text "Murray"
done
-Text03cc: ; 3f771 (f:7771)
+JosephNPCName: ; 3f771 (f:7771)
text "Joseph"
done
-Text03cd: ; 3f779 (f:7779)
+DavidNPCName: ; 3f779 (f:7779)
text "David"
done
-Text03ce: ; 3f780 (f:7780)
+ErikNPCName: ; 3f780 (f:7780)
text "Erik"
done
-Text03cf: ; 3f786 (f:7786)
+RickNPCName: ; 3f786 (f:7786)
text "Rick"
done
-Text03d0: ; 3f78c (f:778c)
+JohnNPCName: ; 3f78c (f:778c)
text "John"
done
-Text03d1: ; 3f792 (f:7792)
+AdamNPCName: ; 3f792 (f:7792)
text "Adam"
done
-Text03d2: ; 3f798 (f:7798)
+JonathanNPCName: ; 3f798 (f:7798)
text "Jonathan"
done
-Text03d3: ; 3f7a2 (f:77a2)
+KenNPCName: ; 3f7a2 (f:77a2)
text "Ken"
done
-Text03d4: ; 3f7a7 (f:77a7)
+CourtneyNPCName: ; 3f7a7 (f:77a7)
text "COURTNEY"
done
-Text03d5: ; 3f7b1 (f:77b1)
+SteveNPCName: ; 3f7b1 (f:77b1)
text "Steve"
done
-Text03d6: ; 3f7b8 (f:77b8)
+JackNPCName: ; 3f7b8 (f:77b8)
text "Jack"
done
-Text03d7: ; 3f7be (f:77be)
+RodNPCName: ; 3f7be (f:77be)
text "Rod"
done
-Text03d8: ; 3f7c3 (f:77c3)
+ManNPCName: ; 3f7c3 (f:77c3)
text "Man"
done
-Text03d9: ; 3f7c8 (f:77c8)
+WomanNPCName: ; 3f7c8 (f:77c8)
text "Woman"
done
-Text03da: ; 3f7cf (f:77cf)
+ChapNPCName: ; 3f7cf (f:77cf)
text "CHAP"
done
-Text03db: ; 3f7d5 (f:77d5)
+GalNPCName: ; 3f7d5 (f:77d5)
text "GAL"
done
-Text03dc: ; 3f7da (f:77da)
+LassNPCName: ; 3f7da (f:77da)
text "Lass"
done
-Text03dd: ; 3f7e0 (f:77e0)
+PappyNPCName: ; 3f7e0 (f:77e0)
text "Pappy"
done
-Text03de: ; 3f7e7 (f:77e7)
+LadNPCName: ; 3f7e7 (f:77e7)
text "Lad"
done
-Text03df: ; 3f7ec (f:77ec)
+HostNPCName: ; 3f7ec (f:77ec)
text "HOST"
done
-Text03e0: ; 3f7f2 (f:77f2)
+SpecsNPCName: ; 3f7f2 (f:77f2)
text "Specs"
done
-Text03e1: ; 3f7f9 (f:77f9)
+ButchNPCName: ; 3f7f9 (f:77f9)
text "Butch"
done
-Text03e2: ; 3f800 (f:7800)
+HoodNPCName: ; 3f800 (f:7800)
text "Hood"
done
-Text03e3: ; 3f806 (f:7806)
+ChampNPCName: ; 3f806 (f:7806)
text "Champ"
done
-Text03e4: ; 3f80d (f:780d)
+ManiaNPCName: ; 3f80d (f:780d)
text "Mania"
done
-Text03e5: ; 3f814 (f:7814)
+GrannyNPCName: ; 3f814 (f:7814)
text "Granny"
done
-Text03e6: ; 3f81c (f:781c)
+GuideNPCName: ; 3f81c (f:781c)
text "Guide"
done
-Text03e7: ; 3f823 (f:7823)
+AaronNPCName: ; 3f823 (f:7823)
text "Aaron"
done
diff --git a/src/text/text_offsets.asm b/src/text/text_offsets.asm
index d027768..605ec7d 100644
--- a/src/text/text_offsets.asm
+++ b/src/text/text_offsets.asm
@@ -1,6 +1,6 @@
const_def 1
-TextOffsets:: ; 34000 (d:4000)
+TextOffsets:: ; 34000 (d:4000)
dwb $0000, $00 ; 0x0000
textpointer HandText ; 0x0001
textpointer CheckText ; 0x0002
@@ -941,66 +941,66 @@ TextOffsets:: ; 34000 (d:40
textpointer Text03a9 ; 0x03a9
textpointer Text03aa ; 0x03aa
textpointer Text03ab ; 0x03ab
- textpointer Text03ac ; 0x03ac
- textpointer Text03ad ; 0x03ad
- textpointer Text03ae ; 0x03ae
- textpointer Text03af ; 0x03af
- textpointer Text03b0 ; 0x03b0
- textpointer Text03b1 ; 0x03b1
- textpointer Text03b2 ; 0x03b2
- textpointer Text03b3 ; 0x03b3
- textpointer Text03b4 ; 0x03b4
- textpointer Text03b5 ; 0x03b5
- textpointer Text03b6 ; 0x03b6
- textpointer Text03b7 ; 0x03b7
- textpointer Text03b8 ; 0x03b8
- textpointer Text03b9 ; 0x03b9
- textpointer Text03ba ; 0x03ba
- textpointer Text03bb ; 0x03bb
- textpointer Text03bc ; 0x03bc
- textpointer Text03bd ; 0x03bd
- textpointer Text03be ; 0x03be
- textpointer Text03bf ; 0x03bf
- textpointer Text03c0 ; 0x03c0
- textpointer Text03c1 ; 0x03c1
- textpointer Text03c2 ; 0x03c2
- textpointer Text03c3 ; 0x03c3
- textpointer Text03c4 ; 0x03c4
- textpointer Text03c5 ; 0x03c5
- textpointer Text03c6 ; 0x03c6
- textpointer Text03c7 ; 0x03c7
- textpointer Text03c8 ; 0x03c8
- textpointer Text03c9 ; 0x03c9
- textpointer Text03ca ; 0x03ca
- textpointer Text03cb ; 0x03cb
- textpointer Text03cc ; 0x03cc
- textpointer Text03cd ; 0x03cd
- textpointer Text03ce ; 0x03ce
- textpointer Text03cf ; 0x03cf
- textpointer Text03d0 ; 0x03d0
- textpointer Text03d1 ; 0x03d1
- textpointer Text03d2 ; 0x03d2
- textpointer Text03d3 ; 0x03d3
- textpointer Text03d4 ; 0x03d4
- textpointer Text03d5 ; 0x03d5
- textpointer Text03d6 ; 0x03d6
- textpointer Text03d7 ; 0x03d7
- textpointer Text03d8 ; 0x03d8
- textpointer Text03d9 ; 0x03d9
- textpointer Text03da ; 0x03da
- textpointer Text03db ; 0x03db
- textpointer Text03dc ; 0x03dc
- textpointer Text03dd ; 0x03dd
- textpointer Text03de ; 0x03de
- textpointer Text03df ; 0x03df
- textpointer Text03e0 ; 0x03e0
- textpointer Text03e1 ; 0x03e1
- textpointer Text03e2 ; 0x03e2
- textpointer Text03e3 ; 0x03e3
- textpointer Text03e4 ; 0x03e4
- textpointer Text03e5 ; 0x03e5
- textpointer Text03e6 ; 0x03e6
- textpointer Text03e7 ; 0x03e7
+ textpointer DrMasonNPCName ; 0x03ac
+ textpointer RonaldNPCName ; 0x03ad
+ textpointer IshiharaNPCName ; 0x03ae
+ textpointer ImakuniNPCName ; 0x03af
+ textpointer ClerkNPCName ; 0x03b0
+ textpointer SamNPCName ; 0x03b1
+ textpointer TechNPCName ; 0x03b2
+ textpointer ClerkNPCName2 ; 0x03b3
+ textpointer ChrisNPCName ; 0x03b4
+ textpointer MichaelNPCName ; 0x03b5
+ textpointer JessicaNPCName ; 0x03b6
+ textpointer MitchNPCName ; 0x03b7
+ textpointer MatthewNPCName ; 0x03b8
+ textpointer RyanNPCName ; 0x03b9
+ textpointer AndrewNPCName ; 0x03ba
+ textpointer GeneNPCName ; 0x03bb
+ textpointer SaraNPCName ; 0x03bc
+ textpointer AmandaNPCName ; 0x03bd
+ textpointer JoshuaNPCName ; 0x03be
+ textpointer AmyNPCName ; 0x03bf
+ textpointer JenniferNPCName ; 0x03c0
+ textpointer NicholasNPCName ; 0x03c1
+ textpointer BrandonNPCName ; 0x03c2
+ textpointer IsaacNPCName ; 0x03c3
+ textpointer BrittanyNPCName ; 0x03c4
+ textpointer KristinNPCName ; 0x03c5
+ textpointer HeatherNPCName ; 0x03c6
+ textpointer NikkiNPCName ; 0x03c7
+ textpointer RobertNPCName ; 0x03c8
+ textpointer DanielNPCName ; 0x03c9
+ textpointer StephanieNPCName ; 0x03ca
+ textpointer MurrayNPCName ; 0x03cb
+ textpointer JosephNPCName ; 0x03cc
+ textpointer DavidNPCName ; 0x03cd
+ textpointer ErikNPCName ; 0x03ce
+ textpointer RickNPCName ; 0x03cf
+ textpointer JohnNPCName ; 0x03d0
+ textpointer AdamNPCName ; 0x03d1
+ textpointer JonathanNPCName ; 0x03d2
+ textpointer KenNPCName ; 0x03d3
+ textpointer CourtneyNPCName ; 0x03d4
+ textpointer SteveNPCName ; 0x03d5
+ textpointer JackNPCName ; 0x03d6
+ textpointer RodNPCName ; 0x03d7
+ textpointer ManNPCName ; 0x03d8
+ textpointer WomanNPCName ; 0x03d9
+ textpointer ChapNPCName ; 0x03da
+ textpointer GalNPCName ; 0x03db
+ textpointer LassNPCName ; 0x03dc
+ textpointer PappyNPCName ; 0x03dd
+ textpointer LadNPCName ; 0x03de
+ textpointer HostNPCName ; 0x03df
+ textpointer SpecsNPCName ; 0x03e0
+ textpointer ButchNPCName ; 0x03e1
+ textpointer HoodNPCName ; 0x03e2
+ textpointer ChampNPCName ; 0x03e3
+ textpointer ManiaNPCName ; 0x03e4
+ textpointer GrannyNPCName ; 0x03e5
+ textpointer GuideNPCName ; 0x03e6
+ textpointer AaronNPCName ; 0x03e7
textpointer Text03e8 ; 0x03e8
textpointer Text03e9 ; 0x03e9
textpointer Text03ea ; 0x03ea
diff --git a/src/wram.asm b/src/wram.asm
index acd9638..bb1f346 100644
--- a/src/wram.asm
+++ b/src/wram.asm
@@ -937,7 +937,7 @@ wAIMaxDamage:: ; ccbc
wDealtDamage:: ; ccbf
ds $2
-; WEAKNESS and RESISTANCE flags for a damaging attack
+; WEAKNESS and RESISTANCE flags for a damaging attack
wDamageEffectiveness:: ; ccc1
ds $1
@@ -1194,9 +1194,9 @@ wAIPokedexCounter:: ; cda6
; variable to keep track of Mewtwo1's Barrier usage during Player' turn.
; AI_FLAG_MEWTWO_MILL set means Player is running Mewtwo1 mill deck.
-; - when flag is not set, this counts how many turns in a row
+; - when flag is not set, this counts how many turns in a row
; Player used Mewtwo1's Barrier attack;
-; - when flag is set, this counts how many turns in a row
+; - when flag is set, this counts how many turns in a row
; Player has NOT used Barrier attack.
wAIBarrierFlagCounter:: ; cda7
ds $1
@@ -1369,7 +1369,7 @@ wcdea:: ; cdea
; $01 = can't damage
wAICannotDamage:: ; cdf0
ds $1
-
+
; used by AI to store variable information
wTempAI:: ; cdf1
ds $1
@@ -1413,8 +1413,8 @@ wAIMoveIsNonDamaging:: ; ce02
ds $1
; whether AI already retreated this turn or not.
-; - $0 has not retreated;
-; - $1 has retreated.
+; - $0 has not retreated;
+; - $1 has retreated.
wAIRetreatedThisTurn:: ; ce03
ds $1
@@ -1945,7 +1945,7 @@ wd0c4:: ; d0c4
wd0c5:: ; d0c5
ds $1
-; used to store the location of an overworld sequence, which is jumped to later
+; used to store the location of an overworld script, which is jumped to later
wNextScript:: ; d0c6
ds $2
@@ -2319,7 +2319,13 @@ wd4af:: ; d4af
wd4b0:: ; d4b0
ds $1
- ds $d
+wd4b1:: ; d4b1
+ ds $1
+
+wd4b2:: ; d4b2
+ ds $1
+
+ ds $b
wd4be:: ; d4be
ds $1
@@ -2384,22 +2390,22 @@ wSpriteAnimBuffer:: ; d4d0
sprite_anim_struct wSprite15
sprite_anim_struct wSprite16
-wd5d0:: ; d5d0
+wCurrSpriteAttributes:: ; d5d0
ds $1
-wd5d1:: ; d5d1
+wCurrSpriteXPos:: ; d5d1
ds $1
-wd5d2:: ; d5d2
+wCurrSpriteYPos:: ; d5d2
ds $1
-wd5d3:: ; d5d3
+wCurrSpriteTileID:: ; d5d3
ds $1
-wd5d4:: ; d5d4
+wCurrSpriteRightEdgeCheck:: ; d5d4
ds $1
-wd5d5:: ; d5d5
+wCurrSpriteBottomEdgeCheck:: ; d5d5
ds $1
wd5d6:: ; d5d6