diff options
67 files changed, 16956 insertions, 5854 deletions
diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 42b0774..4727496 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -221,7 +221,7 @@ When naming WRAM addresses that belong to the same context or feature, try to ma wLoadedCard1:: ; cc24 card_data_struct wLoadedCard1 wLoadedCard2:: ; cc65 - card_data_struct wLoadedCard2 + card_data_struct wLoadedCard2 ``` Lastly, adding some line of commentary to the memory address is helpful when just the name itself doesn't quite tell the whole story. Usually, this is done to clarify where the memory address is used, or to explain which kind of different values it may hold and perhaps what each of them means (or just to mention the support of specific values, such as $00 or $ff). If the RAM address is supposed to hold a value that maps directly to some group of already defined constants, this is the perfect place to indicate it. Adding commentary to an address that contains a bit field is also particularly useful to describe what each bit means, since that's not doable with just the address name. 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/card_data_constants.asm b/src/constants/card_data_constants.asm index 3f26e4d..0731218 100644 --- a/src/constants/card_data_constants.asm +++ b/src/constants/card_data_constants.asm @@ -146,6 +146,7 @@ PRO EQU $8 BASIC EQU $00 STAGE1 EQU $01 STAGE2 EQU $02 +STAGE2_WITHOUT_STAGE1 EQU $03 ; CARD_DATA_WEAKNESS and CARD_DATA_RESISTANCE constants WR_FIRE EQU $80 diff --git a/src/constants/charmaps.asm b/src/constants/charmaps.asm index baa3f46..f87e841 100644 --- a/src/constants/charmaps.asm +++ b/src/constants/charmaps.asm @@ -94,6 +94,7 @@ ENDM fwcharmap 3, "\", $98 fwcharmap 3, "┐", $99 fwcharmap 3, "|", $9a + fwcharmap 3, " ", $9c fwcharmap 3, "!", $9d fwcharmap 3, "#", $9f fwcharmap 3, "$", $a0 diff --git a/src/constants/deck_ai_constants.asm b/src/constants/deck_ai_constants.asm index ceae8ed..4533c99 100644 --- a/src/constants/deck_ai_constants.asm +++ b/src/constants/deck_ai_constants.asm @@ -1,61 +1,78 @@ -; 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_MEWTWO_MILL_F EQU 7 +AI_MEWTWO_MILL EQU 1 << AI_MEWTWO_MILL_F + +; 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 + +; this bit is set when the AI decides to use Peek on their Prize cards, +; with the following bits deciding which one to Peek. That is: +; %10'0000 = first prize card +; %10'0001 = second prize card +; %10'0010 = third prize card +; etc... +AI_PEEK_TARGET_PRIZE_F EQU 6 +AI_PEEK_TARGET_PRIZE EQU 1 << AI_PEEK_TARGET_PRIZE_F +; this bit is set when the AI decides to use Peek on Player hand card, +; with the following bits deciding which one to Peek. That is: +; %1XXX XXXX, where XXX XXXX is the deck index of card chosen +AI_PEEK_TARGET_HAND_F EQU 7 +AI_PEEK_TARGET_HAND EQU 1 << AI_PEEK_TARGET_HAND_F +; all bits set means AI chose to look at Player's top deck card +AI_PEEK_TARGET_DECK EQU $ff diff --git a/src/constants/duel_constants.asm b/src/constants/duel_constants.asm index 28199e5..8255afe 100644 --- a/src/constants/duel_constants.asm +++ b/src/constants/duel_constants.asm @@ -25,58 +25,61 @@ DUEL_WIN EQU $0 DUEL_LOSS EQU $1 ; wPlayerDuelVariables or wOpponentDuelVariables constants -DUELVARS_CARD_LOCATIONS EQUS "LOW(wPlayerCardLocations)" ; 00 -DUELVARS_PRIZE_CARDS EQUS "LOW(wPlayerPrizeCards)" ; 3c -DUELVARS_HAND EQUS "LOW(wPlayerHand)" ; 42 -DUELVARS_DECK_CARDS EQUS "LOW(wPlayerDeckCards)" ; 7e -DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK EQUS "LOW(wPlayerNumberOfCardsNotInDeck)" ; ba -DUELVARS_ARENA_CARD EQUS "LOW(wPlayerArenaCard)" ; bb -DUELVARS_BENCH EQUS "LOW(wPlayerBench)" ; bc -DUELVARS_ARENA_CARD_FLAGS_C2 EQU $c2 -DUELVARS_ARENA_CARD_HP EQUS "LOW(wPlayerArenaCardHP)" ; c8 -DUELVARS_BENCH1_CARD_HP EQUS "LOW(wPlayerBench1CardHP)" ; c9 -DUELVARS_BENCH2_CARD_HP EQUS "LOW(wPlayerBench2CardHP)" ; ca -DUELVARS_BENCH3_CARD_HP EQUS "LOW(wPlayerBench3CardHP)" ; cb -DUELVARS_BENCH4_CARD_HP EQUS "LOW(wPlayerBench4CardHP)" ; cc -DUELVARS_BENCH5_CARD_HP EQUS "LOW(wPlayerBench5CardHP)" ; cd -DUELVARS_ARENA_CARD_STAGE EQUS "LOW(wPlayerArenaCardStage)" ; ce -DUELVARS_BENCH1_CARD_STAGE EQUS "LOW(wPlayerBench1CardStage)" ; cf -DUELVARS_BENCH2_CARD_STAGE EQUS "LOW(wPlayerBench2CardStage)" ; d0 -DUELVARS_BENCH3_CARD_STAGE EQUS "LOW(wPlayerBench3CardStage)" ; d1 -DUELVARS_BENCH4_CARD_STAGE EQUS "LOW(wPlayerBench4CardStage)" ; d2 -DUELVARS_BENCH5_CARD_STAGE EQUS "LOW(wPlayerBench5CardStage)" ; d3 -DUELVARS_ARENA_CARD_CHANGED_TYPE EQUS "LOW(wPlayerArenaCardChangedType)" ; d4 -DUELVARS_BENCH1_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench1CardChangedType)" ; d5 -DUELVARS_BENCH2_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench2CardChangedType)" ; d6 -DUELVARS_BENCH3_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench3CardChangedType)" ; d7 -DUELVARS_BENCH4_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench4CardChangedType)" ; d8 -DUELVARS_BENCH5_CARD_CHANGED_TYPE EQUS "LOW(wPlayerBench5CardChangedType)" ; d9 -DUELVARS_ARENA_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerArenaCardAttachedDefender)" ; da -DUELVARS_BENCH1_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench1CardAttachedDefender)" ; db -DUELVARS_BENCH2_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench2CardAttachedDefender)" ; dc -DUELVARS_BENCH3_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench3CardAttachedDefender)" ; dd -DUELVARS_BENCH4_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench4CardAttachedDefender)" ; de -DUELVARS_BENCH5_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench5CardAttachedDefender)" ; df -DUELVARS_ARENA_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerArenaCardAttachedPluspower)" ; e0 -DUELVARS_BENCH1_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerBench1CardAttachedPluspower)" ; e1 -DUELVARS_BENCH2_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerBench2CardAttachedPluspower)" ; e2 -DUELVARS_BENCH3_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerBench3CardAttachedPluspower)" ; e3 -DUELVARS_BENCH4_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerBench4CardAttachedPluspower)" ; e4 -DUELVARS_BENCH5_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerBench5CardAttachedPluspower)" ; e5 -DUELVARS_ARENA_CARD_SUBSTATUS1 EQUS "LOW(wPlayerArenaCardSubstatus1)" ; e7 -DUELVARS_ARENA_CARD_SUBSTATUS2 EQUS "LOW(wPlayerArenaCardSubstatus2)" ; e8 -DUELVARS_ARENA_CARD_CHANGED_WEAKNESS EQUS "LOW(wPlayerArenaCardChangedWeakness)" ; e9 -DUELVARS_ARENA_CARD_CHANGED_RESISTANCE EQUS "LOW(wPlayerArenaCardChangedResistance)" ; ea -DUELVARS_ARENA_CARD_SUBSTATUS3 EQUS "LOW(wPlayerArenaCardSubstatus3)" ; eb -DUELVARS_PRIZES EQUS "LOW(wPlayerPrizes)" ; ec -DUELVARS_NUMBER_OF_CARDS_IN_DISCARD_PILE EQUS "LOW(wPlayerNumberOfCardsInDiscardPile)" ; ed -DUELVARS_NUMBER_OF_CARDS_IN_HAND EQUS "LOW(wPlayerNumberOfCardsInHand)" ; ee -DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA EQUS "LOW(wPlayerNumberOfPokemonInPlayArea)" ; ef -DUELVARS_ARENA_CARD_STATUS EQUS "LOW(wPlayerArenaCardStatus)" ; f0 -DUELVARS_DUELIST_TYPE EQUS "LOW(wPlayerDuelistType)" ; f1 -DUELVARS_ARENA_CARD_DISABLED_MOVE_INDEX EQUS "LOW(wPlayerArenaCardDisabledMoveIndex)" ; f2 -DUELVARS_ARENA_CARD_LAST_TURN_DAMAGE EQUS "LOW(wPlayerArenaCardLastTurnDamage)" ; f3 -DUELVARS_ARENA_CARD_LAST_TURN_STATUS EQUS "LOW(wPlayerArenaCardLastTurnStatus)" ; f5 +DUELVARS_CARD_LOCATIONS EQUS "LOW(wPlayerCardLocations)" ; 00 +DUELVARS_PRIZE_CARDS EQUS "LOW(wPlayerPrizeCards)" ; 3c +DUELVARS_HAND EQUS "LOW(wPlayerHand)" ; 42 +DUELVARS_DECK_CARDS EQUS "LOW(wPlayerDeckCards)" ; 7e +DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK EQUS "LOW(wPlayerNumberOfCardsNotInDeck)" ; ba +DUELVARS_ARENA_CARD EQUS "LOW(wPlayerArenaCard)" ; bb +DUELVARS_BENCH EQUS "LOW(wPlayerBench)" ; bc +DUELVARS_ARENA_CARD_FLAGS EQUS "LOW(wPlayerArenaCardFlags)" ; c2 +DUELVARS_ARENA_CARD_HP EQUS "LOW(wPlayerArenaCardHP)" ; c8 +DUELVARS_BENCH1_CARD_HP EQUS "LOW(wPlayerBench1CardHP)" ; c9 +DUELVARS_BENCH2_CARD_HP EQUS "LOW(wPlayerBench2CardHP)" ; ca +DUELVARS_BENCH3_CARD_HP EQUS "LOW(wPlayerBench3CardHP)" ; cb +DUELVARS_BENCH4_CARD_HP EQUS "LOW(wPlayerBench4CardHP)" ; cc +DUELVARS_BENCH5_CARD_HP EQUS "LOW(wPlayerBench5CardHP)" ; cd +DUELVARS_ARENA_CARD_STAGE EQUS "LOW(wPlayerArenaCardStage)" ; ce +DUELVARS_BENCH1_CARD_STAGE EQUS "LOW(wPlayerBench1CardStage)" ; cf +DUELVARS_BENCH2_CARD_STAGE EQUS "LOW(wPlayerBench2CardStage)" ; d0 +DUELVARS_BENCH3_CARD_STAGE EQUS "LOW(wPlayerBench3CardStage)" ; d1 +DUELVARS_BENCH4_CARD_STAGE EQUS "LOW(wPlayerBench4CardStage)" ; d2 +DUELVARS_BENCH5_CARD_STAGE EQUS "LOW(wPlayerBench5CardStage)" ; d3 +DUELVARS_ARENA_CARD_CHANGED_TYPE EQUS "LOW(wPlayerArenaCardChangedType)" ; d4 +DUELVARS_BENCH1_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench1CardChangedType)" ; d5 +DUELVARS_BENCH2_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench2CardChangedType)" ; d6 +DUELVARS_BENCH3_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench3CardChangedType)" ; d7 +DUELVARS_BENCH4_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench4CardChangedType)" ; d8 +DUELVARS_BENCH5_CARD_CHANGED_COLOR EQUS "LOW(wPlayerBench5CardChangedType)" ; d9 +DUELVARS_ARENA_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerArenaCardAttachedDefender)" ; da +DUELVARS_BENCH1_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench1CardAttachedDefender)" ; db +DUELVARS_BENCH2_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench2CardAttachedDefender)" ; dc +DUELVARS_BENCH3_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench3CardAttachedDefender)" ; dd +DUELVARS_BENCH4_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench4CardAttachedDefender)" ; de +DUELVARS_BENCH5_CARD_ATTACHED_DEFENDER EQUS "LOW(wPlayerBench5CardAttachedDefender)" ; df +DUELVARS_ARENA_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerArenaCardAttachedPluspower)" ; e0 +DUELVARS_BENCH1_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerBench1CardAttachedPluspower)" ; e1 +DUELVARS_BENCH2_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerBench2CardAttachedPluspower)" ; e2 +DUELVARS_BENCH3_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerBench3CardAttachedPluspower)" ; e3 +DUELVARS_BENCH4_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerBench4CardAttachedPluspower)" ; e4 +DUELVARS_BENCH5_CARD_ATTACHED_PLUSPOWER EQUS "LOW(wPlayerBench5CardAttachedPluspower)" ; e5 +DUELVARS_ARENA_CARD_SUBSTATUS1 EQUS "LOW(wPlayerArenaCardSubstatus1)" ; e7 +DUELVARS_ARENA_CARD_SUBSTATUS2 EQUS "LOW(wPlayerArenaCardSubstatus2)" ; e8 +DUELVARS_ARENA_CARD_CHANGED_WEAKNESS EQUS "LOW(wPlayerArenaCardChangedWeakness)" ; e9 +DUELVARS_ARENA_CARD_CHANGED_RESISTANCE EQUS "LOW(wPlayerArenaCardChangedResistance)" ; ea +DUELVARS_ARENA_CARD_SUBSTATUS3 EQUS "LOW(wPlayerArenaCardSubstatus3)" ; eb +DUELVARS_PRIZES EQUS "LOW(wPlayerPrizes)" ; ec +DUELVARS_NUMBER_OF_CARDS_IN_DISCARD_PILE EQUS "LOW(wPlayerNumberOfCardsInDiscardPile)" ; ed +DUELVARS_NUMBER_OF_CARDS_IN_HAND EQUS "LOW(wPlayerNumberOfCardsInHand)" ; ee +DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA EQUS "LOW(wPlayerNumberOfPokemonInPlayArea)" ; ef +DUELVARS_ARENA_CARD_STATUS EQUS "LOW(wPlayerArenaCardStatus)" ; f0 +DUELVARS_DUELIST_TYPE EQUS "LOW(wPlayerDuelistType)" ; f1 +DUELVARS_ARENA_CARD_DISABLED_MOVE_INDEX EQUS "LOW(wPlayerArenaCardDisabledMoveIndex)" ; f2 +DUELVARS_ARENA_CARD_LAST_TURN_DAMAGE EQUS "LOW(wPlayerArenaCardLastTurnDamage)" ; f3 +DUELVARS_ARENA_CARD_LAST_TURN_STATUS EQUS "LOW(wPlayerArenaCardLastTurnStatus)" ; f5 +DUELVARS_ARENA_CARD_LAST_TURN_SUBSTATUS2 EQUS "LOW(wPlayerArenaCardLastTurnSubstatus2)" ; f6 +DUELVARS_ARENA_CARD_LAST_TURN_CHANGE_WEAK EQUS "LOW(wPlayerArenaCardLastTurnChangeWeak)" ; f7 +DUELVARS_ARENA_CARD_LAST_TURN_EFFECT EQUS "LOW(wPlayerArenaCardLastTurnEffect)" ; f8 ; card location constants (DUELVARS_CARD_LOCATIONS) CARD_LOCATION_DECK EQU $00 @@ -153,6 +156,7 @@ SUBSTATUS2_AMNESIA EQU $04 SUBSTATUS2_TAIL_WAG EQU $05 SUBSTATUS2_LEER EQU $06 SUBSTATUS2_POUNCE EQU $07 +SUBSTATUS2_CONVERSION2 EQU $08 SUBSTATUS2_UNABLE_RETREAT EQU $09 SUBSTATUS2_BONE_ATTACK EQU $0b SUBSTATUS2_GROWL EQU $12 @@ -160,22 +164,41 @@ SUBSTATUS2_GROWL EQU $12 SUBSTATUS3_THIS_TURN_DOUBLE_DAMAGE EQU 0 SUBSTATUS3_HEADACHE EQU 1 -; DUELVARS_ARENA_CARD_FLAGS_C2 constants -CAN_EVOLVE_THIS_TURN_F EQU 7 -CAN_EVOLVE_THIS_TURN EQU 1 << CAN_EVOLVE_THIS_TURN_F +; DUELVARS_ARENA_CARD_FLAGS constants +USED_PKMN_POWER_THIS_TURN_F EQU 5 +USED_LEEK_SLAP_THIS_DUEL_F EQU 6 +CAN_EVOLVE_THIS_TURN_F EQU 7 + +USED_PKMN_POWER_THIS_TURN EQU 1 << USED_PKMN_POWER_THIS_TURN_F +USED_LEEK_SLAP_THIS_DUEL EQU 1 << USED_LEEK_SLAP_THIS_DUEL_F +CAN_EVOLVE_THIS_TURN EQU 1 << CAN_EVOLVE_THIS_TURN_F + +; DUELVARS_ARENA_CARD_LAST_TURN_EFFECT constants + const_def + const LAST_TURN_EFFECT_NONE ; $00 + const LAST_TURN_EFFECT_DISCARD_ENERGY ; $01 + const LAST_TURN_EFFECT_AMNESIA ; $02 + +; *_CHANGED_COLOR constants +HAS_CHANGED_COLOR_F EQU 7 +HAS_CHANGED_COLOR EQU 1 << HAS_CHANGED_COLOR_F + +; flag in wDamage + 1 that indicates +; whether damage is unaffected by Weakness/Resistance +UNAFFECTED_BY_WEAKNESS_RESISTANCE_F EQU 7 ; effect command constants (TryExecuteEffectCommandFunction) ; ordered by (roughly) execution time -EFFECTCMDTYPE_INITIAL_EFFECT_1 EQU $01 -EFFECTCMDTYPE_INITIAL_EFFECT_2 EQU $02 -EFFECTCMDTYPE_DISCARD_ENERGY EQU $06 -EFFECTCMDTYPE_REQUIRE_SELECTION EQU $05 -EFFECTCMDTYPE_BEFORE_DAMAGE EQU $03 -EFFECTCMDTYPE_AFTER_DAMAGE EQU $04 -EFFECTCMDTYPE_SWITCH_DEFENDING_PKMN EQU $0a -EFFECTCMDTYPE_PKMN_POWER_TRIGGER EQU $07 -EFFECTCMDTYPE_AI EQU $09 -EFFECTCMDTYPE_UNKNOWN_08 EQU $08 +EFFECTCMDTYPE_INITIAL_EFFECT_1 EQU $01 +EFFECTCMDTYPE_INITIAL_EFFECT_2 EQU $02 +EFFECTCMDTYPE_DISCARD_ENERGY EQU $06 +EFFECTCMDTYPE_REQUIRE_SELECTION EQU $05 +EFFECTCMDTYPE_BEFORE_DAMAGE EQU $03 +EFFECTCMDTYPE_AFTER_DAMAGE EQU $04 +EFFECTCMDTYPE_AI_SELECTION EQU $08 +EFFECTCMDTYPE_AI_SWITCH_DEFENDING_PKMN EQU $0a +EFFECTCMDTYPE_PKMN_POWER_TRIGGER EQU $07 +EFFECTCMDTYPE_AI EQU $09 ; wDamageEffectiveness constants WEAKNESS EQU 1 @@ -210,7 +233,7 @@ NO_DAMAGE_OR_EFFECT_NSHIELD EQU $05 const OPPACTION_TOSS_COIN_A_TIMES ; $11 const OPPACTION_6B30 ; $12 const OPPACTION_NO_ACTION_13 ; $13 - const OPPACTION_6B3E ; $14 + const OPPACTION_USE_METRONOME_ATTACK ; $14 const OPPACTION_6B15 ; $15 const OPPACTION_DUEL_MAIN_SCENE ; $16 @@ -240,3 +263,10 @@ PRIZES_3 EQU $03 PRIZES_4 EQU $04 PRIZES_5 EQU $05 PRIZES_6 EQU $06 + +; constants to use as input to LookForCardInDeck +SEARCHEFFECT_CARD_ID EQU $0 +SEARCHEFFECT_NIDORAN EQU $1 +SEARCHEFFECT_BASIC_FIGHTING EQU $2 +SEARCHEFFECT_BASIC_ENERGY EQU $3 +SEARCHEFFECT_POKEMON EQU $4 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/cards.asm b/src/data/cards.asm index e601f98..dca875a 100644 --- a/src/data/cards.asm +++ b/src/data/cards.asm @@ -858,12 +858,12 @@ NidoranFCard: ; 31134 (c:5134) ; move 1 energy GRASS, 1 ; energies - tx FurySweepesName ; name + tx FurySwipesName ; name tx TripleAttackX10Description ; description dw NONE ; description (cont) db 10 ; damage db DAMAGE_X ; category - dw NidoranFFurySweepesEffectCommands ; effect commands + dw NidoranFFurySwipesEffectCommands ; effect commands db NONE ; flags 1 db NONE ; flags 2 db NONE ; flags 3 @@ -3320,12 +3320,12 @@ PsyduckCard: ; 31d64 (c:5d64) ; move 2 energy WATER, 1 ; energies - tx FurySweepesName ; name + tx FurySwipesName ; name tx TripleAttackX10Description ; description dw NONE ; description (cont) db 10 ; damage db DAMAGE_X ; category - dw PsyduckFurySweepesEffectCommands ; effect commands + dw PsyduckFurySwipesEffectCommands ; effect commands db NONE ; flags 1 db NONE ; flags 2 db NONE ; flags 3 @@ -5972,12 +5972,12 @@ SandslashCard: ; 32a98 (c:6a98) ; move 2 energy FIGHTING, 2 ; energies - tx FurySweepesName ; name + tx FurySwipesName ; name tx TripleAttackX20Description ; description dw NONE ; description (cont) db 20 ; damage db DAMAGE_X ; category - dw SandslashFurySweepesEffectCommands ; effect commands + dw SandslashFurySwipesEffectCommands ; effect commands db NONE ; flags 1 db NONE ; flags 2 db NONE ; flags 3 @@ -6162,12 +6162,12 @@ PrimeapeCard: ; 32b9c (c:6b9c) ; move 1 energy FIGHTING, 2 ; energies - tx FurySweepesName ; name + tx FurySwipesName ; name tx TripleAttackX20Description ; description dw NONE ; description (cont) db 20 ; damage db DAMAGE_X ; category - dw PrimeapeFurySweepesEffectCommands ; effect commands + dw PrimeapeFurySwipesEffectCommands ; effect commands db NONE ; flags 1 db NONE ; flags 2 db NONE ; flags 3 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/effect_commands.asm b/src/data/effect_commands.asm index 7360aff..5d38cb4 100644 --- a/src/data/effect_commands.asm +++ b/src/data/effect_commands.asm @@ -13,11 +13,14 @@ EffectCommands: ; 186f7 (6:46f7) ; - EFFECTCMDTYPE_DISCARD_ENERGY: For moves or trainer cards that require putting one or more attached energy cards into the discard pile. ; - EFFECTCMDTYPE_REQUIRE_SELECTION: For moves, Pokemon Powers, or trainer cards requring the user to select a card (from e.g. play area screen or card list). ; - EFFECTCMDTYPE_BEFORE_DAMAGE: Effect command of a move executed prior to the damage step. For trainer card or Pokemon Power, usually the main effect. -; - EFFECTCMDTYPE_AFTER_DAMAGE: Effect command executed after the damage step -; - EFFECTCMDTYPE_SWITCH_DEFENDING_PKMN: For moves that may result in the defending Pokemon being switched out -; - EFFECTCMDTYPE_PKMN_POWER_TRIGGER: Pokemon Power effects that trigger the moment the Pokemon card is played -; - EFFECTCMDTYPE_AI: Used for AI scoring -; - EFFECTCMDTYPE_UNKNOWN_08: Unknown +; - EFFECTCMDTYPE_AFTER_DAMAGE: Effect command executed after the damage step. +; - EFFECTCMDTYPE_AI_SWITCH_DEFENDING_PKMN: For moves that may result in the defending Pokemon being switched out. Called only for AI-executed moves. +; - EFFECTCMDTYPE_PKMN_POWER_TRIGGER: Pokemon Power effects that trigger the moment the Pokemon card is played. +; - EFFECTCMDTYPE_AI: Used for AI scoring. +; - EFFECTCMDTYPE_AI_SELECTION: When AI is required to select a card + +; Moves that have an EFFECTCMDTYPE_REQUIRE_SELECTION also must have either an EFFECTCMDTYPE_AI_SWITCH_DEFENDING_PKMN or an +; EFFECTCMDTYPE_AI_SELECTION (for anything not involving switching the defending Pokemon), to handle selections involving the AI. ; Similar move effects of different Pokemon cards all point to a different command list, ; even though in some cases their commands and function pointers match. @@ -44,7 +47,7 @@ EkansWrapEffectCommands: ArbokTerrorStrikeEffectCommands: dbw EFFECTCMDTYPE_AFTER_DAMAGE, TerrorStrike_SwitchDefendingPokemon dbw EFFECTCMDTYPE_REQUIRE_SELECTION, TerrorStrike_50PercentSelectSwitchPokemon - dbw EFFECTCMDTYPE_SWITCH_DEFENDING_PKMN, TerrorStrike_50PercentSelectSwitchPokemon + dbw EFFECTCMDTYPE_AI_SWITCH_DEFENDING_PKMN, TerrorStrike_50PercentSelectSwitchPokemon db $00 ArbokPoisonFangEffectCommands: @@ -58,10 +61,10 @@ WeepinbellPoisonPowderEffectCommands: db $00 VictreebelLureEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $4740 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $476a - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $474b - dbw EFFECTCMDTYPE_UNKNOWN_08, $4764 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, VictreebelLure_AssertPokemonInBench + dbw EFFECTCMDTYPE_AFTER_DAMAGE, VictreebelLure_SwitchDefendingPokemon + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, VictreebelLure_SelectSwitchPokemon + dbw EFFECTCMDTYPE_AI_SELECTION, VictreebelLure_GetBenchPokemonWithLowestHP db $00 VictreebelAcidEffectCommands: @@ -95,7 +98,7 @@ KakunaPoisonPowderEffectCommands: db $00 GolbatLeechLifeEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $47bc + dbw EFFECTCMDTYPE_AFTER_DAMAGE, GolbatLeechLifeEffect db $00 VenonatStunSporeEffectCommands: @@ -103,7 +106,7 @@ VenonatStunSporeEffectCommands: db $00 VenonatLeechLifeEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $47c6 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, VenonatLeechLifeEffect db $00 ScytherSwordsDanceEffectCommands: @@ -115,7 +118,7 @@ ZubatSupersonicEffectCommands: db $00 ZubatLeechLifeEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $47e3 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, ZubatLeechLifeEffect db $00 BeedrillTwineedleEffectCommands: @@ -125,7 +128,7 @@ BeedrillTwineedleEffectCommands: BeedrillPoisonStingEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Poison50PercentEffect - dbw EFFECTCMDTYPE_AI, $480d + dbw EFFECTCMDTYPE_AI, BeedrillPoisonSting_AIEffect db $00 ExeggcuteHypnosisEffectCommands: @@ -133,7 +136,7 @@ ExeggcuteHypnosisEffectCommands: db $00 ExeggcuteLeechSeedEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4815 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, ExeggcuteLeechSeedEffect db $00 KoffingFoulGasEffectCommands: @@ -154,17 +157,17 @@ OddishStunSporeEffectCommands: db $00 OddishSproutEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $484a - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $48cc - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $485a - dbw EFFECTCMDTYPE_UNKNOWN_08, $48b7 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Sprout_CheckDeckAndPlayArea + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Sprout_PutInPlayAreaEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Sprout_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Sprout_AISelectEffect db $00 ExeggutorTeleportEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $48ec - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $491a - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $48f7 - dbw EFFECTCMDTYPE_UNKNOWN_08, $490f + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Teleport_CheckBench + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Teleport_SwitchEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Teleport_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Teleport_AISelectEffect db $00 ExeggutorBigEggsplosionEffectCommands: @@ -174,7 +177,7 @@ ExeggutorBigEggsplosionEffectCommands: NidokingThrashEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Thrash_ModifierEffect - dbw EFFECTCMDTYPE_AFTER_DAMAGE, Func_2c982 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Thrash_LowRecoilEffect dbw EFFECTCMDTYPE_AI, Thrash_AIEffect db $00 @@ -184,48 +187,48 @@ NidokingToxicEffectCommands: db $00 NidoqueenBoyfriendsEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4998 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, BoyfriendsEffect db $00 -NidoranFFurySweepesEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $49c6 - dbw EFFECTCMDTYPE_AI, $49be +NidoranFFurySwipesEffectCommands: + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, NidoranFFurySwipes_MultiplierEffect + dbw EFFECTCMDTYPE_AI, NidoranFFurySwipes_AIEffect db $00 NidoranFCallForFamilyEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $49db - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4a6e - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $49eb - dbw EFFECTCMDTYPE_UNKNOWN_08, $4a55 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, NidoranFCallForFamily_CheckDeckAndPlayArea + dbw EFFECTCMDTYPE_AFTER_DAMAGE, NidoranFCallForFamily_PutInPlayAreaEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, NidoranFCallForFamily_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, NidoranFCallForFamily_AISelectEffect db $00 NidoranMHornHazardEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4a96 - dbw EFFECTCMDTYPE_AI, $4a8e + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, HornHazard_NoDamage50PercentEffect + dbw EFFECTCMDTYPE_AI, HornHazard_AIEffect db $00 NidorinaSupersonicEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4aac + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, NidorinaSupersonicEffect db $00 NidorinaDoubleKickEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4abb - dbw EFFECTCMDTYPE_AI, $4ab3 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, NidorinaDoubleKick_MultiplierEffect + dbw EFFECTCMDTYPE_AI, NidorinaDoubleKick_AIEffect db $00 NidorinoDoubleKickEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4adb - dbw EFFECTCMDTYPE_AI, $4ad3 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, NidorinoDoubleKick_MultiplierEffect + dbw EFFECTCMDTYPE_AI, NidorinoDoubleKick_AIEffect db $00 ButterfreeWhirlwindEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4b09 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $4af3 - dbw EFFECTCMDTYPE_SWITCH_DEFENDING_PKMN, $4af3 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, ButterfreeWhirlwind_SwitchEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, ButterfreeWhirlwind_CheckBench + dbw EFFECTCMDTYPE_AI_SWITCH_DEFENDING_PKMN, ButterfreeWhirlwind_CheckBench db $00 ButterfreeMegaDrainEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4b0f + dbw EFFECTCMDTYPE_AFTER_DAMAGE, ButterfreeMegaDrainEffect db $00 ParasSporeEffectCommands: @@ -238,23 +241,23 @@ ParasectSporeEffectCommands: WeedlePoisonStingEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Poison50PercentEffect - dbw EFFECTCMDTYPE_AI, $4b27 + dbw EFFECTCMDTYPE_AI, WeedlePoisonSting_AIEffect db $00 IvysaurPoisonPowderEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PoisonEffect - dbw EFFECTCMDTYPE_AI, $4b2f + dbw EFFECTCMDTYPE_AI, IvysaurPoisonPowder_AIEffect db $00 BulbasaurLeechSeedEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4b37 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, BulbasaurLeechSeedEffect db $00 VenusaurEnergyTransEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $4b44 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4b77 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4bfb - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $4b6f + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, EnergyTrans_CheckPlayArea + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, EnergyTrans_TransferEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, EnergyTrans_AIEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, EnergyTrans_PrintProcedure db $00 GrimerNastyGooEffectCommands: @@ -262,43 +265,43 @@ GrimerNastyGooEffectCommands: db $00 GrimerMinimizeEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4c30 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, GrimerMinimizeEffect db $00 MukToxicGasEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $4c36 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ToxicGasEffect db $00 MukSludgeEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Poison50PercentEffect - dbw EFFECTCMDTYPE_AI, $4c38 + dbw EFFECTCMDTYPE_AI, Sludge_AIEffect db $00 BellsproutCallForFamilyEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $4c40 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4cc2 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $4c50 - dbw EFFECTCMDTYPE_UNKNOWN_08, $4cad + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, BellsproutCallForFamily_CheckDeckAndPlayArea + dbw EFFECTCMDTYPE_AFTER_DAMAGE, BellsproutCallForFamily_PutInPlayAreaEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, BellsproutCallForFamily_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, BellsproutCallForFamily_AISelectEffect db $00 WeezingSmogEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Poison50PercentEffect - dbw EFFECTCMDTYPE_AI, $4ce2 + dbw EFFECTCMDTYPE_AI, WeezingSmog_AIEffect db $00 WeezingSelfdestructEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4cea + dbw EFFECTCMDTYPE_AFTER_DAMAGE, WeezingSelfdestructEffect db $00 VenomothShiftEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $4d09 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4d5d - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $4d21 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Shift_OncePerTurnCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Shift_ChangeColorEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Shift_PlayerSelectEffect db $00 VenomothVenomPowderEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4d8c - dbw EFFECTCMDTYPE_AI, $4d84 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, VenomPowder_PoisonConfusion50PercentEffect + dbw EFFECTCMDTYPE_AI, VenomPowder_AIEffect db $00 TangelaBindEffectCommands: @@ -307,17 +310,17 @@ TangelaBindEffectCommands: TangelaPoisonPowderEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PoisonEffect - dbw EFFECTCMDTYPE_AI, $4da0 + dbw EFFECTCMDTYPE_AI, TangelaPoisonPowder_AIEffect db $00 VileplumeHealEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $4da8 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4dc7 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Heal_OncePerTurnCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Heal_RemoveDamageEffect db $00 VileplumePetalDanceEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4e2b - dbw EFFECTCMDTYPE_AI, $4e23 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PetalDance_MultiplierEffect + dbw EFFECTCMDTYPE_AI, PetalDance_AIEffect db $00 TangelaStunSporeEffectCommands: @@ -326,48 +329,48 @@ TangelaStunSporeEffectCommands: TangelaPoisonWhipEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PoisonEffect - dbw EFFECTCMDTYPE_AI, $4e4b + dbw EFFECTCMDTYPE_AI, PoisonWhip_AIEffect db $00 VenusaurSolarPowerEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $4e53 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4e82 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, SolarPower_CheckUse + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SolarPower_RemoveStatusEffect db $00 VenusaurMegaDrainEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4eb0 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, VenusaurMegaDrainEffect db $00 OmastarWaterGunEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4f05 - dbw EFFECTCMDTYPE_AI, $4f05 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, OmastarWaterGunEffect + dbw EFFECTCMDTYPE_AI, OmastarWaterGunEffect db $00 OmastarSpikeCannonEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4f12 - dbw EFFECTCMDTYPE_AI, $4f0a + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, OmastarSpikeCannon_MultiplierEffect + dbw EFFECTCMDTYPE_AI, OmastarSpikeCannon_AIEffect db $00 OmanyteClairvoyanceEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $4f2a + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ClairvoyanceEffect db $00 OmanyteWaterGunEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4f2c - dbw EFFECTCMDTYPE_AI, $4f2c + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, OmanyteWaterGunEffect + dbw EFFECTCMDTYPE_AI, OmanyteWaterGunEffect db $00 WartortleWithdrawEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4f32 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, WartortleWithdrawEffect db $00 BlastoiseRainDanceEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $4f46 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, RainDanceEffect db $00 BlastoiseHydroPumpEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4f48 - dbw EFFECTCMDTYPE_AI, $4f48 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, HydroPumpEffect + dbw EFFECTCMDTYPE_AI, HydroPumpEffect db $00 GyaradosBubblebeamEffectCommands: @@ -375,29 +378,29 @@ GyaradosBubblebeamEffectCommands: db $00 KinglerFlailEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $4f54 - dbw EFFECTCMDTYPE_AI, $4f4e + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, KinglerFlail_HPCheck + dbw EFFECTCMDTYPE_AI, KinglerFlail_AIEffect db $00 KrabbyCallForFamilyEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $4f5d - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $4fdf - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $4f6d - dbw EFFECTCMDTYPE_UNKNOWN_08, $4fca + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, KrabbyCallForFamily_CheckDeckAndPlayArea + dbw EFFECTCMDTYPE_AFTER_DAMAGE, KrabbyCallForFamily_PutInPlayAreaEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, KrabbyCallForFamily_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, KrabbyCallForFamily_AISelectEffect db $00 MagikarpFlailEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5005 - dbw EFFECTCMDTYPE_AI, $4fff + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, MagikarpFlail_HPCheck + dbw EFFECTCMDTYPE_AI, MagikarpFlail_AIEffect db $00 PsyduckHeadacheEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $500e + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, HeadacheEffect db $00 -PsyduckFurySweepesEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $501e - dbw EFFECTCMDTYPE_AI, $5016 +PsyduckFurySwipesEffectCommands: + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PsyduckFurySwipes_MultiplierEffect + dbw EFFECTCMDTYPE_AI, PsyduckFurySwipes_AIEffect db $00 GolduckPsyshockEffectCommands: @@ -405,36 +408,36 @@ GolduckPsyshockEffectCommands: db $00 GolduckHyperBeamEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $506b - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $5033 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5065 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, GolduckHyperBeam_DiscardEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, GolduckHyperBeam_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, GolduckHyperBeam_AISelectEffect db $00 SeadraWaterGunEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5085 - dbw EFFECTCMDTYPE_AI, $5085 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SeadraWaterGunEffect + dbw EFFECTCMDTYPE_AI, SeadraWaterGunEffect db $00 SeadraAgilityEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $508b + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SeadraAgilityEffect db $00 ShellderSupersonicEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $509d + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ShellderSupersonicEffect db $00 ShellderHideInShellEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $50a4 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, HideInShellEffect db $00 VaporeonQuickAttackEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $50c0 - dbw EFFECTCMDTYPE_AI, $50b8 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, VaporeonQuickAttack_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, VaporeonQuickAttack_AIEffect db $00 VaporeonWaterGunEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $50d3 - dbw EFFECTCMDTYPE_AI, $50d3 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, VaporeonWaterGunEffect + dbw EFFECTCMDTYPE_AI, VaporeonWaterGunEffect db $00 DewgongIceBeamEffectCommands: @@ -442,11 +445,11 @@ DewgongIceBeamEffectCommands: db $00 StarmieRecoverEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $50d9 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $50f0 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5114 - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $510e - dbw EFFECTCMDTYPE_UNKNOWN_08, $5103 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, StarmieRecover_CheckEnergyHP + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, StarmieRecover_PlayerSelectEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, StarmieRecover_HealEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, StarmieRecover_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, StarmieRecover_AISelectEffect db $00 StarmieStarFreezeEffectCommands: @@ -458,57 +461,57 @@ SquirtleBubbleEffectCommands: db $00 SquirtleWithdrawEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5120 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SquirtleWithdrawEffect db $00 HorseaSmokescreenEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5134 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, HorseaSmokescreenEffect db $00 TentacruelSupersonicEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $513a + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, TentacruelSupersonicEffect db $00 TentacruelJellyfishStingEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PoisonEffect - dbw EFFECTCMDTYPE_AI, $5141 + dbw EFFECTCMDTYPE_AI, JellyfishSting_AIEffect db $00 PoliwhirlAmnesiaEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5149 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $516f - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5179 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5173 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, PoliwhirlAmnesia_CheckAttacks + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, PoliwhirlAmnesia_PlayerSelectEffect + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PoliwhirlAmnesia_DisableEffect + dbw EFFECTCMDTYPE_AI_SELECTION, PoliwhirlAmnesia_AISelectEffect db $00 PoliwhirlDoubleslapEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $51c8 - dbw EFFECTCMDTYPE_AI, $51c0 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PoliwhirlDoubleslap_MultiplierEffect + dbw EFFECTCMDTYPE_AI, PoliwhirlDoubleslap_AIEffect db $00 PoliwrathWaterGunEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $51e0 - dbw EFFECTCMDTYPE_AI, $51e0 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PoliwrathWaterGunEffect + dbw EFFECTCMDTYPE_AI, PoliwrathWaterGunEffect db $00 PoliwrathWhirlpoolEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5214 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $51e6 - dbw EFFECTCMDTYPE_UNKNOWN_08, $520e + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Whirlpool_DiscardEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Whirlpool_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Whirlpool_AISelectEffect db $00 PoliwagWaterGunEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5227 - dbw EFFECTCMDTYPE_AI, $5227 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PoliwagWaterGunEffect + dbw EFFECTCMDTYPE_AI, PoliwagWaterGunEffect db $00 CloysterClampEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $522d + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ClampEffect db $00 CloysterSpikeCannonEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $524e - dbw EFFECTCMDTYPE_AI, $5246 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, CloysterSpikeCannon_MultiplierEffect + dbw EFFECTCMDTYPE_AI, CloysterSpikeCannon_AIEffect db $00 ArticunoFreezeDryEffectCommands: @@ -516,19 +519,19 @@ ArticunoFreezeDryEffectCommands: db $00 ArticunoBlizzardEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5266 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $526f + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Blizzard_BenchDamage50PercentEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Blizzard_BenchDamageEffect db $00 TentacoolCowardiceEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $528b - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $52c3 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $52ae + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Cowardice_Check + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Cowardice_RemoveFromPlayAreaEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Cowardice_PlayerSelectEffect db $00 LaprasWaterGunEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $52eb - dbw EFFECTCMDTYPE_AI, $52eb + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, LaprasWaterGunEffect + dbw EFFECTCMDTYPE_AI, LaprasWaterGunEffect db $00 LaprasConfuseRayEffectCommands: @@ -536,131 +539,131 @@ LaprasConfuseRayEffectCommands: db $00 ArticunoQuickfreezeEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $52f1 - dbw EFFECTCMDTYPE_PKMN_POWER_TRIGGER, $52f3 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Quickfreeze_InitialEffect + dbw EFFECTCMDTYPE_PKMN_POWER_TRIGGER, Quickfreeze_Paralysis50PercentEffect db $00 ArticunoIceBreathEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5329 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $532e + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, IceBreath_ZeroDamage + dbw EFFECTCMDTYPE_AFTER_DAMAGE, IceBreath_RandomPokemonDamageEffect db $00 VaporeonFocusEnergyEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $533f + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, FocusEnergyEffect db $00 ArcanineFlamethrowerEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5363 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $5371 - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $5379 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5375 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ArcanineFlamethrower_CheckEnergy + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, ArcanineFlamethrower_PlayerSelectEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, ArcanineFlamethrower_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, ArcanineFlamethrower_AISelectEffect db $00 ArcanineTakeDownEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $537f + dbw EFFECTCMDTYPE_AFTER_DAMAGE, TakeDownEffect db $00 ArcanineQuickAttackEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $538d - dbw EFFECTCMDTYPE_AI, $5385 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ArcanineQuickAttack_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, ArcanineQuickAttack_AIEffect db $00 ArcanineFlamesOfRageEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $53a0 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $53ae - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $53ef - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $53de - dbw EFFECTCMDTYPE_UNKNOWN_08, $53d5 - dbw EFFECTCMDTYPE_AI, $53e9 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, FlamesOfRage_CheckEnergy + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, FlamesOfRage_PlayerSelectEffect + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, FlamesOfRage_DamageBoostEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, FlamesOfRage_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, FlamesOfRage_AISelectEffect + dbw EFFECTCMDTYPE_AI, FlamesOfRage_AIEffect db $00 RapidashStompEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5400 - dbw EFFECTCMDTYPE_AI, $53f8 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, RapidashStomp_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, RapidashStomp_AIEffect db $00 RapidashAgilityEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5413 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, RapidashAgilityEffect db $00 NinetailsLureEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5425 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $544f - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $5430 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5449 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, NinetailsLure_CheckBench + dbw EFFECTCMDTYPE_AFTER_DAMAGE, NinetailsLure_SwitchEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, NinetailsLure_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, NinetailsLure_AISelectEffect db $00 NinetailsFireBlastEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5463 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $5471 - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $5479 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5475 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, FireBlast_CheckEnergy + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, FireBlast_PlayerSelectEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, FireBlast_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, FireBlast_AISelectEffect db $00 CharmanderEmberEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $547f - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $548d - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $5495 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5491 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Ember_CheckEnergy + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Ember_PlayerSelectEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, Ember_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Ember_AISelectEffect db $00 MoltresWildfireEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $549b - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $54a9 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $54f4 - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $54e1 - dbw EFFECTCMDTYPE_UNKNOWN_08, $54dd + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Wildfire_CheckEnergy + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Wildfire_PlayerSelectEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Wildfire_DiscardDeckEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, Wildfire_DiscardEnergyEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Wildfire_AISelectEffect db $00 Moltres1DiveBombEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $552b - dbw EFFECTCMDTYPE_AI, $5523 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Moltres1DiveBomb_Success50PercentEffect + dbw EFFECTCMDTYPE_AI, Moltres1DiveBomb_AIEffect db $00 FlareonQuickAttackEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5549 - dbw EFFECTCMDTYPE_AI, $5541 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, FlareonQuickAttack_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, FlareonQuickAttack_AIEffect db $00 FlareonFlamethrowerEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $555c - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $556a - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $5572 - dbw EFFECTCMDTYPE_UNKNOWN_08, $556e + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, FlareonFlamethrower_CheckEnergy + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, FlareonFlamethrower_PlayerSelectEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, FlareonFlamethrower_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, FlareonFlamethrower_AISelectEffect db $00 MagmarFlamethrowerEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5578 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $5586 - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $558e - dbw EFFECTCMDTYPE_UNKNOWN_08, $558a + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, MagmarFlamethrower_CheckEnergy + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, MagmarFlamethrower_PlayerSelectEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, MagmarFlamethrower_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, MagmarFlamethrower_AISelectEffect db $00 MagmarSmokescreenEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5594 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, MagmarSmokescreenEffect db $00 MagmarSmogEffectCommands: dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Poison50PercentEffect - dbw EFFECTCMDTYPE_AI, $559a + dbw EFFECTCMDTYPE_AI, MagmarSmog_AIEffect db $00 CharmeleonFlamethrowerEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $55a2 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $55b0 - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $55b8 - dbw EFFECTCMDTYPE_UNKNOWN_08, $55b4 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, CharmeleonFlamethrower_CheckEnergy + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, CharmeleonFlamethrower_PlayerSelectEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, CharmeleonFlamethrower_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, CharmeleonFlamethrower_AISelectEffect db $00 CharizardEnergyBurnEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $55be + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, EnergyBurnEffect db $00 CharizardFireSpinEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $55c0 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $55cd - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $5614 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5606 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, FireSpin_CheckEnergy + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, FireSpin_PlayerSelectEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, FireSpin_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, FireSpin_AISelectEffect db $00 VulpixConfuseRayEffectCommands: @@ -668,27 +671,27 @@ VulpixConfuseRayEffectCommands: db $00 FlareonRageEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $563e - dbw EFFECTCMDTYPE_AI, $5638 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, FlareonRage_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, FlareonRage_AIEffect db $00 NinetailsMixUpEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5647 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, MixUpEffect db $00 NinetailsDancingEmbersEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $56ab - dbw EFFECTCMDTYPE_AI, $56a3 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, DancingEmbers_MultiplierEffect + dbw EFFECTCMDTYPE_AI, DancingEmbers_AIEffect db $00 MoltresFiregiverEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $56c0 - dbw EFFECTCMDTYPE_PKMN_POWER_TRIGGER, $56c2 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Firegiver_InitialEffect + dbw EFFECTCMDTYPE_PKMN_POWER_TRIGGER, Firegiver_AddToHandEffect db $00 Moltres2DiveBombEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5776 - dbw EFFECTCMDTYPE_AI, $576e + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Moltres2DiveBomb_Success50PercentEffect + dbw EFFECTCMDTYPE_AI, Moltres2DiveBomb_AIEffect db $00 AbraPsyshockEffectCommands: @@ -696,27 +699,27 @@ AbraPsyshockEffectCommands: db $00 GengarCurseEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $57fc - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $58bb - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $5834 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Curse_CheckDamageAndBench + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Curse_TransferDamageEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Curse_PlayerSelectEffect db $00 GengarDarkMindEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $593c - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $5903 - dbw EFFECTCMDTYPE_UNKNOWN_08, $592a + dbw EFFECTCMDTYPE_AFTER_DAMAGE, GengarDarkMind_DamageBenchEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, GengarDarkMind_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, GengarDarkMind_AISelectEffect db $00 GastlySleepingGasEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $594f + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SleepingGasEffect db $00 GastlyDestinyBondEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5956 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $5964 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5987 - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $5981 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5976 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, DestinyBond_CheckEnergy + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, DestinyBond_PlayerSelectEffect + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, DestinyBond_DestinyBondEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, DestinyBond_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, DestinyBond_AISelectEffect db $00 GastlyLickEffectCommands: @@ -724,10 +727,10 @@ GastlyLickEffectCommands: db $00 GastlyEnergyConversionEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $598d - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $59b4 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $5994 - dbw EFFECTCMDTYPE_UNKNOWN_08, $599b + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, EnergyConversion_CheckEnergy + dbw EFFECTCMDTYPE_AFTER_DAMAGE, EnergyConversion_AddToHandEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, EnergyConversion_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, EnergyConversion_AISelectEffect db $00 HaunterHypnosisEffectCommands: @@ -735,11 +738,11 @@ HaunterHypnosisEffectCommands: db $00 HaunterDreamEaterEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $59d6 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, DreamEaterEffect db $00 HaunterTransparencyEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $59e5 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, TransparencyEffect db $00 HaunterNightmareEffectCommands: @@ -747,16 +750,16 @@ HaunterNightmareEffectCommands: db $00 HypnoProphecyEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $59e7 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5a41 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $5a00 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5a3c + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Prophecy_CheckDeck + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Prophecy_ReorderDeckEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Prophecy_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Prophecy_AISelectEffect db $00 HypnoDarkMindEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5b64 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $5b2b - dbw EFFECTCMDTYPE_UNKNOWN_08, $5b52 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, HypnoDarkMind_DamageBenchEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, HypnoDarkMind_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, HypnoDarkMind_AISelectEffect db $00 DrowzeeConfuseRayEffectCommands: @@ -764,18 +767,18 @@ DrowzeeConfuseRayEffectCommands: db $00 MrMimeInvisibleWallEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5b77 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, InvisibleWallEffect db $00 MrMimeMeditateEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5b7f - dbw EFFECTCMDTYPE_AI, $5b79 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, MrMimeMeditate_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, MrMimeMeditate_AIEffect db $00 AlakazamDamageSwapEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $5b8e - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5ba2 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5c27 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, DamageSwap_CheckDamage + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, DamageSwap_SelectAndSwapEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, DamageSwap_SwapEffect db $00 AlakazamConfuseRayEffectCommands: @@ -783,19 +786,19 @@ AlakazamConfuseRayEffectCommands: db $00 MewPsywaveEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5c49 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PsywaveEffect db $00 MewDevolutionBeamEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5c53 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $5c64 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5cb6 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5cbb - dbw EFFECTCMDTYPE_UNKNOWN_08, $5c9e + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, DevolutionBeam_CheckPlayArea + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, DevolutionBeam_PlayerSelectEffect + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, DevolutionBeam_LoadAnimation + dbw EFFECTCMDTYPE_AFTER_DAMAGE, DevolutionBeam_DevolveEffect + dbw EFFECTCMDTYPE_AI_SELECTION, DevolutionBeam_AISelectEffect db $00 MewNeutralizingShieldEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5d79 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, NeutralizingShieldEffect db $00 MewPsyshockEffectCommands: @@ -803,36 +806,36 @@ MewPsyshockEffectCommands: db $00 MewtwoPsychicEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5d81 - dbw EFFECTCMDTYPE_AI, $5d7b + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Psychic_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, Psychic_AIEffect db $00 MewtwoBarrierEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5d8e - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $5d9c - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5dbf - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $5db9 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5dae + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Barrier_CheckEnergy + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Barrier_PlayerSelectEffect + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Barrier_BarrierEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, Barrier_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Barrier_AISelectEffect db $00 Mewtwo3EnergyAbsorptionEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5dc5 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5dec - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $5dcc - dbw EFFECTCMDTYPE_UNKNOWN_08, $5dd3 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Mewtwo3EnergyAbsorption_CheckDiscardPile + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Mewtwo3EnergyAbsorption_AddToHandEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Mewtwo3EnergyAbsorption_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Mewtwo3EnergyAbsorption_AISelectEffect db $00 Mewtwo2EnergyAbsorptionEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5dff - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5e26 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $5e06 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5e0d + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Mewtwo2EnergyAbsorption_CheckDiscardPile + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Mewtwo2EnergyAbsorption_AddToHandEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Mewtwo2EnergyAbsorption_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Mewtwo2EnergyAbsorption_AISelectEffect db $00 SlowbroStrangeBehaviorEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $5e39 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5e5b - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5eb3 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, StrangeBehavior_CheckDamage + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, StrangeBehavior_SelectAndSwapEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, StrangeBehavior_SwapEffect db $00 SlowbroPsyshockEffectCommands: @@ -840,165 +843,165 @@ SlowbroPsyshockEffectCommands: db $00 SlowpokeSpacingOutEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5ed5 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5ee0 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5ef1 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, SpacingOut_CheckDamage + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SpacingOut_Success50PercentEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, SpacingOut_HealEffect db $00 SlowpokeScavengeEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5f05 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $5f1a - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5f5f - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $5f46 - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $5f40 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5f2d + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Scavenge_CheckDiscardPile + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Scavenge_PlayerSelectEnergyEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Scavenge_AddToHandEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Scavenge_PlayerSelectTrainerEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, Scavenge_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Scavenge_AISelectEffect db $00 SlowpokeAmnesiaEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5f74 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $5f7b - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5f85 - dbw EFFECTCMDTYPE_UNKNOWN_08, $5f7f + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, SlowpokeAmnesia_CheckAttacks + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, SlowpokeAmnesia_PlayerSelectEffect + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SlowpokeAmnesia_DisableEffect + dbw EFFECTCMDTYPE_AI_SELECTION, SlowpokeAmnesia_AISelectEffect db $00 KadabraRecoverEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $5f89 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $5fa0 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $5fc3 - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $5fbd - dbw EFFECTCMDTYPE_UNKNOWN_08, $5fb2 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, KadabraRecover_CheckEnergyHP + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, KadabraRecover_PlayerSelectEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, KadabraRecover_HealEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, KadabraRecover_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, KadabraRecover_AISelectEffect db $00 JynxDoubleslapEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5fd7 - dbw EFFECTCMDTYPE_AI, $5fcf + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, JynxDoubleslap_MultiplierEffect + dbw EFFECTCMDTYPE_AI, JynxDoubleslap_AIEffect db $00 JynxMeditateEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $5ff2 - dbw EFFECTCMDTYPE_AI, $5fec + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, JynxMeditate_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, JynxMeditate_AIEffect db $00 MewMysteryAttackEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6009 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $603e - dbw EFFECTCMDTYPE_AI, $6001 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, MysteryAttack_RandomEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, MysteryAttack_RecoverEffect + dbw EFFECTCMDTYPE_AI, MysteryAttack_AIEffect db $00 GeodudeStoneBarrageEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6052 - dbw EFFECTCMDTYPE_AI, $604a + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, StoneBarrage_MultiplierEffect + dbw EFFECTCMDTYPE_AI, StoneBarrage_AIEffect db $00 OnixHardenEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6075 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, OnixHardenEffect db $00 -PrimeapeFurySweepesEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6083 - dbw EFFECTCMDTYPE_AI, $607b +PrimeapeFurySwipesEffectCommands: + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PrimeapeFurySwipes_MultiplierEffect + dbw EFFECTCMDTYPE_AI, PrimeapeFurySwipes_AIEffect db $00 PrimeapeTantrumEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6099 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, TantrumEffect db $00 MachampStrikesBackEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $60af + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, StrikesBackEffect db $00 KabutoKabutoArmorEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $60b1 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, KabutoArmorEffect db $00 KabutopsAbsorbEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $60b3 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, AbsorbEffect db $00 CuboneSnivelEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $60cb + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SnivelEffect db $00 CuboneRageEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $60d7 - dbw EFFECTCMDTYPE_AI, $60d1 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, CuboneRage_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, CuboneRage_AIEffect db $00 MarowakBonemerangEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $60e8 - dbw EFFECTCMDTYPE_AI, $60e0 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Bonemerang_MultiplierEffect + dbw EFFECTCMDTYPE_AI, Bonemerang_AIEffect db $00 MarowakCallforFriendEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6100 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6194 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $6110 - dbw EFFECTCMDTYPE_UNKNOWN_08, $6177 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, MarowakCallForFamily_CheckDeckAndPlayArea + dbw EFFECTCMDTYPE_AFTER_DAMAGE, MarowakCallForFamily_PutInPlayAreaEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, MarowakCallForFamily_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, MarowakCallForFamily_AISelectEffect db $00 MachokeKarateChopEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $61ba - dbw EFFECTCMDTYPE_AI, $61b4 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, KarateChop_DamageSubtractionEffect + dbw EFFECTCMDTYPE_AI, KarateChop_AIEffect db $00 MachokeSubmissionEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $61d1 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, SubmissionEffect db $00 GolemSelfdestructEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $61d7 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, GolemSelfdestructEffect db $00 GravelerHardenEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $61f6 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, GravelerHardenEffect db $00 RhydonRamEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6212 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $61fc - dbw EFFECTCMDTYPE_SWITCH_DEFENDING_PKMN, $61fc + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Ram_RecoilSwitchEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Ram_SelectSwitchEffect + dbw EFFECTCMDTYPE_AI_SWITCH_DEFENDING_PKMN, Ram_SelectSwitchEffect db $00 RhyhornLeerEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $621d + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, LeerEffect db $00 HitmonleeStretchKickEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6231 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $625b - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $623c - dbw EFFECTCMDTYPE_UNKNOWN_08, $6255 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, StretchKick_CheckBench + dbw EFFECTCMDTYPE_AFTER_DAMAGE, StretchKick_BenchDamageEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, StretchKick_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, StretchKick_AISelectEffect db $00 SandshrewSandAttackEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $626b + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SandAttackEffect db $00 -SandslashFurySweepesEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6279 - dbw EFFECTCMDTYPE_AI, $6271 +SandslashFurySwipesEffectCommands: + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SandslashFurySwipes_MultiplierEffect + dbw EFFECTCMDTYPE_AI, SandslashFurySwipes_AIEffect db $00 DugtrioEarthquakeEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $628f + dbw EFFECTCMDTYPE_AFTER_DAMAGE, EarthquakeEffect db $00 AerodactylPrehistoricPowerEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $629a + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, PrehistoricPowerEffect db $00 MankeyPeekEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $629c - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $62b4 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Peek_OncePerTurnCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Peek_SelectEffect db $00 MarowakBoneAttackEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $630f + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, BoneAttackEffect db $00 MarowakWailEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $631c - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6335 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Wail_BenchCheck + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Wail_FillBenchEffect db $00 ElectabuzzThundershockEffectCommands: @@ -1006,18 +1009,18 @@ ElectabuzzThundershockEffectCommands: db $00 ElectabuzzThunderpunchEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $63a1 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $63b0 - dbw EFFECTCMDTYPE_AI, $6399 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Thunderpunch_ModifierEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Thunderpunch_RecoilEffect + dbw EFFECTCMDTYPE_AI, Thunderpunch_AIEffect db $00 ElectabuzzLightScreenEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $63ba + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, LightScreenEffect db $00 ElectabuzzQuickAttackEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $63c8 - dbw EFFECTCMDTYPE_AI, $63c0 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ElectabuzzQuickAttack_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, ElectabuzzQuickAttack_AIEffect db $00 MagnemiteThunderWaveEffectCommands: @@ -1025,30 +1028,30 @@ MagnemiteThunderWaveEffectCommands: db $00 MagnemiteSelfdestructEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $63db + dbw EFFECTCMDTYPE_AFTER_DAMAGE, MagnemiteSelfdestructEffect db $00 ZapdosThunderEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $63fa - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6409 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ZapdosThunder_Recoil50PercentEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, ZapdosThunder_RecoilEffect db $00 ZapdosThunderboltEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6419 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ThunderboltEffect db $00 ZapdosThunderstormEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6429 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, ThunderstormEffect db $00 JolteonQuickAttackEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $64c3 - dbw EFFECTCMDTYPE_AI, $64bb + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, JolteonQuickAttack_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, JolteonQuickAttack_AIEffect db $00 JolteonPinMissileEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $64de - dbw EFFECTCMDTYPE_AI, $64d6 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PinMissile_MultiplierEffect + dbw EFFECTCMDTYPE_AI, PinMissile_AIEffect db $00 FlyingPikachuThundershockEffectCommands: @@ -1056,23 +1059,23 @@ FlyingPikachuThundershockEffectCommands: db $00 FlyingPikachuFlyEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $64fc - dbw EFFECTCMDTYPE_AI, $64f4 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Fly_Success50PercentEffect + dbw EFFECTCMDTYPE_AI, Fly_AIEffect db $00 PikachuThunderJoltEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $651a - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6529 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ThunderJolt_Recoil50PercentEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, ThunderJolt_RecoilEffect db $00 PikachuSparkEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6574 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $6539 - dbw EFFECTCMDTYPE_UNKNOWN_08, $6562 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Spark_BenchDamageEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Spark_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Spark_AISelectEffect db $00 Pikachu3GrowlEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6589 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Pikachu3GrowlEffect db $00 Pikachu3ThundershockEffectCommands: @@ -1080,7 +1083,7 @@ Pikachu3ThundershockEffectCommands: db $00 Pikachu4GrowlEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $658f + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Pikachu4GrowlEffect db $00 Pikachu4ThundershockEffectCommands: @@ -1088,22 +1091,22 @@ Pikachu4ThundershockEffectCommands: db $00 ElectrodeChainLightningEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6595 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, ChainLightningEffect db $00 RaichuAgilityEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $65dc + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, RaichuAgilityEffect db $00 RaichuThunderEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $65ee - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $65fd + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, RaichuThunder_Recoil50PercentEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, RaichuThunder_RecoilEffect db $00 RaichuGigashockEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $671f - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $660d - dbw EFFECTCMDTYPE_UNKNOWN_08, $66c3 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Gigashock_BenchDamageEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Gigashock_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Gigashock_AISelectEffect db $00 MagnetonThunderWaveEffectCommands: @@ -1111,48 +1114,48 @@ MagnetonThunderWaveEffectCommands: db $00 Magneton1SelfdestructEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6739 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Magneton1SelfdestructEffect db $00 MagnetonSonicboomEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6758 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $675e - dbw EFFECTCMDTYPE_AI, $6758 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, MagnetonSonicboom_UnaffectedByColorEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, MagnetonSonicboom_NullEffect + dbw EFFECTCMDTYPE_AI, MagnetonSonicboom_UnaffectedByColorEffect db $00 Magneton2SelfdestructEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $675f + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Magneton2SelfdestructEffect db $00 ZapdosPealOfThunderEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $677e - dbw EFFECTCMDTYPE_PKMN_POWER_TRIGGER, $6780 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, PealOfThunder_InitialEffect + dbw EFFECTCMDTYPE_PKMN_POWER_TRIGGER, PealOfThunder_RandomlyDamageEffect db $00 ZapdosBigThunderEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $67cb + dbw EFFECTCMDTYPE_AFTER_DAMAGE, BigThunderEffect db $00 MagnemiteMagneticStormEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $67d5 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, MagneticStormEffect db $00 ElectrodeSonicboomEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6870 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6876 - dbw EFFECTCMDTYPE_AI, $6870 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ElectrodeSonicboom_UnaffectedByColorEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, ElectrodeSonicboom_NullEffect + dbw EFFECTCMDTYPE_AI, ElectrodeSonicboom_UnaffectedByColorEffect db $00 ElectrodeEnergySpikeEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6877 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $68f6 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $687b - dbw EFFECTCMDTYPE_UNKNOWN_08, $68f1 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, EnergySpike_DeckCheck + dbw EFFECTCMDTYPE_AFTER_DAMAGE, EnergySpike_AttachEnergyEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, EnergySpike_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, EnergySpike_AISelectEffect db $00 JolteonDoubleKickEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6938 - dbw EFFECTCMDTYPE_AI, $6930 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, JolteonDoubleKick_MultiplierEffect + dbw EFFECTCMDTYPE_AI, JolteonDoubleKick_AIEffect db $00 JolteonStunNeedleEffectCommands: @@ -1160,40 +1163,40 @@ JolteonStunNeedleEffectCommands: db $00 EeveeTailWagEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $694e + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, TailWagEffect db $00 EeveeQuickAttackEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $696a - dbw EFFECTCMDTYPE_AI, $6962 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, EeveeQuickAttack_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, EeveeQuickAttack_AIEffect db $00 SpearowMirrorMoveEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $697f - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $6981 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6987 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6989 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $6983 - dbw EFFECTCMDTYPE_UNKNOWN_08, $6985 - dbw EFFECTCMDTYPE_AI, $697d + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, SpearowMirrorMove_InitialEffect1 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, SpearowMirrorMove_InitialEffect2 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SpearowMirrorMove_BeforeDamage + dbw EFFECTCMDTYPE_AFTER_DAMAGE, SpearowMirrorMove_AfterDamage + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, SpearowMirrorMove_PlayerSelection + dbw EFFECTCMDTYPE_AI_SELECTION, SpearowMirrorMove_AISelection + dbw EFFECTCMDTYPE_AI, SpearowMirrorMove_AIEffect db $00 FearowAgilityEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6ab8 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, FearowAgilityEffect db $00 DragoniteStepInEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $6aca - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6ae8 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, StepIn_BenchCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, StepIn_SwitchEffect db $00 Dragonite2SlamEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6afe - dbw EFFECTCMDTYPE_AI, $6af6 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Dragonite2Slam_MultiplierEffect + dbw EFFECTCMDTYPE_AI, Dragonite2Slam_AIEffect db $00 SnorlaxThickSkinnedEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6b15 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ThickSkinnedEffect db $00 SnorlaxBodySlamEffectCommands: @@ -1201,98 +1204,98 @@ SnorlaxBodySlamEffectCommands: db $00 FarfetchdLeekSlapEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6b1f - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6b34 - dbw EFFECTCMDTYPE_DISCARD_ENERGY, $6b2c - dbw EFFECTCMDTYPE_AI, $6b17 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, LeekSlap_OncePerDuelCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, LeekSlap_NoDamage50PercentEffect + dbw EFFECTCMDTYPE_DISCARD_ENERGY, LeekSlap_SetUsedThisDuelFlag + dbw EFFECTCMDTYPE_AI, LeekSlap_AIEffect db $00 KangaskhanFetchEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6b40 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, FetchEffect db $00 KangaskhanCometPunchEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6b65 - dbw EFFECTCMDTYPE_AI, $6b5d + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, CometPunch_MultiplerEffect + dbw EFFECTCMDTYPE_AI, CometPunch_AIEffect db $00 TaurosStompEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6b83 - dbw EFFECTCMDTYPE_AI, $6b7b + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, TaurosStomp_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, TaurosStomp_AIEffect db $00 TaurosRampageEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6ba1 - dbw EFFECTCMDTYPE_AI, $6b96 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Rampage_Confusion50PercentEffect + dbw EFFECTCMDTYPE_AI, Rampage_AIEffect db $00 DoduoFuryAttackEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6bc2 - dbw EFFECTCMDTYPE_AI, $6bba + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, FuryAttack_MultiplerEffect + dbw EFFECTCMDTYPE_AI, FuryAttack_AIEffect db $00 DodrioRetreatAidEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6bd7 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, RetreatAidEffect db $00 DodrioRageEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6bdf - dbw EFFECTCMDTYPE_AI, $6bd9 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, DodrioRage_DamageBoostEffect + dbw EFFECTCMDTYPE_AI, DodrioRage_AIEffect db $00 MeowthPayDayEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6be8 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, PayDayEffect db $00 DragonairSlamEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6c14 - dbw EFFECTCMDTYPE_AI, $6c0c + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, DragonairSlam_MultiplierEffect + dbw EFFECTCMDTYPE_AI, DragonairSlam_AIEffect db $00 DragonairHyperBeamEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6c35 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $6c2c - dbw EFFECTCMDTYPE_UNKNOWN_08, $6c2f + dbw EFFECTCMDTYPE_AFTER_DAMAGE, DragonairHyperBeam_DiscardEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, DragonairHyperBeam_PlayerSelectEffect + dbw EFFECTCMDTYPE_AI_SELECTION, DragonairHyperBeam_AISelectEffect db $00 ClefableMetronomeEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6c77 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $6c82 - dbw EFFECTCMDTYPE_UNKNOWN_08, $6c7e + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ClefableMetronome_CheckAttacks + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, ClefableMetronome_UseAttackEffect + dbw EFFECTCMDTYPE_AI_SELECTION, ClefableMetronome_AISelectEffect db $00 ClefableMinimizeEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6c88 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ClefableMinimizeEffect db $00 PidgeotHurricaneEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6c8e + dbw EFFECTCMDTYPE_AFTER_DAMAGE, HurricaneEffect db $00 PidgeottoWhirlwindEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6ce9 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $6cd3 - dbw EFFECTCMDTYPE_SWITCH_DEFENDING_PKMN, $6cd3 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, PidgeottoWhirlwind_SwitchEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, PidgeottoWhirlwind_SelectEffect + dbw EFFECTCMDTYPE_AI_SWITCH_DEFENDING_PKMN, PidgeottoWhirlwind_SelectEffect db $00 PidgeottoMirrorMoveEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6cf2 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $6cf5 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6cfe - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6d01 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $6cf8 - dbw EFFECTCMDTYPE_UNKNOWN_08, $6cfb - dbw EFFECTCMDTYPE_AI, $6cef + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, PidgeottoMirrorMove_InitialEffect1 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, PidgeottoMirrorMove_InitialEffect2 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PidgeottoMirrorMove_BeforeDamage + dbw EFFECTCMDTYPE_AFTER_DAMAGE, PidgeottoMirrorMove_AfterDamage + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, PidgeottoMirrorMove_PlayerSelection + dbw EFFECTCMDTYPE_AI_SELECTION, PidgeottoMirrorMove_AISelection + dbw EFFECTCMDTYPE_AI, PidgeottoMirrorMove_AIEffect db $00 ClefairySingEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6d04 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SingEffect db $00 ClefairyMetronomeEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6d0b - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $6d16 - dbw EFFECTCMDTYPE_UNKNOWN_08, $6d12 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ClefairyMetronome_CheckAttacks + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, ClefairyMetronome_UseAttackEffect + dbw EFFECTCMDTYPE_AI_SELECTION, ClefairyMetronome_AISelectEffect db $00 WigglytuffLullabyEffectCommands: @@ -1300,8 +1303,8 @@ WigglytuffLullabyEffectCommands: db $00 WigglytuffDoTheWaveEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6d87 - dbw EFFECTCMDTYPE_AI, $6d87 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, DoTheWaveEffect + dbw EFFECTCMDTYPE_AI, DoTheWaveEffect db $00 JigglypuffLullabyEffectCommands: @@ -1309,16 +1312,16 @@ JigglypuffLullabyEffectCommands: db $00 JigglypuffFirstAidEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6d94 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6d9f + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, FirstAid_DamageCheck + dbw EFFECTCMDTYPE_AFTER_DAMAGE, FirstAid_HealEffect db $00 JigglypuffDoubleEdgeEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6da6 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, JigglypuffDoubleEdgeEffect db $00 PersianPounceEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6dac + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PounceEffect db $00 LickitungTongueWrapEffectCommands: @@ -1326,82 +1329,82 @@ LickitungTongueWrapEffectCommands: db $00 LickitungSupersonicEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6db2 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, LickitungSupersonicEffect db $00 PidgeyWhirlwindEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6dcf - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $6db9 - dbw EFFECTCMDTYPE_SWITCH_DEFENDING_PKMN, $6db9 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, PidgeyWhirlwind_SwitchEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, PidgeyWhirlwind_SelectEffect + dbw EFFECTCMDTYPE_AI_SWITCH_DEFENDING_PKMN, PidgeyWhirlwind_SelectEffect db $00 PorygonConversion1EffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6dd5 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $6ded - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6dfb - dbw EFFECTCMDTYPE_UNKNOWN_08, $6df7 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Conversion1_WeaknessCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Conversion1_PlayerSelectEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Conversion1_ChangeWeaknessEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Conversion1_AISelectEffect db $00 PorygonConversion2EffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6e1f - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $6e31 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6e5e - dbw EFFECTCMDTYPE_UNKNOWN_08, $6e3c + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Conversion2_ResistanceCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Conversion2_PlayerSelectEffect + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Conversion2_ChangeResistanceEffect + dbw EFFECTCMDTYPE_AI_SELECTION, Conversion2_AISelectEffect db $00 ChanseyScrunchEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6ee7 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ScrunchEffect db $00 ChanseyDoubleEdgeEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6efb + dbw EFFECTCMDTYPE_AFTER_DAMAGE, ChanseyDoubleEdgeEffect db $00 RaticateSuperFangEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6f07 - dbw EFFECTCMDTYPE_AI, $6f01 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SuperFang_HalfHPEffect + dbw EFFECTCMDTYPE_AI, SuperFang_AIEffect db $00 TrainerCardAsPokemonEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $6f18 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6f3c - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $6f27 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, TrainerCardAsPokemon_BenchCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, TrainerCardAsPokemon_DiscardEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, TrainerCardAsPokemon_PlayerSelectSwitch db $00 DragoniteHealingWindEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $6f51 - dbw EFFECTCMDTYPE_PKMN_POWER_TRIGGER, $6f53 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, HealingWind_InitialEffect + dbw EFFECTCMDTYPE_PKMN_POWER_TRIGGER, HealingWind_PlayAreaHealEffect db $00 Dragonite1SlamEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $6fa4 - dbw EFFECTCMDTYPE_AI, $6f9c + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Dragonite1Slam_MultiplierEffect + dbw EFFECTCMDTYPE_AI, Dragonite1Slam_AIEffect db $00 MeowthCatPunchEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6fe0 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, CatPunchEffect db $00 DittoMorphEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $6ff6 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, MorphEffect db $00 PidgeotSlicingWindEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $70bf + dbw EFFECTCMDTYPE_AFTER_DAMAGE, SlicingWindEffect db $00 PidgeotGaleEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $70d0 - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $70d6 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Gale_LoadAnimation + dbw EFFECTCMDTYPE_AFTER_DAMAGE, Gale_SwitchEffect db $00 JigglypuffFriendshipSongEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $710d - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $7119 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, FriendshipSong_BenchCheck + dbw EFFECTCMDTYPE_AFTER_DAMAGE, FriendshipSong_AddToBench50PercentEffect db $00 JigglypuffExpandEffectCommands: - dbw EFFECTCMDTYPE_AFTER_DAMAGE, $7153 + dbw EFFECTCMDTYPE_AFTER_DAMAGE, ExpandEffect db $00 DoubleColorlessEnergyEffectCommands: @@ -1426,68 +1429,68 @@ GrassEnergyEffectCommands: db $00 SuperPotionEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7159 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $7167 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $71b5 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, SuperPotion_DamageEnergyCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, SuperPotion_PlayerSelectEffect + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, SuperPotion_HealEffect db $00 ImakuniEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7216 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ImakuniEffect db $00 EnergyRemovalEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7252 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $725f - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7273 - dbw EFFECTCMDTYPE_UNKNOWN_08, $726f + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, EnergyRemoval_EnergyCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, EnergyRemoval_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, EnergyRemoval_DiscardEffect + dbw EFFECTCMDTYPE_AI_SELECTION, EnergyRemoval_AISelection db $00 EnergyRetrievalEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $728e - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $72a0 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $72f8 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $72b9 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, EnergyRetrieval_HandEnergyCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, EnergyRetrieval_PlayerHandSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, EnergyRetrieval_DiscardAndAddToHandEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, EnergyRetrieval_PlayerDiscardPileSelection db $00 EnergySearchEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $731c - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7372 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $7328 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, EnergySearch_DeckCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, EnergySearch_AddToHandEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, EnergySearch_PlayerSelection db $00 ProfessorOakEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $73a1 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ProfessorOakEffect db $00 PotionEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $73ca - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $73d1 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $73ef + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Potion_DamageCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Potion_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Potion_HealEffect db $00 GamblerEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $73f9 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, GamblerEffect db $00 ItemFinderEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $743b - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $744a - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7463 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ItemFinder_HandDiscardPileCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, ItemFinder_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ItemFinder_DiscardAddToHandEffect db $00 DefenderEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $7488 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7499 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Defender_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Defender_AttachDefenderEffect db $00 MysteriousFossilEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $74b3 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $74bf + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, MysteriousFossil_BenchCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, MysteriousFossil_PlaceInPlayAreaEffect db $00 FullHealEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $74c5 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $74d1 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, FullHeal_StatusCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, FullHeal_ClearStatusEffect db $00 ImposterProfessorOakEffectCommands: @@ -1495,105 +1498,105 @@ ImposterProfessorOakEffectCommands: db $00 ComputerSearchEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7513 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $752a - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7545 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $752e + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ComputerSearch_HandDeckCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, ComputerSearch_PlayerDiscardHandSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ComputerSearch_DiscardAddToHandEfect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, ComputerSearch_PlayerDeckSelection db $00 ClefairyDollEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7561 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $756d + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ClefairyDoll_BenchCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ClefairyDoll_PlaceInPlayAreaEffect db $00 MrFujiEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7573 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $757e - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $758f + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, MrFuji_BenchCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, MrFuji_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, MrFuji_ReturnToDeckEffect db $00 PlusPowerEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $75e0 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PlusPowerEffect db $00 SwitchEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $75ee - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $75f9 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $760a + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Switch_BenchCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Switch_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Switch_SwitchEffect db $00 PokemonCenterEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7611 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7618 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, PokemonCenter_DamageCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PokemonCenter_HealDiscardEnergyEffect db $00 PokemonFluteEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7659 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $7672 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $768f + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, PokemonFlute_BenchCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, PokemonFlute_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PokemonFlute_PlaceInPlayAreaText db $00 PokemonBreederEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $76b3 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $76c1 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $76f4 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, PokemonBreeder_HandPlayAreaCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, PokemonBreeder_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PokemonBreeder_EvolveEffect db $00 ScoopUpEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7795 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $77a0 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $77c3 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, ScoopUp_BenchCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, ScoopUp_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, ScoopUp_ReturnToHandEffect db $00 PokemonTraderEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7826 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $7838 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $788d - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $7853 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, PokemonTrader_HandDeckCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, PokemonTrader_PlayerHandSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PokemonTrader_TradeCardsEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, PokemonTrader_PlayerDeckSelection db $00 PokedexEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $78e1 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $79aa - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $78ed + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Pokedex_DeckCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Pokedex_OrderDeckCardsEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Pokedex_PlayerSelection db $00 BillEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $79c4 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, BillEffect db $00 LassEffectCommands: - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $79e3 + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, LassEffect db $00 MaintenanceEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7a70 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $7a7b - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7a85 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Maintenance_HandCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Maintenance_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Maintenance_ReturnToDeckAndDrawEffect db $00 PokeBallEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7aad - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7b15 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $7ab9 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, PokeBall_DeckCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, PokeBall_AddToHandEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, PokeBall_PlayerSelection db $00 RecycleEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7b36 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7b68 - dbw EFFECTCMDTYPE_REQUIRE_SELECTION, $7b41 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Recycle_DiscardPileCheck + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Recycle_AddToHandEffect + dbw EFFECTCMDTYPE_REQUIRE_SELECTION, Recycle_PlayerSelection db $00 ReviveEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7b80 - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $7b93 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7bb0 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, Revive_BenchCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, Revive_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, Revive_PlaceInPlayAreaEffect db $00 DevolutionSprayEffectCommands: - dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, $7c0b - dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, $7c24 - dbw EFFECTCMDTYPE_BEFORE_DAMAGE, $7c99 + dbw EFFECTCMDTYPE_INITIAL_EFFECT_1, DevolutionSpray_PlayAreaEvolutionCheck + dbw EFFECTCMDTYPE_INITIAL_EFFECT_2, DevolutionSpray_PlayerSelection + dbw EFFECTCMDTYPE_BEFORE_DAMAGE, DevolutionSpray_DevolutionEffect db $00 SuperEnergyRemovalEffectCommands: 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/map_scripts.asm b/src/data/map_scripts.asm index f969d45..3084f8b 100644 --- a/src/data/map_scripts.asm +++ b/src/data/map_scripts.asm @@ -78,7 +78,7 @@ MapScripts: ; 1162a (4:562a) dw $0000 dw $0000 dw $0000 - dw $5da3 + dw FightingClubAfterDuel dw $0000 dw $0000 @@ -98,7 +98,7 @@ MapScripts: ; 1162a (4:562a) dw RockClubLobbyObjects dw $0000 dw $0000 - dw $5ed5 + dw RockClubLobbyAfterDuel dw $0000 dw $0000 @@ -128,7 +128,7 @@ MapScripts: ; 1162a (4:562a) dw WaterClubLobbyObjects dw $0000 dw $0000 - dw $60a2 + dw WaterClubLobbyAfterDuel dw $0000 dw $0000 @@ -158,7 +158,7 @@ MapScripts: ; 1162a (4:562a) dw LightningClubLobbyObjects dw $0000 dw $0000 - dw $636d + dw LightningClubLobbyAfterDuel dw $0000 dw $0000 @@ -218,7 +218,7 @@ MapScripts: ; 1162a (4:562a) dw PsychicClubLobbyObjects dw $0000 dw $6971 - dw $6963 + dw PsychicClubLobbyAfterDuel dw $0000 dw $0000 @@ -248,7 +248,7 @@ MapScripts: ; 1162a (4:562a) dw ScienceClubLobbyObjects dw $0000 dw $0000 - dw $6b57 + dw ScienceClubLobbyAfterDuel dw $0000 dw $0000 @@ -278,7 +278,7 @@ MapScripts: ; 1162a (4:562a) dw FireClubLobbyObjects dw FireClubPressedA dw $0000 - dw $6d49 + dw FireClubLobbyAfterDuel dw $0000 dw $0000 @@ -288,7 +288,7 @@ MapScripts: ; 1162a (4:562a) dw $0000 dw $0000 dw $0000 - dw $6e93 + dw FireClubAfterDuel dw $0000 dw $0000 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 99979ce..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 $5dc3 ; 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 $6f22 ; 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 c18629f..b74340a 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. @@ -791,7 +778,7 @@ PlayPokemonCard: ; 44db (1:44db) ldh [hTemp_ffa0], a ldh a, [hTempPlayAreaLocation_ff9d] ldh [hTempPlayAreaLocation_ffa1], a - call EvolvePokemonCard + call EvolvePokemonCardIfPossible jr c, .try_evolve_loop ; jump if evolution wasn't successsful somehow ld a, OPPACTION_EVOLVE_PKMN call SetOppAction_SerialSendDuelData @@ -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. @@ -1463,10 +1438,17 @@ CheckIfActiveCardParalyzedOrAsleep: ; 4918 (1:4918) scf ret -; display the animation of the turn duelist drawing a card at the beginning of the turn +; display the animation of the turn duelist drawing one card at the beginning of the turn ; if there isn't any card left in the deck, let the player know with a text message DisplayDrawOneCardScreen: ; 4933 (1:4933) ld a, 1 +; fallthrough + +; display the animation of the turn duelist drawing number of cards that is in a. +; if there isn't any card left in the deck, let the player know with a text message. +; input: +; - a = number of cards to draw +DisplayDrawNCardsScreen: ; 4935 (1:4935) push hl push de push bc @@ -1529,7 +1511,6 @@ DisplayDrawOneCardScreen: ; 4933 (1:4933) pop de pop hl ret -; 0x49a8 Func_49a8: ; 49a8 (1:49a8) call Func_3b21 @@ -1550,7 +1531,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 +1550,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 +1596,6 @@ PrintOpponentNumberOfHandAndDeckCards: ld a, e lb bc, 11, 3 jp WriteTwoDigitNumberInTxSymbolFormat -; 0x4a35 DeckAndHandIconsTileData: ; x, y, tiles[], 0 @@ -1682,7 +1660,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 +1671,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 +1712,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 +1726,6 @@ DisplayCardDetailScreen: ; 4b31 (1:4b31) call LoadCardDataToBuffer1_FromDeckIndex call _DisplayCardDetailScreen ret -; 0x4b38 Func_4b38: ; 4b38 (1:4b38) ld a, [wDuelTempList] @@ -1769,7 +1743,6 @@ Func_4b38: ; 4b38 (1:4b38) ldtx hl, YouReceivedTheseCardsText call DrawWideTextBox_WaitForInput ret -; 0x4b60 Func_4b60: ; 4b60 (1:4b60) call InitializeDuelVariables @@ -1950,7 +1923,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 +2033,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 +2106,6 @@ IsLoadedCard1BasicPokemon: ; 4dd1 (1:4dd1) ld a, $01 or a ret ; nz -; 0x4df3 DisplayNoBasicPokemonInHandScreenAndText: ; 4df3 (1:4df3) ldtx hl, ThereAreNoBasicPokemonInHand @@ -2149,7 +2119,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 +2140,6 @@ DisplayNoBasicPokemonInHandScreen: ; 4e06 (1:4e06) call EnableLCD call WaitForWideTextBoxInput ret -; 0x4e37 NoBasicPokemonCardListParameters: db 1, 3 ; cursor x, cursor y @@ -2201,7 +2169,6 @@ DisplayPracticeDuelPlayerHandScreen: ; 4e40 (1:4e40) call PrintTextNoDelay call EnableLCD ret -; 0x4e6e Func_4e6e: ; 4e6e (1:4e6e) ld b, $51 @@ -2304,16 +2271,15 @@ Func_4e98: ; 4e98 (1:4e98) call Func_3b31 pop bc ret -; 0x4f2d Func_4f2d: ; 4f2d (1:4f2d) ld a, [wDuelDisplayedScreen] cp SHUFFLE_DECK - jr z, .asm_4f3d + jr z, .skip_draw_scene call ZeroObjectPositionsAndToggleOAMCopy call EmptyScreen call DrawDuelistPortraitsAndNames -.asm_4f3d +.skip_draw_scene ld a, SHUFFLE_DECK ld [wDuelDisplayedScreen], a ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK @@ -2362,7 +2328,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 +2401,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 +2444,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 +2579,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 +2593,6 @@ DrawDuelHorizontalSeparator: ; 516f (1:516f) call WriteDataBlocksToBGMap0 call BankswitchVRAM0 ret -; 0x5188 DuelEAndHPTileData: ; 5188 (1:5188) ; x, y, tiles[], 0 @@ -2640,7 +2601,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 +2609,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 +2617,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 +2629,6 @@ DoPracticeDuelAction: ; 51e7 (1:51e7) ld a, [wPracticeDuelAction] ld hl, PracticeDuelActionTable jp JumpToFunctionInTable -; 0x51f8 PracticeDuelActionTable: ; 51f8 (1:51f8) dw $0000 @@ -2685,14 +2642,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 +2657,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 +2672,6 @@ PracticeDuel_VerifyInitialPlay: ; 5236 (1:5236) ldtx hl, ChooseStaryuPracticeDuelText scf jp PrintPracticeDuelDrMasonInstructions -; 0x5245 PracticeDuel_DonePuttingOnBench: ; 5245 (1:5245) call DisplayPracticeDuelPlayerHandScreen @@ -2728,7 +2680,6 @@ PracticeDuel_DonePuttingOnBench: ; 5245 (1:5245) ld [wPracticeDuelTurn], a ldtx hl, PressBToFinishPracticeDuelText jp PrintPracticeDuelDrMasonInstructions -; 0x5256 PracticeDuel_PrintTurnInstructions: ; 5256 (1:5256) call DrawPracticeDuelInstructionsTextBox @@ -2749,7 +2700,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 +2723,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 +2736,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 +2754,6 @@ PrintPracticeDuelDrMasonInstructions: ; 52bc (1:52bc) call PrintScrollableText_WithTextBoxLabel pop af ret -; 0x52c5 PracticeDuelTextPointerTable: ; 52c5 (1:52c5) dw PracticeDuelText_Turn1 @@ -2817,7 +2764,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 +2852,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 +2931,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 +2949,6 @@ PrintPracticeDuelNumberedInstruction: ; 53e6 (1:53e6) call SetOneLineSeparation pop hl ret -; 0x53fa Func_53fa: ; 53fa (1:53fa) ld a, $01 @@ -3032,7 +2975,6 @@ Func_53fa: ; 53fa (1:53fa) xor a ldh [hffb0], a ret -; 0x541f PracticeDuelTurnVerificationPointerTable: ; 541f (1:541f) dw PracticeDuelVerify_Turn1 @@ -3049,7 +2991,6 @@ PracticeDuelVerify_Turn1: ; 542f (1:542f) cp GOLDEEN jp nz, ReturnWrongAction ret -; 0x5438 PracticeDuelVerify_Turn2: ; 5438 (1:5438) ld a, [wTempCardID_ccc2] @@ -3064,7 +3005,6 @@ PracticeDuelVerify_Turn2: ; 5438 (1:5438) or a jr z, ReturnWrongAction ret -; 0x5454 PracticeDuelVerify_Turn3: ; 5454 (1:5454) ld a, [wTempCardID_ccc2] @@ -3076,7 +3016,6 @@ PracticeDuelVerify_Turn3: ; 5454 (1:5454) or a jr z, ReturnWrongAction ret -; 0x5467 PracticeDuelVerify_Turn4: ; 5467 (1:5467) ld a, [wPlayerNumberOfPokemonInPlayArea] @@ -3094,7 +3033,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 +3044,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 +3058,6 @@ PracticeDuelVerify_Turn6: ; 549c (1:549c) cp STARYU jr nz, ReturnWrongAction ret -; 0x54b7 PracticeDuelVerify_Turn7Or8: ; 54b7 (1:54b7) ld a, [wTempCardID_ccc2] @@ -3135,7 +3071,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 +3088,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 +3102,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 +3148,6 @@ DisplayPlaceInitialPokemonCardsScreen: ; 5502 (1:5502) call nz, SortHandCardsByID pop af ret -; 0x5542 Func_5542: ; 5542 (1:5542) call CreateDiscardPileCardList @@ -3225,7 +3156,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 +3173,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 +3186,6 @@ SetDiscardPileScreenTexts: ; 556d (1:556d) ldtx hl, ChooseTheCardYouWishToExamineText call SetCardListHeaderText ret -; 0x5580 SetCardListHeaderText: ; 5580 (1:5580) ld a, e @@ -3272,14 +3200,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 +3260,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 +3372,6 @@ DisplayCardList: ; 55f0 (1:55f0) ldh a, [hCurMenuItem] scf ret -; 0x5690 Func_5690: ; 5690 (1:5690) ldh a, [hDPadHeld] @@ -3459,7 +3383,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 +3403,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 +3444,6 @@ CardListItemSelectionMenu: ; 56c2 (1:56c2) .b_pressed scf ret -; 0x5708 ItemSelectionMenuParameters: ; 5708 (1:5708) db 1, 14 ; corsor x, cursor y @@ -3531,7 +3452,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 +3461,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,25 +3485,26 @@ CardListFunction: ; 5719 (1:5719) call LoadSelectedCardGfx or a ret -; 0x5735 Func_5735: ; 5735 (1:5735) ld hl, wcbd8 - ld de, Func_574a + ld de, PrintSortNumberInCardList ld [hl], e inc hl ld [hl], d ld a, 1 ld [wSortCardListByID], a ret -; 0x5744 Func_5744: ; 5744 (1:5744) ld hl, wcbd8 jp CallIndirect -; 0x574a -Func_574a: ; 574a (1:574a) +; goes through list in wDuelTempList + 10 +; and prints the number stored in each entry +; beside the corresponding card in screen. +; used in lists for reordering cards in the Deck. +PrintSortNumberInCardList: ; 574a (1:574a) lb bc, 1, 2 ld hl, wDuelTempList + 10 .next @@ -3593,7 +3513,7 @@ Func_574a: ; 574a (1:574a) jr z, .done or a ; SYM_SPACE jr z, .space - add SYM_0 + add SYM_0 ; load number symbol .space call WriteByteToBGMap0 ; move two lines down @@ -3602,7 +3522,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 +3598,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,9 +3616,11 @@ DisplayCardPageOnLeftOrRightPressed: ; 57cd (1:57cd) call DisplayPreviousCardPage call c, DisplayCardPage ret -; 0x57df -Func_57df: ; 57df (1:57df) +; draws text box that covers the whole screen +; and prints the text ID in hl, then +; waits for Player input. +DrawWholeScreenTextBox: ; 57df (1:57df) push hl call EmptyScreen lb de, 0, 0 @@ -3716,7 +3636,6 @@ Func_57df: ; 57df (1:57df) call SetOneLineSeparation call WaitForWideTextBoxInput ret -; 0x5805 Func_5805: ; 5805 (1:5805) call Func_3b31 @@ -3786,14 +3705,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 +3732,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 +3744,6 @@ LoadSelectedCardGfx: ; 58aa (1:58aa) call SetBGP6OrSGB3ToCardPalette call FlushAllPalettesOrSendPal23Packet ret -; 0x58c2 CardPageDisplayPointerTable: ; 58c2 (1:58c2) dw DrawDuelMainScene @@ -3847,7 +3762,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 +3797,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 +3823,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 +3832,6 @@ GoToPreviousCardPage: ; 5911 (1:5911) SwitchCardPage: ; 5930 (1:5930) ld hl, CardPageSwitchPointerTable jp JumpToFunctionInTable -; 0x5936 CardPageSwitchPointerTable: ; 5936 (1:5936) dw CardPageSwitch_00 @@ -3939,21 +3850,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 +3891,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 +3973,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 +3993,6 @@ LoadLoaded1CardGfx: ; 59ca (1:59ca) lb bc, $30, TILE_SIZE call LoadCardGfx ret -; 0x59d7 SetBGP7OrSGB2ToCardPalette: ; 59d7 (1:59d7) ld a, [wConsole] @@ -4117,7 +4014,6 @@ SetBGP7OrSGB2ToCardPalette: ; 59d7 (1:59d7) dec b jr nz, .copy_pal_loop ret -; 0x59f5 SetBGP6OrSGB3ToCardPalette: ; 59f5 (1:59f5) ld a, [wConsole] @@ -4134,7 +4030,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 +4059,6 @@ CopyCGBCardPalette: ; 5a1e (1:5a1e) dec b jr nz, .copy_pal_loop ret -; 0x5a34 FlushAllPalettesOrSendPal23Packet: ; 5a34 (1:5a34) ld a, [wConsole] @@ -4190,7 +4084,6 @@ FlushAllPalettesOrSendPal23Packet: ; 5a34 (1:5a34) ld [wTempSGBPacket + $f], a call SendSGB ret -; 0x5a56 ApplyBGP6OrSGB3ToCardImage: ; 5a56 (1:5a56) ld a, [wConsole] @@ -4209,7 +4102,6 @@ SendCardAttrBlkPacket: ; 5a67 (1:5a67) call CreateCardAttrBlkPacket call SendSGB ret -; 0x5a6e ApplyBGP7OrSGB2ToCardImage: ; 5a6e (1:5a6e) ld a, [wConsole] @@ -4223,7 +4115,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 +4141,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 +4159,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 +4178,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 +4187,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 +4239,6 @@ SetDefaultPalettes: ; 5aeb (1:5aeb) dec c jr nz, .copy_de_to_hl ret -; 0x5b44 CGBDefaultPalettes: ; 5b44 (1:5b44) ; BGP0 and OBP0 @@ -4372,7 +4258,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 +4281,6 @@ Pal01Packet_Default: ; 5b6c (1:5b6c) JPWriteByteToBGMap0: ; 5b7a (1:5b7a) jp WriteByteToBGMap0 -; 0x5b7d DisplayCardPage_PokemonOverview: ; 5b7d (1:5b7d) ld a, [wCardPageType] @@ -4503,7 +4388,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 +4471,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 +4488,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 +4513,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 +4536,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 +4550,6 @@ DrawCardPageSurroundingBox: ; 5cec (1:5cec) lb de, 6, 4 call ApplyBGP6OrSGB3ToCardImage ret -; 0x5d05 CardPageRetreatWRTextData: ; 5d05 (1:5d05) textitem 1, 14, RetreatCostText @@ -4732,7 +4611,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 +4672,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 +4683,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 +4702,6 @@ DrawCardPageSet2AndRarityIcons: ; 5ddd (1:5ddd) cp PROMOSTAR call nz, PrintCardPageRarityIcon ret -; 0x5e02 CardPageLengthWeightTextData: ; 5e02 (1:5e02) textitem 1, 11, LengthText @@ -4843,7 +4718,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 +4762,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 +4776,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 +4807,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 +4824,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 +4833,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 +4893,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 +4939,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 +4982,6 @@ _HasAlivePokemonInPlayArea: ; 5fde (1:5fde) ret nz scf ret -; 0x6008 OpenPlayAreaScreenForViewing: ; 6008 (1:6008) ld a, START + A_BUTTON @@ -5216,7 +5081,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 +5109,6 @@ PlayAreaScreenMenuFunction: ; 60ce (1:60ce) .start_or_a scf ret -; 0x60dd Func_60dd: ; 60dd (1:60dd) ld a, [wcbd4] @@ -5295,7 +5158,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 +5195,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 +5218,6 @@ Func_6186: ld [hl], a call PrintPlayAreaCardInformationAndLocation ret -; 0x6194 Func_6194: ; 6194 (1:6194) call Func_6186 @@ -5366,7 +5226,6 @@ Func_6194: ; 6194 (1:6194) ld d, 0 call SetCursorParametersForTextBox_Default ret -; 0x61a1 Func_61a1: ; 61a1 (1:61a1) xor a @@ -5379,7 +5238,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 +5251,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 +5320,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 +5369,6 @@ PrintPlayAreaCardLocation: ; 6238 (1:6238) add d call WriteByteToBGMap0 ret -; 0x6264 PlayAreaLocationTileNumbers: ; 6264 (1:6264) db $e0, $e1, $e2, $00 ; ACT @@ -5580,7 +5435,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 +5565,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 +5572,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 +5584,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 +5591,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 +5613,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 +5685,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 +5704,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 +5714,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 +5731,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 +5755,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 +5774,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 +5795,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 +5840,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 +5866,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 +5892,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 +5900,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 +5920,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 +5989,6 @@ SaveDuelDataToDE: ; 66a4 (1:66a4) ld [hl], a ; sCurrentDuelData call DisableSRAM ret -; 0x66e9 Func_66e9: ; 66e9 (1:66e9) ld hl, sCurrentDuel @@ -6165,7 +6001,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 +6041,6 @@ LoadSavedDuelData: ; 66ff (1:66ff) .done call DisableSRAM ret -; 0x6729 DuelDataToSave: ; 6729 (1:6729) ; dw address, number_of_bytes_to_copy @@ -6218,7 +6052,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 +6105,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 +6117,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 +6138,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 +6150,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 +6189,6 @@ AIMakeDecision: ; 67be (1:67be) .turn_ended scf ret -; 0x67fb Func_67fb: ; 67fb (1:67fb) ld a, 10 @@ -6397,7 +6225,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 +6249,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 +6307,6 @@ Func_6862: ; 6862 (1:6862) .right_pressed call OpenNonTurnHolderDiscardPileScreen jr .return_carry -; 0x68c6 Func_68c6: ; 68c6 (1:68c6) call Func_3b31 @@ -6496,7 +6321,6 @@ Func_68c6: ; 68c6 (1:68c6) inc hl ld [hl], d ret -; 0x68dd ResetDoFrameFunction_Bank1: ; 68dd (1:68dd) xor a @@ -6504,7 +6328,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 +6341,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 +6354,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 +6393,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) @@ -6598,7 +6418,7 @@ OppActionTable: ; 695e (1:695e) dw OppAction_TossCoinATimes dw OppAction_6b30 dw OppAction_NoAction - dw OppAction_6b3e + dw OppAction_UseMetronomeAttack dw OppAction_6b15 dw OppAction_DrawDuelMainScene @@ -6606,7 +6426,6 @@ OppAction_DrawCard: ; 698c (1:698c) call DrawCardFromDeck call nc, AddCardToHand ret -; 0x6993 OppAction_FinishTurnWithoutAttacking: ; 6993 (1:6993) call DrawDuelMainScene @@ -6616,7 +6435,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 +6452,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) @@ -6644,12 +6461,11 @@ OppAction_EvolvePokemonCard: ; 69c5 (1:69c5) ldh [hTempCardIndex_ff98], a call LoadCardDataToBuffer1_FromDeckIndex call DrawLargePictureOfCard - call EvolvePokemonCard + call EvolvePokemonCardIfPossible call PrintPokemonEvolvedIntoPokemon call Func_161e call DrawDuelMainScene ret -; 0x69e0 ; place a basic Pokemon card from hand in the bench OppAction_PlayBasicPokemonCard: ; 69e0 (1:69e0) @@ -6666,7 +6482,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 +6506,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 +6516,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 +6530,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 +6566,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 +6587,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 +6609,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 +6631,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 +6640,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 +6648,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 +6659,6 @@ OppAction_TossCoinATimes: ; 6b24 (1:6b24) ld a, $01 ld [wSkipDuelistIsThinkingDelay], a ret -; 0x6b30 OppAction_6b30: ; 6b30 (1:6b30) ldh a, [hWhoseTurn] @@ -6866,9 +6669,8 @@ OppAction_6b30: ; 6b30 (1:6b30) pop af ldh [hWhoseTurn], a ret -; 0x6b3e -OppAction_6b3e: ; 6b3e (1:6b3e) +OppAction_UseMetronomeAttack: ; 6b3e (1:6b3e) call DrawDuelMainScene ld a, DUELVARS_ARENA_CARD_STATUS call GetTurnDuelistVariable @@ -6894,13 +6696,11 @@ OppAction_6b3e: ; 6b3e (1:6b3e) call Func_16f6 pop bc ld a, c - ld [wccf0], a + ld [wMetronomeEnergyCost], 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 +6711,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 +6721,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 +6733,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) @@ -7009,7 +6805,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 +6818,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 +6831,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 +6852,6 @@ IsArenaPokemonAsleepOrPoisoned: ; 6c68 (1:6c68) .set_carry scf ret -; 0x6c7e Func_6c7e: ; 6c7e (1:6c7e) ld a, [wDuelDisplayedScreen] @@ -7082,7 +6874,6 @@ Func_6c7e: ; 6c7e (1:6c7e) call DrawDuelHUDs call SwapTurn ret -; 0x6cab Func_6cab: ; 6cab (1:6cab) push af @@ -7113,7 +6904,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 +6919,6 @@ Func_6ce4: ; 6ce4 (1:6ce4) pop hl call DrawWideTextBox_PrintText ret -; 0x6cfa Func_6cfa: ; 6cfa (1:6cfa) ld a, [hl] @@ -7259,16 +7048,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 @@ -7319,7 +7108,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 @@ -7339,7 +7127,6 @@ ApplyStatusConditionToArenaPokemon: ; 6e38 (1:6e38) inc hl ld [de], a ret -; 0x6e49 Func_6e49: ; 6e49 (1:6e49) call HandleDestinyBondSubstatus @@ -7407,7 +7194,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 @@ -7428,21 +7214,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 @@ -7467,7 +7250,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. @@ -7543,7 +7325,6 @@ ReplaceKnockedOutPokemon: ; 6f23 (1:6f23) call SerialRecv8Bytes ldh [hTempPlayAreaLocation_ff9d], a jr .replace_pokemon -; 0x6fa5 Func_6fa5: ; 6fa5 (1:6fa5) call CountKnockedOutPokemon @@ -7561,7 +7342,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. @@ -7601,7 +7381,6 @@ CountKnockedOutPokemon: ; 6fc7 (1:6fc7) ret z scf ret -; 0x6ff7 Func_6ff7: ; 6ff7 (1:6ff7) ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA @@ -7619,12 +7398,11 @@ 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) +; on the value at wNoEffectFromWhichStatus (NO_STATUS or a status condition constant) PrintThereWasNoEffectFromStatusText: ; 700a (1:700a) - ld a, [wNoEffectFromStatus] + ld a, [wNoEffectFromWhichStatus] or a jr nz, .status ld hl, wLoadedMoveName @@ -7657,10 +7435,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. @@ -7727,7 +7504,8 @@ GetCardOneStageBelow: ; 7045 (1:7045) ld hl, wAllStagesIndices ; pointing to basic cp STAGE1 jr z, .done - cp STAGE2 + 1 ; unnecessary check? + ; if stage1 was skipped, hl should point to Basic stage card + cp STAGE2_WITHOUT_STAGE1 jr z, .done inc hl ; pointing to stage 1 .done @@ -7738,7 +7516,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 @@ -7769,7 +7546,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) @@ -7780,7 +7556,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. @@ -7788,7 +7563,7 @@ SetAllPlayAreaPokemonCanEvolve: ; 70f6 (1:70f6) ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetTurnDuelistVariable ld c, a - ld l, DUELVARS_ARENA_CARD_FLAGS_C2 + ld l, DUELVARS_ARENA_CARD_FLAGS .next_pkmn_loop res 5, [hl] set CAN_EVOLVE_THIS_TURN_F, [hl] @@ -7796,7 +7571,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] @@ -7839,7 +7613,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 @@ -7872,11 +7645,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 @@ -7898,7 +7669,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. @@ -7915,7 +7685,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 @@ -7925,7 +7694,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] @@ -7946,7 +7714,6 @@ Func_7195: ; 7195 (1:7195) ld [hli], a ld [hl], a ret -; 0x71ad _TossCoin: ; 71ad (1:71ad) ld [wcd9c], a @@ -8295,7 +8062,6 @@ Func_7415: ; 7415 (1:7415) xor a ld [wce7e], a ret -; 0x741a Func_741a: ; 741a (1:741a) ld hl, wEffectFunctionsFeedbackIndex @@ -8345,7 +8111,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. @@ -8367,7 +8132,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) @@ -8381,7 +8145,6 @@ WaitMoveAnimation: ; 7484 (1:7484) jr c, .anim_loop pop de ret -; 0x7494 ; play move animation ; input: @@ -8453,12 +8216,10 @@ Func_758f: ; 758f (1:758f) 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 1f1e690..58367e2 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 @@ -2210,33 +2214,33 @@ ScriptCommand_ShowCardReceivedScreen: ; cee2 (3:4ee2) xor a jr .asm_cef0 -Func_cf0c: ; cf0c (3:4f0c) +ScriptCommand_CheckIfCardInCollectionOrDecks: ; cf0c (3:4f0c) ld a, c call GetCardCountInCollectionAndDecks jr asm_cf16 -Func_cf12: ; cf12 (3:4f12) +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 -Func_cf2d: ; cf2d (3:4f2d) +ScriptCommand_CheckRawAmountOfCardsOwned: ; cf2d (3:4f2d) push bc call IncreaseScriptPointerBy1 pop bc @@ -2317,7 +2321,7 @@ Func_cf7b: ; cf7b (3:4f7b) jr c, .asm_cf7d jp IncreaseScriptPointerBy1 -Func_cf96: ; cf96 (3:4f96) +ScriptCommand_JumpBasedOnFightingClubPupilStatus: ; cf96 (3:4f96) ld c, $0 get_flag_value EVENT_FLAG_11 or a @@ -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 @@ -3622,25 +3656,25 @@ Script_Ishihara: ; db4a (3:5b4a) db $02 run_command ScriptCommand_AskQuestionJump tx Text072b - dw .ows_dba8 + dw .check_ifhave_clefable_incollectionordecks run_command ScriptCommand_PrintTextQuitFully tx Text072c -.ows_dba8 - run_command Func_cf0c - db $ac - dw .ows_dbaf +.check_ifhave_clefable_incollectionordecks + run_command ScriptCommand_CheckIfCardInCollectionOrDecks + db CLEFABLE + dw .check_ifhave_clefable_incollectiononly run_command ScriptCommand_PrintTextQuitFully tx Text072d -.ows_dbaf - run_command Func_cf12 - db $ac - dw .ows_dbb6 +.check_ifhave_clefable_incollectiononly + run_command ScriptCommand_CheckIfCardInCollection + db CLEFABLE + dw .do_clefable_trade run_command ScriptCommand_PrintTextQuitFully tx Text072e -.ows_dbb6 +.do_clefable_trade run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_00 run_command ScriptCommand_SetFlagValue @@ -3674,25 +3708,25 @@ Script_Ishihara: ; db4a (3:5b4a) db $04 run_command ScriptCommand_AskQuestionJump tx Text072b - dw .ows_dbe1 + dw .check_ifhave_ditto_incollectionordecks run_command ScriptCommand_PrintTextQuitFully tx Text072c -.ows_dbe1 - run_command Func_cf0c - db $bb - dw .ows_dbe8 +.check_ifhave_ditto_incollectionordecks + run_command ScriptCommand_CheckIfCardInCollectionOrDecks + db DITTO + dw .check_ifhave_ditto_incollectiononly run_command ScriptCommand_PrintTextQuitFully tx Text0734 -.ows_dbe8 - run_command Func_cf12 - db $bb - dw .ows_dbef +.check_ifhave_ditto_incollectiononly + run_command ScriptCommand_CheckIfCardInCollection + db DITTO + dw .do_ditto_trade run_command ScriptCommand_PrintTextQuitFully tx Text0735 -.ows_dbef +.do_ditto_trade run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_00 run_command ScriptCommand_SetFlagValue @@ -3726,25 +3760,25 @@ Script_Ishihara: ; db4a (3:5b4a) db $06 run_command ScriptCommand_AskQuestionJump tx Text072b - dw .ows_dc1a + dw .check_ifhave_chansey_incollectionordecks run_command ScriptCommand_PrintTextQuitFully tx Text072c -.ows_dc1a - run_command Func_cf0c - db $b8 - dw .ows_dc21 +.check_ifhave_chansey_incollectionordecks + run_command ScriptCommand_CheckIfCardInCollectionOrDecks + db CHANSEY + dw .check_ifhave_chansey_incollectiononly run_command ScriptCommand_PrintTextQuitFully tx Text073a -.ows_dc21 - run_command Func_cf12 - db $b8 - dw .ows_dc28 +.check_ifhave_chansey_incollectiononly + run_command ScriptCommand_CheckIfCardInCollection + db CHANSEY + dw .do_chansey_trade run_command ScriptCommand_PrintTextQuitFully tx Text073b -.ows_dc28 +.do_chansey_trade run_command ScriptCommand_MaxOutFlagValue db EVENT_FLAG_00 run_command ScriptCommand_SetFlagValue @@ -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,247 @@ NPCMovement_dd78 ; dd78 (3:5d78) db EAST db $ff - INCROM $dd82, $e0b0 +Script_Specs1: ; dd82 (3:5d82) + INCROM $dd82, $dd8d + +Script_Butch: ; dd8d (3:5d8d) + INCROM $dd8d, $dd9f + +Script_Granny1: ; dd9f (3:5d9f) + INCROM $dd9f, $dda3 + + + +FightingClubAfterDuel: ; dda3 (3:5da3) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret +; 0xddaa + +.after_duel_table + db NPC_CHRIS + db NPC_CHRIS + dw $5e69 + dw $5e75 + + db NPC_MICHAEL + db NPC_MICHAEL + dw $5e95 + dw $5ea1 + + db NPC_JESSICA + db NPC_JESSICA + dw $5ec1 + dw $5ecd + + db NPC_MITCH + db NPC_MITCH + dw Script_BeatMitch + dw Script_LoseToMitch + + db $00 +; ddc3 + +Script_Mitch: ; ddc3 (3:5dc3) + start_script + run_command ScriptCommand_TryGivePCPack + db $02 + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_0F + dw Script_Mitch_AlreadyHaveMedal + run_command ScriptCommand_JumpBasedOnFightingClubPupilStatus + dw .first_interaction + dw .three_pupils_remaining + dw .two_pupils_remaining + dw .one_pupil_remaining + dw .all_pupils_defeated +.first_interaction + run_command ScriptCommand_PrintTextString + tx Text0477 + run_command ScriptCommand_SetFlagValue + db EVENT_FLAG_11 + db $01 + run_command ScriptCommand_SetFlagValue + db EVENT_FLAG_17 + db $01 + run_command ScriptCommand_SetFlagValue + db EVENT_FLAG_20 + db $01 + run_command ScriptCommand_QuitScriptFully +; 0xdde2 +.three_pupils_remaining + run_command ScriptCommand_PrintTextQuitFully + tx Text0478 +; 0xdde5 +.two_pupils_remaining + run_command ScriptCommand_PrintTextQuitFully + tx Text0479 +; 0xdde8 +.one_pupil_remaining + run_command ScriptCommand_PrintTextQuitFully + tx Text047a +; 0xddeb +.all_pupils_defeated + run_command ScriptCommand_PrintTextString + tx Text047b + run_command ScriptCommand_AskQuestionJump + tx Text047c + dw .do_battle + run_command ScriptCommand_PrintTextString + tx Text047d + run_command ScriptCommand_QuitScriptFully +; 0xddf7 +.do_battle + run_command ScriptCommand_PrintTextString + tx Text047e + run_command ScriptCommand_StartBattle + db PRIZES_6 + db FIRST_STRIKE_DECK_ID + db MUSIC_DUEL_THEME_2 + run_command ScriptCommand_QuitScriptFully +; 0xddff + +Script_BeatMitch: ; ddff (3:5dff) + start_script + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_0F + dw Script_Mitch_GiveBoosters + run_command ScriptCommand_PrintTextString + tx Text047f + run_command ScriptCommand_MaxOutFlagValue + db EVENT_FLAG_0F + run_command ScriptCommand_TryGiveMedalPCPacks + run_command Func_d125 + db $0f + run_command Func_d435 + db $01 + run_command ScriptCommand_PrintTextString + tx Text0480 + run_command ScriptCommand_GiveBoosterPacks + db BOOSTER_LABORATORY_NEUTRAL + db BOOSTER_LABORATORY_NEUTRAL + db NO_BOOSTER + run_command ScriptCommand_PrintTextString + tx Text0481 + run_command ScriptCommand_QuitScriptFully +; 0xde19 + +Script_LoseToMitch: ; de19 (3:5e19) + start_script + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_0F + dw Script_Mitch_PrintTrainHarderText + run_command ScriptCommand_PrintTextQuitFully + tx Text0482 +; 0xde21 + +Script_Mitch_AlreadyHaveMedal: ; 0xde21 + run_command ScriptCommand_PrintTextString + tx Text0483 + run_command ScriptCommand_AskQuestionJump + tx Text047c + dw .do_battle + run_command ScriptCommand_PrintTextString + tx Text0484 + run_command ScriptCommand_QuitScriptFully +; 0xde2d +.do_battle + run_command ScriptCommand_PrintTextString + tx Text0485 + run_command ScriptCommand_StartBattle + db PRIZES_6 + db FIRST_STRIKE_DECK_ID + db MUSIC_DUEL_THEME_2 + run_command ScriptCommand_QuitScriptFully +; 0xde35 + +Script_Mitch_GiveBoosters: + run_command ScriptCommand_PrintTextString + tx Text0486 + run_command ScriptCommand_GiveBoosterPacks + db BOOSTER_LABORATORY_NEUTRAL + db BOOSTER_LABORATORY_NEUTRAL + db NO_BOOSTER + run_command ScriptCommand_PrintTextString + tx Text0487 + run_command ScriptCommand_QuitScriptFully +; 0xde40 + +Script_Mitch_PrintTrainHarderText: + run_command ScriptCommand_PrintTextQuitFully + tx Text0488 +; 0xde43 + + INCROM $de43, $ded1 + +Script_Clerk2: ; ded1 (3:5ed1) + INCROM $ded1, $ded5 + + +RockClubLobbyAfterDuel: ; ded5 (3:5ed5) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret +; 0xdedc + +.after_duel_table + + db NPC_CHRIS + db NPC_CHRIS + dw $5f0c + dw $5f20 + + db NPC_MATTHEW + db NPC_MATTHEW + dw $5f63 + dw $5f78 + db $00 +; 0xdee9 + + 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 + ret +; 0xe0a9 + +.after_duel_table + db NPC_IMAKUNI + db NPC_IMAKUNI + dw Script_BeatImakuni + dw Script_LostToImakuni + db $00 +; 0xe0b0 + Preload_ImakuniInWaterClubLobby: ; e0b0 (3:60b0) get_flag_value EVENT_IMAKUNI_STATE @@ -3962,7 +4234,6 @@ Preload_ImakuniInWaterClubLobby: ; e0b0 (3:60b0) ld [wd111], a scf ret -; 0xe0cf Script_Gal1: ; e0cf (3:60cf) start_script @@ -3988,7 +4259,7 @@ Script_Gal1: ; e0cf (3:60cf) run_command ScriptCommand_QuitScriptFully .ows_e0eb - run_command Func_cf0c + run_command ScriptCommand_CheckIfCardInCollectionOrDecks db $59 dw .ows_e0f3 run_command ScriptCommand_PrintTextString @@ -3996,7 +4267,7 @@ Script_Gal1: ; e0cf (3:60cf) run_command ScriptCommand_QuitScriptFully .ows_e0f3 - run_command Func_cf12 + run_command ScriptCommand_CheckIfCardInCollection db $59 dw .ows_e0fb run_command ScriptCommand_PrintTextString @@ -4580,7 +4851,45 @@ ScriptJump_TalkToAmyAgain: ; e356 (3:6356) run_command ScriptCommand_QuitScriptFully ; 0xe369 - INCROM $e369, $e525 +Script_Clerk4: ; e369 (3:6369) + INCROM $e369, $e36d + +LightningClubLobbyAfterDuel: ; e36d (3:636d) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret +; 0xe374 + +.after_duel_table + db NPC_IMAKUNI + db NPC_IMAKUNI + dw Script_BeatImakuni + dw Script_LostToImakuni + db $00 +; 0xe37B + + 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 @@ -4616,7 +4925,6 @@ FindEndOfBattleScript: ; e52c (3:652c) inc hl ld b, [hl] jp SetNextNPCAndScript -; 0xe553 GrassClubEntranceAfterDuelTable: ; e553 (3:6553) db NPC_MICHAEL @@ -4635,7 +4943,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 @@ -4694,13 +5006,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 @@ -4708,20 +5020,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 @@ -4755,14 +5066,14 @@ Script_e61f: ; e61f (3:661f) tx Text06ee .ows_e648 - run_command Func_cf0c + run_command ScriptCommand_CheckIfCardInCollectionOrDecks db $1c dw .ows_e64f run_command ScriptCommand_PrintTextQuitFully tx Text06ef .ows_e64f - run_command Func_cf12 + run_command ScriptCommand_CheckIfCardInCollection db $1c dw .ows_e656 run_command ScriptCommand_PrintTextQuitFully @@ -4805,14 +5116,14 @@ Script_e61f: ; e61f (3:661f) tx Text06f6 .ows_e67f - run_command Func_cf0c + run_command ScriptCommand_CheckIfCardInCollectionOrDecks db $ab dw .ows_e686 run_command ScriptCommand_PrintTextQuitFully tx Text06f7 .ows_e686 - run_command Func_cf12 + run_command ScriptCommand_CheckIfCardInCollection db $ab dw .ows_e68d run_command ScriptCommand_PrintTextQuitFully @@ -4855,14 +5166,14 @@ Script_e61f: ; e61f (3:661f) tx Text06fd .ows_e6b6 - run_command Func_cf0c + run_command ScriptCommand_CheckIfCardInCollectionOrDecks db $32 dw .ows_e6bd run_command ScriptCommand_PrintTextQuitFully tx Text06fe .ows_e6bd - run_command Func_cf12 + run_command ScriptCommand_CheckIfCardInCollection db $32 dw .ows_e6c4 run_command ScriptCommand_PrintTextQuitFully @@ -4888,7 +5199,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 @@ -4907,7 +5231,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 @@ -4945,7 +5269,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 @@ -5059,7 +5387,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 @@ -5152,7 +5480,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 @@ -5164,7 +5492,109 @@ ScriptJump_FinishedSecondRonaldFight ; e959 (3:6959) run_command ScriptCommand_QuitScriptFully ; 0xe963 - INCROM $e963, $ed57 + +PsychicClubLobbyAfterDuel: ; e963 (3:6963) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret +; 0xe96a + +.after_duel_table + + db NPC_ROBERT + db NPC_ROBERT + dw $6995 + dw $69a1 + db $00 + + 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 + call FindEndOfBattleScript + ret +; 0xeb5e + +.after_duel_table + + db NPC_IMAKUNI + db NPC_IMAKUNI + dw Script_BeatImakuni + dw Script_LostToImakuni + db $00 +; 0xeb65 + + 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 + call FindEndOfBattleScript + ret +; 0xed50 + +.after_duel_table + db NPC_JESSICA + db NPC_JESSICA + dw $6dba + dw $6dce + db $00 + +; 0xed57 FireClubPressedA: ; ed57 (3:6d57) ld hl, SlowpokePaintingObjectTable @@ -5212,7 +5642,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 @@ -5235,7 +5674,155 @@ Script_ee76: ; ee76 (3:6e76) run_command ScriptCommand_QuitScriptFully ; 0xee88 - INCROM $ee88, $ef96 +Script_Mania: ; ee88 (3:6e88) + INCROM $ee88, $ee93 + + +FireClubAfterDuel: ;ee93 (3:6e93) + ld hl, .after_duel_table + call FindEndOfBattleScript + ret + +.after_duel_table + db NPC_JOHN + db NPC_JOHN + dw $6ec8 + dw $6ed4 + + db NPC_ADAM + db NPC_ADAM + dw $6eed + dw $6ef9 + + db NPC_JONATHAN + db NPC_JONATHAN + dw $6f12 + dw $6f1e + + db NPC_KEN + db NPC_KEN + dw Script_BeatKen + dw Script_LoseToKen + + db $00 +; 0xeeb3 + +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 + run_command ScriptCommand_TryGivePCPack + db $09 + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_23 + dw .have_300_cards + run_command ScriptCommand_CheckRawAmountOfCardsOwned + dw 300 + dw .have_300_cards + run_command ScriptCommand_JumpIfFlagZero1 + db EVENT_FLAG_24 + dw NO_JUMP + run_command ScriptCommand_PrintVariableText + tx Text06ba + tx Text06bb + run_command ScriptCommand_SetFlagValue + db EVENT_FLAG_24 + db $01 + run_command ScriptCommand_QuitScriptFully +.have_300_cards + run_command ScriptCommand_MaxOutFlagValue + db EVENT_FLAG_23 + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_0A + dw Script_KenBattle_AlreadyHaveMedal + run_command ScriptCommand_JumpIfFlagZero1 + db EVENT_FLAG_24 + dw NO_JUMP + run_command ScriptCommand_PrintVariableText + tx Text06bc + tx Text06bd + run_command ScriptCommand_SetFlagValue + db EVENT_FLAG_24 + db $01 + run_command ScriptCommand_AskQuestionJump + tx Text06be + dw .do_battle + run_command ScriptCommand_PrintTextString + tx Text06bf + run_command ScriptCommand_QuitScriptFully +.do_battle + run_command ScriptCommand_PrintTextString + tx Text06c0 + run_command ScriptCommand_StartBattle + db PRIZES_6 + db FIRE_CHARGE_DECK_ID + db MUSIC_DUEL_THEME_2 + run_command ScriptCommand_QuitScriptFully +; 0xef5e + +Script_BeatKen: ; ef5e (3:6f5e) + start_script + run_command ScriptCommand_PrintTextString + tx Text06c1 + run_command ScriptCommand_JumpIfFlagNonzero2 + db EVENT_FLAG_0A + dw .give_booster_packs + run_command ScriptCommand_MaxOutFlagValue + db EVENT_FLAG_0A + run_command ScriptCommand_TryGiveMedalPCPacks + run_command Func_d125 + db $0a + run_command Func_d435 + db $08 + run_command ScriptCommand_PrintTextString + tx Text06c2 +.give_booster_packs + run_command ScriptCommand_GiveBoosterPacks + db BOOSTER_MYSTERY_NEUTRAL + db BOOSTER_MYSTERY_NEUTRAL + db NO_BOOSTER + run_command ScriptCommand_PrintTextString + tx Text06c3 + run_command ScriptCommand_QuitScriptFully +; 0xef78 + + + +Script_LoseToKen: ; ef78 (3:6f78) + start_script + run_command ScriptCommand_JumpIfFlagZero2 + db EVENT_FLAG_0A + dw NO_JUMP + run_command ScriptCommand_PrintVariableText + tx Text06c4 + tx Text06c5 + run_command ScriptCommand_QuitScriptFully +; 0xef83 + +Script_KenBattle_AlreadyHaveMedal: ; ef83 (3:6f83) + run_command ScriptCommand_PrintTextString + tx Text06c6 + run_command ScriptCommand_AskQuestionJump + tx Text06be + dw .do_battle + run_command ScriptCommand_PrintTextQuitFully + tx Text06bf +.do_battle + run_command ScriptCommand_PrintTextString + tx Text06c7 + run_command ScriptCommand_StartBattle + db PRIZES_6 + db FIRE_CHARGE_DECK_ID + db MUSIC_DUEL_THEME_2 + run_command ScriptCommand_QuitScriptFully +; 0xef96 Preload_Clerk9: ; ef96 (3:6f96) call TryGiveMedalPCPacks @@ -5518,7 +6105,6 @@ Func_f121: ; f121 (3:7121) jr nz, .asm_f123 or a ret -; 0xf146 Unknown_f146: ; f146 (3:7146) INCROM $f146, $f156 @@ -5573,7 +6159,6 @@ Preload_Guide: ; f270 (3:7270) .asm_f281 scf ret -; 0xf283 Script_Guide: ; f283 (3:7283) start_script @@ -5783,7 +6368,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) @@ -6025,7 +6610,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 @@ -6352,7 +6937,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 13df81b..a1e504f 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 @@ -982,14 +981,14 @@ OverworldScriptTable: ; 1217b (4:617b) dw ScriptCommand_MoveActiveNPCByDirection dw ScriptCommand_CloseTextBox dw ScriptCommand_GiveBoosterPacks - dw Func_cf0c - dw Func_cf12 + dw ScriptCommand_CheckIfCardInCollectionOrDecks + dw ScriptCommand_CheckIfCardInCollection dw ScriptCommand_GiveCard dw ScriptCommand_TakeCard dw Func_cf53 dw Func_cf7b - dw Func_cf2d - dw Func_cf96 + dw ScriptCommand_CheckRawAmountOfCardsOwned + dw ScriptCommand_JumpBasedOnFightingClubPupilStatus dw Func_cfc6 dw Func_cfd4 dw Func_d00b @@ -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..901f7c5 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. @@ -201,7 +190,7 @@ AITryUseAttack: ; 14145 (5:4145) call AISelectSpecialAttackParameters jr c, .use_attack - ld a, OPPACTION_BEGIN_ATTACK + ld a, EFFECTCMDTYPE_AI_SELECTION call TryExecuteEffectCommandFunction .use_attack @@ -215,12 +204,11 @@ AITryUseAttack: ; 14145 (5:4145) bank1call AIMakeDecision ret c - ld a, OPPACTION_ATTACK_ANIM_AND_DAMAGE + ld a, EFFECTCMDTYPE_AI_SWITCH_DEFENDING_PKMN call TryExecuteEffectCommandFunction 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] @@ -889,11 +866,9 @@ _CalculateDamage_VersusDefendingPokemon: ; 14462 (5:4462) ldh a, [hTempPlayAreaLocation_ff9d] or a call z, HandleDoubleDamageSubstatus - ; skips the weak/res checks if bit 7 is set - ; I guess to avoid overflowing? - ; should probably just have skipped weakness test instead? - bit 7, d - res 7, d + ; skips the weak/res checks if unaffected. + bit UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, d + res UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, d jr nz, .not_resistant ; handle weakness @@ -966,7 +941,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 +1044,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) @@ -1107,8 +1081,8 @@ CalculateDamage_FromDefendingPokemon: ; 1458c (5:458c) call SwapTurn call HandleDoubleDamageSubstatus - bit 7, d - res 7, d + bit UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, d + res UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, d jr nz, .not_resistant ; handle weakness @@ -1207,7 +1181,6 @@ CalculateDamage_FromDefendingPokemon: ; 1458c (5:458c) ld a, $ff ld [hl], a ret -; 0x14663 AIProcessHandTrainerCards: ; 14663 (5:4663) farcall _AIProcessHandTrainerCards @@ -1243,7 +1216,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 +1252,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 +1276,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 +1287,6 @@ AIAttachEnergyInHandToCardInBench: ; 1562b (5:562b) ret nc ld b, PLAY_AREA_BENCH_1 jr AIAttachEnergyInHandToCardInPlayArea.attach -; 0x15636 InitAIDuelVars: ; 15636 (5:5636) ld a, $10 @@ -1368,7 +1337,7 @@ InitAITurnVars: ; 15649 (5:5649) ; check if flag was already set, if so, ; reset wAIBarrierFlagCounter to $80. ld a, [wAIBarrierFlagCounter] - bit 7, a + bit AI_MEWTWO_MILL_F, a jr nz, .set_flag ; if not, increase it by 1 and check if it exceeds 2. @@ -1398,14 +1367,14 @@ InitAITurnVars: ; 15649 (5:5649) jr .done .set_flag - ld a, AI_FLAG_MEWTWO_MILL + 0 + ld a, AI_MEWTWO_MILL ld [wAIBarrierFlagCounter], a jr .done .check_flag ; increase counter by 1 if flag is set ld a, [wAIBarrierFlagCounter] - bit 7, a + bit AI_MEWTWO_MILL_F, a jr z, .reset_2 inc a ld [wAIBarrierFlagCounter], a @@ -1417,7 +1386,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 +1398,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 +1502,6 @@ CheckEnergyNeededForAttackAfterDiscard: ; 156c3 (5:56c3) ld d, 0 scf ret -; 0x1575e ; zeroes a bytes starting at hl ClearMemory_Bank5: ; 1575e (5:575e) @@ -1551,7 +1518,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 +1532,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 +1553,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 +1567,7 @@ CountNumberOfEnergyCardsAttached: ; 15787 (5:5787) ld a, [wTotalAttachedEnergies] or a ret z - + xor a push hl push bc @@ -1623,7 +1587,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 +1623,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 +1661,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 +1712,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 +1747,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 +1784,6 @@ TrySetUpBossStartingPlayArea: ; 1581b (5:581b) .not_found scf ret -; 0x1585b Func_1585b: ; 1585b (5:585b) INCROM $1585b, $158b2 @@ -1884,7 +1842,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 +2222,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 +2248,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 +2551,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 +2710,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 +2797,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) @@ -3166,7 +3120,7 @@ AIDecideEvolution: ; 15f4c (5:5f4c) .check_damage ld a, [wTempAI] ld e, a - call GetCardDamage + call GetCardDamageAndMaxHP or a jr z, .check_mysterious_fossil srl a @@ -3174,7 +3128,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 @@ -3338,7 +3292,7 @@ Func_16120: ; 16120 (5:6120) dec b ld e, b push bc - call GetCardDamage + call GetCardDamageAndMaxHP pop bc add c ld c, a @@ -3363,12 +3317,12 @@ 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 ld e, 0 - call GetCardDamage + call GetCardDamageAndMaxHP cp 50 jr c, .lower_score ld e, PLAY_AREA_ARENA @@ -3377,7 +3331,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 +3369,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 +3434,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 +3460,6 @@ CheckDamageToMrMime: ; 16270 (5:6270) .set_carry scf ret -; 0x1628f ; returns carry if arena card ; can knock out defending Pokémon @@ -3521,11 +3472,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 +3506,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 +3567,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 +3613,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 +3673,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 +3737,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 +3758,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 +3824,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 +3868,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 +3919,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 +3989,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 @@ -4147,7 +4087,7 @@ AIProcessEnergyCards: ; 164fc (5:64fc) ; arena ld a, [wAIBarrierFlagCounter] - bit 7, a + bit AI_MEWTWO_MILL_F, a jr z, .add_to_score ; subtract from score instead @@ -4302,7 +4242,7 @@ AIProcessEnergyCards: ; 164fc (5:64fc) ld a, $80 sub b call SubFromAIScore - + .skip_boss_deck ld a, 1 call AddToAIScore @@ -4313,7 +4253,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 +4292,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 +4491,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 +4568,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 +4607,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 +4616,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 +4699,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 +4864,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 +4872,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 +4950,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 +4992,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. @@ -5085,7 +5017,7 @@ AIProcessAttacks: ; 169fc (5:69fc) ; if Player is running Mewtwo1 mill deck, ; skip attack if Barrier counter is 0. ld a, [wAIBarrierFlagCounter] - cp AI_FLAG_MEWTWO_MILL + 0 + cp AI_MEWTWO_MILL + 0 jp z, .dont_attack ; determine AI score of both attacks. @@ -5122,7 +5054,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 +5121,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 +5199,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 +5248,7 @@ GetAIScoreOfAttack: ; 16a86 (5:6a86) ld a, e call CalculateByteTensDigit call SubFromAIScore - + push de ld a, MOVE_FLAG1_ADDRESS | HIGH_RECOIL_F call CheckLoadedMoveFlag @@ -5375,7 +5306,7 @@ GetAIScoreOfAttack: ; 16a86 (5:6a86) cp 31 jr nc, .high_recoil_generic_checks ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP sla a cp c jr c, .high_recoil_generic_checks @@ -5611,7 +5542,7 @@ GetAIScoreOfAttack: ; 16a86 (5:6a86) .tally_heal_score push af ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP call CalculateByteTensDigit pop bc cp b ; wLoadedMoveEffectParam @@ -5639,7 +5570,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 +5672,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 +5775,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 +5974,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 +6073,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 +6123,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 +6154,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, @@ -6262,7 +6189,7 @@ LookForCardThatIsKnockedOutOnDevolution: ; 17080 (5:7080) ld [wTempAI], a ld e, c push bc - call GetCardDamage + call GetCardDamageAndMaxHP pop bc ld e, a ld a, [wTempAI] @@ -6280,7 +6207,7 @@ LookForCardThatIsKnockedOutOnDevolution: ; 17080 (5:7080) ldh [hTempPlayAreaLocation_ff9d], a or a ret - + .set_carry call SwapTurn pop af @@ -6288,7 +6215,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 +6257,6 @@ CheckIfArenaCardIsAtHalfHPCanEvolveAndUseSecondMove: ; 170c9 (5:70c9) .no_carry or a ret -; 0x17101 ; count Pokemon in the Bench that ; meet the following conditions: @@ -6418,7 +6343,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 +6357,6 @@ AISelectSpecialAttackParameters: ; 17161 (5:7161) ld a, b ld [wSelectedAttack], a ret -; 0x1716e .SelectAttackParameters: ; 1716e (5:716e) ld a, DUELVARS_ARENA_CARD @@ -6489,7 +6412,7 @@ AISelectSpecialAttackParameters: ; 17161 (5:7161) ld a, CARD_LOCATION_DISCARD_PILE call CheckIfAnyCardIDinLocation ldh [hTemp_ffa0], a - farcall CreateEnergyCardListFromOpponentDiscardPile + farcall CreateEnergyCardListFromDiscardPile_AllEnergy ; find any energy card different from ; the one found by CheckIfAnyCardIDinLocation. @@ -6551,7 +6474,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 +6526,7 @@ CheckIfNoSurplusEnergyForMove: ; 171fb (5:71fb) inc de dec c jr nz, .loop - + ; colorless ld a, [de] swap a @@ -6622,17 +6544,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 +6577,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 +6629,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 +6762,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 +6797,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 +6831,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 +6874,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 +6912,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 +6932,6 @@ CheckIfOpponentHasBossDeckID: ; 17414 (5:7414) pop af or a ret -; 0x17426 ; sets carry if not a boss fight ; and if s0a00a == 0 @@ -7037,7 +6950,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 +6997,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 +7043,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 +7065,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 +7096,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 +7200,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 +7219,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) @@ -7319,7 +7227,7 @@ Func_174f2: ; 174f2 (5:74f2) Func_17583: ; 17583 (5:7583) push hl push de - call GetCardDamage + call GetCardDamageAndMaxHP call CalculateByteTensDigit ld b, a push bc @@ -7340,7 +7248,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 +7268,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 +7279,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 d3aa46a..ef8b699 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 @@ -1588,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 @@ -1619,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 @@ -1679,7 +1677,7 @@ Func_1a6cd: ; 1a6cd (6:66cd) lb de, $38, $9f call SetupText ld hl, $00a3 - bank1call Func_57df + bank1call DrawWholeScreenTextBox ld a, $0a ld [$0000], a xor a @@ -1981,7 +1979,7 @@ PrintPlayerNameFromInput: rept 10 textfw3 "_" endr - done + done ; check if button pressed. ; if pressed, set the carry bit on. @@ -2572,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 @@ -2755,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..a4aa5f8 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 @@ -554,7 +553,35 @@ Func_1c83d: ; 1c83d (7:483d) ret ; 0x1c858 - INCROM $1c858, $1c8ef + INCROM $1c858, $1c8bc + +Func_1c8bc: ; 1c8bc (7:48bc) + push hl + push bc + call Set_OBJ_8x8 + ld a, LOW(Func_3ba2) + ld [wDoFrameFunction], a + ld a, HIGH(Func_3ba2) + ld [wDoFrameFunction + 1], a + ld a, $ff + ld hl, wAnimationQueue + ld c, ANIMATION_QUEUE_LENGTH +.fill_queue + ld [hli], a + dec c + jr nz, .fill_queue + ld [wd42a], a + ld [wd4c0], a + xor a + ld [wd4ac], a + ld [wd4ad], a + ld [wd4b3], a + call Func_1ccbc + call Func_3ca0 + pop bc + pop hl + ret +; 0x1c8ef Func_1c8ef: ; 1c8ef (7:48ef) ld a, [wDoFrameFunction + 0] @@ -580,7 +607,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 +680,8 @@ Func_1c94a: ld [wd42b], a call Func_1c980 pop af - - farcall Func_12ab5 + + farcall StartNewSpriteAnimation or a jr .return @@ -667,7 +694,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 +706,7 @@ Func_1c980: ; 1c980 (7:4980) ld [hli], a ld [hl], c pop af - + ld bc, $000c add hl, bc ld c, a @@ -896,7 +923,24 @@ Func_1cb18: ; 1cb18 (7:4b18) jr .asm_1cb57 ; 0x1cb5e - INCROM $1cb5e, $1d078 + INCROM $1cb5e, $1ccbc + +Func_1ccbc: ; 1ccbc (7:4cbc) + ld a, $ff + ld [wd42a], a + call DisableInt_LYCoincidence + xor a + ldh [hSCX], a + ldh [rSCX], a + ldh [hSCY], a + ld hl, wd4b9 + ld [hl], LOW(Func_1ccbc) + inc hl + ld [hl], HIGH(Func_1ccbc) + ret +; 0x1ccd4 + + INCROM $1ccd4, $1d078 Func_1d078: ; 1d078 (7:5078) ld a, [wd627] diff --git a/src/engine/bank08.asm b/src/engine/bank08.asm index 1bb06a3..5283497 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) @@ -203,7 +202,7 @@ AIPlay_Potion: ; 201b5 (8:41b5) ld a, [wAITrainerCardParameter] ldh [hTemp_ffa0], a ld e, a - call GetCardDamage + call GetCardDamageAndMaxHP cp 20 jr c, .play_card ld a, 20 @@ -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 @@ -234,7 +232,7 @@ AIDecide_Potion1: ; 201d1 (8:41d1) call GetTurnDuelistVariable ld h, a ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP cp 20 + 1 ; if damage <= 20 jr c, .calculate_hp ld a, 20 ; amount of Potion HP healing @@ -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: @@ -273,7 +270,7 @@ AIDecide_Potion2: ; 20204 (8:4204) call GetTurnDuelistVariable ld h, a ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP cp 20 + 1 ; if damage <= 20 jr c, .calculate_hp ld a, 20 @@ -310,9 +307,9 @@ 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 + call GetCardDamageAndMaxHP cp 20 ; if damage >= 20 jr nc, .found .has_boost_damage @@ -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) @@ -397,7 +392,7 @@ AIPlay_SuperPotion: ; 202a8 (8:42a8) ldh [hTemp_ffa0], a ld a, [wAITrainerCardParameter] ld e, a - call GetCardDamage + call GetCardDamageAndMaxHP cp 40 jr c, .play_card ld a, 40 @@ -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 @@ -432,7 +426,7 @@ AIDecide_SuperPotion1: ; 202cc (8:42cc) call GetTurnDuelistVariable ld h, a ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP cp 40 + 1 ; if damage < 40 jr c, .calculate_hp ld a, 40 @@ -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: @@ -478,7 +470,7 @@ AIDecide_SuperPotion2: ; 2030f (8:430f) call GetTurnDuelistVariable ld h, a ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP cp 40 + 1 ; if damage < 40 jr c, .calculate_hp ld a, 40 @@ -524,7 +516,7 @@ AIDecide_SuperPotion2: ; 2030f (8:430f) jr c, .next call .check_energy_cost jr c, .next - call GetCardDamage + call GetCardDamageAndMaxHP cp 40 ; if damage >= 40 jr nc, .found .next @@ -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 @@ -2309,7 +2274,7 @@ AIDecide_PokemonBreeder: ; 20b1b (8:4b1b) dec b ld e, b push bc - call GetCardDamage + call GetCardDamageAndMaxHP pop bc call ConvertHPToCounters add c @@ -2331,7 +2296,7 @@ AIDecide_PokemonBreeder: ; 20b1b (8:4b1b) ; compare number of this card's damage counters ; with 5, if less than that, set carry ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP cp 5 jr c, .set_carry @@ -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 @@ -3232,7 +3182,7 @@ AIDecide_PokemonCenter: ; 210eb (8:50eb) ; get this Pokemon's current damage counters ; and add it to the total. - call GetCardDamage + call GetCardDamageAndMaxHP call ConvertHPToCounters ld b, a ld a, [wce08] @@ -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) @@ -4017,7 +3950,7 @@ AIDecide_MrFuji: ; 214a7 (8:54a7) ld b, a ; skip if zero damage counters - call GetCardDamage + call GetCardDamageAndMaxHP call ConvertHPToCounters or a jr z, .next @@ -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 @@ -4130,7 +4061,7 @@ AIDecide_ScoopUp: ; 21506 (8:5506) ; skip if card has no damage counters. ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP or a jr z, .no_carry @@ -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 @@ -4708,7 +4626,7 @@ AIDecide_Gambler: ; 21875 (8:5875) ; check if flag is set for Player using Mewtwo1 only deck ld a, [wAIBarrierFlagCounter] - and AI_FLAG_MEWTWO_MILL + and AI_MEWTWO_MILL jr z, .no_carry ; set carry if number of cards in deck <= 4. @@ -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: @@ -6747,13 +6637,12 @@ HandleAIHeal: ; 22402 (8:6402) ld a, OPPACTION_USE_PKMN_POWER bank1call AIMakeDecision pop af - ldh [hAIHealCard], a + ldh [hPlayAreaEffectTarget], a ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT bank1call AIMakeDecision 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 @@ -6764,7 +6653,7 @@ HandleAIHeal: ; 22402 (8:6402) ; check if Arena card has any damage counters, ; if not, check Bench instead. ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP or a jr z, .check_bench @@ -6777,7 +6666,7 @@ HandleAIHeal: ; 22402 (8:6402) call GetTurnDuelistVariable ld h, a ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP ; this seems useless since it was already ; checked that Arena card has damage, ; so card damage is at least 10. @@ -6815,7 +6704,7 @@ HandleAIHeal: ; 22402 (8:6402) cp d jr z, .done push bc - call GetCardDamage + call GetCardDamageAndMaxHP pop bc cp b jr c, .next_bench @@ -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: @@ -6938,7 +6824,7 @@ HandleAIPeek: ; 224e6 (8:64e6) ld a, 3 call Random or a - jr z, .check_player_prizes + jr z, .check_ai_prizes cp 2 jr c, .check_player_hand @@ -6947,10 +6833,10 @@ HandleAIPeek: ; 224e6 (8:64e6) call GetNonTurnDuelistVariable cp DECK_SIZE - 1 ret nc ; return if Player has one or no cards in Deck - ld a, $ff + ld a, AI_PEEK_TARGET_DECK jr .use_peek -.check_player_prizes +.check_ai_prizes ld a, DUELVARS_PRIZES call GetTurnDuelistVariable ld hl, wcda5 @@ -6975,7 +6861,7 @@ HandleAIPeek: ; 224e6 (8:64e6) ld a, c sub b ld [hl], a - ld a, $40 + ld a, AI_PEEK_TARGET_PRIZE add d jr .use_peek @@ -6990,7 +6876,7 @@ HandleAIPeek: ; 224e6 (8:64e6) call CountCardsInDuelTempList call ShuffleCards ld a, [wDuelTempList] - or $80 + or AI_PEEK_TARGET_HAND .use_peek push af @@ -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: @@ -7017,7 +6902,7 @@ HandleAIStrangeBehavior: ; 2255d (8:655d) ldh [hTemp_ffa0], a ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP or a ret z ; return if Arena card has no damage counters @@ -7072,7 +6957,6 @@ HandleAIStrangeBehavior: ; 2255d (8:655d) ld a, OPPACTION_DUEL_MAIN_SCENE bank1call AIMakeDecision ret -; 0x225b5 ; checks whether AI uses Curse. ; input: @@ -7093,7 +6977,7 @@ HandleAICurse: ; 225b5 (8:65b5) call SwapTurn .loop_play_area_1 push bc - call GetCardDamage + call GetCardDamageAndMaxHP pop bc or a jr z, .next_1 @@ -7149,7 +7033,7 @@ HandleAICurse: ; 225b5 (8:65b5) cp b jr z, .next_2 ; skip same Pokemon card push bc - call GetCardDamage + call GetCardDamageAndMaxHP pop bc jr nz, .use_curse ; has damage counters, choose this card .next_2 @@ -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. @@ -7234,7 +7116,7 @@ HandleAICowardice: ; 2262d (8:662d) ld a, c ldh [hTemp_ffa0], a ld e, a - call GetCardDamage + call GetCardDamageAndMaxHP .asm_22678 or a ret z ; return if has no damage counters @@ -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 @@ -7302,7 +7183,7 @@ HandleAIDamageSwap: ; 226a3 (8:66a3) .ok ld e, PLAY_AREA_ARENA - call GetCardDamage + call GetCardDamageAndMaxHP or a ret z ; return if no damage @@ -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 @@ -7503,12 +7380,12 @@ CheckIfPlayerHasPokemonOtherThanMewtwo1: ; 227a9 (8:67a9) HandleAIAntiMewtwoDeckStrategy: ; 227d3 (8:67d3) ; return carry if Player is not playing Mewtwo1 mill deck ld a, [wAIBarrierFlagCounter] - bit 7, a + bit AI_MEWTWO_MILL_F, a jr z, .set_carry ; else, check if there's been less than 2 turns ; without the Player using Barrier. - cp AI_FLAG_MEWTWO_MILL + 2 + cp AI_MEWTWO_MILL + 2 jr c, .count_bench ; if there has been, reset wAIBarrierFlagCounter @@ -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..2e7c40b 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -15,6 +15,8 @@ Paralysis50PercentEffect: ; 2c011 (b:4011) ldtx de, ParalysisCheckText call TossCoin_BankB ret nc + +ParalysisEffect: ; 2c018 (b:4018) lb bc, PSN_DBLPSN, PARALYZED jr ApplyStatusEffect @@ -27,6 +29,7 @@ ConfusionEffect: ; 2c024 (b:4024) lb bc, PSN_DBLPSN, CONFUSED jr ApplyStatusEffect +Sleep50PercentEffect: ; 2c029 (b:4029) ldtx de, SleepCheckText call TossCoin_BankB ret nc @@ -57,7 +60,7 @@ ApplyStatusEffect: .cant_induce_status ld a, c - ld [wNoEffectFromStatus], a + ld [wNoEffectFromWhichStatus], a call SetNoEffectFromStatus or a ret @@ -83,21 +86,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 +115,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,16 +139,15 @@ 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) +; return carry if Player is the Turn Duelist +IsPlayerTurn: ; 2c0c7 (b:40c7) ld a, DUELVARS_DUELIST_TYPE call GetTurnDuelistVariable cp DUELIST_TYPE_PLAYER @@ -162,29 +157,33 @@ Func_2c0c7: ; 2c0c7 (b:40c7) .player scf ret -; 0x2c0d4 -; Sets some flags for AI use +; Stores information about the attack damage for AI purposes +; taking into account poison damage between turns. ; if target poisoned -; [wAIMinDamage] <- [wDamage] -; [wAIMaxDamage] <- [wDamage] +; [wAIMinDamage] <- [wDamage] +; [wAIMaxDamage] <- [wDamage] ; else -; [wAIMinDamage] <- [wDamage] + d -; [wAIMaxDamage] <- [wDamage] + e -; [wDamage] <- [wDamage] + a -Func_2c0d4: ; 2c0d4 (b:40d4) +; [wAIMinDamage] <- [wDamage] + d +; [wAIMaxDamage] <- [wDamage] + e +; [wDamage] <- [wDamage] + a +UpdateExpectedAIDamage_AccountForPoison: ; 2c0d4 (b:40d4) push af ld a, DUELVARS_ARENA_CARD_STATUS call GetNonTurnDuelistVariable and POISONED | DOUBLE_POISONED - jr z, Func_2c0e9.skip_push_af + jr z, UpdateExpectedAIDamage.skip_push_af pop af ld a, [wDamage] ld [wAIMinDamage], a ld [wAIMaxDamage], a ret -Func_2c0e9: ; 2c0e9 (b:40e9) +; Sets some variables for AI use +; [wAIMinDamage] <- [wDamage] + d +; [wAIMaxDamage] <- [wDamage] + e +; [wDamage] <- [wDamage] + a +UpdateExpectedAIDamage: ; 2c0e9 (b:40e9) push af .skip_push_af @@ -199,13 +198,12 @@ Func_2c0e9: ; 2c0e9 (b:40e9) add [hl] ld [hl], a ret -; 0x2c0fb -; Sets some flags for AI use -; [wDamage] <- a -; [wAIMinDamage] <- d -; [wAIMaxDamage] <- e -Func_2c0fb: ; 2c0fb (b:40fb) +; Stores information about the attack damage for AI purposes +; [wDamage] <- a (average amount of damage) +; [wAIMinDamage] <- d (minimum) +; [wAIMaxDamage] <- e (maximum) +SetExpectedAIDamage: ; 2c0fb (b:40fb) ld [wDamage], a xor a ld [wDamage + 1], a @@ -214,7 +212,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 +219,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 @@ -236,14 +232,13 @@ DealDamageToAllBenchedPokemon: ; 2c117 (b:4117) jr .skip_to_bench .loop push bc - call DealDamageToPlayAreaPokemon + call DealDamageToPlayAreaPokemon_RegularAnim pop bc .skip_to_bench inc b dec c jr nz, .loop ret -; 0x2c12e Func_2c12e: ; 2c12e (b:412e) ld [wLoadedMoveAnimation], a @@ -255,7 +250,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 +259,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 @@ -284,17 +277,16 @@ ApplySubstatus2ToDefendingCard: ; 2c149 (b:4149) .no_damage_orEffect pop af push hl - bank1call $4f9d + bank1call DrawDuelMainScene pop hl ld a, l or h call nz, DrawWideTextBox_PrintText ret -; 0x2c166 ; overwrites in wDamage, wAIMinDamage and wAIMaxDamage ; with the value in a. -StoreDamageInfo: ; 2c166 (b:4166) +SetDefiniteDamage: ; 2c166 (b:4166) ld [wDamage], a ld [wAIMinDamage], a ld [wAIMaxDamage], a @@ -303,7 +295,122 @@ StoreDamageInfo: ; 2c166 (b:4166) ret ; 0x2c174 - INCROM $2c174, $2c1ec +; overwrites wAIMinDamage and wAIMaxDamage +; with value in wDamage. +SetMinMaxDamageSameAsDamage: ; 2c174 (b:4174) + ld a, [wDamage] + ld [wAIMinDamage], a + ld [wAIMaxDamage], a + ret +; 0x2c17e + +; returns in a some random occupied Play Area location +; in Turn Duelist's Play Area. +PickRandomPlayAreaCard: ; 2c17e (b:417e) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + call Random + or a + ret +; 0x2c188 + +; outputs in hl the next position +; in hTempList to place a new card, +; and increments hCurSelectionItem. +GetNextPositionInTempList: ; 2c188 (b:4188) + push de + ld hl, hCurSelectionItem + ld a, [hl] + inc [hl] + ld e, a + ld d, $00 + ld hl, hTempList + add hl, de + pop de + ret +; 0x2c197 + +; creates in wDuelTempList list of attached Fire Energy cards +; that are attached to the Turn Duelist's Arena card. +CreateListOfFireEnergyAttachedToArena: ; 2c197 (b:4197) + ld a, TYPE_ENERGY_FIRE + ; fallthrough + +; creates in wDuelTempList a list of cards that +; are in the Arena of the same type as input a. +; this is called to list Energy cards of a specific type +; that are attached to the Arena Pokemon. +; input: +; a = TYPE_ENERGY_* constant +; output: +; a = number of cards in list; +; wDuelTempList filled with cards, terminated by $ff +CreateListOfEnergyAttachedToArena: ; 2c199 (b:4199) + ld b, a + ld c, 0 + ld de, wDuelTempList + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop + ld a, [hl] + cp CARD_LOCATION_ARENA + jr nz, .next + push de + ld a, l + call GetCardIDFromDeckIndex + call GetCardType + pop de + cp b + jr nz, .next ; is same as input type? + ld a, l + ld [de], a + inc de + inc c +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop + + ld a, $ff + ld [de], a + ld a, c + ret +; 0x2c1c4 + +; prints the text "<X> devolved to <Y>!" with +; the proper card names and levels. +; input: +; d = deck index of the lower stage card +; e = deck index of card that was devolved +PrintDevolvedCardNameAndLevelText: ; 2c1c4 (b:41c4) + push de + ld a, e + call LoadCardDataToBuffer1_FromDeckIndex + ld bc, wTxRam2 + ld hl, wLoadedCard1Name + ld a, [hli] + ld [bc], a + inc bc + ld a, [hl] + ld [bc], a + + inc bc ; wTxRam2_b + xor a + ld [bc], a + inc bc + ld [bc], a + + ld a, d + call LoadCardDataToBuffer1_FromDeckIndex + ld a, 18 + call CopyCardNameAndLevel + ld [hl], $00 + ldtx hl, PokemonDevolvedToText + call DrawWideTextBox_WaitForInput + pop de + ret +; 0x2c1ec HandleSwitchDefendingPokemonEffect: ; 2c1ec (b:41ec) ld e, a @@ -322,7 +429,7 @@ HandleSwitchDefendingPokemonEffect: ; 2c1ec (b:41ec) pop de .switch - call .HandleNoDamageOrEffect + call HandleNoDamageOrEffect ret c ; attack was successful, switch Defending Pokemon @@ -336,11 +443,10 @@ 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. -.HandleNoDamageOrEffect: ; 2c216 (b:4216) +HandleNoDamageOrEffect: ; 2c216 (b:4216) call CheckNoDamageOrEffect ret nc ld a, l @@ -350,16 +456,144 @@ HandleSwitchDefendingPokemonEffect: ; 2c1ec (b:41ec) ret ; 0x2c221 - INCROM $2c221, $2c2a4 +; applies HP recovery on Pokemon after an attack +; with HP recovery effect, and handles its animation. +; input: +; d = damage effectiveness +; e = HP amount to recover +ApplyAndAnimateHPRecovery: ; 2c221 (b:4221) + push de + ld hl, wccbd + ld [hl], e + inc hl + ld [hl], d + +; get Arena card's damage + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + pop de + or a + ret z ; return if no damage + +; load correct animation + push de + ld a, $79 + ld [wLoadedMoveAnimation], a + ld bc, $01 ; arrow + bank1call PlayMoveAnimation + +; compare HP to be restored with max HP +; if HP to be restored would cause HP to +; be larger than max HP, cap it accordingly + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + ld b, $00 + pop de + ld a, DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + add e + ld e, a + ld a, 0 + adc d + ld d, a + ; de = damage dealt + current HP + ; bc = max HP of card + call CompareDEtoBC + jr c, .skip_cap + ; cap de to value in bc + ld e, c + ld d, b + +.skip_cap + ld [hl], e ; apply new HP to arena card + bank1call WaitMoveAnimation + ret +; 0x2c25b + +; returns carry if Play Area has no damage counters. +CheckIfPlayAreaHasAnyDamage: ; 2c25b (b:425b) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld d, a + ld e, PLAY_AREA_ARENA +.loop_play_area + call GetCardDamageAndMaxHP + or a + ret nz ; found damage + inc e + dec d + jr nz, .loop_play_area + ; no damage found + scf + ret +; 0x2c26e + +; makes a list in wDuelTempList with the deck indices +; of Trainer cards found in Turn Duelist's Discard Pile. +; returns carry set if no Trainer cards found, and loads +; corresponding text to notify this. +CreateTrainerCardListFromDiscardPile: ; 2c26e (b:426e) +; get number of cards in Discard Pile +; and have hl point to the end of the +; Discard Pile list in wOpponentDeckCards. + ld a, DUELVARS_NUMBER_OF_CARDS_IN_DISCARD_PILE + call GetTurnDuelistVariable + ld b, a + add DUELVARS_DECK_CARDS + ld l, a + + ld de, wDuelTempList + inc b + jr .next_card + +.check_trainer + ld a, [hl] + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_TRAINER + jr nz, .next_card + + ld a, [hl] + ld [de], a + inc de + +.next_card + dec l + dec b + jr nz, .check_trainer + + ld a, $ff ; terminating byte + ld [de], a + ld a, [wDuelTempList] + cp $ff + jr z, .no_trainers + or a + ret +.no_trainers + ldtx hl, ThereAreNoTrainerCardsInDiscardPileText + scf + ret +; 0x2c2a0 ; makes a list in wDuelTempList with the deck indices -; of all the energy cards found in opponent's Discard Pile. -; if (c == 0), all energy cards are allowed; -; if (c != 0), double colorless energy cards are not counted. -; returns carry if no energy cards were found. -CreateEnergyCardListFromOpponentDiscardPile: ; 2c2a4 (b:42a4) +; of all basic energy cards found in Turn Duelist's Discard Pile. +CreateEnergyCardListFromDiscardPile_OnlyBasic: ; 2c2a0 (b:42a0) + ld c, $01 + jr CreateEnergyCardListFromDiscardPile + +; makes a list in wDuelTempList with the deck indices +; of all energy cards (including Double Colorless) +; found in Turn Duelist's Discard Pile. +CreateEnergyCardListFromDiscardPile_AllEnergy: ; 2c2a4 (b:42a4) ld c, $00 +; fallthrough +; makes a list in wDuelTempList with the deck indices +; of energy cards found in Turn Duelist's Discard Pile. +; if (c == 0), all energy cards are allowed; +; if (c != 0), double colorless energy cards are not included. +; returns carry if no energy cards were found. +CreateEnergyCardListFromDiscardPile: ; 2c2a6 (b:42a6) ; get number of cards in Discard Pile ; and have hl point to the end of the ; Discard Pile list in wOpponentDeckCards. @@ -420,12 +654,359 @@ CreateEnergyCardListFromOpponentDiscardPile: ; 2c2a4 (b:42a4) ret ; 0x2c2e0 - INCROM $2c2e0, $2c487 +; returns carry if Deck is empty +CheckIfDeckIsEmpty: ; 2c2e0 (b:42e0) + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetTurnDuelistVariable + ldtx hl, NoCardsLeftInTheDeckText + cp DECK_SIZE + ccf + ret +; 0x2c2ec + +; searches through Deck in wDuelTempList looking for +; a certain card or cards, and prints text depending +; on whether at least one was found. +; if none were found, asks the Player whether to look +; in the Deck anyway, and returns carry if No is selected. +; uses SEARCHEFFECT_* as input which determines what to search for: +; SEARCHEFFECT_CARD_ID = search for card ID in e +; SEARCHEFFECT_NIDORAN = search for either NidoranM or NidoranF +; SEARCHEFFECT_BASIC_FIGHTING = search for any Basic Fighting Pokemon +; SEARCHEFFECT_BASIC_ENERGY = search for any Basic Energy +; SEARCHEFFECT_POKEMON = search for any Pokemon card +; input: +; d = SEARCHEFFECT_* constant +; e = (optional) card ID to search for in deck +; hl = text to print if Deck has card(s) +; output: +; carry set if refused to look at deck +LookForCardsInDeck: ; 2c2ec (b:42ec) + push hl + push bc + ld a, [wDuelTempList] + cp $ff + jr z, .none_in_deck + ld a, d + ld hl, .search_table + call JumpToFunctionInTable + jr c, .none_in_deck + pop bc + pop hl + call DrawWideTextBox_WaitForInput + or a + ret + +.none_in_deck + pop hl + call LoadTxRam2 + pop hl + ldtx hl, ThereIsNoInTheDeckText + call DrawWideTextBox_WaitForInput + ldtx hl, WouldYouLikeToCheckTheDeckText + call YesOrNoMenuWithText_SetCursorToYes + ret +; 0x2c317 + +.search_table + dw .SearchDeckForCardID + dw .SearchDeckForNidoran + dw .SearchDeckForBasicFighting + dw .SearchDeckForBasicEnergy + dw .SearchDeckForPokemon + +.set_carry ; 2c321 (b:4321) + scf + ret +; 0x2c323 + +; returns carry if no card with +; same card ID as e is found in Deck +.SearchDeckForCardID ; 2c323 (b:4323) + ld hl, wDuelTempList +.loop_deck_e + ld a, [hli] + cp $ff + jr z, .set_carry + push de + call GetCardIDFromDeckIndex + ld a, e + pop de + cp e + jr nz, .loop_deck_e + or a + ret +; 0x2c336 -; handles the selection of a forced switch -; by link/AI opponent or by the player. -; outputs the Play Area location of the chosen -; bench card in hTempPlayAreaLocation_ff9d. +; returns carry if no NidoranM or NidoranF card is found in Deck +.SearchDeckForNidoran ; 2c336 (b:4336) + ld hl, wDuelTempList +.loop_deck_nidoran + ld a, [hli] + cp $ff + jr z, .set_carry + call GetCardIDFromDeckIndex + ld a, e + cp NIDORANF + jr z, .found_nidoran + cp NIDORANM + jr nz, .loop_deck_nidoran +.found_nidoran + or a + ret +; 0x2c34c + +; returns carry if no Basic Fighting Pokemon is found in Deck +.SearchDeckForBasicFighting ; 2c34c (b:434c) + ld hl, wDuelTempList +.loop_deck_fighting + ld a, [hli] + cp $ff + jr z, .set_carry + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_PKMN_FIGHTING + jr nz, .loop_deck_fighting + ld a, [wLoadedCard2Stage] + or a ; BASIC + jr nz, .loop_deck_fighting + ret +; 0x2c365 + +; returns carry if no Basic Energy cards are found in Deck +.SearchDeckForBasicEnergy ; 2c365 (b:4365) + ld hl, wDuelTempList +.loop_deck_energy + ld a, [hli] + cp $ff + jr z, .set_carry + call GetCardIDFromDeckIndex + call GetCardType + cp TYPE_ENERGY_DOUBLE_COLORLESS + jr z, .loop_deck_energy + and TYPE_ENERGY + jr z, .loop_deck_energy + or a + ret +; 0x2c37d + +; returns carry if no Pokemon cards are found in Deck +.SearchDeckForPokemon ; 2c37d (b:437d) + ld hl, wDuelTempList +.loop_deck_pkmn + ld a, [hli] + cp $ff + jr z, .set_carry + call GetCardIDFromDeckIndex + call GetCardType + cp TYPE_ENERGY + jr nc, .loop_deck_pkmn + or a + ret +; 0x2c391 + +; handles the Player selection of attack +; to use, i.e. Amnesia or Metronome on. +; returns carry if none selected. +; outputs: +; d = card index of defending card +; e = attack index selected +HandleDefendingPokemonAttackSelection: ; 2c391 (b:4391) + bank1call DrawDuelMainScene + call SwapTurn + xor a + ldh [hCurSelectionItem], a + +.start + bank1call PrintAndLoadMovesToDuelTempList + push af + ldh a, [hCurSelectionItem] + ld hl, .menu_parameters + call InitializeMenuParameters + pop af + + ld [wNumMenuItems], a + call EnableLCD +.loop_input + call DoFrame + ldh a, [hKeysPressed] + bit B_BUTTON_F, a + jr nz, .set_carry + and START + jr nz, .open_move_page + call HandleMenuInput + jr nc, .loop_input + cp -1 + jr z, .loop_input + +; a move was selected + ldh a, [hCurMenuItem] + add a + ld e, a + ld d, $00 + ld hl, wDuelTempList + add hl, de + ld d, [hl] + inc hl + ld e, [hl] + call SwapTurn + or a + ret + +.set_carry + call SwapTurn + scf + ret + +.open_move_page + ldh a, [hCurMenuItem] + ldh [hCurSelectionItem], a + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + bank1call OpenMovePage + call SwapTurn + bank1call DrawDuelMainScene + call SwapTurn + jr .start +; 0x2c3f4 + +.menu_parameters + db 1, 13 ; cursor x, cursor y + db 2 ; y displacement between items + db 2 ; number of items + db SYM_CURSOR_R ; cursor tile number + db SYM_SPACE ; tile behind cursor + dw $0000 ; function pointer if non-0 +; 0x2c3fc + +; loads in hl the pointer to attack's name. +; input: +; d = deck index of card +; e = attack index (0 = first attack, 1 = second attack) +GetAttackName: ; 2c3fc (b:43fc) + ld a, d + call LoadCardDataToBuffer1_FromDeckIndex + ld hl, wLoadedCard1Move1Name + inc e + dec e + jr z, .load_name + ld hl, wLoadedCard1Move2Name +.load_name + ld a, [hli] + ld h, [hl] + ld l, a + ret +; 0x2c40e + +; returns carry if Defending Pokemon +; doesn't have an attack. +CheckIfDefendingPokemonHasAnyAttack: ; 2c40e (b:440e) + call SwapTurn + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Move1Category] + cp POKEMON_POWER + jr nz, .has_attack + ld hl, wLoadedCard2Move2Name + ld a, [hli] + or [hl] + jr nz, .has_attack + call SwapTurn + scf + ret +.has_attack + call SwapTurn + or a + ret +; 0x2c431 + +; overwrites HP and Stage data of the card that was +; devolved in the Play Area to the values of new card. +; if the damage exceeds HP of pre-evolution, +; then HP is set to zero. +; input: +; a = card index of pre-evolved card +UpdateDevolvedCardHPAndStage: ; 2c431 (b:4431) + push bc + push de + push af + ldh a, [hTempPlayAreaLocation_ff9d] + ld e, a + call GetCardDamageAndMaxHP + ld b, a ; store damage + ld a, e + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + pop af + + ld [hl], a + call LoadCardDataToBuffer2_FromDeckIndex + ld a, e + add DUELVARS_ARENA_CARD_HP + ld l, a + ld a, [wLoadedCard2HP] + sub b ; subtract damage from new HP + jr nc, .got_hp + ; damage exceeds HP + xor a ; 0 HP +.got_hp + ld [hl], a + ld a, e +; overwrite card stage + add DUELVARS_ARENA_CARD_STAGE + ld l, a + ld a, [wLoadedCard2Stage] + ld [hl], a + pop de + pop bc + ret +; 0x2c45d + +; reset various status after devolving card. +ResetDevolvedCardStatus: ; 2c45d (b:445d) +; if it's Arena card, clear status conditions + ldh a, [hTempPlayAreaLocation_ff9d] + or a + jr nz, .skip_clear_status + call ClearAllStatusConditions +.skip_clear_status +; reset changed color status + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD_CHANGED_TYPE + call GetTurnDuelistVariable + ld [hl], $00 +; reset C2 flags + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD_FLAGS + ld l, a + ld [hl], $00 + ret +; 0x2c476 + +; prompts the Player with a Yes/No question +; whether to quit the screen, even though +; they can select more cards from list. +; [hCurSelectionItem] holds number of cards +; that were already selected by the Player. +; input: +; - a = total number of cards that can be selected +; output: +; - carry set if "No" was selected +AskWhetherToQuitSelectingCards: ; 2c476 (b:4476) + ld hl, hCurSelectionItem + sub [hl] + ld l, a + ld h, $00 + call LoadTxRam3 + ldtx hl, YouCanSelectMoreCardsQuitText + call YesOrNoMenuWithText + ret +; 0x2c487 + +; handles the selection of a forced switch by link/AI opponent or by the player. +; outputs the Play Area location of the chosen bench card in hTempPlayAreaLocation_ff9d. DuelistSelectForcedSwitch: ; 2c487 (b:4487) ld a, DUELVARS_DUELIST_TYPE call GetNonTurnDuelistVariable @@ -477,13 +1058,403 @@ DuelistSelectForcedSwitch: ; 2c487 (b:4487) ret ; 0x2c4da - INCROM $2c4da, $2c6f0 +; returns in a the card index of energy card +; attached to Defending Pokemon +; that is to be discarded by the AI for an effect. +; outputs $ff is none was found. +; output: +; a = deck index of attached energy card chosen +AIPickEnergyCardToDiscardFromDefendingPokemon: ; 2c4da (b:44da) + call SwapTurn + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + + xor a + call CreateArenaOrBenchEnergyCardList + jr nc, .has_energy + ; no energy, return + ld a, $ff + jr .done + +.has_energy + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + ld e, COLORLESS + ld a, [wAttachedEnergies + COLORLESS] + or a + jr nz, .pick_color ; has colorless attached? + + ; no colorless energy attached. + ; if it's colorless Pokemon, just + ; pick any energy card at random... + ld a, [wLoadedCard1Type] + cp COLORLESS + jr nc, .choose_random + + ; ...if not, check if it has its + ; own color energy attached. + ; if it doesn't, pick at random. + ld e, a + ld d, $00 + ld hl, wAttachedEnergies + add hl, de + ld a, [hl] + or a + jr z, .choose_random + +; pick attached card with same color as e +.pick_color + ld hl, wDuelTempList +.loop_energy + ld a, [hli] + cp $ff + jr z, .choose_random + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + and TYPE_PKMN + cp e + jr nz, .loop_energy + dec hl + +.done_chosen + ld a, [hl] +.done + call SwapTurn + ret + +.choose_random + call CountCardsInDuelTempList + ld hl, wDuelTempList + call ShuffleCards + jr .done_chosen +; 0x2c532 + +; handles AI logic to pick attack for Amnesia +AIPickAttackForAmnesia: ; 2c532 (b:4532) +; load Defending Pokemon attacks + call SwapTurn + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + call HandleEnergyBurn + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + ld d, a + call LoadCardDataToBuffer2_FromDeckIndex +; if has no attack 1 name, return + ld hl, wLoadedCard2Move1Name + ld a, [hli] + or [hl] + jr z, .chosen + +; if Defending Pokemon has enough energy for second attack, choose it + ld e, SECOND_ATTACK + bank1call _CheckIfEnoughEnergiesToMove + jr nc, .chosen +; otherwise if first attack isn't a Pkmn Power, choose it instead. + ld e, FIRST_ATTACK_OR_PKMN_POWER + ld a, [wLoadedCard2Move1Category] + cp POKEMON_POWER + jr nz, .chosen +; if it is a Pkmn Power, choose second attack. + ld e, SECOND_ATTACK +.chosen + ld a, e + call SwapTurn + ret +; 0x2c564 + +; Return in a the PLAY_AREA_* of the non-turn holder's Pokemon card in bench with the lowest (remaining) HP. +; if multiple cards are tied for the lowest HP, the one with the highest PLAY_AREA_* is returned. +GetBenchPokemonWithLowestHP: ; 2c564 (b:4564) + call SwapTurn + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld c, a + lb de, PLAY_AREA_ARENA, $ff + ld b, d + ld a, DUELVARS_BENCH1_CARD_HP + call GetTurnDuelistVariable + jr .start +; find Play Area location with least amount of HP +.loop_bench + ld a, e + cp [hl] + jr c, .next ; skip if HP is higher + ld e, [hl] + ld d, b + +.next + inc hl +.start + inc b + dec c + jr nz, .loop_bench + + ld a, d + call SwapTurn + ret +; 0x2c588 + +; handles drawing and selection of screen for +; choosing a color (excluding colorless), for use +; of Shift Pkmn Power and Conversion attacks. +; outputs in a the color that was selected or, +; if B was pressed, returns carry. +; input: +; a = Play Area location (PLAY_AREA_*), with: +; bit 7 not set if it's applying to opponent's card +; bit 7 set if it's applying to player's card +; hl = text to be printed in the bottom box +; output: +; a = color that was selected +HandleColorChangeScreen: ; 2c588 (b:4588) + or a + call z, SwapTurn + push af + call .DrawScreen + pop af + call z, SwapTurn + + ld hl, .menu_params + xor a + call InitializeMenuParameters + call EnableLCD + +.loop_input + call DoFrame + call HandleMenuInput + jr nc, .loop_input + cp -1 ; b pressed? + jr z, .set_carry + ld e, a + ld d, $00 + ld hl, ShiftListItemToColor + add hl, de + ld a, [hl] + or a + ret +.set_carry + scf + ret + +.menu_params + db 1, 1 ; cursor x, cursor y + db 2 ; y displacement between items + db MAX_PLAY_AREA_POKEMON ; number of items + db SYM_CURSOR_R ; cursor tile number + db SYM_SPACE ; tile behind cursor + dw $0000 ; function pointer if non-0 +; 0x2c5be + +.DrawScreen: ; 2c5be (b:45be) + push hl + push af + call EmptyScreen + call ZeroObjectPositions + call LoadDuelCardSymbolTiles + +; load card data + pop af + and $7f + ld [wTempPlayAreaLocation_cceb], a + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + +; draw card gfx + ld de, v0Tiles1 + $20 tiles ; destination offset of loaded gfx + ld hl, wLoadedCard1Gfx + ld a, [hli] + ld h, [hl] + ld l, a + lb bc, $30, TILE_SIZE + call LoadCardGfx + bank1call SetBGP6OrSGB3ToCardPalette + bank1call FlushAllPalettesOrSendPal23Packet + ld a, $a0 + lb hl, 6, 1 + lb de, 9, 2 + lb bc, 8, 6 + call FillRectangle + bank1call ApplyBGP6OrSGB3ToCardImage + +; print card name and level at the top + ld a, 16 + call CopyCardNameAndLevel + ld [hl], $00 + lb de, 7, 0 + call InitTextPrinting + ld hl, wDefaultText + call ProcessText + +; list all the colors + ld hl, ShiftMenuData + call PlaceTextItems + +; print card's color, resistance and weakness + ld a, [wTempPlayAreaLocation_cceb] + call GetPlayAreaCardColor + inc a + lb bc, 15, 9 + call WriteByteToBGMap0 + ld a, [wTempPlayAreaLocation_cceb] + call GetPlayAreaCardWeakness + lb bc, 15, 10 + bank1call PrintCardPageWeaknessesOrResistances + ld a, [wTempPlayAreaLocation_cceb] + call GetPlayAreaCardResistance + lb bc, 15, 11 + bank1call PrintCardPageWeaknessesOrResistances + + call DrawWideTextBox + +; print list of color names on all list items + lb de, 4, 1 + ldtx hl, ColorListText + call InitTextPrinting_ProcessTextFromID + +; print input hl to text box + lb de, 1, 14 + pop hl + call InitTextPrinting_ProcessTextFromID + +; draw and apply palette to color icons + ld hl, ColorTileAndBGP + lb de, 2, 0 + ld c, NUM_COLORED_TYPES +.loop_colors + ld a, [hli] + push de + push bc + push hl + lb hl, 1, 2 + lb bc, 2, 2 + call FillRectangle + + ld a, [wConsole] + cp CONSOLE_CGB + jr nz, .skip_vram1 + pop hl ; unnecessary + push hl ; unnecessary + call BankswitchVRAM1 + ld a, [hl] + lb hl, 0, 0 + lb bc, 2, 2 + call FillRectangle + call BankswitchVRAM0 + +.skip_vram1 + pop hl + pop bc + pop de + inc hl + inc e + inc e + dec c + jr nz, .loop_colors + ret +; 0x2c686 + +; loads wTxRam2 and wTxRam2_b: +; [wTxRam2] <- wLoadedCard1Name +; [wTxRam2_b] <- input color as text symbol +; input: +; a = type (color) constant +LoadCardNameAndInputColor: ; 2c686 (b:4686) + add a + ld e, a + ld d, $00 + ld hl, ColorToTextSymbol + add hl, de + +; load wTxRam2 with card's name + ld de, wTxRam2 + ld a, [wLoadedCard1Name] + ld [de], a + inc de + ld a, [wLoadedCard1Name + 1] + ld [de], a + +; load wTxRam2_b with ColorToTextSymbol + inc de + ld a, [hli] + ld [de], a + inc de + ld a, [hli] + ld [de], a + ret +; 0x2c6a1 + +ShiftMenuData: ; 2c6a1 (b:46a1) + ; x, y, text id + textitem 10, 9, TypeText + textitem 10, 10, WeaknessText + textitem 10, 11, ResistanceText + db $ff + +ColorTileAndBGP: ; 2c6ae (b:46ae) + ; tile, BG + db $E4, $02 + db $E0, $01 + db $EC, $02 + db $E8, $01 + db $F0, $03 + db $F4, $03 + +ShiftListItemToColor: ; 2c6ba (b:46ba) + db GRASS + db FIRE + db WATER + db LIGHTNING + db FIGHTING + db PSYCHIC + +ColorToTextSymbol: ; 2c6c0 (b:46c0) + tx FireSymbolText + tx GrassSymbolText + tx LightningSymbolText + tx WaterSymbolText + tx FightingSymbolText + tx PsychicSymbolText + +DrawSymbolOnPlayAreaCursor: ; 2c6cc (b:46cc) + ld c, a + add a + add c + add 2 + ; a = 3*a + 2 + ld c, a + ld a, b + ld b, 0 + call WriteByteToBGMap0 + ret +; 0x2c6d9 + + INCROM $2c6d9, $2c6e0 + +PlayAreaSelectionMenuParameters: ; 2c6e0 (b:46e0) + db 0, 0 ; cursor x, cursor y + db 3 ; y displacement between items + db MAX_PLAY_AREA_POKEMON ; number of items + db SYM_CURSOR_R ; cursor tile number + db SYM_SPACE ; tile behind cursor + dw $0000 ; function pointer if non-0 +; 0x2c6e8 + +BenchSelectionMenuParameters: ; 2c6e8 (b:46e8) + db 0, 3 ; cursor x, cursor y + db 3 ; y displacement between items + db MAX_PLAY_AREA_POKEMON ; number of items + db SYM_CURSOR_R ; cursor tile number + db SYM_SPACE ; tile behind cursor + dw $0000 ; function pointer if non-0 +; 0x2c6f0 SpitPoison_AIEffect: ; 2c6f0 (b:46f0) - ld a, 5 + ld a, 10 / 2 lb de, 0, 10 - jp Func_2c0fb -; 0x2c6f8 + jp SetExpectedAIDamage ; If heads, defending Pokemon becomes poisoned SpitPoison_Poison50PercentEffect: ; 2c6f8 (b:46f8) @@ -494,12 +1465,10 @@ 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, -; stores in hTempPlayAreaLocation_ffa1 the location -; of the Bench Pokemon that was selected for switch. +; outputs in hTemp_ffa0 the result of the coin toss (0 = tails, 1 = heads). +; in case it was heads, stores in hTempPlayAreaLocation_ffa1 +; the PLAY_AREA_* location of the Bench Pokemon that was selected for switch. TerrorStrike_50PercentSelectSwitchPokemon: ; 2c70a (b:470a) xor a ldh [hTemp_ffa0], a @@ -510,8 +1479,7 @@ TerrorStrike_50PercentSelectSwitchPokemon: ; 2c70a (b:470a) cp 2 ret c -; toss coin and store whether it was tails (0) -; or heads (1) in hTemp_ffa0 +; toss coin and store whether it was tails (0) or heads (1) in hTemp_ffa0. ; return if it was tails. ldtx de, IfHeadsChangeOpponentsActivePokemonText call Func_2c08a @@ -522,10 +1490,9 @@ 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 +; if coin toss at hTemp_ffa0 was heads and it's possible, +; switch the Defending Pokemon TerrorStrike_SwitchDefendingPokemon: ; 2c726 (b:4726) ldh a, [hTemp_ffa0] or a @@ -533,21 +1500,63 @@ 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 + jp UpdateExpectedAIDamage_AccountForPoison WeepinbellPoisonPowder_AIEffect: ; 2c738 (b:4738) ld a, 5 lb de, 0, 10 - jp Func_2c0d4 + jp UpdateExpectedAIDamage_AccountForPoison ; 0x2c740 - INCROM $2c740, $2c77e +; return carry if there are no Pokemon cards in the non-turn holder's bench +VictreebelLure_AssertPokemonInBench: ; 2c740 (b:4740) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + ldtx hl, EffectNoPokemonOnTheBenchText + cp 2 + ret +; 0x2c74b + +; return in hTempPlayAreaLocation_ffa1 the PLAY_AREA_* location +; of the Bench Pokemon that was selected for switch +VictreebelLure_SelectSwitchPokemon: ; 2c74b (b:474b) + ldtx hl, SelectPkmnOnBenchToSwitchWithActiveText + call DrawWideTextBox_WaitForInput + call SwapTurn + bank1call HasAlivePokemonInBench +.select_pokemon + bank1call OpenPlayAreaScreenForSelection + jr c, .select_pokemon + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + call SwapTurn + ret +; 0x2c764 + +; Return in hTemp_ffa0 the PLAY_AREA_* of the non-turn holder's Pokemon card in bench with the lowest (remaining) HP. +; if multiple cards are tied for the lowest HP, the one with the highest PLAY_AREA_* is returned. +VictreebelLure_GetBenchPokemonWithLowestHP: ; 2c764 (b:4764) + call GetBenchPokemonWithLowestHP + ldh [hTemp_ffa0], a + ret +; 0x2c76a + +; Defending Pokemon is swapped out for the one with the PLAY_AREA_* at hTemp_ffa0 +; unless Mew's Neutralizing Shield or Haunter's Transparency prevents it. +VictreebelLure_SwitchDefendingPokemon: ; 2c76a (b:476a) + call SwapTurn + ldh a, [hTemp_ffa0] + ld e, a + call HandleNShieldAndTransparency + call nc, SwapArenaWithBenchPokemon + call SwapTurn + xor a + ld [wDuelDisplayedScreen], a + ret ; If heads, defending Pokemon can't retreat next turn AcidEffect: ; 2c77e (b:477e) @@ -557,13 +1566,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 + jp UpdateExpectedAIDamage_AccountForPoison ; Defending Pokemon and user become confused FoulOdorEffect: ; 2c793 (b:4793) @@ -572,7 +1579,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,15 +1590,30 @@ KakunaStiffenEffect: ; 2c7a0 (b:47a0) ld a, SUBSTATUS1_NO_DAMAGE_STIFFEN call ApplySubstatus1ToDefendingCard ret -; 0x2c7b4 KakunaPoisonPowder_AIEffect: ; 2c7b4 (b:47b4) ld a, 5 lb de, 0, 10 - jp Func_2c0d4 + jp UpdateExpectedAIDamage_AccountForPoison ; 0x2c7bc - INCROM $2c7bc, $2c7d0 +GolbatLeechLifeEffect: ; 2c7bc (b:47bc) + ld hl, wDealtDamage + ld e, [hl] + inc hl ; wDamageEffectiveness + ld d, [hl] + call ApplyAndAnimateHPRecovery + ret +; 0x2c7c6 + +VenonatLeechLifeEffect: ; 2c7c6 (b:47c6) + ld hl, wDealtDamage + ld e, [hl] + inc hl ; wDamageEffectiveness + ld d, [hl] + call ApplyAndAnimateHPRecovery + ret +; 0x2c7d0 ; During your next turn, double damage SwordsDanceEffect: ; 2c7d0 (b:47d0) @@ -602,7 +1623,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) @@ -611,13 +1631,19 @@ ZubatSupersonicEffect: ; 2c7dc (b:47dc) ret ; 0x2c7e3 - INCROM $2c7e3, $2c7ed +ZubatLeechLifeEffect: ; 2c7e3 (b:47e3) + ld hl, wDealtDamage + ld e, [hl] + inc hl + ld d, [hl] + call ApplyAndAnimateHPRecovery + ret +; 0x2c7ed Twineedle_AIEffect: ; 2c7ed (b:47ed) - ld a, 30 + ld a, 60 / 2 lb de, 0, 60 - jp Func_2c0fb -; 0x2c7f5 + jp SetExpectedAIDamage ; Flip 2 coins; deal 30x number of heads Twineedle_MultiplierEffect: ; 2c7f5 (b:47f5) @@ -630,17 +1656,30 @@ Twineedle_MultiplierEffect: ; 2c7f5 (b:47f5) add a add e call ATimes10 - call StoreDamageInfo + call SetDefiniteDamage ret ; 0x2c80d - INCROM $2c80d, $2c822 +BeedrillPoisonSting_AIEffect: ; 2c80d (b:480d) + ld a, 5 + lb de, 0, 10 + jp UpdateExpectedAIDamage_AccountForPoison +; 0x2c815 + +ExeggcuteLeechSeedEffect: ; 2c815 (b:4815) + ld hl, wDealtDamage + ld a, [hli] + or a + ret z ; return if no damage dealt + ld de, 10 + call ApplyAndAnimateHPRecovery + ret +; 0x2c822 FoulGas_AIEffect: ; 2c822 (b:4822) ld a, 5 lb de, 0, 10 - jp Func_2c0e9 -; 0x2c82a + jp UpdateExpectedAIDamage ; If heads, defending Pokemon becomes poisoned. If tails, defending Pokemon becomes confused FoulGas_PoisonOrConfusionEffect: ; 2c82a (b:482a) @@ -648,7 +1687,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 @@ -663,7 +1701,154 @@ MetapodStiffenEffect: ; 2c836 (b:4836) ret ; 0x2c84a - INCROM $2c84a, $2c925 +; returns carry if no cards in Deck or if +; Play Area is full already. +Sprout_CheckDeckAndPlayArea: ; 2c84a (b:484a) + call CheckIfDeckIsEmpty + ret c ; return if no cards in deck + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, NoSpaceOnTheBenchText + cp MAX_PLAY_AREA_POKEMON + ccf + ret +; 0x2c85a + +Sprout_PlayerSelectEffect: ; 2c85a (b:485a) + ld a, $ff + ldh [hTemp_ffa0], a + + call CreateDeckCardList + ldtx hl, ChooseAnOddishFromDeckText + ldtx bc, OddishText + lb de, SEARCHEFFECT_CARD_ID, ODDISH + call LookForCardsInDeck + ret c + +; draw Deck list interface and print text + bank1call Func_5591 + ldtx hl, ChooseAnOddishText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText + +.loop + bank1call DisplayCardList + jr c, .pressed_b + call GetCardIDFromDeckIndex + ld bc, ODDISH + call CompareDEtoBC + jr nz, .play_sfx + +; Oddish was selected + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + or a + ret + +.play_sfx + ; play SFX and loop back + call Func_3794 + jr .loop + +.pressed_b +; figure if Player can exit the screen without selecting, +; that is, if the Deck has no Oddish card. + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_b_press + ld a, [hl] + cp CARD_LOCATION_DECK + jr nz, .next + ld a, l + call GetCardIDFromDeckIndex + ld bc, ODDISH + call CompareDEtoBC + jr z, .play_sfx ; found Oddish, go back to top loop +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_b_press + +; no Oddish in Deck, can safely exit screen + ld a, $ff + ldh [hTemp_ffa0], a + or a + ret +; 0x2c8b7 + +Sprout_AISelectEffect: ; 2c8b7 (b:48b7) + call CreateDeckCardList + ld hl, wDuelTempList +.loop_deck + ld a, [hli] + ldh [hTemp_ffa0], a + cp $ff + ret z ; no Oddish + call GetCardIDFromDeckIndex + ld a, e + cp ODDISH + jr nz, .loop_deck + ret ; Oddish found +; 0x2c8cc + +Sprout_PutInPlayAreaEffect: ; 2c8cc (b:48cc) + ldh a, [hTemp_ffa0] + cp $ff + jr z, .shuffle + call SearchCardInDeckAndAddToHand + call AddCardToHand + call PutHandPokemonCardInPlayArea + call IsPlayerTurn + jr c, .shuffle + ; display card on screen + ldh a, [hTemp_ffa0] + ldtx hl, PlacedOnTheBenchText + bank1call DisplayCardDetailScreen +.shuffle + call Func_2c0bd + ret +; 0x2c8ec + +; returns carry if no Pokemon on Bench +Teleport_CheckBench: ; 2c8ec (b:48ec) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, ThereAreNoPokemonOnBenchText + cp 2 + ret +; 0x2c8f7 + +Teleport_PlayerSelectEffect: ; 2c8f7 (b:48f7) + ldtx hl, SelectPkmnOnBenchToSwitchWithActiveText + call DrawWideTextBox_WaitForInput + bank1call HasAlivePokemonInBench + ld a, $01 + ld [wcbd4], a +.loop + bank1call OpenPlayAreaScreenForSelection + jr c, .loop + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ret +; 0x2c90f + +Teleport_AISelectEffect: ; 2c90f (b:490f) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + call Random + ldh [hTemp_ffa0], a + ret +; 0x2c91a + +Teleport_SwitchEffect: ; 2c91a (b:491a) + ldh a, [hTemp_ffa0] + ld e, a + call SwapArenaWithBenchPokemon + xor a + ld [wDuelDisplayedScreen], a + ret +; 0x2c925 BigEggsplosion_AIEffect: ; 2c925 (b:4925) ldh a, [hTempPlayAreaLocation_ff9d] @@ -682,7 +1867,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 +1895,11 @@ SetDamageToATimes20: ; 2c958 (b:4958) ld a, h ld [wDamage + 1], a ret -; 0x2c96b Thrash_AIEffect: ; 2c96b (b:496b) - ld a, 35 + ld a, (30 + 40) / 2 lb de, 30, 40 - jp Func_2c0fb -; 0x2c973 + jp SetExpectedAIDamage ; If heads 10 more damage; if tails, 10 damage to itself Thrash_ModifierEffect: ; 2c973 (b:4973) @@ -728,32 +1910,443 @@ Thrash_ModifierEffect: ; 2c973 (b:4973) ld a, 10 call AddToDamage ret -; 0x2c982 -Func_2c982: ; 2c982 (b:4982) +Thrash_LowRecoilEffect: ; 2c982 (b:4982) ldh a, [hTemp_ffa0] or a ret nz ld a, 10 - call Func_1955 + call DealRecoilDamageToSelf ret -; 0x2c98c Toxic_AIEffect: ; 2c98c (b:498c) ld a, 20 lb de, 20, 20 - jp Func_2c0e9 -; 0x2c994 + jp UpdateExpectedAIDamage -; Defending Pokémon becomes poisoned, but takes 20 damage (double poisoned) +; Defending Pokémon becomes double poisoned (takes 20 damage per turn rather than 10) Toxic_DoublePoisonEffect: ; 2c994 (b:4994) call DoublePoisonEffect ret ; 0x2c998 - INCROM $2c998, $2cbfb +BoyfriendsEffect: ; 2c998 (b:4998) + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + ld c, PLAY_AREA_ARENA +.loop + ld a, [hl] + cp $ff + jr z, .done + call GetCardIDFromDeckIndex + ld a, e + cp NIDOKING + jr nz, .next + ld a, d + cp $00 ; why check d? Card IDs are only 1 byte long + jr nz, .next + inc c +.next + inc hl + jr .loop +.done +; c holds number of Nidoking found in Play Area + ld a, c + add a + call ATimes10 + call AddToDamage ; adds 2 * 10 * c + ret +; 0x2c9be + +NidoranFFurySwipes_AIEffect: ; 2c9be (b:49be) + ld a, 30 / 2 + lb de, 0, 30 + jp SetExpectedAIDamage +; 0x2c9c6 + +NidoranFFurySwipes_MultiplierEffect: ; 2c9c6 (b:49c6) + ld hl, 10 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 3 + call TossCoinATimes_BankB + call ATimes10 + call SetDefiniteDamage + ret +; 0x2c9db + +NidoranFCallForFamily_CheckDeckAndPlayArea: ; 2c9db (b:49db) + call CheckIfDeckIsEmpty + ret c ; return if no cards in deck + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, NoSpaceOnTheBenchText + cp MAX_PLAY_AREA_POKEMON + ccf + ret +; 0x2c9eb -Func_2cbfb: ; 2cbfb (b:4bfb) +NidoranFCallForFamily_PlayerSelectEffect: ; 2c9eb (b:49eb) + ld a, $ff + ldh [hTemp_ffa0], a + + call CreateDeckCardList + ldtx hl, ChooseNidoranFromDeckText + ldtx bc, NidoranMNidoranFText + lb de, SEARCHEFFECT_NIDORAN, $00 + call LookForCardsInDeck + ret c + +; draw Deck list interface and print text + bank1call Func_5591 + ldtx hl, ChooseNidoranText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText + +.loop + bank1call DisplayCardList + jr c, .pressed_b + call GetCardIDFromDeckIndex + ld bc, NIDORANF + call CompareDEtoBC + jr z, .selected_nidoran + ld bc, NIDORANM + call CompareDEtoBC + jr nz, .loop ; .play_sfx would be more appropriate here + +.selected_nidoran + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + or a + ret + +.play_sfx + ; play SFX and loop back + call Func_3794 + jr .loop + +.pressed_b +; figure if Player can exit the screen without selecting, +; that is, if the Deck has no NidoranF or NidoranM card. + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_b_press + ld a, [hl] + cp CARD_LOCATION_DECK + jr nz, .next + ld a, l + call GetCardIDFromDeckIndex + ld bc, NIDORANF + call CompareDEtoBC + jr z, .play_sfx ; found, go back to top loop + ld bc, NIDORANM + jr z, .play_sfx ; found, go back to top loop +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_b_press + +; no Nidoran in Deck, can safely exit screen + ld a, $ff + ldh [hTemp_ffa0], a + or a + ret +; 0x2ca55 + +NidoranFCallForFamily_AISelectEffect: ; 2ca55 (b:4a55) + call CreateDeckCardList + ld hl, wDuelTempList +.loop_deck + ld a, [hli] + ldh [hTemp_ffa0], a + cp $ff + ret z ; none found + call GetCardIDFromDeckIndex + ld a, e + cp NIDORANF + jr z, .found + cp NIDORANM + jr nz, .loop_deck +.found + ret +; 0x2ca6e + +NidoranFCallForFamily_PutInPlayAreaEffect: ; 2ca6e (b:4a6e) + ldh a, [hTemp_ffa0] + cp $ff + jr z, .shuffle + call SearchCardInDeckAndAddToHand + call AddCardToHand + call PutHandPokemonCardInPlayArea + call IsPlayerTurn + jr c, .shuffle + ; display card on screen + ldh a, [hTemp_ffa0] + ldtx hl, PlacedOnTheBenchText + bank1call DisplayCardDetailScreen +.shuffle + call Func_2c0bd + ret +; 0x2ca8e + +HornHazard_AIEffect: ; 2ca8e (b:4a8e) + ld a, 30 / 2 + lb de, 0, 30 + jp SetExpectedAIDamage +; 0x2ca96 + +HornHazard_NoDamage50PercentEffect: ; 2ca96 (b:4a96) + ldtx de, DamageCheckIfTailsNoDamageText + call TossCoin_BankB + jr c, .heads + xor a + call SetDefiniteDamage + call SetWasUnsuccessful + ret +.heads + ld a, $01 + ld [wLoadedMoveAnimation], a + ret +; 0x2caac + +NidorinaSupersonicEffect: ; 2caac (b:4aac) + call Confusion50PercentEffect + call nc, SetNoEffectFromStatus + ret +; 0x2cab3 + +NidorinaDoubleKick_AIEffect: ; 2cab3 (b:4ab3) + ld a, 60 / 2 + lb de, 0, 60 + jp SetExpectedAIDamage +; 0x2cabb + +NidorinaDoubleKick_MultiplierEffect: ; 2cabb (b:4abb) + ld hl, 30 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 2 + call TossCoinATimes_BankB + ld e, a + add a + add e + call ATimes10 + call SetDefiniteDamage + ret +; 0x2cad3 + +NidorinoDoubleKick_AIEffect: ; 2cad3 (b:4ad3) + ld a, 60 / 2 + lb de, 0, 60 + jp SetExpectedAIDamage +; 0x2cadb + +NidorinoDoubleKick_MultiplierEffect: ; 2cabb (b:4abb) + ld hl, 30 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 2 + call TossCoinATimes_BankB + ld e, a + add a + add e + call ATimes10 + call SetDefiniteDamage + ret +; 0x2caf3 + +ButterfreeWhirlwind_CheckBench: ; 2caf3 (b:4af3) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp 2 + jr nc, .has_bench + ; no bench, do not do effect + ld a, $ff + ldh [hTemp_ffa0], a + ret +.has_bench + call DuelistSelectForcedSwitch + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ret +; 0x2cb09 + +ButterfreeWhirlwind_SwitchEffect: ; 2cb09 (b:4b09) + ldh a, [hTemp_ffa0] + call HandleSwitchDefendingPokemonEffect + ret +; 0x2cb0f + +ButterfreeMegaDrainEffect: ; 2cb0f (b:4b0f) + ld hl, wDealtDamage + ld a, [hli] + ld h, [hl] + ld l, a + srl h + rr l + bit 0, l + jr z, .rounded + ; round up to nearest 10 + ld de, 10 / 2 + add hl, de +.rounded + ld e, l + ld d, h + call ApplyAndAnimateHPRecovery + ret +; 0x2cb27 + +WeedlePoisonSting_AIEffect: ; 2cb27 (b:4b27) + ld a, 5 + lb de, 0, 10 + jp UpdateExpectedAIDamage_AccountForPoison +; 0x2cb2f + +IvysaurPoisonPowder_AIEffect: ; 2cb2f (b:4b2f) + ld a, 10 + lb de, 10, 10 + jp UpdateExpectedAIDamage_AccountForPoison +; 0x2cb37 + +BulbasaurLeechSeedEffect: ; 2cb37 (b:4b37) + ld hl, wDealtDamage + ld a, [hli] + or [hl] + ret z ; return if no damage dealt + lb de, 0, 10 + call ApplyAndAnimateHPRecovery + ret +; 0x2cb44 + +; returns carry if no Grass Energy in Play Area +EnergyTrans_CheckPlayArea: ; 2cb44 (b:4b44) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret c ; cannot use Pkmn Power + +; search in Play Area for at least 1 Grass Energy type + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_deck + ld a, [hl] + and CARD_LOCATION_PLAY_AREA + jr z, .next + push hl + ld a, l + call GetCardIDFromDeckIndex + call GetCardType + pop hl + cp TYPE_ENERGY_GRASS + ret z +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_deck + +; none found + ldtx hl, NoGrassEnergyText + scf + ret +; 0x2cb6f + +EnergyTrans_PrintProcedure: ; 2cb6f (b:4b6f) + ldtx hl, ProcedureForEnergyTransferText + bank1call DrawWholeScreenTextBox + or a + ret +; 0x2cb77 + +EnergyTrans_TransferEffect: ; 2cb77 (b:4b77) + ld a, DUELVARS_DUELIST_TYPE + call GetTurnDuelistVariable + cp DUELIST_TYPE_PLAYER + jr z, .player +; not player + bank1call Func_61a1 + bank1call PrintPlayAreaCardList_EnableLCD + ret + +.player + xor a + ldh [hCurSelectionItem], a + bank1call Func_61a1 + +.draw_play_area + bank1call PrintPlayAreaCardList_EnableLCD + push af + ldh a, [hCurSelectionItem] + ld hl, PlayAreaSelectionMenuParameters + call InitializeMenuParameters + pop af + ld [wNumMenuItems], a + +; handle the action of taking a Grass Energy card +.loop_input_take + call DoFrame + call HandleMenuInput + jr nc, .loop_input_take + cp -1 ; b press? + ret z + +; a press + ldh [hAIPkmnPowerEffectParam], a + ldh [hCurSelectionItem], a + call CheckIfCardHasGrassEnergyAttached + jr c, .play_sfx ; no Grass attached + + ldh [hAIEnergyTransEnergyCard], a + ldh a, [hAIEnergyTransEnergyCard] ; useless + ; temporarily take card away to draw Play Area + call AddCardToHand + bank1call PrintPlayAreaCardList_EnableLCD + ldh a, [hAIPkmnPowerEffectParam] + ld e, a + ldh a, [hAIEnergyTransEnergyCard] + ; give card back + call PutHandCardInPlayArea + + ; draw Grass symbol near cursor + ldh a, [hAIPkmnPowerEffectParam] + ld b, SYM_GRASS + call DrawSymbolOnPlayAreaCursor + +; handle the action of placing a Grass Energy card +.loop_input_put + call DoFrame + call HandleMenuInput + jr nc, .loop_input_put + cp -1 ; b press? + jr z, .remove_symbol + +; a press + ldh [hCurSelectionItem], a + ldh [hAIEnergyTransPlayAreaLocation], a + ld a, OPPACTION_6B15 + call SetOppAction_SerialSendDuelData + ldh a, [hAIEnergyTransPlayAreaLocation] + ld e, a + ldh a, [hAIEnergyTransEnergyCard] + ; give card being held to this Pokemon + call AddCardToHand + call PutHandCardInPlayArea + +.remove_symbol + ldh a, [hAIPkmnPowerEffectParam] + ld b, SYM_SPACE + call DrawSymbolOnPlayAreaCursor + call EraseCursor + jr .draw_play_area + +.play_sfx + call Func_3794 + jr .loop_input_take +; 0x2cbfb + +EnergyTrans_AIEffect: ; 2cbfb (b:4bfb) ldh a, [hAIEnergyTransPlayAreaLocation] ld e, a ldh a, [hAIEnergyTransEnergyCard] @@ -763,35 +2356,9265 @@ Func_2cbfb: ; 2cbfb (b:4bfb) ret ; 0x2cc0a - INCROM $2cc0a, $2f4e1 - -ImposterProfessorOakEffect: ; 2f4e1 (b:74e1) - call SwapTurn - call CreateHandCardList - call SortCardsInDuelTempListByID - ld hl, wDuelTempList -.return_hand_to_deck_loop - ld a, [hli] - cp $ff - jr z, .shuffle - call RemoveCardFromHand - call ReturnCardToDeck - jr .return_hand_to_deck_loop +; returns carry if no Grass Energy cards +; attached to card in Play Area location of a. +; input: +; a = PLAY_AREA_* of location to check +CheckIfCardHasGrassEnergyAttached: ; 2cc0a (b:4c0a) + or CARD_LOCATION_PLAY_AREA + ld e, a + + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop + ld a, [hl] + cp e + jr nz, .next + push de + push hl + ld a, l + call GetCardIDFromDeckIndex + call GetCardType + pop hl + pop de + cp TYPE_ENERGY_GRASS + jr z, .no_carry +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop + scf + ret +.no_carry + ld a, l + or a + ret +; 0x2cc30 + +GrimerMinimizeEffect: ; 2cc30 (b:4c30) + ld a, SUBSTATUS1_REDUCE_BY_20 + call ApplySubstatus1ToDefendingCard + ret +; 0x2cc36 + +ToxicGasEffect: ; 2cc36 (b:4c36) + scf + ret +; 0x2cc38 + +Sludge_AIEffect: ; 2cc38 (b:4c38) + ld a, 5 + lb de, 0, 10 + jp UpdateExpectedAIDamage_AccountForPoison +; 0x2cc40 + +; returns carry if no cards in Deck +; or if Play Area is full already. +BellsproutCallForFamily_CheckDeckAndPlayArea: ; 2cc40 (b:4c40) + call CheckIfDeckIsEmpty + ret c ; return if no cards in deck + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, NoSpaceOnTheBenchText + cp MAX_PLAY_AREA_POKEMON + ccf + ret +; 0x2cc50 + +BellsproutCallForFamily_PlayerSelectEffect: ; 2cc50 (b:4c50) + ld a, $ff + ldh [hTemp_ffa0], a + + call CreateDeckCardList + ldtx hl, ChooseABellsproutFromDeckText + ldtx bc, BellsproutText + lb de, SEARCHEFFECT_CARD_ID, BELLSPROUT + call LookForCardsInDeck + ret c + +; draw Deck list interface and print text + bank1call Func_5591 + ldtx hl, ChooseABellsproutText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText + +.loop + bank1call DisplayCardList + jr c, .pressed_b + call GetCardIDFromDeckIndex + ld bc, BELLSPROUT + call CompareDEtoBC + jr nz, .play_sfx + +; Bellsprout was selected + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + or a + ret + +.play_sfx + ; play SFX and loop back + call Func_3794 + jr .loop + +.pressed_b +; figure if Player can exit the screen without selecting, +; that is, if the Deck has no Bellsprout card. + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_b_press + ld a, [hl] + cp CARD_LOCATION_DECK + jr nz, .next + ld a, l + call GetCardIDFromDeckIndex + ld bc, BELLSPROUT + call CompareDEtoBC + jr z, .play_sfx ; found Bellsprout, go back to top loop +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_b_press + +; no Bellsprout in Deck, can safely exit screen + ld a, $ff + ldh [hTemp_ffa0], a + or a + ret +; 0x2ccad + +BellsproutCallForFamily_AISelectEffect: ; 2ccad (b:4cad) + call CreateDeckCardList + ld hl, wDuelTempList +.loop_deck + ld a, [hli] + ldh [hTemp_ffa0], a + cp $ff + ret z ; no Bellsprout + call GetCardIDFromDeckIndex + ld a, e + cp BELLSPROUT + jr nz, .loop_deck + ret ; Bellsprout found +; 0x2ccc2 + +BellsproutCallForFamily_PutInPlayAreaEffect: ; 2ccc2 (b:4cc2) + ldh a, [hTemp_ffa0] + cp $ff + jr z, .shuffle + call SearchCardInDeckAndAddToHand + call AddCardToHand + call PutHandPokemonCardInPlayArea + call IsPlayerTurn + jr c, .shuffle + ldh a, [hTemp_ffa0] + ldtx hl, PlacedOnTheBenchText + bank1call DisplayCardDetailScreen +.shuffle + call Func_2c0bd + ret +; 0x2cce2 + +WeezingSmog_AIEffect: ; 2cce2 (b:4ce2) + ld a, 5 + lb de, 0, 10 + jp UpdateExpectedAIDamage_AccountForPoison +; 0x2ccea + +WeezingSelfdestructEffect: ; 2ccea (b:4cea) + ld a, 60 + call DealRecoilDamageToSelf + ld a, $01 + ld [wIsDamageToSelf], a + ld a, 10 + call DealDamageToAllBenchedPokemon + call SwapTurn + xor a + ld [wIsDamageToSelf], a + ld a, 10 + call DealDamageToAllBenchedPokemon + call SwapTurn + ret +; 0x2cd09 + +Shift_OncePerTurnCheck: ; 2cd09 (b:4d09) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + and USED_PKMN_POWER_THIS_TURN + jr nz, .already_used + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret +.already_used + ldtx hl, OnlyOncePerTurnText + scf + ret +; 0x2cd21 + +Shift_PlayerSelectEffect: ; 2cd21 (b:4d21) + ldtx hl, ChoosePokemonWishToColorChangeText + ldh a, [hTemp_ffa0] + or $80 + call HandleColorChangeScreen + ldh [hAIPkmnPowerEffectParam], a + ret c ; cancelled + +; check whether the color selected is valid + ; look in Turn Duelist's Play Area + call .CheckColorInPlayArea + ret nc + ; look in NonTurn Duelist's Play Area + call SwapTurn + call .CheckColorInPlayArea + call SwapTurn + ret nc + ; not found in either Duelist's Play Area + ldtx hl, UnableToSelectText + call DrawWideTextBox_WaitForInput + jr Shift_PlayerSelectEffect ; loop back to start +; 0x2cd44 + +; checks in input color in a exists in Turn Duelist's Play Area +; returns carry if not found. +.CheckColorInPlayArea: ; 2cd44 (b:4d44) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld c, a + ld b, PLAY_AREA_ARENA +.loop_play_area + push bc + ld a, b + call GetPlayAreaCardColor + pop bc + ld hl, hAIPkmnPowerEffectParam + cp [hl] + ret z ; found + inc b + dec c + jr nz, .loop_play_area + ; not found + scf + ret +; 0x2cd5d + +Shift_ChangeColorEffect: ; 2cd5d (b:4d5d) + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + set USED_PKMN_POWER_THIS_TURN_F, [hl] + + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD_CHANGED_TYPE + ld l, a + ldh a, [hAIPkmnPowerEffectParam] + or HAS_CHANGED_COLOR + ld [hl], a + call LoadCardNameAndInputColor + ldtx hl, ChangedTheColorOfText + call DrawWideTextBox_WaitForInput + ret +; 0x2cd84 + +VenomPowder_AIEffect: ; 2cd84 (b:4d84) + ld a, 5 + lb de, 0, 10 + jp UpdateExpectedAIDamage +; 0x2cd8c + +VenomPowder_PoisonConfusion50PercentEffect: ; 2cd8c (b:4d8c) + ldtx de, VenomPowderCheckText + call TossCoin_BankB + ret nc ; return if tails + +; heads + call PoisonEffect + call ConfusionEffect + ret c + ld a, CONFUSED | POISONED + ld [wNoEffectFromWhichStatus], a + ret +; 0x2cda0 + +TangelaPoisonPowder_AIEffect: ; 2cda0 (b:4da0) + ld a, 5 + lb de, 0, 10 + jp UpdateExpectedAIDamage_AccountForPoison +; 0x2cda8 + +Heal_OncePerTurnCheck: ; 2cda8 (b:4da8) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + and USED_PKMN_POWER_THIS_TURN + jr nz, .already_used + + call CheckIfPlayAreaHasAnyDamage + ldtx hl, NoPokemonWithDamageCountersText + ret c ; no damage counters to heal + + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret + +.already_used + ldtx hl, OnlyOncePerTurnText + scf + ret +; 0x2cdc7 + +Heal_RemoveDamageEffect: ; 2cdc7 (b:4dc7) + ldtx de, IfHeadsHealIsSuccessfulText + call TossCoin_BankB + ldh [hAIPkmnPowerEffectParam], a + jr nc, .done + + ld a, DUELVARS_DUELIST_TYPE + call GetTurnDuelistVariable + cp DUELIST_TYPE_LINK_OPP + jr z, .link_opp + and DUELIST_TYPE_AI_OPP + jr nz, .done + +; player + ldtx hl, ChoosePkmnToRemoveDamageCounterText + call DrawWideTextBox_WaitForInput + bank1call HasAlivePokemonInPlayArea +.loop_input + bank1call OpenPlayAreaScreenForSelection + jr c, .loop_input + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hPlayAreaEffectTarget], a + ld e, a + call GetCardDamageAndMaxHP + or a + jr z, .loop_input ; has no damage counters + ldh a, [hTempPlayAreaLocation_ff9d] + call SerialSend8Bytes + jr .done + +.link_opp + call SerialRecv8Bytes + ldh [hPlayAreaEffectTarget], a + ; fallthrough + +.done +; flag Pkmn Power as being used regardless of coin outcome + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + set USED_PKMN_POWER_THIS_TURN_F, [hl] + ldh a, [hAIPkmnPowerEffectParam] + or a + ret z ; return if coin was tails + + ldh a, [hPlayAreaEffectTarget] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + add 10 ; remove 1 damage counter + ld [hl], a + ldh a, [hPlayAreaEffectTarget] + call Func_2c10b + call ExchangeRNG + ret +; 0x2ce23 + +PetalDance_AIEffect: ; 2ce23 (b:4e23) + ld a, 120 / 2 + lb de, 0, 120 + jp SetExpectedAIDamage +; 0x2ce2b + +PetalDance_MultiplierEffect: ; 2ce2b (b:4e2b) + ld hl, 40 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 3 + call TossCoinATimes_BankB + add a + add a + call ATimes10 + ; a = 4 * 10 * heads + call SetDefiniteDamage + call SwapTurn + call ConfusionEffect + call SwapTurn + ret +; 0x2ce4b + +PoisonWhip_AIEffect: ; 2ce4b (b:4e4b) + ld a, 10 + lb de, 10, 10 + jp UpdateExpectedAIDamage_AccountForPoison +; 0x2ce53 + +SolarPower_CheckUse: ; 2ce53 (b:4e53) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + and USED_PKMN_POWER_THIS_TURN + jr nz, .already_used + + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret c ; can't use PKMN due to status or Toxic Gas + +; return carry if none of the Arena cards have status conditions + ld a, DUELVARS_ARENA_CARD_STATUS + call GetTurnDuelistVariable + or a + jr nz, .has_status + ld a, DUELVARS_ARENA_CARD_STATUS + call GetNonTurnDuelistVariable + or a + jr z, .no_status +.has_status + or a + ret +.already_used + ldtx hl, OnlyOncePerTurnText + scf + ret +.no_status + ldtx hl, NotAffectedByPoisonSleepParalysisOrConfusionText + scf + ret +; 0x2ce82 + +SolarPower_RemoveStatusEffect: ; 2ce82 (b:4e82) + ld a, $8e + ld [wLoadedMoveAnimation], a + bank1call Func_7415 + ldh a, [hTempPlayAreaLocation_ff9d] + ld b, a + ld c, $00 + ldh a, [hWhoseTurn] + ld h, a + bank1call PlayMoveAnimation + bank1call WaitMoveAnimation + + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + set USED_PKMN_POWER_THIS_TURN_F, [hl] + ld l, DUELVARS_ARENA_CARD_STATUS + ld [hl], NO_STATUS + + ld a, DUELVARS_ARENA_CARD_STATUS + call GetNonTurnDuelistVariable + ld [hl], NO_STATUS + bank1call DrawDuelHUDs + ret +; 0x2ceb0 + +VenusaurMegaDrainEffect: ; 2ceb0 (b:4eb0) + ld hl, wDealtDamage + ld a, [hli] + ld h, [hl] + ld l, a + srl h + rr l + bit 0, l + jr z, .rounded + ; round up to nearest 10 + ld de, 10 / 2 + add hl, de +.rounded + ld e, l + ld d, h + call ApplyAndAnimateHPRecovery + ret +; 0x2cec8 + +; applies the damage bonus for attacks that get bonus +; from extra Water energy cards. +; this bonus is always 10 more damage for each extra Water energy +; and is always capped at a maximum of 20 damage. +; input: +; b = number of Water energy cards needed for paying Energy Cost +; c = number of colorless energy cards needed for paying Energy Cost +ApplyExtraWaterEnergyDamageBonus: ; 2cec8 (b:4ec8) + ld a, [wMetronomeEnergyCost] + or a + jr z, .not_metronome + ld c, a ; amount of colorless needed for Metronome + ld b, 0 ; no Water energy needed for Metronome + +.not_metronome + push bc + ldh a, [hTempPlayAreaLocation_ff9d] + ld e, a + call GetPlayAreaCardAttachedEnergies + pop bc + + ld hl, wAttachedEnergies + WATER + ld a, c + or a + jr z, .check_bonus ; is Energy cost all water energy? + + ; it's not, so we need to remove the + ; Water energy cards from calculations + ; if they pay for colorless instead. + ld a, [wTotalAttachedEnergies] + cp [hl] + jr nz, .check_bonus ; skip if at least 1 non-Water energy attached + + ; Water is the only energy color attached + ld a, c + add b + ld b, a + ; b += c + +.check_bonus + ld a, [hl] + sub b + jr c, .skip_bonus ; is water energy < b? + jr z, .skip_bonus ; is water energy == b? + +; a holds number of water energy not payed for energy cost + cp 3 + jr c, .less_than_3 + ld a, 2 ; cap this to 2 for bonus effect +.less_than_3 + call ATimes10 + call AddToDamage ; add 10 * a to damage + +.skip_bonus + ld a, [wDamage] + ld [wAIMinDamage], a + ld [wAIMaxDamage], a + ret +; 0x2cf05 + +OmastarWaterGunEffect: ; 2cf05 (b:4f05) + lb bc, 1, 1 + jr ApplyExtraWaterEnergyDamageBonus +; 0x2cf0a + +OmastarSpikeCannon_AIEffect: ; 2cf0a (b:4f0a) + ld a, 60 / 2 + lb de, 0, 60 + jp SetExpectedAIDamage +; 0x2cf12 + +OmastarSpikeCannon_MultiplierEffect: ; 2cf12 (b:4f12) + ld hl, 30 + call LoadTxRam3 + ld a, 2 + ldtx de, DamageCheckIfHeadsXDamageText + call TossCoinATimes_BankB + ld e, a + add a + add e + call ATimes10 + call SetDefiniteDamage ; 3 * 10 * heads + ret +; 0x2cf2a + +ClairvoyanceEffect: ; 2cf2a (b:4f2a) + scf + ret +; 0x2cf2c + +OmanyteWaterGunEffect: ; 2cf2c (b:4f2c) + lb bc, 1, 0 + jp ApplyExtraWaterEnergyDamageBonus +; 0x2cf32 + +WartortleWithdrawEffect: ; 2cf32 (b:4f32) + ldtx de, IfHeadsNoDamageNextTurnText + call TossCoin_BankB + jp nc, SetWasUnsuccessful + ld a, $4f + ld [wLoadedMoveAnimation], a + ld a, SUBSTATUS1_NO_DAMAGE_10 + call ApplySubstatus1ToDefendingCard + ret +; 0x2cf46 + +RainDanceEffect: ; 2cf46 (b:4f46) + scf + ret +; 0x2cf48 + +HydroPumpEffect: ; 2cf48 (b:4f48) + lb bc, 3, 0 + jp ApplyExtraWaterEnergyDamageBonus +; 0x2cf4e + +KinglerFlail_AIEffect: ; 2cf4e (b:4f4e) + call KinglerFlail_HPCheck + jp SetMinMaxDamageSameAsDamage +; 0x2cf54 + +KinglerFlail_HPCheck: ; 2cf54 (b:4f54) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + call SetDefiniteDamage + ret +; 0x2cf5d + +; returns carry if no cards in Deck +; or if Play Area is full already. +KrabbyCallForFamily_CheckDeckAndPlayArea: ; 2cf5d (b:4f5d) + call CheckIfDeckIsEmpty + ret c ; return if no cards in deck + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, NoSpaceOnTheBenchText + cp MAX_PLAY_AREA_POKEMON + ccf + ret +; 0x2cf6d + +KrabbyCallForFamily_PlayerSelectEffect: ; 2cf6d (b:4f6d) + ld a, $ff + ldh [hTemp_ffa0], a + + call CreateDeckCardList + ldtx hl, ChooseAKrabbyFromDeckText + ldtx bc, KrabbyText + lb de, SEARCHEFFECT_CARD_ID, KRABBY + call LookForCardsInDeck + ret c + +; draw Deck list interface and print text + bank1call Func_5591 + ldtx hl, ChooseAKrabbyText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText + +.loop + bank1call DisplayCardList + jr c, .pressed_b + call GetCardIDFromDeckIndex + ld bc, KRABBY + call CompareDEtoBC + jr nz, .play_sfx + +; Krabby was selected + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + or a + ret + +.play_sfx + ; play SFX and loop back + call Func_3794 + jr .loop + +.pressed_b +; figure if Player can exit the screen without selecting, +; that is, if the Deck has no Krabby card. + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_b_press + ld a, [hl] + cp CARD_LOCATION_DECK + jr nz, .next + ld a, l + call GetCardIDFromDeckIndex + ld bc, KRABBY + call CompareDEtoBC + jr z, .play_sfx ; found Krabby, go back to top loop +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_b_press + +; no Krabby in Deck, can safely exit screen + ld a, $ff + ldh [hTemp_ffa0], a + or a + ret +; 0x2cfdf + +KrabbyCallForFamily_AISelectEffect: ; 2cfdf (b:4fdf) + call CreateDeckCardList + ld hl, wDuelTempList +.loop_deck + ld a, [hli] + ldh [hTemp_ffa0], a + cp $ff + ret z ; no Krabby + call GetCardIDFromDeckIndex + ld a, e + cp KRABBY + jr nz, .loop_deck + ret ; Krabby found +; 0x2cfca + +KrabbyCallForFamily_PutInPlayAreaEffect: ; 2cfca (b:4fca) + ldh a, [hTemp_ffa0] + cp $ff + jr z, .shuffle + call SearchCardInDeckAndAddToHand + call AddCardToHand + call PutHandPokemonCardInPlayArea + call IsPlayerTurn + jr c, .shuffle + ldh a, [hTemp_ffa0] + ldtx hl, PlacedOnTheBenchText + bank1call DisplayCardDetailScreen .shuffle - call Func_2c0bd - ld a, $07 - bank1call $4935 - ld c, $07 + call Func_2c0bd + ret +; 0x2cfff + +MagikarpFlail_AIEffect: ; 2cfff (b:4fff) + call MagikarpFlail_HPCheck + jp SetMinMaxDamageSameAsDamage +; 0x2d005 + +MagikarpFlail_HPCheck: ; 2d005 (b:5005) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + call SetDefiniteDamage + ret +; 0x2d00e + +HeadacheEffect: ; 2d00e (b:500e) + ld a, DUELVARS_ARENA_CARD_SUBSTATUS3 + call GetNonTurnDuelistVariable + set SUBSTATUS3_HEADACHE, [hl] + ret +; 0x2d016 + +PsyduckFurySwipes_AIEffect: ; 2d016 (b:5016) + ld a, 30 / 2 + lb de, 0, 30 + jp SetExpectedAIDamage +; 0x2d01e + +PsyduckFurySwipes_MultiplierEffect: ; 2d01e (b:501e) + ld hl, 10 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 3 + call TossCoinATimes_BankB + call ATimes10 + call SetDefiniteDamage + ret +; 0x2d033 + +GolduckHyperBeam_PlayerSelectEffect: ; 2d033 (b:5033) + call SwapTurn + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ld a, [wTotalAttachedEnergies] + or a + jr z, .no_energy + +; draw Energy Card list screen + ldtx hl, ChooseDiscardEnergyCardFromOpponentText + call DrawWideTextBox_WaitForInput + xor a ; PLAY_AREA_ARENA + call CreateArenaOrBenchEnergyCardList + xor a ; PLAY_AREA_ARENA + bank1call DisplayEnergyDiscardScreen + +.loop_input + bank1call HandleEnergyDiscardMenuInput + jr c, .loop_input + + call SwapTurn + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a ; store selected card to discard + ret + +.no_energy + call SwapTurn + ld a, $ff + ldh [hTemp_ffa0], a + or a + ret +; 0x2d065 + +GolduckHyperBeam_AISelectEffect: ; 2d065 (b:5065) + call AIPickEnergyCardToDiscardFromDefendingPokemon + ldh [hTemp_ffa0], a + ret +; 0x2d06b + +GolduckHyperBeam_DiscardEffect: ; 2d06b (b:506b) + call HandleNoDamageOrEffect + ret c ; return if attack had no effect + + ; check if energy card was chosen to discard + ldh a, [hTemp_ffa0] + cp $ff + ret z ; return if none selected + + ; discard Defending card's energy + call SwapTurn + call PutCardInDiscardPile + ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT + call GetTurnDuelistVariable + ld [hl], LAST_TURN_EFFECT_DISCARD_ENERGY + call SwapTurn + ret +; 0x2d085 + +SeadraWaterGunEffect: ; 2d085 (b:5085) + lb bc, 1, 1 + jp ApplyExtraWaterEnergyDamageBonus +; 0x2d08b + +SeadraAgilityEffect: ; 2d08b (b:508b) + ldtx de, IfHeadsDoNotReceiveDamageOrEffectText + call TossCoin_BankB + ret nc ; return if tails + ld a, $52 + ld [wLoadedMoveAnimation], a + ld a, SUBSTATUS1_AGILITY + call ApplySubstatus1ToDefendingCard + ret +; 0x2d09d + +ShellderSupersonicEffect: ; 2d09d (b:509d) + call Confusion50PercentEffect + call nc, SetNoEffectFromStatus + ret +; 0x2d0a4 + +HideInShellEffect: ; 2d0a4 (b:50a4) + ldtx de, IfHeadsNoDamageNextTurnText + call TossCoin_BankB + jp nc, SetWasUnsuccessful + ld a, $4f + ld [wLoadedMoveAnimation], a + ld a, SUBSTATUS1_NO_DAMAGE_11 + call ApplySubstatus1ToDefendingCard + ret +; 0x2d0b8 + +VaporeonQuickAttack_AIEffect: ; 2d0b8 (b:50b8) + ld a, (10 + 30) / 2 + lb de, 10, 30 + jp SetExpectedAIDamage +; 0x2d0c0 + +VaporeonQuickAttack_DamageBoostEffect: ; 2d0c0 (b:50c0) + ld hl, 20 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsPlusDamageText + call TossCoin_BankB + ret nc ; return if tails + ld a, 20 + call AddToDamage + ret +; 0x2d0d3 + +VaporeonWaterGunEffect: ; 2d0d3 (b:50d3) + lb bc, 2, 1 + jp ApplyExtraWaterEnergyDamageBonus +; 0x2d0d9 + +; returns carry if Arena card has no Water Energy attached +; or if it doesn't have any damage counters. +StarmieRecover_CheckEnergyHP: ; 2d0d9 (b:50d9) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies + WATER] + ldtx hl, NotEnoughWaterEnergyText + cp 1 + ret c ; return if not enough energy + call GetCardDamageAndMaxHP + ldtx hl, NoDamageCountersText + cp 10 + ret ; return carry if no damage +; 0x2d0f0 + +StarmieRecover_PlayerSelectEffect: ; 2d0f0 (b:50f0) + ld a, TYPE_ENERGY_WATER + call CreateListOfEnergyAttachedToArena + xor a ; PLAY_AREA_ARENA + bank1call DisplayEnergyDiscardScreen +.loop_input + bank1call HandleEnergyDiscardMenuInput + jr c, .loop_input + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a ; store card chosen + ret +; 0x2d103 + +StarmieRecover_AISelectEffect: ; 2d103 (b:5103) + ld a, TYPE_ENERGY_WATER + call CreateListOfEnergyAttachedToArena + ld a, [wDuelTempList] ; pick first card + ldh [hTemp_ffa0], a + ret +; 0x2d10e + +StarmieRecover_DiscardEffect: ; 2d10e (b:510e) + ldh a, [hTemp_ffa0] + call PutCardInDiscardPile + ret +; 0x2d114 + +StarmieRecover_HealEffect: ; 2d114 (b:5114) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + ld e, a ; all damage for recovery + ld d, 0 + call ApplyAndAnimateHPRecovery + ret +; 0x2d120 + +SquirtleWithdrawEffect: ; 2d120 (b:5120) + ldtx de, IfHeadsNoDamageNextTurnText + call TossCoin_BankB + jp nc, SetWasUnsuccessful + ld a, $4f + ld [wLoadedMoveAnimation], a + ld a, SUBSTATUS1_NO_DAMAGE_10 + call ApplySubstatus1ToDefendingCard + ret +; 0x2d134 + +HorseaSmokescreenEffect: ; 2d134 (b:5134) + ld a, SUBSTATUS2_SMOKESCREEN + call ApplySubstatus2ToDefendingCard + ret +; 0x2d13a + +TentacruelSupersonicEffect: ; 2d13a (b:513a) + call Confusion50PercentEffect + call nc, SetNoEffectFromStatus + ret +; 0x2d141 + +JellyfishSting_AIEffect: ; 2d141 (b:5141) + ld a, 10 + lb de, 10, 10 + jp UpdateExpectedAIDamage_AccountForPoison +; 0x2d149 + +; returns carry if Defending Pokemon has no attacks +PoliwhirlAmnesia_CheckAttacks: ; 2d149 (b:5149) + call SwapTurn + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Move1Category] + cp POKEMON_POWER + jr nz, .has_attack + ld hl, wLoadedCard2Move2Name + ld a, [hli] + or [hl] + jr nz, .has_attack +; has no attack + call SwapTurn + ldtx hl, NoAttackMayBeChoosenText + scf + ret +.has_attack + call SwapTurn + or a + ret +; 0x2d16f + +PoliwhirlAmnesia_PlayerSelectEffect: ; 2d16f (b:516f) + call PlayerPickAttackForAmnesia + ret +; 0x2d173 + +PoliwhirlAmnesia_AISelectEffect: ; 2d173 (b:5173) + call AIPickAttackForAmnesia + ldh [hTemp_ffa0], a + ret +; 0x2d179 + +PoliwhirlAmnesia_DisableEffect: ; 2d179 (b:5179) + call ApplyAmnesiaToAttack + ret +; 0x2d17d + +PlayerPickAttackForAmnesia: ; 2d17d (b:517d) + ldtx hl, ChooseAttackOpponentWillNotBeAbleToUseText + call DrawWideTextBox_WaitForInput + call HandleDefendingPokemonAttackSelection + ld a, e + ldh [hTemp_ffa0], a + ret +; 0x2d18a + +; applies the Amnesia effect on the defending Pokemon, +; for the attack index in hTemp_ffa0. +ApplyAmnesiaToAttack: ; 2d18a (b:518a) + ld a, SUBSTATUS2_AMNESIA + call ApplySubstatus2ToDefendingCard + ld a, [wNoDamageOrEffect] + or a + ret nz ; no effect + +; set selected attack as disabled + ld a, DUELVARS_ARENA_CARD_DISABLED_MOVE_INDEX + call GetNonTurnDuelistVariable + ldh a, [hTemp_ffa0] + ld [hl], a + + ld l, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT + ld [hl], LAST_TURN_EFFECT_AMNESIA + + call IsPlayerTurn + ret c ; return if Player + +; the rest of the routine if for Opponent +; to announce which move was used for Amnesia. + call SwapTurn + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + ld d, a + ldh a, [hTemp_ffa0] + ld e, a + call GetAttackName + call LoadTxRam2 + ldtx hl, WasChosenForTheEffectOfAmnesiaText + call DrawWideTextBox_WaitForInput + call SwapTurn + ret +; 0x2d1c0 + +PoliwhirlDoubleslap_AIEffect: ; 2d1c0 (b:51c0) + ld a, 60 / 2 + lb de, 0, 60 + jp SetExpectedAIDamage +; 0x2d1c8 + +PoliwhirlDoubleslap_MultiplierEffect: ; 2d1c8 (b:51c8) + ld hl, 30 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 2 + call TossCoinATimes_BankB + ld e, a + add a + add e + call ATimes10 + call SetDefiniteDamage + ret +; 0x2d1e0 + +PoliwrathWaterGunEffect: ; 2d1e0 (b:51e0) + lb bc, 2, 1 + jp ApplyExtraWaterEnergyDamageBonus +; 0x2d1e6 + +Whirlpool_PlayerSelectEffect: ; 2d1e6 (b:51e6) + call SwapTurn + xor a ; PLAY_AREA_ARENA + call CreateArenaOrBenchEnergyCardList + jr c, .no_energy + + ldtx hl, ChooseDiscardEnergyCardFromOpponentText + call DrawWideTextBox_WaitForInput + xor a ; PLAY_AREA_ARENA + bank1call DisplayEnergyDiscardScreen +.loop_input + bank1call HandleEnergyDiscardMenuInput + jr c, .loop_input + + call SwapTurn + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a ; store selected card to discard + ret + +.no_energy + call SwapTurn + ld a, $ff + ldh [hTemp_ffa0], a + ret +; 0x2d20e + +Whirlpool_AISelectEffect: ; 2d20e (b:520e) + call AIPickEnergyCardToDiscardFromDefendingPokemon + ldh [hTemp_ffa0], a + ret +; 0x2d214 + +Whirlpool_DiscardEffect: ; 2d214 (b:5214) + call HandleNoDamageOrEffect + ret c ; return if attack had no effect + ldh a, [hTemp_ffa0] + cp $ff + ret z ; return if none selected + + ; discard Defending card's energy + ; this doesn't update DUELVARS_ARENA_CARD_LAST_TURN_EFFECT + call SwapTurn + call PutCardInDiscardPile + ; ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT + ; call GetTurnDuelistVariable + ; ld [hl], LAST_TURN_EFFECT_DISCARD_ENERGY + call SwapTurn + ret +; 0x2d227 + +PoliwagWaterGunEffect: ; 2d227 (b:5227) + lb bc, 1, 0 + jp ApplyExtraWaterEnergyDamageBonus +; 0x2d22d + +ClampEffect: ; 2d22d (b:522d) + ld a, $05 + ld [wLoadedMoveAnimation], a + ldtx de, SuccessCheckIfHeadsAttackIsSuccessfulText + call TossCoin_BankB + jp c, ParalysisEffect +; unsuccessful + xor a + ld [wLoadedMoveAnimation], a + call SetDefiniteDamage + call SetWasUnsuccessful + ret +; 0x2d246 + +CloysterSpikeCannon_AIEffect: ; 2d246 (b:5246) + ld a, 60 / 2 + lb de, 0, 60 + jp SetExpectedAIDamage +; 0x2d24e + +CloysterSpikeCannon_MultiplierEffect: ; 2d24e (b:524e) + ld hl, 30 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 2 + call TossCoinATimes_BankB + ld e, a + add a + add e + call ATimes10 + call SetDefiniteDamage + ret +; 0x2d266 + +Blizzard_BenchDamage50PercentEffect: ; 2d266 (b:5266) + ldtx de, DamageToOppBenchIfHeadsDamageToYoursIfTailsText + call TossCoin_BankB + ldh [hTemp_ffa0], a ; store coin result + ret +; 0x2d26f + +Blizzard_BenchDamageEffect: ; 2d26f (b:526f) + ldh a, [hTemp_ffa0] + or a + jr nz, .opp_bench + +; own bench + ld a, $01 + ld [wIsDamageToSelf], a + ld a, 10 + call DealDamageToAllBenchedPokemon + ret + +.opp_bench + call SwapTurn + ld a, 10 + call DealDamageToAllBenchedPokemon + call SwapTurn + ret +; 0x2d28b + +; return carry if can use Cowardice +Cowardice_Check: ; 2d28b (b:528b) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret c ; return if cannot use + + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, EffectNoPokemonOnTheBenchText + cp 2 + ret c ; return if no bench + + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + ldtx hl, CannotBeUsedInTurnWhichWasPlayedText + and CAN_EVOLVE_THIS_TURN + scf + ret z ; return if was played this turn + + or a + ret +; 0x2d2ae + +Cowardice_PlayerSelectEffect: ; 2d2ae (b:52ae) + ldh a, [hTemp_ffa0] + or a + ret nz ; return if not Arena card + ldtx hl, SelectPokemonToPlaceInTheArenaText + call DrawWideTextBox_WaitForInput + bank1call HasAlivePokemonInBench + bank1call OpenPlayAreaScreenForSelection + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hAIPkmnPowerEffectParam], a + ret +; 0x2d2c3 + +Cowardice_RemoveFromPlayAreaEffect: ; 2d2c3 (b:52c3) + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + +; put card in Discard Pile temporarily, so that +; all cards attached are discarded as well. + push af + ldh a, [hTemp_ffa0] + ld e, a + call MovePlayAreaCardToDiscardPile + +; if card was in Arena, swap selected Bench +; Pokemon with Arena, otherwise skip. + ldh a, [hTemp_ffa0] + or a + jr nz, .skip_switch + ldh a, [hAIPkmnPowerEffectParam] + ld e, a + call SwapArenaWithBenchPokemon + +.skip_switch +; move card back to Hand from Discard Pile +; and adjust Play Area + pop af + call MoveDiscardPileCardToHand + call AddCardToHand + call ShiftAllPokemonToFirstPlayAreaSlots + + xor a + ld [wDuelDisplayedScreen], a + ret +; 0x2d2eb + +LaprasWaterGunEffect: ; 2d2eb (b:52eb) + lb bc, 1, 0 + jp ApplyExtraWaterEnergyDamageBonus +; 0x2d2f1 + +Quickfreeze_InitialEffect: ; 2d2f1 (b:52f1) + scf + ret +; 0x2d2f3 + +Quickfreeze_Paralysis50PercentEffect: ; 2d2f3 (b:52f3) + ldtx de, ParalysisCheckText + call TossCoin_BankB + jr c, .heads + +; tails + call SetWasUnsuccessful + bank1call DrawDuelMainScene + bank1call Func_1bca + call WaitForWideTextBoxInput + ret + +.heads + call ParalysisEffect + ldh a, [hTempPlayAreaLocation_ff9d] + ld b, a + ld c, $00 + ldh a, [hWhoseTurn] + ld h, a + bank1call PlayMoveAnimation + bank1call Func_741a + bank1call WaitMoveAnimation + bank1call Func_6df1 + bank1call DrawDuelHUDs + bank1call Func_1bca + call c, WaitForWideTextBoxInput + ret +; 0x2d329 + +IceBreath_ZeroDamage: ; 2d329 (b:5329) + xor a + call SetDefiniteDamage + ret +; 0x2d32e + +IceBreath_RandomPokemonDamageEffect: ; 2d32e (b:532e) + call SwapTurn + call PickRandomPlayAreaCard + ld b, a + ld de, 40 + call DealDamageToPlayAreaPokemon_RegularAnim + call SwapTurn + ret +; 0x2d33f + +FocusEnergyEffect: ; 2d33f (b:533f) + ld a, [wTempTurnDuelistCardID] + cp VAPOREON1 + ret nz ; return if no Vaporeon1 + ld a, SUBSTATUS1_NEXT_TURN_DOUBLE_DAMAGE + call ApplySubstatus1ToDefendingCard + ret +; 0x2d34b + +PlayerPickFireEnergyCardToDiscard: ; 2d34b (b:534b) + call CreateListOfFireEnergyAttachedToArena + xor a + bank1call DisplayEnergyDiscardScreen + bank1call HandleEnergyDiscardMenuInput + ldh a, [hTempCardIndex_ff98] + ldh [hTempList], a + ret +; 0x2d35a + +AIPickFireEnergyCardToDiscard: ; 2d35a (b:535a) + call CreateListOfFireEnergyAttachedToArena + ld a, [wDuelTempList] + ldh [hTempList], a ; pick first in list + ret +; 0x2d363 + +; returns carry if Arena card has no Fire Energy cards +ArcanineFlamethrower_CheckEnergy: ; 2d363 (b:5363) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies] + ldtx hl, NotEnoughFireEnergyText + cp 1 + ret +; 0x2d371 + +ArcanineFlamethrower_PlayerSelectEffect: ; 2d371 (b:5371) + call PlayerPickFireEnergyCardToDiscard + ret +; 0x2d375 + +ArcanineFlamethrower_AISelectEffect: ; 2d375 (b:5375) + call AIPickFireEnergyCardToDiscard + ret +; 0x2d379 + +ArcanineFlamethrower_DiscardEffect: ; 2d379 (b:5379) + ldh a, [hTempList] + call PutCardInDiscardPile + ret +; 0x2d37f + +TakeDownEffect: ; 2d37f (b:537f) + ld a, 30 + call DealRecoilDamageToSelf + ret +; 0x2d385 + +ArcanineQuickAttack_AIEffect: ; 2d385 (b:5385) + ld a, (10 + 30) / 2 + lb de, 10, 30 + jp SetExpectedAIDamage +; 0x2d38d + +ArcanineQuickAttack_DamageBoostEffect: ; 2d38d (b:538d) + ld hl, 20 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsPlusDamageText + call TossCoin_BankB + ret nc ; return if tails + ld a, 20 + call AddToDamage + ret +; 0x2d3a0 + +; return carry if has less than 2 Fire Energy cards +FlamesOfRage_CheckEnergy: ; 2d3a0 (b:53a0) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies] + ldtx hl, NotEnoughFireEnergyText + cp 2 + ret +; 0x2d3ae + +FlamesOfRage_PlayerSelectEffect: ; 2d3ae (b:53ae) + ldtx hl, ChooseAndDiscard2FireEnergyCardsText + call DrawWideTextBox_WaitForInput + + xor a + ldh [hCurSelectionItem], a + call CreateListOfFireEnergyAttachedToArena + xor a + bank1call DisplayEnergyDiscardScreen +.loop_input + bank1call HandleEnergyDiscardMenuInput + ret c + call GetNextPositionInTempList + ldh a, [hTempCardIndex_ff98] + ld [hl], a + call RemoveCardFromDuelTempList + ldh a, [hCurSelectionItem] + cp 2 + ret nc ; return when 2 have been chosen + bank1call DisplayEnergyDiscardMenu + jr .loop_input +; 0x2d3d5 + +FlamesOfRage_AISelectEffect: ; 2d3d5 (b:53d5) + call AIPickFireEnergyCardToDiscard + ld a, [wDuelTempList + 1] + ldh [hTempList + 1], a + ret +; 0x2d3de + +FlamesOfRage_DiscardEffect: ; 2d3de (b:53de) + ldh a, [hTempList] + call PutCardInDiscardPile + ldh a, [hTempList + 1] + call PutCardInDiscardPile + ret +; 0x2d3e9 + +FlamesOfRage_AIEffect: ; 2d3e9 (b:53e9) + call FlamesOfRage_DamageBoostEffect + jp SetMinMaxDamageSameAsDamage +; 0x2d3ef + +FlamesOfRage_DamageBoostEffect: ; 2d3ef (b:53ef) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + call AddToDamage + ret +; 0x2d3f8 + +RapidashStomp_AIEffect: ; 2d3f8 (b:53f8) + ld a, (20 + 30) / 2 + lb de, 20, 30 + jp SetExpectedAIDamage +; 0x2d400 + +RapidashStomp_DamageBoostEffect: ; 2d400 (b:5400) + ld hl, 10 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsPlusDamageText + call TossCoin_BankB + ret nc ; return if tails + ld a, 10 + call AddToDamage + ret +; 0x2d413 + +RapidashAgilityEffect: ; 2d413 (b:5413) + ldtx de, IfHeadsDoNotReceiveDamageOrEffectText + call TossCoin_BankB + ret nc ; return if tails + ld a, $52 + ld [wLoadedMoveAnimation], a + ld a, SUBSTATUS1_AGILITY + call ApplySubstatus1ToDefendingCard + ret +; 0x2d425 + +; returns carry if Opponent has no Pokemon in bench +NinetailsLure_CheckBench: ; 2d425 (b:5425) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + ldtx hl, EffectNoPokemonOnTheBenchText + cp 2 + ret +; 0x2d430 + +NinetailsLure_PlayerSelectEffect: ; 2d430 (b:5430) + ldtx hl, SelectPkmnOnBenchToSwitchWithActiveText + call DrawWideTextBox_WaitForInput + call SwapTurn + bank1call HasAlivePokemonInBench +.loop_input + bank1call OpenPlayAreaScreenForSelection + jr c, .loop_input + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + call SwapTurn + ret +; 0x2d449 + +NinetailsLure_AISelectEffect: ; 2d449 (b:5449) + call GetBenchPokemonWithLowestHP + ldh [hTemp_ffa0], a + ret +; 0x2d44f + +NinetailsLure_SwitchEffect: ; 2d44f (b:544f) + call SwapTurn + ldh a, [hTemp_ffa0] + ld e, a + call HandleNShieldAndTransparency + call nc, SwapArenaWithBenchPokemon + call SwapTurn + xor a + ld [wDuelDisplayedScreen], a + ret +; 0x2d463 + +; return carry if no Fire energy cards +FireBlast_CheckEnergy: ; 2d463 (b:5463) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ldtx hl, NotEnoughFireEnergyText + ld a, [wAttachedEnergies] + cp 1 + ret +; 0x2d471 + +FireBlast_PlayerSelectEffect: ; 2d471 (b:5471) + call PlayerPickFireEnergyCardToDiscard + ret +; 0x2d475 + +FireBlast_AISelectEffect: ; 2d475 (b:5475) + call AIPickFireEnergyCardToDiscard + ret +; 0x2d479 + +FireBlast_DiscardEffect: ; 2d479 (b:5479) + ldh a, [hTempList] + call PutCardInDiscardPile + ret +; 0x2d47f + +; return carry if no Fire energy cards +Ember_CheckEnergy: ; 2d47f (b:547f) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ldtx hl, NotEnoughFireEnergyText + ld a, [wAttachedEnergies] + cp 1 + ret +; 0x2d48d + +Ember_PlayerSelectEffect: ; 2d48d (b:548d) + call PlayerPickFireEnergyCardToDiscard + ret +; 0x2d491 + +Ember_AISelectEffect: ; 2d491 (b:5491) + call AIPickFireEnergyCardToDiscard + ret +; 0x2d495 + +Ember_DiscardEffect: ; 2d495 (b:5495) + ldh a, [hTempList] + call PutCardInDiscardPile + ret +; 0x2d49b + +; return carry if no Fire energy cards +Wildfire_CheckEnergy: ; 2d49b (b:549b) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ldtx hl, NotEnoughFireEnergyText + ld a, [wAttachedEnergies] + cp 1 + ret +; 0x2d4a9 + +Wildfire_PlayerSelectEffect: ; 2d4a9 (b:54a9) + ldtx hl, DiscardOppDeckAsManyFireEnergyCardsText + call DrawWideTextBox_WaitForInput + + xor a + ldh [hCurSelectionItem], a + call CreateListOfFireEnergyAttachedToArena + xor a + bank1call DisplayEnergyDiscardScreen + +; show list to Player and for each card selected to discard, +; just increase a counter and store it. +; this will be the output used by Wildfire_DiscardEnergyEffect. + xor a + ld [wcbfa], a +.loop + ldh a, [hCurSelectionItem] + ld [wcbfb], a + bank1call HandleEnergyDiscardMenuInput + jr c, .done + ld hl, hCurSelectionItem + inc [hl] + call RemoveCardFromDuelTempList + jr c, .done + bank1call DisplayEnergyDiscardMenu + jr .loop + +.done +; return carry if no cards were discarded +; output the result in hTemp_ffa0 + ldh a, [hCurSelectionItem] + ldh [hTemp_ffa0], a + or a + ret nz + scf + ret +; 0x2d4dd + +Wildfire_AISelectEffect: ; 2d4dd (b:54dd) +; AI always chooses 0 cards to discard + xor a + ldh [hTempList], a + ret +; 0x2d4e1 + +Wildfire_DiscardEnergyEffect: ; 2d4e1 (b:54e1) + call CreateListOfFireEnergyAttachedToArena + ldh a, [hTemp_ffa0] + or a + ret z ; no cards to discard + +; discard cards from wDuelTempList equal to the number +; of cards that were input in hTemp_ffa0. +; these are all the Fire Energy cards attached to Arena card +; so it will discard the cards in order, regardless +; of the actual order that was selected by Player. + ld c, a + ld hl, wDuelTempList +.loop_discard + ld a, [hli] + call PutCardInDiscardPile + dec c + jr nz, .loop_discard + ret +; 0x2d4f4 + +Wildfire_DiscardDeckEffect: ; 2d4f4 (b:54f4) + ldh a, [hTemp_ffa0] + ld c, a + ld b, $00 + call SwapTurn + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetTurnDuelistVariable + ld a, DECK_SIZE + sub [hl] + cp c + jr nc, .start_discard + ; only discard number of cards that are left in deck + ld c, a + +.start_discard + push bc + inc c + jr .check_remaining + +.loop + ; discard top card from deck + call DrawCardFromDeck + call nc, PutCardInDiscardPile +.check_remaining + dec c + jr nz, .loop + + pop hl + call LoadTxRam3 + ldtx hl, DiscardedCardsFromDeckText + call DrawWideTextBox_PrintText + call SwapTurn + ret +; 0x2d523 + +Moltres1DiveBomb_AIEffect: ; 2d523 (b:5523) + ld a, 80 / 2 + lb de, 0, 80 + jp SetExpectedAIDamage +; 0x2d52b + +Moltres1DiveBomb_Success50PercentEffect: ; 2d52b (b:552b) + ldtx de, SuccessCheckIfHeadsAttackIsSuccessfulText + call TossCoin_BankB + jr c, .heads +; tails + xor a + call SetDefiniteDamage + call SetWasUnsuccessful + ret +.heads + ld a, $11 + ld [wLoadedMoveAnimation], a + ret +; 0x2d541 + +FlareonQuickAttack_AIEffect: ; 2d541 (b:5541) + ld a, (10 + 30) / 2 + lb de, 10, 30 + jp SetExpectedAIDamage +; 0x2d549 + +FlareonQuickAttack_DamageBoostEffect: ; 2d549 (b:5549) + ld hl, 20 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsPlusDamageText + call TossCoin_BankB + ret nc ; return if tails + ld a, 20 + call AddToDamage + ret +; 0x2d55c + +; return carry if no Fire Energy attached +FlareonFlamethrower_CheckEnergy: ; 2d55c (b:555c) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ldtx hl, NotEnoughFireEnergyText + ld a, [wAttachedEnergies] + cp 1 + ret +; 0x2d56a + +FlareonFlamethrower_PlayerSelectEffect: ; 2d56a (b:556a) + call PlayerPickFireEnergyCardToDiscard + ret +; 0x2d56e + +FlareonFlamethrower_AISelectEffect: ; 2d56e (b:556e) + call AIPickFireEnergyCardToDiscard + ret +; 0x2d572 + +FlareonFlamethrower_DiscardEffect: ; 2d572 (b:5572) + ldh a, [hTempList] + call PutCardInDiscardPile + ret +; 0x2d578 + +; return carry if no Fire Energy attached +MagmarFlamethrower_CheckEnergy: ; 2d578 (b:5578) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ldtx hl, NotEnoughFireEnergyText + ld a, [wAttachedEnergies] + cp 1 + ret +; 0x2d586 + +MagmarFlamethrower_PlayerSelectEffect: ; 2d586 (b:5586) + call PlayerPickFireEnergyCardToDiscard + ret +; 0x2d58a + +MagmarFlamethrower_AISelectEffect: ; 2d58a (b:558a) + call AIPickFireEnergyCardToDiscard + ret +; 0x2d58e + +MagmarFlamethrower_DiscardEffect: ; 2d58e (b:558e) + ldh a, [hTempList] + call PutCardInDiscardPile + ret +; 0x2d594 + +MagmarSmokescreenEffect: ; 2d594 (b:5594) + ld a, SUBSTATUS2_SMOKESCREEN + call ApplySubstatus2ToDefendingCard + ret +; 0x2d59a + +MagmarSmog_AIEffect: ; 2d59a (b:559a) + ld a, 5 + lb de, 0, 10 + jp UpdateExpectedAIDamage_AccountForPoison +; 0x2d5a2 + +; return carry if no Fire Energy attached +CharmeleonFlamethrower_CheckEnergy: ; 2d5a2 (b:55a2) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ldtx hl, NotEnoughFireEnergyText + ld a, [wAttachedEnergies] + cp 1 + ret +; 0x2d5b0 + +CharmeleonFlamethrower_PlayerSelectEffect: ; 2d5b0 (b:55b0) + call PlayerPickFireEnergyCardToDiscard + ret +; 0x2d5b4 + +CharmeleonFlamethrower_AISelectEffect: ; 2d5b4 (b:55b4) + call AIPickFireEnergyCardToDiscard + ret +; 0x2d5b8 + +CharmeleonFlamethrower_DiscardEffect: ; 2d5b8 (b:55b8) + ldh a, [hTempList] + call PutCardInDiscardPile + ret +; 0x2d5be + +EnergyBurnEffect: ; 2d5be (b:55be) + scf + ret +; 0x2d5c0 + +; return carry if has less than 2 Fire Energy cards +FireSpin_CheckEnergy: ; 2d5c0 (b:55c0) + xor a ; PLAY_AREA_ARENA + call CreateArenaOrBenchEnergyCardList + call CountCardsInDuelTempList + ldtx hl, NotEnoughEnergyCardsText + cp 2 + ret +; 0x2d5cd + +FireSpin_PlayerSelectEffect: ; 2d5cd (b:55cd) + ldtx hl, ChooseAndDiscard2EnergyCardsText + call DrawWideTextBox_WaitForInput + + xor a + ldh [hCurSelectionItem], a + xor a + call CreateArenaOrBenchEnergyCardList + call SortCardsInDuelTempListByID + xor a + bank1call DisplayEnergyDiscardScreen + + ld a, 2 + ld [wcbfa], a +.loop_input + bank1call HandleEnergyDiscardMenuInput + ret c + call GetNextPositionInTempList + ldh a, [hTempCardIndex_ff98] + ld [hl], a + ld hl, wcbfb + inc [hl] + ldh a, [hCurSelectionItem] + cp 2 + jr nc, .done + ldh a, [hTempCardIndex_ff98] + call RemoveCardFromDuelTempList + bank1call DisplayEnergyDiscardMenu + jr .loop_input +.done +; return when 2 have been chosen + or a + ret +; 0x2d606 + +FireSpin_AISelectEffect: ; 2d606 (b:5606) + xor a ; PLAY_AREA_ARENA + call CreateArenaOrBenchEnergyCardList + ld hl, wDuelTempList + ld a, [hli] + ldh [hTempList], a + ld a, [hl] + ldh [hTempList + 1], a + ret +; 0x2d614 + +FireSpin_DiscardEffect: ; 2d614 (b:5614) + ld hl, hTempList + ld a, [hli] + call PutCardInDiscardPile + ld a, [hli] + call PutCardInDiscardPile + ret +; 0x2d620 + +; returns carry if Pkmn Power cannot be used +; or if Arena card is not Charizard. +; this is unused. +EnergyBurnCheck_Unreferenced: ; 2d620 (b:5620) + xor a + bank1call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret c + ld a, DUELVARS_ARENA_CARD + push de + call GetTurnDuelistVariable + call GetCardIDFromDeckIndex + ld a, e + pop de + cp CHARIZARD + jr nz, .not_charizard + or a + ret +.not_charizard + scf + ret +; 0x2d638 + +FlareonRage_AIEffect: ; 2d638 (b:5638) + call FlareonRage_DamageBoostEffect + jp SetMinMaxDamageSameAsDamage +; 0x2d63e + +FlareonRage_DamageBoostEffect: ; 2d63e (b:563e) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + call AddToDamage + ret +; 0x2d647 + +MixUpEffect: ; 2d647 (b:5647) + call SwapTurn + call CreateHandCardList + call SortCardsInDuelTempListByID + +; first go through Hand to place +; all Pkmn cards in it in the Deck. + ld hl, wDuelTempList + ld c, 0 +.loop_hand + ld a, [hl] + cp $ff + jr z, .done_hand + call .CheckIfCardIsPkmnCard + jr nc, .next_hand + ; found Pkmn card, place in deck + inc c + ld a, [hl] + call RemoveCardFromHand + call ReturnCardToDeck +.next_hand + inc hl + jr .loop_hand + +.done_hand + ld a, c + ldh [hCurSelectionItem], a + push bc + ldtx hl, ThePkmnCardsInHandAndDeckWereShuffledText + call DrawWideTextBox_WaitForInput + + call Func_2c0bd + call CreateDeckCardList + pop bc + ldh a, [hCurSelectionItem] + or a + jr z, .done ; if no cards were removed from Hand, return + +; c holds the number of cards that were placed in the Deck. +; now pick Pkmn cards from the Deck to place in Hand. + ld hl, wDuelTempList +.loop_deck + ld a, [hl] + call .CheckIfCardIsPkmnCard + jr nc, .next_deck + dec c + ld a, [hl] + call SearchCardInDeckAndAddToHand + call AddCardToHand +.next_deck + inc hl + ld a, c + or a + jr nz, .loop_deck +.done + call SwapTurn + ret +; 0x2d69a + +; returns carry if card index in a is Pkmn card +.CheckIfCardIsPkmnCard: ; 2d69a (b:569a) + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + ret +; 0x2d6a3 + +DancingEmbers_AIEffect: ; 2d6a3 (b:56a3) + ld a, 80 / 2 + lb de, 0, 80 + jp SetExpectedAIDamage +; 0x2d6ab + +DancingEmbers_MultiplierEffect: ; 2d6ab (b:56ab) + ld hl, 10 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 8 + call TossCoinATimes_BankB + call ATimes10 + call SetDefiniteDamage + ret +; 0x2d6c0 + +Firegiver_InitialEffect: ; 2d6c0 (b:56c0) + scf + ret +; 0x2d6c2 + +Firegiver_AddToHandEffect: ; 2d6c2 (b:56c2) +; fill wDuelTempList with all Fire Energy card +; deck indices that are in the Deck. + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable + ld de, wDuelTempList + ld c, 0 +.loop_cards + ld a, [hl] + cp CARD_LOCATION_DECK + jr nz, .next + push hl + push de + ld a, l + call GetCardIDFromDeckIndex + call GetCardType + pop de + pop hl + cp TYPE_ENERGY_FIRE + jr nz, .next + ld a, l + ld [de], a + inc de + inc c +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_cards + ld a, $ff + ld [de], a + +; check how many were found + ld a, c + or a + jr nz, .found + ; return if none found + ldtx hl, ThereWasNoFireEnergyText + call DrawWideTextBox_WaitForInput + call Func_2c0bd + ret + +.found +; pick a random number between 1 and 4, +; up to the maximum number of Fire Energy +; cards that were found. + ld a, 4 + call Random + inc a + cp c + jr c, .ok + ld a, c + +.ok + ldh [hCurSelectionItem], a +; load correct Move animation depending +; on what side the effect is from. + ld d, $84 + ld a, [wDuelistType] + cp DUELIST_TYPE_PLAYER + jr z, .player_1 +; opponent + ld d, $85 +.player_1 + ld a, d + ld [wLoadedMoveAnimation], a + +; start loop for adding Energy cards to hand + ldh a, [hCurSelectionItem] + ld c, a + ld hl, wDuelTempList +.loop_energy + push hl + push bc + ld bc, $0 + ldh a, [hWhoseTurn] + ld h, a + bank1call PlayMoveAnimation + bank1call WaitMoveAnimation + +; load correct coordinates to update the number of cards +; in hand and deck during animation. + lb bc, 18, 7 ; x, y for hand number + ld e, 3 ; y for deck number + ld a, [wLoadedMoveAnimation] + cp $84 + jr z, .player_2 + lb bc, 4, 5 ; x, y for hand number + ld e, 10 ; y for deck number + +.player_2 +; update and print number of cards in hand + ld a, DUELVARS_NUMBER_OF_CARDS_IN_HAND + call GetTurnDuelistVariable + inc a + bank1call WriteTwoDigitNumberInTxSymbolFormat +; update and print number of cards in deck + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetTurnDuelistVariable + ld a, DECK_SIZE - 1 + sub [hl] + ld c, e + bank1call WriteTwoDigitNumberInTxSymbolFormat + +; load Fire Energy card index and add to hand + pop bc + pop hl + ld a, [hli] + call SearchCardInDeckAndAddToHand + call AddCardToHand + dec c + jr nz, .loop_energy + +; load the number of cards added to hand and print text + ldh a, [hCurSelectionItem] + ld l, a + ld h, $00 + call LoadTxRam3 + ldtx hl, DrewFireEnergyFromTheHandText + call DrawWideTextBox_WaitForInput + call Func_2c0bd + ret +; 0x2d76e + +Moltres2DiveBomb_AIEffect: ; 2d76e (b:576e) + ld a, 70 / 2 + lb de, 0, 70 + jp SetExpectedAIDamage +; 0x2d776 + +Moltres2DiveBomb_Success50PercentEffect: ; 2d776 (b:5776) + ldtx de, SuccessCheckIfHeadsAttackIsSuccessfulText + call TossCoin_BankB + jr c, .heads +; tails + xor a + call SetDefiniteDamage + call SetWasUnsuccessful + ret +.heads + ld a, $11 + ld [wLoadedMoveAnimation], a + ret +; 0x2d78c + +; output in de the number of energy cards +; attached to the Defending Pokemon times 10. +; used for attacks that deal 10x number of energy +; cards attached to the Defending card. +GetEnergyAttachedMultiplierDamage: ; 2d78c (b:578c) + call SwapTurn + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable + + ld c, 0 +.loop + ld a, [hl] + cp CARD_LOCATION_ARENA + jr nz, .next + ; is in Arena + ld a, l + call GetCardIDFromDeckIndex + call GetCardType + and TYPE_ENERGY + jr z, .next + ; is Energy attached to Arena card + inc c +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop + + call SwapTurn + ld l, c + ld h, $00 + ld b, $00 + add hl, hl ; hl = 2 * c + add hl, hl ; hl = 4 * c + add hl, bc ; hl = 5 * c + add hl, hl ; hl = 10 * c + ld e, l + ld d, h + ret +; 0x2d7bc + +; draws list of Energy Cards in Discard Pile +; for Player to select from. +; the Player can select up to 2 cards from the list. +; these cards are given in $ff-terminated list +; in hTempList. +HandleEnergyCardsInDiscardPileSelection: ; 2d7bc (b:57bc) + push hl + xor a + ldh [hCurSelectionItem], a + call CreateEnergyCardListFromDiscardPile_AllEnergy + pop hl + jr c, .finish + + call DrawWideTextBox_WaitForInput +.loop +; draws Discard Pile screen and textbox, +; and handles Player input + bank1call InitAndDrawCardListScreenLayout + ldtx hl, ChooseAnEnergyCardText + ldtx de, PlayerDiscardPileText + bank1call SetCardListHeaderText + bank1call DisplayCardList + jr nc, .selected + +; Player is trying to exit screen, +; but can select up to 2 cards total. +; prompt Player to confirm exiting screen. + ld a, 2 + call AskWhetherToQuitSelectingCards + jr c, .loop + jr .finish + +.selected +; a card was selected, so add it to list + call GetNextPositionInTempList + ldh a, [hTempCardIndex_ff98] + ld [hl], a + call RemoveCardFromDuelTempList + or a + jr z, .finish ; no more cards? + ldh a, [hCurSelectionItem] + cp 2 + jr c, .loop ; already selected 2 cards? + +.finish +; place terminating byte on list + call GetNextPositionInTempList + ld [hl], $ff + or a + ret +; 0x2d7fc + +; returns carry if Pkmn Power cannot be used, and +; sets the correct text in hl for failure. +Curse_CheckDamageAndBench: ; 2d7fc (b:57fc) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + +; fail if Pkmn Power has already been used + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + ldtx hl, OnlyOncePerTurnText + and USED_PKMN_POWER_THIS_TURN + jr nz, .set_carry + +; fail if Opponent only has 1 Pokemon in Play Area + call SwapTurn + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + call SwapTurn + ldtx hl, CannotUseSinceTheresOnly1PkmnText + cp 2 + jr c, .set_carry + +; fail if Opponent has no damage counters + call SwapTurn + call CheckIfPlayAreaHasAnyDamage + call SwapTurn + ldtx hl, NoPokemonWithDamageCountersText + jr c, .set_carry + +; return carry if Pkmn Power cannot be used due +; to Toxic Gas or status. + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret + +.set_carry + scf + ret +; 0x2d834 + +Curse_PlayerSelectEffect: ; 2d834 (b:5834) + ldtx hl, ProcedureForCurseText + bank1call DrawWholeScreenTextBox + call SwapTurn + xor a + ldh [hCurSelectionItem], a + bank1call Func_61a1 +.start + bank1call PrintPlayAreaCardList_EnableLCD + push af + ldh a, [hCurSelectionItem] + ld hl, PlayAreaSelectionMenuParameters + call InitializeMenuParameters + pop af + ld [wNumMenuItems], a + +; first pick a target to take 1 damage counter from. +.loop_input_first + call DoFrame + call HandleMenuInput + jr nc, .loop_input_first + cp $ff + jr z, .cancel + ldh [hCurSelectionItem], a + ldh [hTempPlayAreaLocation_ffa1], a + call GetCardDamageAndMaxHP + or a + jr nz, .picked_first ; test if has damage + ; play sfx + call Func_3794 + jr .loop_input_first + +.picked_first +; give 10 HP to card selected, draw the scene, +; then immediately revert this. + ldh a, [hTempPlayAreaLocation_ffa1] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + push af + push hl + add 10 + ld [hl], a + bank1call PrintPlayAreaCardList_EnableLCD + pop hl + pop af + ld [hl], a + +; draw damage counter on cursor + ldh a, [hTempPlayAreaLocation_ffa1] + ld b, SYM_HP_NOK + call DrawSymbolOnPlayAreaCursor + +; handle input to pick the target to receive the damage counter. +.loop_input_second + call DoFrame + call HandleMenuInput + jr nc, .loop_input_second + ldh [hPlayAreaEffectTarget], a + cp $ff + jr nz, .a_press ; was a pressed? + +; b press +; erase the damage counter symbol +; and loop back up again. + ldh a, [hTempPlayAreaLocation_ffa1] + ld b, SYM_SPACE + call DrawSymbolOnPlayAreaCursor + call EraseCursor + jr .start + +.a_press + ld hl, hTempPlayAreaLocation_ffa1 + cp [hl] + jr z, .loop_input_second ; same as first? +; a different Pokemon was picked, +; so store this Play Area location +; and erase the damage counter in the cursor. + ldh a, [hTempPlayAreaLocation_ffa1] + ld b, SYM_SPACE + call DrawSymbolOnPlayAreaCursor + call EraseCursor + call SwapTurn + or a + ret + +.cancel +; return carry if operation was cancelled. + call SwapTurn + scf + ret +; 0x2d8bb + +Curse_TransferDamageEffect: ; 2d8bb (b:58bb) +; set Pkmn Power as used + ldh a, [hTempList] + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + set USED_PKMN_POWER_THIS_TURN_F, [hl] + +; figure out the type of duelist that used Curse. +; if it was the player, no need to draw the Play Area screen. + call SwapTurn + ld a, DUELVARS_DUELIST_TYPE + call GetNonTurnDuelistVariable + cp DUELIST_TYPE_PLAYER + jr z, .vs_player + +; vs. oppponent + bank1call Func_61a1 +.vs_player +; transfer the damage counter to the targets that were selected. + ldh a, [hPlayAreaEffectTarget] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + sub 10 + ld [hl], a + ldh a, [hTempPlayAreaLocation_ffa1] + add DUELVARS_ARENA_CARD_HP + ld l, a + ld a, 10 + add [hl] + ld [hl], a + + bank1call PrintPlayAreaCardList_EnableLCD + ld a, DUELVARS_DUELIST_TYPE + call GetNonTurnDuelistVariable + cp DUELIST_TYPE_PLAYER + jr z, .done +; vs. opponent + ldh a, [hPlayAreaEffectTarget] + ldh [hTempPlayAreaLocation_ff9d], a + bank1call Func_6194 + +.done + call SwapTurn + call ExchangeRNG + bank1call Func_6e49 + ret +; 0x2d903 + +GengarDarkMind_PlayerSelectEffect: ; 2d903 (b:5903) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp 2 + jr nc, .has_bench +; no bench Pokemon to damage. + ld a, $ff + ldh [hTemp_ffa0], a + ret + +.has_bench +; opens Play Area screen to select Bench Pokemon +; to damage, and store it before returning. + ldtx hl, ChoosePkmnInTheBenchToGiveDamageText + call DrawWideTextBox_WaitForInput + call SwapTurn + bank1call HasAlivePokemonInBench +.loop_input + bank1call OpenPlayAreaScreenForSelection + jr c, .loop_input + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + call SwapTurn + ret +; 0x2d92a + +GengarDarkMind_AISelectEffect: ; 2d92a (b:592a) + ld a, $ff + ldh [hTemp_ffa0], a + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp 2 + ret c ; return if no Bench Pokemon +; just pick Pokemon with lowest remaining HP. + call GetBenchPokemonWithLowestHP + ldh [hTemp_ffa0], a + ret +; 0x2d93c + +GengarDarkMind_DamageBenchEffect: ; 2d93c (b:593c) + ldh a, [hTemp_ffa0] + cp $ff + ret z ; no target chosen + call SwapTurn + ld b, a + ld de, 10 + call DealDamageToPlayAreaPokemon_RegularAnim + call SwapTurn + ret +; 0x2d94f + +SleepingGasEffect: ; 2d94f (b:594f) + call Sleep50PercentEffect + call nc, SetNoEffectFromStatus + ret +; 0x2d956 + +DestinyBond_CheckEnergy: ; 2d956 (b:5956) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies + PSYCHIC] + ldtx hl, NotEnoughPsychicEnergyText + cp 1 + ret +; 0x2d964 + +DestinyBond_PlayerSelectEffect: ; 2d964 (b:5964) +; handle input and display of Energy card list + ld a, TYPE_ENERGY_PSYCHIC + call CreateListOfEnergyAttachedToArena + xor a + bank1call DisplayEnergyDiscardScreen + bank1call HandleEnergyDiscardMenuInput + ret c + ldh a, [hTempCardIndex_ff98] + ldh [hTempList], a + ret +; 0x2d976 + +DestinyBond_AISelectEffect: ; 2d976 (b:5976) +; pick first card in list + ld a, TYPE_ENERGY_PSYCHIC + call CreateListOfEnergyAttachedToArena + ld a, [wDuelTempList] + ldh [hTempList], a + ret +; 0x2d981 + +DestinyBond_DiscardEffect: ; 2d981 (b:5981) + ldh a, [hTempList] + call PutCardInDiscardPile + ret +; 0x2d987 + +DestinyBond_DestinyBondEffect: ; 2d987 (b:5987) + ld a, SUBSTATUS1_DESTINY_BOND + call ApplySubstatus1ToDefendingCard + ret +; 0x2d98d + +; returns carry if no Energy cards in Discard Pile. +EnergyConversion_CheckEnergy: ; 2d98d (b:598d) + call CreateEnergyCardListFromDiscardPile_AllEnergy + ldtx hl, ThereAreNoEnergyCardsInDiscardPileText + ret +; 0x2d994 + +EnergyConversion_PlayerSelectEffect: ; 2d994 (b:5994) + ldtx hl, Choose2EnergyCardsFromDiscardPileForHandText + call HandleEnergyCardsInDiscardPileSelection + ret +; 0x2d99b + +EnergyConversion_AISelectEffect: ; 2d99b (b:599b) + call CreateEnergyCardListFromDiscardPile_AllEnergy + ld hl, wDuelTempList + ld de, hTempList + ld c, 2 +; select the first two energy cards found in Discard Pile +.loop + ld a, [hli] + cp $ff + jr z, .done + ld [de], a + inc de + dec c + jr nz, .loop +.done + ld a, $ff + ld [de], a + ret +; 0x2d9b4 + +EnergyConversion_AddToHandEffect: ; 2d9b4 (b:59b4) +; damage itself + ld a, 10 + call DealRecoilDamageToSelf + +; loop cards that were chosen +; until $ff is reached, +; and move them to the hand. + ld hl, hTempList + ld de, wDuelTempList +.loop_cards + ld a, [hli] + ld [de], a + inc de + cp $ff + jr z, .done + call MoveDiscardPileCardToHand + call AddCardToHand + jr .loop_cards + +.done + call IsPlayerTurn + ret c + bank1call Func_4b38 + ret +; 0x2d9d6 + +; return carry if Defending Pokemon is not asleep +DreamEaterEffect: ; 2d9d6 (b:59d6) + ld a, DUELVARS_ARENA_CARD_STATUS + call GetNonTurnDuelistVariable + and CNF_SLP_PRZ + cp ASLEEP + ret z ; return if asleep +; not asleep, set carry and load text + ldtx hl, OpponentIsNotAsleepText + scf + ret +; 0x2d9e5 + +TransparencyEffect: ; 2d9e5 (b:59e5) + scf + ret +; 0x2d9e7 + +; returns carry if neither the Turn Duelist or +; the non-Turn Duelist have any deck cards. +Prophecy_CheckDeck: ; 2d9e7 (b:59e7) + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetTurnDuelistVariable + cp DECK_SIZE + jr c, .no_carry + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetNonTurnDuelistVariable + cp DECK_SIZE + jr c, .no_carry + ldtx hl, NoCardsLeftInTheDeckText + scf + ret +.no_carry + or a + ret +; 0x2da00 + +Prophecy_PlayerSelectEffect: ; 2da00 (b:5a00) + ldtx hl, ProcedureForProphecyText + bank1call DrawWholeScreenTextBox +.select_deck + bank1call DrawDuelMainScene + ldtx hl, PleaseSelectTheDeckText + call TwoItemHorizontalMenu + ldh a, [hKeysHeld] + and B_BUTTON + jr nz, Prophecy_PlayerSelectEffect ; loop back to start + + ldh a, [hCurMenuItem] + ldh [hTempList], a ; store selection in first position in list + or a + jr z, .turn_duelist + +; non-turn duelist + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetNonTurnDuelistVariable + cp DECK_SIZE + jr nc, .select_deck ; no cards, go back to deck selection + call SwapTurn + call HandleProphecyScreen + call SwapTurn + ret + +.turn_duelist + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetTurnDuelistVariable + cp DECK_SIZE + jr nc, .select_deck ; no cards, go back to deck selection + call HandleProphecyScreen + ret +; 0x2da3c + +Prophecy_AISelectEffect: ; 2da3c (b:5a3c) +; AI doesn't ever choose this attack +; so this it does no sorting. + ld a, $ff + ldh [hTemp_ffa0], a + ret +; 0x2da41 + +Prophecy_ReorderDeckEffect: ; 2da41 (b:5a41) + ld hl, hTempList + ld a, [hli] + or a + jr z, .ReorderCards ; turn duelist's deck + cp $ff + ret z + + ; non-turn duelist's deck + call SwapTurn + call .ReorderCards + call SwapTurn + ret + +.ReorderCards + ld c, 0 +; add selected cards to hand in the specified order +.loop_add_hand + ld a, [hli] + cp $ff + jr z, .dec_hl + call SearchCardInDeckAndAddToHand + inc c + jr .loop_add_hand + +.dec_hl +; go to last card that was in the list + dec hl + dec hl + +.loop_return_deck +; return the cards to the top of the deck + ld a, [hld] + call ReturnCardToDeck + dec c + jr nz, .loop_return_deck + call IsPlayerTurn + ret c + ; print text in case it was the opponent + ldtx hl, ExchangedCardsInDuelistsHandText + call DrawWideTextBox_WaitForInput + ret +; 0x2da76 + +; draw and handle Player selection for reordering +; the top 3 cards of Deck. +; the resulting list is output in order in hTempList. +HandleProphecyScreen: ; 2da76 (b:5a76) + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetTurnDuelistVariable + ld b, a + ld a, DECK_SIZE + sub [hl] ; a = number of cards in deck + +; store in c the number of cards that will be reordered. +; this number is 3, unless the deck as fewer cards than +; that in which case it will be the number of cards remaining. + ld c, 3 + cp c + jr nc, .got_number_cards + ld c, a ; store number of remaining cards in c +.got_number_cards + ld a, c + inc a + ld [wNumberOfCardsToOrder], a + +; store in wDuelTempList the cards +; at top of Deck to be reordered. + ld a, b + add DUELVARS_DECK_CARDS + ld l, a + ld de, wDuelTempList +.loop_top_cards + ld a, [hli] + ld [de], a + inc de + dec c + jr nz, .loop_top_cards + ld a, $ff ; terminating byte + ld [de], a + +.start + call CountCardsInDuelTempList + ld b, a + ld a, 1 ; start at 1 + ldh [hCurSelectionItem], a + +; initialize buffer ahead in wDuelTempList. + ld hl, wDuelTempList + 10 + xor a +.loop_init_buffer + ld [hli], a + dec b + jr nz, .loop_init_buffer + ld [hl], $ff + + bank1call InitAndDrawCardListScreenLayout + ldtx hl, ChooseTheOrderOfTheCardsText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText + bank1call Func_5735 + +.loop_selection + bank1call DisplayCardList + jr c, .clear + +; first check if this card was already selected + ldh a, [hCurMenuItem] + ld e, a + ld d, $00 + ld hl, wDuelTempList + 10 + add hl, de + ld a, [hl] + or a + jr nz, .loop_selection ; already chosen + +; being here means card hasn't been selected yet, +; so add its order number to buffer and increment +; the sort number for the next card. + ldh a, [hCurSelectionItem] + ld [hl], a + inc a + ldh [hCurSelectionItem], a + bank1call Func_5744 + ldh a, [hCurSelectionItem] + ld hl, wNumberOfCardsToOrder + cp [hl] + jr c, .loop_selection ; still more cards + +; confirm that the ordering has been completed + call EraseCursor + ldtx hl, IsThisOKText + call YesOrNoMenuWithText_LeftAligned + jr c, .start ; if not, return back to beginning of selection + +; write in hTempList the card list +; in order that was selected. + ld hl, wDuelTempList + 10 + ld de, wDuelTempList + ld c, 0 +.loop_order + ld a, [hli] + cp $ff + jr z, .done + push hl + push bc + ld c, a + ld b, $00 + ld hl, hTempList + add hl, bc + ld a, [de] + ld [hl], a + pop bc + pop hl + inc de + inc c + jr .loop_order +; now hTempList has the list of card deck indices +; in the order selected to be place on top of the deck. + +.done + ld b, $00 + ld hl, hTempList + 1 + add hl, bc + ld [hl], $ff ; terminating byte + or a + ret + +.clear +; check if any reordering was done. + ld hl, hCurSelectionItem + ld a, [hl] + cp 1 + jr z, .loop_selection ; none done, go back +; clear the order that was selected thus far. + dec a + ld [hl], a + ld c, a + ld hl, wDuelTempList + 10 +.loop_clear + ld a, [hli] + cp c + jr nz, .loop_clear + ; clear this byte + dec hl + ld [hl], $00 + bank1call Func_5744 + jr .loop_selection +; 0x2db2b + +HypnoDarkMind_PlayerSelectEffect: ; 2db2b (b:5b2b) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp 2 + jr nc, .has_bench +; no bench Pokemon to damage. + ld a, $ff + ldh [hTemp_ffa0], a + ret + +.has_bench +; opens Play Area screen to select Bench Pokemon +; to damage, and store it before returning. + ldtx hl, ChoosePkmnInTheBenchToGiveDamageText + call DrawWideTextBox_WaitForInput + call SwapTurn + bank1call HasAlivePokemonInBench +.loop_input + bank1call OpenPlayAreaScreenForSelection + jr c, .loop_input + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + call SwapTurn + ret +; 0x2db52 + +HypnoDarkMind_AISelectEffect: ; 2db52 (b:5b52) + ld a, $ff + ldh [hTemp_ffa0], a + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp 2 + ret c ; return if no Bench Pokemon +; just pick Pokemon with lowest remaining HP. + call GetBenchPokemonWithLowestHP + ldh [hTemp_ffa0], a + ret +; 0x2db64 + +HypnoDarkMind_DamageBenchEffect: ; 2db64 (b:5b64) + ldh a, [hTemp_ffa0] + cp $ff + ret z ; no target chosen + call SwapTurn + ld b, a + ld de, 10 + call DealDamageToPlayAreaPokemon_RegularAnim + call SwapTurn + ret +; 0x2db77 + +InvisibleWallEffect: ; 2db77 (b:5b77) + scf + ret +; 0x2db79 + +MrMimeMeditate_AIEffect: ; 2db79 (b:5b79) + call MrMimeMeditate_DamageBoostEffect + jp SetMinMaxDamageSameAsDamage +; 0x2db7f + +MrMimeMeditate_DamageBoostEffect: ; 2db7f (b:5b7f) +; add damage counters of Defending card to damage + call SwapTurn + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + call SwapTurn + call AddToDamage + ret +; 0x2db8e + +; returns carry if Damage Swap cannot be used. +DamageSwap_CheckDamage: ; 2db8e (b:5b8e) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + call CheckIfPlayAreaHasAnyDamage + jr c, .no_damage + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret +.no_damage + ldtx hl, NoPokemonWithDamageCountersText + scf + ret +; 0x2dba2 + +DamageSwap_SelectAndSwapEffect: ; 2dba2 (b:5ba2) + ld a, DUELVARS_DUELIST_TYPE + call GetTurnDuelistVariable + cp DUELIST_TYPE_PLAYER + jr z, .player +; non-player + bank1call Func_61a1 + bank1call PrintPlayAreaCardList_EnableLCD + ret + +.player + ldtx hl, ProcedureForDamageSwapText + bank1call DrawWholeScreenTextBox + xor a + ldh [hCurSelectionItem], a + bank1call Func_61a1 + +.start + bank1call PrintPlayAreaCardList_EnableLCD + push af + ldh a, [hCurSelectionItem] + ld hl, PlayAreaSelectionMenuParameters + call InitializeMenuParameters + pop af + ld [wNumMenuItems], a + +; handle selection of Pokemon to take damage from +.loop_input_first + call DoFrame + call HandleMenuInput + jr nc, .loop_input_first + cp $ff + ret z ; quit when B button is pressed + + ldh [hTempPlayAreaLocation_ffa1], a + ldh [hCurSelectionItem], a + +; if card has no damage, play sfx and return to start + call GetCardDamageAndMaxHP + or a + jr z, .no_damage + +; take damage away temporarily to draw UI. + ldh a, [hTempPlayAreaLocation_ffa1] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + push af + push hl + add 10 + ld [hl], a + bank1call PrintPlayAreaCardList_EnableLCD + pop hl + pop af + ld [hl], a + +; draw damage counter in cursor + ldh a, [hTempPlayAreaLocation_ffa1] + ld b, SYM_HP_NOK + call DrawSymbolOnPlayAreaCursor + +; handle selection of Pokemon to give damage to +.loop_input_second + call DoFrame + call HandleMenuInput + jr nc, .loop_input_second + ; if B is pressed, return damage counter + ; to card that it was taken from + cp $ff + jr z, .update_ui + +; try to give the card selected the damage counter +; if it would KO, ignore it. + ldh [hPlayAreaEffectTarget], a + ldh [hCurSelectionItem], a + call TryGiveDamageCounter_DamageSwap + jr c, .loop_input_second + + ld a, OPPACTION_6B15 + call SetOppAction_SerialSendDuelData + +.update_ui + ldh a, [hTempPlayAreaLocation_ffa1] + ld b, SYM_SPACE + call DrawSymbolOnPlayAreaCursor + call EraseCursor + jr .start + +.no_damage + call Func_3794 + jr .loop_input_first +; 0x2dc27 + +; tries to give damage counter to hPlayAreaEffectTarget, +; and if successful updates UI screen. +DamageSwap_SwapEffect: ; 2dc27 (b:5c27) + call TryGiveDamageCounter_DamageSwap + ret c + bank1call PrintPlayAreaCardList_EnableLCD + or a + ret +; 0x2dc30 + +; tries to give the damage counter to the target +; chosen by the Player (hPlayAreaEffectTarget). +; if the damage counter would KO card, then do +; not give the damage counter and return carry. +TryGiveDamageCounter_DamageSwap: ; 2dc30 (b:5c30) + ldh a, [hPlayAreaEffectTarget] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + sub 10 + jr z, .set_carry ; would bring HP to zero? +; has enough HP to receive a damage counter + ld [hl], a + ldh a, [hTempPlayAreaLocation_ffa1] + add DUELVARS_ARENA_CARD_HP + ld l, a + ld a, 10 + add [hl] + ld [hl], a + or a + ret +.set_carry + scf + ret +; 0x2dc49 + +PsywaveEffect: ; 2dc49 (b:5c49) + call GetEnergyAttachedMultiplierDamage + ld hl, wDamage + ld [hl], e + inc hl + ld [hl], d + ret +; 0x2dc53 + +; returns carry if neither Duelist has evolved Pokemon. +DevolutionBeam_CheckPlayArea: ; 2dc53 (b:5c53) + call CheckIfTurnDuelistHasEvolvedCards + ret nc + call SwapTurn + call CheckIfTurnDuelistHasEvolvedCards + call SwapTurn + ldtx hl, ThereAreNoStage1PokemonText + ret +; 0x2dc64 + +; returns carry of Player cancelled selection. +; otherwise, output in hTemp_ffa0 which Play Area +; was selected ($0 = own Play Area, $1 = opp. Play Area) +; and in hTempPlayAreaLocation_ffa1 selected card. +DevolutionBeam_PlayerSelectEffect: ; 2dc64 (b:5c64) + ldtx hl, ProcedureForDevolutionBeamText + bank1call DrawWholeScreenTextBox + +.start + bank1call DrawDuelMainScene + ldtx hl, PleaseSelectThePlayAreaText + call TwoItemHorizontalMenu + ldh a, [hKeysHeld] + and B_BUTTON + jr nz, .set_carry + +; a Play Area was selected + ldh a, [hCurMenuItem] + or a + jr nz, .opp_chosen + +; player chosen + call HandleEvolvedCardSelection + jr c, .start + + xor a +.store_selection + ld hl, hTemp_ffa0 + ld [hli], a ; store which Duelist Play Area selected + ldh a, [hTempPlayAreaLocation_ff9d] + ld [hl], a ; store which card selected + or a + ret + +.opp_chosen + call SwapTurn + call HandleEvolvedCardSelection + call SwapTurn + jr c, .start + ld a, $01 + jr .store_selection + +.set_carry + scf + ret +; 0x2dc9e + +DevolutionBeam_AISelectEffect: ; 2dc9e (b:5c9e) + ld a, $01 + ldh [hTemp_ffa0], a + call SwapTurn + call FindFirstNonBasicCardInPlayArea + call SwapTurn + jr c, .found + xor a + ldh [hTemp_ffa0], a + call FindFirstNonBasicCardInPlayArea +.found + ldh [hTempPlayAreaLocation_ffa1], a + ret +; 0x2dcb6 + +DevolutionBeam_LoadAnimation: ; 2dcb6 (b:5cb6) + xor a + ld [wLoadedMoveAnimation], a + ret +; 0x2dcbb + +DevolutionBeam_DevolveEffect: ; 2dcbb (b:5cbb) + ldh a, [hTemp_ffa0] + or a + jr z, .DevolvePokemon + cp $ff + ret z + +; opponent's Play Area + call SwapTurn + ldh a, [hTempPlayAreaLocation_ffa1] + jr nz, .skip_handle_no_damage_effect + call HandleNoDamageOrEffect + jr c, .unaffected +.skip_handle_no_damage_effect + call .DevolvePokemon +.unaffected + call SwapTurn + ret + +.DevolvePokemon + ld a, $5d + ld [wLoadedMoveAnimation], a + ldh a, [hTempPlayAreaLocation_ffa1] + ld b, a + ld c, $00 + ldh a, [hWhoseTurn] + ld h, a + bank1call PlayMoveAnimation + bank1call WaitMoveAnimation + +; load selected card's data + ldh a, [hTempPlayAreaLocation_ffa1] + ldh [hTempPlayAreaLocation_ff9d], a + ld [wTempPlayAreaLocation_cceb], a + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + +; check if car is affected + ld a, [wLoadedCard1ID] + ld [wTempNonTurnDuelistCardID], a + ld de, $0 + ldh a, [hTempPlayAreaLocation_ff9d] + or a + jr nz, .skip_substatus_check + call HandleNoDamageOrEffectSubstatus + jr c, .check_no_damage_effect +.skip_substatus_check + call HandleDamageReductionOrNoDamageFromPkmnPowerEffects +.check_no_damage_effect + call CheckNoDamageOrEffect + jr nc, .devolve + call DrawWideTextBox_WaitForInput + ret + +.devolve + ldh a, [hTempPlayAreaLocation_ffa1] + ldh [hTempPlayAreaLocation_ff9d], a + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + bank1call GetCardOneStageBelow + call PrintDevolvedCardNameAndLevelText + + ld a, d + call UpdateDevolvedCardHPAndStage + call ResetDevolvedCardStatus + +; add the evolved card to the hand + ld a, e + call AddCardToHand + +; check if this devolution KO's card + ldh a, [hTempPlayAreaLocation_ffa1] + call PrintPlayAreaCardKnockedOutIfNoHP + + xor a + ld [wDuelDisplayedScreen], a + ret +; 0x2dd3b + +; returns carry if Turn Duelist +; has no Stage1 or Stage2 cards in Play Area. +CheckIfTurnDuelistHasEvolvedCards: ; 2dd3b (b:5d3b) + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + ld d, h + ld e, DUELVARS_ARENA_CARD_STAGE +.loop + ld a, [hli] + cp $ff + jr z, .set_carry + ld a, [de] + inc de + or a + jr z, .loop ; is Basic Stage + ret +.set_carry + scf + ret +; 0x2dd50 + +; handles Player selection of an evolved card in Play Area. +; returns carry if Player cancelled operation. +HandleEvolvedCardSelection: ; 2dd50 (b:5d50) + bank1call HasAlivePokemonInPlayArea +.loop + bank1call OpenPlayAreaScreenForSelection + ret c + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD_STAGE + call GetTurnDuelistVariable + or a + jr z, .loop ; if Basic, loop + ret +; 0x2dd62 + +; finds first occurence in Play Area +; of Stage 1 or 2 card, and outputs its +; Play Area location in a, with carry set. +; if none found, don't return carry set. +FindFirstNonBasicCardInPlayArea: ; 2dd62 (b:5d62) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld c, a + + ld b, PLAY_AREA_ARENA + ld l, DUELVARS_ARENA_CARD_STAGE +.loop + ld a, [hli] + or a + jr nz, .not_basic + inc b + dec c + jr nz, .loop + or a + ret +.not_basic + ld a, b + scf + ret +; 0x2dd79 + +NeutralizingShieldEffect: ; 2dd79 (b:5d79) + scf + ret +; 0x2dd7b + +Psychic_AIEffect: ; 2dd7b (b:5d7b) + call Psychic_DamageBoostEffect + jp SetMinMaxDamageSameAsDamage +; 0x2dd81 + +Psychic_DamageBoostEffect: ; 2dd81 (b:5d81) + call GetEnergyAttachedMultiplierDamage + ld hl, wDamage + ld a, e + add [hl] + ld [hli], a + ld a, d + adc [hl] + ld [hl], a + ret +; 0x2dd8e + +; return carry if no Psychic Energy attached +Barrier_CheckEnergy: ; 2dd8e (b:5d8e) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies + PSYCHIC] + ldtx hl, NotEnoughPsychicEnergyText + cp 1 + ret +; 0x2dd9c + +Barrier_PlayerSelectEffect: ; 2dd9c (b:5d9c) + ld a, TYPE_ENERGY_PSYCHIC + call CreateListOfEnergyAttachedToArena + xor a ; PLAY_AREA_ARENA + bank1call DisplayEnergyDiscardScreen + bank1call HandleEnergyDiscardMenuInput + ret c + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + ret +; 0x2ddae + +Barrier_AISelectEffect: ; 2ddae (b:5dae) +; AI picks the first energy in list + ld a, TYPE_ENERGY_PSYCHIC + call CreateListOfEnergyAttachedToArena + ld a, [wDuelTempList] + ldh [hTemp_ffa0], a + ret +; 0x2ddb9 + +Barrier_DiscardEffect: ; 2ddb9 (b:5db9) + ldh a, [hTemp_ffa0] + call PutCardInDiscardPile + ret +; 0x2ddbf + +Barrier_BarrierEffect: ; 2ddbf (b:5dbf) + ld a, SUBSTATUS1_BARRIER + call ApplySubstatus1ToDefendingCard + ret +; 0x2ddc5 + +Mewtwo3EnergyAbsorption_CheckDiscardPile: ; 2ddc5 (b:5dc5) + call CreateEnergyCardListFromDiscardPile_AllEnergy + ldtx hl, ThereAreNoEnergyCardsInDiscardPileText + ret +; 0x2ddcc + +Mewtwo3EnergyAbsorption_PlayerSelectEffect: ; 2ddcc (b:5dcc) + ldtx hl, Choose2EnergyCardsFromDiscardPileToAttachText + call HandleEnergyCardsInDiscardPileSelection + ret +; 0x2ddd3 + +Mewtwo3EnergyAbsorption_AISelectEffect: ; 2ddd3 (b:5dd3) +; AI picks first 2 energy cards + call CreateEnergyCardListFromDiscardPile_AllEnergy + ld hl, wDuelTempList + ld de, hTempList + ld c, 2 +.loop + ld a, [hli] + cp $ff + jr z, .done + ld [de], a + inc de + dec c + jr nz, .loop +.done + ld a, $ff ; terminating byte + ld [de], a + ret +; 0x2ddec + +Mewtwo3EnergyAbsorption_AddToHandEffect: ; 2ddec (b:5dec) + ld hl, hTempList +.loop + ld a, [hli] + cp $ff + ret z + push hl + call MoveDiscardPileCardToHand + call GetTurnDuelistVariable + ld [hl], CARD_LOCATION_ARENA + pop hl + jr .loop +; 0x2ddff + +Mewtwo2EnergyAbsorption_CheckDiscardPile: ; 2ddff (b:5dff) + call CreateEnergyCardListFromDiscardPile_AllEnergy + ldtx hl, ThereAreNoEnergyCardsInDiscardPileText + ret +; 0x2de06 + +Mewtwo2EnergyAbsorption_PlayerSelectEffect: ; 2de06 (b:5e06) + ldtx hl, Choose2EnergyCardsFromDiscardPileToAttachText + call HandleEnergyCardsInDiscardPileSelection + ret +; 0x2de0d + +Mewtwo2EnergyAbsorption_AISelectEffect: ; 2de0d (b:5e0d) +; AI picks first 2 energy cards + call CreateEnergyCardListFromDiscardPile_AllEnergy + ld hl, wDuelTempList + ld de, hTempList + ld c, 2 +.loop + ld a, [hli] + cp $ff + jr z, .done + ld [de], a + inc de + dec c + jr nz, .loop +.done + ld a, $ff ; terminating byte + ld [de], a + ret +; 0x2de26 + +Mewtwo2EnergyAbsorption_AddToHandEffect: ; 2de26 (b:5e26) + ld hl, hTempList +.loop + ld a, [hli] + cp $ff + ret z + push hl + call MoveDiscardPileCardToHand + call GetTurnDuelistVariable + ld [hl], CARD_LOCATION_ARENA + pop hl + jr .loop +; 0x2de39 + +; returns carry if Strange Behavior cannot be used. +StrangeBehavior_CheckDamage: ; 2de39 (b:5e39) +; does Play Area have any damage counters? + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + call CheckIfPlayAreaHasAnyDamage + ldtx hl, NoPokemonWithDamageCountersText + jr c, .set_carry +; can Slowbro receive any damage counters without KOing? + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + ldtx hl, CannotUseBecauseItWillBeKnockedOutText + cp 10 + 10 + jr c, .set_carry +; can Pkmn Power be used? + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret + +.set_carry + scf + ret +; 0x2de5b + +StrangeBehavior_SelectAndSwapEffect: ; 2de5b (b:5e5b) + ld a, DUELVARS_DUELIST_TYPE + call GetTurnDuelistVariable + cp DUELIST_TYPE_PLAYER + jr z, .player + +; not player + bank1call Func_61a1 + bank1call PrintPlayAreaCardList_EnableLCD + ret + +.player + ldtx hl, ProcedureForStrangeBehaviorText + bank1call DrawWholeScreenTextBox + + xor a + ldh [hCurSelectionItem], a + bank1call Func_61a1 +.start + bank1call PrintPlayAreaCardList_EnableLCD + push af + ldh a, [hCurSelectionItem] + ld hl, PlayAreaSelectionMenuParameters + call InitializeMenuParameters + pop af + + ld [wNumMenuItems], a +.loop_input + call DoFrame + call HandleMenuInput + jr nc, .loop_input + cp -1 + ret z ; return when B button is pressed + + ldh [hCurSelectionItem], a + ldh [hTempPlayAreaLocation_ffa1], a + ld hl, hTemp_ffa0 + cp [hl] + jr z, .play_sfx ; can't select Slowbro itself + + call GetCardDamageAndMaxHP + or a + jr z, .play_sfx ; can't select card without damage + + call TryGiveDamageCounter_StrangeBehavior + jr c, .play_sfx + ld a, OPPACTION_6B15 + call SetOppAction_SerialSendDuelData + jr .start + +.play_sfx + call Func_3794 + jr .loop_input +; 0x2deb3 + +StrangeBehavior_SwapEffect: ; 2deb3 (b:5eb3) + call TryGiveDamageCounter_StrangeBehavior + ret c + bank1call PrintPlayAreaCardList_EnableLCD + or a + ret +; 0x2debc + +; tries to give the damage counter to the target +; chosen by the Player (hTemp_ffa0). +; if the damage counter would KO card, then do +; not give the damage counter and return carry. +TryGiveDamageCounter_StrangeBehavior: ; 2debc (b:5ebc) + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + sub 10 + jr z, .set_carry ; would bring HP to zero? +; has enough HP to receive a damage counter + ld [hl], a + ldh a, [hTempPlayAreaLocation_ffa1] + add DUELVARS_ARENA_CARD_HP + ld l, a + ld a, 10 + add [hl] + ld [hl], a + or a + ret +.set_carry + scf + ret +; 0x2ded5 + +; returns carry if has no damage counters. +SpacingOut_CheckDamage: ; 2ded5 (b:5ed5) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + ldtx hl, NoDamageCountersText + cp 10 + ret +; 0x2dee0 + +SpacingOut_Success50PercentEffect: ; 2dee0 (b:5ee0) + ldtx de, SuccessCheckIfHeadsAttackIsSuccessfulText + call TossCoin_BankB + ldh [hTemp_ffa0], a + jp nc, SetWasUnsuccessful + ld a, $58 + ld [wLoadedMoveAnimation], a + ret +; 0x2def1 + +SpacingOut_HealEffect: ; 2def1 (b:5ef1) + ldh a, [hTemp_ffa0] + or a + ret z ; coin toss was tails + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + or a + ret z ; no damage counters + ld a, DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + add 10 + ld [hl], a + ret +; 0x2df05 + +; sets carry if no Trainer cards in the Discard Pile. +Scavenge_CheckDiscardPile: ; 2df05 (b:5f05) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies + PSYCHIC] + ldtx hl, NotEnoughPsychicEnergyText + cp 1 + ret c ; return if no Psychic energy attached + call CreateTrainerCardListFromDiscardPile + ldtx hl, ThereAreNoTrainerCardsInDiscardPileText ; this is redundant + ret +; 0x2df1a + +Scavenge_PlayerSelectEnergyEffect: ; 2df1a (b:5f1a) + ld a, TYPE_ENERGY_PSYCHIC + call CreateListOfEnergyAttachedToArena + xor a ; PLAY_AREA_ARENA + bank1call DisplayEnergyDiscardScreen + bank1call HandleEnergyDiscardMenuInput + ret c + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + or a + ret +; 0x2df2d + +Scavenge_AISelectEffect: ; 2df2d (b:5f2d) +; AI picks first Energy card in list + ld a, TYPE_ENERGY_PSYCHIC + call CreateListOfEnergyAttachedToArena + ld a, [wDuelTempList] + ldh [hTemp_ffa0], a +; AI picks first Trainer card in list + call CreateTrainerCardListFromDiscardPile + ld a, [wDuelTempList] + ldh [hTempPlayAreaLocation_ffa1], a + ret +; 0x2df40 + +Scavenge_DiscardEffect: ; 2df40 (b:5f40) + ldh a, [hTemp_ffa0] + call PutCardInDiscardPile + ret +; 0x2df46 + +Scavenge_PlayerSelectTrainerEffect: ; 2df46 (b:5f46) + call CreateTrainerCardListFromDiscardPile + bank1call Func_5591 + ldtx hl, PleaseSelectCardText + ldtx de, PlayerDiscardPileText + bank1call SetCardListHeaderText +.loop_input + bank1call DisplayCardList + jr c, .loop_input + ldh a, [hTempCardIndex_ff98] + ldh [hTempPlayAreaLocation_ffa1], a + ret +; 0x2df5f + +Scavenge_AddToHandEffect: ; 2df5f (b:5f5f) + ldh a, [hTempPlayAreaLocation_ffa1] + call MoveDiscardPileCardToHand + call AddCardToHand + call IsPlayerTurn + ret c + ldh a, [hTempPlayAreaLocation_ffa1] + ldtx hl, WasPlacedInTheHandText + bank1call DisplayCardDetailScreen + ret +; 0x2df74 + +; returns carry if Defending Pokemon has no attacks +SlowpokeAmnesia_CheckAttacks: ; 2df74 (b:5f74) + call CheckIfDefendingPokemonHasAnyAttack + ldtx hl, NoAttackMayBeChoosenText + ret +; 0x2df7b + +SlowpokeAmnesia_PlayerSelectEffect: ; 2df7b (b:5f7b) + call PlayerPickAttackForAmnesia + ret +; 0x2df7f + +SlowpokeAmnesia_AISelectEffect: ; 2df7f (b:5f7f) + call AIPickAttackForAmnesia + ldh [hTemp_ffa0], a + ret +; 0x2df85 + +SlowpokeAmnesia_DisableEffect: ; 2df85 (b:5f85) + call ApplyAmnesiaToAttack + ret +; 0x2df89 + +; returns carry if Arena card has no Psychic Energy attached +; or if it doesn't have any damage counters. +KadabraRecover_CheckEnergyHP: ; 2df89 (b:5f89) + ld e, PLAY_AREA_ARENA + call GetPlayAreaCardAttachedEnergies + ld a, [wAttachedEnergies + PSYCHIC] + ldtx hl, NotEnoughPsychicEnergyText + cp 1 + ret c ; return if not enough energy + call GetCardDamageAndMaxHP + ldtx hl, NoDamageCountersText + cp 10 + ret ; return carry if no damage +; 0x2dfa0 + +KadabraRecover_PlayerSelectEffect: ; 2dfa0 (b:5fa0) + ld a, TYPE_ENERGY_PSYCHIC + call CreateListOfEnergyAttachedToArena + xor a ; PLAY_AREA_ARENA + bank1call DisplayEnergyDiscardScreen + bank1call HandleEnergyDiscardMenuInput + ret c + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a ; store card chosen + ret +; 0x2dfb2 + +KadabraRecover_AISelectEffect: ; 2dfb2 (b:5fb2) + ld a, TYPE_ENERGY_PSYCHIC + call CreateListOfEnergyAttachedToArena + ld a, [wDuelTempList] ; pick first card + ldh [hTemp_ffa0], a + ret +; 0x2dfbd + +KadabraRecover_DiscardEffect: ; 2dfbd (b:5fbd) + ldh a, [hTemp_ffa0] + call PutCardInDiscardPile + ret +; 0x2dfc3 + +KadabraRecover_HealEffect: ; 2dfc3 (b:5fc3) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + ld e, a ; all damage for recovery + ld d, 0 + call ApplyAndAnimateHPRecovery + ret +; 0x2dfd7 + +JynxDoubleslap_AIEffect: ; 2dfd7 (b:5fd7) + ld a, 20 / 2 + lb de, 0, 20 + jp SetExpectedAIDamage +; 0x2dfcf + +JynxDoubleslap_MultiplierEffect: ; 2dfcf (b:5fcf) + ld hl, 10 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 2 + call TossCoinATimes_BankB + call ATimes10 + call SetDefiniteDamage + ret +; 0x2dff2 + +JynxMeditate_AIEffect: ; 2dff2 (b:5ff2) + call JynxMeditate_DamageBoostEffect + jp SetMinMaxDamageSameAsDamage +; 0x2dfec + +JynxMeditate_DamageBoostEffect: ; 2dfec (b:5fec) +; add damage counters of Defending card to damage + call SwapTurn + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + call SwapTurn + call AddToDamage + ret +; 0x2e001 + +MysteryAttack_AIEffect: ; 2e001 (b:6001) + ld a, 10 + lb de, 0, 20 + jp SetExpectedAIDamage +; 0x2e009 + +MysteryAttack_RandomEffect: ; 2e009 (b:6009) + ld a, 10 + call SetDefiniteDamage + +; chooses a random effect from 8 possible options. + call UpdateRNGSources + and %111 + ldh [hTemp_ffa0], a + ld hl, .random_effect + jp JumpToFunctionInTable + +.random_effect + dw ParalysisEffect + dw PoisonEffect + dw SleepEffect + dw ConfusionEffect + dw .no_effect ; this will actually activate recovery effect afterwards + dw .no_effect + dw .more_damage + dw .no_damage + +.more_damage + ld a, 20 + call SetDefiniteDamage + ret + +.no_damage + ld a, $5b + ld [wLoadedMoveAnimation], a + xor a + call SetDefiniteDamage + call SetNoEffectFromStatus +.no_effect + ret +; 0x2e03e + +MysteryAttack_RecoverEffect: ; 2e03e (b:603e) +; in case the 5th option was chosen for random effect, +; trigger recovery effect for 10 HP. + ldh a, [hTemp_ffa0] + cp 4 + ret nz + lb de, 0, 10 + call ApplyAndAnimateHPRecovery + ret +; 0x2e04a + +StoneBarrage_AIEffect: ; 2e04a (b:604a) + ld a, 10 + lb de, 0, 100 + jp SetExpectedAIDamage +; 0x2e052 + +StoneBarrage_MultiplierEffect: ; 2e052 (b:6052) + xor a + ldh [hTemp_ffa0], a +.loop_coin_toss + ldtx de, FlipUntilFailAppears10DamageForEachHeadsText + xor a + call TossCoinATimes_BankB + jr nc, .tails + ld hl, hTemp_ffa0 + inc [hl] ; increase heads count + jr .loop_coin_toss + +.tails +; store resulting damage + ldh a, [hTemp_ffa0] + ld l, a + ld h, 10 + call HtimesL + ld de, wDamage + ld a, l + ld [de], a + inc de + ld a, h + ld [de], a + ret +; 0x2e075 + +OnixHardenEffect: ; 2e075 (b:6075) + ld a, SUBSTATUS1_HARDEN + call ApplySubstatus1ToDefendingCard + ret +; 0x2e07b + +PrimeapeFurySwipes_AIEffect: ; 2e07b (b:607b) + ld a, 60 / 2 + lb de, 0, 60 + jp SetExpectedAIDamage +; 0x2e083 + +PrimeapeFurySwipes_MultiplierEffect: ; 2e083 (b:6083) + ld hl, 20 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 3 + call TossCoinATimes_BankB + add a + call ATimes10 + call SetDefiniteDamage + ret +; 0x2e099 + +TantrumEffect: ; 2e099 (b:6099) + ldtx de, IfTailsYourPokemonBecomesConfusedText + call TossCoin_BankB + ret c ; return if heads +; confuse Pokemon + ld a, $29 + ld [wLoadedMoveAnimation], a + call SwapTurn + call ConfusionEffect + call SwapTurn + ret +; 0x2e0af + +StrikesBackEffect: ; 2e0af (b:60af) + scf + ret +; 0x2e0b1 + +KabutoArmorEffect: ; 2e0b1 (b:60b1) + scf + ret +; 0x2e0b3 + +AbsorbEffect: ; 2e0b3 (b:60b3) + ld hl, wDealtDamage + ld a, [hli] + ld h, [hl] + ld l, a + srl h + rr l + bit 0, l + jr z, .rounded + ; round up to nearest 10 + ld de, 5 + add hl, de +.rounded + ld e, l + ld d, h + call ApplyAndAnimateHPRecovery + ret +; 0x2e0cb + +SnivelEffect: ; 2e0cb (b:60cb) + ld a, SUBSTATUS2_REDUCE_BY_20 + call ApplySubstatus2ToDefendingCard + ret +; 0x2e0d1 + +CuboneRage_AIEffect: ; 2e0d1 (b:60d1) + call CuboneRage_DamageBoostEffect + jp SetMinMaxDamageSameAsDamage +; 0x2e0d7 + +CuboneRage_DamageBoostEffect: ; 2e0d7 (b:60d7) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + call AddToDamage + ret +; 0x2e0e0 + +Bonemerang_AIEffect: ; 2e0e0 (b:60e0) + ld a, 60 / 2 + lb de, 0, 60 + jp SetExpectedAIDamage +; 0x2e0e8 + +Bonemerang_MultiplierEffect: ; 2e0e8 (b:60e8) + ld hl, 30 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 2 + call TossCoinATimes_BankB + ld e, a + add a ; a = 2 * heads + add e ; a = 3 * heads + call ATimes10 + call SetDefiniteDamage + ret +; 0x2e100 + +; returns carry if can't add Pokemon from deck +MarowakCallForFamily_CheckDeckAndPlayArea: ; 2e100 (b:6100) + call CheckIfDeckIsEmpty + ret c ; no cards in deck + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, NoSpaceOnTheBenchText + cp MAX_PLAY_AREA_POKEMON + ccf + ret +; 0x2e110 + +MarowakCallForFamily_PlayerSelectEffect: ; 2e110 (b:6110) + ld a, $ff + ldh [hTemp_ffa0], a + + call CreateDeckCardList + ldtx hl, ChooseBasicFightingPokemonFromDeckText + ldtx bc, FightingPokemonDeckText + lb de, SEARCHEFFECT_BASIC_FIGHTING, $00 + call LookForCardsInDeck + ret c + +; draw Deck list interface and print text + bank1call Func_5591 + ldtx hl, ChooseBasicFightingPokemonText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText + +.loop + bank1call DisplayCardList + jr c, .pressed_b + + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp FIGHTING + jr nz, .play_sfx ; is Fighting? + ld a, [wLoadedCard2Stage] + or a + jr nz, .play_sfx ; is Basic? + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + or a + ret + +.play_sfx + ; play SFX and loop back + call Func_3794 + jr .loop + +.pressed_b +; figure if Player can exit the screen without selecting, +; that is, if the Deck has no Basic Fighting Pokemon. + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_b_press + ld a, [hl] + cp CARD_LOCATION_DECK + jr nz, .next + ld a, l + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard1Type] + cp FIGHTING + jr nz, .next ; found, go back to top loop + ld a, [wLoadedCard1Stage] + or a + jr z, .play_sfx ; found, go back to top loop +.next + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_b_press + +; no valid card in Deck, can safely exit screen + ld a, $ff + ldh [hTemp_ffa0], a + or a + ret +; 0x2e177 + +MarowakCallForFamily_AISelectEffect: ; 2e177 (b:6177) + call CreateDeckCardList + ld hl, wDuelTempList +.loop_deck + ld a, [hli] + ldh [hTemp_ffa0], a + cp $ff + ret z ; none found + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp FIGHTING + jr nz, .loop_deck + ld a, [wLoadedCard2Stage] + or a + jr nz, .loop_deck +; found + ret +; 0x2e194 + +MarowakCallForFamily_PutInPlayAreaEffect: ; 2e194 (b:6194) + ldh a, [hTemp_ffa0] + cp $ff + jr z, .shuffle + call SearchCardInDeckAndAddToHand + call AddCardToHand + call PutHandPokemonCardInPlayArea + call IsPlayerTurn + jr c, .shuffle + ; display card on screen + ldh a, [hTemp_ffa0] + ldtx hl, PlacedOnTheBenchText + bank1call DisplayCardDetailScreen +.shuffle + call Func_2c0bd + ret +; 0x2c1b4 + +KarateChop_AIEffect: ; 2e1b4 (b:61b4) + call KarateChop_DamageSubtractionEffect + jp SetMinMaxDamageSameAsDamage +; 0x2e1ba + +KarateChop_DamageSubtractionEffect: ; 2e1ba (b:61ba) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + ld e, a + ld hl, wDamage + ld a, [hl] + sub e + ld [hli], a + ld a, [hl] + sbc 0 + ld [hl], a + rla + ret nc +; cap it to 0 damage + xor a + call SetDefiniteDamage + ret +; 0x2e1d1 + +SubmissionEffect: ; 2e1d1 (b:61d1) + ld a, 20 + call DealRecoilDamageToSelf + ret +; 0x2e1d7 + +GolemSelfdestructEffect: ; 2e1d7 (b:61d7) + ld a, 100 + call DealRecoilDamageToSelf + ld a, $01 + ld [wIsDamageToSelf], a + ld a, 20 + call DealDamageToAllBenchedPokemon + call SwapTurn + xor a + ld [wIsDamageToSelf], a + ld a, 20 + call DealDamageToAllBenchedPokemon + call SwapTurn + ret +; 0x2e1f6 + +GravelerHardenEffect: ; 2e1f6 (b:61f6) + ld a, SUBSTATUS1_HARDEN + call ApplySubstatus1ToDefendingCard + ret +; 0x2e1fc + +Ram_SelectSwitchEffect: ; 2e1fc (b:61fc) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp 2 + jr c, .no_bench + call DuelistSelectForcedSwitch + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ret +.no_bench + ld a, $ff + ldh [hTemp_ffa0], a + ret +; 0x2e212 + +Ram_RecoilSwitchEffect: ; 2e212 (b:6212) + ld a, 20 + call DealRecoilDamageToSelf + ldh a, [hTemp_ffa0] + call HandleSwitchDefendingPokemonEffect + ret +; 0x2e21d + +LeerEffect: ; 2e21d (b:621d) + ldtx de, IfHeadsOpponentCannotAttackText + call TossCoin_BankB + jp nc, SetWasUnsuccessful + ld a, $74 + ld [wLoadedMoveAnimation], a + ld a, SUBSTATUS2_LEER + call ApplySubstatus2ToDefendingCard + ret +; 0x2e231 + +; return carry if opponent has no Bench Pokemon. +StretchKick_CheckBench: ; 2e231 (b:6231) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + ldtx hl, EffectNoPokemonOnTheBenchText + cp 2 + ret +; 0x2e23c + +StretchKick_PlayerSelectEffect: ; 2e23c (b:623c) + ldtx hl, ChoosePkmnInTheBenchToGiveDamageText + call DrawWideTextBox_WaitForInput + call SwapTurn + bank1call HasAlivePokemonInBench +.loop_input + bank1call OpenPlayAreaScreenForSelection + jr c, .loop_input + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + call SwapTurn + ret +; 0x2e255 + +StretchKick_AISelectEffect: ; 2e255 (b:6255) +; chooses Bench Pokemon with least amount of remaining HP + call GetBenchPokemonWithLowestHP + ldh [hTemp_ffa0], a + ret +; 0x2e25b + +StretchKick_BenchDamageEffect: ; 2e25b (b:625b) + call SwapTurn + ldh a, [hTemp_ffa0] + ld b, a + ld de, 20 + call DealDamageToPlayAreaPokemon_RegularAnim + call SwapTurn + ret +; 0x2e26b + +SandAttackEffect: ; 2e26b (b:626b) + ld a, SUBSTATUS2_SAND_ATTACK + call ApplySubstatus2ToDefendingCard + ret +; 0x2e271 + +SandslashFurySwipes_AIEffect: ; 2e271 (b:6271) + ld a, 60 / 2 + lb de, 0, 60 + jp SetExpectedAIDamage +; 0x2e279 + +SandslashFurySwipes_MultiplierEffect: ; 2e279 (b:6279) + ld hl, 20 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 3 + call TossCoinATimes_BankB + add a + call ATimes10 + call SetDefiniteDamage + ret +; 0x2e28f + +EarthquakeEffect: ; 2e28f (b:628f) + ld a, $01 + ld [wIsDamageToSelf], a + ld a, 10 + call DealDamageToAllBenchedPokemon + ret +; 0x2e29a + +PrehistoricPowerEffect: ; 2e29a (b:629a) + scf + ret +; 0x2e29c + +; returns carry if Pkmn Power can't be used. +Peek_OncePerTurnCheck: ; 2e29c (b:629c) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + and USED_PKMN_POWER_THIS_TURN + jr nz, .already_used + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret +.already_used + ldtx hl, OnlyOncePerTurnText + scf + ret +; 0x2e2b4 + +Peek_SelectEffect: ; 2e2b4 (b:62b4) +; set Pkmn Power used flag + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + set USED_PKMN_POWER_THIS_TURN_F, [hl] + + ld a, DUELVARS_DUELIST_TYPE + call GetTurnDuelistVariable + cp DUELIST_TYPE_LINK_OPP + jr z, .link_opp + and DUELIST_TYPE_AI_OPP + jr nz, .ai_opp + +; player + call Func_3b31 + call Func_30e7 + ldh [hAIPkmnPowerEffectParam], a + call SerialSend8Bytes + ret + +.link_opp + call SerialRecv8Bytes + ldh [hAIPkmnPowerEffectParam], a + +.ai_opp + ldh a, [hAIPkmnPowerEffectParam] + bit AI_PEEK_TARGET_HAND_F, a + jr z, .prize_or_deck + and (~AI_PEEK_TARGET_HAND & $ff) ; unset bit to get deck index +; if masked value is higher than $40, then it means +; that AI chose to look at Player's deck. +; all deck indices will be smaller than $40. + cp $40 + jr c, .hand + ldh a, [hAIPkmnPowerEffectParam] + jr .prize_or_deck + +.hand +; AI chose to look at random card in hand, +; so display it to the Player on screen. + call SwapTurn + ldtx hl, PeekWasUsedToLookInYourHandText + bank1call DisplayCardDetailScreen + call SwapTurn + ret + +.prize_or_deck +; AI chose either a prize card or Player's top deck card, +; so show Play Area and draw cursor appropriately. + call Func_3b31 + call SwapTurn + ldh a, [hAIPkmnPowerEffectParam] + xor $80 + call Func_30f9 + call SwapTurn + ldtx hl, CardPeekWasUsedOnText + call DrawWideTextBox_WaitForInput + ret +; 0x2e30f + +BoneAttackEffect: ; 2e30f (b:630f) + ldtx de, IfHeadsOpponentCannotAttackText + call TossCoin_BankB + ret nc + ld a, SUBSTATUS2_BONE_ATTACK + call ApplySubstatus2ToDefendingCard + ret +; 0x2e31c + +; return carry if neither Play Area +; has room for more Bench Pokemon. +Wail_BenchCheck: ; 2e31c (b:631c) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + cp MAX_PLAY_AREA_POKEMON + jr c, .no_carry + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp MAX_PLAY_AREA_POKEMON + jr c, .no_carry + ldtx hl, NoSpaceOnTheBenchText + scf + ret +.no_carry + or a + ret +; 0x2e335 + +Wail_FillBenchEffect: ; 2e335 (b:6335) + call SwapTurn + call .FillBench + call SwapTurn + call .FillBench + +; display both Play Areas + ldtx hl, BasicPokemonWasPlacedOnEachBenchText + call DrawWideTextBox_WaitForInput + bank1call HasAlivePokemonInPlayArea + bank1call OpenPlayAreaScreenForSelection + call SwapTurn + bank1call HasAlivePokemonInPlayArea + bank1call OpenPlayAreaScreenForSelection + call SwapTurn + ret + +.FillBench ; 2e35a (b:635a) + call CreateDeckCardList + ret c + ld hl, wDuelTempList + call ShuffleCards + +; if no more space in the Bench, then return. +.check_bench + push hl + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + pop hl + cp MAX_PLAY_AREA_POKEMON + jr nc, .done + +; there's still space, so look for the next +; Basic Pokemon card to put in the Bench. +.loop + ld a, [hli] + ldh [hTempCardIndex_ff98], a + cp $ff + jr z, .done + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + jr nc, .loop ; is Pokemon card? + ld a, [wLoadedCard2Stage] + or a + jr nz, .loop ; is Basic? +; place card in Bench + push hl + ldh a, [hTempCardIndex_ff98] + call SearchCardInDeckAndAddToHand + call AddCardToHand + call PutHandPokemonCardInPlayArea + pop hl + jr .check_bench + +.done + call Func_2c0bd + ret +; 0x2e399 + +Thunderpunch_AIEffect: ; 2e399 (b:6399) + ld a, (30 + 40) / 2 + lb de, 30, 40 + jp SetExpectedAIDamage +; 0x2e3a1 + +Thunderpunch_ModifierEffect: ; 2e3a1 (b:63a1) + ldtx de, IfHeadPlus10IfTails10ToYourselfText + call TossCoin_BankB + ldh [hTemp_ffa0], a + ret nc ; return if got tails + ld a, 10 + call AddToDamage + ret +; 0x2e3b0 + +Thunderpunch_RecoilEffect: ; 2e3b0 (b:63b0) + ldh a, [hTemp_ffa0] + or a + ret nz ; return if got heads + ld a, 10 + call DealRecoilDamageToSelf + ret +; 0x2e3ba + +LightScreenEffect: ; 2e3ba (b:63ba) + ld a, SUBSTATUS1_HALVE_DAMAGE + call ApplySubstatus1ToDefendingCard + ret +; 0x2e3c0 + +ElectabuzzQuickAttack_AIEffect: ; 2e3c0 (b:63c0) + ld a, (10 + 30) / 2 + lb de, 10, 30 + jp SetExpectedAIDamage +; 0x2e3c8 + +ElectabuzzQuickAttack_DamageBoostEffect: ; 2e3c8 (b:63c8) + ld hl, 20 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsPlusDamageText + call TossCoin_BankB + ret nc ; return if tails + ld a, 20 + call AddToDamage + ret +; 0x2e3db + +MagnemiteSelfdestructEffect: ; 2e3db (b:63db) + ld a, 40 + call DealRecoilDamageToSelf + + ld a, $01 + ld [wIsDamageToSelf], a + ld a, 10 + call DealDamageToAllBenchedPokemon + call SwapTurn + + xor a + ld [wIsDamageToSelf], a + ld a, 10 + call DealDamageToAllBenchedPokemon + call SwapTurn + ret +; 0x2e3fa + +ZapdosThunder_Recoil50PercentEffect: ; 2e3fa (b:63fa) + ld hl, 30 + call LoadTxRam3 + ldtx de, IfTailsDamageToYourselfTooText + call TossCoin_BankB + ldh [hTemp_ffa0], a + ret +; 0x2e409 + +ZapdosThunder_RecoilEffect: ; 2e409 (b:6409) + ld hl, 30 + call LoadTxRam3 + ldh a, [hTemp_ffa0] + or a + ret nz ; return if got heads + ld a, 30 + call DealRecoilDamageToSelf + ret +; 0x2e419 + +ThunderboltEffect: ; 2e419 (b:6419) + xor a + call CreateArenaOrBenchEnergyCardList + ld hl, wDuelTempList +; put all energy cards in Discard Pile +.loop + ld a, [hli] + cp $ff + ret z + call PutCardInDiscardPile + jr .loop +; 0x2e429 + +ThunderstormEffect: ; 2e429 (b:6429) + ld a, 1 + ldh [hCurSelectionItem], a + + call SwapTurn + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld c, a + ld b, 0 + ld e, b + jr .next_pkmn + +.check_damage + push de + push bc + call .DisplayText + ld de, $0 + call SwapTurn + call TossCoin_BankB + call SwapTurn + push af + call GetNextPositionInTempList + pop af + ld [hl], a ; store result in list + pop bc + pop de + jr c, .next_pkmn + inc b ; increase number of tails + +.next_pkmn + inc e + dec c + jr nz, .check_damage + +; all coins were tossed for each Benched Pokemon + call GetNextPositionInTempList + ld [hl], $ff + ld a, b + ldh [hTemp_ffa0], a + call Func_3b21 + call SwapTurn + +; tally recoil damage + ldh a, [hTemp_ffa0] + or a + jr z, .skip_recoil + ; deal number of tails times 10 to self + call ATimes10 + call DealRecoilDamageToSelf +.skip_recoil + +; deal damage for Bench Pokemon that got heads + call SwapTurn + ld hl, hTempPlayAreaLocation_ffa1 + ld b, PLAY_AREA_BENCH_1 +.loop_bench + ld a, [hli] + cp $ff + jr z, .done + or a + jr z, .skip_damage ; skip if tails + ld de, 20 + call DealDamageToPlayAreaPokemon_RegularAnim +.skip_damage + inc b + jr .loop_bench + +.done + call SwapTurn + ret +; 0x2e491 + +; displays text for current Bench Pokemon, +; printing its Bench number and name. +.DisplayText ; 2e491 (b:6491) + ld b, e + ldtx hl, BenchText + ld de, wDefaultText + call CopyText + ld a, $30 ; 0 FW character + add b + ld [de], a + inc de + ld a, $20 ; space FW character + ld [de], a + inc de + + ld a, DUELVARS_ARENA_CARD + add b + call GetTurnDuelistVariable + call LoadCardDataToBuffer2_FromDeckIndex + ld hl, wLoadedCard2Name + ld a, [hli] + ld h, [hl] + ld l, a + call CopyText + + xor a + ld [wDuelDisplayedScreen], a + ret +; 0x2e4bb + +JolteonQuickAttack_AIEffect: ; 2e4bb (b:64bb) + ld a, (10 + 30) / 2 + lb de, 10, 30 + jp SetExpectedAIDamage +; 0x2e4c3 + +JolteonQuickAttack_DamageBoostEffect: ; 2e4c3 (b:64c3) + ld hl, 20 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsPlusDamageText + call TossCoin_BankB + ret nc ; return if tails + ld a, 20 + call AddToDamage + ret +; 0x2e3d6 + +PinMissile_AIEffect: ; 2e4d6 (b:64d6) + ld a, (20 * 4) / 2 + lb de, 0, 80 + jp SetExpectedAIDamage +; 0x2e4de + +PinMissile_MultiplierEffect: ; 2e4de (b:64de) + ld hl, 20 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 4 + call TossCoinATimes_BankB + add a ; a = 2 * heads + call ATimes10 + call SetDefiniteDamage + ret +; 0x2e4f4 + +Fly_AIEffect: ; 2e4f4 (b:64f4) + ld a, 30 / 2 + lb de, 0, 30 + jp SetExpectedAIDamage +; 0x2e4fc + +Fly_Success50PercentEffect: ; 2e4fc (b:64fc) + ldtx de, SuccessCheckIfHeadsAttackIsSuccessfulText + call TossCoin_BankB + jr c, .heads + xor a + ld [wLoadedMoveAnimation], a + call SetDefiniteDamage + call SetWasUnsuccessful + ret +.heads + ld a, $52 + ld [wLoadedMoveAnimation], a + ld a, SUBSTATUS1_FLY + call ApplySubstatus1ToDefendingCard + ret +; 0x2e51a + +ThunderJolt_Recoil50PercentEffect: ; 2e51a (b:651a) + ld hl, 10 + call LoadTxRam3 + ldtx de, IfTailsDamageToYourselfTooText + call TossCoin_BankB + ldh [hTemp_ffa0], a + ret +; 0x2e529 + +ThunderJolt_RecoilEffect: ; 2e529 (b:6529) + ld hl, 10 + call LoadTxRam3 + ldh a, [hTemp_ffa0] + or a + ret nz ; return if was heads + ld a, 10 + call DealRecoilDamageToSelf + ret +; 0x2e539 + +Spark_PlayerSelectEffect: ; 2e539 (b:6539) + ld a, $ff + ldh [hTemp_ffa0], a + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp 2 + ret c ; has no Bench Pokemon + + ldtx hl, ChoosePkmnInTheBenchToGiveDamageText + call DrawWideTextBox_WaitForInput + call SwapTurn + bank1call HasAlivePokemonInBench + + ; the following two instructions can be removed + ; since Player selection will overwrite it. + ld a, PLAY_AREA_BENCH_1 + ldh [hTempPlayAreaLocation_ff9d], a + +.loop_input + bank1call OpenPlayAreaScreenForSelection + jr c, .loop_input + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + call SwapTurn + ret +; 0x2e562 + +Spark_AISelectEffect: ; 2e562 (b:6562) + ld a, $ff + ldh [hTemp_ffa0], a + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp 2 + ret c ; has no Bench Pokemon +; AI always picks Pokemon with lowest HP remaining + call GetBenchPokemonWithLowestHP + ldh [hTemp_ffa0], a + ret +; 0x2e574 + +Spark_BenchDamageEffect: ; 2e574 (b:6574) + ldh a, [hTemp_ffa0] + cp $ff + ret z + call SwapTurn + ldh a, [hTemp_ffa0] + ld b, a + ld de, 10 + call DealDamageToPlayAreaPokemon_RegularAnim + call SwapTurn + ret +; 0x2e589 + +Pikachu3GrowlEffect: ; 2e589 (b:6589) + ld a, SUBSTATUS2_GROWL + call ApplySubstatus2ToDefendingCard + ret +; 0x2e58f + +Pikachu4GrowlEffect: ; 2e58f (b:658f) + ld a, SUBSTATUS2_GROWL + call ApplySubstatus2ToDefendingCard + ret +; 0x2e595 + +ChainLightningEffect: ; 2e595 (b:6595) + ld a, 10 + call SetDefiniteDamage + call SwapTurn + call GetArenaCardColor + call SwapTurn + ldh [hCurSelectionItem], a + cp COLORLESS + ret z ; don't damage if colorless + +; opponent's Bench + call SwapTurn + call .DamageSameColorBench + call SwapTurn + +; own Bench + ld a, $01 + ld [wIsDamageToSelf], a + call .DamageSameColorBench + ret +; 0x2e5ba + +.DamageSameColorBench ; 2e5ba (b:65ba) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld e, a + ld d, PLAY_AREA_ARENA + jr .next_bench + +.check_damage + ld a, d + call GetPlayAreaCardColor + ld c, a + ldh a, [hCurSelectionItem] + cp c + jr nz, .next_bench ; skip if not same color +; apply damage to this Bench card + push de + ld b, d + ld de, 10 + call DealDamageToPlayAreaPokemon_RegularAnim + pop de + +.next_bench + inc d + dec e + jr nz, .check_damage + ret +; 0x2e5dc + +RaichuAgilityEffect: ; 2e5dc (b:65dc) + ldtx de, IfHeadsDoNotReceiveDamageOrEffectText + call TossCoin_BankB + ret nc ; skip if got tails + ld a, $52 + ld [wLoadedMoveAnimation], a + ld a, SUBSTATUS1_AGILITY + call ApplySubstatus1ToDefendingCard + ret +; 0x2e5ee + +RaichuThunder_Recoil50PercentEffect: ; 2e5ee (b:65ee) + ld hl, 30 + call LoadTxRam3 + ldtx de, IfTailsDamageToYourselfTooText + call TossCoin_BankB + ldh [hTemp_ffa0], a + ret +; 0x2e5fd + +RaichuThunder_RecoilEffect: ; 2e5fd (b:65fd) + ld hl, 30 + call LoadTxRam3 + ldh a, [hTemp_ffa0] + or a + ret nz ; return if got heads + ld a, 30 + call DealRecoilDamageToSelf + ret +; 0x2e60d + +Gigashock_PlayerSelectEffect: ; 2e60d (b:660d) + call SwapTurn + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + cp 2 + jr nc, .has_bench + call SwapTurn + ld a, $ff + ldh [hTempList], a + ret + +.has_bench + ldtx hl, ChooseUpTo3PkmnOnBenchToGiveDamageText + call DrawWideTextBox_WaitForInput + +; init number of items in list and cursor position + xor a + ldh [hCurSelectionItem], a + ld [wce72], a + bank1call Func_61a1 +.start + bank1call PrintPlayAreaCardList_EnableLCD + push af + ld a, [wce72] + ld hl, BenchSelectionMenuParameters + call InitializeMenuParameters + pop af + +; exclude Arena Pokemon from number of items + dec a + ld [wNumMenuItems], a + +.loop_input + call DoFrame + call HandleMenuInput + jr nc, .loop_input + cp -1 + jr z, .try_cancel + + ld [wce72], a + call .CheckIfChosenAlready + jr nc, .not_chosen + ; play SFX + call Func_3794 + jr .loop_input + +.not_chosen +; mark this Play Area location + ldh a, [hCurMenuItem] + inc a + ld b, SYM_LIGHTNING + call DrawSymbolOnPlayAreaCursor +; store it in the list of chosen Bench Pokemon + call GetNextPositionInTempList + ldh a, [hCurMenuItem] + inc a + ld [hl], a + +; check if 3 were chosen already + ldh a, [hCurSelectionItem] + ld c, a + cp 3 + jr nc, .chosen ; check if already chose 3 + + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + dec a + cp c + jr nz, .start ; if sill more options available, loop back + ; fallthrough if no other options available to choose + +.chosen + ldh a, [hCurMenuItem] + inc a + call Func_2c10b + ldh a, [hKeysPressed] + and B_BUTTON + jr nz, .try_cancel + call SwapTurn + call GetNextPositionInTempList + ld [hl], $ff ; terminating byte + ret + +.try_cancel + ldh a, [hCurSelectionItem] + or a + jr z, .start ; none selected, can safely loop back to start + +; undo last selection made + dec a + ldh [hCurSelectionItem], a + ld e, a + ld d, $00 + ld hl, hTempList + add hl, de + ld a, [hl] + + push af + ld b, SYM_SPACE + call DrawSymbolOnPlayAreaCursor + call EraseCursor + pop af + + dec a + ld [wce72], a + jr .start +; 0x2e6af + +; returns carry if Bench Pokemon +; in register a was already chosen. +.CheckIfChosenAlready: ; 2e6af (b:66af) + inc a + ld c, a + ldh a, [hCurSelectionItem] + ld b, a + ld hl, hTempList + inc b + jr .next_check +.check_chosen + ld a, [hli] + cp c + scf + ret z ; return if chosen already +.next_check + dec b + jr nz, .check_chosen + or a + ret +; 0x2e6c3 + +Gigashock_AISelectEffect: ; 2e6c3 (b:66c3) +; if Bench has 3 Pokemon or less, no need for selection, +; since AI will choose them all. + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp MAX_PLAY_AREA_POKEMON - 1 + jr nc, .start_selection + +; select them all + ld hl, hTempList + ld b, PLAY_AREA_ARENA + jr .next_bench +.select_bench + ld [hl], b + inc hl +.next_bench + inc b + dec a + jr nz, .select_bench + ld [hl], $ff ; terminating byte + ret + +.start_selection +; has more than 3 Bench cards,proceed to sort them +; by lowest remaining HP to highest, and pick first 3. + call SwapTurn + dec a + ld c, a + ld b, PLAY_AREA_BENCH_1 + +; first select all of the Bench Pokemon and write to list + ld hl, hTempList +.loop_all + ld [hl], b + inc hl + inc b + dec c + jr nz, .loop_all + ld [hl], $00 ; end list with $00 + +; then check each of the Bench Pokemon HP +; sort them from lowest remaining HP to highest. + ld de, hTempList +.loop_outer + ld a, [de] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + ld c, a + ld l, e + ld h, d + inc hl + +.loop_inner + ld a, [hli] + or a + jr z, .next ; reaching $00 means it's end of list + + push hl + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + pop hl + cp c + jr c, .loop_inner + ; a Bench Pokemon was found with less HP + ld c, a ; store its HP + +; switch the two + dec hl + ld b, [hl] + ld a, [de] + ld [hli], a + ld a, b + ld [de], a + jr .loop_inner + +.next + inc de + ld a, [de] + or a + jr nz, .loop_outer + +; done + ld a, $ff ; terminating byte + ldh [hTempList + 3], a + call SwapTurn + ret +; 0x2e71f + +Gigashock_BenchDamageEffect: ; 2e71f (b:671f) + call SwapTurn + ld hl, hTempList +.loop_selection + ld a, [hli] + cp $ff + jr z, .done + push hl + ld b, a + ld de, 10 + call DealDamageToPlayAreaPokemon_RegularAnim + pop hl + jr .loop_selection +.done + call SwapTurn + ret +; 0x2e739 + +Magneton1SelfdestructEffect: ; 2e739 (b:6739) + ld a, 80 + call DealRecoilDamageToSelf + +; own bench + ld a, $01 + ld [wIsDamageToSelf], a + ld a, 20 + call DealDamageToAllBenchedPokemon + +; opponent's bench + call SwapTurn + xor a + ld [wIsDamageToSelf], a + ld a, 20 + call DealDamageToAllBenchedPokemon + call SwapTurn + ret +; 0x2e758 + +MagnetonSonicboom_UnaffectedByColorEffect: ; 2e758 (b:6758) + ld hl, wDamage + 1 + set UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, [hl] + ret +; 0x2e75e + +MagnetonSonicboom_NullEffect: ; 2e75e (b:675e) + ret +; 0x2e75f + +Magneton2SelfdestructEffect: ; 2e75f (b:675f) + ld a, 100 + call DealRecoilDamageToSelf + +; own bench + ld a, $01 + ld [wIsDamageToSelf], a + ld a, 20 + call DealDamageToAllBenchedPokemon + +; opponent's bench + call SwapTurn + xor a + ld [wIsDamageToSelf], a + ld a, 20 + call DealDamageToAllBenchedPokemon + call SwapTurn + ret +; 0x2e77e + +PealOfThunder_InitialEffect: ; 2e77e (b:677e) + scf + ret +; 0x2e780 + +PealOfThunder_RandomlyDamageEffect: ; 2e780 (b:6780) + call ExchangeRNG + ld de, 30 ; damage to inflict + call RandomlyDamagePlayAreaPokemon + bank1call Func_6e49 + ret +; 0x2e78d + +; randomly damages a Pokemon in play, except +; card that is in [hTempPlayAreaLocation_ff9d]. +; plays thunder animation when Play Area is shown. +; input: +; de = amount of damage to deal +RandomlyDamagePlayAreaPokemon: ; 2e78d (b:678d) + xor a + ld [wNoDamageOrEffect], a + +; choose randomly which Play Area to attack + call UpdateRNGSources + and 1 + jr nz, .opp_play_area + +; own Play Area + ld a, $01 + ld [wIsDamageToSelf], a + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + call Random + ld b, a + ; can't select Zapdos + ldh a, [hTempPlayAreaLocation_ff9d] + cp b + jr z, RandomlyDamagePlayAreaPokemon ; re-roll Pokemon to attack + +.damage + ld a, $82 + ld [wLoadedMoveAnimation], a + call DealDamageToPlayAreaPokemon + ret + +.opp_play_area + xor a + ld [wIsDamageToSelf], a + call SwapTurn + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + call Random + ld b, a + call .damage + call SwapTurn + ret +; 0x2e7cb + +BigThunderEffect: ; 2e7cb (b:67cb) + call ExchangeRNG + ld de, 70 ; damage to inflict + call RandomlyDamagePlayAreaPokemon + ret +; 0x2e7d5 + +MagneticStormEffect: ; 2e7d5 (b:67d5) + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable + +; writes in wDuelTempList all deck indices +; of Energy cards attached to Pokemon +; in the Turn Duelist's Play Area. + ld de, wDuelTempList + ld c, 0 +.loop_card_locations + ld a, [hl] + and CARD_LOCATION_PLAY_AREA + jr z, .next_card_location + +; is a card that is in the Play Area + push hl + push de + push bc + ld a, l + call GetCardIDFromDeckIndex + call GetCardType + pop bc + pop de + pop hl + and TYPE_ENERGY + jr z, .next_card_location +; is an Energy card attached to Pokemon in Play Area + ld a, l + ld [de], a + inc de + inc c +.next_card_location + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_card_locations + ld a, $ff ; terminating byte + ld [de], a + +; divide number of energy cards +; by number of Pokemon in Play Area + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld b, a + ld a, c + ld c, -1 +.loop_division + inc c + sub b + jr nc, .loop_division + ; c = floor(a / b) + +; evenly divides the Energy cards randomly +; to every Pokemon in the Play Area. + push bc + ld hl, wDuelTempList + call CountCardsInDuelTempList + call ShuffleCards + ld d, c + ld e, PLAY_AREA_ARENA +.start_attach + ld c, d + inc c + jr .check_done +.attach_energy + ld a, [hli] + push hl + push de + push bc + call AddCardToHand + call PutHandCardInPlayArea + pop bc + pop de + pop hl +.check_done + dec c + jr nz, .attach_energy +; go to next Pokemon in Play Area + inc e ; next in Play Area + dec b + jr nz, .start_attach + pop bc + + push hl + ld hl, hTempList + +; fill hTempList with PLAY_AREA_* locations +; that have Pokemon in them. + push hl + xor a +.loop_init + ld [hli], a + inc a + cp b + jr nz, .loop_init + pop hl + +; shuffle them and distribute +; the remaining cards in random order. + ld a, b + call ShuffleCards + pop hl + ld de, hTempList +.next_random_pokemon + ld a, [hl] + cp $ff + jr z, .done + push hl + push de + ld a, [de] + ld e, a + ld a, [hl] + call AddCardToHand + call PutHandCardInPlayArea + pop de + pop hl + inc hl + inc de + jr .next_random_pokemon + +.done + bank1call DrawDuelMainScene + bank1call DrawDuelHUDs + ldtx hl, TheEnergyCardFromPlayAreaWasMovedText + call DrawWideTextBox_WaitForInput + xor a + call Func_2c10b + ret +; 0x2e870 + +ElectrodeSonicboom_UnaffectedByColorEffect: ; 2e870 (b:6870) + ld hl, wDamage + 1 + set UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, [hl] + ret +; 0x2e876 + +ElectrodeSonicboom_NullEffect: ; 2e876 (b:6876) + ret +; 0x2e877 + +; return carry if no cards in Deck +EnergySpike_DeckCheck: ; 2e877 (b:6877) + call CheckIfDeckIsEmpty + ret +; 0x2e87b + +EnergySpike_PlayerSelectEffect: ; 2e87b (b:687b) + ld a, $ff + ldh [hTemp_ffa0], a + +; search cards in Deck + call CreateDeckCardList + ldtx hl, Choose1BasicEnergyCardFromDeckText + ldtx bc, BasicEnergyText + lb de, SEARCHEFFECT_BASIC_ENERGY, 0 + call LookForCardsInDeck + ret c + + bank1call Func_5591 + ldtx hl, ChooseBasicEnergyCardText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText +.select_card + bank1call DisplayCardList + jr c, .try_cancel + call GetCardIDFromDeckIndex + call GetCardType + cp TYPE_ENERGY_DOUBLE_COLORLESS + jr nc, .select_card ; not a Basic Energy card + and TYPE_ENERGY + jr z, .select_card ; not a Basic Energy card + ; Energy card selected + + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + call EmptyScreen + ldtx hl, ChoosePokemonToAttachEnergyCardText + call DrawWideTextBox_WaitForInput + +; choose a Pokemon in Play Area to attach card + bank1call HasAlivePokemonInPlayArea +.loop_input + bank1call OpenPlayAreaScreenForSelection + jr c, .loop_input + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTempPlayAreaLocation_ffa1], a + ret + +.play_sfx + call Func_3794 + jr .select_card + +.try_cancel +; Player tried exiting screen, if there are +; any Basic Energy cards, Player is forced to select them. +; otherwise, they can safely exit. + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_deck + ld a, [hl] + cp CARD_LOCATION_DECK + jr nz, .next_card + ld a, l + call GetCardIDFromDeckIndex + call GetCardType + and TYPE_ENERGY + jr z, .next_card + cp TYPE_ENERGY_DOUBLE_COLORLESS + jr c, .play_sfx +.next_card + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_deck + ; can exit + + ld a, $ff + ldh [hTemp_ffa0], a + ret +; 0x2e8f1 + +EnergySpike_AISelectEffect: ; 2e8f1 (b:68f1) +; AI doesn't select any card + ld a, $ff + ldh [hTemp_ffa0], a + ret +; 0x2e8f6 + +EnergySpike_AttachEnergyEffect: ; 2e8f6 (b:68f6) + ldh a, [hTemp_ffa0] + cp $ff + jr z, .done + +; add card to hand and attach it to the selected Pokemon + call SearchCardInDeckAndAddToHand + call AddCardToHand + ldh a, [hTempPlayAreaLocation_ffa1] + ld e, a + ldh a, [hTemp_ffa0] + call PutHandCardInPlayArea + call IsPlayerTurn + jr c, .done + +; not Player, so show detail screen +; and which Pokemon was chosen to attach Energy. + ldh a, [hTempPlayAreaLocation_ffa1] + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + ld hl, wLoadedCard1Name + ld de, wTxRam2_b + ld a, [hli] + ld [de], a + inc de + ld a, [hli] + ld [de], a + ldh a, [hTemp_ffa0] + ldtx hl, AttachedEnergyToPokemonText + bank1call DisplayCardDetailScreen + +.done + call Func_2c0bd + ret +; 0x2e930 + +JolteonDoubleKick_AIEffect: ; 2e930 (b:6930) + ld a, 40 / 2 + lb de, 0, 40 + jp SetExpectedAIDamage +; 0x2e938 + +JolteonDoubleKick_MultiplierEffect: ; 2e938 (b:6938) + ld hl, 20 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 2 + call TossCoinATimes_BankB + add a ; a = 2 * heads + call ATimes10 + call SetDefiniteDamage + ret +; 0x2e94e + +TailWagEffect: ; 2e94e (b:694e) + ldtx de, IfHeadsOpponentCannotAttackText + call TossCoin_BankB + jp nc, SetWasUnsuccessful + ld a, $46 + ld [wLoadedMoveAnimation], a + ld a, SUBSTATUS2_TAIL_WAG + call ApplySubstatus2ToDefendingCard + ret +; 0x2e962 + +EeveeQuickAttack_AIEffect: ; 2e962 (b:5962) + ld a, (10 + 30) / 2 + lb de, 10, 30 + jp SetExpectedAIDamage +; 0x2e96a + +EeveeQuickAttack_DamageBoostEffect: ; 2e96a (b:596a) + ld hl, 20 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsPlusDamageText + call TossCoin_BankB + ret nc ; return if tails + ld a, 20 + call AddToDamage + ret +; 0x2e97d + +SpearowMirrorMove_AIEffect: ; 2e97d (b:697d) + jr MirrorMoveEffects.AIEffect +; 0x2e97f + +SpearowMirrorMove_InitialEffect1: ; 2e97f (b:697f) + jr MirrorMoveEffects.InitialEffect1 +; 0x2e981 + +SpearowMirrorMove_InitialEffect2: ; 2e981 (b:6981) + jr MirrorMoveEffects.InitialEffect2 +; 0x2e983 + +SpearowMirrorMove_PlayerSelection: ; 2e983 (b:6983) + jr MirrorMoveEffects.PlayerSelection +; 0x2e985 + +SpearowMirrorMove_AISelection: ; 2e985 (b:6985) + jr MirrorMoveEffects.AISelection +; 0x2e987 + +SpearowMirrorMove_BeforeDamage: ; 2e987 (b:6987) + jr MirrorMoveEffects.BeforeDamage +; 0x2e989 + +SpearowMirrorMove_AfterDamage: ; 2e989 (b:6989) + jp MirrorMoveEffects.AfterDamage +; 0x2e98c + +; these are effect commands that Mirror Move uses +; in order to mimic last turn's attack. +; it covers all possible effect steps to perform its commands +; (i.e. selection for Amnesia and Energy discarding attacks, etc) +MirrorMoveEffects: ; 2e98c (b:698c) +.AIEffect + ld a, DUELVARS_ARENA_CARD_LAST_TURN_DAMAGE + call GetTurnDuelistVariable + ld a, [hl] + ld [wAIMinDamage], a + ld [wAIMaxDamage], a + ret + +.InitialEffect1 + ld a, DUELVARS_ARENA_CARD_LAST_TURN_DAMAGE + call GetTurnDuelistVariable + ld a, [hli] + or [hl] + inc hl + or [hl] + inc hl + ret nz ; return if has last turn damage + ld a, [hli] + or a + ret nz ; return if has last turn status + ; no attack received last turn + ldtx hl, YouDidNotReceiveAnAttackToMirrorMoveText + scf + ret + +.InitialEffect2 + ld a, $ff + ldh [hTemp_ffa0], a + ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT + call GetTurnDuelistVariable + or a + ret z ; no effect + cp LAST_TURN_EFFECT_AMNESIA + jp z, PlayerPickAttackForAmnesia + or a + ret + +.PlayerSelection + ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT + call GetTurnDuelistVariable + or a + ret z ; no effect +; handle Energy card discard effect + cp LAST_TURN_EFFECT_DISCARD_ENERGY + jp z, HandleEnergyDiscardEffectSelection + ret + +.AISelection + ld a, $ff + ldh [hTemp_ffa0], a + ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT + call GetTurnDuelistVariable + or a + ret z ; no effect + cp LAST_TURN_EFFECT_DISCARD_ENERGY + jr z, .dicard_energy + cp LAST_TURN_EFFECT_AMNESIA + jr z, .pick_amnesia_attack + ret + +.dicard_energy + call AIPickEnergyCardToDiscardFromDefendingPokemon + ldh [hTemp_ffa0], a + ret + +.pick_amnesia_attack + call AIPickAttackForAmnesia + ldh [hTemp_ffa0], a + ret + +.BeforeDamage +; if was attacked with Amnesia, apply it to the selected attack + ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT + call GetTurnDuelistVariable + cp LAST_TURN_EFFECT_AMNESIA + jr z, .apply_amnesia + +; otherwise, check if there was last turn damage, +; and write it to wDamage. + ld a, DUELVARS_ARENA_CARD_LAST_TURN_DAMAGE + call GetTurnDuelistVariable + ld de, wDamage + ld a, [hli] + ld [de], a + inc de + ld a, [hld] + ld [de], a + or [hl] + jr z, .no_damage + ld a, $01 + ld [wLoadedMoveAnimation], a +.no_damage + inc hl + inc hl ; DUELVARS_ARENA_CARD_LAST_TURN_STATUS +; check if there was a status applied to Defending Pokemon +; from the attack it used. + push hl + ld a, DUELVARS_ARENA_CARD_STATUS + call GetNonTurnDuelistVariable + ld e, l + ld d, h + pop hl + ld a, [hli] + or a + jr z, .no_status + push hl + push de + call .ExecuteStatusEffect + pop de + pop hl +.no_status +; hl is at DUELVARS_ARENA_CARD_LAST_TURN_SUBSTATUS2 +; apply substatus2 to self + ld e, DUELVARS_ARENA_CARD_SUBSTATUS2 + ld a, [hli] + ld [de], a + ret + +.apply_amnesia + call ApplyAmnesiaToAttack + ret +; 0x2ea28 + +.AfterDamage: ; 2ea28 (b:6a28) + ld a, [wNoDamageOrEffect] + or a + ret nz ; is unaffected + ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT + call GetTurnDuelistVariable + cp LAST_TURN_EFFECT_DISCARD_ENERGY + jr nz, .change_weakness + +; execute Energy discard effect for card chosen + call SwapTurn + ldh a, [hTemp_ffa0] + call PutCardInDiscardPile + ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT + call GetTurnDuelistVariable + ld [hl], LAST_TURN_EFFECT_DISCARD_ENERGY + call SwapTurn + +.change_weakness + ld a, DUELVARS_ARENA_CARD_LAST_TURN_CHANGE_WEAK + call GetTurnDuelistVariable + ld a, [hl] + or a + ret z ; weakness wasn't changed last turn + + push hl + call SwapTurn + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer2_FromDeckIndex + call SwapTurn + pop hl + + ld a, [wLoadedCard2Weakness] + or a + ret z ; defending Pokemon has no weakness to change + +; apply same color weakness to Defending Pokemon + ld a, [hl] + push af + ld a, DUELVARS_ARENA_CARD_CHANGED_WEAKNESS + call GetNonTurnDuelistVariable + pop af + ld [hl], a + +; print message of weakness color change + ld c, -1 +.loop_color + inc c + rla + jr nc, .loop_color + ld a, c + call SwapTurn + push af + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + pop af + call LoadCardNameAndInputColor + ldtx hl, ChangedTheWeaknessOfPokemonToColorText + call DrawWideTextBox_PrintText + call SwapTurn + ret +; 0x2ea8f + +.ExecuteStatusEffect: ; 2ea8f (b:6a8f) + ld c, a + and PSN_DBLPSN + jr z, .cnf_slp_prz + ld b, a + cp DOUBLE_POISONED + push bc + call z, DoublePoisonEffect + pop bc + ld a, b + cp POISONED + push bc + call z, PoisonEffect + pop bc +.cnf_slp_prz + ld a, c + and CNF_SLP_PRZ + ret z + cp CONFUSED + jp z, ConfusionEffect + cp ASLEEP + jp z, SleepEffect + cp PARALYZED + jp z, ParalysisEffect + ret +; 0x2eab8 + +FearowAgilityEffect: ; 2eab8 (b:6ab8) + ldtx de, IfHeadsDoNotReceiveDamageOrEffectText + call TossCoin_BankB + ret nc + ld a, $52 + ld [wLoadedMoveAnimation], a + ld a, SUBSTATUS1_AGILITY + call ApplySubstatus1ToDefendingCard + ret +; 0x2eaca + +; return carry if cannot use Step In +StepIn_BenchCheck: ; 2eaca (b:6aca) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ldtx hl, CanOnlyBeUsedOnTheBenchText + or a + jr z, .set_carry + + add DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + ldtx hl, OnlyOncePerTurnText + and USED_PKMN_POWER_THIS_TURN + jr nz, .set_carry + + ldh a, [hTempPlayAreaLocation_ff9d] + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + ret + +.set_carry + scf + ret +; 0x2eae8 + +StepIn_SwitchEffect: ; 2eae8 (b:6ae8) + ldh a, [hTemp_ffa0] + ld e, a + call SwapArenaWithBenchPokemon + ld a, DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + set USED_PKMN_POWER_THIS_TURN_F, [hl] + ret +; 0x2eaf6 + +Dragonite2Slam_AIEffect: ; 2eaf6 (b:6af6) + ld a, (40 * 2) / 2 + lb de, 0, 80 + jp SetExpectedAIDamage +; 0x2eafe + +Dragonite2Slam_MultiplierEffect: ; 2eafe (b:6afe) + ld hl, 40 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 2 + call TossCoinATimes_BankB + add a + add a + call ATimes10 + call SetDefiniteDamage + ret +; 0x2eb15 + +ThickSkinnedEffect: ; 2eb15 (b:6b15) + scf + ret +; 0x2eb17 + +LeekSlap_AIEffect: ; 2eb17 (b:6b17) + ld a, 30 / 2 + lb de, 0, 30 + jp SetExpectedAIDamage +; 0x2eb1f + +; return carry if already used attack in this duel +LeekSlap_OncePerDuelCheck: ; 2eb1f (b:6b1f) +; can only use attack if it was never used before this duel + ld a, DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + and USED_LEEK_SLAP_THIS_DUEL + ret z + ldtx hl, ThisAttackCannotBeUsedTwiceText + scf + ret +; 0x2eb2c + +LeekSlap_SetUsedThisDuelFlag: ; 2eb2c (b:6b2c) + ld a, DUELVARS_ARENA_CARD_FLAGS + call GetTurnDuelistVariable + set USED_LEEK_SLAP_THIS_DUEL_F, [hl] + ret +; 0x2eb34 + +LeekSlap_NoDamage50PercentEffect: ; 2eb34 (b:6b34) + ldtx de, DamageCheckIfTailsNoDamageText + call TossCoin_BankB + ret c + xor a ; 0 damage + call SetDefiniteDamage + ret +; 0x2eb40 + +FetchEffect: ; 2eb40 (b:6b40) + ldtx hl, Draw1CardFromTheDeckText + call DrawWideTextBox_WaitForInput + bank1call DisplayDrawOneCardScreen + call DrawCardFromDeck + ret c ; return if deck is empty + call AddCardToHand + call LoadCardDataToBuffer1_FromDeckIndex + ld a, [wDuelistType] + cp DUELIST_TYPE_PLAYER + ret nz + ; show card on screen if it was Player + bank1call OpenCardPage_FromHand + ret +; 0x2eb5d + +CometPunch_AIEffect: ; 2eb5d (b:6b5d) + ld a, (20 * 4) / 2 + lb de, 0, 80 + jp SetExpectedAIDamage +; 0x2eb65 + +CometPunch_MultiplerEffect: ; 2eb65 (b:6b65) + ld hl, 20 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 4 + call TossCoinATimes_BankB + add a + call ATimes10 + call SetDefiniteDamage + ret +; 0x2eb7b + +TaurosStomp_AIEffect: ; 2eb7b (b:6b7b) + ld a, (20 + 30) / 2 + lb de, 20, 30 + jp SetExpectedAIDamage +; 0x2eb83 + +TaurosStomp_DamageBoostEffect: ; 2eb83 (b:6b83) + ld hl, 10 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsPlusDamageText + call TossCoin_BankB + ret nc ; tails + ld a, 10 + call AddToDamage + ret +; 0x2eb96 + +Rampage_AIEffect: ; 2eb96 (b:6b96) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + call AddToDamage + jp SetMinMaxDamageSameAsDamage +; 0x2eba1 + +Rampage_Confusion50PercentEffect: ; 2eba1 (b:6ba1) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + call AddToDamage + ldtx de, IfTailsYourPokemonBecomesConfusedText + call TossCoin_BankB + ret c ; heads + call SwapTurn + call ConfusionEffect + call SwapTurn + ret +; 0x2ebba + +FuryAttack_AIEffect: ; 2ebba (b:6bba) + ld a, (10 * 2) / 2 + lb de, 0, 20 + jp SetExpectedAIDamage +; 0x2ebc2 + +FuryAttack_MultiplerEffect: ; 2ebc2 (b:6bc2) + ld hl, 10 + call LoadTxRam3 + ld a, 2 + ldtx de, DamageCheckIfHeadsXDamageText + call TossCoinATimes_BankB + call ATimes10 + call SetDefiniteDamage + ret +; 0x2ebd7 + +RetreatAidEffect: ; 2ebd7 (b:6bd7) + scf + ret +; 0x2ebd9 + +DodrioRage_AIEffect: ; 2ebd9 (b:6bd9) + call DodrioRage_DamageBoostEffect + jp SetMinMaxDamageSameAsDamage +; 0x2ebdf + +DodrioRage_DamageBoostEffect: ; 2ebdf (b:6bdf) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + call AddToDamage + ret +; 0x2ebe8 + +PayDayEffect: ; 2ebe8 (b:6be8) + ldtx de, IfHeadsDraw1CardFromDeckText + call TossCoin_BankB + ret nc ; tails + ldtx hl, Draw1CardFromTheDeckText + call DrawWideTextBox_WaitForInput + bank1call DisplayDrawOneCardScreen + call DrawCardFromDeck + ret c ; empty deck + call AddCardToHand + call LoadCardDataToBuffer1_FromDeckIndex + ld a, [wDuelistType] + cp DUELIST_TYPE_PLAYER + ret nz + ; show card on screen if it was Player + bank1call OpenCardPage_FromHand + ret +; 0x2ec0c + +DragonairSlam_AIEffect: ; 2ec0c (b:6c0c) + ld a, (30 * 2) / 2 + lb de, 0, 60 + jp SetExpectedAIDamage +; 0x2ec14 + +DragonairSlam_MultiplierEffect: ; 2ec14 (b:6c14) + ld hl, 30 + call LoadTxRam3 + ld a, 2 + ldtx de, DamageCheckIfHeadsXDamageText + call TossCoinATimes_BankB + ld e, a + add a + add e + call ATimes10 + call SetDefiniteDamage + ret +; 0x2ec2c + +DragonairHyperBeam_PlayerSelectEffect: ; 2ec2c (b:6c2c) + jp HandleEnergyDiscardEffectSelection +; 0x2ec2f + +DragonairHyperBeam_AISelectEffect: ; 2ec2f (b:6c2f) + call AIPickEnergyCardToDiscardFromDefendingPokemon + ldh [hTemp_ffa0], a + ret +; 0x2ec35 + +DragonairHyperBeam_DiscardEffect: ; 2ec35 (b:6c35) + call HandleNoDamageOrEffect + ret c ; is unaffected + ldh a, [hTemp_ffa0] + cp $ff + ret z ; no energy card chosen + call SwapTurn + call PutCardInDiscardPile + ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT + call GetTurnDuelistVariable + ld [hl], LAST_TURN_EFFECT_DISCARD_ENERGY + call SwapTurn + ret +; 0x2ec4f + +; handles screen for selecting an Energy card to discard +; that is attached to Defending Pokemon, +; and store the Player selection in [hTemp_ffa0]. +HandleEnergyDiscardEffectSelection: ; 2ec4f (b:6c4f) + call SwapTurn + xor a ; PLAY_AREA_ARENA + call CreateArenaOrBenchEnergyCardList + jr c, .no_energy + ldtx hl, ChooseDiscardEnergyCardFromOpponentText + call DrawWideTextBox_WaitForInput + xor a ; PLAY_AREA_ARENA + bank1call DisplayEnergyDiscardScreen + +.loop_input + bank1call HandleEnergyDiscardMenuInput + jr c, .loop_input + + call SwapTurn + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a ; store selected card to discard + ret + +.no_energy + call SwapTurn + ld a, $ff + ldh [hTemp_ffa0], a + ret +; 0x2ec77 + +; return carry if Defending Pokemon has no attacks +ClefableMetronome_CheckAttacks: ; 2ec77 (b:6c77) + call CheckIfDefendingPokemonHasAnyAttack + ldtx hl, NoAttackMayBeChoosenText + ret +; 0x2ec7e + +ClefableMetronome_AISelectEffect: ; 2ec7e (b:6c7e) + call HandleAIMetronomeEffect + ret +; 0x2ec82 + +ClefableMetronome_UseAttackEffect: ; 2ec82 (b:6c82) + ld a, 1 ; energy cost of this attack + call HandlePlayerMetronomeEffect + ret +; 0x2ec88 + +ClefableMinimizeEffect: ; 2ec88 (b:6c88) + ld a, SUBSTATUS1_REDUCE_BY_20 + call ApplySubstatus1ToDefendingCard + ret +; 0x2ec8e + +HurricaneEffect: ; 2ec8e (b:6c8e) + call HandleNoDamageOrEffect + ret c ; is unaffected + + ld a, DUELVARS_ARENA_CARD_HP + call GetNonTurnDuelistVariable + or a + ret z ; return if Pokemon was KO'd + +; look at all the card locations and put all cards +; that are in the Arena in the hand. + call SwapTurn + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_locations + ld a, [hl] + cp CARD_LOCATION_ARENA + jr nz, .next_card + ; card in Arena found, put in hand + ld a, l + call AddCardToHand +.next_card + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_locations + +; empty the Arena card slot + ld l, DUELVARS_ARENA_CARD + ld a, [hl] + ld [hl], $ff + ld l, DUELVARS_ARENA_CARD_HP + ld [hl], 0 + call LoadCardDataToBuffer1_FromDeckIndex + ld hl, wLoadedCard1Name + ld a, [hli] + ld h, [hl] + ld l, a + call LoadTxRam2 + ldtx hl, PokemonAndAllAttachedCardsReturnedToHandText + call DrawWideTextBox_WaitForInput + xor a + ld [wDuelDisplayedScreen], a + call SwapTurn + ret +; 0x2ecd3 + +PidgeottoWhirlwind_SelectEffect: ; 2ecd3 (b:6cd3) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp 2 + jr nc, .switch + ; no Bench Pokemon + ld a, $ff + ldh [hTemp_ffa0], a + ret +.switch + call DuelistSelectForcedSwitch + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ret +; 0x2ece9 + +PidgeottoWhirlwind_SwitchEffect: ; 2ece9 (b:6ce9) + ldh a, [hTemp_ffa0] + call HandleSwitchDefendingPokemonEffect + ret +; 0x2ecef + +PidgeottoMirrorMove_AIEffect: ; 2ecef (b:6cef) + jp MirrorMoveEffects.AIEffect +; 0x2ecf2 + +PidgeottoMirrorMove_InitialEffect1: ; 2ecf2 (b:6cf2) + jp MirrorMoveEffects.InitialEffect1 +; 0x2ecf5 + +PidgeottoMirrorMove_InitialEffect2: ; 2ecf5 (b:6cf5) + jp MirrorMoveEffects.InitialEffect2 +; 0x2ecf8 + +PidgeottoMirrorMove_PlayerSelection: ; 2ecf8 (b:6cf8) + jp MirrorMoveEffects.PlayerSelection +; 0x2ecfb + +PidgeottoMirrorMove_AISelection: ; 2ecfb (b:6cfb) + jp MirrorMoveEffects.AISelection +; 0x2ecfe + +PidgeottoMirrorMove_BeforeDamage: ; 2ecfe (b:6cfe) + jp MirrorMoveEffects.BeforeDamage +; 0x2ed01 + +PidgeottoMirrorMove_AfterDamage: ; 2ed01 (b:6d01) + jp MirrorMoveEffects.AfterDamage +; 0x2ed04 + +SingEffect: ; 2ed04 (b:6d04) + call Sleep50PercentEffect + call nc, SetNoEffectFromStatus + ret +; 0x2ed0b + +; return carry if Defending Pokemon has no attacks +ClefairyMetronome_CheckAttacks: ; 2ed0b (b:6d0b) + call CheckIfDefendingPokemonHasAnyAttack + ldtx hl, NoAttackMayBeChoosenText + ret +; 0x2ed12 + +ClefairyMetronome_AISelectEffect: ; 2ed12 (b:6d12) + call HandleAIMetronomeEffect + ret +; 0x2ed16 + +ClefairyMetronome_UseAttackEffect: ; 2ed16 (b:6d16) + ld a, 3 ; energy cost of this attack +; fallthrough + +; handles Metronome selection, and validates +; whether it can use the selected attack. +; if unsuccessful, returns carry. +; input: +; a = amount of colorless energy needed for Metronome +HandlePlayerMetronomeEffect: ; 2ed18 (b:6d18) + ld [wMetronomeEnergyCost], a + ldtx hl, ChooseOppAttackToBeUsedWithMetronomeText + call DrawWideTextBox_WaitForInput + + call HandleDefendingPokemonAttackSelection + ret c ; return if operation cancelled + +; store this attack as selected attack to use + ld hl, wMetronomeSelectedAttack + ld [hl], d + inc hl + ld [hl], e + +; compare selected attack's name with +; the attack that is loaded, which is Metronome. +; if equal, then cannot select it. +; (i.e. cannot use Metronome with Metronome.) + ld hl, wLoadedMoveName + ld a, [hli] + ld h, [hl] + ld l, a + push hl + call SwapTurn + call CopyMoveDataAndDamage_FromDeckIndex + call SwapTurn + pop de + ld hl, wLoadedMoveName + ld a, e + cp [hl] + jr nz, .try_use + inc hl + ld a, d + cp [hl] + jr nz, .try_use + ; cannot select Metronome + ldtx hl, UnableToSelectText +.failed + call DrawWideTextBox_WaitForInput +.set_carry + scf + ret + +.try_use +; run the attack checks to determine +; whether it can be used. + ld a, EFFECTCMDTYPE_INITIAL_EFFECT_1 + call TryExecuteEffectCommandFunction + jr c, .failed + ld a, EFFECTCMDTYPE_INITIAL_EFFECT_2 + call TryExecuteEffectCommandFunction + jr c, .set_carry + ; successful + +; send data to link opponent + bank1call SendAttackDataToLinkOpponent + ld a, OPPACTION_USE_METRONOME_ATTACK + call SetOppAction_SerialSendDuelData + ld hl, wMetronomeSelectedAttack + ld d, [hl] + inc hl + ld e, [hl] + ld a, [wMetronomeEnergyCost] + ld c, a + call SerialSend8Bytes + + ldh a, [hTempCardIndex_ff9f] + ld [wPlayerAttackingCardIndex], a + ld a, [wSelectedAttack] + ld [wPlayerAttackingMoveIndex], a + ld a, [wTempCardID_ccc2] + ld [wPlayerAttackingCardID], a + or a + ret +; 0x2ed86 + +; does nothing for AI. +HandleAIMetronomeEffect: ; 2ed86 (b:6d86) + ret +; 0x2ed87 + +DoTheWaveEffect: ; 2ed87 (b:6d87) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + dec a ; don't count arena card + call ATimes10 + call AddToDamage + ret +; 0x2ed94 + +; return carry if no damage counters +FirstAid_DamageCheck: ; 2ed94 (b:6d94) + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + ldtx hl, NoDamageCountersText + cp 10 + ret +; 0x2ed9f + +FirstAid_HealEffect: ; 2ed9f (b:6d9f) + lb de, 0, 10 + call ApplyAndAnimateHPRecovery + ret +; 0x2eda6 + +JigglypuffDoubleEdgeEffect: ; 2eda6 (b:6da6) + ld a, 20 + call DealRecoilDamageToSelf + ret +; 0x2edac + +PounceEffect: ; 2edac (b:6dac) + ld a, SUBSTATUS2_POUNCE + call ApplySubstatus2ToDefendingCard + ret +; 0x2edb2 + +LickitungSupersonicEffect: ; 2edb2 (b:6db2) + call Confusion50PercentEffect + call nc, SetNoEffectFromStatus + ret +; 0x2edb9 + +PidgeyWhirlwind_SelectEffect: ; 2edb9 (b:6db9) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + cp 2 + jr nc, .switch + ; no Bench Pokemon + ld a, $ff + ldh [hTemp_ffa0], a + ret +.switch + call DuelistSelectForcedSwitch + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ret +; 0x2edcf + +PidgeyWhirlwind_SwitchEffect: ; 2edcf (b:6dcf) + ldh a, [hTemp_ffa0] + call HandleSwitchDefendingPokemonEffect + ret +; 0x2edd5 + +; return carry if Defending card has no weakness +Conversion1_WeaknessCheck: ; 2edd5 (b:6dd5) + call SwapTurn + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer2_FromDeckIndex + call SwapTurn + ld a, [wLoadedCard2Weakness] + or a + ret nz + ldtx hl, NoWeaknessText + scf + ret +; 0x2eded + +Conversion1_PlayerSelectEffect: ; 2eded (b:6ded) + ldtx hl, ChooseWeaknessYouWishToChangeText + xor a ; PLAY_AREA_ARENA + call HandleColorChangeScreen + ldh [hTemp_ffa0], a + ret +; 0x2edf7 + +Conversion1_AISelectEffect: ; 2edf7 (b:6df7) + call AISelectConversionColor + ret +; 0x2edfb + +Conversion1_ChangeWeaknessEffect: ; 2edfb (b:6dfb) + call HandleNoDamageOrEffect + ret c ; is unaffected + +; apply changed weakness + ld a, DUELVARS_ARENA_CARD_CHANGED_WEAKNESS + call GetNonTurnDuelistVariable + ldh a, [hTemp_ffa0] + call TranslateColorToWR + ld [hl], a + ld l, DUELVARS_ARENA_CARD_LAST_TURN_CHANGE_WEAK + ld [hl], a + +; print text box + call SwapTurn + ldtx hl, ChangedTheWeaknessOfPokemonToColorText + call PrintArenaCardNameAndColorText + call SwapTurn + +; apply substatus + ld a, SUBSTATUS2_CONVERSION2 + call ApplySubstatus2ToDefendingCard + ret +; 0x2ee1f + +; returns carry if Active Pokemon has no Resistance. +Conversion2_ResistanceCheck: ; 2ee1f (b:6e1f) + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Resistance] + or a + ret nz + ldtx hl, NoResistanceText + scf + ret +; 0x2ee31 + +Conversion2_PlayerSelectEffect: ; 2ee31 (b:6e31) + ldtx hl, ChooseResistanceYouWishToChangeText + ld a, $80 + call HandleColorChangeScreen + ldh [hTemp_ffa0], a + ret +; 0x2ee3c + +Conversion2_AISelectEffect: ; 2ee3c (b:6e3c) +; AI will choose Defending Pokemon's color +; unless it is colorless. + call SwapTurn + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + call SwapTurn + ld a, [wLoadedCard1Type] + cp COLORLESS + jr z, .is_colorless + ldh [hTemp_ffa0], a + ret + +.is_colorless + call SwapTurn + call AISelectConversionColor + call SwapTurn + ret +; 0x2ee5e + +Conversion2_ChangeResistanceEffect: ; 2ee5e (b:6e5e) +; apply changed resistance + ld a, DUELVARS_ARENA_CARD_CHANGED_RESISTANCE + call GetTurnDuelistVariable + ldh a, [hTemp_ffa0] + call TranslateColorToWR + ld [hl], a + ldtx hl, ChangedTheResistanceOfPokemonToColorText +; fallthrough + +; prints text that requires card name and color, +; with the card name of the Turn Duelist's Arena Pokemon +; and color in [hTemp_ffa0]. +; input: +; hl = text to print +PrintArenaCardNameAndColorText: ; 2ee6c (b:6e6c) + push hl + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + ldh a, [hTemp_ffa0] + call LoadCardNameAndInputColor + pop hl + call DrawWideTextBox_PrintText + ret +; 0x2ee7f + +; handles AI logic for selecting a new color +; for weakness/resistance. +; - if within the context of Conversion1, looks +; in own Bench for a non-colorless card that can attack. +; - if within the context of Conversion2, looks +; in Player's Bench for a non-colorless card that can attack. +AISelectConversionColor: ; 2ee7f (b:6e7f) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld d, a + ld e, PLAY_AREA_ARENA + jr .next_pkmn_atk + +; look for a non-colorless Bench Pokemon +; that has enough energy to use an attack. +.loop_atk + push de + call GetPlayAreaCardAttachedEnergies + ld a, e + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + ld d, a + call LoadCardDataToBuffer1_FromDeckIndex + ld a, [wLoadedCard1Type] + cp COLORLESS + jr z, .skip_pkmn_atk ; skip colorless Pokemon + ld e, FIRST_ATTACK_OR_PKMN_POWER + bank1call _CheckIfEnoughEnergiesToMove + jr nc, .found + ld e, SECOND_ATTACK + bank1call _CheckIfEnoughEnergiesToMove + jr nc, .found +.skip_pkmn_atk + pop de +.next_pkmn_atk + inc e + dec d + jr nz, .loop_atk + +; none found in Bench. +; next, look for a non-colorless Bench Pokemon +; that has any Energy cards attached. + ld d, e ; number of Play Area Pokemon + ld e, PLAY_AREA_ARENA + jr .next_pkmn_energy + +.loop_energy + push de + call GetPlayAreaCardAttachedEnergies + ld a, [wTotalAttachedEnergies] + or a + jr z, .skip_pkmn_energy + ld a, e + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + ld d, a + call LoadCardDataToBuffer1_FromDeckIndex + ld a, [wLoadedCard1Type] + cp COLORLESS + jr nz, .found +.skip_pkmn_energy + pop de +.next_pkmn_energy + inc e + dec d + jr nz, .loop_energy + +; otherwise, just select a random energy. + ld a, NUM_COLORED_TYPES + call Random + ldh [hTemp_ffa0], a + ret + +.found + pop de + ld a, [wLoadedCard1Type] + and TYPE_PKMN + ldh [hTemp_ffa0], a + ret +; 0x2eee7 + +ScrunchEffect: ; 2eee7 (b:6ee7) + ldtx de, IfHeadsNoDamageNextTurnText + call TossCoin_BankB + jp nc, SetWasUnsuccessful + ld a, $6b + ld [wLoadedMoveAnimation], a + ld a, SUBSTATUS1_NO_DAMAGE_17 + call ApplySubstatus1ToDefendingCard + ret +; 0x2eefb + +ChanseyDoubleEdgeEffect: ; 2eefb (b:6efb) + ld a, 80 + call DealRecoilDamageToSelf + ret +; 0x2ef01 + +SuperFang_AIEffect: ; 2ef01 (b:6f01) + call SuperFang_HalfHPEffect + jp SetMinMaxDamageSameAsDamage +; 0x2ef07 + +SuperFang_HalfHPEffect: ; 2ef07 (b:6f07) + ld a, DUELVARS_ARENA_CARD_HP + call GetNonTurnDuelistVariable + srl a + bit 0, a + jr z, .rounded + ; round up + add 5 +.rounded + call SetDefiniteDamage + ret +; 0x2ef18 + +; return carry if no Pokemon in Bench +TrainerCardAsPokemon_BenchCheck: ; 2ef18 (b:6f18) + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, EffectNoPokemonOnTheBenchText + cp 2 + ret +; 0x2ef27 + +TrainerCardAsPokemon_PlayerSelectSwitch: ; 2ef27 (b:6f27) + ldh a, [hTemp_ffa0] + or a + ret nz ; no need to switch if it's not Arena card + + ldtx hl, SelectPokemonToPlaceInTheArenaText + call DrawWideTextBox_WaitForInput + bank1call HasAlivePokemonInBench + bank1call OpenPlayAreaScreenForSelection + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTempPlayAreaLocation_ffa1], a + ret +; 0x2ef3c + +TrainerCardAsPokemon_DiscardEffect: ; 2ef3c (b:6f3c) + ldh a, [hTemp_ffa0] + ld e, a + call MovePlayAreaCardToDiscardPile + ldh a, [hTemp_ffa0] + or a + jr nz, .shift_cards + ldh a, [hTempPlayAreaLocation_ffa1] + ld e, a + call SwapArenaWithBenchPokemon +.shift_cards + call ShiftAllPokemonToFirstPlayAreaSlots + ret +; 0x2ef51 + +HealingWind_InitialEffect: ; 2ef51 (b:6f51) + scf + ret +; 0x2ef53 + +HealingWind_PlayAreaHealEffect: ; 2ef53 (b:6f53) +; play initial animation + ldh a, [hTempPlayAreaLocation_ff9d] + ld b, a + ld c, $00 + ldh a, [hWhoseTurn] + ld h, a + bank1call PlayMoveAnimation + bank1call WaitMoveAnimation + ld a, $86 + ld [wLoadedMoveAnimation], a + + + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld d, a + ld e, PLAY_AREA_ARENA +.loop_play_area + push de + ld a, e + ldh [hTempPlayAreaLocation_ff9d], a + call GetCardDamageAndMaxHP + or a + jr z, .next_pkmn ; skip if no damage + +; if less than 20 damage, cap recovery at 10 damage + ld de, 20 + cp e + jr nc, .heal + ld e, a + +.heal +; add HP to this card + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + add e + ld [hl], a + +; play heal animation + ldh a, [hTempPlayAreaLocation_ff9d] + ld b, a + ld c, $01 + ldh a, [hWhoseTurn] + ld h, a + bank1call PlayMoveAnimation + bank1call WaitMoveAnimation +.next_pkmn + pop de + inc e + dec d + jr nz, .loop_play_area + + ret +; 0x2ef9c + +Dragonite1Slam_AIEffect: ; 2ef9c (b:6f9c) + ld a, (30 * 2) / 2 + lb de, 0, 60 + jp SetExpectedAIDamage +; 0x2efa4 + +Dragonite1Slam_MultiplierEffect: ; 2efa4 (b:6fa4) + ld hl, 30 + call LoadTxRam3 + ldtx de, DamageCheckIfHeadsXDamageText + ld a, 2 + call TossCoinATimes_BankB + ld c, a + add a + add c + call ATimes10 + call SetDefiniteDamage + ret +; 0x2efbc + + INCROM $2efbc, $2efe0 + +CatPunchEffect: ; 2efe0 (b:6fe0) + call SwapTurn + call PickRandomPlayAreaCard + ld b, a + ld a, $83 + ld [wLoadedMoveAnimation], a + ld de, 20 + call DealDamageToPlayAreaPokemon + call SwapTurn + ret +; 0x2eff6 + +MorphEffect: ; 2eff6 (b:6ff6) + call ExchangeRNG + call .PickRandomBasicPokemonFromDeck + jr nc, .successful + ldtx hl, AttackUnsuccessfulText + call DrawWideTextBox_WaitForInput + ret + +.successful + ld a, DUELVARS_ARENA_CARD_STAGE + call GetTurnDuelistVariable + or a + jr z, .skip_discard_stage_below + +; if this is a stage 1 Pokemon (in case it's used +; by Clefable's Metronome attack) then first discard +; the lower stage card. + push hl + xor a + ldh [hTempPlayAreaLocation_ff9d], a + bank1call GetCardOneStageBelow + ld a, d + call PutCardInDiscardPile + pop hl + ld [hl], BASIC + +.skip_discard_stage_below +; overwrite card ID + ldh a, [hTempCardIndex_ff98] + call GetCardIDFromDeckIndex + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + ldh [hTempCardIndex_ff98], a + call _GetCardIDFromDeckIndex + ld [hl], e + +; overwrite HP to new card's maximum HP + ld e, PLAY_AREA_ARENA + call GetCardDamageAndMaxHP + ld a, DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + ld [hl], c + +; clear changed color and status + ld l, DUELVARS_ARENA_CARD_CHANGED_TYPE + ld [hl], $00 + call ClearAllStatusConditions + +; load both card's names for printing text + ld a, [wTempTurnDuelistCardID] + ld e, a + ld d, $00 + call LoadCardDataToBuffer2_FromCardID + ld hl, wLoadedCard2Name + ld de, wTxRam2 + ld a, [hli] + ld [de], a + inc de + ld a, [hl] + ld [de], a + inc de + ldh a, [hTempCardIndex_ff98] + call LoadCardDataToBuffer2_FromDeckIndex + ld hl, wLoadedCard2Name + ld a, [hli] + ld [de], a + inc de + ld a, [hl] + ld [de], a + ldtx hl, MetamorphsToText + call DrawWideTextBox_WaitForInput + + xor a + ld [wDuelDisplayedScreen], a + ret +; 0x2f06a + +; picks a random Pokemon in the Deck to morph. +; needs to be a Basic Pokemon that doesn't have +; the same ID as the Arena card. +; returns carry if no Pokemon were found. +.PickRandomBasicPokemonFromDeck ; 2f06a (b:706a) + call CreateDeckCardList + ret c ; empty deck + ld hl, wDuelTempList + call ShuffleCards +.loop_deck + ld a, [hli] + ldh [hTempCardIndex_ff98], a + cp $ff + jr z, .set_carry + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + jr nc, .loop_deck ; skip non-Pokemon cards + ld a, [wLoadedCard2Stage] + or a + jr nz, .loop_deck ; skip non-Basic cards + ld a, [wLoadedCard2ID] + cp DUELVARS_ARENA_CARD + jr z, .loop_deck ; skip cards with same ID as Arena card + ldh a, [hTempCardIndex_ff98] + or a + ret +.set_carry + scf + ret +; 0x2f098 + +; returns in a and [hTempCardIndex_ff98] the deck index +; of random Basic Pokemon card in deck. +; if none are found, return carry. +PickRandomBasicCardFromDeck: ; 2f098 (b:7098) + call CreateDeckCardList + ret c ; return if empty deck + ld hl, wDuelTempList + call ShuffleCards +.loop_deck + ld a, [hli] + ldh [hTempCardIndex_ff98], a + cp $ff + jr z, .set_carry + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + jr nc, .loop_deck ; skip if not Pokemon card + ld a, [wLoadedCard2Stage] + or a + jr nz, .loop_deck ; skip if not Basic stage + ldh a, [hTempCardIndex_ff98] + or a + ret +.set_carry + scf + ret +; 0x2f0bf + +SlicingWindEffect: ; 2f0bf (b:70bf) + call SwapTurn + call PickRandomPlayAreaCard + ld b, a + ld de, 30 + call DealDamageToPlayAreaPokemon_RegularAnim + call SwapTurn + ret +; 0x2f0d0 + +Gale_LoadAnimation: ; 2f0d0 (b:70d0) + ld a, $87 + ld [wLoadedMoveAnimation], a + ret +; 0x2f0d6 + +Gale_SwitchEffect: ; 2f0d6 (b:70d6) +; if Defending card is unaffected by attack +; jump directly to switching this card only. + call HandleNoDamageOrEffect + jr c, .SwitchWithRandomBenchPokemon + +; handle switching Defending card + ld a, DUELVARS_ARENA_CARD_HP + call GetNonTurnDuelistVariable + or a + jr nz, .skip_destiny_bond + bank1call HandleDestinyBondSubstatus +.skip_destiny_bond + call SwapTurn + call .SwitchWithRandomBenchPokemon + jr c, .skip_clear_damage +; clear dealt damage because Pokemon was switched + xor a + ld hl, wDealtDamage + ld [hli], a + ld [hl], a +.skip_clear_damage + call SwapTurn +; fallthrough for attacking card switch + +.SwitchWithRandomBenchPokemon + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + cp 2 + ret c ; return if no Bench Pokemon + +; get random Bench location and swap + dec a + call Random + inc a + ld e, a + call SwapArenaWithBenchPokemon + + xor a + ld [wDuelDisplayedScreen], a + ret +; 0x2f10d + +; return carry if Bench is full +FriendshipSong_BenchCheck: ; 2f10d (b:710d) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, NoSpaceOnTheBenchText + cp MAX_PLAY_AREA_POKEMON + ccf + ret +; 0x2f119 + +FriendshipSong_AddToBench50PercentEffect: ; 2f119 (b:7119) + ldtx de, SuccessCheckIfHeadsAttackIsSuccessfulText + call TossCoin_BankB + jr c, .successful + +.none_came_text + ldtx hl, NoneCameText + call DrawWideTextBox_WaitForInput + ret + +.successful + call PickRandomBasicCardFromDeck + jr nc, .put_in_bench + ld a, $6a + call Func_2c12e + call .none_came_text + call Func_2c0bd + ret + +.put_in_bench + call SearchCardInDeckAndAddToHand + call AddCardToHand + call PutHandPokemonCardInPlayArea + ld a, $6a + call Func_2c12e + ldh a, [hTempCardIndex_ff98] + ldtx hl, CameToTheBenchText + bank1call DisplayCardDetailScreen + call Func_2c0bd + ret +; 0x2f153 + +ExpandEffect: ; 2f153 (b:7153) + ld a, SUBSTATUS1_REDUCE_BY_10 + call ApplySubstatus1ToDefendingCard + ret +; 0x2f159 + +; returns carry if either there are no damage counters +; or no Energy cards attached in the Play Area. +SuperPotion_DamageEnergyCheck: ; 2f159 (b:7159) + call CheckIfPlayAreaHasAnyDamage + ldtx hl, NoPokemonWithDamageCountersText + ret c ; no damage counters + call CheckIfThereAreAnyEnergyCardsAttached + ldtx hl, ThereIsNoEnergyCardAttachedText + ret +; 0x2f167 + +SuperPotion_PlayerSelectEffect: ; 2f167 (b:7167) + ldtx hl, ChoosePokemonToRemoveDamageCounterFromText + call DrawWideTextBox_WaitForInput +.start + bank1call HasAlivePokemonInPlayArea +.read_input + bank1call OpenPlayAreaScreenForSelection + ret c ; exit if B is pressed + ld e, a + call GetCardDamageAndMaxHP + or a + jr z, .read_input ; Pokemon has no damage? + ldh a, [hCurMenuItem] + ld e, a + call GetPlayAreaCardAttachedEnergies + ld a, [wTotalAttachedEnergies] + or a + jr nz, .got_pkmn + ; no energy cards attached + ldtx hl, NoEnergyCardsText + call DrawWideTextBox_WaitForInput + jr .start + +.got_pkmn +; Pokemon has damage and Energy cards attached, +; prompt the Player for Energy selection to discard. + ldh a, [hCurMenuItem] + bank1call CreateArenaOrBenchEnergyCardList + ldh a, [hCurMenuItem] + bank1call DisplayEnergyDiscardScreen + bank1call HandleEnergyDiscardMenuInput + ret c ; exit if B was pressed + + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTempPlayAreaLocation_ffa1], a + ld e, a + +; cap the healing damage if +; it would make it exceed max HP. + call GetCardDamageAndMaxHP + ld c, 40 + cp 40 + jr nc, .heal + ld c, a +.heal + ld a, c + ldh [hPlayAreaEffectTarget], a + or a + ret +; 0x2f1b5 + +SuperPotion_HealEffect: ; 2f1b5 (b:71b5) + ldh a, [hTemp_ffa0] + call PutCardInDiscardPile + ldh a, [hTempPlayAreaLocation_ffa1] + ldh [hTempPlayAreaLocation_ff9d], a + ldh a, [hPlayAreaEffectTarget] + call HealPlayAreaCardHP + ret +; 0x2f1c4 + +; checks if there is at least one Energy card +; attached to some card in the Turn Duelist's Play Area. +; return no carry if one is found, +; and returns carry set if none is found. +CheckIfThereAreAnyEnergyCardsAttached: ; 2f1c4 (b:71c4) + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_deck + ld a, [hl] + bit CARD_LOCATION_PLAY_AREA_F, a + jr z, .next_card ; skip if not in Play Area + ld a, l + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_TRAINER + jr z, .next_card ; skip if it's a Trainer card + cp TYPE_ENERGY + jr nc, .found +.next_card + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_deck + scf + ret +.found + or a + ret +; 0x2f1e7 + +; handles Player selection for Pokemon in Play Area, +; then opens screen to choose one of the energy cards +; attached to that selected Pokemon. +; outputs the selection in: +; [hTemp_ffa0] = play area location +; [hTempPlayAreaLocation_ffa1] = index of energy card +HandlePokemonAndEnergySelectionScreen: ; 2f1e7 (b:71e7) + bank1call HasAlivePokemonInPlayArea + bank1call OpenPlayAreaScreenForSelection + ret c ; exit if B is pressed + ld e, a + call GetPlayAreaCardAttachedEnergies + ld a, [wTotalAttachedEnergies] + or a + jr nz, .has_energy + ldtx hl, NoEnergyCardsText + call DrawWideTextBox_WaitForInput + jr HandlePokemonAndEnergySelectionScreen ; loop back to start + +.has_energy + ldh a, [hCurMenuItem] + bank1call CreateArenaOrBenchEnergyCardList + ldh a, [hCurMenuItem] + bank1call DisplayEnergyDiscardScreen + bank1call HandleEnergyDiscardMenuInput + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ldh a, [hTempCardIndex_ff98] + ldh [hTempPlayAreaLocation_ffa1], a + ret +; 0x2f216 + +ImakuniEffect: ; 2f216 (b:7216) + ld a, DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + ld a, [wLoadedCard1ID] + +; cannot confuse Clefairy Doll and Mysterious Fossil + cp CLEFAIRY_DOLL + jr z, .failed + cp MYSTERIOUS_FOSSIL + jr z, .failed + +; cannot confuse Snorlax if its Pkmn Power is active + cp SNORLAX + jr nz, .success + xor a + call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0 + jr c, .success + ; fallthrough if Thick Skinned is active + +.failed +; play confusion animation and print failure text + ld a, $7f + call Func_2fea9 + ldtx hl, ThereWasNoEffectText + call DrawWideTextBox_WaitForInput + ret + +.success +; play confusion animation and confuse card + ld a, $7f + call Func_2fea9 + ld a, DUELVARS_ARENA_CARD_STATUS + call GetTurnDuelistVariable + and PSN_DBLPSN + or CONFUSED + ld [hl], a + bank1call DrawDuelHUDs + ret +; 0x2f252 + +; returns carry if opponent has no energy cards attached +EnergyRemoval_EnergyCheck: ; 2f252 (b:7252) + call SwapTurn + call CheckIfThereAreAnyEnergyCardsAttached + ldtx hl, NoEnergyAttachedToOpponentsActiveText + call SwapTurn + ret +; 0x2f25f + +EnergyRemoval_PlayerSelection: ; 2f25f (b:725f) + ldtx hl, ChoosePokemonToRemoveEnergyFromText + call DrawWideTextBox_WaitForInput + call SwapTurn + call HandlePokemonAndEnergySelectionScreen + call SwapTurn + ret +; 0x2f26f + +EnergyRemoval_AISelection: ; 2f26f (b:726f) + call AIPickEnergyCardToDiscardFromDefendingPokemon + ret +; 0x2f273 + +EnergyRemoval_DiscardEffect: ; 2f273 (b:7273) + call SwapTurn + ldh a, [hTempPlayAreaLocation_ffa1] + call PutCardInDiscardPile + call SwapTurn + call IsPlayerTurn + ret c + +; show Player which Pokemon was affected + call SwapTurn + ldh a, [hTemp_ffa0] + call Func_2c10b + call SwapTurn + ret +; 0x2f28e + +; return carry if no other card in hand to discard +; or if there are no Basic Energy cards in Discard Pile. +EnergyRetrieval_HandEnergyCheck: ; 2f28e (b:728e) + ld a, DUELVARS_NUMBER_OF_CARDS_IN_HAND + call GetTurnDuelistVariable + cp 2 + ldtx hl, NotEnoughCardsInHandText + ret c ; return if doesn't have another card to discard + call CreateEnergyCardListFromDiscardPile_OnlyBasic + ldtx hl, ThereAreNoBasicEnergyCardsInDiscardPileText + ret +; 0x2f2a0 + +EnergyRetrieval_PlayerHandSelection: ; 2f2a0 (b:72a0) + ldtx hl, ChooseCardToDiscardFromHandText + call DrawWideTextBox_WaitForInput + call CreateHandCardList + ldh a, [hTempCardIndex_ff9f] + call RemoveCardFromDuelTempList + bank1call Func_5591 + bank1call DisplayCardList + ldh a, [hTempCardIndex_ff98] + ldh [hTempList], a + ret +; 0x2f2b9 + +EnergyRetrieval_PlayerDiscardPileSelection: ; 2f2b9 (b:72b9) + ld a, 1 ; start at 1 due to card selected from hand + ldh [hCurSelectionItem], a + ldtx hl, Choose2BasicEnergyCardsFromDiscardPileText + call DrawWideTextBox_WaitForInput + call CreateEnergyCardListFromDiscardPile_OnlyBasic + +.select_card + bank1call InitAndDrawCardListScreenLayout + ldtx hl, PleaseSelectCardText + ldtx de, PlayerDiscardPileText + bank1call SetCardListHeaderText + bank1call DisplayCardList + jr nc, .selected + ; B was pressed + ld a, 2 + 1 ; includes the card selected from hand + call AskWhetherToQuitSelectingCards + jr c, .select_card ; player selected No + jr .done + +.selected + call GetNextPositionInTempList_TrainerEffects + ldh a, [hTempCardIndex_ff98] + ld [hl], a + call RemoveCardFromDuelTempList + jr c, .done + ldh a, [hCurSelectionItem] + cp 2 + 1 ; includes the card selected from hand + jr c, .select_card + +.done + call GetNextPositionInTempList_TrainerEffects + ld [hl], $ff ; terminating byte + or a + ret +; 0x2f2f8 + +EnergyRetrieval_DiscardAndAddToHandEffect: ; 2f2f8 (b:72f8) + ld hl, hTempList + ld a, [hli] + call RemoveCardFromHand + call PutCardInDiscardPile + ld de, wDuelTempList +.loop + ld a, [hli] + ld [de], a + inc de + cp $ff + jr z, .done + call MoveDiscardPileCardToHand + call AddCardToHand + jr .loop +.done + call IsPlayerTurn + ret c + bank1call Func_4b38 + ret +; 0x2f31c + +; return carry if no cards left in Deck. +EnergySearch_DeckCheck: ; 2f31c (b:731c) + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetTurnDuelistVariable + cp DECK_SIZE + ccf + ldtx hl, NoCardsLeftInTheDeckText + ret +; 0x2f328 + +EnergySearch_PlayerSelection: ; 2f328 (b:7328) + ld a, $ff + ldh [hTemp_ffa0], a + call CreateDeckCardList + ldtx hl, Choose1BasicEnergyCardFromDeckText + lb de, SEARCHEFFECT_BASIC_ENERGY, 0 + ldtx bc, BasicEnergyText + call LookForCardsInDeck + ret c ; skip showing deck + + bank1call Func_5591 + ldtx hl, ChooseBasicEnergyCardText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText +.read_input + bank1call DisplayCardList + jr c, .try_exit ; B pressed? + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + call CheckIfCardIsBasicEnergy + jr c, .play_sfx + or a + ret +.play_sfx + call Func_3794 + jr .read_input + +.try_exit +; check if Player can exit without selecting anything + ld hl, wDuelTempList +.next_card + ld a, [hli] + cp $ff + jr z, .exit + call CheckIfCardIsBasicEnergy + jr c, .next_card + jr .read_input ; no, has to select Energy card +.exit + ld a, $ff + ldh [hTemp_ffa0], a + or a + ret +; 0x2f372 + +EnergySearch_AddToHandEffect: ; 2f372 (b:7372) + ldh a, [hTemp_ffa0] + cp $ff + jr z, .done +; add to hand + call SearchCardInDeckAndAddToHand + call AddCardToHand + call IsPlayerTurn + jr c, .done ; done if Player played card +; display card in screen + ldh a, [hTemp_ffa0] + ldtx hl, WasPlacedInTheHandText + bank1call DisplayCardDetailScreen +.done + call Func_2c0bd + ret + +; check if card index in a is a Basic Energy card. +; returns carry in case it's not. +CheckIfCardIsBasicEnergy: ; 2f38f (b:738f) + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + jr c, .not_basic_energy + cp TYPE_ENERGY_DOUBLE_COLORLESS + jr nc, .not_basic_energy +; is basic energy + or a + ret +.not_basic_energy + scf + ret +; 0x2f3a1 + +ProfessorOakEffect: ; 2f3a1 (b:73a1) +; discard hand + call CreateHandCardList + call SortCardsInDuelTempListByID + ld hl, wDuelTempList +.discard_loop + ld a, [hli] + cp $ff + jr z, .draw_cards + call RemoveCardFromHand + call PutCardInDiscardPile + jr .discard_loop + +.draw_cards + ld a, 7 + bank1call DisplayDrawNCardsScreen + ld c, 7 +.draw_loop + call DrawCardFromDeck + jr c, .done + call AddCardToHand + dec c + jr nz, .draw_loop +.done + ret +; 0x2f3ca + +Potion_DamageCheck: ; 2f3ca (b:73ca) + call CheckIfPlayAreaHasAnyDamage + ldtx hl, NoPokemonWithDamageCountersText + ret +; 0x2f3d1 + +Potion_PlayerSelection: ; 2f3d1 (b:73d1) + bank1call HasAlivePokemonInPlayArea +.read_input + bank1call OpenPlayAreaScreenForSelection + ret c ; exit is B was pressed + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ld e, a + call GetCardDamageAndMaxHP + or a + jr z, .read_input ; no damage, loop back to start +; cap damage + ld c, 20 + cp 20 + jr nc, .skip_cap + ld c, a +.skip_cap + ld a, c + ldh [hTempPlayAreaLocation_ffa1], a + or a + ret +; 0x2f3ef + +Potion_HealEffect: ; 2f3ef (b:73ef) + ldh a, [hTemp_ffa0] + ldh [hTempPlayAreaLocation_ff9d], a + ldh a, [hTempPlayAreaLocation_ffa1] + call HealPlayAreaCardHP + ret +; 0x2f3f9 + +GamblerEffect: ; 2f3f9 (b:73f9) + ldtx de, CardCheckIfHeads8CardsIfTails1CardText + call TossCoin_BankB + ldh [hTemp_ffa0], a +; discard Gambler card from hand + ldh a, [hTempCardIndex_ff9f] + call RemoveCardFromHand + call PutCardInDiscardPile + +; shuffle cards into deck + call CreateHandCardList + call SortCardsInDuelTempListByID + ld hl, wDuelTempList +.loop_return_deck + ld a, [hli] + cp $ff + jr z, .check_coin_toss + call RemoveCardFromHand + call ReturnCardToDeck + jr .loop_return_deck + +.check_coin_toss + call Func_2c0bd + ld c, 8 + ldh a, [hTemp_ffa0] + or a + jr nz, .draw_cards ; coin toss was heads? + ; if tails, number of cards to draw is 1 + ld c, 1 + +; correct number of cards to draw is in c +.draw_cards + ld a, c + bank1call DisplayDrawNCardsScreen .draw_loop - call DrawCardFromDeck - jr c, .revert_turn_to_user - call AddCardToHand - dec c - jr nz, .draw_loop -.revert_turn_to_user - call SwapTurn - ret + call DrawCardFromDeck + jr c, .done + call AddCardToHand + dec c + jr nz, .draw_loop +.done + ret +; 0x2f43b + +; return carry if not enough cards in hand to discard +; or if there are no cards in the Discard Pile +ItemFinder_HandDiscardPileCheck: ; 2f43b (b:743b) + ld a, DUELVARS_NUMBER_OF_CARDS_IN_HAND + call GetTurnDuelistVariable + ldtx hl, NotEnoughCardsInHandText + cp 3 + ret c + call CreateTrainerCardListFromDiscardPile + ret +; 0x2f44a + +ItemFinder_PlayerSelection: ; 2f44a (b:744a) + call HandlePlayerSelection2HandCardsToDiscard + ret c ; was operation cancelled? + +; cards were selected to discard from hand. +; now to choose a Trainer card from Discard Pile. + call CreateTrainerCardListFromDiscardPile + bank1call Func_5591 + ldtx hl, ChooseCardToPlaceInHandText + ldtx de, PlayerDiscardPileText + bank1call SetCardListHeaderText + bank1call DisplayCardList + ldh [hTempList + 2], a ; placed after the 2 cards selected to discard + ret +; 0x2f463 + +ItemFinder_DiscardAddToHandEffect: ; 2f463 (b:7463) +; discard cards from hand + ld hl, hTempList + ld a, [hli] + call RemoveCardFromHand + call PutCardInDiscardPile + ld a, [hli] + call RemoveCardFromHand + call PutCardInDiscardPile + +; place card from Discard Pile to hand + ld a, [hl] + call MoveDiscardPileCardToHand + call AddCardToHand + call IsPlayerTurn + ret c +; display card in screen + ldh a, [hTempList + 2] + ldtx hl, WasPlacedInTheHandText + bank1call DisplayCardDetailScreen + ret +; 0x2f488 + +Defender_PlayerSelection: ; 2f488 (b:7488) + ldtx hl, ChoosePokemonToAttachDefenderToText + call DrawWideTextBox_WaitForInput + bank1call HasAlivePokemonInPlayArea + bank1call OpenPlayAreaScreenForSelection + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ret +; 0x2f499 + +Defender_AttachDefenderEffect: ; 2f499 (b:7499) +; attach Trainer card to Play Area Pokemon + ldh a, [hTemp_ffa0] + ld e, a + ldh a, [hTempCardIndex_ff9f] + call PutHandCardInPlayArea + +; increase number of Defender cards of this location by 1 + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD_ATTACHED_DEFENDER + call GetTurnDuelistVariable + inc [hl] + call IsPlayerTurn + ret c + + ldh a, [hTemp_ffa0] + call Func_2c10b + ret +; 0x2f4b3 + +; return carry if Bench is full. +MysteriousFossil_BenchCheck: ; 2f4b3 (b:74b3) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + cp MAX_PLAY_AREA_POKEMON + ccf + ldtx hl, NoSpaceOnTheBenchText + ret +; 0x2f4bf + +MysteriousFossil_PlaceInPlayAreaEffect: ; 2f4bf (b:74bf) + ldh a, [hTempCardIndex_ff9f] + call PutHandPokemonCardInPlayArea + ret +; 0x2f4c5 + +; return carry if Arena card has no status to heal. +FullHeal_StatusCheck: ; 2f4c5 (b:74c5) + ld a, DUELVARS_ARENA_CARD_STATUS + call GetTurnDuelistVariable + or a + ret nz + ldtx hl, NotAffectedByPoisonSleepParalysisOrConfusionText + scf + ret +; 0x2f4d1 + +FullHeal_ClearStatusEffect: ; 2f4d1 (b:74d1) + ld a, $8a + call Func_2fea9 + ld a, DUELVARS_ARENA_CARD_STATUS + call GetTurnDuelistVariable + ld [hl], NO_STATUS + bank1call DrawDuelHUDs + ret +; 0x2f4e1 + +ImposterProfessorOakEffect: ; 2f4e1 (b:74e1) + call SwapTurn + call CreateHandCardList + call SortCardsInDuelTempListByID + +; first return all cards in hand to the deck. + ld hl, wDuelTempList +.loop_return_deck + ld a, [hli] + cp $ff + jr z, .done_return + call RemoveCardFromHand + call ReturnCardToDeck + jr .loop_return_deck + +; then draw 7 cards from the deck. +.done_return + call Func_2c0bd + ld a, 7 + bank1call DisplayDrawNCardsScreen + ld c, 7 +.loop_draw + call DrawCardFromDeck + jr c, .done + call AddCardToHand + dec c + jr nz, .loop_draw +.done + call SwapTurn + ret ; 0x2f513 +; return carry if not enough cards in hand to discard +; or if there are no cards left in the deck. +ComputerSearch_HandDeckCheck: ; 2f513 (b:7513) + ld a, DUELVARS_NUMBER_OF_CARDS_IN_HAND + call GetTurnDuelistVariable + ldtx hl, NotEnoughCardsInHandText + cp 3 + ret c + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetTurnDuelistVariable + ldtx hl, NoCardsLeftInTheDeckText + cp DECK_SIZE + ccf + ret +; 0x2f52a + +ComputerSearch_PlayerDiscardHandSelection: ; 2f52a (b:752a) + call HandlePlayerSelection2HandCardsToDiscard + ret +; 0x2f52e + +ComputerSearch_PlayerDeckSelection: ; 2f52e (b:752e) + call CreateDeckCardList + bank1call Func_5591 + ldtx hl, ChooseCardToPlaceInHandText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText +.loop_input + bank1call DisplayCardList + jr c, .loop_input ; can't exit with B button + ldh [hTempList + 2], a + ret +; 0x2f545 + +ComputerSearch_DiscardAddToHandEfect: ; 2f545 (b:7545) +; discard cards from hand + ld hl, hTempList + ld a, [hli] + call RemoveCardFromHand + call PutCardInDiscardPile + ld a, [hli] + call RemoveCardFromHand + call PutCardInDiscardPile + +; add card from deck to hand + ld a, [hl] + call SearchCardInDeckAndAddToHand + call AddCardToHand + call Func_2c0bd + ret +; 0x2f561 + +; return carry if Bench is full. +ClefairyDoll_BenchCheck: ; 2f561 (b:7561) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, NoSpaceOnTheBenchText + cp MAX_PLAY_AREA_POKEMON + ccf + ret +; 0x2f56d + +ClefairyDoll_PlaceInPlayAreaEffect: ; 2f56d (b:756d) + ldh a, [hTempCardIndex_ff9f] + call PutHandPokemonCardInPlayArea + ret +; 0x2f573 + +; return carry if no Pokemon in the Bench. +MrFuji_BenchCheck: ; 2f573 (b:7573) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, EffectNoPokemonOnTheBenchText + cp 2 + ret +; 0x2f57e + +MrFuji_PlayerSelection: ; 2f57e (b:757e) + ldtx hl, ChoosePokemonToReturnToTheDeckText + call DrawWideTextBox_WaitForInput + bank1call HasAlivePokemonInBench + bank1call OpenPlayAreaScreenForSelection + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ret +; 0x2f58f + +MrFuji_ReturnToDeckEffect: ; 2f58f (b:758f) +; get Play Area location's card index + ldh a, [hTemp_ffa0] + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + ldh [hTempCardIndex_ff98], a + +; find all cards that are in the same location +; (previous evolutions and energy cards attached) +; and return them all to the deck. + ldh a, [hTemp_ffa0] + or CARD_LOCATION_PLAY_AREA + ld e, a + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop_cards + push de + push hl + ld a, [hl] + cp e + jr nz, .next_card + ld a, l + call ReturnCardToDeck +.next_card + pop hl + pop de + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_cards + +; clear Play Area location of card + ldh a, [hTemp_ffa0] + ld e, a + call EmptyPlayAreaSlot + ld l, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + dec [hl] + call ShiftAllPokemonToFirstPlayAreaSlots + +; if Trainer card wasn't played by the Player, +; print the selected Pokemon's name and show card on screen. + call IsPlayerTurn + jr c, .done + ldh a, [hTempCardIndex_ff98] + call LoadCardDataToBuffer1_FromDeckIndex + ld hl, wLoadedCard1Name + ld a, [hli] + ld h, [hl] + ld l, a + call LoadTxRam2 + bank1call DrawLargePictureOfCard + ldtx hl, PokemonAndAllAttachedCardsWereReturnedToDeckText + call DrawWideTextBox_WaitForInput +.done + call Func_2c0bd + ret +; 0x2f5e0 + +PlusPowerEffect: ; 2f5e0 (b:75e0) +; attach Trainer card to Arena Pokemon + ld e, PLAY_AREA_ARENA + ldh a, [hTempCardIndex_ff9f] + call PutHandCardInPlayArea + +; increase number of Defender cards of this location by 1 + ld a, DUELVARS_ARENA_CARD_ATTACHED_PLUSPOWER + call GetTurnDuelistVariable + inc [hl] + ret +; 0x2f5ee + +; return carry if no Pokemon in the Bench. +Switch_BenchCheck: ; 2f5ee (b:75ee) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, EffectNoPokemonOnTheBenchText + cp 2 + ret +; 0x2f5f9 + +Switch_PlayerSelection: ; 2f5f9 (b:75f9) + ldtx hl, SelectPkmnOnBenchToSwitchWithActiveText + call DrawWideTextBox_WaitForInput + bank1call HasAlivePokemonInBench + bank1call OpenPlayAreaScreenForSelection + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + ret +; 0x2f60a + +Switch_SwitchEffect: ; 2f60a (b:760a) + ldh a, [hTemp_ffa0] + ld e, a + call SwapArenaWithBenchPokemon + ret +; 0x2f611 + +PokemonCenter_DamageCheck: ; 2f611 (b:7611) + call CheckIfPlayAreaHasAnyDamage + ldtx hl, NoPokemonWithDamageCountersText + ret +; 0x2f618 + +PokemonCenter_HealDiscardEnergyEffect: ; 2f618 (b:7618) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld d, a + ld e, PLAY_AREA_ARENA + +; go through every Pokemon in the Play Area +; and heal all damage & discard their Energy cards. +.loop_play_area +; check its damage + ld a, e + ldh [hTempPlayAreaLocation_ff9d], a + call GetCardDamageAndMaxHP + or a + jr z, .next_pkmn ; if no damage, skip Pokemon + +; heal all its damage + push de + ld e, a + ld d, $00 + call HealPlayAreaCardHP + +; loop all cards in deck and for all the Energy cards +; that are attached to this Play Area location Pokemon, +; place them in the Discard Pile. + ldh a, [hTempPlayAreaLocation_ff9d] + or CARD_LOCATION_PLAY_AREA + ld e, a + ld a, $00 + call GetTurnDuelistVariable +.loop_deck + ld a, [hl] + cp e + jr nz, .next_card_deck ; not attached to card, skip + ld a, l + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + and TYPE_ENERGY + jr z, .next_card_deck ; not Energy, skip + ld a, l + call PutCardInDiscardPile +.next_card_deck + inc l + ld a, l + cp DECK_SIZE + jr c, .loop_deck + + pop de +.next_pkmn + inc e + dec d + jr nz, .loop_play_area + ret +; 0x2f659 + +; return carry if non-Turn Duelist has full Bench +; or if they have no Basic Pokemon cards in Discard Pile. +PokemonFlute_BenchCheck: ; 2f659 (b:7659) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + ldtx hl, NoSpaceOnTheBenchText + cp MAX_PLAY_AREA_POKEMON + ccf + ret c ; not enough space in Bench + ; check Discard Pile + call SwapTurn + call CreateBasicPokemonCardListFromDiscardPile + ldtx hl, ThereAreNoPokemonInDiscardPileText + call SwapTurn + ret +; 0x2f672 + +PokemonFlute_PlayerSelection: ; 2f672 (b:7672) +; create Discard Pile list + call SwapTurn + call CreateBasicPokemonCardListFromDiscardPile + +; display selection screen and store Player's selection + bank1call Func_5591 + ldtx hl, ChoosePokemonToPlaceInPlayText + ldtx de, PlayerDiscardPileText + bank1call SetCardListHeaderText + bank1call DisplayCardList + call SwapTurn + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + ret +; 0x2f68f + +PokemonFlute_PlaceInPlayAreaText: ; 2f68f (b:768f) +; place selected card in non-Turn Duelist's Bench + call SwapTurn + ldh a, [hTemp_ffa0] + call MoveDiscardPileCardToHand + call AddCardToHand + call PutHandPokemonCardInPlayArea + call SwapTurn + +; unless it was the Player who played the card, +; display the Pokemon card on screen. + call IsPlayerTurn + ret c + call SwapTurn + ldh a, [hTemp_ffa0] + ldtx hl, CardWasChosenText + bank1call DisplayCardDetailScreen + call SwapTurn + ret +; 0x2f6b3 + +PokemonBreeder_HandPlayAreaCheck: ; 2f6b3 (b:76b3) + call CreatePlayableStage2PokemonCardListFromHand + jr c, .cannot_evolve + bank1call IsPrehistoricPowerActive + ret +.cannot_evolve + ldtx hl, ConditionsForEvolvingToStage2NotFulfilledText + scf + ret +; 0x2f6c1 + +PokemonBreeder_PlayerSelection: ; 2f6c1 (b:76c1) +; create hand list of playable Stage2 cards + call CreatePlayableStage2PokemonCardListFromHand + bank1call Func_5591 + +; handle Player selection of Stage2 card + ldtx hl, PleaseSelectCardText + ldtx de, DuelistHandText + bank1call SetCardListHeaderText + bank1call DisplayCardList + ret c ; exit if B was pressed + + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + ldtx hl, ChooseBasicPokemonToEvolveText + call DrawWideTextBox_WaitForInput + +; handle Player selection of Basic card to evolve + bank1call HasAlivePokemonInPlayArea +.read_input + bank1call OpenPlayAreaScreenForSelection + ret c ; exit if B was pressed + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTempPlayAreaLocation_ffa1], a + ld e, a + ldh a, [hTemp_ffa0] + ld d, a + call CheckIfCanEvolveInto_BasicToStage2 + jr c, .read_input ; loop back if cannot evolve this card + or a + ret +; 0x2f6f4 + +PokemonBreeder_EvolveEffect: ; 2f6f4 (b:76f4) + ldh a, [hTempCardIndex_ff9f] + push af + ld hl, hTemp_ffa0 + ld a, [hli] + ldh [hTempCardIndex_ff98], a + ld a, [hl] ; hTempPlayAreaLocation_ffa1 + ldh [hTempPlayAreaLocation_ff9d], a + +; load the Basic Pokemon card name to RAM + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + ld hl, wLoadedCard1Name + ld a, [hli] + ld h, [hl] + ld l, a + call LoadTxRam2 + +; evolve card and overwrite its stage as STAGE2_WITHOUT_STAGE1 + ldh a, [hTempCardIndex_ff98] + call EvolvePokemonCard + ld [hl], STAGE2_WITHOUT_STAGE1 + +; load Stage2 Pokemon card name to RAM + ldh a, [hTempCardIndex_ff98] + call LoadCardDataToBuffer1_FromDeckIndex + ld a, 18 + call CopyCardNameAndLevel + xor a + ld [hl], a ; $0 character + ld hl, wTxRam2_b + ld [hli], a + ld [hl], a + +; display Pokemon picture and play sfx, +; print the corresponding card names. + bank1call DrawLargePictureOfCard + ld a, $5e + call PlaySFX + ldtx hl, PokemonEvolvedIntoPokemonText + call DrawWideTextBox_WaitForInput + bank1call Func_161e + pop af + ldh [hTempCardIndex_ff9f], a + ret +; 0x2f73e + +; creates list in wDuelTempList of all Stage2 Pokemon cards +; in the hand that can evolve a Basic Pokemon card in Play Area +; through use of Pokemon Breeder. +; returns carry if that list is empty. +CreatePlayableStage2PokemonCardListFromHand: ; 2f73e (b:773e) + call CreateHandCardList + ret c ; return if no hand cards + +; check if hand Stage2 Pokemon cards can be made +; to evolve a Basic Pokemon in the Play Area and, if so, +; add it to the wDuelTempList. + ld hl, wDuelTempList + ld e, l + ld d, h +.loop_hand + ld a, [hl] + cp $ff + jr z, .done + call .CheckIfCanEvolveAnyPlayAreaBasicCard + jr c, .next_hand_card + ld a, [hl] + ld [de], a + inc de +.next_hand_card + inc hl + jr .loop_hand + +.done + ld a, $ff ; terminating byte + ld [de], a + ld a, [wDuelTempList] + cp $ff + scf + ret z ; return carry if empty + ; not empty + or a + ret + +; return carry if Stage2 card in a cannot evolve any +; of the Basic Pokemon in Play Area through Pokemon Breeder. +.CheckIfCanEvolveAnyPlayAreaBasicCard + push de + ld d, a + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + jr nc, .set_carry ; skip if not Pokemon card + ld a, [wLoadedCard2Stage] + cp STAGE2 + jr nz, .set_carry ; skip if not Stage2 + +; check if can evolve any Play Area cards + push hl + push bc + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld c, a + ld e, PLAY_AREA_ARENA +.loop_play_area + push bc + push de + call CheckIfCanEvolveInto_BasicToStage2 + pop de + pop bc + jr nc, .done_play_area + inc e + dec c + jr nz, .loop_play_area +; set carry + scf +.done_play_area + pop bc + pop hl + pop de + ret +.set_carry + pop de + scf + ret +; 0x2f795 + +; return carry if no cards in the Bench. +ScoopUp_BenchCheck: ; 2f795 (b:7795) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, EffectNoPokemonOnTheBenchText + cp 2 + ret +; 0x2f7a0 + +ScoopUp_PlayerSelection: ; 2f7a0 (b:77a0) +; print text box + ldtx hl, ChoosePokemonToScoopUpText + call DrawWideTextBox_WaitForInput + +; handle Player selection + bank1call HasAlivePokemonInPlayArea + bank1call OpenPlayAreaScreenForSelection + ret c ; exit if B was pressed + + ldh [hTemp_ffa0], a + or a + ret nz ; if it wasn't the Active Pokemon, we are done + +; handle switching to a Pokemon in Bench and store location selected. + call EmptyScreen + ldtx hl, SelectPokemonToPlaceInTheArenaText + call DrawWideTextBox_WaitForInput + bank1call HasAlivePokemonInBench + bank1call OpenPlayAreaScreenForSelection + ldh [hTempPlayAreaLocation_ffa1], a + ret +; 0x2f7c3 + +ScoopUp_ReturnToHandEffect: ; 2f7c3 (b:77c3) +; store chosen card location to Scoop Up + ldh a, [hTemp_ffa0] + or CARD_LOCATION_PLAY_AREA + ld e, a + +; find Basic Pokemon card that is in the selected Play Area location +; and add it to the hand, discarding all cards attached. + ld a, DUELVARS_CARD_LOCATIONS + call GetTurnDuelistVariable +.loop + ld a, [hl] + cp e + jr nz, .next_card ; skip if not in selected location + ld a, l + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + jr nc, .next_card ; skip if not Pokemon card + ld a, [wLoadedCard2Stage] + or a + jr nz, .next_card ; skip if not Basic stage +; found + ld a, l + ldh [hTempCardIndex_ff98], a + call AddCardToHand + ; optimization: break loop here, since + ; no two Basic Pokemon cards may occupy + ; the same Play Area location. +.next_card + inc l + ld a, l + cp DECK_SIZE + jr c, .loop + +; since the card has been moved to hand, +; MovePlayAreaCardToDiscardPile will take care +; of discarding every higher stage cards and other cards attached. + ldh a, [hTemp_ffa0] + ld e, a + call MovePlayAreaCardToDiscardPile + +; if the Pokemon was in the Arena, clear status + ldh a, [hTemp_ffa0] + or a + jr nz, .skip_clear_status + call ClearAllStatusConditions +.skip_clear_status + +; if card was not played by Player, show detail screen +; and print corresponding text. + call IsPlayerTurn + jr c, .shift_or_switch + ldtx hl, PokemonWasReturnedFromArenaToHandText + ldh a, [hTemp_ffa0] + or a + jr z, .display_detail_screen + ldtx hl, PokemonWasReturnedFromBenchToHandText +.display_detail_screen + ldh a, [hTempCardIndex_ff98] + bank1call DisplayCardDetailScreen + +.shift_or_switch +; if card was in Bench, simply shift Pokemon slots... + ldh a, [hTemp_ffa0] + or a + jr z, .switch + call ShiftAllPokemonToFirstPlayAreaSlots + ret + +.switch +; ...if Pokemon was in Arena, then switch it with the selected Bench card. + ldh a, [hTempPlayAreaLocation_ffa1] + ld d, a + ld e, PLAY_AREA_ARENA + call SwapPlayAreaPokemon + call ShiftAllPokemonToFirstPlayAreaSlots + ret +; 0x2f826 + +; return carry if no other cards in hand, +; or if there are no Pokemon cards in hand. +PokemonTrader_HandDeckCheck: ; 2f826 (b:7826) + ld a, DUELVARS_NUMBER_OF_CARDS_IN_HAND + call GetTurnDuelistVariable + ldtx hl, ThereAreNoCardsInHandThatYouCanChangeText + cp 2 + ret c ; return if no other cards in hand + call CreatePokemonCardListFromHand + ldtx hl, ThereAreNoCardsInHandThatYouCanChangeText + ret +; 0x2f838 + +PokemonTrader_PlayerHandSelection: ; 2f838 (b:7838) +; print text box + ldtx hl, ChooseCardFromYourHandToSwitchText + call DrawWideTextBox_WaitForInput + +; create list with all Pokemon cards in hand + call CreatePokemonCardListFromHand + bank1call Func_5591 + +; handle Player selection + ldtx hl, ChooseCardToSwitchText + ldtx de, DuelistHandText + bank1call SetCardListHeaderText + bank1call DisplayCardList + ldh [hTemp_ffa0], a + ret +; 0x2f853 + +PokemonTrader_PlayerDeckSelection: ; 2f853 (b:7853) +; temporarily place chosen hand card in deck +; so it can be potentially chosen to be traded. + ldh a, [hTemp_ffa0] + call RemoveCardFromHand + call ReturnCardToDeck + +; display deck card list screen + ldtx hl, ChooseBasicOrEvolutionPokemonCardFromDeckText + call DrawWideTextBox_WaitForInput + call CreateDeckCardList + bank1call Func_5591 + ldtx hl, ChoosePokemonCardText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText + +; handle Player selection +.read_input + bank1call DisplayCardList + jr c, .read_input ; pressing B loops back to selection + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + jr nc, .read_input ; can't select non-Pokemon cards + +; a valid card was selected, store its card index and +; place the selected hand card back to the hand. + ldh a, [hTempCardIndex_ff98] + ldh [hTempPlayAreaLocation_ffa1], a + ldh a, [hTemp_ffa0] + call SearchCardInDeckAndAddToHand + call AddCardToHand + or a + ret +; 0x2f88d + +PokemonTrader_TradeCardsEffect: ; 2f88d (b:788d) +; place hand card in deck + ldh a, [hTemp_ffa0] + call RemoveCardFromHand + call ReturnCardToDeck + +; place deck card in hand + ldh a, [hTempPlayAreaLocation_ffa1] + call SearchCardInDeckAndAddToHand + call AddCardToHand + +; display cards if the Pokemon Trader wasn't played by Player + call IsPlayerTurn + jr c, .done + ldh a, [hTemp_ffa0] + ldtx hl, PokemonWasReturnedToDeckText + bank1call DisplayCardDetailScreen + ldh a, [hTempPlayAreaLocation_ffa1] + ldtx hl, WasPlacedInTheHandText + bank1call DisplayCardDetailScreen +.done + call Func_2c0bd + ret +; 0x2f8b6 + +; makes list in wDuelTempList with all Pokemon cards +; that are in Turn Duelist's hand. +; if list turns out empty, return carry. +CreatePokemonCardListFromHand: ; 2f8b6 (b:78b6) + ld a, DUELVARS_NUMBER_OF_CARDS_IN_HAND + call GetTurnDuelistVariable + ld c, a + ld l, DUELVARS_HAND + ld de, wDuelTempList +.loop + ld a, [hl] + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + jr nc, .next_hand_card + ld a, [hl] + ld [de], a + inc de +.next_hand_card + inc l + dec c + jr nz, .loop + ld a, $ff ; terminating byte + ld [de], a + ld a, [wDuelTempList] + cp $ff + jr z, .set_carry + or a + ret +.set_carry + scf + ret +; 0x2f8e1 + +; return carry if no cards in deck +Pokedex_DeckCheck: ; 2f8e1 (b:78e1) + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetTurnDuelistVariable + ldtx hl, NoCardsLeftInTheDeckText + cp DECK_SIZE + ccf + ret +; 0x2f8ed + +Pokedex_PlayerSelection: ; 2f8ed (b:78ed) +; print text box + ldtx hl, RearrangeThe5CardsAtTopOfDeckText + call DrawWideTextBox_WaitForInput + +; cap the number of cards to reorder up to +; number of cards left in the deck (maximum of 5) + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetTurnDuelistVariable + ld b, a + ld a, DECK_SIZE + sub [hl] + ld c, 5 + cp c + jr nc, .no_cap + ld c, a +.no_cap + +; fill wDuelTempList with cards that are going to be sorted + ld a, c + inc a + ld [wNumberOfCardsToOrder], a + ld a, b + add DUELVARS_DECK_CARDS + ld l, a + ld de, wDuelTempList +.loop_cards_to_order + ld a, [hli] + ld [de], a + inc de + dec c + jr nz, .loop_cards_to_order + ld a, $ff ; terminating byte + ld [de], a + +.clear_list +; wDuelTempList + 10 will be filled with numbers from 1 +; to 5 (or whatever the maximum order card is). +; so that the first item in that list corresponds to the first card +; the second item corresponds to the second card, etc. +; and the number in the list corresponds to the ordering number. + call CountCardsInDuelTempList + ld b, a + ld a, 1 +; fill order list with zeroes + ldh [hCurSelectionItem], a + ld hl, wDuelTempList + 10 + xor a +.loop_init + ld [hli], a + dec b + jr nz, .loop_init + ld [hl], $ff ; terminating byte + +; display card list to order + bank1call InitAndDrawCardListScreenLayout + ldtx hl, ChooseTheOrderOfTheCardsText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText + bank1call Func_5735 + +.read_input + bank1call DisplayCardList + jr c, .undo ; if B is pressed, undo last order selection + +; a card was selected, check if it's already been selected + ldh a, [hCurMenuItem] + ld e, a + ld d, $00 + ld hl, wDuelTempList + 10 + add hl, de + ld a, [hl] + or a + jr nz, .read_input ; already has an ordering number + +; hasn't been ordered yet, apply to it current ordering number +; and increase it by 1. + ldh a, [hCurSelectionItem] + ld [hl], a + inc a + ldh [hCurSelectionItem], a + +; refresh screen + push af + bank1call Func_5744 + pop af + +; check if we're done ordering + ldh a, [hCurSelectionItem] + ld hl, wNumberOfCardsToOrder + cp [hl] + jr c, .read_input ; if still more cards to select, loop back up + +; we're done selecting cards + call EraseCursor + ldtx hl, IsThisOKText + call YesOrNoMenuWithText_LeftAligned + jr c, .clear_list ; "No" was selected, start over + ; selection was confirmed + +; now wDuelTempList + 10 will be overwritten with the +; card indices in order of selection. + ld hl, wDuelTempList + 10 + ld de, wDuelTempList + ld c, 0 +.loop_write_indices + ld a, [hli] + cp $ff + jr z, .done_write_indices + push hl + push bc + ld c, a + ld b, $00 + ld hl, hTempCardIndex_ff9f + add hl, bc + ld a, [de] + ld [hl], a + pop bc + pop hl + inc de + inc c + jr .loop_write_indices + +.done_write_indices + ld b, $00 + ld hl, hTempList + add hl, bc + ld [hl], $ff ; terminating byte + or a + ret + +.undo +; undo last selection and get previous order number + ld hl, hCurSelectionItem + ld a, [hl] + cp 1 + jr z, .read_input ; already at first input, nothing to undo + dec a + ld [hl], a + ld c, a + ld hl, wDuelTempList + 10 +.asm_2f99e + ld a, [hli] + cp c + jr nz, .asm_2f99e + dec hl + ld [hl], $00 ; overwrite order number with 0 + bank1call Func_5744 + jr .read_input +; 0x2f9aa + +Pokedex_OrderDeckCardsEffect: ; 2f9aa (b:79aa) +; place cards in order to the hand. + ld hl, hTempList + ld c, 0 +.loop_place_hand + ld a, [hli] + cp $ff + jr z, .place_top_deck + call SearchCardInDeckAndAddToHand + inc c + jr .loop_place_hand + +.place_top_deck +; go to last card in list and iterate in decreasing order +; placing each card in top of deck. + dec hl + dec hl +.loop_place_deck + ld a, [hld] + call ReturnCardToDeck + dec c + jr nz, .loop_place_deck + ret +; 0x2f9c4 + +BillEffect: ; 2f9c4 (b:79c4) + ld a, 2 + bank1call DisplayDrawNCardsScreen + ld c, 2 +.loop_draw + call DrawCardFromDeck + jr c, .done + ldh [hTempCardIndex_ff98], a + call AddCardToHand + call IsPlayerTurn + jr nc, .skip_display_screen + push bc + bank1call DisplayPlayerDrawCardScreen + pop bc +.skip_display_screen + dec c + jr nz, .loop_draw +.done + ret +; 0x2f9e3 + +LassEffect: ; 2f9e3 (b:79e3) +; first discard Lass card that was used + ldh a, [hTempCardIndex_ff9f] + call RemoveCardFromHand + call PutCardInDiscardPile + + ldtx hl, PleaseCheckTheOpponentsHandText + call DrawWideTextBox_WaitForInput + + call .DisplayLinkOrCPUHand + ; do for non-Turn Duelist + call SwapTurn + call .ShuffleDuelistHandTrainerCardsInDeck + call SwapTurn + ; do for Turn Duelist +; fallthrough + +.ShuffleDuelistHandTrainerCardsInDeck + call CreateHandCardList + call SortCardsInDuelTempListByID + xor a + ldh [hCurSelectionItem], a + ld hl, wDuelTempList + +; go through all cards in hand +; and any Trainer card is returned to deck. +.loop_hand + ld a, [hli] + ldh [hTempCardIndex_ff98], a + cp $ff + jr z, .done + call GetCardIDFromDeckIndex + call GetCardType + cp TYPE_TRAINER + jr nz, .loop_hand + ldh a, [hTempCardIndex_ff98] + call RemoveCardFromHand + call ReturnCardToDeck + push hl + ld hl, hCurSelectionItem + inc [hl] + pop hl + jr .loop_hand +.done +; show card list + ldh a, [hCurSelectionItem] + or a + call nz, Func_2c0bd ; only show list if there were any Trainer cards + ret +; 0x2fa31 + +.DisplayLinkOrCPUHand ; 2fa31 (b:7a31) + ld a, [wDuelType] + or a + jr z, .cpu_opp + +; link duel + ldh a, [hWhoseTurn] + push af + ld a, OPPONENT_TURN + ldh [hWhoseTurn], a + call .DisplayOppHand + pop af + ldh [hWhoseTurn], a + ret + +.cpu_opp + call SwapTurn + call .DisplayOppHand + call SwapTurn + ret +; 0x2fa4f + +.DisplayOppHand ; 2fa4f (b:7a4f) + call CreateHandCardList + jr c, .no_cards + bank1call InitAndDrawCardListScreenLayout + ldtx hl, ChooseTheCardYouWishToExamineText + ldtx de, DuelistHandText + bank1call SetCardListHeaderText + ld a, A_BUTTON | START + ld [wNoItemSelectionMenuKeys], a + bank1call DisplayCardList + ret +.no_cards + ldtx hl, DuelistHasNoCardsInHandText + call DrawWideTextBox_WaitForInput + ret +; 0x2fa70 + +; return carry if not enough cards in hand for effect +Maintenance_HandCheck: ; 2fa70 (b:7a70) + ld a, DUELVARS_NUMBER_OF_CARDS_IN_HAND + call GetTurnDuelistVariable + ldtx hl, NotEnoughCardsInHandText + cp 3 + ret +; 0x2fa7b + +Maintenance_PlayerSelection: ; 2fa7b (b:7a7b) + ldtx hl, Choose2HandCardsFromHandToReturnToDeckText + ldtx de, ChooseTheCardToPutBackText + call HandlePlayerSelection2HandCards + ret +; 0x2fa85 + +Maintenance_ReturnToDeckAndDrawEffect: ; 2fa85 (b:7a85) +; return both selected cards to the deck + ldh a, [hTempList] + call RemoveCardFromHand + call ReturnCardToDeck + ldh a, [hTempList + 1] + call RemoveCardFromHand + call ReturnCardToDeck + call Func_2c0bd + +; draw one card + ld a, 1 + bank1call DisplayDrawNCardsScreen + call DrawCardFromDeck + ldh [hTempCardIndex_ff98], a + call AddCardToHand + call IsPlayerTurn + ret nc + ; show card on screen if played by Player + bank1call DisplayPlayerDrawCardScreen + ret +; 0x2faad + +; return carry if no cards in deck +PokeBall_DeckCheck: ; 2faad (b:7aad) + ld a, DUELVARS_NUMBER_OF_CARDS_NOT_IN_DECK + call GetTurnDuelistVariable + ldtx hl, NoCardsLeftInTheDeckText + cp DECK_SIZE + ccf + ret +; 0x2fab9 + +PokeBall_PlayerSelection: ; 2fab9 (b:7ab9) + ld de, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call Func_2c08a + ldh [hTempList], a ; store coin result + ret nc + +; create list of all Pokemon cards in deck to search for + call CreateDeckCardList + ldtx hl, ChooseBasicOrEvolutionPokemonCardFromDeckText + ldtx bc, EvolutionCardText + lb de, SEARCHEFFECT_POKEMON, 0 + call LookForCardsInDeck + jr c, .no_pkmn ; return if Player chose not to check deck + +; handle input + bank1call Func_5591 + ldtx hl, ChoosePokemonCardText + ldtx de, DuelistDeckText + bank1call SetCardListHeaderText +.read_input + bank1call DisplayCardList + jr c, .try_exit ; B was pressed, check if Player can cancel operation + ldh a, [hTempCardIndex_ff98] + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + jr nc, .play_sfx ; can't select non-Pokemon card + ldh a, [hTempCardIndex_ff98] + ldh [hTempList + 1], a + or a + ret + +.no_pkmn + ld a, $ff + ldh [hTempList + 1], a + or a + ret + +.play_sfx + call Func_3794 + jr .read_input + +.try_exit +; Player can only exit screen if there are no cards to choose + ld hl, wDuelTempList +.loop + ld a, [hli] + cp $ff + jr z, .no_pkmn + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + jr nc, .loop + jr .read_input +; 0x2fb15 + +PokeBall_AddToHandEffect: ; 2fb15 (b:7b15) + ldh a, [hTempList] + or a + ret z ; return if coin toss was tails + + ldh a, [hTempList + 1] + cp $ff + jr z, .done ; skip if no Pokemon was chosen + +; add Pokemon card to hand and show in screen if +; it wasn't the Player who played the Trainer card. + call SearchCardInDeckAndAddToHand + call AddCardToHand + call IsPlayerTurn + jr c, .done + ldh a, [hTempList + 1] + ldtx hl, WasPlacedInTheHandText + bank1call DisplayCardDetailScreen +.done + call Func_2c0bd + ret +; 0x2fb36 + +; return carry if no cards in the Discard Pile +Recycle_DiscardPileCheck: ; 2fb36 (b:7b36) + ld a, DUELVARS_NUMBER_OF_CARDS_IN_DISCARD_PILE + call GetTurnDuelistVariable + ldtx hl, ThereAreNoCardsInTheDiscardPileText + cp 1 + ret +; 0x2fb41 + +Recycle_PlayerSelection: ; 2fb41 (b:7b41) + ld de, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call Func_2c08a + jr nc, .tails + + call CreateDiscardPileCardList + bank1call Func_5591 + ldtx hl, PleaseSelectCardText + ldtx de, PlayerDiscardPileText + bank1call SetCardListHeaderText +.read_input + bank1call DisplayCardList + jr c, .read_input ; can't cancel with B button + +; Discard Pile card was chosen + ldh a, [hTempCardIndex_ff98] + ldh [hTempList], a + ret + +.tails + ld a, $ff + ldh [hTempList], a + or a + ret +; 0x2fb68 + +Recycle_AddToHandEffect: ; 2fb68 (b:7b68) + ldh a, [hTempList] + cp $ff + ret z ; return if no card was selected + +; add card to hand and show in screen if +; it wasn't the Player who played the Trainer card. + call MoveDiscardPileCardToHand + call ReturnCardToDeck + call IsPlayerTurn + ret c + ldh a, [hTempList] + ldtx hl, CardWasChosenText + bank1call DisplayCardDetailScreen + ret +; 0x2fb80 + +; return carry if Bench is full or +; if no Basic Pokemon cards in Discard Pile. +Revive_BenchCheck: ; 2fb80 (b:7b80) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ldtx hl, NoSpaceOnTheBenchText + cp MAX_PLAY_AREA_POKEMON + ccf + ret c + call CreateBasicPokemonCardListFromDiscardPile + ldtx hl, ThereAreNoPokemonInDiscardPileText + ret +; 0x2fb93 + +Revive_PlayerSelection: ; 2fb93 (b:7b93) +; create Basic Pokemon card list from Discard Pile + ldtx hl, ChooseBasicPokemonToPlaceOnBenchText + call DrawWideTextBox_WaitForInput + call CreateBasicPokemonCardListFromDiscardPile + bank1call Func_5591 + +; display screen to select Pokemon + ldtx hl, PleaseSelectCardText + ldtx de, PlayerDiscardPileText + bank1call SetCardListHeaderText + bank1call DisplayCardList + +; store selection + ldh a, [hTempCardIndex_ff98] + ldh [hTemp_ffa0], a + ret +; 0x2fbb0 + +Revive_PlaceInPlayAreaEffect: ; 2fbb0 (b:7bb0) +; place selected Pokemon in the Bench + ldh a, [hTemp_ffa0] + call MoveDiscardPileCardToHand + call AddCardToHand + call PutHandPokemonCardInPlayArea + +; set HP to half, rounded up + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + srl a + bit 0, a + jr z, .rounded + add 5 ; round up HP to nearest 10 +.rounded + ld [hl], a + call IsPlayerTurn + ret c ; done if Player played Revive + +; display card + ldh a, [hTemp_ffa0] + ldtx hl, PlacedOnTheBenchText + bank1call DisplayCardDetailScreen + ret +; 0x2fbd6 + +; makes list in wDuelTempList with all Basic Pokemon cards +; that are in Turn Duelist's Discard Pile. +; if list turns out empty, return carry. +CreateBasicPokemonCardListFromDiscardPile: ; 2fbd6 (b:7bd6) +; gets hl to point at end of Discard Pile cards +; and iterates the cards in reverse order. + ld a, DUELVARS_NUMBER_OF_CARDS_IN_DISCARD_PILE + call GetTurnDuelistVariable + ld b, a + add DUELVARS_DECK_CARDS + ld l, a + ld de, wDuelTempList + inc b + jr .next_discard_pile_card + +.check_card + ld a, [hl] + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Type] + cp TYPE_ENERGY + jr nc, .next_discard_pile_card ; if not Pokemon card, skip + ld a, [wLoadedCard2Stage] + or a + jr nz, .next_discard_pile_card ; if not Basic stage, skip + +; write this card'sindex to wDuelTempList + ld a, [hl] + ld [de], a + inc de +.next_discard_pile_card + dec l + dec b + jr nz, .check_card + +; done with the loop. + ld a, $ff ; terminating byte + ld [de], a + ld a, [wDuelTempList] + cp $ff + jr z, .set_carry + or a + ret +.set_carry + scf + ret +; 0x2fc0b + +; return carry if Turn Duelist has no Evolution cards in Play Area +DevolutionSpray_PlayAreaEvolutionCheck: ; 2fc0b (b:7c0b) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld c, a + ld l, DUELVARS_ARENA_CARD +.loop + ld a, [hli] + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Stage] + or a + ret nz ; found an Evolution card + dec c + jr nz, .loop + + ldtx hl, ThereAreNoStage1PokemonText + scf + ret +; 0x2fc24 + +DevolutionSpray_PlayerSelection: ; 2fc24 (b:7c24) +; display textbox + ldtx hl, ChooseEvolutionCardAndPressAButtonToDevolveText + call DrawWideTextBox_WaitForInput + +; have Player select an Evolution card in Play Area + ld a, 1 + ldh [hCurSelectionItem], a + bank1call HasAlivePokemonInPlayArea +.read_input + bank1call OpenPlayAreaScreenForSelection + ret c ; exit if B was pressed + bank1call GetCardOneStageBelow + jr c, .read_input ; can't select Basic cards + +; get pre-evolution card data + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + push hl + push af + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD_STAGE + ld l, a + ld a, [hl] + push hl + push af + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD + ld l, a + ld a, [hl] + push hl + push af + jr .update_data + +.repeat_devolution +; show Play Area screen with static cursor +; so that the Player either presses A to do one more devolution +; or presses B to finish selection. + bank1call Func_6194 + jr c, .done_selection ; if B pressed, end selection instead + ; do one more devolution + bank1call GetCardOneStageBelow + +.update_data +; overwrite the card data to new devolved stats + ld a, d + call UpdateDevolvedCardHPAndStage + call GetNextPositionInTempList_TrainerEffects + ld [hl], e + ld a, d + call LoadCardDataToBuffer2_FromDeckIndex + ld a, [wLoadedCard2Stage] + or a + jr nz, .repeat_devolution ; can do one more devolution + +.done_selection + call GetNextPositionInTempList_TrainerEffects + ld [hl], $ff ; terminating byte + +; store this Play Area location in first item of temp list + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTempList], a + +; update Play Area location display of this Pokemon + call EmptyScreen + ldh a, [hTempPlayAreaLocation_ff9d] + ld hl, wHUDEnergyAndHPBarsX + ld [hli], a + ld [hl], $00 + bank1call PrintPlayAreaCardInformationAndLocation + call EnableLCD + pop bc + pop hl + +; rewrite all duelvars from before the selection was done +; this is so that if "No" is selected in confirmation menu, +; then the Pokemon isn't devolved and remains unchanged. + ld [hl], b + ldtx hl, IsThisOKText + call YesOrNoMenuWithText + pop bc + pop hl + + ld [hl], b + pop bc + pop hl + + ld [hl], b + ret +; 0x2fc99 + +DevolutionSpray_DevolutionEffect: ; 2fc99 (b:7c99) +; first byte in list is Play Area location chosen + ld hl, hTempList + ld a, [hli] + ldh [hTempPlayAreaLocation_ff9d], a + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + push hl + push af + +; loop through devolutions selected + ld hl, hTempList + 1 +.loop_devolutions + ld a, [hl] + cp $ff + jr z, .check_ko ; list is over + ; devolve card to its stage below + push hl + bank1call GetCardOneStageBelow + ld a, d + call UpdateDevolvedCardHPAndStage + call ResetDevolvedCardStatus + pop hl + ld a, [hli] + call PutCardInDiscardPile + jr .loop_devolutions + +.check_ko + pop af + ld e, a + pop hl + ld d, [hl] + call PrintDevolvedCardNameAndLevelText + ldh a, [hTempList] + call PrintPlayAreaCardKnockedOutIfNoHP + bank1call Func_6e49 + ret +; 0x2fcd0 + +Func_2fcd0: ; 2fcd0 (b:7cd0) + call CheckIfThereAreAnyEnergyCardsAttached + ldtx hl, NoEnergyCardsAttachedToPokemonInYourPlayAreaText + ret c + call SwapTurn + call CheckIfThereAreAnyEnergyCardsAttached + ldtx hl, NoEnergyCardsAttachedToPokemonInOppPlayAreaText + call SwapTurn + ret +; 0x2fce4 + +Func_2fce4: ; 2fce4 (b:7ce4) +; handle selection of Energy to discard in own Play Area + ldtx hl, ChoosePokemonInYourAreaThenPokemonInYourOppText + call DrawWideTextBox_WaitForInput + call HandlePokemonAndEnergySelectionScreen + ret c ; return if operation was cancelled + + ldtx hl, ChoosePokemonToRemoveEnergyFromText + call DrawWideTextBox_WaitForInput + + call SwapTurn + ld a, 3 + ldh [hCurSelectionItem], a +.select_opp_pkmn + bank1call HasAlivePokemonInPlayArea + bank1call OpenPlayAreaScreenForSelection + jr nc, .opp_pkmn_selected + ; B was pressed + call SwapTurn + ret ; return if operation was cancelled +.opp_pkmn_selected + ld e, a + call GetPlayAreaCardAttachedEnergies + ld a, [wTotalAttachedEnergies] + or a + jr nz, .has_energy ; has any energy cards attached? + ; no energy, loop back + ldtx hl, NoEnergyCardsText + call DrawWideTextBox_WaitForInput + jr .select_opp_pkmn + +.has_energy +; store this Pokemon's Play Area location + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hPlayAreaEffectTarget], a + + bank1call CreateArenaOrBenchEnergyCardList + ldh a, [hTempPlayAreaLocation_ff9d] + bank1call DisplayEnergyDiscardScreen + ld a, 2 + ld [wcbfa], a +.asm_2fd2a + bank1call HandleEnergyDiscardMenuInput + jr nc, .asm_2fd4a + ld a, 5 + call AskWhetherToQuitSelectingCards + jr nc, .asm_2fd69 + ld a, [wcbfb] + push af + ldh a, [hTempPlayAreaLocation_ff9d] + bank1call DisplayEnergyDiscardScreen + ld a, 2 + ld [wcbfa], a + pop af + ld [wcbfb], a + jr .asm_2fd2a +.asm_2fd4a + call GetNextPositionInTempList_TrainerEffects + ldh a, [hTempCardIndex_ff98] + ld [hl], a + call RemoveCardFromDuelTempList + ld hl, wcbfb + inc [hl] + ldh a, [hCurSelectionItem] + cp $05 + jr nc, .asm_2fd69 + ld a, [wDuelTempList] + cp $ff + jr z, .asm_2fd69 + bank1call DisplayEnergyDiscardMenu + jr .asm_2fd2a +.asm_2fd69 + call GetNextPositionInTempList_TrainerEffects + ld [hl], $ff + call SwapTurn + or a + ret +; 0x2fd73 + + INCROM $2fd73, $2fe25 + +; outputs in hl the next position +; in hTempList to place a new card, +; and increments hCurSelectionItem. +; identical to GetNextPositionInTempList. +GetNextPositionInTempList_TrainerEffects: ; 2fe25 (b:7e25) + push de + ld hl, hCurSelectionItem + ld a, [hl] + inc [hl] + ld e, a + ld d, $00 + ld hl, hTempList + add hl, de + pop de + ret +; 0x2fe34 + +; handles screen for Player to select 2 cards from the hand to discard. +; first prints text informing Player to choose cards to discard +; then runs HandlePlayerSelection2HandCards routine. +HandlePlayerSelection2HandCardsToDiscard: ; 2fe34 (b:7e34) + ldtx hl, Choose2CardsFromHandToDiscardText + ldtx de, ChooseTheCardToDiscardText +; fallthrough + +; handles screen for Player to select 2 cards from the hand +; to activate some Trainer card effect. +; assumes Trainer card index being used is in [hTempCardIndex_ff9f]. +; stores selection of cards in hTempList. +; returns carry if Player cancels operation. +; input: +; hl = text to print in text box; +; de = text to print in screen header. +HandlePlayerSelection2HandCards: ; 2fe3a (b:7e3a) + push de + call DrawWideTextBox_WaitForInput + +; remove the Trainer card being used from list +; of cards to select from hand. + call CreateHandCardList + ldh a, [hTempCardIndex_ff9f] + call RemoveCardFromDuelTempList + + xor a + ldh [hCurSelectionItem], a + pop hl +.loop + push hl + bank1call Func_5591 + pop hl + bank1call SetCardListInfoBoxText + push hl + bank1call DisplayCardList + pop hl + jr c, .set_carry ; was B pressed? + push hl + call GetNextPositionInTempList_TrainerEffects + ldh a, [hTempCardIndex_ff98] + ld [hl], a + call RemoveCardFromDuelTempList + pop hl + ldh a, [hCurSelectionItem] + cp 2 + jr c, .loop ; is selection over? + or a + ret +.set_carry + scf + ret +; 0x2fe6e + + INCROM $2fe6e, $2fea9 + +; input: +; a = move animation to play +Func_2fea9: ; 2fea9 (b:7ea9) + ld [wLoadedMoveAnimation], a + bank1call Func_7415 + ld bc, $0 + ldh a, [hWhoseTurn] + ld h, a + bank1call PlayMoveAnimation + bank1call WaitMoveAnimation + ret +; 0x2febc + +; heals amount of damage in register e for card in +; Play Area location in [hTempPlayAreaLocation_ff9d]. +; plays healing animation and prints text with card's name. +; input: +; e = amount of HP to heal +; [hTempPlayAreaLocation_ff9d] = Play Area location of card to heal +HealPlayAreaCardHP: ; 2febc (b:7ebc) + ld e, a + ld d, $00 + +; play heal animation + push de + bank1call Func_7415 + ld a, $86 + ld [wLoadedMoveAnimation], a + ldh a, [hTempPlayAreaLocation_ff9d] + ld b, a + ld c, $01 + ldh a, [hWhoseTurn] + ld h, a + bank1call PlayMoveAnimation + bank1call WaitMoveAnimation + pop hl + +; print Pokemon card name and damage healed + push hl + call LoadTxRam3 + ld hl, $0000 + call LoadTxRam2 + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD + call GetTurnDuelistVariable + call LoadCardDataToBuffer1_FromDeckIndex + ld a, 18 + call CopyCardNameAndLevel + ld [hl], $00 ; terminating character on end of the name + ldtx hl, PokemonHealedDamageText + call DrawWideTextBox_WaitForInput + pop de + +; heal the target Pokemon + ldh a, [hTempPlayAreaLocation_ff9d] + add DUELVARS_ARENA_CARD_HP + call GetTurnDuelistVariable + add e + ld [hl], a + ret +; 0x2ff03 - INCROM $2f513, $30000 +rept $fd + db $ff +endr diff --git a/src/engine/home.asm b/src/engine/home.asm index 78e0bf1..11a7c37 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. @@ -2816,7 +2778,7 @@ ExchangeRNG: ; 0f58 (0:0f58) ; send 10 bytes of data to the other game from hOppActionTableIndex, hTempCardIndex_ff9f, ; hTemp_ffa0, and hTempPlayAreaLocation_ffa1, and hTempRetreatCostCards. ; finally exchange RNG data. -; the receiving side will use this data to read the OPP_ACTION_* value in +; the receiving side will use this data to read the OPPACTION_* value in ; [hOppActionTableIndex] and match it by calling the correspoding OppAction* function SetOppAction_SerialSendDuelData: ; 0f7f (0:0f7f) push hl @@ -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,9 +3602,9 @@ GetCardIDFromDeckIndex: ; 1324 (0:1324) pop hl pop af ret -; 0x132f ; remove card c from wDuelTempList (it contains a $ff-terminated list of deck indexes) +; returns carry if no matches were found. RemoveCardFromDuelTempList: ; 132f (0:132f) push hl push de @@ -3698,7 +3636,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 +3652,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,12 +3702,11 @@ 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. -; return nc if evolution was succesful. -EvolvePokemonCard: ; 13a2 (0:13a2) +; into another turn holder's Pokemon card identifier by its deck index (0-59) in hTempCardIndex_ff98. +; return nc if evolution was successful. +EvolvePokemonCardIfPossible: ; 13a2 (0:13a2) ; first make sure the attempted evolution is viable ldh a, [hTempCardIndex_ff98] ld d, a @@ -3779,7 +3714,12 @@ EvolvePokemonCard: ; 13a2 (0:13a2) ld e, a call CheckIfCanEvolveInto ret c ; return if it's not capable of evolving into the selected Pokemon - ; place the evolved Pokemon card in the play area location of the pre-evolved Pokemon card +; fallthrough + +; 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 its deck index (0-59) in hTempCardIndex_ff98. +EvolvePokemonCard: ; 13ac (0:13ac) +; place the evolved Pokemon card in the play area location of the pre-evolved Pokemon card ldh a, [hTempPlayAreaLocation_ff9d] ld e, a add DUELVARS_ARENA_CARD @@ -3804,7 +3744,7 @@ EvolvePokemonCard: ; 13a2 (0:13a2) ld [hl], a ; reset status (if in arena) and set the flag that prevents it from evolving again this turn ld a, e - add DUELVARS_ARENA_CARD_FLAGS_C2 + add DUELVARS_ARENA_CARD_FLAGS ld l, a ld [hl], $00 ld a, e @@ -3826,7 +3766,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. @@ -3852,7 +3791,7 @@ CheckIfCanEvolveInto: ; 13f7 (0:13f7) jr nz, .cant_evolve ; jump if they are incompatible to evolve pop de ld a, e - add DUELVARS_ARENA_CARD_FLAGS_C2 + add DUELVARS_ARENA_CARD_FLAGS call GetTurnDuelistVariable and CAN_EVOLVE_THIS_TURN jr nz, .can_evolve @@ -3869,7 +3808,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. @@ -3878,7 +3816,7 @@ CheckIfCanEvolveInto: ; 13f7 (0:13f7) ; return carry if not basic to stage 2 evolution, or if evolution not possible this turn. CheckIfCanEvolveInto_BasicToStage2: ; 142b (0:142b) ld a, e - add DUELVARS_ARENA_CARD_FLAGS_C2 + add DUELVARS_ARENA_CARD_FLAGS call GetTurnDuelistVariable and CAN_EVOLVE_THIS_TURN jr nz, .can_evolve @@ -3912,7 +3850,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 +3882,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. @@ -3974,7 +3910,7 @@ PutHandPokemonCardInPlayArea: ; 1485 (0:1485) ld l, a ld a, [wLoadedCard2HP] ld [hl], a ; set card's HP - ld a, DUELVARS_ARENA_CARD_FLAGS_C2 + ld a, DUELVARS_ARENA_CARD_FLAGS add e ld l, a ld [hl], $0 @@ -4006,7 +3942,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 +3957,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 +3980,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 +4004,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 +4012,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 +4030,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. @@ -4127,7 +4057,7 @@ SwapPlayAreaPokemon: ; 1548 (0:1548) call .swap_duelvar ld a, DUELVARS_ARENA_CARD_HP call .swap_duelvar - ld a, DUELVARS_ARENA_CARD_FLAGS_C2 + ld a, DUELVARS_ARENA_CARD_FLAGS call .swap_duelvar ld a, DUELVARS_ARENA_CARD_STAGE call .swap_duelvar @@ -4178,7 +4108,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 +4177,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 +4227,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 +4301,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 @@ -4459,8 +4385,8 @@ Func_16f6: ; 16f6 (0:16f6) ld [wEffectFailed], a ld [wIsDamageToSelf], a ld [wccef], a - ld [wccf0], a - ld [wNoEffectFromStatus], a + ld [wMetronomeEnergyCost], a + ld [wNoEffectFromWhichStatus], a bank1call ClearNonTurnTemporaryDuelvars_CopyStatus ret @@ -4596,7 +4522,7 @@ ClearNonTurnTemporaryDuelvars_ResetCarry: ; 1823 (0:1823) ret ; called when attacker deals damage to itself due to confusion -; display the corresponding animation and deal damage to self +; display the corresponding animation and deal 20 damage to self HandleConfusionDamageToSelf: ; 1828 (0:1828) bank1call DrawDuelMainScene ld a, 1 @@ -4714,7 +4640,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 +4681,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,15 +4695,18 @@ LoadNonPokemonCardEffectCommands: ; 1944 (0:1944) ld a, [hl] ld [de], a ret -; 0x1955 -Func_1955: ; 1955 (0:1955) +; Make turn holder deal A damage to self due to recoil (e.g. Thrash, Selfdestruct) +; display recoil animation +DealRecoilDamageToSelf: ; 1955 (0:1955) push af ld a, $7a ld [wLoadedMoveAnimation], a pop af ; fallthrough +; Make turn holder deal A damage to self due to confusion +; display animation at wLoadedMoveAnimation DealConfusionDamageToSelf: ; 195c (0:195c) ld hl, wDamage ld [hli], a @@ -5044,15 +4971,22 @@ 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. ; shows the defending player's play area screen when dealing the damage -; instead of the main duel interface, and has a fixed move animation. -DealDamageToPlayAreaPokemon: ; 1af3 (0:1af3) +; instead of the main duel interface with regular attack animation. +DealDamageToPlayAreaPokemon_RegularAnim: ; 1af3 (0:1af3) ld a, $78 ld [wLoadedMoveAnimation], a +; fallthrough + +; deal damage to turn holder's Pokemon card at play area location at b (PLAY_AREA_*). +; damage to deal is given in de. +; shows the defending player's play area screen when dealing the damage +; instead of the main duel interface. +; plays animation that is loaded in wLoadedMoveAnimation. +DealDamageToPlayAreaPokemon: ; 1af8 (0:1af8) ld a, b ld [wTempPlayAreaLocation_cceb], a or a ; cp PLAY_AREA_ARENA @@ -5140,7 +5074,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 +5150,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 +5160,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,11 +5189,14 @@ 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 -GetCardDamage: ; 1c35 (0:1c35) +; calculate damage and max HP of card at PLAY_AREA_* in e. +; input: +; e = PLAY_AREA_* of card; +; output: +; a = damage; +; c = max HP. +GetCardDamageAndMaxHP: ; 1c35 (0:1c35) push hl push de ld a, DUELVARS_ARENA_CARD @@ -5280,7 +5214,6 @@ GetCardDamage: ; 1c35 (0:1c35) pop de pop hl ret -; 0x1c50 ; check if a flag of wLoadedMove is set ; input: @@ -5316,7 +5249,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 +5491,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 +5521,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 +5904,6 @@ FillRectangle: ; 1f5f (0:1f5f) add sp, $24 pop de ret -; 0x1f96 Func_1f96: ; 1f96 (0:1f96) add sp, -10 @@ -6108,7 +6037,6 @@ Func_1f96: ; 1f96 (0:1f96) add sp, 10 scf ret -; 0x2046 Func_2046: ; 2046 (0:2046) ld hl, sp+3 @@ -6140,7 +6068,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 +6101,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 +6109,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 +6120,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 +6210,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 +6238,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 +6257,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 +6276,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 +6292,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 +6762,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 +6844,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 +7102,6 @@ GetFullWidthFontTileOffset: ; 256d (0:256d) add hl, hl add hl, bc ret -; 0x2589 ; pointers to VRAM? Unknown_2589: ; 2589 (0:2589) @@ -7238,7 +7154,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 +7191,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 +7206,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 +7457,6 @@ HandleDuelMenuInput: ; 271a (0:271a) ld e, a or a ret -; 0x278d DuelMenuCursorCoords: ; 278d (0:278d) db 2, 14 ; Hand @@ -7645,7 +7557,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 +7566,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 +7580,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 +7749,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 +7759,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 +7776,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 +7794,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 +7806,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 +7838,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 +7859,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 +7906,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 +8034,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 +8124,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 +8297,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 +8332,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 +8759,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 +8774,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 +8790,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 +8836,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 +9612,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 +9633,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 +9695,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 +9736,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 +9897,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 +9925,6 @@ CheckNoDamageOrEffect: ; 34b7 (0:34b7) ld hl, $0000 scf ret -; 0x34d8 NoDamageOrEffectTextIDTable: ; 34d8 (0:34d8) tx NoDamageOrEffectDueToAgilityText ; NO_DAMAGE_OR_EFFECT_AGILITY @@ -10047,7 +9932,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 +10036,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 +10070,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 +10085,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 +10096,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 +10107,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 +10130,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 +10162,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 +10172,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 +10190,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 +10229,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 +10284,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 +10305,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) @@ -10447,7 +10319,7 @@ GetPlayAreaCardColor: ; 36f7 (0:36f7) ld e, a add DUELVARS_ARENA_CARD_CHANGED_TYPE call GetTurnDuelistVariable - bit 7, a + bit HAS_CHANGED_COLOR_F, a jr nz, .has_changed_color .regular_color ld a, e @@ -10473,7 +10345,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 +10370,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 +10395,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 +10418,6 @@ HandleEnergyBurn: ; 375d (0:375d) ld a, [wTotalAttachedEnergies] ld [wAttachedEnergies], a ret -; 0x377f SetupSound: ; 377f (0:377f) farcall _SetupSound @@ -10584,7 +10452,6 @@ PauseSong: ; 379b (0:379b) ResumeSong: ; 37a0 (0:37a0) farcall _ResumeSong ret -; 0x37a5 Func_37a5: ; 37a5 (0:37a5) ldh a, [hBankROM] @@ -10606,7 +10473,6 @@ Func_37a5: ; 37a5 (0:37a5) pop af call BankswitchROM ret -; 0x37c5 Func_37c5: ; 37c5 (0:37c5) ld c, $08 @@ -10666,7 +10532,6 @@ Func_37c5: ; 37c5 (0:37c5) dec c jr nz, .asm_37c7 ret -; 0x380e Func_380e: ; 380e (0:380e) ld a, [wd0c1] @@ -10829,7 +10694,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 +10704,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 +10721,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 +10844,6 @@ FindLoadedNPC: ; 39c3 (0:39c3) pop bc pop hl ret -; 0x39ea Func_39ea: ; 39ea (0:39ea) push bc @@ -10997,7 +10858,6 @@ Func_39ea: ; 39ea (0:39ea) ld a, c pop bc ret -; 0x39fc Func_39fc: ; 39fc (0:39fc) push hl @@ -11048,17 +10908,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 +10929,6 @@ Func_3a4f: ; 3a4f (0:3a4f) pop bc pop af ret -; 0x3a5e HandleMoveModeAPress: ; 3a5e (0:3a5e) ldh a, [hBankROM] @@ -11167,12 +11023,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 +11055,6 @@ RunOverworldScript: ; 3aed (0:3aed) call BankswitchROM pop bc jp hl -; 0x3b11 Func_3b11: ; 3b11 (0:3b11) ldh a, [hBankROM] @@ -11212,14 +11065,14 @@ Func_3b11: ; 3b11 (0:3b11) pop af call BankswitchROM ret -; 0x3b21 Func_3b21: ; 3b21 (0:3b21) ldh a, [hBankROM] push af - ld a, $07 + ld a, BANK(Func_1c8bc) call BankswitchROM - call $48bc + call Func_1c8bc + pop af call BankswitchROM ret @@ -11294,7 +11147,6 @@ Func_3b6a: ; 3b6a (0:3b6a) pop af call BankswitchROM ret -; 0x3ba2 Func_3ba2: ; 3ba2 (0:3ba2) ldh a, [hBankROM] @@ -11306,7 +11158,6 @@ Func_3ba2: ; 3ba2 (0:3ba2) pop af call BankswitchROM ret -; 0x3bb5 Func_3bb5: ; 3bb5 (0:3bb5) xor a @@ -11322,7 +11173,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 +11188,6 @@ ResetDoFrameFunction: ; 3bdb (0:3bdb) call SetDoFrameFunction pop hl ret -; 0x3be4 Func_3be4: ; 3be4 (0:3be4) ldh a, [hBankROM] @@ -11349,7 +11198,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 +11215,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 +11233,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 +11250,6 @@ FillMemoryWithDE: ; 3c1f (0:3c1f) pop bc pop hl ret -; 0x3c2d Func_3c2d: ; 3c2d (0:3c2d) push hl @@ -11424,15 +11269,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 +11327,6 @@ DivideBCbyDE: ; 3c5a (0:3c5a) CallPlaySong: ; 3c83 (0:3c83) call PlaySong ret -; 0x3c87 Func_3c87: ; 3c87 (0:3c87) push af @@ -11495,7 +11336,6 @@ Func_3c87: ; 3c87 (0:3c87) call WaitForSongToFinish call ResumeSong ret -; 0x3c96 WaitForSongToFinish: ; 3c96 (0:3c96) call DoFrameIfLCDEnabled @@ -11522,141 +11362,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 +11515,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 +11537,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 +11567,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 +11605,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 +11629,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 +11640,6 @@ Func_3e31: ; 3e31 (0:3e31) pop af call BankswitchROM ret -; 0x3e44 ; something window scroll Func_3e44: ; 3e44 (0:3e44) @@ -11860,7 +11697,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 +11751,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 +11786,6 @@ GetNextBackgroundScroll: ; 3f38 (0:3f38) sra a .done ret -; 0x3f5a ; enable lcdc interrupt on LYC=LC coincidence EnableInt_LYCoincidence: ; 3f5a (0:3f5a) @@ -11963,7 +11797,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 +11808,6 @@ DisableInt_LYCoincidence: ; 3f68 (0:3f68) res INT_LCD_STAT, [hl] pop hl ret -; 0x3f76 rept $6a db $ff diff --git a/src/hram.asm b/src/hram.asm index f22b172..9aa1504 100644 --- a/src/hram.asm +++ b/src/hram.asm @@ -77,12 +77,15 @@ hOppActionTableIndex:: ; ff9e hTempCardIndex_ff9f:: ; ff9f ds $1 +UNION + ; multipurpose temp storage (card's deck index, selected move index, status condition...) hTemp_ffa0:: ; ffa0 ds $1 ; a PLAY_AREA_* constant (0: arena card, 1-5: bench card) hTempPlayAreaLocation_ffa1:: ; ffa1 + ; parameter to be used by the AI's Pkmn Power effect hAIPkmnPowerEffectParam:: ; ffa1 ds $1 @@ -99,16 +102,24 @@ NEXTU ; the deck index (0-59) of the energy card to transfer ; and the Play Area location (PLAY_AREA_*) of card to receive that energy card. hAIEnergyTransEnergyCard:: ; ffa2 + +; PLAY_AREA_* of target selected for some Pkmn Powers, +; (e.g. Curse, Damage Swap) and for trainer card effect. +hPlayAreaEffectTarget:: ; ffa2 ds $1 + hAIEnergyTransPlayAreaLocation:: ; ffa3 ds $1 +ENDU + NEXTU -; Play Area location (PLAY_AREA_*) of card -; chosen by AI to use Heal Pkmn Power on. -hAIHealCard:: ; ffa2 - ds $1 +; list of various items, such as +; cards selected for various effects, +; Play Area locations, etc. +hTempList:: ; ffa0 + ds $8 ENDU @@ -153,7 +164,11 @@ hffb0:: ; ffb0 hCurMenuItem:: ; ffb1 ds $1 - ds $3 +; stores the item number in the selection menu of various effects +hCurSelectionItem:: ; ffb2 + ds $1 + + ds $2 hffb5:: ; ffb5 ds $1 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 bd1a58f..ed7b30d 100644 --- a/src/macros/scripts.asm +++ b/src/macros/scripts.asm @@ -27,14 +27,14 @@ ENDM const ScriptCommand_MoveActiveNPCByDirection_index ; $0a const ScriptCommand_CloseTextBox_index ; $0b const ScriptCommand_GiveBoosterPacks_index ; $0c - const Func_cf0c_index ; $0d - const Func_cf12_index ; $0e + const ScriptCommand_CheckIfCardInCollectionOrDecks_index ; $0d + const ScriptCommand_CheckIfCardInCollection_index ; $0e const ScriptCommand_GiveCard_index ; $0f const ScriptCommand_TakeCard_index ; $10 const Func_cf53_index ; $11 const Func_cf7b_index ; $12 - const Func_cf2d_index ; $13 - const Func_cf96_index ; $14 + const ScriptCommand_CheckRawAmountOfCardsOwned_index ; $13 + const ScriptCommand_JumpBasedOnFightingClubPupilStatus_index ; $14 const Func_cfc6_index ; $15 const Func_cfd4_index ; $16 const Func_d00b_index ; $17 @@ -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/text1.asm b/src/text/text1.asm index 07d7a7a..fa1d585 100644 --- a/src/text/text1.asm +++ b/src/text/text1.asm @@ -290,11 +290,11 @@ DuelistPlacedACardText: ; 367f9 (d:67f9) line "a <RAMTEXT>." done -Text0045: ; 36808 (d:6808) +UnableToSelectText: ; 36808 (d:6808) text "Unable to select." done -Text0046: ; 3681b (d:681b) +ColorListText: ; 3681b (d:681b) text "Grass" line "Fire" line "Water" @@ -303,31 +303,31 @@ Text0046: ; 3681b (d:681b) line "Psychic" done -Text0047: ; 36848 (d:6848) +GrassSymbolText: ; 36848 (d:6848) textfw0 "<GRASS>" done -Text0048: ; 3684b (d:684b) +FireSymbolText: ; 3684b (d:684b) textfw0 "<FIRE>" done -Text0049: ; 3684e (d:684e) +WaterSymbolText: ; 3684e (d:684e) textfw0 "<WATER>" done -Text004a: ; 36851 (d:6851) +LightningSymbolText: ; 36851 (d:6851) textfw0 "<LIGHTNING>" done -Text004b: ; 36854 (d:6854) +FightingSymbolText: ; 36854 (d:6854) textfw0 "<FIGHTING>" done -Text004c: ; 36857 (d:6857) +PsychicSymbolText: ; 36857 (d:6857) textfw0 "<PSYCHIC>" done -Text004d: ; 3685a (d:685a) +BenchText: ; 3685a (d:685a) text "Bench" done @@ -821,17 +821,17 @@ NoEnergyAttachedToOpponentsActiveText: ; 3742a (d:742a) line "the opponent's Active Pokémon." done -Text00af: ; 3746a (d:746a) +ThereAreNoEnergyCardsInDiscardPileText: ; 3746a (d:746a) text "There are no Energy cards" line "in the the Discard Pile." done -Text00b0: ; 3749e (d:749e) +ThereAreNoBasicEnergyCardsInDiscardPileText: ; 3749e (d:749e) text "There are no Basic Energy cards" line "in the Discard Pile." done -Text00b1: ; 374d4 (d:74d4) +NoCardsLeftInTheDeckText: ; 374d4 (d:74d4) text "There are no cards left in the Deck." done @@ -849,50 +849,50 @@ CantEvolvePokemonInSameTurnItsPlacedText: ; 37546 (d:7546) line "in the same turn it was placed." done -Text00b5: ; 37583 (d:7583) +NotAffectedByPoisonSleepParalysisOrConfusionText: ; 37583 (d:7583) text "Not affected by Poison," line "Sleep, Paralysis, or Confusion." done -Text00b6: ; 375bc (d:75bc) +NotEnoughCardsInHandText: ; 375bc (d:75bc) text "Not enough cards in Hand." done -Text00b7: ; 375d7 (d:75d7) +EffectNoPokemonOnTheBenchText: ; 375d7 (d:75d7) text "No Pokémon on the Bench." done -Text00b8: ; 375f1 (d:75f1) +ThereAreNoPokemonInDiscardPileText: ; 375f1 (d:75f1) text "There are no Pokémon" line "in the Discard Pile." done -Text00b9: ; 3761c (d:761c) +ConditionsForEvolvingToStage2NotFulfilledText: ; 3761c (d:761c) text "Conditions for evolving to" line "Stage 2 not fulfilled." done -Text00ba: ; 3764f (d:764f) +ThereAreNoCardsInHandThatYouCanChangeText: ; 3764f (d:764f) text "There are no cards in Hand" line "that you can change." done -Text00bb: ; 37680 (d:7680) +ThereAreNoCardsInTheDiscardPileText: ; 37680 (d:7680) text "There are no cards in the" line "Discard Pile." done -Text00bc: ; 376a9 (d:76a9) +ThereAreNoStage1PokemonText: ; 376a9 (d:76a9) text "There are no Stage 1 Pokémon" line "in the Play Area." done -Text00bd: ; 376d9 (d:76d9) +NoEnergyCardsAttachedToPokemonInYourPlayAreaText: ; 376d9 (d:76d9) text "No Energy cards are attached to" line "Pokémon in your Play Area." done -Text00be: ; 37715 (d:7715) +NoEnergyCardsAttachedToPokemonInOppPlayAreaText: ; 37715 (d:7715) text "No Energy cards attached to Pokémon" line "in your opponent's Play Area." done @@ -906,46 +906,46 @@ NotEnoughEnergyCardsText: ; 37781 (d:7781) text "Not enough Energy cards." done -Text00c1: ; 3779b (d:779b) +NotEnoughFireEnergyText: ; 3779b (d:779b) text "Not enough Fire Energy." done -Text00c2: ; 377b4 (d:77b4) +NotEnoughPsychicEnergyText: ; 377b4 (d:77b4) text "Not enough Psychic Energy." done -Text00c3: ; 377d0 (d:77d0) +NotEnoughWaterEnergyText: ; 377d0 (d:77d0) text "Not enough Water Energy." done -Text00c4: ; 377ea (d:77ea) +ThereAreNoTrainerCardsInDiscardPileText: ; 377ea (d:77ea) text "There are no Trainer Cards" line "in the Discard Pile." done -Text00c5: ; 3781b (d:781b) +NoAttackMayBeChoosenText: ; 3781b (d:781b) text "No Attacks may be choosen." done -Text00c6: ; 37837 (d:7837) +YouDidNotReceiveAnAttackToMirrorMoveText: ; 37837 (d:7837) text "You did not receive an Attack" line "to Mirror Move." done -Text00c7: ; 37866 (d:7866) +ThisAttackCannotBeUsedTwiceText: ; 37866 (d:7866) text "This attack cannot" line "be used twice." done -Text00c8: ; 37889 (d:7889) +NoWeaknessText: ; 37889 (d:7889) text "No Weakness." done -Text00c9: ; 37897 (d:7897) +NoResistanceText: ; 37897 (d:7897) text "No Resistance." done -Text00ca: ; 378a7 (d:78a7) +OnlyOncePerTurnText: ; 378a7 (d:78a7) text "Only once per turn." done @@ -954,38 +954,38 @@ CannotUseDueToStatusText: ; 378bc (d:78bc) line "or Confusion." done -Text00cc: ; 378ef (d:78ef) +CannotBeUsedInTurnWhichWasPlayedText: ; 378ef (d:78ef) text "Cannot be used in the turn in" line "which it was played." done -Text00cd: ; 37923 (d:7923) +ThereIsNoEnergyCardAttachedText: ; 37923 (d:7923) text "There is no Energy card attached." done -Text00ce: ; 37946 (d:7946) +NoGrassEnergyText: ; 37946 (d:7946) text "No Grass Energy." done -Text00cf: ; 37958 (d:7958) +CannotUseSinceTheresOnly1PkmnText: ; 37958 (d:7958) text "Cannot use since there's only" line "1 Pokémon." done -Text00d0: ; 37982 (d:7982) +CannotUseBecauseItWillBeKnockedOutText: ; 37982 (d:7982) text "Cannot use because" line "it will be Knocked Out." done -Text00d1: ; 379ae (d:79ae) +CanOnlyBeUsedOnTheBenchText: ; 379ae (d:79ae) text "Can only be used on the Bench." done -Text00d2: ; 379ce (d:79ce) +ThereAreNoPokemonOnBenchText: ; 379ce (d:79ce) text "There are no Pokémon on the Bench." done -Text00d3: ; 379f2 (d:79f2) +OpponentIsNotAsleepText: ; 379f2 (d:79f2) text "Opponent is not Asleep" done @@ -1073,22 +1073,22 @@ VenomPowderCheckText: ; 37cdf (d:7cdf) line "opponent is Poisoned & Confused." done -Text00e5: ; 37d1f (d:7d1f) +IfTailsYourPokemonBecomesConfusedText: ; 37d1f (d:7d1f) text "If Tails, your Pokémon" line "becomes Confused." done -Text00e6: ; 37d4a (d:7d4a) +DamageCheckIfTailsNoDamageText: ; 37d4a (d:7d4a) text "Damage check!" line "If Tails, no damage!!!" done -Text00e7: ; 37d70 (d:7d70) +IfHeadsDraw1CardFromDeckText: ; 37d70 (d:7d70) text "If Heads," line "Draw 1 card from Deck!" done -Text00e8: ; 37d92 (d:7d92) +FlipUntilFailAppears10DamageForEachHeadsText: ; 37d92 (d:7d92) text "Flip until Tails appears." line "10 damage for each Heads!!!" done @@ -1098,7 +1098,7 @@ IfHeadPlus10IfTails10ToYourselfText: ; 37dc9 (d:7dc9) line "If Tails, +10 damage to yourself!" done -Text00ea: ; 37e03 (d:7e03) +DamageToOppBenchIfHeadsDamageToYoursIfTailsText: ; 37e03 (d:7e03) text "10 damage to opponent's Bench if" line "Heads, damage to yours if Tails." done @@ -1108,17 +1108,17 @@ IfHeadsChangeOpponentsActivePokemonText: ; 37e46 (d:7e46) line "Active Pokémon." done -Text00ec: ; 37e73 (d:7e73) +IfHeadsHealIsSuccessfulText: ; 37e73 (d:7e73) text "If Heads," line "Heal is successful." done -Text00ed: ; 37e92 (d:7e92) +IfTailsDamageToYourselfTooText: ; 37e92 (d:7e92) text "If Tails, <RAMNUM> damage" line "to yourself, too." done -Text00ee: ; 37eb8 (d:7eb8) +SuccessCheckIfHeadsAttackIsSuccessfulText: ; 37eb8 (d:7eb8) text "Success check!!!" line "If Heads, Attack is successful!" done @@ -1128,7 +1128,7 @@ TrainerCardSuccessCheckText: ; 37eea (d:7eea) line "If Heads, you're successful!" done -Text00f0: ; 37f24 (d:7f24) +CardCheckIfHeads8CardsIfTails1CardText: ; 37f24 (d:7f24) text "Card check!" line "If Heads, 8 cards! If Tails, 1 card!" done diff --git a/src/text/text10.asm b/src/text/text10.asm index 057820f..49fb302 100644 --- a/src/text/text10.asm +++ b/src/text/text10.asm @@ -85,7 +85,7 @@ NidoranFName: ; 582e5 (16:42e5) text "Nidoran♀" done -FurySweepesName: ; 582ef (16:42ef) +FurySwipesName: ; 582ef (16:42ef) text "Fury Swipes" done diff --git a/src/text/text2.asm b/src/text/text2.asm index 97ecf45..43a8ba5 100644 --- a/src/text/text2.asm +++ b/src/text/text2.asm @@ -27,12 +27,12 @@ PoisonedIfHeadsConfusedIfTailsText: ; 380ed (e:40ed) line "and Confused if Tails." done -Text00fb: ; 38124 (e:4124) +IfHeadsDoNotReceiveDamageOrEffectText: ; 38124 (e:4124) text "If Heads, do not receive damage" line "or effect of opponent's next Attack!" done -Text00fc: ; 3816a (e:416a) +IfHeadsOpponentCannotAttackText: ; 3816a (e:416a) text "If Heads, opponent cannot Attack" line "next turn!" done @@ -116,7 +116,7 @@ NoDamageOrEffectDueToTransparencyText: ; 384d8 (e:44d8) line "due to the effects of Transparency" done -Text010d: ; 3851f (e:451f) +MetamorphsToText: ; 3851f (e:451f) text "<RAMTEXT>" line "metamorphs to <RAMTEXT>." done @@ -136,40 +136,40 @@ DuelistIsSelectingPokemonToPlaceInArenaText: ; 3859e (e:459e) line "to place in the Arena." done -Text0111: ; 385cf (e:45cf) +ChooseWeaknessYouWishToChangeText: ; 385cf (e:45cf) text "Choose the Weakness you wish" line "to change with Conversion 1." done -Text0112: ; 3860a (e:460a) +ChooseResistanceYouWishToChangeText: ; 3860a (e:460a) text "Choose the Resistance you wish" line "to change with Conversion 2." done -Text0113: ; 38647 (e:4647) +ChoosePokemonWishToColorChangeText: ; 38647 (e:4647) text "Choose the Pokémon whose color you" line "wish to change with Color change." done -Text0114: ; 3868d (e:468d) +ChangedTheWeaknessOfPokemonToColorText: ; 3868d (e:468d) text "Changed the Weakness of" line "" text "<RAMTEXT> to <RAMTEXT>." done -Text0115: ; 386af (e:46af) +ChangedTheResistanceOfPokemonToColorText: ; 386af (e:46af) text "Changed the Resistance of" line "" text "<RAMTEXT> to <RAMTEXT>." done -Text0116: ; 386d3 (e:46d3) +ChangedTheColorOfText: ; 386d3 (e:46d3) text "Changed the color of" line "" text "<RAMTEXT> to <RAMTEXT>." done -Text0117: ; 386f2 (e:46f2) +Draw1CardFromTheDeckText: ; 386f2 (e:46f2) text "Draw 1 card from the Deck." done @@ -182,22 +182,22 @@ CannotDrawCardBecauseNoCardsInDeckText: ; 3872d (e:472d) line "there are no cards in the Deck." done -Text011a: ; 38769 (e:4769) +ChoosePkmnInTheBenchToGiveDamageText: ; 38769 (e:4769) text "Choose a Pokémon on the Bench" line "to give damage to." done -Text011b: ; 3879b (e:479b) +ChooseUpTo3PkmnOnBenchToGiveDamageText: ; 3879b (e:479b) text "Choose up to 3 Pokémon on the" line "Bench to give damage to." done -Text011c: ; 387d3 (e:47d3) +Choose1BasicEnergyCardFromDeckText: ; 387d3 (e:47d3) text "Choose 1 Basic Energy card" line "from the Deck." done -Text011d: ; 387fe (e:47fe) +ChoosePokemonToAttachEnergyCardText: ; 387fe (e:47fe) text "Choose a Pokémon to attach" line "the Energy card to." done @@ -207,75 +207,75 @@ Text011e: ; 3882e (e:482e) line "1 Fire Energy card." done -Text011f: ; 38856 (e:4856) +ChooseAndDiscard2FireEnergyCardsText: ; 38856 (e:4856) text "Choose and Discard" line "2 Fire Energy cards." done -Text0120: ; 3887f (e:487f) +DiscardOppDeckAsManyFireEnergyCardsText: ; 3887f (e:487f) text "Discard from opponent's Deck as many" line "Fire Energy cards as were discarded." done -Text0121: ; 388ca (e:48ca) +ChooseAndDiscard2EnergyCardsText: ; 388ca (e:48ca) text "Choose and Discard" line "2 Energy cards." done -Text0122: ; 388ee (e:48ee) +ChooseAKrabbyFromDeckText: ; 388ee (e:48ee) text "Choose a Krabby" line "from the Deck." done -Text0123: ; 3890e (e:490e) +ChooseDiscardEnergyCardFromOpponentText: ; 3890e (e:490e) text "Choose and Discard an Energy card" line "from the opponent's Active Pokémon." done -Text0124: ; 38955 (e:4955) +ChooseAttackOpponentWillNotBeAbleToUseText: ; 38955 (e:4955) text "Choose the Attack the opponent will" line "not be able to use on the next turn." done -Text0125: ; 3899f (e:499f) +ChooseBasicFightingPokemonFromDeckText: ; 3899f (e:499f) text "Choose a Basic Fighting Pokémon" line "from the Deck." done -Text0126: ; 389cf (e:49cf) +ChooseAnOddishFromDeckText: ; 389cf (e:49cf) text "Choose an Oddish" line "from the Deck." done -Text0127: ; 389f0 (e:49f0) +ChooseAnOddishText: ; 389f0 (e:49f0) text "Choose an Oddish" done -Text0128: ; 38a02 (e:4a02) +ChooseAKrabbyText: ; 38a02 (e:4a02) text "Choose a Krabby." done -Text0129: ; 38a14 (e:4a14) +ChooseBasicEnergyCardText: ; 38a14 (e:4a14) text "Choose a Basic" line "Energy card." done -Text012a: ; 38a31 (e:4a31) +ChooseNidoranFromDeckText: ; 38a31 (e:4a31) text "Choose a Nidoran♀ or a" line "Nidoran♂ from the Deck." done -Text012b: ; 38a61 (e:4a61) +ChooseNidoranText: ; 38a61 (e:4a61) text "Choose a Nidoran♀" line "or a Nidoran♂." done -Text012c: ; 38a83 (e:4a83) +ChooseBasicFightingPokemonText: ; 38a83 (e:4a83) text "Choose a Basic" line "Fighting Pokémon" done -Text012d: ; 38aa4 (e:4aa4) +ProcedureForEnergyTransferText: ; 38aa4 (e:4aa4) text "Procedure for Energy Transfer:" line "" line "1. Choose the Pokémon to move Grass" @@ -289,21 +289,21 @@ Text012d: ; 38aa4 (e:4aa4) line "4. Press the B Button to end." done -Text012e: ; 38b8f (e:4b8f) +ChooseABellsproutFromDeckText: ; 38b8f (e:4b8f) text "Choose a Bellsprout" line "from the Deck." done -Text012f: ; 38bb3 (e:4bb3) +ChooseABellsproutText: ; 38bb3 (e:4bb3) text "Choose a Bellsprout." done -Text0130: ; 38bc9 (e:4bc9) +ChoosePkmnToRemoveDamageCounterText: ; 38bc9 (e:4bc9) text "Choose a Pokémon to remove" line "the Damage counter from." done -Text0131: ; 38bfe (e:4bfe) +ProcedureForCurseText: ; 38bfe (e:4bfe) text "Procedure for Curse:" line "" line "1. Choose a Pokémon to move the" @@ -317,22 +317,22 @@ Text0131: ; 38bfe (e:4bfe) line "3. Press the B Button to cancel." done -Text0132: ; 38cda (e:4cda) +Choose2EnergyCardsFromDiscardPileToAttachText: ; 38cda (e:4cda) text "Choose 2 Energy cards from the" line "Discard Pileto attach to a Pokémon." done -Text0133: ; 38d1e (e:4d1e) +Choose2EnergyCardsFromDiscardPileForHandText: ; 38d1e (e:4d1e) text "Choose 2 Energy cards from the" line "Discard Pile for your Hand." done -Text0134: ; 38d5a (e:4d5a) +ChooseAnEnergyCardText: ; 38d5a (e:4d5a) text "Choose an Energy" line "card." done -Text0135: ; 38d72 (e:4d72) +ProcedureForProphecyText: ; 38d72 (e:4d72) text "Procedure for Prophecy:" line "" line "1. Choose either your Deck" @@ -348,12 +348,12 @@ Text0135: ; 38d72 (e:4d72) line "4. Press the B Button to cancel." done -Text0136: ; 38e70 (e:4e70) +ChooseTheOrderOfTheCardsText: ; 38e70 (e:4e70) text "Choose the order" line "of the cards." done -Text0137: ; 38e90 (e:4e90) +ProcedureForDamageSwapText: ; 38e90 (e:4e90) text "Procedure for Damage Swap:" line "" line "1. Choose a Pokémon to move a" @@ -372,7 +372,7 @@ Text0137: ; 38e90 (e:4e90) line " it will Knock Out the Pokémon." done -Text0138: ; 38fcc (e:4fcc) +ProcedureForDevolutionBeamText: ; 38fcc (e:4fcc) text "Procedure for Devolution Beam." line "" line "1. Choose either a Pokémon in your" @@ -385,7 +385,7 @@ Text0138: ; 38fcc (e:4fcc) line "3. Press the B Button to cancel." done -Text0139: ; 390b4 (e:50b4) +ProcedureForStrangeBehaviorText: ; 390b4 (e:50b4) text "Procedure for Strange Behavior:" line "" line "1. Choose the Pokémon with the" @@ -401,74 +401,74 @@ Text0139: ; 390b4 (e:50b4) line " Slowbro will be Knocked Out." done -Text013a: ; 391dc (e:51dc) +ChooseOppAttackToBeUsedWithMetronomeText: ; 391dc (e:51dc) text "Choose the opponent's Attack" line "to be used with Metronome." done -Text013b: ; 39215 (e:5215) +ThereIsNoInTheDeckText: ; 39215 (e:5215) text "There is no <RAMTEXT>" line "in the Deck." done -Text013c: ; 39231 (e:5231) +WouldYouLikeToCheckTheDeckText: ; 39231 (e:5231) text "Would you like to check the Deck?" done -Text013d: ; 39254 (e:5254) +PleaseSelectTheDeckText: ; 39254 (e:5254) text "Please select the Deck:" line " Yours Opponent's" done -Text013e: ; 3928c (e:528c) +PleaseSelectThePlayAreaText: ; 3928c (e:528c) text "Please select the Play Area:" line " Yours Opponent's" done -Text013f: ; 392c9 (e:52c9) +NidoranMNidoranFText: ; 392c9 (e:52c9) text "Nidoran♂ Nidoran♀" done -Text0140: ; 392dc (e:52dc) +OddishText: ; 392dc (e:52dc) text "Oddish" done -Text0141: ; 392e4 (e:52e4) +BellsproutText: ; 392e4 (e:52e4) text "Bellsprout" done -Text0142: ; 392f0 (e:52f0) +KrabbyText: ; 392f0 (e:52f0) text "Krabby" done -Text0143: ; 392f8 (e:52f8) +FightingPokemonDeckText: ; 392f8 (e:52f8) text "Fighting Pokémon" done -Text0144: ; 3930a (e:530a) +BasicEnergyText: ; 3930a (e:530a) text "Basic Energy" done -Text0145: ; 39318 (e:5318) +PeekWasUsedToLookInYourHandText: ; 39318 (e:5318) text "Peek was used to look at the" line "<RAMTEXT> in your Hand." done -Text0146: ; 39346 (e:5346) +CardPeekWasUsedOnText: ; 39346 (e:5346) text "Card Peek was used on" done -Text0147: ; 3935d (e:535d) +PokemonAndAllAttachedCardsReturnedToHandText: ; 3935d (e:535d) text "<RAMTEXT> and all attached" line "cards were returned to the Hand." done -Text0148: ; 39392 (e:5392) +WasChosenForTheEffectOfAmnesiaText: ; 39392 (e:5392) text "<RAMTEXT> was chosen" line "for the effect of Amnesia." done -Text0149: ; 393bb (e:53bb) +BasicPokemonWasPlacedOnEachBenchText: ; 393bb (e:53bb) text "A Basic Pokémon was placed" line "on each Bench." done @@ -483,17 +483,17 @@ ThereWasNoEffectFromTxRam2Text: ; 393ff (e:53ff) line "from <RAMTEXT>." done -Text014c: ; 3941c (e:541c) +TheEnergyCardFromPlayAreaWasMovedText: ; 3941c (e:541c) text "The Energy card from <RAMNAME>'s" line "Play Area was moved." done -Text014d: ; 3944b (e:544b) +DrewFireEnergyFromTheHandText: ; 3944b (e:544b) text "<RAMNAME> drew" line "<RAMNUM> Fire Energy from the Hand." done -Text014e: ; 39470 (e:5470) +ThePkmnCardsInHandAndDeckWereShuffledText: ; 39470 (e:5470) text "The Pokémon cards in <RAMNAME>'s" line "Hand and Deck were shuffled" done @@ -503,22 +503,22 @@ Text014f: ; 394a6 (e:54a6) line "A Button is pressed. B Button quits." done -Text0150: ; 394f0 (e:54f0) +ChoosePokemonToRemoveDamageCounterFromText: ; 394f0 (e:54f0) text "Choose a Pokémon to remove" line "the Damage counter from." done -Text0151: ; 39525 (e:5525) +ChooseCardToDiscardFromHandText: ; 39525 (e:5525) text "Choose the card to Discard" line "from the Hand." done -Text0152: ; 39550 (e:5550) +ChoosePokemonToRemoveEnergyFromText: ; 39550 (e:5550) text "Choose a Pokémon to remove" line "Energy from and choose the Energy." done -Text0153: ; 3958f (e:558f) +Choose2BasicEnergyCardsFromDiscardPileText: ; 3958f (e:558f) text "Choose 2 Basic Energy cards" line "from the Discard Pile." done @@ -528,22 +528,22 @@ Text0154: ; 395c3 (e:55c3) line "Button to remove Damage counters." done -Text0155: ; 39607 (e:5607) +Choose2CardsFromHandToDiscardText: ; 39607 (e:5607) text "Choose 2 cards from the Hand" line "to Discard." done -Text0156: ; 39631 (e:5631) +Choose2HandCardsFromHandToReturnToDeckText: ; 39631 (e:5631) text "Choose 2 cards from the Hand" line "to return to the Deck." done -Text0157: ; 39666 (e:5666) +ChooseCardToPlaceInHandText: ; 39666 (e:5666) text "Choose a card to" line "place in the Hand." done -Text0158: ; 3968b (e:568b) +ChoosePokemonToAttachDefenderToText: ; 3968b (e:568b) text "Choose a Pokémon to" line "attach Defender to." done @@ -553,75 +553,75 @@ Text0159: ; 396b4 (e:56b4) line "A to Draw, B to End." done -Text015a: ; 396e6 (e:56e6) +ChoosePokemonToReturnToTheDeckText: ; 396e6 (e:56e6) text "Choose a Pokémon to" line "return to the Deck." done -Text015b: ; 3970f (e:570f) +ChoosePokemonToPlaceInPlayText: ; 3970f (e:570f) text "Choose a Pokémon to" line "place in play." done -Text015c: ; 39733 (e:5733) +ChooseBasicPokemonToEvolveText: ; 39733 (e:5733) text "Choose a Basic Pokémon" line "to Evolve." done -Text015d: ; 39756 (e:5756) +ChoosePokemonToScoopUpText: ; 39756 (e:5756) text "Choose a Pokémon to" line "Scoop Up." done -Text015e: ; 39775 (e:5775) +ChooseCardFromYourHandToSwitchText: ; 39775 (e:5775) text "Choose a card from your" line "Hand to Switch." done -Text015f: ; 3979e (e:579e) +ChooseCardToSwitchText: ; 3979e (e:579e) text "Choose a card to" line "Switch." done -Text0160: ; 397b8 (e:57b8) +ChooseBasicOrEvolutionPokemonCardFromDeckText: ; 397b8 (e:57b8) text "Choose a Basic or Evolution" line "Pokémon card from the Deck." done -Text0161: ; 397f1 (e:57f1) +ChoosePokemonCardText: ; 397f1 (e:57f1) text "Choose" line "a Pokémon card." done -Text0162: ; 39809 (e:5809) +RearrangeThe5CardsAtTopOfDeckText: ; 39809 (e:5809) text "Rearrange the 5 cards at" line "the top of the Deck." done -Text0163: ; 39838 (e:5838) +PleaseCheckTheOpponentsHandText: ; 39838 (e:5838) text "Please check the opponent's" line "Hand." done -Text0164: ; 3985b (e:585b) +EvolutionCardText: ; 3985b (e:585b) text "Evolution card" done -Text0165: ; 3986b (e:586b) +CardWasChosenText: ; 3986b (e:586b) text "<RAMTEXT> was chosen." done -Text0166: ; 3987a (e:587a) +ChooseBasicPokemonToPlaceOnBenchText: ; 3987a (e:587a) text "Choose a Basic Pokémon" line "to place on the Bench." done -Text0167: ; 398a9 (e:58a9) +ChooseEvolutionCardAndPressAButtonToDevolveText: ; 398a9 (e:58a9) text "Choose an Evolution card and" line "press the A Button to Devolve 1." done -Text0168: ; 398e8 (e:58e8) +ChoosePokemonInYourAreaThenPokemonInYourOppText: ; 398e8 (e:58e8) text "Choose a Pokémon in your Area, then" line "a Pokémon in your opponent's." done @@ -636,27 +636,27 @@ Text016a: ; 39952 (e:5952) line "with the Active Pokémon." done -Text016b: ; 39987 (e:5987) +PokemonAndAllAttachedCardsWereReturnedToDeckText: ; 39987 (e:5987) text "<RAMTEXT> and all attached" line "cards were returned to the Deck." done -Text016c: ; 399bc (e:59bc) +PokemonWasReturnedFromArenaToHandText: ; 399bc (e:59bc) text "<RAMTEXT> was returned" line "from the Arena to the Hand." done -Text016d: ; 399e8 (e:59e8) +PokemonWasReturnedFromBenchToHandText: ; 399e8 (e:59e8) text "<RAMTEXT> was returned" line "from the Bench to the Hand." done -Text016e: ; 39a14 (e:5a14) +PokemonWasReturnedToDeckText: ; 39a14 (e:5a14) text "<RAMTEXT> was returned" line "to the Deck." done -Text016f: ; 39a31 (e:5a31) +WasPlacedInTheHandText: ; 39a31 (e:5a31) text "<RAMTEXT> was placed" line "in the Hand." done @@ -669,17 +669,17 @@ YouReceivedTheseCardsText: ; 39a63 (e:5a63) text "You received these cards:" done -Text0172: ; 39a7e (e:5a7e) +ChooseTheCardToPutBackText: ; 39a7e (e:5a7e) text "Choose the card" line "to put back." done -Text0173: ; 39a9c (e:5a9c) +ChooseTheCardToDiscardText: ; 39a9c (e:5a9c) text "Choose the card" line "to Discard." done -Text0174: ; 39ab9 (e:5ab9) +DiscardedCardsFromDeckText: ; 39ab9 (e:5ab9) text "Discarded <RAMNUM> cards" line "from <RAMNAME>'s Deck." done @@ -689,39 +689,39 @@ Text0175: ; 39adb (e:5adb) line "from the Hand." done -Text0176: ; 39af7 (e:5af7) +NoneCameText: ; 39af7 (e:5af7) text "None came!" done -Text0177: ; 39b03 (e:5b03) +CameToTheBenchText: ; 39b03 (e:5b03) text "<RAMTEXT>" line "came to the Bench!" done -Text0178: ; 39b19 (e:5b19) +DuelistHasNoCardsInHandText: ; 39b19 (e:5b19) text "<RAMNAME> has" line "no cards in Hand!" done -Text0179: ; 39b32 (e:5b32) +PokemonHealedDamageText: ; 39b32 (e:5b32) text "<RAMTEXT> healed" line "<RAMNUM> damage!" done -Text017a: ; 39b46 (e:5b46) +PokemonDevolvedToText: ; 39b46 (e:5b46) text "<RAMTEXT> devolved" line "to <RAMTEXT>!" done -Text017b: ; 39b58 (e:5b58) +ThereWasNoFireEnergyText: ; 39b58 (e:5b58) text "There was no Fire Energy." done -Text017c: ; 39b73 (e:5b73) +YouCanSelectMoreCardsQuitText: ; 39b73 (e:5b73) text "You can select <RAMNUM> more cards. Quit?" done -Text017d: ; 39b97 (e:5b97) +ThereWasNoEffectText: ; 39b97 (e:5b97) text "There was no effect!" done @@ -755,7 +755,7 @@ ThereWasNoEffectFromPoisonConfusionText: ; 39c5a (e:5c5a) line "from Poison, Confusion." done -Text0184: ; 39c86 (e:5c86) +ExchangedCardsInDuelistsHandText: ; 39c86 (e:5c86) text "Exchanged the cards" line "in <RAMNAME>'s Hand." done 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..b44dc3e 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 @@ -70,15 +70,15 @@ TextOffsets:: ; 34000 (d:40 textpointer WillDrawNPrizesText ; 0x0042 textpointer DrewNPrizesText ; 0x0043 textpointer DuelistPlacedACardText ; 0x0044 - textpointer Text0045 ; 0x0045 - textpointer Text0046 ; 0x0046 - textpointer Text0047 ; 0x0047 - textpointer Text0048 ; 0x0048 - textpointer Text0049 ; 0x0049 - textpointer Text004a ; 0x004a - textpointer Text004b ; 0x004b - textpointer Text004c ; 0x004c - textpointer Text004d ; 0x004d + textpointer UnableToSelectText ; 0x0045 + textpointer ColorListText ; 0x0046 + textpointer GrassSymbolText ; 0x0047 + textpointer FireSymbolText ; 0x0048 + textpointer WaterSymbolText ; 0x0049 + textpointer LightningSymbolText ; 0x004a + textpointer FightingSymbolText ; 0x004b + textpointer PsychicSymbolText ; 0x004c + textpointer BenchText ; 0x004d textpointer KnockOutText ; 0x004e textpointer DamageToSelfDueToConfusionText ; 0x004f textpointer ChooseEnergyCardToDiscardText ; 0x0050 @@ -176,43 +176,43 @@ TextOffsets:: ; 34000 (d:40 textpointer NoPokemonWithDamageCountersText ; 0x00ac textpointer NoDamageCountersText ; 0x00ad textpointer NoEnergyAttachedToOpponentsActiveText ; 0x00ae - textpointer Text00af ; 0x00af - textpointer Text00b0 ; 0x00b0 - textpointer Text00b1 ; 0x00b1 + textpointer ThereAreNoEnergyCardsInDiscardPileText ; 0x00af + textpointer ThereAreNoBasicEnergyCardsInDiscardPileText ; 0x00b0 + textpointer NoCardsLeftInTheDeckText ; 0x00b1 textpointer NoSpaceOnTheBenchText ; 0x00b2 textpointer NoPokemonCapableOfEvolvingText ; 0x00b3 textpointer CantEvolvePokemonInSameTurnItsPlacedText ; 0x00b4 - textpointer Text00b5 ; 0x00b5 - textpointer Text00b6 ; 0x00b6 - textpointer Text00b7 ; 0x00b7 - textpointer Text00b8 ; 0x00b8 - textpointer Text00b9 ; 0x00b9 - textpointer Text00ba ; 0x00ba - textpointer Text00bb ; 0x00bb - textpointer Text00bc ; 0x00bc - textpointer Text00bd ; 0x00bd - textpointer Text00be ; 0x00be + textpointer NotAffectedByPoisonSleepParalysisOrConfusionText ; 0x00b5 + textpointer NotEnoughCardsInHandText ; 0x00b6 + textpointer EffectNoPokemonOnTheBenchText ; 0x00b7 + textpointer ThereAreNoPokemonInDiscardPileText ; 0x00b8 + textpointer ConditionsForEvolvingToStage2NotFulfilledText ; 0x00b9 + textpointer ThereAreNoCardsInHandThatYouCanChangeText ; 0x00ba + textpointer ThereAreNoCardsInTheDiscardPileText ; 0x00bb + textpointer ThereAreNoStage1PokemonText ; 0x00bc + textpointer NoEnergyCardsAttachedToPokemonInYourPlayAreaText ; 0x00bd + textpointer NoEnergyCardsAttachedToPokemonInOppPlayAreaText ; 0x00be textpointer EnergyCardsRequiredToRetreatText ; 0x00bf textpointer NotEnoughEnergyCardsText ; 0x00c0 - textpointer Text00c1 ; 0x00c1 - textpointer Text00c2 ; 0x00c2 - textpointer Text00c3 ; 0x00c3 - textpointer Text00c4 ; 0x00c4 - textpointer Text00c5 ; 0x00c5 - textpointer Text00c6 ; 0x00c6 - textpointer Text00c7 ; 0x00c7 - textpointer Text00c8 ; 0x00c8 - textpointer Text00c9 ; 0x00c9 - textpointer Text00ca ; 0x00ca + textpointer NotEnoughFireEnergyText ; 0x00c1 + textpointer NotEnoughPsychicEnergyText ; 0x00c2 + textpointer NotEnoughWaterEnergyText ; 0x00c3 + textpointer ThereAreNoTrainerCardsInDiscardPileText ; 0x00c4 + textpointer NoAttackMayBeChoosenText ; 0x00c5 + textpointer YouDidNotReceiveAnAttackToMirrorMoveText ; 0x00c6 + textpointer ThisAttackCannotBeUsedTwiceText ; 0x00c7 + textpointer NoWeaknessText ; 0x00c8 + textpointer NoResistanceText ; 0x00c9 + textpointer OnlyOncePerTurnText ; 0x00ca textpointer CannotUseDueToStatusText ; 0x00cb - textpointer Text00cc ; 0x00cc - textpointer Text00cd ; 0x00cd - textpointer Text00ce ; 0x00ce - textpointer Text00cf ; 0x00cf - textpointer Text00d0 ; 0x00d0 - textpointer Text00d1 ; 0x00d1 - textpointer Text00d2 ; 0x00d2 - textpointer Text00d3 ; 0x00d3 + textpointer CannotBeUsedInTurnWhichWasPlayedText ; 0x00cc + textpointer ThereIsNoEnergyCardAttachedText ; 0x00cd + textpointer NoGrassEnergyText ; 0x00ce + textpointer CannotUseSinceTheresOnly1PkmnText ; 0x00cf + textpointer CannotUseBecauseItWillBeKnockedOutText ; 0x00d0 + textpointer CanOnlyBeUsedOnTheBenchText ; 0x00d1 + textpointer ThereAreNoPokemonOnBenchText ; 0x00d2 + textpointer OpponentIsNotAsleepText ; 0x00d3 textpointer UnableDueToToxicGasText ; 0x00d4 textpointer Text00d5 ; 0x00d5 textpointer BackUpIsBrokenText ; 0x00d6 @@ -230,18 +230,18 @@ TextOffsets:: ; 34000 (d:40 textpointer PoisonCheckText ; 0x00e2 textpointer ConfusionCheckText ; 0x00e3 textpointer VenomPowderCheckText ; 0x00e4 - textpointer Text00e5 ; 0x00e5 - textpointer Text00e6 ; 0x00e6 - textpointer Text00e7 ; 0x00e7 - textpointer Text00e8 ; 0x00e8 + textpointer IfTailsYourPokemonBecomesConfusedText ; 0x00e5 + textpointer DamageCheckIfTailsNoDamageText ; 0x00e6 + textpointer IfHeadsDraw1CardFromDeckText ; 0x00e7 + textpointer FlipUntilFailAppears10DamageForEachHeadsText ; 0x00e8 textpointer IfHeadPlus10IfTails10ToYourselfText ; 0x00e9 - textpointer Text00ea ; 0x00ea + textpointer DamageToOppBenchIfHeadsDamageToYoursIfTailsText ; 0x00ea textpointer IfHeadsChangeOpponentsActivePokemonText ; 0x00eb - textpointer Text00ec ; 0x00ec - textpointer Text00ed ; 0x00ed - textpointer Text00ee ; 0x00ee + textpointer IfHeadsHealIsSuccessfulText ; 0x00ec + textpointer IfTailsDamageToYourselfTooText ; 0x00ed + textpointer SuccessCheckIfHeadsAttackIsSuccessfulText ; 0x00ee textpointer TrainerCardSuccessCheckText ; 0x00ef - textpointer Text00f0 ; 0x00f0 + textpointer CardCheckIfHeads8CardsIfTails1CardText ; 0x00f0 textpointer IfHeadsNoDamageNextTurnText ; 0x00f1 textpointer Text00f2 ; 0x00f2 textpointer DamageCheckIfHeadsPlusDamageText ; 0x00f3 @@ -252,8 +252,8 @@ TextOffsets:: ; 34000 (d:40 textpointer ConfusionCheckRetreatText ; 0x00f8 textpointer PokemonsSleepCheckText ; 0x00f9 textpointer PoisonedIfHeadsConfusedIfTailsText ; 0x00fa - textpointer Text00fb ; 0x00fb - textpointer Text00fc ; 0x00fc + textpointer IfHeadsDoNotReceiveDamageOrEffectText ; 0x00fb + textpointer IfHeadsOpponentCannotAttackText ; 0x00fc textpointer AttackUnsuccessfulText ; 0x00fd textpointer UnableToRetreatDueToAcidText ; 0x00fe textpointer UnableToUseTrainerDueToHeadacheText ; 0x00ff @@ -270,126 +270,126 @@ TextOffsets:: ; 34000 (d:40 textpointer UnableToUseAttackDueToNShieldText ; 0x010a textpointer NoDamageOrEffectDueToNShieldText ; 0x010b textpointer NoDamageOrEffectDueToTransparencyText ; 0x010c - textpointer Text010d ; 0x010d + textpointer MetamorphsToText ; 0x010d textpointer SelectPkmnOnBenchToSwitchWithActiveText ; 0x010e textpointer SelectPokemonToPlaceInTheArenaText ; 0x010f textpointer DuelistIsSelectingPokemonToPlaceInArenaText ; 0x0110 - textpointer Text0111 ; 0x0111 - textpointer Text0112 ; 0x0112 - textpointer Text0113 ; 0x0113 - textpointer Text0114 ; 0x0114 - textpointer Text0115 ; 0x0115 - textpointer Text0116 ; 0x0116 - textpointer Text0117 ; 0x0117 + textpointer ChooseWeaknessYouWishToChangeText ; 0x0111 + textpointer ChooseResistanceYouWishToChangeText ; 0x0112 + textpointer ChoosePokemonWishToColorChangeText ; 0x0113 + textpointer ChangedTheWeaknessOfPokemonToColorText ; 0x0114 + textpointer ChangedTheResistanceOfPokemonToColorText ; 0x0115 + textpointer ChangedTheColorOfText ; 0x0116 + textpointer Draw1CardFromTheDeckText ; 0x0117 textpointer DrawCardsFromTheDeckText ; 0x0118 textpointer CannotDrawCardBecauseNoCardsInDeckText ; 0x0119 - textpointer Text011a ; 0x011a - textpointer Text011b ; 0x011b - textpointer Text011c ; 0x011c - textpointer Text011d ; 0x011d + textpointer ChoosePkmnInTheBenchToGiveDamageText ; 0x011a + textpointer ChooseUpTo3PkmnOnBenchToGiveDamageText ; 0x011b + textpointer Choose1BasicEnergyCardFromDeckText ; 0x011c + textpointer ChoosePokemonToAttachEnergyCardText ; 0x011d textpointer Text011e ; 0x011e - textpointer Text011f ; 0x011f - textpointer Text0120 ; 0x0120 - textpointer Text0121 ; 0x0121 - textpointer Text0122 ; 0x0122 - textpointer Text0123 ; 0x0123 - textpointer Text0124 ; 0x0124 - textpointer Text0125 ; 0x0125 - textpointer Text0126 ; 0x0126 - textpointer Text0127 ; 0x0127 - textpointer Text0128 ; 0x0128 - textpointer Text0129 ; 0x0129 - textpointer Text012a ; 0x012a - textpointer Text012b ; 0x012b - textpointer Text012c ; 0x012c - textpointer Text012d ; 0x012d - textpointer Text012e ; 0x012e - textpointer Text012f ; 0x012f - textpointer Text0130 ; 0x0130 - textpointer Text0131 ; 0x0131 - textpointer Text0132 ; 0x0132 - textpointer Text0133 ; 0x0133 - textpointer Text0134 ; 0x0134 - textpointer Text0135 ; 0x0135 - textpointer Text0136 ; 0x0136 - textpointer Text0137 ; 0x0137 - textpointer Text0138 ; 0x0138 - textpointer Text0139 ; 0x0139 - textpointer Text013a ; 0x013a - textpointer Text013b ; 0x013b - textpointer Text013c ; 0x013c - textpointer Text013d ; 0x013d - textpointer Text013e ; 0x013e - textpointer Text013f ; 0x013f - textpointer Text0140 ; 0x0140 - textpointer Text0141 ; 0x0141 - textpointer Text0142 ; 0x0142 - textpointer Text0143 ; 0x0143 - textpointer Text0144 ; 0x0144 - textpointer Text0145 ; 0x0145 - textpointer Text0146 ; 0x0146 - textpointer Text0147 ; 0x0147 - textpointer Text0148 ; 0x0148 - textpointer Text0149 ; 0x0149 + textpointer ChooseAndDiscard2FireEnergyCardsText ; 0x011f + textpointer DiscardOppDeckAsManyFireEnergyCardsText ; 0x0120 + textpointer ChooseAndDiscard2EnergyCardsText ; 0x0121 + textpointer ChooseAKrabbyFromDeckText ; 0x0122 + textpointer ChooseDiscardEnergyCardFromOpponentText ; 0x0123 + textpointer ChooseAttackOpponentWillNotBeAbleToUseText ; 0x0124 + textpointer ChooseBasicFightingPokemonFromDeckText ; 0x0125 + textpointer ChooseAnOddishFromDeckText ; 0x0126 + textpointer ChooseAnOddishText ; 0x0127 + textpointer ChooseAKrabbyText ; 0x0128 + textpointer ChooseBasicEnergyCardText ; 0x0129 + textpointer ChooseNidoranFromDeckText ; 0x012a + textpointer ChooseNidoranText ; 0x012b + textpointer ChooseBasicFightingPokemonText ; 0x012c + textpointer ProcedureForEnergyTransferText ; 0x012d + textpointer ChooseABellsproutFromDeckText ; 0x012e + textpointer ChooseABellsproutText ; 0x012f + textpointer ChoosePkmnToRemoveDamageCounterText ; 0x0130 + textpointer ProcedureForCurseText ; 0x0131 + textpointer Choose2EnergyCardsFromDiscardPileToAttachText ; 0x0132 + textpointer Choose2EnergyCardsFromDiscardPileForHandText ; 0x0133 + textpointer ChooseAnEnergyCardText ; 0x0134 + textpointer ProcedureForProphecyText ; 0x0135 + textpointer ChooseTheOrderOfTheCardsText ; 0x0136 + textpointer ProcedureForDamageSwapText ; 0x0137 + textpointer ProcedureForDevolutionBeamText ; 0x0138 + textpointer ProcedureForStrangeBehaviorText ; 0x0139 + textpointer ChooseOppAttackToBeUsedWithMetronomeText ; 0x013a + textpointer ThereIsNoInTheDeckText ; 0x013b + textpointer WouldYouLikeToCheckTheDeckText ; 0x013c + textpointer PleaseSelectTheDeckText ; 0x013d + textpointer PleaseSelectThePlayAreaText ; 0x013e + textpointer NidoranMNidoranFText ; 0x013f + textpointer OddishText ; 0x0140 + textpointer BellsproutText ; 0x0141 + textpointer KrabbyText ; 0x0142 + textpointer FightingPokemonDeckText ; 0x0143 + textpointer BasicEnergyText ; 0x0144 + textpointer PeekWasUsedToLookInYourHandText ; 0x0145 + textpointer CardPeekWasUsedOnText ; 0x0146 + textpointer PokemonAndAllAttachedCardsReturnedToHandText ; 0x0147 + textpointer WasChosenForTheEffectOfAmnesiaText ; 0x0148 + textpointer BasicPokemonWasPlacedOnEachBenchText ; 0x0149 textpointer WasUnsuccessfulText ; 0x014a textpointer ThereWasNoEffectFromTxRam2Text ; 0x014b - textpointer Text014c ; 0x014c - textpointer Text014d ; 0x014d - textpointer Text014e ; 0x014e + textpointer TheEnergyCardFromPlayAreaWasMovedText ; 0x014c + textpointer DrewFireEnergyFromTheHandText ; 0x014d + textpointer ThePkmnCardsInHandAndDeckWereShuffledText ; 0x014e textpointer Text014f ; 0x014f - textpointer Text0150 ; 0x0150 - textpointer Text0151 ; 0x0151 - textpointer Text0152 ; 0x0152 - textpointer Text0153 ; 0x0153 + textpointer ChoosePokemonToRemoveDamageCounterFromText ; 0x0150 + textpointer ChooseCardToDiscardFromHandText ; 0x0151 + textpointer ChoosePokemonToRemoveEnergyFromText ; 0x0152 + textpointer Choose2BasicEnergyCardsFromDiscardPileText ; 0x0153 textpointer Text0154 ; 0x0154 - textpointer Text0155 ; 0x0155 - textpointer Text0156 ; 0x0156 - textpointer Text0157 ; 0x0157 - textpointer Text0158 ; 0x0158 + textpointer Choose2CardsFromHandToDiscardText ; 0x0155 + textpointer Choose2HandCardsFromHandToReturnToDeckText ; 0x0156 + textpointer ChooseCardToPlaceInHandText ; 0x0157 + textpointer ChoosePokemonToAttachDefenderToText ; 0x0158 textpointer Text0159 ; 0x0159 - textpointer Text015a ; 0x015a - textpointer Text015b ; 0x015b - textpointer Text015c ; 0x015c - textpointer Text015d ; 0x015d - textpointer Text015e ; 0x015e - textpointer Text015f ; 0x015f - textpointer Text0160 ; 0x0160 - textpointer Text0161 ; 0x0161 - textpointer Text0162 ; 0x0162 - textpointer Text0163 ; 0x0163 - textpointer Text0164 ; 0x0164 - textpointer Text0165 ; 0x0165 - textpointer Text0166 ; 0x0166 - textpointer Text0167 ; 0x0167 - textpointer Text0168 ; 0x0168 + textpointer ChoosePokemonToReturnToTheDeckText ; 0x015a + textpointer ChoosePokemonToPlaceInPlayText ; 0x015b + textpointer ChooseBasicPokemonToEvolveText ; 0x015c + textpointer ChoosePokemonToScoopUpText ; 0x015d + textpointer ChooseCardFromYourHandToSwitchText ; 0x015e + textpointer ChooseCardToSwitchText ; 0x015f + textpointer ChooseBasicOrEvolutionPokemonCardFromDeckText ; 0x0160 + textpointer ChoosePokemonCardText ; 0x0161 + textpointer RearrangeThe5CardsAtTopOfDeckText ; 0x0162 + textpointer PleaseCheckTheOpponentsHandText ; 0x0163 + textpointer EvolutionCardText ; 0x0164 + textpointer CardWasChosenText ; 0x0165 + textpointer ChooseBasicPokemonToPlaceOnBenchText ; 0x0166 + textpointer ChooseEvolutionCardAndPressAButtonToDevolveText ; 0x0167 + textpointer ChoosePokemonInYourAreaThenPokemonInYourOppText ; 0x0168 textpointer Text0169 ; 0x0169 textpointer Text016a ; 0x016a - textpointer Text016b ; 0x016b - textpointer Text016c ; 0x016c - textpointer Text016d ; 0x016d - textpointer Text016e ; 0x016e - textpointer Text016f ; 0x016f + textpointer PokemonAndAllAttachedCardsWereReturnedToDeckText ; 0x016b + textpointer PokemonWasReturnedFromArenaToHandText ; 0x016c + textpointer PokemonWasReturnedFromBenchToHandText ; 0x016d + textpointer PokemonWasReturnedToDeckText ; 0x016e + textpointer WasPlacedInTheHandText ; 0x016f textpointer TheCardYouReceivedText ; 0x0170 textpointer YouReceivedTheseCardsText ; 0x0171 - textpointer Text0172 ; 0x0172 - textpointer Text0173 ; 0x0173 - textpointer Text0174 ; 0x0174 + textpointer ChooseTheCardToPutBackText ; 0x0172 + textpointer ChooseTheCardToDiscardText ; 0x0173 + textpointer DiscardedCardsFromDeckText ; 0x0174 textpointer Text0175 ; 0x0175 - textpointer Text0176 ; 0x0176 - textpointer Text0177 ; 0x0177 - textpointer Text0178 ; 0x0178 - textpointer Text0179 ; 0x0179 - textpointer Text017a ; 0x017a - textpointer Text017b ; 0x017b - textpointer Text017c ; 0x017c - textpointer Text017d ; 0x017d + textpointer NoneCameText ; 0x0176 + textpointer CameToTheBenchText ; 0x0177 + textpointer DuelistHasNoCardsInHandText ; 0x0178 + textpointer PokemonHealedDamageText ; 0x0179 + textpointer PokemonDevolvedToText ; 0x017a + textpointer ThereWasNoFireEnergyText ; 0x017b + textpointer YouCanSelectMoreCardsQuitText ; 0x017c + textpointer ThereWasNoEffectText ; 0x017d textpointer ThereWasNoEffectFromToxicText ; 0x017e textpointer ThereWasNoEffectFromPoisonText ; 0x017f textpointer ThereWasNoEffectFromSleepText ; 0x0180 textpointer ThereWasNoEffectFromParalysisText ; 0x0181 textpointer ThereWasNoEffectFromConfusionText ; 0x0182 textpointer ThereWasNoEffectFromPoisonConfusionText ; 0x0183 - textpointer Text0184 ; 0x0184 + textpointer ExchangedCardsInDuelistsHandText ; 0x0184 textpointer Text0185 ; 0x0185 textpointer Text0186 ; 0x0186 textpointer Text0187 ; 0x0187 @@ -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 @@ -2124,7 +2124,7 @@ TextOffsets:: ; 34000 (d:40 textpointer CobraName ; 0x0848 textpointer ArbokDescription ; 0x0849 textpointer NidoranFName ; 0x084a - textpointer FurySweepesName ; 0x084b + textpointer FurySwipesName ; 0x084b textpointer TripleAttackX10Description ; 0x084c textpointer CallForFamilyName ; 0x084d textpointer NidoranFsCallForFamilyDescription ; 0x084e diff --git a/src/wram.asm b/src/wram.asm index a54a8d2..761aab1 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -73,7 +73,10 @@ wPlayerArenaCard:: ; c2bb wPlayerBench:: ; c2bc ds MAX_BENCH_POKEMON + 1 - ds $6 +wPlayerArenaCardFlags:: ; c2c2 + ds $1 + + ds $5 wPlayerArenaCardHP:: ; c2c8 ds $1 @@ -102,7 +105,7 @@ wPlayerBench5CardStage:: ; c2d3 ds $1 ; changed type from Venomoth's Shift Pokemon Power -; if bit 7 == 1, then bits 0-3 override the Pokemon's actual type +; if bit 7 == 1, then bits 0-3 override the Pokemon's actual color wPlayerArenaCardChangedType:: ; c2d4 ds $1 wPlayerBench1CardChangedType:: ; c2d5 @@ -196,7 +199,21 @@ wPlayerArenaCardLastTurnDamage:: ; c2f3 wPlayerArenaCardLastTurnStatus:: ; c2f5 ds $1 - ds $a +; substatus2 that the opponent card got last turn +wPlayerArenaCardLastTurnSubstatus2:: ; c2f6 + ds $1 + +; indicates color of weakness that was changed +; for this card last turn +wPlayerArenaCardLastTurnChangeWeak:: ; c2f7 + ds $1 + +; stores an effect that was used on the Arena card last turn. +; see LAST_TURN_EFFECT_* constants. +wPlayerArenaCardLastTurnEffect:: ; c2f8 + ds $1 + + ds $7 wOpponentDuelVariables:: ; c300 @@ -221,7 +238,10 @@ wOpponentArenaCard:: ; c3bb wOpponentBench:: ; c3bc ds MAX_BENCH_POKEMON + 1 - ds $6 +wOpponentArenaCardFlags:: ; c3c2 + ds $1 + + ds $5 wOpponentArenaCardHP:: ; c3c8 ds $1 @@ -336,7 +356,20 @@ wOpponentArenaCardLastTurnDamage:: ; c3f3 wOpponentArenaCardLastTurnStatus:: ; c3f5 ds $1 - ds $a +; substatus2 that the player card got last turn +wOpponentArenaCardLastTurnSubstatus2:: ; c3f6 + ds $1 + +; indicates color of weakness that was changed +; for this card last turn +wOpponentArenaCardLastTurnChangeWeak:: ; c3f7 + ds $1 + +; whether any attached energy card was discarded last turn (0 if not) +wOpponentArenaCardLastTurnEffect:: ; c3f8 + ds $1 + + ds $7 UNION @@ -704,11 +737,10 @@ wNoItemSelectionMenuKeys:: ; cbd6 wCardPageExitKeys:: ; cbd7 ds $1 +; used to store function pointer for printing card order +; in card list reordering screen. wcbd8:: ; cbd8 - ds $1 - -wcbd9:: ; cbd9 - ds $1 + ds $2 ; in the hand or discard pile card screen, id of the text printed in the bottom-left box wCardListInfoBoxText:: ; cbda @@ -919,6 +951,7 @@ wLoadedMove:: ; cca6 ; the damage field of an used move is loaded here ; doubles as "wAIAverageDamage" when complementing wAIMinDamage and wAIMaxDamage ; little-endian +; second byte may have UNAFFECTED_BY_WEAKNESS_RESISTANCE_F set/unset wDamage:: ; ccb9 ds $2 @@ -931,13 +964,14 @@ wAIMinDamage:: ; ccbb wAIMaxDamage:: ; ccbc ds $1 +wccbd:: ; ccbd ds $2 ; damage dealt by an attack to a target wDealtDamage:: ; ccbf ds $2 -; WEAKNESS and RESISTANCE flags for a damaging attack +; WEAKNESS and RESISTANCE flags for a damaging attack wDamageEffectiveness:: ; ccc1 ds $1 @@ -987,6 +1021,7 @@ wEffectFunctionsFeedback:: ; ccce ds $18 ; this is 1 (non-0) if dealing damage to self due to confusion +; or a self-destruct type attack wIsDamageToSelf:: ; cce6 ds $1 @@ -1020,12 +1055,16 @@ wccee:: ; ccee wccef:: ; ccef ds $1 -wccf0:: ; ccf0 +; stores the energy cost of the Metronome attack being used. +; it's used to know how many attached Energy cards are being used +; to pay for the attack for damage calculation. +; if equal to 0, then the attack wasn't invoked by Metronome. +wMetronomeEnergyCost:: ; ccf0 ds $1 ; effect functions return a status condition constant here when it had no effect ; on the target, in order to print one of the ThereWasNoEffectFrom* texts -wNoEffectFromStatus:: ; ccf1 +wNoEffectFromWhichStatus:: ; ccf1 ds $1 ; when non-0, allows the player to skip some delays during a duel by pressing B. @@ -1193,10 +1232,10 @@ wAIPokedexCounter:: ; cda6 ds $1 ; variable to keep track of Mewtwo1's Barrier usage during Player' turn. -; AI_FLAG_MEWTWO_MILL set means Player is running Mewtwo1 mill deck. +; AI_MEWTWO_MILL set means Player is running Mewtwo1 mill deck. ; - 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 +1408,7 @@ wcdea:: ; cdea ; $01 = can't damage wAICannotDamage:: ; cdf0 ds $1 - + ; used by AI to store variable information wTempAI:: ; cdf1 ds $1 @@ -1413,8 +1452,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 @@ -1670,7 +1709,20 @@ wce70:: ; ce70 wce71:: ; ce71 ds $1 - ds $a +wce72:: ; ce72 + ds $1 + +; card index and its attack index chosen +; to be used by Metronome. +wMetronomeSelectedAttack:: ; ce73 + ds $2 + +; stores the amount of cards that are being ordered. +wNumberOfCardsToOrder:: ; ce75 + ds $1 + +wce76:: ; ce76 + ds MAX_PLAY_AREA_POKEMON ; used in CountPokemonIDInPlayArea wTempPokemonID_ce7c:: ; ce7c @@ -1945,7 +1997,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 @@ -2324,8 +2376,16 @@ wd4b1:: ; d4b1 wd4b2:: ; d4b2 ds $1 - - ds $b + +wd4b3:: ; d4b3 + ds $1 + + ds $5 + +wd4b9:: ; d4b9 + ds $1 + + ds $4 wd4be:: ; d4be ds $1 @@ -2390,22 +2450,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 @@ -1,180 +1,180 @@ -ROM0
- org $0000
- "rst00"
- org $0008
- "rst08"
- org $0010
- "rst10"
- org $0018
- "rst18"
- org $0020
- "rst20"
- org $0028
- "rst28"
- org $0030
- "rst30"
- org $0038
- "rst38"
- org $0040
- "vblank"
- org $0048
- "lcdc"
- org $0050
- "timer"
- org $0058
- "serial"
- org $0060
- "joypad"
- org $0100
- "romheader"
- org $0150
- "start"
-ROMX $01
- "Bank 1"
-ROMX $02
- "Bank 2"
-ROMX $03
- "Bank 3"
-ROMX $04
- "Bank 4"
-ROMX $06
- "Bank 6"
-ROMX $07
- "Bank 7"
- "Booster Packs"
-ROMX $08
- "Bank 8"
-ROMX $09
- "Empty Bank 9"
-ROMX $0a
- "Empty Bank A"
-ROMX $0b
- "Effect Functions"
-ROMX $0c
- "Decks"
- "Cards"
+ROM0 + org $0000 + "rst00" + org $0008 + "rst08" + org $0010 + "rst10" + org $0018 + "rst18" + org $0020 + "rst20" + org $0028 + "rst28" + org $0030 + "rst30" + org $0038 + "rst38" + org $0040 + "vblank" + org $0048 + "lcdc" + org $0050 + "timer" + org $0058 + "serial" + org $0060 + "joypad" + org $0100 + "romheader" + org $0150 + "start" +ROMX $01 + "Bank 1" +ROMX $02 + "Bank 2" +ROMX $03 + "Bank 3" +ROMX $04 + "Bank 4" +ROMX $06 + "Bank 6" +ROMX $07 + "Bank 7" + "Booster Packs" +ROMX $08 + "Bank 8" +ROMX $09 + "Empty Bank 9" +ROMX $0a + "Empty Bank A" +ROMX $0b + "Effect Functions" +ROMX $0c + "Decks" + "Cards" ROMX $0d - "Text 1"
+ "Text 1" ROMX $0e - "Text 2"
+ "Text 2" ROMX $0f - "Text 3"
+ "Text 3" ROMX $10 - "Text 4"
+ "Text 4" ROMX $11 - "Text 5"
+ "Text 5" ROMX $12 - "Text 6"
+ "Text 6" ROMX $13 - "Text 7"
+ "Text 7" ROMX $14 - "Text 8"
+ "Text 8" ROMX $15 - "Text 9"
+ "Text 9" ROMX $16 - "Text 10"
+ "Text 10" ROMX $17 - "Text 11"
+ "Text 11" ROMX $18 - "Text 12"
+ "Text 12" ROMX $19 - "Text 13"
+ "Text 13" ROMX $1a - "Empty Bank 1A"
+ "Empty Bank 1A" ROMX $1b - "Empty Bank 1B"
+ "Empty Bank 1B" ROMX $1c - "Bank 1C"
+ "Bank 1C" ROMX $1d - "Gfx 1"
+ "Gfx 1" ROMX $1e - "Gfx 2"
+ "Gfx 2" ROMX $1f - "Empty Bank 1F"
+ "Empty Bank 1F" ROMX $20 - "Bank 20"
+ "Bank 20" ROMX $21 - "Gfx 3"
+ "Gfx 3" ROMX $22 - "Gfx 4"
+ "Gfx 4" ROMX $23 - "Gfx 5"
+ "Gfx 5" ROMX $24 - "Gfx 6"
+ "Gfx 6" ROMX $25 - "Gfx 7"
+ "Gfx 7" ROMX $26 - "Gfx 8"
+ "Gfx 8" ROMX $27 - "Gfx 9"
+ "Gfx 9" ROMX $28 - "Gfx 10"
+ "Gfx 10" ROMX $29 - "Gfx 11"
+ "Gfx 11" ROMX $2a - "Gfx 12"
+ "Gfx 12" ROMX $2b - "Gfx 13"
+ "Gfx 13" ROMX $2c - "Gfx 14"
+ "Gfx 14" ROMX $2d - "Gfx 15"
+ "Gfx 15" ROMX $2e - "Gfx 16"
+ "Gfx 16" ROMX $2f - "Empty Bank 2F"
+ "Empty Bank 2F" ROMX $30 - "Empty Bank 30"
+ "Empty Bank 30" ROMX $31 - "Card Gfx 1"
+ "Card Gfx 1" ROMX $32 - "Card Gfx 2"
+ "Card Gfx 2" ROMX $33 - "Card Gfx 3"
+ "Card Gfx 3" ROMX $34 - "Card Gfx 4"
+ "Card Gfx 4" ROMX $35 - "Card Gfx 5"
+ "Card Gfx 5" ROMX $36 - "Card Gfx 6"
+ "Card Gfx 6" ROMX $37 - "Card Gfx 7"
+ "Card Gfx 7" ROMX $38 - "Card Gfx 8"
+ "Card Gfx 8" ROMX $39 - "Card Gfx 9"
+ "Card Gfx 9" ROMX $3a - "Card Gfx 10"
+ "Card Gfx 10" ROMX $3b - "Card Gfx 11"
+ "Card Gfx 11" ROMX $3c - "Empty Bank 3C"
-ROMX $3d
- "Audio 1"
-ROMX $3e
- "Audio 2"
-ROMX $3f
- "Audio 3"
-WRAM0
- "WRAM0"
- "WRAM0 Duels 1"
- "WRAM0 Text Engine"
- "WRAM0 1"
- "WRAM0 Serial Transfer"
- "WRAM0 Duels 2"
- "WRAM0 2"
-WRAMX 1
- "WRAM1"
- "WRAM1 Audio"
-VRAM $00
- "VRAM0"
-VRAM $01
- "VRAM1"
-SRAM $00
- "SRAM0"
-SRAM $01
- "SRAM1"
-SRAM $02
- "SRAM2"
-SRAM $03
- "SRAM3"
+ "Empty Bank 3C" +ROMX $3d + "Audio 1" +ROMX $3e + "Audio 2" +ROMX $3f + "Audio 3" +WRAM0 + "WRAM0" + "WRAM0 Duels 1" + "WRAM0 Text Engine" + "WRAM0 1" + "WRAM0 Serial Transfer" + "WRAM0 Duels 2" + "WRAM0 2" +WRAMX 1 + "WRAM1" + "WRAM1 Audio" +VRAM $00 + "VRAM0" +VRAM $01 + "VRAM1" +SRAM $00 + "SRAM0" +SRAM $01 + "SRAM1" +SRAM $02 + "SRAM2" +SRAM $03 + "SRAM3" diff --git a/tools/script_extractor.py b/tools/script_extractor.py index f043010..812678c 100644 --- a/tools/script_extractor.py +++ b/tools/script_extractor.py @@ -148,7 +148,7 @@ def printScript(game_data, loc, auto, ignore_broken, scriptList, \ #print("Error: first byte was not start_script") print(".ows_" + format(loc,"04x")) else: - + # TODO this is hacky please don't do this printHeader(loc, "Script_") loc += 1 @@ -188,14 +188,14 @@ def createList(): # this is a func just so all this can go at the bottom ("ScriptCommand_MoveActiveNPCByDirection", "w", DO_NOT_QUIT), ("ScriptCommand_CloseTextBox", "", DO_NOT_QUIT), ("ScriptCommand_GiveBoosterPacks", "bbb", DO_NOT_QUIT), - ("Func_cf0c", "bj", DO_NOT_QUIT), # more complex behavior too (jumping) - ("Func_cf12", "bj", DO_NOT_QUIT), + ("ScriptCommand_CheckIfCardInCollectionOrDecks", "bj", DO_NOT_QUIT), # more complex behavior too (jumping) + ("ScriptCommand_CheckIfCardInCollection", "bj", DO_NOT_QUIT), ("ScriptCommand_GiveCard", "b", DO_NOT_QUIT), ("ScriptCommand_TakeCard", "b", DO_NOT_QUIT), ("Func_cf53", "w", DO_NOT_QUIT), # more complex behavior too (jumping) ("Func_cf7b", "", DO_NOT_QUIT), - ("Func_cf2d", "bbbb", DO_NOT_QUIT), # more complex behavior too (jumping + ??) - ("Func_cf96", "w", DO_NOT_QUIT), # only jumps? still needs args to do that though + ("ScriptCommand_CheckRawAmountOfCardsOwned", "bbbb", DO_NOT_QUIT), # more complex behavior too (jumping + ??) + ("ScriptCommand_JumpBasedOnFightingClubPupilStatus", "w", DO_NOT_QUIT), # only jumps? still needs args to do that though ("Func_cfc6", "b", DO_NOT_QUIT), ("Func_cfd4", "", DO_NOT_QUIT), ("Func_d00b", "", DO_NOT_QUIT), # includes something with random and extra data diff --git a/tools/tcgdisasm.py b/tools/tcgdisasm.py index 579d577..a887b1e 100644 --- a/tools/tcgdisasm.py +++ b/tools/tcgdisasm.py @@ -763,16 +763,17 @@ class Disassembler(object): # handle the special flag macros found_flag_macro = False - for flag_macro in flag_macros: - if flag_macro[0] == target_offset: - found_flag_macro = True - current_flag_macro = flag_macro - event_flag = "EVENT_FLAG_" + format(opcode_arg_3, "02X") - opcode_output_str = flag_macro[1].format(event_flag) - - # we need to skip a byte since this macro takes one extra - opcode_nargs+=1 - break + if opcode_byte == 0xcd: + for flag_macro in flag_macros: + if flag_macro[0] == target_offset: + found_flag_macro = True + current_flag_macro = flag_macro + event_flag = "EVENT_FLAG_" + format(opcode_arg_3, "02X") + opcode_output_str = flag_macro[1].format(event_flag) + + # we need to skip a byte since this macro takes one extra + opcode_nargs+=1 + break if not found_flag_macro and opcode_byte in call_commands + absolute_jumps: |