From d38e3eb5dfa214b55865d85387fa412feca5c48b Mon Sep 17 00:00:00 2001 From: Test User Date: Thu, 4 Jun 2026 12:54:04 -0400 Subject: [PATCH] Mirror poketcg #187 in-duel action hRAM refactor; sync Imakuni AI name Adopt the duel-action hRAM scheme from poketcg (tcg1) draft PR #187 so the shared duel engine's documentation stays synchronised across both repos. - Add src/constants/duel_action_constants.asm verbatim from #187 (DUEL_ACTION_* struct offsets + per-action arg constants). The offsets are relative, so they apply unchanged despite tcg2's hRAM being shifted +2 vs tcg1. - hram.asm: replace hTempCardIndex_ff9f / hTemp_ffa0 / hTempPlayAreaLocation_ffa1 / hTempRetreatCostCards / hAIPkmnPowerEffectParam / hAIEnergyTrans* / hPlayAreaEffectTarget with hDuelAction / hDuelActionCardIndex / hDuelActionArgs. This also retires tcg2's stale "_ffNN" suffixes, which were wrong (tcg2's were copied from tcg1 but sit +2 higher). hOppActionTableIndex and the 15-byte hTempList are kept as tcg2-specific union members (tcg2 has hCurSelectionItem at $ffb2; tcg1's hTempList was only 8 bytes and was folded away). - Sweep 1263 call sites across 14 engine/home files to the new names; serial send/recv buffer base -> hDuelAction; wram pointer comment updated. - Rename AIDecide_ImakuniCard / AIPlay_ImakuniCard -> AIDecide_Imakuni / AIPlay_Imakuni to match tcg1. make compare: OK (byte-identical to baserom). Co-Authored-By: Claude Opus 4.8 (1M context) --- src/constants.asm | 1 + src/constants/duel_action_constants.asm | 69 ++ src/engine/bank01.asm | 72 +-- src/engine/bank02.asm | 4 +- src/engine/bank05.asm | 68 +- src/engine/bank08.asm | 252 ++++---- src/engine/bank09.asm | 54 +- src/engine/bank0a.asm | 170 ++--- src/engine/bank0e.asm | 190 +++--- src/engine/bank12.asm | 132 ++-- src/engine/duel/effect_functions1.asm | 734 ++++++++++----------- src/engine/duel/effect_functions2.asm | 806 ++++++++++++------------ src/engine/duel/special_attacks.asm | 2 +- src/home/ai.asm | 4 +- src/home/duel.asm | 26 +- src/home/serial.asm | 12 +- src/hram.asm | 51 +- src/wram.asm | 2 +- 18 files changed, 1350 insertions(+), 1299 deletions(-) create mode 100644 src/constants/duel_action_constants.asm diff --git a/src/constants.asm b/src/constants.asm index 8a3217c..fef89b5 100644 --- a/src/constants.asm +++ b/src/constants.asm @@ -9,6 +9,7 @@ INCLUDE "constants/coin_constants.asm" INCLUDE "constants/credits_constants.asm" INCLUDE "constants/deck_ai_constants.asm" INCLUDE "constants/deck_constants.asm" +INCLUDE "constants/duel_action_constants.asm" INCLUDE "constants/duel_constants.asm" INCLUDE "constants/duel_interface_constants.asm" INCLUDE "constants/game_center_constants.asm" diff --git a/src/constants/duel_action_constants.asm b/src/constants/duel_action_constants.asm new file mode 100644 index 0000000..9b1a75f --- /dev/null +++ b/src/constants/duel_action_constants.asm @@ -0,0 +1,69 @@ +; in-duel action structs +RSRESET +DEF DUEL_ACTION_STRUCT_ACTION_INDEX RB ; $0 +DEF DUEL_ACTION_STRUCT_CARD_INDEX RB ; $1 +DEF DUEL_ACTION_STRUCT_ARGS RB 7 ; $2 +DEF DUEL_ACTION_STRUCT_TERMINATOR RB ; $9 + +DEF DUEL_ACTION_ARGS_SIZE EQU DUEL_ACTION_STRUCT_TERMINATOR - DUEL_ACTION_STRUCT_ARGS ; 7 +DEF DUEL_ACTION_STRUCT_SIZE EQU _RS ; 10 + +; common sets of argument offset in DUEL_ACTION_STRUCT_ARGS +; play pkmn/energy card from hand +RSRESET +DEF PLAYCARD_ARGS_CARD_INDEX RB ; $0 +DEF PLAYCARD_ARGS_TO_PLAY_AREA RB ; $1 + +; retreat +RSRESET +DEF RETREAT_ARGS_STATUS RB ; $0 +DEF RETREAT_ARGS_BENCH RB ; $1 +DEF RETREAT_ARGS_COST_LIST RB 5 ; $2 + +; pkmn powers +RSRESET +DEF PKMNPOWER_ARGS_PLAY_AREA RB ; $0 + +; choose-1-pkmn effect +DEF PKMNPOWER_TARGET_ARGS_TO_PLAY_AREA RB ; $1 + +; coin flip + choose-1-pkmn effect +RSSET PKMNPOWER_ARGS_PLAY_AREA + 1 +DEF PKMNPOWER_COIN_ARGS_COIN_RESULT RB ; $1 +DEF PKMNPOWER_COIN_ARGS_TO_PLAY_AREA RB ; $2 + +; move from-to effect +RSSET PKMNPOWER_ARGS_PLAY_AREA + 1 +DEF PKMNPOWER_MOVE_ARGS_FROM_PLAY_AREA RB ; $1 +DEF PKMNPOWER_MOVE_ARGS_TO_PLAY_AREA RB ; $2 + +; energy trans +RSSET PKMNPOWER_ARGS_PLAY_AREA + 1 +DEF ENERGYTRANS_ARGS_FROM_PLAY_AREA RB ; $1 +DEF ENERGYTRANS_ARGS_ENERGY_INDEX RB ; $2 +DEF ENERGYTRANS_ARGS_TO_PLAY_AREA RB ; $3 + +; shift +RSSET PKMNPOWER_ARGS_PLAY_AREA + 1 +DEF VENOMOTH_SHIFT_ARGS_TARGET_COLOR RB ; $1 + +; peek +RSSET PKMNPOWER_ARGS_PLAY_AREA + 1 +DEF MANKEY_PEEK_ARGS_TARGET RB ; $1 + +; trainers +; potion +RSRESET +DEF POTION_ARGS_TO_PLAY_AREA RB ; $0 +DEF POTION_ARGS_HEAL_AMOUNT RB ; $1 + +; super potion +RSRESET +DEF SUPERPOTION_ARGS_DISCARD_ENERGY_INDEX RB ; $0 +DEF SUPERPOTION_ARGS_TO_PLAY_AREA RB ; $1 +DEF SUPERPOTION_ARGS_HEAL_AMOUNT RB ; $2 + +; prize cards +RSRESET +DEF SELECTPRIZE_ARGS_BITFIELD RB ; $0 +DEF SELECTPRIZE_ARGS_SELECTED_CARD_INDICES RB 6 ; $1 diff --git a/src/engine/bank01.asm b/src/engine/bank01.asm index c936911..219c29a 100644 --- a/src/engine/bank01.asm +++ b/src/engine/bank01.asm @@ -560,7 +560,7 @@ DuelMenu_Retreat: get_turn_duelist_var and CNF_SLP_PRZ cp CONFUSED - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr nz, .not_confused ld a, [wGotHeadsFromConfusionCheckDuringRetreat] or a @@ -575,7 +575,7 @@ DuelMenu_Retreat: jr c, .done ld [wBenchSelectedPokemon], a ld a, [wBenchSelectedPokemon] ; unnecessary - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_ATTEMPT_RETREAT call SetOppAction_SerialSendDuelData call AttemptRetreat @@ -603,7 +603,7 @@ DuelMenu_Retreat: call DrawWideTextBox_WaitForInput call OpenPlayAreaScreenForSelection ld [wBenchSelectedPokemon], a - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a push af call ReturnRetreatCostCardsToArena pop af @@ -685,10 +685,10 @@ PlayEnergyCard: ld [wAlreadyPlayedEnergy], a .play_energy ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld e, a ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call PutHandCardInPlayArea call PrintPlayAreaCardList_EnableLCD ld a, OPPACTION_PLAY_ENERGY @@ -736,10 +736,10 @@ PlayPokemonCard: cp [hl] jr nc, .no_space ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call PutHandPokemonCardInPlayArea ldh [hTempPlayAreaLocation_ff9d], a - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a add DUELVARS_ARENA_CARD_STAGE get_turn_duelist_var ld [hl], BASIC @@ -809,9 +809,9 @@ PlayPokemonCard: call OpenPlayAreaScreenForSelection jr c, .done ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call EvolvePokemonCardIfPossible jr c, .try_evolve_loop ; jump if evolution wasn't successful somehow ld a, OPPACTION_EVOLVE_PKMN @@ -919,14 +919,14 @@ CheckIfEnoughEnergiesToRetreat: ; energy cards have been selected or if the player declines to retreat. DisplayRetreatScreen: ld a, $ff - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ld a, [wEnergyCardsRequiredToRetreat] or a ret z ; return if no energy cards are required at all xor a ld [wNumRetreatEnergiesSelected], a call CreateArenaOrBenchEnergyCardList - ld a, LOW(hTempRetreatCostCards) + ld a, LOW(hDuelActionArgs + RETREAT_ARGS_COST_LIST) ld [wTempRetreatCostCardsPos], a xor a call DisplayEnergyDiscardMenu @@ -939,7 +939,7 @@ DisplayRetreatScreen: ret c ldh a, [hTempCardIndex_ff98] call LoadCardDataToBuffer2_FromDeckIndex - ; append selected energy card to hTempRetreatCostCards + ; append selected energy card to hDuelActionArgs + RETREAT_ARGS_COST_LIST ld hl, wTempRetreatCostCardsPos ld c, [hl] inc [hl] @@ -965,7 +965,7 @@ DisplayRetreatScreen: call UpdateAttachedEnergyMenu jr .select_energies_loop .enough - ; terminate hTempRetreatCostCards array with $ff + ; terminate hDuelActionArgs + RETREAT_ARGS_COST_LIST array with $ff ld a, [wTempRetreatCostCardsPos] ld c, a ld a, $ff @@ -1515,14 +1515,14 @@ HandleDuelSetup: call SwapTurn farcall PlayShuffleAndDrawCardsAnimation_BothDuelists call ShuffleDeckAndDrawSevenCards - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn call ShuffleDeckAndDrawSevenCards call SwapTurn ld c, a ; check if any Basic Pokémon cards were drawn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld b, a and c jr nz, .hand_cards_ok @@ -3061,7 +3061,7 @@ TurnDuelistTakePrizes: call DrawWideTextBox_WaitForInput ld a, [wNumberPrizeCardsToTake] call SelectPrizeCards - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld d, [hl] inc hl ld e, [hl] @@ -4957,7 +4957,7 @@ DisplayPlayAreaScreenToUsePkmnPower: call YesOrNoMenu jp c, .start ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret .cancel @@ -5042,9 +5042,9 @@ PrintAttackOrCardDescription: call SetOneLineSeparation ret -; moves the cards loaded by deck index at hTempRetreatCostCards to the discard pile +; moves the cards loaded by deck index at hDuelActionArgs + RETREAT_ARGS_COST_LIST to the discard pile DiscardRetreatCostCards: - ld hl, hTempRetreatCostCards + ld hl, hDuelActionArgs + RETREAT_ARGS_COST_LIST .discard_loop ld a, [hli] cp $ff @@ -5052,11 +5052,11 @@ DiscardRetreatCostCards: call PutCardInDiscardPile jr .discard_loop -; moves the discard pile cards that were loaded to hTempRetreatCostCards back to the active Pokemon. +; moves the discard pile cards that were loaded to hDuelActionArgs + RETREAT_ARGS_COST_LIST back to the active Pokemon. ; this exists because they will be discarded again during the call to AttemptRetreat, so ; it prevents the energy cards from being discarded twice. ReturnRetreatCostCardsToArena: - ld hl, hTempRetreatCostCards + ld hl, hDuelActionArgs + RETREAT_ARGS_COST_LIST .loop ld a, [hli] cp $ff @@ -5073,7 +5073,7 @@ ReturnRetreatCostCardsToArena: ; return carry if unable to retreat this turn due to unsuccessful confusion check ; if successful, the retreated card is replaced with a bench Pokemon card AttemptRetreat: - ld hl, hTempRetreatCostCards + ld hl, hDuelActionArgs + RETREAT_ARGS_COST_LIST .discard_loop ld a, [hli] cp $ff @@ -5082,7 +5082,7 @@ AttemptRetreat: jr .discard_loop .asm_6033 - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] and CNF_SLP_PRZ cp CONFUSED jr nz, .success @@ -5102,7 +5102,7 @@ AttemptRetreat: get_turn_duelist_var push af - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a call SwapArenaWithBenchPokemon call HandleDestinyBondAndBetweenTurnKnockOuts @@ -5368,9 +5368,9 @@ LoadPlayAreaCardID: ; the player, and possibly to use it if it triggers when the card is played. ProcessPlayedPokemonCard: ldh a, [hTempCardIndex_ff98] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_PROCESS_PLAYED_PKMN call SetOppAction_SerialSendDuelData call .Process @@ -5383,15 +5383,15 @@ ProcessPlayedPokemonCard: ret .Process: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] ldh [hTempCardIndex_ff98], a call ClearChangedTypesIfMuk - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] ld d, a ld e, FIRST_ATTACK_OR_PKMN_POWER call CopyAttackDataAndDamage_FromDeckIndex call ClearTwoTurnDuelVars - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call GetCardIDFromDeckIndex ld hl, wTempTurnDuelistCardID ld [hl], e @@ -5440,7 +5440,7 @@ ProcessPlayedPokemonCard: call CheckMatchingCommand jr c, .not_using_pkmn_power call DrawDuelMainScene - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call LoadCardDataToBuffer1_FromDeckIndex ld de, wLoadedCard1Name ld hl, wTxRam2 @@ -6129,7 +6129,7 @@ ReplaceKnockedOutPokemon: cp DUELIST_TYPE_LINK_OPP jr z, .link_opponent call AIDoAction_KOSwitch - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hTempPlayAreaLocation_ff9d], a jr .replace_pokemon @@ -6669,7 +6669,7 @@ PlayTrainerCard: ldh a, [hWhoseTurn] ld h, a ldh a, [hTempCardIndex_ff98] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a call LoadNonPokemonCardEffectCommands ld a, EFFECTCMDTYPE_INITIAL_EFFECT_1 call TryExecuteEffectCommandFunction @@ -6694,7 +6694,7 @@ PlayTrainerCard: call SetOppAction_SerialSendDuelData ld a, EFFECTCMDTYPE_BEFORE_DAMAGE call TryExecuteEffectCommandFunction - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call MoveHandCardToDiscardPile call ExchangeRNG ld a, [wcd15] @@ -6706,10 +6706,10 @@ PlayTrainerCard: or a ret -; loads the effect commands of a (trainer or energy) card with deck index (0-59) at hTempCardIndex_ff9f +; loads the effect commands of a (trainer or energy) card with deck index (0-59) at hDuelActionCardIndex ; into wLoadedAttackEffectCommands. in practice, only used for trainer cards LoadNonPokemonCardEffectCommands: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call LoadCardDataToBuffer1_FromDeckIndex ld hl, wLoadedCard1EffectCommands ld de, wLoadedAttackEffectCommands @@ -6727,7 +6727,7 @@ LoadNonPokemonCardEffectCommands: Func_6986: ldh a, [hTempCardIndex_ff98] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a call LoadNonPokemonCardEffectCommands ld hl, wLoadedAttackEffectCommands ld a, [hli] diff --git a/src/engine/bank02.asm b/src/engine/bank02.asm index 456dba9..372ef5d 100644 --- a/src/engine/bank02.asm +++ b/src/engine/bank02.asm @@ -1999,7 +1999,7 @@ _SelectPrizeCards:: xor a call GetFirstSetPrizeCard ld [wMultiDirectionalMenuCursorPosition], a - ld de, hTempPlayAreaLocation_ffa1 + ld de, hDuelActionArgs + 1 ld hl, wSelectedPrizeCardListPtr ld [hl], e inc hl @@ -2017,7 +2017,7 @@ _SelectPrizeCards:: .selection_made ld a, DUELVARS_PRIZES get_turn_duelist_var - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wSelectedPrizeCardListPtr] ld l, a ld a, [wSelectedPrizeCardListPtr + 1] diff --git a/src/engine/bank05.asm b/src/engine/bank05.asm index 6aacfc8..a4c31ae 100644 --- a/src/engine/bank05.asm +++ b/src/engine/bank05.asm @@ -6431,9 +6431,9 @@ Func_167e5: jr c, .dont_play_energy_card .asm_1682a ld a, [wDuelTempList] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a xor a ; PLAY_AREA_ARENA - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_PLAY_ENERGY farcall AIMakeDecision @@ -6447,9 +6447,9 @@ Func_167e5: jp z, .mysterious_fossil_or_clefairy_doll ; if card is Asleep or Paralyzed, set carry and exit -; else, load the status in hTemp_ffa0 +; else, load the status in hDuelActionArgs + 0 pop af - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, DUELVARS_ARENA_CARD_STATUS get_turn_duelist_var ld b, a @@ -6459,9 +6459,9 @@ Func_167e5: cp PARALYZED jp z, .set_carry ld a, b - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, $ff - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ; check energy required to retreat ; if the cost is 0, retreat right away @@ -6484,7 +6484,7 @@ Func_167e5: cp c jr nz, .choose_energy_discard - ld hl, hTempRetreatCostCards + ld hl, hDuelActionArgs + RETREAT_ARGS_COST_LIST ld de, wDuelTempList .loop_select_all_cards ld a, [de] @@ -6513,7 +6513,7 @@ Func_167e5: ; first, look for and discard any Recycle energy cards ld hl, wDuelTempList - ld de, hTempRetreatCostCards + ld de, hDuelActionArgs + RETREAT_ARGS_COST_LIST .loop_select_recycle_energy ld a, [hli] cp $ff @@ -6633,13 +6633,13 @@ Func_167e5: .has_bench ld a, DUELVARS_ARENA_CARD get_turn_duelist_var - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a xor a ; PLAY_AREA_ARENA - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision pop af - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT farcall AIMakeDecision ld a, OPPACTION_DUEL_MAIN_SCENE @@ -6761,15 +6761,15 @@ AIDecidePlayPokemonCard: cp 180 jr c, .skip ld a, [wTempAIPokemonCard] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckIfCardCanBePlayed jr c, .skip ld a, OPPACTION_PLAY_BASIC_PKMN farcall AIMakeDecision ld a, [wTempAIPokemonCard] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_PROCESS_PLAYED_PKMN farcall AIMakeDecision ld a, [wcd18] @@ -6838,15 +6838,15 @@ AIDecideEvolution: jr nc, .done_bench_pokemon ld a, [wTempAI] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wTempAIPokemonCard] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_EVOLVE_PKMN farcall AIMakeDecision ld a, [wTempAIPokemonCard] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_PROCESS_PLAYED_PKMN farcall AIMakeDecision ld a, [wcd18] @@ -8008,7 +8008,7 @@ AITryToPlayEnergyCard: ; in this case, Pokémon needs a specific basic energy card. ; look for basic energy card needed in hand and play it. call LookForCardIDInHand - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jp nc, .play_energy_card ; it might be that there's no basic energy is not in hand, @@ -8020,7 +8020,7 @@ AITryToPlayEnergyCard: jr c, .colorless_energy ld de, RAINBOW_ENERGY call LookForCardIDInHand - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr nc, .play_energy_card ; in this case Pokémon just needs colorless (any basic energy card). @@ -8040,7 +8040,7 @@ AITryToPlayEnergyCard: ld a, [hli] cp $ff jr z, .check_recycle_energy - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call GetCardIDFromDeckIndex cp16 DOUBLE_COLORLESS_ENERGY jr nz, .loop_1 @@ -8050,7 +8050,7 @@ AITryToPlayEnergyCard: .check_recycle_energy ld de, RECYCLE_ENERGY call LookForCardIDInHand - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr nc, .play_energy_card ; otherwise, try to play any Basic Energy card @@ -8058,7 +8058,7 @@ AITryToPlayEnergyCard: ld a, [wDuelTempList] cp $ff jr z, .no_basic_energy - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr .play_energy_card .no_basic_energy @@ -8083,7 +8083,7 @@ AITryToPlayEnergyCard: ld a, [hli] cp $ff jr z, .check_if_done - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a push hl farcall Func_4c25c pop hl @@ -8091,10 +8091,10 @@ AITryToPlayEnergyCard: cp -1 jr nz, .asm_171d6 -; plays energy card loaded in hTemp_ffa0 and sets carry flag. +; plays energy card loaded in hDuelActionArgs + 0 and sets carry flag. .play_energy_card ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_PLAY_ENERGY farcall AIMakeDecision scf @@ -8168,7 +8168,7 @@ AICheckSpecialColorlessEnergyCards: ld de, POTION_ENERGY call LookForCardIDInHand jr c, .done - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a pop hl pop de pop bc @@ -8197,7 +8197,7 @@ AICheckSpecialColorlessEnergyCards: ld de, FULLHEAL_ENERGY call LookForCardIDInHand jr c, .done - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a pop hl pop de pop bc @@ -8261,7 +8261,7 @@ AICheckSpecialColorlessEnergyCards: bank1call CreateEnergyCardListFromHand ld a, [wDuelTempList] .has_double_colorless_in_hand - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a pop hl pop de pop bc @@ -8281,7 +8281,7 @@ AICheckSpecialColorlessEnergyCards: call LookForCardIDInHand jp c, .done ; has no Double Colorless in hand ; pick double colorless - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a pop hl pop de pop bc @@ -9454,11 +9454,11 @@ LoadDefendingPokemonColorWRAndPrizeCards: ; handles AI choosing parameters for certain attacks as well. AITryUseAttack: ld a, [wSelectedAttack] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld e, a ld a, DUELVARS_ARENA_CARD get_turn_duelist_var - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld d, a call CopyAttackDataAndDamage_FromDeckIndex ld a, OPPACTION_BEGIN_ATTACK @@ -9914,7 +9914,7 @@ ConvertColorToEnergyCardID: ; input: ; a = card index to check CheckIfCardCanBePlayed: - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a call LoadCardDataToBuffer1_FromDeckIndex ld a, [wLoadedCard1Type] cp TYPE_ENERGY @@ -9950,7 +9950,7 @@ CheckIfCardCanBePlayed: .loop push bc ld e, b - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] ld d, a call CheckIfCanEvolveInto pop bc diff --git a/src/engine/bank08.asm b/src/engine/bank08.asm index 6da9662..d890e1e 100644 --- a/src/engine/bank08.asm +++ b/src/engine/bank08.asm @@ -46,7 +46,7 @@ AITrainerCardLogic: ai_trainer_card_logic AI_TRAINER_CARD_PHASE_03, RECYCLE, AIDecide_Recycle, AIPlay_Recycle ai_trainer_card_logic AI_TRAINER_CARD_PHASE_13, LASS, AIDecide_Lass, AIPlay_Lass ai_trainer_card_logic AI_TRAINER_CARD_PHASE_04, ITEMFINDER, AIDecide_ItemFinder, AIPlay_ItemFinder - ai_trainer_card_logic AI_TRAINER_CARD_PHASE_01, IMAKUNI_CARD, AIDecide_ImakuniCard, AIPlay_ImakuniCard + ai_trainer_card_logic AI_TRAINER_CARD_PHASE_01, IMAKUNI_CARD, AIDecide_Imakuni, AIPlay_Imakuni ai_trainer_card_logic AI_TRAINER_CARD_PHASE_01, GAMBLER, AIDecide_Gambler, AIPlay_Gambler ai_trainer_card_logic AI_TRAINER_CARD_PHASE_05, REVIVE, AIDecide_Revive, AIPlay_Revive ai_trainer_card_logic AI_TRAINER_CARD_PHASE_06, POKEMON_FLUTE, AIDecide_PokemonFlute, AIPlay_PokemonFlute @@ -129,7 +129,7 @@ AIProcessHandTrainerCards: push hl push de ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ; if Headache effects prevent playing card ; move on to the next item in list. @@ -162,7 +162,7 @@ AIProcessHandTrainerCards: push de push hl ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_PLAY_TRAINER farcall AIMakeDecision pop hl @@ -274,16 +274,16 @@ CalculateBDividedByA_Bank08: ; makes AI use Potion card. AIPlay_Potion: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld e, a call GetCardDamageAndMaxHP cp 20 jr c, .play_card ld a, 20 .play_card - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -486,11 +486,11 @@ AIDecide_Potion_Phase11_Deck74: ; never overheals. AIPlay_SuperPotion: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a farcall AIPickEnergyCardToDiscard - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wAITrainerCardParameter] ld e, a call GetCardDamageAndMaxHP @@ -498,7 +498,7 @@ AIPlay_SuperPotion: jr c, .heal_amount ; heal min(damage, 40) ld a, $28 .heal_amount - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -699,13 +699,13 @@ AIDecide_SuperPotion_Phase13: farcall BigThunderDeckAIDecideSuperPotion ret -; Shared by Phase_13 and Phase_14. Forwards hTemp_ffa0 = 0 since +; Shared by Phase_13 and Phase_14. Forwards hDuelActionArgs + 0 = 0 since ; Defender doesn't need a target parameter beyond the active slot. AIPlay_Defender: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -952,7 +952,7 @@ AIPlay_PlusPower: ld a, [wAITrainerCardParameter] ld [wAIPlusPowerAttack], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -1225,9 +1225,9 @@ AIPlay_Switch: or AI_FLAG_USED_SWITCH ld [wCurrentAIFlags], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision xor a @@ -1488,9 +1488,9 @@ AIPlay_GustOfWind: or AI_FLAG_USED_GUST_OF_WIND ld [wCurrentAIFlags], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -1858,7 +1858,7 @@ CheckIfCanDamageBenchedPokemon: AIPlay_Bill: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -1875,11 +1875,11 @@ AIDecide_Bill: AIPlay_EnergyRemoval: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -2339,15 +2339,15 @@ AIDecide_EnergyRemoval_Deck74: ; the list. AIPlay_SuperEnergyRemoval: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wTempAIMultiTargetCardDeckIndex2] - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ld a, [wTempAIMultiTargetCardDeckIndex3] - ldh [hAIEnergyTransPlayAreaLocation], a + ldh [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA], a ld a, [$d09a] ldh [$ffa6], a ld a, $ff @@ -2584,20 +2584,20 @@ ScoreSuperEnergyRemovalTarget: ; bail out cleanly if the prior step rejected the choice. AIPlay_PokemonBreeder: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ld a, [wcd15] cp $ff ret z - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld [wTempAIPokemonCard], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, $18 farcall AIMakeDecision ld a, [wcd18] @@ -3055,7 +3055,7 @@ AIPlay_ProfessorOak: or AI_FLAG_USED_PROFESSOR_OAK | AI_FLAG_MODIFIED_HAND ld [wCurrentAIFlags], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -3492,17 +3492,17 @@ AIPlay_EnergyRetrieval: or AI_FLAG_MODIFIED_HAND ld [wCurrentAIFlags], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wTempAIMultiTargetCardDeckIndex2] - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a cp $ff jr z, .single_target ld a, $ff - ldh [hAIEnergyTransPlayAreaLocation], a + ldh [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA], a .single_target ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision @@ -4145,15 +4145,15 @@ AIPlay_SuperEnergyRetrieval: or AI_FLAG_MODIFIED_HAND ld [wCurrentAIFlags], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wTempAIMultiTargetCardDeckIndex2] - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ld a, [wTempAIMultiTargetCardDeckIndex3] - ldh [hAIEnergyTransPlayAreaLocation], a + ldh [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA], a cp $ff jr z, .done ld a, [$d09a] @@ -4384,7 +4384,7 @@ RemoveCardFromListByValue: ; Energy attached to them. AIPlay_PokemonCenter: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -4461,7 +4461,7 @@ AIDecide_PokemonCenter: AIPlay_ImposterProfessorOak: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -4514,9 +4514,9 @@ AIDecide_ImposterProfessorOak: AIPlay_EnergySearch: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -4762,15 +4762,15 @@ LookForUsefulEnergyForGrassPokemon: ; The play wrapper forwards the chosen ordering (slots 1-3 plus $d09a/$d09b). AIPlay_Pokedex: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex2] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wTempAIMultiTargetCardDeckIndex3] - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ld a, [$d09a] - ldh [hAIEnergyTransPlayAreaLocation], a + ldh [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA], a ld a, [$d09b] ldh [$ffa6], a ld a, $ff @@ -4897,7 +4897,7 @@ GetCardTypeFromDeckIndex: AIPlay_FullHeal: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -5028,9 +5028,9 @@ AIDecide_FullHeal_Deck53: AIPlay_MrFuji: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -5141,11 +5141,11 @@ AIDecide_MrFuji_Deck6D: AIPlay_ScoopUp: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -5395,11 +5395,11 @@ AIPlay_Maintenance: or AI_FLAG_MODIFIED_HAND ld [wCurrentAIFlags], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex2] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -5434,16 +5434,16 @@ AIDecide_Maintenance: ; (the parameter picks which), tails does nothing. AIPlay_Recycle: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld de, $10e bank1call TossCoin jr nc, .tails ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr .decide .tails ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a .decide ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision @@ -5514,7 +5514,7 @@ AIPlay_Lass: or AI_FLAG_MODIFIED_HAND ld [wCurrentAIFlags], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -5561,13 +5561,13 @@ AIPlay_ItemFinder: or AI_FLAG_MODIFIED_HAND ld [wCurrentAIFlags], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex2] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wAITrainerCardParameter] - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -5896,9 +5896,9 @@ StoreItemFinderDiscardTarget: scf ret -AIPlay_ImakuniCard: +AIPlay_Imakuni: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -5909,7 +5909,7 @@ AIPlay_ImakuniCard: ; confusion is desirable -- but only if our Dark Primeape has 2+ ; energy attached (so its "Fury Swipes" benefits) and isn't ; already confused. -AIDecide_ImakuniCard: +AIDecide_Imakuni: ld a, [wOpponentDeckID] cp RUNNING_WILD_DECK_ID jr z, .deck_50_dark_primeape @@ -5970,7 +5970,7 @@ AIPlay_Gambler: ld [hld], a ld [hl], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ld hl, wRNGVars @@ -5984,7 +5984,7 @@ AIPlay_Gambler: ret .play_honestly ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -6036,9 +6036,9 @@ AIDecide_Gambler: AIPlay_Revive: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -6115,9 +6115,9 @@ AIDecide_Revive_Deck40: AIPlay_PokemonFlute: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -6219,7 +6219,7 @@ AIDecide_PokemonFlute: ; both (their PHASE_05 table rows point here). AIPlay_ClefairyDollOrMysteriousFossil: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -6280,17 +6280,17 @@ AIDecide_ClefairyDollOrMysteriousFossil: ; tails it forwards $ff so AIMakeDecision treats it as "no target". AIPlay_Pokeball: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ldtx de, TrainerCardSuccessCheckText bank1call TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr nc, .tails ld a, [wAITrainerCardParameter] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jr .commit .tails ld a, $ff - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a .commit ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision @@ -6826,13 +6826,13 @@ AIPlay_ComputerSearch: or AI_FLAG_MODIFIED_HAND ld [wCurrentAIFlags], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex2] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -6997,11 +6997,11 @@ AIDecide_ComputerSearch_Deck70: ; tell the AI has already traded this turn. AIPlay_PokemonTrader: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ld a, $01 @@ -7774,11 +7774,11 @@ AIDecide_PokemonTrader_Deck74: AIPlay_TheBosssWay: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, $ff - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -7965,15 +7965,15 @@ AIDecide_TheBosssWay_Deck73: AIPlay_NightlyGarbageRun: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wTempAIMultiTargetCardDeckIndex2] - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ld a, $ff - ldh [hAIEnergyTransPlayAreaLocation], a + ldh [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -8520,11 +8520,11 @@ AIPlay_FossilExcavation: or AI_FLAG_MODIFIED_HAND ld [wCurrentAIFlags], a ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -8563,7 +8563,7 @@ AIDecide_FossilExcavation_Deck3BOr63: AIPlay_Sleep: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -8620,11 +8620,11 @@ AIDecide_Sleep_Deck53: ; let the effect pick). AIPlay_PokemonRecall: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, $ff - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -8676,11 +8676,11 @@ AIDecide_PokemonRecall: AIPlay_MasterBall: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, $ff - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -9041,7 +9041,7 @@ AIDecide_MasterBall_Deck74: ; Bill's Teleporter has no targeting -- just execute the trainer effect. AIPlay_BillsTeleporter: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -9057,12 +9057,12 @@ AIDecide_BillsTeleporter: ; Moon Stone evolves a Pokemon already in play. Stash the chosen ; play-area position (wAITrainerCardParameter, set by the decider) into -; hTemp_ffa0, then execute the trainer effect. +; hDuelActionArgs + 0, then execute the trainer effect. AIPlay_MoonStone: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -9129,7 +9129,7 @@ AIDecide_MoonStone: ; The Rocket's Trap has no targeting -- just execute the trainer effect. AIPlay_TheRocketsTrap: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -9156,7 +9156,7 @@ AIDecide_TheRocketsTrap: AIPlay_GoopGasAttack: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -9185,9 +9185,9 @@ AIDecide_GoopGasAttack: ; and draw 7 -- a disruption when their hand is large. AIPlay_ImposterOaksRevenge: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -9247,7 +9247,7 @@ AIDecide_ImposterOaksRevenge: ; Digger discards a card to draw 2 -- the AI always plays it when able. AIPlay_Digger: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ret @@ -9259,17 +9259,17 @@ AIDecide_Digger: ; Computer Error's play has its own pre-step: SwapTurn so the ; trainer effect picks a card from the *player's* hand to swap, ; then SwapTurn back, store the chosen index in -; hTempPlayAreaLocation_ffa1, fire the effect, and bump wd033 to +; hDuelActionArgs + 1, fire the effect, and bump wd033 to ; signal "AI used Computer Error this turn". AIPlay_ComputerError: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wAITrainerCardParameter] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn farcall HandleComputerErrorPlayerSelection call SwapTurn - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ld a, $02 @@ -9320,19 +9320,19 @@ AIDecide_ComputerError: ; On tails the trainer effect treats $ff as "no target." AIPlay_SuperScoopUp: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ldtx de, TrainerCardSuccessCheckText bank1call TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr nc, .tails ld a, [wAITrainerCardParameter] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wTempAIMultiTargetCardDeckIndex1] - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a jr .commit .tails ld a, $ff - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a .commit ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision diff --git a/src/engine/bank09.asm b/src/engine/bank09.asm index cee5c6c..75fc87f 100644 --- a/src/engine/bank09.asm +++ b/src/engine/bank09.asm @@ -258,7 +258,7 @@ DisplayOpponentUsedAttackScreen: call EmptyScreen call LoadDuelCardSymbolTiles call LoadDuelFaceDownCardTiles - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call LoadCardDataToBuffer1_FromDeckIndex ld a, CARDPAGE_POKEMON_OVERVIEW ld [wCardPageNumber], a @@ -395,9 +395,9 @@ PrintTextToDescriptionScreenTextBox: jp PrintTextNoDelay ; display card detail when a trainer card is used, and print "Used xxx" -; hTempCardIndex_ff9f contains the card's deck index +; hDuelActionCardIndex contains the card's deck index DisplayUsedTrainerCardDetailScreen: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] ldtx hl, UsedText bank1call DisplayCardDetailScreen ret @@ -570,13 +570,13 @@ OppAction_FinishTurnWithoutAttacking: ret OppAction_PlayEnergyCard: - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldh [hTempPlayAreaLocation_ff9d], a ld e, a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hTempCardIndex_ff98], a call PutHandCardInPlayArea - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call LoadCardDataToBuffer1_FromDeckIndex call DrawLargePictureOfCard call PrintAttachedEnergyToPokemon @@ -587,9 +587,9 @@ OppAction_PlayEnergyCard: ret OppAction_EvolvePokemonCard: - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldh [hTempPlayAreaLocation_ff9d], a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hTempCardIndex_ff98], a call LoadCardDataToBuffer1_FromDeckIndex call DrawLargePictureOfCard @@ -600,14 +600,14 @@ OppAction_EvolvePokemonCard: ret OppAction_PlayBasicPokemonCard: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hTempCardIndex_ff98], a call PutHandPokemonCardInPlayArea ldh [hTempPlayAreaLocation_ff9d], a add DUELVARS_ARENA_CARD_STAGE get_turn_duelist_var ld [hl], BASIC - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, PlacedOnBenchText bank1call DisplayCardDetailScreen ld a, TRUE @@ -657,16 +657,16 @@ OppAction_ExecuteTrainerCardEffectCommands: ld a, EFFECTCMDTYPE_BEFORE_DAMAGE call TryExecuteEffectCommandFunction bank1call DrawDuelMainScene - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call MoveHandCardToDiscardPile call ExchangeRNG bank1call DrawDuelMainScene ret OppAction_BeginUseAttack: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] ld d, a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call CopyAttackDataAndDamage_FromDeckIndex call UpdateTempDuelistCardIDsAndClearTwoTurnDuelVars @@ -698,7 +698,7 @@ OppAction_UseAttack: ; now handle EFFECTCMDTYPE_DISCARD_ENERGY here OppAction_PlayAttackAnimationDealAttackDamage: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] cp -1 jr z, .metronome_unsuccessful ld a, EFFECTCMDTYPE_DISCARD_ENERGY @@ -727,14 +727,14 @@ OppAction_ForceSwitchActive: ret OppAction_UsePokemonPower_NoEffect2: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] ld d, a ld e, FIRST_ATTACK_OR_PKMN_POWER call CopyAttackDataAndDamage_FromDeckIndex call ClearTwoTurnDuelVars - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hTempPlayAreaLocation_ff9d], a - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call LoadCardNameToTxRam2 ld hl, wLoadedAttackName ld a, [hli] @@ -747,19 +747,19 @@ OppAction_UsePokemonPower_NoEffect2: ret OppAction_UsePokemonPower: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] ld d, a ld e, FIRST_ATTACK_OR_PKMN_POWER call CopyAttackDataAndDamage_FromDeckIndex call ClearTwoTurnDuelVars - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hTempPlayAreaLocation_ff9d], a ld a, EFFECTCMDTYPE_INITIAL_EFFECT_2 call TryExecuteEffectCommandFunction ld a, [wcd0d] or a jr nz, .exit - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call LoadCardNameToTxRam2 ld hl, wLoadedAttackName ld a, [hli] @@ -809,7 +809,7 @@ OppAction_TossCoinATimes: OppAction_6b30: ldh a, [hWhoseTurn] push af - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hWhoseTurn], a call PlayDeckShuffleAnimation pop af @@ -824,7 +824,7 @@ OppAction_UseMetronomeAttack: call SwapTurn call CopyAttackDataAndDamage_FromDeckIndex call SwapTurn - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] ld [wPlayerAttackingCardIndex], a ld a, [wSelectedAttack] ld [wPlayerAttackingAttackIndex], a @@ -841,7 +841,7 @@ OppAction_UseMetronomeAttack: ret OppAction_ProcessPlayedPokemonCard: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hTempPlayAreaLocation_ff9d], a bank1call ProcessPlayedPokemonCard.Process ret nc @@ -855,7 +855,7 @@ OppAction_ProcessTriggeredPokemonPower: ret OppAction_ComputerErrorPrompt: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld l, a ld h, 0 call LoadTxRam3 @@ -1459,7 +1459,7 @@ HandleComputerErrorPlayerSelection: ; handles player selection when opponent ; accepts challenge due to the effects of Challenge! card HandleChallengeCardPlayerSelection: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hCurSelectionItem], a call CreateDeckCardList jr nc, .has_deck_cards @@ -1526,7 +1526,7 @@ HandleChallengeCardPlayerSelection: call GetNextPositionInTempList ld [hl], $ff ; terminating byte ldh a, [hCurSelectionItem] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .try_cancel @@ -1542,7 +1542,7 @@ HandleChallengeCardPlayerSelection: jr .done_selection PrintHowManyCardsLinkOpponentChoseDueToChallenge: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] sub $02 ld hl, wTxRam3 ld [hli], a diff --git a/src/engine/bank0a.asm b/src/engine/bank0a.asm index 546c96f..ed5054d 100644 --- a/src/engine/bank0a.asm +++ b/src/engine/bank0a.asm @@ -115,9 +115,9 @@ AIAttachEnergyInHandToCardInPlayArea: .attach call FindCardIDInTurnDuelistsPlayArea - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a pop af - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_PLAY_ENERGY farcall AIMakeDecision ret @@ -811,9 +811,9 @@ AISelectSpecialAttackParameters: .devolve_to_ko ld a, $01 ; player's Play Area - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call LookForCardThatIsKnockedOutOnDevolution - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a scf ret @@ -826,11 +826,11 @@ AISelectSpecialAttackParameters: ; in own Play Area to devolve so it can reuse ; Power of Darkness on next turn xor a ; AI's Play Area - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, GENGAR_LV40 ld b, PLAY_AREA_BENCH_1 call FindCardIDInTurnDuelistsPlayArea - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a scf ret @@ -842,20 +842,20 @@ AISelectSpecialAttackParameters: jp nz, .no_carry ld a, $ff - ldh [hTempPlayAreaLocation_ffa1], a - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + 1], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ; search for Psychic energy cards in Discard Pile ld de, PSYCHIC_ENERGY ld a, CARD_LOCATION_DISCARD_PILE call FindCardIDInLocation - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a farcall CreateEnergyCardListFromDiscardPile_OnlyBasic ; find any energy card different from ; the one found by FindCardIDInLocation. ; since using this attack requires a Psychic energy card, -; and another one is in hTemp_ffa0, +; and another one is in hDuelActionArgs + 0, ; then any other energy card would account ; for the Energy Cost of Psyburn. ld hl, wDuelTempList @@ -864,13 +864,13 @@ AISelectSpecialAttackParameters: cp $ff jr z, .set_carry ld b, a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp b jr z, .loop_energy_cards ; same card, keep looking ; store the deck index of energy card found ld a, b - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a .set_carry scf @@ -884,7 +884,7 @@ AISelectSpecialAttackParameters: jp nz, .no_carry farcall AIDecideBenchPokemonToSwitchTo jr c, .no_carry - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -899,7 +899,7 @@ AISelectSpecialAttackParameters: ld a, CARD_LOCATION_DECK ld de, LIGHTNING_ENERGY call FindCardIDInLocation - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jp nc, .no_carry ; ...else find a suitable Play Area Pokemon to @@ -907,7 +907,7 @@ AISelectSpecialAttackParameters: farcall AIProcessButDontPlayEnergy_SkipEvolution jp nc, .no_carry ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a scf ret @@ -919,7 +919,7 @@ AISelectSpecialAttackParameters: ; toss coin ldtx de, IfHeadsAttachUpTo3WaterEnergyFromDeckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; check number of Water energies attached to Kingler ld e, PLAY_AREA_ARENA @@ -931,7 +931,7 @@ AISelectSpecialAttackParameters: ; a = number of Water energies still needed ; for Double-Edged Claw - ld hl, hTempPlayAreaLocation_ffa1 + ld hl, hDuelActionArgs + 1 jr c, .kingler_no_energy_required jr z, .kingler_no_energy_required ld de, WATER_ENERGY @@ -943,7 +943,7 @@ AISelectSpecialAttackParameters: .WaterBomb: ld a, MAX_PLAY_AREA_POKEMON + 1 - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 farcall ClearNBytesFromHL ld e, PLAY_AREA_ARENA call GetPlayAreaCardAttachedEnergies @@ -960,12 +960,12 @@ AISelectSpecialAttackParameters: ; can KO, store this location ld c, a ld b, $00 - ld hl, hTempPlayAreaLocation_ffa1 + ld hl, hDuelActionArgs + 1 add hl, bc ld [hl], 1 ld b, a ld a, 1 - ldh [hTemp_ffa0], a ; number of selected targets + ldh [hDuelActionArgs + 0], a ; number of selected targets ; look for another card to KO, ; other than the one already checked @@ -983,13 +983,13 @@ AISelectSpecialAttackParameters: .can_ko_both ld c, a ld b, $00 - ld hl, hTempPlayAreaLocation_ffa1 + ld hl, hDuelActionArgs + 1 add hl, bc ld a, [hl] inc a ld [hl], a ld a, 2 - ldh [hTemp_ffa0], a ; number of selected targets + ldh [hDuelActionArgs + 0], a ; number of selected targets .made_water_bomb_selection scf ret @@ -1003,11 +1003,11 @@ AISelectSpecialAttackParameters: jr nc, .made_water_bomb_selection ld c, a ld b, $00 - ld hl, hTempPlayAreaLocation_ffa1 + ld hl, hDuelActionArgs + 1 add hl, bc ld [hl], 2 ld a, 2 - ldh [hTemp_ffa0], a ; number of selected targets + ldh [hDuelActionArgs + 0], a ; number of selected targets jr .made_water_bomb_selection .one_water_bomb_target @@ -1018,11 +1018,11 @@ AISelectSpecialAttackParameters: jr nc, .made_water_bomb_selection ld c, a ld b, $00 - ld hl, hTempPlayAreaLocation_ffa1 + ld hl, hDuelActionArgs + 1 add hl, bc ld [hl], 1 ld a, 1 - ldh [hTemp_ffa0], a ; number of selected targets + ldh [hDuelActionArgs + 0], a ; number of selected targets jr .made_water_bomb_selection .Foxfire: @@ -1035,7 +1035,7 @@ AISelectSpecialAttackParameters: jr c, .asm_285ff farcall FindBenchCardThatCanBeDamaged .asm_285ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1043,13 +1043,13 @@ AISelectSpecialAttackParameters: ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA call GetNonTurnDuelistVariable call Random - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret .select_foxfire_based_on_energies farcall AIDecideFoxfireTarget - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1072,12 +1072,12 @@ AISelectSpecialAttackParameters: farcall AIProcessButDontPlayEnergy_SkipEvolutionAndArena jr nc, .asm_28661 ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a xor a ; PLAY_AREA_ARENA call CreateArenaOrBenchEnergyCardList jr c, .energy_bomb_no_more_energies ; no energies ld a, [wDuelTempList + 0] ; first energy card - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld b, 60 .asm_2864a call DoFrame @@ -1093,10 +1093,10 @@ AISelectSpecialAttackParameters: jr .asm_28633 .asm_28661 xor a ; PLAY_AREA_ARENA - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a .asm_28664 ld a, DUELVARS_BENCH - ld hl, hTempPlayAreaLocation_ffa1 + ld hl, hDuelActionArgs + 1 add [hl] get_turn_duelist_var cp $ff @@ -1105,7 +1105,7 @@ AISelectSpecialAttackParameters: call CreateArenaOrBenchEnergyCardList jr c, .energy_bomb_no_more_energies ld a, [wDuelTempList + 0] ; first energy card - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld b, 60 .asm_2867b call DoFrame @@ -1118,7 +1118,7 @@ AISelectSpecialAttackParameters: call CopyAttackDataAndDamage_FromDeckIndex ld a, OPPACTION_6B15 farcall AIMakeDecision - ld hl, hTempPlayAreaLocation_ffa1 + ld hl, hDuelActionArgs + 1 inc [hl] jr .asm_28664 .energy_bomb_no_more_energies @@ -1144,11 +1144,11 @@ AISelectSpecialAttackParameters: jp nz, .no_carry ldtx de, IfTails30DamageTo1OfYourPokemonText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a jr nz, .asm_286c7 call AIChooseRagingThunderTarget - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a .asm_286c7 scf ret @@ -1161,7 +1161,7 @@ AISelectSpecialAttackParameters: ld de, LIGHTNING_ENERGY ld a, CARD_LOCATION_DECK call FindCardIDInLocation - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1172,7 +1172,7 @@ AISelectSpecialAttackParameters: ; ...if not, then choose a target based on damage call AIChooseShortCircuitTarget .got_short_circuit_target - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1184,13 +1184,13 @@ AISelectSpecialAttackParameters: call CreateArenaOrBenchEnergyCardList jp c, .no_carry ; no energies ld a, [wDuelTempList + 0] ; first energy in list - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; fetch a Clefairy Doll from the Discard Pile ld de, CLEFAIRY_DOLL ld a, CARD_LOCATION_DISCARD_PILE call FindCardIDInLocation jp nc, .no_carry - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a scf ret @@ -1200,7 +1200,7 @@ AISelectSpecialAttackParameters: jp nz, .no_carry ldtx de, AttackSuccessCheckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a jr z, .errand_running_tails ; find a Bill first @@ -1217,7 +1217,7 @@ AISelectSpecialAttackParameters: .errand_running_tails ld a, $ff .found_target_for_errand_running - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a scf ret @@ -1236,7 +1236,7 @@ AISelectSpecialAttackParameters: ; discard as many as possible ld b, a ; number of energies available to discard ld hl, wDuelTempList - ld de, hTemp_ffa0 + ld de, hDuelActionArgs + 0 ld [de], a ; number of energies inc de .loop_fill_flame_inferno_list @@ -1254,10 +1254,10 @@ AISelectSpecialAttackParameters: ret .dont_discard_for_flame_inferno xor a ; 0 energies - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; empty list ld a, $ff - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a scf ret @@ -1269,7 +1269,7 @@ AISelectSpecialAttackParameters: ld a, CARD_LOCATION_DISCARD_PILE ; bug, should be CARD_LOCATION_DISCARD_DECK call FindCardIDInLocation jp nc, .no_carry - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1279,10 +1279,10 @@ AISelectSpecialAttackParameters: jp nz, .no_carry farcall AIDecide_GustOfWind jp nc, .no_carry - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ldtx de, AttackSuccessCheckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1294,9 +1294,9 @@ AISelectSpecialAttackParameters: ; no Play Area Pokémon has damage ldtx de, DamageCheckIfTailsNoDamageText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a xor a ; choose Arena card - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a scf ret @@ -1306,12 +1306,12 @@ AISelectSpecialAttackParameters: jp nz, .no_carry farcall HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a farcall AIDecideBenchPokemonToSwitchTo jr nc, .got_stir_up_twister_decision ld a, $ff ; no switch .got_stir_up_twister_decision - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a scf ret @@ -1337,7 +1337,7 @@ AISelectSpecialAttackParameters: .got_stare_target_to_ko ld a, b .got_stare_target - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1409,7 +1409,7 @@ AISelectSpecialAttackParameters: get_turn_duelist_var dec a .got_num_food_counters_to_remove - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1425,11 +1425,11 @@ AISelectSpecialAttackParameters: jp c, .no_carry ; attach it to Pokémon with least amount of HP remaining in Bench ld a, [wDuelTempList + 0] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, PLAY_AREA_BENCH_1 ld d, 10 call AIFindPlayAreaPkmnWithMinimumLeastRemainingHP - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret .FlamePillar: @@ -1437,7 +1437,7 @@ AISelectSpecialAttackParameters: ld d, 10 call AIFindPlayAreaPkmnWithMinimumLeastRemainingHP jr nc, .dont_discard_for_flame_pillar - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a ; discard if will KO bench card ld a, 10 cp d @@ -1447,7 +1447,7 @@ AISelectSpecialAttackParameters: jr c, .discard_energy_for_flame_pillar .dont_discard_for_flame_pillar ld a, $01 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret .discard_energy_for_flame_pillar @@ -1456,9 +1456,9 @@ AISelectSpecialAttackParameters: jr c, .dont_discard_for_flame_pillar ; choose first energy card ld a, [wDuelTempList + 0] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1469,9 +1469,9 @@ AISelectSpecialAttackParameters: farcall CheckIfDefendingPokemonCanKnockOut jp nc, .no_carry ld a, $ff - ldh [hTemp_ffa0], a - ldh [hTempPlayAreaLocation_ffa1], a - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 0], a + ldh [hDuelActionArgs + 1], a + ldh [hDuelActionArgs + 2], a ldh [$ffa5], a farcall CheckIfDefendingCardIsWeakToArenaCard ld c, 10 @@ -1529,7 +1529,7 @@ AISelectSpecialAttackParameters: .got_cards_to_discard_for_burning_fire ld b, a ld hl, wDuelTempList - ld de, hTemp_ffa0 + ld de, hDuelActionArgs + 0 .loop_fill_burning_fire_list ld a, [hli] ld [de], a @@ -1554,9 +1554,9 @@ AISelectSpecialAttackParameters: jr c, .got_num_energy_discard_for_rock_blast ld a, 5 ; maximum 5 energies .got_num_energy_discard_for_rock_blast - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld b, a - ld hl, hTempPlayAreaLocation_ffa1 + ld hl, hDuelActionArgs + 1 ld de, wDuelTempList .loop_fill_rock_blast_energy_list ld a, [de] @@ -1571,7 +1571,7 @@ AISelectSpecialAttackParameters: pop hl jr c, .defending_is_invulnerable_to_rock_blast ; choose all of them on the Defending card - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld [hli], a ; PLAY_AREA_ARENA xor a ld [hli], a ; PLAY_AREA_BENCH_1 @@ -1598,11 +1598,11 @@ AISelectSpecialAttackParameters: ret z ; no Bench dec a ld c, a ; number of benched Pokémon - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr z, .asm_28984 ; no energy cards to discard ; choose randomly from player's Bench, - ; up to [hTemp_ffa0] number of cards + ; up to [hDuelActionArgs + 0] number of cards ld b, a ld d, $00 .loop_rock_blast_random_selection @@ -1632,7 +1632,7 @@ AISelectSpecialAttackParameters: call FindPlayAreaCardWithLeastRemainingHP call SwapTurn .got_drag_off_target - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1650,7 +1650,7 @@ AISelectSpecialAttackParameters: .dont_switch_teleport_blast ld a, $ff .got_teleport_blast_target - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1683,13 +1683,13 @@ AISelectSpecialAttackParameters: ld a, e ldh [$ffa5], a xor a ; PLAY_AREA_ARENA - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a farcall GetFirstBasicEnergyAttachedToPlayAreaCard - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a call SwapTurn ldtx de, AttackSuccessCheckText farcall TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret c farcall SetWasUnsuccessful scf @@ -1720,7 +1720,7 @@ AISelectSpecialAttackParameters: ld a, PLAY_AREA_ARENA .got_telekinesis_target farcall FindReplacementPkmnIfMrMime - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .TextureMagic: @@ -1731,7 +1731,7 @@ AISelectSpecialAttackParameters: cp VERY_RARE_CARD_DECK_ID jr z, .choose_color_of_strongest_pkmn ld a, $ff - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call SwapTurn bank1call GetArenaCardWeakness call SwapTurn @@ -1739,7 +1739,7 @@ AISelectSpecialAttackParameters: jr z, .choose_texture_magic_resistance ; always choose Grass as player's Arena card weakness ld a, GRASS - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a .choose_texture_magic_resistance ; choose arena card's color for Porygon's resistance call SwapTurn @@ -1750,7 +1750,7 @@ AISelectSpecialAttackParameters: jr nz, .got_texture_magic_color ld a, PSYCHIC .got_texture_magic_color - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1764,7 +1764,7 @@ AISelectSpecialAttackParameters: jr c, .strongest_pkmn_is_valid_color ld a, $ff .strongest_pkmn_is_valid_color - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jr .choose_texture_magic_resistance .Lure: @@ -1773,7 +1773,7 @@ AISelectSpecialAttackParameters: jp nz, .no_carry farcall AIChoosePlayerBenchPkmnWithNotEnoughEnergiesOrHighRetreatCost ret nc - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1784,7 +1784,7 @@ AISelectSpecialAttackParameters: ld a, FIGHTING farcall AIChooseFollowMeTarget ret nc ; no target - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1797,7 +1797,7 @@ AISelectSpecialAttackParameters: jp z, .no_carry ; always choose Grass ld a, GRASS - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret @@ -1816,10 +1816,10 @@ AISelectSpecialAttackParameters: ; default to Arena card xor a ; PLAY_AREA_ARENA .got_focus_blast_target - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ldtx de, IfHeads20DamageTo1OfOppPokemonText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a scf ret diff --git a/src/engine/bank0e.asm b/src/engine/bank0e.asm index 14c9391..d1c4830 100644 --- a/src/engine/bank0e.asm +++ b/src/engine/bank0e.asm @@ -56,7 +56,7 @@ HandleAIEnergyTrans: ld a, DUELVARS_ARENA_CARD add b get_turn_duelist_var - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a call GetCardIDFromDeckIndex cp16 VENUSAUR_LV67 jr z, .use_pkmn_power @@ -70,14 +70,14 @@ HandleAIEnergyTrans: .use_pkmn_power ld a, b - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT farcall AIMakeDecision xor a - ldh [hAIEnergyTransPlayAreaLocation], a + ldh [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA], a ld a, [wd082] ld d, a @@ -91,7 +91,7 @@ HandleAIEnergyTrans: jr c, .next_card and %00001111 - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a ld a, e push de @@ -102,7 +102,7 @@ HandleAIEnergyTrans: ; store the deck index of energy card ld a, e - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a push de ld d, 30 @@ -292,7 +292,7 @@ AIEnergyTransTransferEnergyToBench: ld a, DUELVARS_ARENA_CARD add b get_turn_duelist_var - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld [wAIVenusaurLv67DeckIndex], a call GetCardIDFromDeckIndex cp16 VENUSAUR_LV67 @@ -308,7 +308,7 @@ AIEnergyTransTransferEnergyToBench: ; use Energy Trans Pkmn Power .use_pkmn_power ld a, b - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld [wd07f], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision @@ -318,9 +318,9 @@ AIEnergyTransTransferEnergyToBench: ; loop for each energy cards that are going to be transferred. .loop_energy xor a - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a ld a, [wd07f] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; returns when Arena card has no Grass energy cards attached. ld e, PLAY_AREA_ARENA @@ -348,7 +348,7 @@ AIEnergyTransTransferEnergyToBench: ; store the deck index of energy card ld a, e - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a jr .transfer .next_card @@ -363,7 +363,7 @@ AIEnergyTransTransferEnergyToBench: farcall AIProcessButDontPlayEnergy_SkipEvolutionAndArena jr nc, .done_transfer ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hAIEnergyTransPlayAreaLocation], a + ldh [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA], a ld d, 30 .small_delay_loop @@ -372,7 +372,7 @@ AIEnergyTransTransferEnergyToBench: jr nz, .small_delay_loop ld a, [wAIVenusaurLv67DeckIndex] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld d, a ld e, FIRST_ATTACK_OR_PKMN_POWER call CopyAttackDataAndDamage_FromDeckIndex @@ -571,16 +571,16 @@ HandleAIPkmnPowers: ; c = Play Area location (PLAY_AREA_*) of Vileplume. HandleAIHeal: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call .CheckHealTarget ret nc ; return if no target to heal push af ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision pop af - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT farcall AIMakeDecision ld a, OPPACTION_DUEL_MAIN_SCENE @@ -679,7 +679,7 @@ HandleAIShift: or a ret nz ; return if Venomoth is not Arena card - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a bank1call GetArenaCardColor call TranslateColorToWR ld b, a @@ -703,7 +703,7 @@ HandleAIShift: .found ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision @@ -720,7 +720,7 @@ HandleAIShift: ; use Pkmn Power effect .done ld a, b - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT farcall AIMakeDecision ld a, OPPACTION_DUEL_MAIN_SCENE @@ -837,7 +837,7 @@ HandleAIShift: ; c = Play Area location (PLAY_AREA_*) of Mankey. HandleAIPeek: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, 50 call Random cp 3 @@ -904,11 +904,11 @@ HandleAIPeek: .use_peek push af ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision pop af - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT farcall AIMakeDecision ld a, OPPACTION_DUEL_MAIN_SCENE @@ -923,14 +923,14 @@ HandleAIStrangeBehavior: or a ret z ; return if Slowbro is Arena card - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld e, PLAY_AREA_ARENA call GetCardDamageAndMaxHP or a ret z ; return if Arena card has no damage counters ld [wd082], a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD_HP get_turn_duelist_var sub 10 @@ -946,11 +946,11 @@ HandleAIStrangeBehavior: .use_strange_behavior push af ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision xor a - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT farcall AIMakeDecision pop af @@ -986,7 +986,7 @@ HandleAIStrangeBehavior: ; c = Play Area location (PLAY_AREA_*) of Gengar. HandleAICurse: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; loop Player's Play Area and checks their damage. ; finds the card with lowest remaining HP and @@ -1030,7 +1030,7 @@ HandleAICurse: ; card in Play Area with lowest HP remaining was found. ; look for another card to take damage counter from. ld a, h - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ld b, a ld a, 10 cp c @@ -1072,10 +1072,10 @@ HandleAICurse: .use_curse ld a, e - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a call SwapTurn ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -1089,7 +1089,7 @@ HandleAICurse: ; c = Play Area location (PLAY_AREA_*) of Drowzee. HandleAILongDistanceHypnosis: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckIfArenaCardCanKnockOutDefendingCard ccf @@ -1144,7 +1144,7 @@ HandleAILongDistanceHypnosis: ret c ; difference is less than 4 .use_long_distance_hypnosis ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -1167,7 +1167,7 @@ HandleAILongDistanceHypnosis: ; c = Play Area location (PLAY_AREA_*) of Dark Gloom. HandleAIPollenStench: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, DUELVARS_ARENA_CARD_STATUS call GetNonTurnDuelistVariable @@ -1251,7 +1251,7 @@ HandleAIPollenStench: ret z .use_pollen_stench ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -1360,9 +1360,9 @@ HandleAIGatherFire: inc c jr nc, .loop_bench .use_gather_fire - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -1429,7 +1429,7 @@ HandleAIGatherFire: ; c = Play Area location (PLAY_AREA_*) of Dark Dragonair. HandleAIEvolutionaryLight: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wOpponentDeckID] cp GREAT_DRAGON_DECK_ID jr z, .great_dragon_deck @@ -1448,9 +1448,9 @@ HandleAIEvolutionaryLight: ret .use_evolutionary_light - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -1639,7 +1639,7 @@ HandleAIEvolutionaryLight: ; c = Play Area location (PLAY_AREA_*) of Dark Kadabra. HandleAIMatterExchange: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; only use Pkmn Power if there are no Energy cards in Hand ; and there's duplicates of certain cards to discard @@ -1661,9 +1661,9 @@ HandleAIMatterExchange: call CheckIfHandHasRepeatedCard ret nc .use_matter_exchange - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -1680,7 +1680,7 @@ HandleAIPlayTricks: or a ret z ; Dark Gengar is Arena card - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, [wOpponentDeckID] cp DAMAGE_CHAOS_DECK_ID jr z, .damage_chaos_deck @@ -1689,7 +1689,7 @@ HandleAIPlayTricks: ret nc .use_play_tricks ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -1747,7 +1747,7 @@ HandleAIPlayTricks: ; c = Play Area location (PLAY_AREA_*) of Kabuto. HandleAIFossilize: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckIfArenaCardCanKnockOutDefendingCard ccf @@ -1794,11 +1794,11 @@ HandleAIFossilize: .use_fossilize ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER_NO_EFF2 farcall AIMakeDecision ld a, -1 - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ldtx de, FossilizeCheckText farcall Serial_TossCoin jr c, .got_heads @@ -1808,7 +1808,7 @@ HandleAIFossilize: jr .got_tails .got_heads xor a ; PLAY_AREA_ARENA - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a .got_tails ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision @@ -1825,12 +1825,12 @@ HandleAISpecialDelivery: ; chooses an evolution card in Hand that doesn't ; evolve any Pokémon in the Play Area to place on Deck ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a farcall FindUnusableEvolutionCardInHand ret nc ; not found - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -1844,12 +1844,12 @@ HandleAISpecialDelivery: ; c = Play Area location (PLAY_AREA_*) of Dragonite. HandleAIStepIn: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a xor a ; PLAY_AREA_ARENA ldh [hTempPlayAreaLocation_ff9d], a call CheckIfDefendingPokemonCanKnockOut ret nc ; defending can't KO - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call GetPlayAreaCardAttachedEnergies ld a, [wTotalAttachedEnergies] @@ -1857,7 +1857,7 @@ HandleAIStepIn: ccf ret nc ; Dragonite doesn't have enough energy to attack ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -1918,7 +1918,7 @@ HandleAIMagnet: ; check if there's space in the Bench ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA get_turn_duelist_var inc a @@ -1938,18 +1938,18 @@ HandleAIMagnet: ld a, [hli] cp $ff ret z - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a farcall ExecuteCardSearchFunc jr nc, .loop_deck ; a Magnemite is found in the Deck ld a, [wAIPkmnPowerUserCardIndex] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER_NO_EFF2 farcall AIMakeDecision ldtx de, MagnetCheckText farcall Serial_TossCoin - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a jr c, .heads farcall SetWasUnsuccessful call PrintFailedEffectText @@ -2015,20 +2015,20 @@ HandleAICowardice: ; c = Play Area location (PLAY_AREA_*) of Tentacool. .CheckWhetherToUseCowardice: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a bank1call CheckIsIncapableOfUsingPkmnPower ccf ret nc ; can't use Cowardice - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call GetCardDamageAndMaxHP or a ret z ; return if has no damage counters .try - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hTempPlayAreaLocation_ff9d], a ld a, [wd084] ld d, a @@ -2038,7 +2038,7 @@ HandleAICowardice: call TryExecuteEffectCommandFunction jr c, .dont_use_cowardice - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .is_benched farcall AIDecideBenchPokemonToSwitchTo @@ -2050,11 +2050,11 @@ HandleAICowardice: .use_cowardice push af ld a, [wd084] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision pop af - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT farcall AIMakeDecision ld a, OPPACTION_DUEL_MAIN_SCENE @@ -2111,7 +2111,7 @@ HandleAICowardice: .CheckWhetherToUseCowardice_SkipDamageCheck: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a bank1call CheckIsIncapableOfUsingPkmnPower ccf ret nc @@ -2125,7 +2125,7 @@ HandleAITrickery: ld b, PLAY_AREA_ARENA farcall FindCardIDInTurnDuelistsPlayArea ret nc ; no Rattata in Play Area - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a bank1call CheckIsIncapableOfUsingPkmnPower ret c ; incapable of using Trickery @@ -2136,10 +2136,10 @@ HandleAITrickery: or a ret z - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD get_turn_duelist_var - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ; sample random prize cards ; until we get one that hasn't been picked yet @@ -2163,7 +2163,7 @@ HandleAITrickery: ; use Trickery with selected prize card ld a, c or $40 - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -2217,7 +2217,7 @@ HandleAIRebirth: ; - c = Dark Starmie's PLAY_AREA_* location .TryUseRebirth: ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a bank1call CheckIsIncapableOfUsingPkmnPower ret c ; incapable of using Pkmn Power @@ -2227,7 +2227,7 @@ HandleAIRebirth: farcall FindCardIDInLocation ret nc ; no Staryu in deck - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .is_on_bench ldh [hTempPlayAreaLocation_ff9d], a @@ -2235,7 +2235,7 @@ HandleAIRebirth: ret nc ; player cannot KO ; player can KO next turn ; use Rebirth if has <= 20 HP remaining - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD_HP get_turn_duelist_var cp 20 + 1 @@ -2253,7 +2253,7 @@ HandleAIRebirth: .is_on_bench ; Dark Starmie is on the Bench, use Rebirth ; if remaining HP is <= 20 - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD_HP get_turn_duelist_var cp 20 + 1 @@ -2261,7 +2261,7 @@ HandleAIRebirth: .use_rebirth ld a, [wAIPkmnPowerUserCardIndex] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -2303,9 +2303,9 @@ HandleAIDamageSwap: ld a, [wd084] add DUELVARS_ARENA_CARD get_turn_duelist_var - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wd084] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -2324,9 +2324,9 @@ HandleAIDamageSwap: call .FindTargets jr c, .no_more_targets - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a xor a ; PLAY_AREA_ARENA - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_6B15 farcall AIMakeDecision pop de @@ -2674,7 +2674,7 @@ HandleAIPrehistoricDreamAndPoisonMist: ; use Prehistoric Dream ld a, [wAIPkmnPowerUserCardIndex] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -2773,7 +2773,7 @@ HandleAIPrehistoricDreamAndPoisonMist: .use_poison_mist ld a, [wAIPkmnPowerUserCardIndex] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT @@ -2788,9 +2788,9 @@ AIChooseSummonMinionsCards: push af ld b, a ld a, $ff - ldh [hTemp_ffa0], a - ldh [hTempPlayAreaLocation_ffa1], a - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 0], a + ldh [hDuelActionArgs + 1], a + ldh [hDuelActionArgs + 2], a ld a, b or a jr z, .zero @@ -2844,21 +2844,21 @@ AIChooseSummonMinionsCards: .AddCardToList: push af - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr nz, .second_pkmn pop af - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .second_pkmn pop af - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a add sp, $02 .asm_391e1 pop af ld c, a ld b, $00 - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 add hl, bc ld [hl], $ff ret @@ -5360,12 +5360,12 @@ BadGuysDeckAIDecideReelIn: farcall FindCardIDInLocation jr nc, .try_psyduck_and_golduck ; got an Oddish, try a Dark Gloom next - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, DARK_GLOOM ld a, CARD_LOCATION_DISCARD_PILE farcall FindCardIDInLocation jr nc, .try_psyduck_and_golduck - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jr .find_third_card .try_psyduck_and_golduck @@ -5374,12 +5374,12 @@ BadGuysDeckAIDecideReelIn: ld a, CARD_LOCATION_DISCARD_PILE farcall FindCardIDInLocation jr nc, .try_charmander_and_charmeleon - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, DARK_GOLDUCK ld a, CARD_LOCATION_DISCARD_PILE farcall FindCardIDInLocation jr nc, .try_charmander_and_charmeleon - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jr .find_third_card .try_charmander_and_charmeleon @@ -5388,12 +5388,12 @@ BadGuysDeckAIDecideReelIn: ld a, CARD_LOCATION_DISCARD_PILE farcall FindCardIDInLocation jr nc, .try_slowpoke_and_slowbro - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, DARK_CHARMELEON ld a, CARD_LOCATION_DISCARD_PILE farcall FindCardIDInLocation jr nc, .try_slowpoke_and_slowbro - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jr .find_third_card .try_slowpoke_and_slowbro @@ -5401,12 +5401,12 @@ BadGuysDeckAIDecideReelIn: ld a, CARD_LOCATION_DISCARD_PILE farcall FindCardIDInLocation ret nc - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, DARK_SLOWBRO ld a, CARD_LOCATION_DISCARD_PILE farcall FindCardIDInLocation ret nc - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a .find_third_card ld de, ODDISH_LV21 @@ -5445,7 +5445,7 @@ BadGuysDeckAIDecideReelIn: ret .AddCardIfNotInListAlready: - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 cp [hl] ret z ; equal to first card inc hl diff --git a/src/engine/bank12.asm b/src/engine/bank12.asm index bf28d5f..2f7cda9 100644 --- a/src/engine/bank12.asm +++ b/src/engine/bank12.asm @@ -124,13 +124,13 @@ AISamPerformScriptedTurn: .turn_2 ld de, POTION farcall LookForCardIDInHandList - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_PLAY_TRAINER farcall AIMakeDecision xor a ; PLAY_AREA_ARENA - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, 20 - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ld de, GOLDEEN @@ -143,15 +143,15 @@ AISamPerformScriptedTurn: ld de, GOLDEEN ld b, PLAY_AREA_ARENA farcall FindCardIDInTurnDuelistsPlayArea - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld de, SEAKING farcall LookForCardIDInHandList - ldh [hTemp_ffa0], a - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionArgs + 0], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_EVOLVE_PKMN farcall AIMakeDecision ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_PROCESS_PLAYED_PKMN farcall AIMakeDecision ld de, SEAKING @@ -163,13 +163,13 @@ AISamPerformScriptedTurn: .turn_4 ld de, POTION farcall LookForCardIDInHandList - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_PLAY_TRAINER farcall AIMakeDecision xor a ; PLAY_AREA_ARENA - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, 20 - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ld a, SECOND_ATTACK @@ -178,12 +178,12 @@ AISamPerformScriptedTurn: .turn_5 ld de, STARYU_LV15 farcall LookForCardIDInHandList - ldh [hTemp_ffa0], a - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionArgs + 0], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_PLAY_BASIC_PKMN farcall AIMakeDecision ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_PROCESS_PLAYED_PKMN farcall AIMakeDecision ld de, STARYU_LV15 @@ -280,12 +280,12 @@ AIAaronStep2PerformScriptedTurn: .turn_2 ld de, ODDISH_LV8 farcall LookForCardIDInHandList - ldh [hTemp_ffa0], a - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionArgs + 0], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_PLAY_BASIC_PKMN farcall AIMakeDecision ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_PROCESS_PLAYED_PKMN farcall AIMakeDecision ld de, GRIMER_LV10 @@ -351,33 +351,33 @@ AIAaronStep3PerformScriptedTurn: .turn_2 ld de, CHANSEY_LV55 farcall LookForCardIDInHandList - ldh [hTemp_ffa0], a - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionArgs + 0], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_PLAY_BASIC_PKMN farcall AIMakeDecision ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_PROCESS_PLAYED_PKMN farcall AIMakeDecision ld de, POKEMON_BREEDER farcall LookForCardIDInHandList - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_PLAY_TRAINER farcall AIMakeDecision ld de, ALAKAZAM_LV42 farcall LookForCardIDInHandList - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, ABRA_LV10 ld b, PLAY_AREA_BENCH_1 farcall FindCardIDInTurnDuelistsPlayArea - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a push af ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ld a, [wcd15] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a pop af - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld [wTempAIPokemonCard], a ld a, OPPACTION_PROCESS_PLAYED_PKMN farcall AIMakeDecision @@ -400,7 +400,7 @@ AIAaronStep3PerformScriptedTurn: farcall HandleAIDamageSwap ld de, POKEMON_CENTER farcall LookForCardIDInHandList - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_PLAY_TRAINER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS @@ -439,24 +439,24 @@ AIAaronStep3PerformScriptedTurn: jr nc, .asm_4839b ld de, SCOOP_UP farcall LookForCardIDInHandList - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld de, CHANSEY_LV55 ld b, PLAY_AREA_BENCH_1 farcall FindCardIDInTurnDuelistsPlayArea jr nc, .unscripted - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_PLAY_TRAINER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_TRAINER_EFFECTS farcall AIMakeDecision ld de, CHANSEY_LV55 farcall LookForCardIDInHandList - ldh [hTemp_ffa0], a - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionArgs + 0], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_PLAY_BASIC_PKMN farcall AIMakeDecision ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_PROCESS_PLAYED_PKMN farcall AIMakeDecision farcall HandleAIDamageSwap @@ -2028,12 +2028,12 @@ HandleAIDarkPokemonSearchStrategies: ret c ; couldn't use The Boss' Way ld a, b .trade_with_dratini - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, DRATINI_LV10 ld a, CARD_LOCATION_DECK farcall FindCardIDInLocation jr nc, .try_search_for_bulbasaur ; no Dratini in Deck - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jp AITryUsePokemonTraderToSearchCard_GotCardToTrade .try_search_for_bulbasaur @@ -2068,12 +2068,12 @@ HandleAIDarkPokemonSearchStrategies: ret c ; couldn't use The Boss' Way ld a, b .trade_with_bulbasaur - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, BULBASAUR_LV12 ld a, CARD_LOCATION_DECK farcall FindCardIDInLocation jr nc, .try_search_for_kangaskhan_or_scyther ; no Bulbasaur in Deck - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jp AITryUsePokemonTraderToSearchCard_GotCardToTrade .try_search_for_kangaskhan_or_scyther @@ -2098,7 +2098,7 @@ HandleAIDarkPokemonSearchStrategies: ret c ld a, b .trade_with_kangaskhan_or_scyther - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, KANGASKHAN_LV40 ld a, CARD_LOCATION_DECK farcall FindCardIDInLocation @@ -2108,7 +2108,7 @@ HandleAIDarkPokemonSearchStrategies: farcall FindCardIDInLocation jr nc, .try_search_for_evolutions_1 .asm_490ff - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jp AITryUsePokemonTraderToSearchCard_GotCardToTrade .try_search_for_evolutions_1 @@ -2204,12 +2204,12 @@ HandleAIDarkPokemonSearchStrategies: ret c ; couldn't use The Boss' Way ld a, b .trade_with_charmander - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, CHARMANDER_LV9 ld a, CARD_LOCATION_DECK farcall FindCardIDInLocation jr nc, .try_search_for_kangaskhan_magmar_or_mr_mime ; no Charmander in Deck - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jp AITryUsePokemonTraderToSearchCard_GotCardToTrade .try_search_for_kangaskhan_magmar_or_mr_mime @@ -2232,7 +2232,7 @@ HandleAIDarkPokemonSearchStrategies: ret c ld a, b .trade_with_kangaskhan_magmar_or_mr_mime - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, KANGASKHAN_LV40 ld a, CARD_LOCATION_DECK farcall FindCardIDInLocation @@ -2246,7 +2246,7 @@ HandleAIDarkPokemonSearchStrategies: farcall FindCardIDInLocation jr nc, .try_search_for_evolutions_2 .asm_49219 - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jp AITryUsePokemonTraderToSearchCard_GotCardToTrade .try_search_for_evolutions_2 @@ -2336,12 +2336,12 @@ HandleAIDarkPokemonSearchStrategies: ret c ; couldn't use The Boss' Way ld a, b .trade_with_squirtle - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, SQUIRTLE_LV8 ld a, CARD_LOCATION_DECK farcall FindCardIDInLocation jr nc, .try_search_for_scyther_mr_mime_or_lapras ; no Squirtle in Deck - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jp AITryUsePokemonTraderToSearchCard_GotCardToTrade .try_search_for_scyther_mr_mime_or_lapras @@ -2364,7 +2364,7 @@ HandleAIDarkPokemonSearchStrategies: ret c ld a, b .trade_with_scyther_mr_mime_or_lapras - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, SCYTHER_LV25 ld a, CARD_LOCATION_DECK farcall FindCardIDInLocation @@ -2378,7 +2378,7 @@ HandleAIDarkPokemonSearchStrategies: farcall FindCardIDInLocation jr nc, .try_search_for_evolutions_3 .asm_49329 - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jp AITryUsePokemonTraderToSearchCard_GotCardToTrade .try_search_for_evolutions_3 @@ -2472,12 +2472,12 @@ HandleAIDarkPokemonSearchStrategies: ret c ; couldn't use The Boss' Way ld a, b .trade_with_machop - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, MACHOP_LV20 ld a, CARD_LOCATION_DECK farcall FindCardIDInLocation jr nc, .try_search_for_kangaskhan_magmar_or_chansey ; no Machop in Deck - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jp AITryUsePokemonTraderToSearchCard_GotCardToTrade .try_search_for_kangaskhan_magmar_or_chansey @@ -2500,7 +2500,7 @@ HandleAIDarkPokemonSearchStrategies: ret c ld a, b .trade_with_kangaskhan_magmar_or_chansey - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, KANGASKHAN_LV40 ld a, CARD_LOCATION_DECK farcall FindCardIDInLocation @@ -2510,7 +2510,7 @@ HandleAIDarkPokemonSearchStrategies: farcall FindCardIDInLocation jr nc, .try_search_for_evolutions_4 .asm_49436 - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jp AITryUsePokemonTraderToSearchCard_GotCardToTrade .try_search_for_evolutions_4 @@ -2583,7 +2583,7 @@ HandleAIDarkPokemonSearchStrategies: call CanUseEvolutionaryLight pop bc ld a, b - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr nc, .asm_49508 ld de, GRS_MEWTWO ld a, CARD_LOCATION_DECK @@ -2621,7 +2621,7 @@ HandleAIDarkPokemonSearchStrategies: farcall FindCardIDInLocation jr nc, .try_search_for_evolutions_5 .asm_49534 - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jp AITryUsePokemonTraderToSearchCard_GotCardToTrade .try_search_for_evolutions_5 @@ -2666,7 +2666,7 @@ HandleAIDarkPokemonSearchStrategies: ; input: ; - a = deck index of card to search in Deck AITryUseTheBossWayToSearchCard: - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld de, THE_BOSSS_WAY farcall LookForCardIDInHandList ccf @@ -2681,11 +2681,11 @@ AITryUseTheBossWayToSearchCard: ; - a = deck index of card to search in Deck ; - de = card ID in Hand to avoid trading AITryUsePokemonTraderToSearchCard: - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call FindDifferentPokemonCardInHand ccf ret c ; card in hand to trade not found - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a AITryUsePokemonTraderToSearchCard_GotCardToTrade: ld de, POKEMON_TRADER farcall LookForCardIDInHandList @@ -2698,7 +2698,7 @@ AITryUsePokemonTraderToSearchCard_GotCardToTrade: ; expects the Trainer card index to be in [wAITrainerCardToPlay] AIUseTrainerCardToSearchCard: ld a, [wAITrainerCardToPlay] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a bank1call LoadNonPokemonCardEffectCommands ld a, EFFECTCMDTYPE_INITIAL_EFFECT_1 call TryExecuteEffectCommandFunction @@ -2715,20 +2715,20 @@ Func_495dd: call CanUseEvolutionaryLight ccf ret c - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, c - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call FindAnyEvolutionCardInDeck ccf ret c ; evolution card not found - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, OPPACTION_USE_PKMN_POWER farcall AIMakeDecision ld a, OPPACTION_EXECUTE_PKMN_POWER_EFFECT farcall AIMakeDecision ld a, OPPACTION_DUEL_MAIN_SCENE farcall AIMakeDecision - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ret StopLifeDeckAIDecideGustOfWind: @@ -4800,19 +4800,19 @@ AIHandlePkmnPowersWhenPlayingPkmnFromHand: .power_of_darkness ldtx de, PowerOfDarknessCheckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn ld e, PLAY_AREA_ARENA call Func_4a3dc call SwapTurn - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret .sneak_attack xor a ld d, 10 farcall AIFindPlayAreaPkmnWithMinimumLeastRemainingHP - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, 10 cp d ret z ; will ko @@ -4828,7 +4828,7 @@ AIHandlePkmnPowersWhenPlayingPkmnFromHand: srl a ret c ; odd number xor a ; PLAY_AREA_ARENA - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .summon_minions @@ -4851,9 +4851,9 @@ AIHandlePkmnPowersWhenPlayingPkmnFromHand: .reel_in ld a, $ff - ldh [hTemp_ffa0], a - ldh [hTempPlayAreaLocation_ffa1], a - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 0], a + ldh [hDuelActionArgs + 1], a + ldh [hDuelActionArgs + 2], a ldh [$ffa5], a ld a, [wOpponentDeckID] cp BAD_GUYS_DECK_ID @@ -4900,7 +4900,7 @@ AIHandlePkmnPowersWhenPlayingPkmnFromHand: .TryAddCardToList: ld b, a ld c, 0 - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 .asm_4a3bf ld a, [hl] cp $ff diff --git a/src/engine/duel/effect_functions1.asm b/src/engine/duel/effect_functions1.asm index aae114b..fff0914 100644 --- a/src/engine/duel/effect_functions1.asm +++ b/src/engine/duel/effect_functions1.asm @@ -953,7 +953,7 @@ CheckIfTurnDuelistHasBench: ; - hl = text ID of reason why it cannot use it CheckIfCanUsePkmnPowerThisTurn: ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a add DUELVARS_ARENA_CARD_FLAGS get_turn_duelist_var and USED_PKMN_POWER_THIS_TURN @@ -967,7 +967,7 @@ CheckIfCanUsePkmnPowerThisTurn: ret SetUsedPkmnPowerThisTurnFlag: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD_FLAGS get_turn_duelist_var set USED_PKMN_POWER_THIS_TURN_F, [hl] @@ -1361,16 +1361,16 @@ AIPickAttackForAmnesia: ld e, SECOND_ATTACK .chosen ld a, e - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn ret ; handles screen for player to select a bench Pokémon -; on opponent's side, and outputs selection in [hTemp_ffa0] +; on opponent's side, and outputs selection in [hDuelActionArgs + 0] ; if opponent has no bench Pokémon then return carry HandlePlayerSelectOppBenchPkmn: ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckNonTurnDuelistHasBench ret c ; no bench ldtx hl, ChooseBenchedPokemonToGiveDamageText @@ -1381,7 +1381,7 @@ HandlePlayerSelectOppBenchPkmn: bank1call OpenPlayAreaScreenForSelection jr c, .loop_input ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn ret @@ -1396,7 +1396,7 @@ HandlePlayerSelectOppPlayAreaPkmn: bank1call OpenPlayAreaScreenForSelection jr c, .select_pkmn call SwapTurn - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ; Return in a the PLAY_AREA_* of the non-turn holder's Pokemon card in bench with the lowest (remaining) HP. @@ -1572,34 +1572,34 @@ TerrorStrike_InitialEffect: call Func_6808d ret -; outputs in hTemp_ffa0 the result of the coin toss (0 = tails, 1 = heads). -; in case it was heads, stores in hTempPlayAreaLocation_ffa1 +; outputs in hDuelActionArgs + 0 the result of the coin toss (0 = tails, 1 = heads). +; in case it was heads, stores in hDuelActionArgs + 1 ; the PLAY_AREA_* location of the Bench Pokemon that was selected for switch. TerrorStrike_50PercentSelectSwitchPokemon: xor a ; PLAY_AREA_ARENA - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckNonTurnDuelistHasBench ret c ; no bench -; 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 hDuelActionArgs + 0. ; return if it was tails. ldtx de, IfHeadsSwitchOutOpponentsActivePokemonText call Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc call HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret -; if coin toss at hTemp_ffa0 was heads and it's possible, +; if coin toss at hDuelActionArgs + 0 was heads and it's possible, ; switch the Defending Pokemon TerrorStrike_SwitchDefendingPokemon: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call HandleSwitchDefendingPokemonEffect ret @@ -1627,7 +1627,7 @@ VictreebelLure_AssertPokemonInBench: call CheckNonTurnDuelistHasBench ret -; return in hTempPlayAreaLocation_ffa1 the PLAY_AREA_* location +; return in hDuelActionArgs + 1 the PLAY_AREA_* location ; of the Bench Pokemon that was selected for switch VictreebelLure_SelectSwitchPokemon: ldtx hl, SelectBenchedPokemonToSwitchWithActiveText @@ -1638,22 +1638,22 @@ VictreebelLure_SelectSwitchPokemon: bank1call OpenPlayAreaScreenForSelection jr c, .select_pokemon ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn ret -; Return in hTemp_ffa0 the PLAY_AREA_* of the non-turn holder's Pokemon card in bench with the lowest (remaining) HP. +; Return in hDuelActionArgs + 0 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: call AIFindTargetForBenchAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret -; Defending Pokemon is swapped out for the one with the PLAY_AREA_* at hTemp_ffa0 +; Defending Pokemon is swapped out for the one with the PLAY_AREA_* at hDuelActionArgs + 0 ; unless an effect or Pkmn Power prevents it. VictreebelLure_SwitchDefendingPokemon: call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect call nc, SwapArenaWithBenchPokemon @@ -1850,7 +1850,7 @@ Sprout_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Sprout_AISelectEffect: @@ -1861,7 +1861,7 @@ Sprout_AISelectEffect: ld hl, wDuelTempList .loop ld a, [hli] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff ret z farcall ExecuteCardSearchFunc @@ -1869,7 +1869,7 @@ Sprout_AISelectEffect: ret Sprout_PutInPlayAreaEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .shuffle call SearchCardInDeckAndAddToHand @@ -1878,7 +1878,7 @@ Sprout_PutInPlayAreaEffect: call IsPlayerTurn jr c, .shuffle ; display card on screen - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, PlacedOnBenchText bank1call DisplayCardDetailScreen .shuffle @@ -1897,7 +1897,7 @@ Teleport_PlayerSelectEffect: bank1call OpenPlayAreaScreenForSelection jr c, .loop ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ; selects a random card from the bench to switch to @@ -1905,11 +1905,11 @@ Teleport_AISelectEffect: ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA get_turn_duelist_var call Random - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Teleport_SwitchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call SwapArenaWithBenchPokemon xor a @@ -1975,14 +1975,14 @@ Thrash_AIEffect: Thrash_ModifierEffect: ldtx de, IfHeadPlus10IfTails10ToYourselfText call TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ld a, 10 call AddToDamage ret Thrash_RecoilEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ld a, 10 @@ -2060,7 +2060,7 @@ NidoranFCallForFamily_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret NidoranFCallForFamily_AISelectEffect: @@ -2070,7 +2070,7 @@ NidoranFCallForFamily_AISelectEffect: ld hl, wDuelTempList .loop ld a, [hli] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff ret z farcall ExecuteCardSearchFunc @@ -2078,7 +2078,7 @@ NidoranFCallForFamily_AISelectEffect: ret NidoranFCallForFamily_PutInPlayAreaEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .shuffle call SearchCardInDeckAndAddToHand @@ -2087,7 +2087,7 @@ NidoranFCallForFamily_PutInPlayAreaEffect: call IsPlayerTurn jr c, .shuffle ; display card on screen - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, PlacedOnBenchText bank1call DisplayCardDetailScreen .shuffle @@ -2158,11 +2158,11 @@ NidorinoDoubleKick_MultiplierEffect: ButterfreeWhirlwind_CheckBench: call HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ButterfreeWhirlwind_SwitchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call HandleSwitchDefendingPokemonEffect ret @@ -2236,7 +2236,7 @@ VenusaurEnergyTrans_AIEffect: ; found in turn duelist's Play Area CheckIfGrassEnergyInPlayArea: ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ldh a, [hTempPlayAreaLocation_ff9d] bank1call CheckIsIncapableOfUsingPkmnPower ret c ; cannot use Pkmn Power @@ -2310,31 +2310,31 @@ EnergyTransEffect: ret z ; a press - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ldh [hCurSelectionItem], a call CheckIfCardHasGrassOrRainbowEnergyAttached jr c, .play_sfx ; no Grass attached - ldh [hAIEnergyTransEnergyCard], a - ldh a, [hAIEnergyTransEnergyCard] ; useless + ldh [hDuelActionArgs + ENERGYTRANS_ARGS_ENERGY_INDEX], a + ldh a, [hDuelActionArgs + ENERGYTRANS_ARGS_ENERGY_INDEX] ; useless ; temporarily take card away to draw Play Area call AddCardToHand bank1call PrintPlayAreaCardList_EnableLCD - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a - ldh a, [hAIEnergyTransEnergyCard] + ldh a, [hDuelActionArgs + ENERGYTRANS_ARGS_ENERGY_INDEX] ; give card back call PutHandCardInPlayArea ; draw Grass/Rainbow symbol near cursor - ldh a, [hAIEnergyTransEnergyCard] + ldh a, [hDuelActionArgs + ENERGYTRANS_ARGS_ENERGY_INDEX] ld b, SYM_GRASS call GetCardIDFromDeckIndex cp16 GRASS_ENERGY jr z, .got_symbol ld b, SYM_RAINBOW .got_symbol - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call DrawSymbolOnPlayAreaCursor ; handle the action of placing a Grass Energy card @@ -2347,18 +2347,18 @@ EnergyTransEffect: ; a press ldh [hCurSelectionItem], a - ldh [hAIEnergyTransPlayAreaLocation], a + ldh [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA], a ld a, OPPACTION_6B15 call SetOppAction_SerialSendDuelData - ldh a, [hAIEnergyTransPlayAreaLocation] + ldh a, [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA] ld e, a - ldh a, [hAIEnergyTransEnergyCard] + ldh a, [hDuelActionArgs + ENERGYTRANS_ARGS_ENERGY_INDEX] ; give card being held to this Pokemon call AddCardToHand call PutHandCardInPlayArea .remove_symbol - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld b, SYM_SPACE call DrawSymbolOnPlayAreaCursor call EraseCursor @@ -2369,9 +2369,9 @@ EnergyTransEffect: jr .loop_input_take EnergyTransAITransfer: - ldh a, [hAIEnergyTransPlayAreaLocation] + ldh a, [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA] ld e, a - ldh a, [hAIEnergyTransEnergyCard] + ldh a, [hDuelActionArgs + ENERGYTRANS_ARGS_ENERGY_INDEX] call AddCardToHand call PutHandCardInPlayArea bank1call PrintPlayAreaCardList_EnableLCD @@ -2470,7 +2470,7 @@ BellsproutCallForFamily_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret BellsproutCallForFamily_AISelectEffect: @@ -2481,7 +2481,7 @@ BellsproutCallForFamily_AISelectEffect: ld hl, wDuelTempList .loop ld a, [hli] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff ret z farcall ExecuteCardSearchFunc @@ -2489,7 +2489,7 @@ BellsproutCallForFamily_AISelectEffect: ret BellsproutCallForFamily_PutInPlayAreaEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .shuffle call SearchCardInDeckAndAddToHand @@ -2497,7 +2497,7 @@ BellsproutCallForFamily_PutInPlayAreaEffect: call PutHandPokemonCardInPlayArea call IsPlayerTurn jr c, .shuffle - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, PlacedOnBenchText bank1call DisplayCardDetailScreen .shuffle @@ -2533,10 +2533,10 @@ Shift_OncePerTurnCheck: Shift_PlayerSelectEffect: .loop ldtx hl, ChoosePokemonToColorChangeText - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or $80 farcall HandleColorChangeScreen - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret c ; cancelled ; check whether the color selected is valid @@ -2565,7 +2565,7 @@ Shift_PlayerSelectEffect: ld a, b bank1call GetPlayAreaCardColor pop bc - ld hl, hTempPlayAreaLocation_ffa1 + ld hl, hDuelActionArgs + 1 cp [hl] ret z ; found inc b @@ -2577,15 +2577,15 @@ Shift_PlayerSelectEffect: Shift_ChangeColorEffect: call SetUsedPkmnPowerThisTurnFlag - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD get_turn_duelist_var call LoadCardDataToBuffer1_FromDeckIndex - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD_CHANGED_TYPE ld l, a - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or HAS_CHANGED_COLOR ld [hl], a call LoadCardNameAndInputColor @@ -2635,7 +2635,7 @@ Heal_OncePerTurnCheck: Heal_RemoveDamageEffect: ldtx de, HealSuccessCheckText call TossCoin_Bank1a - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jr nc, .done ld a, DUELVARS_DUELIST_TYPE @@ -2653,7 +2653,7 @@ Heal_RemoveDamageEffect: bank1call OpenPlayAreaScreenForSelection jr c, .loop_input ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a ld e, a call GetCardDamageAndMaxHP or a @@ -2666,21 +2666,21 @@ Heal_RemoveDamageEffect: call LoadSymbolsFont call LoadDuelCardSymbolTiles call SerialRecv8Bytes - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a .done ; flag Pkmn Power as being used regardless of coin outcome call SetUsedPkmnPowerThisTurnFlag - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a ret z ; return if coin was tails - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] add DUELVARS_ARENA_CARD_HP get_turn_duelist_var add 10 ; remove 1 damage counter ld [hl], a - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] call DrawPlayAreaScreenToShowChanges call ExchangeRNG ret @@ -2889,7 +2889,7 @@ OmastarSpikeCannon_MultiplierEffect: Clairvoyance_CheckUse: ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ldh a, [hTempPlayAreaLocation_ff9d] ; unnecessary bank1call CheckIsIncapableOfUsingPkmnPower ret @@ -2964,7 +2964,7 @@ KrabbyCallForFamily_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret KrabbyCallForFamily_AISelectEffect: @@ -2975,7 +2975,7 @@ KrabbyCallForFamily_AISelectEffect: ld hl, wDuelTempList .loop ld a, [hli] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff ret z farcall ExecuteCardSearchFunc @@ -2983,7 +2983,7 @@ KrabbyCallForFamily_AISelectEffect: ret KrabbyCallForFamily_PutInPlayAreaEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .shuffle call SearchCardInDeckAndAddToHand @@ -2991,7 +2991,7 @@ KrabbyCallForFamily_PutInPlayAreaEffect: call PutHandPokemonCardInPlayArea call IsPlayerTurn jr c, .shuffle - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, PlacedOnBenchText bank1call DisplayCardDetailScreen .shuffle @@ -3116,18 +3116,18 @@ StarmieRecover_PlayerSelectEffect: bank1call HandleAttachedEnergyMenuInput jr c, .loop_input ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a ; store card chosen + ldh [hDuelActionArgs + 0], a ; store card chosen ret StarmieRecover_AISelectEffect: ld a, TYPE_ENERGY_WATER call CreateListOfEnergyAttachedToArena ld a, [wDuelTempList] ; pick first card - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret StarmieRecover_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -3196,11 +3196,11 @@ PlayerPickAttackForAmnesia: call DrawWideTextBox_WaitForInput call HandleDefendingPokemonAttackSelection ld a, e - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ; applies the Amnesia effect on the defending Pokemon, -; for the attack index in hTemp_ffa0. +; for the attack index in hDuelActionArgs + 0. ApplyAmnesiaToAttack: ld a, SUBSTATUS2_AMNESIA ApplyAmnesiaToAttack_GotSubstatus: @@ -3212,7 +3212,7 @@ ApplyAmnesiaToAttack_GotSubstatus: ; set selected attack as disabled ld a, DUELVARS_ARENA_CARD_DISABLED_ATTACK_INDEX call GetNonTurnDuelistVariable - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld [hl], a ld l, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT @@ -3229,7 +3229,7 @@ ApplyAmnesiaToAttack_GotSubstatus: ld a, DUELVARS_ARENA_CARD get_turn_duelist_var ld d, a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call GetAttackName call LoadTxRam2 @@ -3321,11 +3321,11 @@ FreezeDryEffect: Blizzard_BenchDamage50PercentEffect: ldtx de, DamageToOppBenchIfHeadsDamageToYoursIfTailsText call TossCoin_Bank1a - ldh [hTemp_ffa0], a ; store coin result + ldh [hDuelActionArgs + 0], a ; store coin result ret Blizzard_BenchDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .opp_bench @@ -3345,7 +3345,7 @@ Blizzard_BenchDamageEffect: ; return carry if can't use Cowardice Cowardice_CheckUseAndBench: ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a bank1call CheckIsIncapableOfUsingPkmnPower ret c ; return if cannot use @@ -3364,7 +3364,7 @@ Cowardice_CheckUseAndBench: ret Cowardice_PlayerSelectEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; return if not Arena card ldtx hl, SelectPokemonToPlaceInTheArenaText @@ -3372,27 +3372,27 @@ Cowardice_PlayerSelectEffect: bank1call HasAlivePokemonInBench bank1call OpenPlayAreaScreenForSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret Cowardice_ReturnToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD get_turn_duelist_var ; put card in Discard Pile temporarily, so that ; all cards attached are discarded as well. push af - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call MovePlayAreaCardToDiscardPile ; if card was in Arena, swap selected Bench ; Pokemon with Arena, otherwise skip. - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .skip_switch - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a call SwapArenaWithBenchPokemon @@ -3481,7 +3481,7 @@ PlayerPickFireEnergyCardToDiscard: bank1call DisplayEnergyDiscardMenu bank1call HandleAttachedEnergyMenuInput ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ; returns carry if Arena card has no Fire/Rainbow Energy cards @@ -3507,7 +3507,7 @@ GetNumberOfAttachedFireAndRainbowEnergy: AIPickFireEnergyCardToDiscard: call CreateListOfFireEnergyAttachedToArena ld a, [wDuelTempList] - ldh [hTemp_ffa0], a ; pick first in list + ldh [hDuelActionArgs + 0], a ; pick first in list ret ArcanineFlamethrower_CheckEnergy: @@ -3520,7 +3520,7 @@ ArcanineFlamethrower_AISelectEffect: jp AIPickFireEnergyCardToDiscard ArcanineFlamethrower_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -3628,18 +3628,18 @@ NinetalesLure_PlayerSelectEffect: bank1call OpenPlayAreaScreenForSelection jr c, .loop_input ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn ret NinetalesLure_AISelectEffect: call AIFindTargetForBenchAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret NinetalesLure_SwitchEffect: call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect call nc, SwapArenaWithBenchPokemon @@ -3658,7 +3658,7 @@ FireBlast_AISelectEffect: jp AIPickFireEnergyCardToDiscard FireBlast_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -3672,7 +3672,7 @@ CharmanderEmber_AISelectEffect: jp AIPickFireEnergyCardToDiscard CharmanderEmber_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -3821,7 +3821,7 @@ FlareonFlamethrower_AISelectEffect: jp AIPickFireEnergyCardToDiscard FlareonFlamethrower_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -3835,7 +3835,7 @@ MagmarFlamethrower_AISelectEffect: jp AIPickFireEnergyCardToDiscard MagmarFlamethrower_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -3864,7 +3864,7 @@ CharmeleonFlamethrower_AISelectEffect: jp AIPickFireEnergyCardToDiscard CharmeleonFlamethrower_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -4394,7 +4394,7 @@ Curse_PlayerSelectEffect: cp $ff jr z, .cancel ldh [hCurSelectionItem], a - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call GetCardDamageAndMaxHP or a jr nz, .picked_first @@ -4405,7 +4405,7 @@ Curse_PlayerSelectEffect: .picked_first ; give 10 HP to card selected, draw the scene, ; then immediately revert this. - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] add DUELVARS_ARENA_CARD_HP get_turn_duelist_var push af @@ -4418,7 +4418,7 @@ Curse_PlayerSelectEffect: ld [hl], a ; draw damage counter on cursor - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld b, SYM_HP_NOK call DrawSymbolOnPlayAreaCursor @@ -4427,27 +4427,27 @@ Curse_PlayerSelectEffect: call DoFrame call HandleMenuInput jr nc, .loop_input_second - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], 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] + ldh a, [hDuelActionArgs + 1] ld b, SYM_SPACE call DrawSymbolOnPlayAreaCursor call EraseCursor jr .start .a_press - ld hl, hTempPlayAreaLocation_ffa1 + ld hl, hDuelActionArgs + 1 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] + ldh a, [hDuelActionArgs + 1] ld b, SYM_SPACE call DrawSymbolOnPlayAreaCursor call EraseCursor @@ -4477,12 +4477,12 @@ Curse_TransferDamageEffect: bank1call SetupPlayAreaScreen .vs_player ; transfer the damage counter to the targets that were selected. - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] add DUELVARS_ARENA_CARD_HP get_turn_duelist_var sub 10 ld [hl], a - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] add DUELVARS_ARENA_CARD_HP ld l, a ld a, 10 @@ -4495,14 +4495,14 @@ Curse_TransferDamageEffect: cp DUELIST_TYPE_PLAYER jr z, .done ; vs. opponent - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] ldh [hTempPlayAreaLocation_ff9d], a bank1call InitAndPrintPlayAreaCardInformationAndLocation_WithTextBox .done - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] bank1call LoadPlayAreaCardID_ToTempNonTurnDuelistCardID - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] add DUELVARS_ARENA_CARD_HP get_turn_duelist_var call PrintKnockedOutIfHLZero @@ -4518,16 +4518,16 @@ GengarDarkMind_PlayerSelectEffect: GengarDarkMind_AISelectEffect: ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckNonTurnDuelistHasBench ret c ; no bench ; just pick Pokemon with lowest remaining HP. call AIFindTargetForBenchAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret GengarDarkMind_DamageBenchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff ret z ; no target chosen call SwapTurn @@ -4553,7 +4553,7 @@ DestinyBond_PlayerSelectEffect: bank1call HandleAttachedEnergyMenuInput ret c ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret DestinyBond_AISelectEffect: @@ -4561,11 +4561,11 @@ DestinyBond_AISelectEffect: ld a, TYPE_ENERGY_PSYCHIC call CreateListOfEnergyAttachedToArena ld a, [wDuelTempList] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret DestinyBond_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -4714,7 +4714,7 @@ Prophecy_AISelectEffect: ; AI doesn't ever choose this attack ; so this it does no sorting. ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Prophecy_ReorderDeckEffect: @@ -4864,7 +4864,7 @@ HandleProphecyScreen: push bc ld c, a ld b, $00 - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 add hl, bc ld a, [de] ld [hl], a @@ -4911,16 +4911,16 @@ HypnoDarkMind_PlayerSelectEffect: HypnoDarkMind_AISelectEffect: ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckNonTurnDuelistHasBench ret c ; no bench ; just pick Pokemon with lowest remaining HP. call AIFindTargetForBenchAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret HypnoDarkMind_DamageBenchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff ret z ; no target chosen call SwapTurn @@ -4950,7 +4950,7 @@ MrMimeMeditateEffect: ; returns carry if Damage Swap cannot be used. DamageSwap_CheckDamage: ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckIfPlayAreaHasAnyDamage jr c, .no_damage ldh a, [hTempPlayAreaLocation_ff9d] @@ -4995,7 +4995,7 @@ DamageSwap_SelectAndSwapEffect: cp $ff ret z ; quit when B button is pressed - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ldh [hCurSelectionItem], a ; if card has no damage, play sfx and return to start @@ -5004,7 +5004,7 @@ DamageSwap_SelectAndSwapEffect: jr z, .no_damage ; take damage away temporarily to draw UI. - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] add DUELVARS_ARENA_CARD_HP get_turn_duelist_var push af @@ -5017,7 +5017,7 @@ DamageSwap_SelectAndSwapEffect: ld [hl], a ; draw damage counter in cursor - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld b, SYM_HP_NOK call DrawSymbolOnPlayAreaCursor @@ -5033,7 +5033,7 @@ DamageSwap_SelectAndSwapEffect: ; try to give the card selected the damage counter ; if it would KO, ignore it. - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a ldh [hCurSelectionItem], a call TryGiveDamageCounter_DamageSwap jr c, .loop_input_second @@ -5042,7 +5042,7 @@ DamageSwap_SelectAndSwapEffect: call SetOppAction_SerialSendDuelData .update_ui - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld b, SYM_SPACE call DrawSymbolOnPlayAreaCursor call EraseCursor @@ -5052,7 +5052,7 @@ DamageSwap_SelectAndSwapEffect: call PlaySFX_InvalidChoice jr .loop_input_first -; tries to give damage counter to hPlayAreaEffectTarget, +; tries to give damage counter to hDuelActionArgs + 2, ; and if successful updates UI screen. DamageSwap_SwapEffect: call TryGiveDamageCounter_DamageSwap @@ -5062,13 +5062,13 @@ DamageSwap_SwapEffect: ret ; tries to give the damage counter to the target -; chosen by the Player (hPlayAreaEffectTarget). +; chosen by the Player (hDuelActionArgs + 2). ; if the damage counter would KO card, then do ; not give the damage counter and return carry. TryGiveDamageCounter_DamageSwap: - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld l, a - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] cp l ret z ; both targets are the same, exit add DUELVARS_ARENA_CARD_HP @@ -5077,7 +5077,7 @@ TryGiveDamageCounter_DamageSwap: jr z, .set_carry ; would bring HP to zero? ; has enough HP to receive a damage counter ld [hl], a - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] add DUELVARS_ARENA_CARD_HP ld l, a ld a, 10 @@ -5116,9 +5116,9 @@ DevolutionBeam_CheckPlayArea: ret ; returns carry of Player cancelled selection. -; otherwise, output in hTemp_ffa0 which Play Area +; otherwise, output in hDuelActionArgs + 0 which Play Area ; was selected ($0 = own Play Area, $1 = opp. Play Area) -; and in hTempPlayAreaLocation_ffa1 selected card. +; and in hDuelActionArgs + 1 selected card. DevolutionBeam_PlayerSelectEffect: ldtx hl, ProcedureForDevolutionBeamText bank1call DrawWholeScreenTextBox @@ -5142,7 +5142,7 @@ DevolutionBeam_PlayerSelectEffect: xor a .store_selection - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld [hli], a ; store which Duelist Play Area selected ldh a, [hTempPlayAreaLocation_ff9d] ld [hl], a ; store which card selected @@ -5163,16 +5163,16 @@ DevolutionBeam_PlayerSelectEffect: DevolutionBeam_AISelectEffect: ld a, $01 ; always choose player's side - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn call FindFirstNonBasicCardInPlayArea call SwapTurn jr c, .found xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call FindFirstNonBasicCardInPlayArea .found - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret DevolutionBeam_LoadAnimation: @@ -5181,14 +5181,14 @@ DevolutionBeam_LoadAnimation: ret DevolutionBeam_DevolveEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr z, .DevolvePokemon cp $ff ret z ; opponent's Play Area - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a jr nz, .skip_handle_no_damage_effect call HandleNoDamageOrEffect @@ -5204,7 +5204,7 @@ DevolutionBeam_DevolveEffect: farcall ResetAttackAnimationIsPlaying ld a, ATK_ANIM_DEVOLUTION_BEAM ld [wLoadedAttackAnimation], a - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld b, a ld c, $00 ldh a, [hWhoseTurn] @@ -5213,7 +5213,7 @@ DevolutionBeam_DevolveEffect: farcall WaitAttackAnimation ; load selected card's data - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldh [hTempPlayAreaLocation_ff9d], a ld [wTempPlayAreaLocation_cceb], a add DUELVARS_ARENA_CARD @@ -5240,7 +5240,7 @@ DevolutionBeam_DevolveEffect: ret .devolve - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldh [hTempPlayAreaLocation_ff9d], a add DUELVARS_ARENA_CARD get_turn_duelist_var @@ -5256,7 +5256,7 @@ DevolutionBeam_DevolveEffect: call AddCardToHand ; check if this devolution KO's card - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call PrintPlayAreaCardKnockedOutIfNoHP xor a @@ -5356,7 +5356,7 @@ Barrier_PlayerSelectEffect: bank1call HandleAttachedEnergyMenuInput ret c ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Barrier_AISelectEffect: @@ -5364,11 +5364,11 @@ Barrier_AISelectEffect: ld a, TYPE_ENERGY_PSYCHIC call CreateListOfEnergyAttachedToArena ld a, [wDuelTempList] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Barrier_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -5465,7 +5465,7 @@ MewtwoEnergyAbsorption_AddToHandEffect: StrangeBehavior_CheckDamage: ; does Play Area have any damage counters? ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckIfPlayAreaHasAnyDamage ldtx hl, NoPokemonWithDamageCountersText jr c, .set_carry @@ -5520,8 +5520,8 @@ StrangeBehavior_SelectAndSwapEffect: ret z ; return when B button is pressed ldh [hCurSelectionItem], a - ldh [hTempPlayAreaLocation_ffa1], a - ld hl, hTemp_ffa0 + ldh [hDuelActionArgs + 1], a + ld hl, hDuelActionArgs + 0 cp [hl] jr z, .play_sfx ; can't select Slowbro itself @@ -5547,18 +5547,18 @@ StrangeBehavior_SwapEffect: ret ; tries to give the damage counter to the target -; chosen by the Player (hTemp_ffa0). +; chosen by the Player (hDuelActionArgs + 0). ; if the damage counter would KO card, then do ; not give the damage counter and return carry. TryGiveDamageCounter_StrangeBehavior: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD_HP get_turn_duelist_var 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] + ldh a, [hDuelActionArgs + 1] add DUELVARS_ARENA_CARD_HP ld l, a ld a, 10 @@ -5584,14 +5584,14 @@ SpacingOut_CheckDamage: SpacingOut_Success50PercentEffect: ldtx de, AttackSuccessCheckText call TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jp nc, SetWasUnsuccessful ld a, ATK_ANIM_RECOVER ld [wLoadedAttackAnimation], a ret SpacingOut_HealEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; coin toss was tails ld de, 10 @@ -5614,7 +5614,7 @@ Scavenge_PlayerSelectEnergyEffect: bank1call HandleAttachedEnergyMenuInput ret c ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret @@ -5623,15 +5623,15 @@ Scavenge_AISelectEffect: ld a, TYPE_ENERGY_PSYCHIC call CreateListOfEnergyAttachedToArena ld a, [wDuelTempList] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; AI picks first Trainer card in list call CreateTrainerCardListFromDiscardPile ld a, [wDuelTempList] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret Scavenge_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -5645,16 +5645,16 @@ Scavenge_PlayerSelectTrainerEffect: bank1call DisplayCardList jr c, .loop_input ldh a, [hTempCardIndex_ff98] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret Scavenge_AddToHandEffect: - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call MoveDiscardPileCardToHand call AddCardToHand call IsPlayerTurn ret c - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldtx hl, WasPlacedInTheHandText bank1call DisplayCardDetailScreen ret @@ -5693,18 +5693,18 @@ KadabraRecover_PlayerSelectEffect: bank1call HandleAttachedEnergyMenuInput ret c ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a ; store card chosen + ldh [hDuelActionArgs + 0], a ; store card chosen ret KadabraRecover_AISelectEffect: ld a, TYPE_ENERGY_PSYCHIC call CreateListOfEnergyAttachedToArena ld a, [wDuelTempList] ; pick first card - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret KadabraRecover_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -5754,7 +5754,7 @@ MysteryAttack_RandomEffect: ; chooses a random effect from 8 possible options. call UpdateRNGSources and %111 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld hl, .random_effect jp JumpToFunctionInTable @@ -5791,7 +5791,7 @@ MysteryAttack_RandomEffect: MysteryAttack_RecoverEffect: ; in case the 5th option was chosen for random effect, ; trigger recovery effect for 10 HP. - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp 4 ret nz ld de, 10 @@ -5806,19 +5806,19 @@ GeodudeStoneBarrage_AIEffect: GeodudeStoneBarrage_MultiplierEffect: xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a .loop_coin_toss ldtx de, FlipUntilTails10DamageTimesHeadsText xor a call TossCoinATimes_Bank1a jr nc, .tails - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 inc [hl] ; increase heads count jr .loop_coin_toss .tails ; store resulting damage - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld l, a ld h, 10 call HtimesL @@ -5943,7 +5943,7 @@ MarowakCallForFamily_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret MarowakCallForFamily_AISelectEffect: @@ -5953,7 +5953,7 @@ MarowakCallForFamily_AISelectEffect: ld hl, wDuelTempList .loop ld a, [hli] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff ret z farcall ExecuteCardSearchFunc @@ -5961,7 +5961,7 @@ MarowakCallForFamily_AISelectEffect: ret MarowakCallForFamily_PutInPlayAreaEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .shuffle call SearchCardInDeckAndAddToHand @@ -5969,7 +5969,7 @@ MarowakCallForFamily_PutInPlayAreaEffect: call PutHandPokemonCardInPlayArea call IsPlayerTurn jr c, .shuffle - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, PlacedOnBenchText bank1call DisplayCardDetailScreen .shuffle @@ -6026,14 +6026,14 @@ GravelerHardenEffect: Ram_SelectSwitchEffect: call HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Ram_RecoilSwitchEffect: ld a, 20 call DealRecoilDamageToSelf call UnsetIsDamageToSelf - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call HandleSwitchDefendingPokemonEffect ret @@ -6057,12 +6057,12 @@ StretchKick_PlayerSelectEffect: StretchKick_AISelectEffect: call AIFindTargetForBenchAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret StretchKick_BenchDamageEffect: call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld b, a ld de, 20 call DealDamageToPlayAreaPokemon_RegularAnim @@ -6118,16 +6118,16 @@ MankeyPeek_SelectEffect: ; player call FinishQueuedAnimations call HandlePeekSelection - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a call SerialSend8Bytes ret .link_opp call SerialRecv8Bytes - ldh [hAIPkmnPowerEffectParam], a + ldh [hDuelActionArgs + 1], a .ai_opp - ldh a, [hAIPkmnPowerEffectParam] + ldh a, [hDuelActionArgs + 1] bit AI_PEEK_TARGET_HAND_F, a jr z, .prize_or_deck and (~AI_PEEK_TARGET_HAND & $ff) ; unset bit to get deck index @@ -6136,7 +6136,7 @@ MankeyPeek_SelectEffect: ; all deck indices will be smaller than $40. cp $40 jr c, .hand - ldh a, [hAIPkmnPowerEffectParam] + ldh a, [hDuelActionArgs + 1] jr .prize_or_deck .hand @@ -6153,7 +6153,7 @@ MankeyPeek_SelectEffect: ; so show Play Area and draw cursor appropriately. call FinishQueuedAnimations call SwapTurn - ldh a, [hAIPkmnPowerEffectParam] + ldh a, [hDuelActionArgs + 1] xor $80 call DrawAIPeekScreen call SwapTurn @@ -6262,14 +6262,14 @@ Thunderpunch_AIEffect: Thunderpunch_ModifierEffect: ldtx de, IfHeadPlus10IfTails10ToYourselfText call TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; return if got tails ld a, 10 call AddToDamage ret Thunderpunch_RecoilEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; return if got heads ld a, 10 @@ -6320,13 +6320,13 @@ ZapdosThunder_Recoil50PercentEffect: call LoadTxRam3 ldtx de, IfTailsDamageToYourselfTooText call TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ZapdosThunder_RecoilEffect: ld hl, 30 call LoadTxRam3 - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; return if got heads ld a, 30 @@ -6383,12 +6383,12 @@ ThunderstormEffect: farcall GetNextPositionInTempList ld [hl], $ff ld a, b - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call ResetAnimationQueue call SwapTurn ; tally recoil damage - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr z, .skip_recoil ; deal number of tails times 10 to self @@ -6398,7 +6398,7 @@ ThunderstormEffect: ; deal damage for Bench Pokemon that got heads call SwapTurn - ld hl, hTempPlayAreaLocation_ffa1 + ld hl, hDuelActionArgs + 1 ld b, PLAY_AREA_BENCH_1 .loop_bench ld a, [hli] @@ -6524,13 +6524,13 @@ ThunderJolt_Recoil50PercentEffect: call LoadTxRam3 ldtx de, IfTailsDamageToYourselfTooText call TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ThunderJolt_RecoilEffect: ld hl, 10 call LoadTxRam3 - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ld a, 10 @@ -6543,20 +6543,20 @@ Spark_PlayerSelectEffect: Spark_AISelectEffect: ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckNonTurnDuelistHasBench ret c ; no bench ; AI always picks Pokemon with lowest HP remaining call AIFindTargetForBenchAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Spark_BenchDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff ret z call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld b, a ld de, 10 call DealDamageToPlayAreaPokemon_RegularAnim @@ -6644,13 +6644,13 @@ RaichuThunder_Recoil50PercentEffect: call LoadTxRam3 ldtx de, IfTailsDamageToYourselfTooText call TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret RaichuThunder_RecoilEffect: ld hl, 30 call LoadTxRam3 - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ld a, 30 @@ -7134,7 +7134,7 @@ EnergySpike_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff ret z ; no selection done @@ -7148,34 +7148,34 @@ EnergySpike_PlayerSelectEffect: bank1call OpenPlayAreaScreenForSelection jr c, .loop ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret EnergySpike_AISelectEffect: ; AI doesn't choose card here, ; instead this is handled in AISelectSpecialAttackParameters ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret EnergySpike_AttachEnergyEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .done ; add card to hand and attach it to the selected Pokemon call SearchCardInDeckAndAddToHand call AddCardToHand - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] 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] + ldh a, [hDuelActionArgs + 1] add DUELVARS_ARENA_CARD get_turn_duelist_var call LoadCardDataToBuffer1_FromDeckIndex @@ -7186,7 +7186,7 @@ EnergySpike_AttachEnergyEffect: inc de ld a, [hli] ld [de], a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, AttachedEnergyToPokemonText bank1call DisplayCardDetailScreen @@ -7275,7 +7275,7 @@ StepIn_BenchCheck: call CheckIfCanUsePkmnPowerThisTurn ret c ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret nz ; is Arena card already ldtx hl, CanOnlyBeUsedOnTheBenchText @@ -7284,7 +7284,7 @@ StepIn_BenchCheck: StepIn_SwitchEffect: call SetUsedPkmnPowerThisTurnFlag - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call SwapArenaWithBenchPokemon ret @@ -7490,12 +7490,12 @@ DragonairHyperBeam_DiscardEffect: AIPickEnergyCardToDiscardFromDefendingPokemon: call _AIPickEnergyCardToDiscardFromDefendingPokemon - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ; handles player selection for attacks that discard ; an energy card attached to the defending card -; outputs selection in [hTemp_ffa0] +; outputs selection in [hDuelActionArgs + 0] ; if defending Pokémon has no energy, then output -1 instead HandleDiscardEnergyFromDefendingCardPlayerSelection: call SwapTurn @@ -7516,20 +7516,20 @@ HandleDiscardEnergyFromDefendingCardPlayerSelection: jr c, .loop call SwapTurn ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .no_energies call SwapTurn ld a, -1 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ; discards an energy due to an attack's effect -; selection is expected to be in [hTemp_ffa0] +; selection is expected to be in [hDuelActionArgs + 0] DiscardEnergyEffect: ; check if energy card was chosen to discard - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp -1 ret z ; return if none selected @@ -7538,7 +7538,7 @@ DiscardEnergyEffect: ; discard Defending card's energy call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT get_turn_duelist_var @@ -7618,11 +7618,11 @@ HurricaneEffect: PidgeottoWhirlwind_SelectEffect: call HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret PidgeottoWhirlwind_SwitchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call HandleSwitchDefendingPokemonEffect ret @@ -7747,7 +7747,7 @@ HandlePlayerMetronomeEffect: ld a, [wMetronomeAttackCannotBeUsed] call SerialSend8Bytes - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] ld [wPlayerAttackingCardIndex], a ld a, [wSelectedAttack] ld [wPlayerAttackingAttackIndex], a @@ -7812,11 +7812,11 @@ LickitungSupersonicEffect: PidgeyWhirlwind_SelectEffect: call HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret PidgeyWhirlwind_SwitchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call HandleSwitchDefendingPokemonEffect ret @@ -7850,12 +7850,12 @@ HandleConversion1PlayerSelection: ldtx hl, ChooseWeaknessToConversion1Text xor a ; PLAY_AREA_ARENA farcall HandleColorChangeScreen - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret -; change Defending card's weakness given in [hTemp_ffa0] +; change Defending card's weakness given in [hDuelActionArgs + 0] ChangeDefendingCardsWeakness: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff ret z call HandleNoDamageOrEffect @@ -7864,7 +7864,7 @@ ChangeDefendingCardsWeakness: ; apply changed weakness ld a, DUELVARS_ARENA_CARD_CHANGED_WEAKNESS call GetNonTurnDuelistVariable - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call TranslateColorToWR ld [hl], a ld l, DUELVARS_ARENA_CARD_LAST_TURN_CHANGE_WEAK @@ -7911,7 +7911,7 @@ HandleConversion2PlayerSelection: ldtx hl, ChooseResistanceToConversion2Text ld a, $80 farcall HandleColorChangeScreen - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret AISelectConversion2Color: @@ -7925,7 +7925,7 @@ AISelectConversion2Color: ld a, [wLoadedCard1Type] cp COLORLESS jr z, .is_colorless - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .is_colorless call SwapTurn @@ -7933,15 +7933,15 @@ AISelectConversion2Color: call SwapTurn ret -; change Attacking card's resistance given in [hTemp_ffa0] +; change Attacking card's resistance given in [hDuelActionArgs + 0] ChangeAttackingCardsResistance: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff ret z ; apply changed resistance ld a, DUELVARS_ARENA_CARD_CHANGED_RESISTANCE get_turn_duelist_var - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call TranslateColorToWR ld [hl], a ldtx hl, ChangedTheResistanceOfPokemonToColorText @@ -7951,7 +7951,7 @@ PrintChangedCardWRText: ld a, DUELVARS_ARENA_CARD get_turn_duelist_var call LoadCardDataToBuffer1_FromDeckIndex - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call LoadCardNameAndInputColor pop hl call DrawWideTextBox_PrintText @@ -8027,14 +8027,14 @@ AISelectConversionColor: ; otherwise, just select a random energy. ld a, NUM_COLORED_TYPES call Random - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .found pop de ld a, [wLoadedCard1Type] and TYPE_PKMN - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ScrunchEffect: @@ -8068,13 +8068,13 @@ SuperFangEffect: ; unused in-game TrainerCardAsPokemon_BenchCheck: ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckIfTurnDuelistHasBench ret ; unused in-game TrainerCardAsPokemon_PlayerSelectSwitch: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; no need to switch if it's not Arena card @@ -8083,18 +8083,18 @@ TrainerCardAsPokemon_PlayerSelectSwitch: bank1call HasAlivePokemonInBench bank1call OpenPlayAreaScreenForSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret ; unused in-game TrainerCardAsPokemon_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call DiscardPlayAreaCard - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .shift_cards - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a call SwapArenaWithBenchPokemon .shift_cards @@ -8465,7 +8465,7 @@ GatherFire_PlayerSelectEffect: ; is the same card as Charmander? ldh a, [hTempPlayAreaLocation_ff9d] ld e, a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp e jr z, .loop ; not same Pokémon, transfer energy @@ -8481,12 +8481,12 @@ GatherFire_PlayerSelectEffect: ; store selection ldh a, [hTempCardIndex_ff98] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret GatherFire_TransferEnergyEffect: call SetUsedPkmnPowerThisTurnFlag - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hTempPlayAreaLocation_ff9d], a ld e, a or a @@ -8494,7 +8494,7 @@ GatherFire_TransferEnergyEffect: ld a, ATK_ANIM_PKMN_POWER_1 ld [wLoadedAttackAnimation], a .no_animation - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call AddCardToHand call PutHandCardInPlayArea ld a, [wLoadedAttackAnimation] @@ -8515,34 +8515,34 @@ Fireball_CheckEnergy: Fireball_AISuccess50PercentEffect: ldtx de, DamageCheckIfTailsNoDamageText call Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails call AIPickFireEnergyCardToDiscard - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, $01 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Fireball_PlayerSuccess50PercentEffect: ldtx de, DamageCheckIfTailsNoDamageText call Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails .select_energy call PlayerPickFireEnergyCardToDiscard jr c, .select_energy ld a, $01 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ldh a, [hTempCardIndex_ff98] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret Fireball_DiscardEffect: ; if result was heads, discard card - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr z, .not_successful - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] jp DiscardCard .not_successful ; else set 0 damage and unsuccessful flag @@ -8587,14 +8587,14 @@ ContinuousFireball_AIMultiplierEffect: ld hl, 50 ldtx de, DamageCheckXDamageTimesHeadsText call Serial_TossCoinATimes - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret z ; no heads call CreateListOfFireEnergyAttachedToArena ; cap number of heads to 14 - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp 15 jr c, .capped ld a, 14 @@ -8620,7 +8620,7 @@ ContinuousFireball_PlayerMultiplierEffect: ld hl, 50 ldtx de, DamageCheckXDamageTimesHeadsText call Serial_TossCoinATimes - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret z ; no heads @@ -8628,7 +8628,7 @@ ContinuousFireball_PlayerMultiplierEffect: cp 16 ; bug, should be 15 jr c, .capped ld a, 14 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a .capped ; select Fire energies to discard ; start at hTempList + 1 @@ -8638,7 +8638,7 @@ ContinuousFireball_PlayerMultiplierEffect: call CreateListOfFireEnergyAttachedToArena xor a ; PLAY_AREA_ARENA bank1call DisplayEnergyDiscardMenu - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld [wAttachedEnergyMenuDenominator], a .loop_selection bank1call HandleAttachedEnergyMenuInput @@ -8657,7 +8657,7 @@ ContinuousFireball_PlayerMultiplierEffect: ContinuousFireball_DiscardEffect: ; discard if any heads - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld a, [hli] or a jr z, .no_discard @@ -8669,7 +8669,7 @@ ContinuousFireball_DiscardEffect: jr nz, .loop_discard .no_discard ; set damage to num heads * 50 - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld l, a ld h, 50 call HtimesL @@ -8692,19 +8692,19 @@ PonytaEmber_AISelectEffect: ret PonytaEmber_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] jp DiscardCard FlamePillar_AISelectEffect: ; AI always selects "no" ld a, $01 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret FlamePillar_PlayerSelectEffect: ; default is "no" ld a, $01 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; has any Fire/Rainbow energy? call CheckIfArenaCardHasFireOrRainbowEnergy @@ -8715,40 +8715,40 @@ FlamePillar_PlayerSelectEffect: ; prompt player if they want to discard ldtx hl, RemoveEnergyCardPromptText call YesOrNoMenuWithText - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr c, .no_carry .select_energy call PlayerPickFireEnergyCardToDiscard jr c, .select_energy xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ldh a, [hTempCardIndex_ff98] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a .select_bench_pkmn call SwapTurn bank1call HasAlivePokemonInBench bank1call OpenPlayAreaScreenForSelection call SwapTurn jr c, .select_bench_pkmn - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a .no_carry or a ret FlamePillar_BenchDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; no damage to bench ; first discard selected card - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call DiscardCard ; then damage Bench Pokémon call SwapTurn - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] ld b, a ld de, 10 bank1call ApplyDarkWaveDamageBoost @@ -8791,13 +8791,13 @@ PlayingWithFire_AISelectEffect: call LoadTxRam3 ldtx de, DamageCheckIfHeadsPlusDamageText call Serial_TossCoin - ldh [hTemp_ffa0], a ; useless, this will be overwritten + ldh [hDuelActionArgs + 0], a ; useless, this will be overwritten ret nc ; got tails call AIPickFireEnergyCardToDiscard - ldh a, [hTemp_ffa0] - ldh [hTempPlayAreaLocation_ffa1], a + ldh a, [hDuelActionArgs + 0] + ldh [hDuelActionArgs + 1], a ld a, $01 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret PlayingWithFire_PlayerSelectEffect: @@ -8805,7 +8805,7 @@ PlayingWithFire_PlayerSelectEffect: call LoadTxRam3 ldtx de, DamageCheckIfHeadsPlusDamageText call Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; got tails ; select Fire energy if any @@ -8821,19 +8821,19 @@ PlayingWithFire_PlayerSelectEffect: .no_fire_energy ld a, $ff .got_card - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld a, $01 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret PlayingWithFire_DiscardAndDamageBonusEffect: ; did we get heads? - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; got tails ; did we select a card to discard? - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] cp $ff jr z, .no_damage call DiscardCard @@ -8876,7 +8876,7 @@ HydrocannonEffect: RocketTackle_NoDamageCheckEffect: ldtx de, IfHeadsNoDamageNextTurnText call TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret c ; got heads ld a, ATK_ANIM_ROCKET_TACKLE_NO_PROTECT ld [wLoadedAttackAnimation], a @@ -8888,7 +8888,7 @@ RocketTackle_NoDamageEffect: bank1call ApplyDarkWaveDamageBoost ld a, e call DealRecoilDamageToSelf - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; got tails ; if got heads, no damage next turn @@ -8938,7 +8938,7 @@ ThirdEye_AISelectEffect: bank1call SortCardsInDuelTempListByID ; select the first card in the list ld a, [wDuelTempList] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ThirdEye_PlayerSelectEffect: @@ -8949,11 +8949,11 @@ ThirdEye_PlayerSelectEffect: bank1call HandleAttachedEnergyMenuInput ret c ; operation cancelled ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ThirdEye_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] jp DiscardCard ThirdEye_DrawCardsEffect: @@ -9004,7 +9004,7 @@ RapidEvolution_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret RapidEvolution_AISelectEffect: @@ -9015,7 +9015,7 @@ RapidEvolution_AISelectEffect: ld hl, wDuelTempList .loop ld a, [hli] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff ret z farcall ExecuteCardSearchFunc @@ -9023,7 +9023,7 @@ RapidEvolution_AISelectEffect: ret RapidEvolution_EvolveEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .none_chosen ; a Gyarados card was successfully chosen @@ -9098,18 +9098,18 @@ Stare_DamageBenchEffect: ; used when Mirror Move is copying Stare attack SetArenaCardAsStareTarget: xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret AISelectStareTarget: call AIFindTargetForPlayAreaAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret SetAttackAnimationToNoneAndResetResidualIfTargetIsArenaCard: xor a ; ATK_ANIM_NONE ld [wLoadedAttackAnimation], a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; is Bench ld hl, wLoadedAttackCategory @@ -9118,9 +9118,9 @@ SetAttackAnimationToNoneAndResetResidualIfTargetIsArenaCard: ; input: ; - de = damage to deal -; - [hTemp_ffa0] = target chosen +; - [hDuelActionArgs + 0] = target chosen DealStareDamage: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff ret z ; no target push de @@ -9135,7 +9135,7 @@ DealStareDamage: ld a, ATK_ANIM_STARE_BENCH ld [wLoadedAttackAnimation], a call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .bench_target @@ -9146,26 +9146,26 @@ DealStareDamage: ld a, ATK_ANIM_STARE ld [wLoadedAttackAnimation], a .bench_target - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld b, a bank1call ApplyDarkWaveDamageBoostIfTargetIsBench call DealDamageToPlayAreaPokemon ld a, [wNoDamageOrEffect] or a jr nz, .done ; no effect or damage - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD_HP get_turn_duelist_var or a jr z, .done ; target was KO'd ; set Stare flag - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD_FLAGS get_turn_duelist_var set AFFECTED_BY_STARE_F, [hl] ; reset changed type - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD_CHANGED_TYPE ld l, a ld [hl], 0 @@ -9197,13 +9197,13 @@ SneakAttack_PlayerSelectEffect: .select_pkmn bank1call OpenPlayAreaScreenForSelection jr c, .select_pkmn ; mandatory selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn ret SneakAttack_DealDamageEffect: call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld b, a ld de, 10 call DealDamageToPlayAreaPokemon_RegularAnim @@ -9222,11 +9222,11 @@ Flitter_PlayerSelectEffect: Flitter_AISelectEffect: call AIFindTargetForPlayAreaAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Flitter_DamageArenaEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .bench call PreparePlayAreaAttackAgainstArena @@ -9240,7 +9240,7 @@ Flitter_DamageArenaEffect: ret Flitter_DamageBenchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; Arena was chosen call SwapTurn @@ -9548,7 +9548,7 @@ AbraVanish_PlayerSelectEffect: .select_bench bank1call OpenPlayAreaScreenForSelection jr c, .select_bench ; mandatory selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret AbraVanish_ReturnToDeckEffect: @@ -9579,7 +9579,7 @@ AbraVanish_ReturnToDeckEffect: ld [hl], 0 ; switch in selected card to replace - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call SwapArenaWithBenchPokemon call ShiftAllPokemonToFirstPlayAreaSlots @@ -9606,12 +9606,12 @@ MatterExchange_PlayerSelectEffect: bank1call InitAndDrawCardListScreenLayout_WithSelectCheckMenu bank1call DisplayCardList ret c ; operation cancelled - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret MatterExchange_DiscardAndDrawEffect: call SetUsedPkmnPowerThisTurnFlag - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hTempPlayAreaLocation_ff9d], a or a jr z, .no_animation @@ -9622,7 +9622,7 @@ MatterExchange_DiscardAndDrawEffect: farcall PlayAttackAnimationOverAttackingPokemon ; discard chosen card - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call RemoveCardFromHand call PutCardInDiscardPile @@ -9644,7 +9644,7 @@ DarkKadabraMindShockEffect: TeleportBlast_PlayerSelectEffect: ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckIfTurnDuelistHasBench ret c ; no bench @@ -9658,17 +9658,17 @@ TeleportBlast_PlayerSelectEffect: .select_switch_in bank1call OpenPlayAreaScreenForSelection jr c, .select_switch_in - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret TeleportBlast_AISelectEffect: ; AI always selects "no" ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret TeleportBlast_BeforeDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff ret nz ; has switching ld a, ATK_ANIM_PSYCHIC_HIT @@ -9676,7 +9676,7 @@ TeleportBlast_BeforeDamageEffect: ret TeleportBlast_SwitchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff ret z ; no switching @@ -9698,7 +9698,7 @@ TeleportBlast_SwitchEffect: ret z ; no damage ; actually do switching - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld [wcd0a], a ld e, a call SwapArenaWithBenchPokemon @@ -9726,7 +9726,7 @@ AfternoonNap_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret AfternoonNap_AISelectEffect: @@ -9736,7 +9736,7 @@ AfternoonNap_AISelectEffect: ld hl, wDuelTempList .loop ld a, [hli] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff ret z farcall ExecuteCardSearchFunc @@ -9744,7 +9744,7 @@ AfternoonNap_AISelectEffect: ret AfternoonNap_AttachEnergyEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .no_selection ; got card to attach @@ -9959,11 +9959,11 @@ DigUnder_PlayerSelectEffect: DigUnder_AISelectEffect: call AIFindTargetForPlayAreaAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret DigUnder_ArenaDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .bench call PreparePlayAreaAttackAgainstArena @@ -9977,7 +9977,7 @@ DigUnder_ArenaDamageEffect: ret DigUnder_BenchDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; arena call SwapTurn @@ -10069,17 +10069,17 @@ DragOff_PlayerSelectEffect: bank1call OpenPlayAreaScreenForSelection jr c, .select_bench ; mandatory selection call SwapTurn - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret DragOff_AISelectEffect: call AIFindTargetForBenchAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret DragOff_SwitchEffect: call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect jr nc, .switch @@ -10109,11 +10109,11 @@ DragOff_SwitchEffect: KnockBack_CheckBench: call HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret KnockBack_SwitchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call HandleSwitchDefendingPokemonEffect ret @@ -10184,25 +10184,25 @@ Trickery_SwitchPrizeEffect: jr nz, .ai_opp call FinishQueuedAnimations farcall HandlePrizeCardPlayerSelection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call SerialSend8Bytes jr .switch_cards ret .link_opp call SerialRecv8Bytes - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a .ai_opp call FinishQueuedAnimations call SwapTurn - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] xor $80 call DrawAIPeekScreen call SwapTurn ldtx hl, CardTrickeryWasUsedOnText call DrawWideTextBox_WaitForInput .switch_cards - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] and $0f add DUELVARS_PRIZE_CARDS get_turn_duelist_var @@ -10254,7 +10254,7 @@ CoinHurl_AIEffect: CoinHurl_PlayerSelectEffect: ldtx de, DamageCheckIfTailsNoDamageText call Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails call SwapTurn bank1call HasAlivePokemonInPlayArea @@ -10262,20 +10262,20 @@ CoinHurl_PlayerSelectEffect: bank1call OpenPlayAreaScreenForSelection jr c, .loop ; mandatory selection call SwapTurn - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret CoinHurl_AISelectEffect: ldtx de, DamageCheckIfTailsNoDamageText call Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails call AIFindTargetForPlayAreaAttack - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret CoinHurl_DamageArenaEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .successful ; unsuccessful @@ -10284,7 +10284,7 @@ CoinHurl_DamageArenaEffect: call SetWasUnsuccessful ret .successful - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a jr nz, .bench call PreparePlayAreaAttackAgainstArena @@ -10298,10 +10298,10 @@ CoinHurl_DamageArenaEffect: ret CoinHurl_DamageBenchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; unsuccessful - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a ret z ; arena call SwapTurn @@ -10336,16 +10336,16 @@ FascinateInitialEffect: FascinateAISelectEffect: ldtx de, AttackSuccessCheckText call Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails call AIFindTargetForBenchAttack - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret FascinatePlayerSelectEffect: ldtx de, AttackSuccessCheckText call Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails call SwapTurn bank1call HasAlivePokemonInBench @@ -10353,11 +10353,11 @@ FascinatePlayerSelectEffect: bank1call OpenPlayAreaScreenForSelection jr c, .loop ; mandatory selection call SwapTurn - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret FascinateLoadAnimation: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; a = ATK_ANIM_NONE @@ -10366,15 +10366,15 @@ FascinateLoadAnimation: ret FascinateSwitchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; not successful call SwapTurn - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect jr c, .not_affected - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a call SwapArenaWithBenchPokemon .not_affected @@ -10439,7 +10439,7 @@ EvolutionaryLight_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a or a ret @@ -10447,7 +10447,7 @@ EvolutionaryLight_AddToHandEffect: call SetUsedPkmnPowerThisTurnFlag ; was a valid selection made? - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] cp $ff jr z, .done @@ -10458,7 +10458,7 @@ EvolutionaryLight_AddToHandEffect: jr c, .done ; show it to the player - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldtx hl, WasPlacedInTheHandText bank1call DisplayCardDetailScreen @@ -10483,7 +10483,7 @@ SummonMinions_InitialEffect: SummonMinions_PlayerSelectEffect: ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CreateDeckCardList jr c, .no_cards_in_deck @@ -10632,7 +10632,7 @@ DarkMagnetonSonicboomEffect: MagneticLines_AISelectEffect: ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckNonTurnDuelistHasBench ret c ; no bench call CreateBasicEnergyListAttachedToDefendingCard @@ -10640,14 +10640,14 @@ MagneticLines_AISelectEffect: ; just choose the first energy card ; and give it to weakest bench Pokémon ld a, [wDuelTempList] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call AIFindTargetForBenchAttack - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret MagneticLines_PlayerSelectEffect: ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckNonTurnDuelistHasBench ret c ; no bench call CreateBasicEnergyListAttachedToDefendingCard @@ -10662,38 +10662,38 @@ MagneticLines_PlayerSelectEffect: bank1call HandleAttachedEnergyMenuInput jr c, .select_energy ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; select a Bench Pokémon to give it to bank1call HasAlivePokemonInBench .select_bench_pkmn bank1call OpenPlayAreaScreenForSelection jr c, .select_bench_pkmn - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call SwapTurn ret MagneticLines_TransferEnergyEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff ret z ; no card to transfer call HandleNoDamageOrEffect ret c ; no effect call SwapTurn - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect jr c, .done ; add to hand then attach it to Bench card - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call AddCardToHand call PutHandCardInPlayArea call IsPlayerTurn jr c, .done ; show it to the player - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call DrawPlayAreaScreenToShowChanges .done @@ -10773,9 +10773,9 @@ EnergyBomb_PlayerSelectEffect: ld a, d cp $ff ret z ; done - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, e - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call TransferEnergyToPlayAreaPkmn jr .link_opp @@ -10790,14 +10790,14 @@ EnergyBomb_PlayerSelectEffect: .select_energy bank1call DisplayCardList jr c, .select_energy - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a bank1call HasAlivePokemonInBench .select_bench_pkmn bank1call OpenPlayAreaScreenForSelection jr c, .select_bench_pkmn - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld e, a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld d, a call SerialSend8Bytes call AddCardToHand @@ -10827,9 +10827,9 @@ EnergyBomb_PlayerSelectEffect: ret TransferEnergyToPlayAreaPkmn: - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call AddCardToHand call PutHandCardInPlayArea bank1call PrintPlayAreaCardList_EnableLCD @@ -10843,13 +10843,13 @@ LightningFlashEffect: ThunderAttack_Paralysis50PercentEffect: ldtx de, ThunderAttackCheckText call TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails call ParalysisEffect ret ThunderAttack_RecoilEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; got heads ld a, 10 @@ -11099,7 +11099,7 @@ MirrorMove_InitialEffect1: MirrorMove_InitialEffect2: ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT get_turn_duelist_var or a @@ -11147,7 +11147,7 @@ MirrorMove_PlayerSelection: MirrorMove_AISelection: ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT get_turn_duelist_var or a diff --git a/src/engine/duel/effect_functions2.asm b/src/engine/duel/effect_functions2.asm index 88189fe..c736c2b 100644 --- a/src/engine/duel/effect_functions2.asm +++ b/src/engine/duel/effect_functions2.asm @@ -10,17 +10,17 @@ ImposterOaksRevenge_PlayerSelectEffect: ldtx hl, ChooseCardFromHandToDiscardText call DrawWideTextBox_WaitForInput call CreateHandCardList - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call RemoveCardFromDuelTempList bank1call InitAndDrawCardListScreenLayout_WithSelectCheckMenu bank1call DisplayCardList ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ImposterOaksRevenge_ReturnHandAndDrawEffect: ; discard selected card - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call RemoveCardFromHand call PutCardInDiscardPile @@ -192,11 +192,11 @@ TheBosssWay_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret TheBosssWay_AddToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .finish ; no valid selection @@ -206,7 +206,7 @@ TheBosssWay_AddToHandEffect: jr c, .finish ; show card to player - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, WasPlacedInTheHandText bank1call DisplayCardDetailScreen @@ -223,7 +223,7 @@ GoopGasAttackEffect: RocketsSneakAttack_PlayerSelectEffect: ; default to invalid selection ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn call CreateHandCardList @@ -246,7 +246,7 @@ RocketsSneakAttack_PlayerSelectEffect: jr nz, .loop_selection ; is Trainer ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr .done .check_if_can_exit @@ -269,7 +269,7 @@ RocketsSneakAttack_PlayerSelectEffect: ret RocketsSneakAttack_ReturnToDeckEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff ret z ; no selection call SwapTurn @@ -328,7 +328,7 @@ NightlyGarbageRun_PlayerSelectEffect: ret NightlyGarbageRun_ReturnToDeckEffect: - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld de, wDuelTempList .loop_return_to_deck ld a, [hli] @@ -451,7 +451,7 @@ Challenge_PlayerAndOpponentSelectEffect: call AIDecideChallengeCards call SwapTurn xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .player @@ -473,7 +473,7 @@ Challenge_PlayerAndOpponentSelectEffect: call SwapTurn xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .link_opp @@ -503,30 +503,30 @@ Challenge_PlayerAndOpponentSelectEffect: call SwapTurn ldh a, [hCurSelectionItem] ld e, a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] sub e inc a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a farcall PrintHowManyCardsLinkOpponentChoseDueToChallenge call SwapTurn xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ; input: ; - a = TRUE if declined challenge, FALSE if accepted ; output: ; - carry set if challenge was declined -; - either way, $1 is loaded to hTemp_ffa0 +; - either way, $1 is loaded to hDuelActionArgs + 0 .ProcessResponse: - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ldtx hl, ChallengeDeclinedText or a scf ; carry set jr nz, .print_text ldtx hl, ChallengeAcceptedText ld a, $01 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ; carry not set .print_text push af @@ -537,13 +537,13 @@ Challenge_PlayerAndOpponentSelectEffect: ret Challenge_DrawOrPlaceInPlayAreaEffect: - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld a, [hli] or a jr z, .loop_add_to_play_area_player ; challenge was declined, draw 2 cards - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call RemoveCardFromHand ld a, 2 farcall DisplayDrawNCardsScreen @@ -722,18 +722,18 @@ FollowMe_SelectSwitchPokemon: bank1call OpenPlayAreaScreenForSelection jr c, .loop ; mandatory selection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn ret FollowMe_GetBenchPokemonWithLowestHP: farcall AIFindTargetForBenchAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret FollowMe_SwitchDefendingPokemon: call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect call nc, SwapArenaWithBenchPokemon @@ -765,7 +765,7 @@ HelpingHandEffect_CheckUse: HelpingHandEffect_PlayerSelectEffect: ; set result as unsuccessful by default ld a, $ff - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ldtx de, IfHeadsHeal1StatusOfYourActiveText farcall Serial_TossCoin jr c, .heads @@ -783,7 +783,7 @@ HelpingHandEffect_PlayerSelectEffect: jr nz, .two_status .one_status_only xor a - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret .two_status @@ -810,19 +810,19 @@ HelpingHandEffect_PlayerSelectEffect: ld e, CNF_SLP_PRZ ; keep cnf/slp/prz, heal poison .got_choice ld a, e - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a or a ret HelpingHandEffect_HealStatusEffect: farcall SetUsedPkmnPowerThisTurnFlag - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] cp $ff ret z ; got tails ld a, ATK_ANIM_FULL_HEAL call PlaySpecialAttackAnimation - ; hTempPlayAreaLocation_ffa1 holds mask to apply to status - ldh a, [hTempPlayAreaLocation_ffa1] + ; hDuelActionArgs + 1 holds mask to apply to status + ldh a, [hDuelActionArgs + 1] ld e, a ld a, DUELVARS_ARENA_CARD_STATUS get_turn_duelist_var @@ -847,11 +847,11 @@ GolbatLv25LeechLifeEffect: Nosedive_Recoil50PercentEffect: ldtx de, IfTails40DamageToYourselfTooText farcall TossCoin_Bank1a - ldh [hTemp_ffa0], a ; store coin toss result + ldh [hDuelActionArgs + 0], a ; store coin toss result ret Nosedive_RecoilEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; was heads ld a, 40 @@ -876,7 +876,7 @@ ScatterSpores_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ScatterSpores_AISelectEffect: @@ -887,7 +887,7 @@ ScatterSpores_AISelectEffect: ld hl, wDuelTempList .loop ld a, [hli] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff ret z farcall ExecuteCardSearchFunc @@ -895,7 +895,7 @@ ScatterSpores_AISelectEffect: ret ScatterSpores_PlaceInPlayAreaEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .no_selection ldh [hTempCardIndex_ff98], a @@ -905,7 +905,7 @@ ScatterSpores_PlaceInPlayAreaEffect: farcall IsPlayerTurn jr c, .no_selection ; show card to player - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, PlacedOnBenchText bank1call DisplayCardDetailScreen .no_selection @@ -948,11 +948,11 @@ AbraPsychic_PlayerSelectEffect: AbraPsychic_AISelectEffect: farcall AIFindTargetForPlayAreaAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret AbraPsychic_ArenaDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .bench farcall PreparePlayAreaAttackAgainstArena @@ -966,7 +966,7 @@ AbraPsychic_ArenaDamageEffect: ret AbraPsychic_BenchDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; is arena call SwapTurn @@ -1003,7 +1003,7 @@ FlameInferno_AIEffect: FlameInferno_AISelectEffect: xor a ; 0 cards - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a farcall CreateListOfFireEnergyAttachedToArena ret c ; no fire energies to discard @@ -1028,7 +1028,7 @@ FlameInferno_AISelectEffect: ret z ; only one fire, don't discard .got_num_to_discard ld hl, wDuelTempList - ld de, hTemp_ffa0 + ld de, hDuelActionArgs + 0 ld a, b cp c ret c ; need more cards to discard than has attached @@ -1048,7 +1048,7 @@ FlameInferno_PlayerSelectEffect: xor a ld [wAttachedEnergyMenuNumerator], a - ; start on 1 because hTemp_ffa0 will hold num cards discarded + ; start on 1 because hDuelActionArgs + 0 will hold num cards discarded ld a, 1 ldh [hCurSelectionItem], a @@ -1094,7 +1094,7 @@ FlameInferno_PlayerSelectEffect: ; also output num of cards discarded ld a, [wAttachedEnergyMenuNumerator] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret @@ -1109,7 +1109,7 @@ FlameInferno_DiscardAndDamageBoostEffect: jr .loop_discard .calculate_damage_boost - ldh a, [hTemp_ffa0] ; num cards discarded + ldh a, [hDuelActionArgs + 0] ; num cards discarded add a call ATimes10 farcall AddToDamage @@ -1118,11 +1118,11 @@ FlameInferno_DiscardAndDamageBoostEffect: KickAway_CheckBench: farcall HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret KickAway_SwitchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] farcall HandleSwitchDefendingPokemonEffect ret @@ -1365,18 +1365,18 @@ FossilExcavation_AISelectEffect: jr nc, .got_selection ld a, $ff .got_selection - ldh [hTemp_ffa0], a - ; [hTempPlayAreaLocation_ffa1] already has deck index + ldh [hDuelActionArgs + 0], a + ; [hDuelActionArgs + 1] already has deck index ; of Mysterious Fossil because of CheckIfMysteriousFossilInList ret ; returns carry set if Mysterious Fossil is found in wDuelTempList -; also outputs first card it finds in [hTempPlayAreaLocation_ffa1] +; also outputs first card it finds in [hDuelActionArgs + 1] CheckIfMysteriousFossilInList: ld hl, wDuelTempList .loop_find ld a, [hli] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a cp $ff ret z ; didn't find any call GetCardIDFromDeckIndex @@ -1389,7 +1389,7 @@ FossilExcavation_PlayerSelectEffect: .select_deck_or_discard_pile ldtx hl, ChooseDeckOrDiscardPileToCheckText call TwoItemHorizontalMenu - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr nc, .deck ; discard pile @@ -1410,7 +1410,7 @@ FossilExcavation_PlayerSelectEffect: .loop_discard_pile_input bank1call DisplayCardList jr c, .loop_discard_pile_input - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call GetCardIDFromDeckIndex cp16 MYSTERIOUS_FOSSIL jr nz, .loop_discard_pile_input @@ -1429,16 +1429,16 @@ FossilExcavation_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret FossilExcavation_AddToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr z, .get_from_deck ; get from Discard Pile - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldh [hTempCardIndex_ff98], a call MoveDiscardPileCardToHand call AddCardToHand @@ -1449,7 +1449,7 @@ FossilExcavation_AddToHandEffect: ret .get_from_deck - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldh [hTempCardIndex_ff98], a cp $ff jr z, .finish ; no valid card in deck @@ -1471,7 +1471,7 @@ MoonStone_AISelectEffect: ; AI always chooses no target here since ; this is handled in Trainer-specific logic ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret MoonStone_PlayerSelectEffect: @@ -1485,18 +1485,18 @@ MoonStone_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret MoonStone_AddToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .finish call SearchCardInDeckAndAddToHand call AddCardToHand farcall IsPlayerTurn jr c, .finish - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, WasPlacedInTheHandText bank1call DisplayCardDetailScreen .finish @@ -1620,7 +1620,7 @@ MasterBall_PlayerSelectEffect: .loop_selection bank1call DisplayCardList jr c, .try_exit - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call CheckIfCardIsNotPkmn jr c, .loop_selection ; not a Pkmn .done @@ -1629,11 +1629,11 @@ MasterBall_PlayerSelectEffect: .try_exit ; only exit if player cannot choose a Pokémon card - ; will exit with $ff in hTemp_ffa0, in case there are no valid targets + ; will exit with $ff in hDuelActionArgs + 0, in case there are no valid targets ld hl, wDuelTempList .loop_check ld a, [hli] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff jr z, .done call CheckIfCardIsNotPkmn @@ -1641,7 +1641,7 @@ MasterBall_PlayerSelectEffect: jr .loop_check MasterBall_AddToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .finish call SearchCardInDeckAndAddToHand @@ -1675,19 +1675,19 @@ PokemonRecall_PlayerSelectEffect: bank1call SetCardListHeaderAndInfoText bank1call DisplayCardList ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; if player cancelled during DisplayCardList, ; then carry is set here and effect will not continue ret PokemonRecall_AddToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call MoveDiscardPileCardToHand call ReturnCardToDeck farcall IsPlayerTurn ret c ldtx hl, CardWasChosenText - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] bank1call DisplayCardDetailScreen ret @@ -1750,9 +1750,9 @@ ComputerError_DecksCheck: ComputerError_PlayerAndOppSelection: farcall HandleComputerErrorPlayerSelection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call .OtherDuelist - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret .OtherDuelist: @@ -1786,16 +1786,16 @@ ComputerError_PlayerAndOppSelection: ret ComputerError_DrawEffect: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call RemoveCardFromHand ; turn duelist draws - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call .DrawCards ; non-turn duelist draws call SwapTurn - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call .DrawCards call SwapTurn @@ -1911,7 +1911,7 @@ ShortCircuit_PlayerSelectEffect: bank1call OpenPlayAreaScreenForSelection jr c, .loop_selection ; mandatory selection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call GetNumberOfWaterEnergiesAttachedToPlayAreaCard ; does it have any Water energies? or a @@ -1954,12 +1954,12 @@ ShortCircuit_AISelectEffect: dec c jr nz, .loop_play_area ld a, e - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn ret ShortCircuit_DamageArenaEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .bench farcall PreparePlayAreaAttackAgainstArena @@ -1977,18 +1977,18 @@ ShortCircuit_DamageArenaEffect: ret ShortCircuit_DamageBenchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; arena ld a, ATK_ANIM_SHORT_CIRCUIT_BENCH ld [wLoadedAttackAnimation], a call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call GetNumberOfWaterEnergiesAttachedToPlayAreaCard call ATimes10 ld e, a ld d, 0 - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld b, a call DealDamageToPlayAreaPokemon call SwapTurn @@ -2083,7 +2083,7 @@ StirUpTwister_AISelectEffect: ; handle own switch farcall HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; handle player switch farcall CheckIfTurnDuelistHasBench @@ -2096,20 +2096,20 @@ StirUpTwister_AISelectEffect: call Random inc a .no_bench - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret StirUpTwister_PlayerSelectEffect: ; handle own switch farcall HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff jr z, .select_opp_switch farcall IsPlayerTurn jr nc, .select_opp_switch call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] farcall DrawPlayAreaScreenToShowChanges call SwapTurn @@ -2118,18 +2118,18 @@ StirUpTwister_PlayerSelectEffect: farcall HandleMandatorySwitchSelection call SwapTurn ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret StirUpTwister_SwitchEffect: ; switch defending card first - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] farcall HandleSwitchDefendingPokemonEffect - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] cp $ff ret z - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD_HP call GetNonTurnDuelistVariable or a @@ -2140,7 +2140,7 @@ StirUpTwister_SwitchEffect: cp SUBSTATUS1_DESTINY_BOND jr z, .skip_attacking_switch .no_ko - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld [wcd0a], a ld e, a call SwapArenaWithBenchPokemon @@ -2202,19 +2202,19 @@ GravelerStoneBarrage_AIEffect: GravelerStoneBarrage_MultiplierEffect: xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a .loop_coin_toss ldtx de, FlipUntilTails20DamageTimesHeadsText xor a farcall TossCoinATimes_Bank1a jr nc, .tails - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 inc [hl] ; increase heads count jr .loop_coin_toss .tails ; store resulting damage - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld l, a ld h, 20 call HtimesL @@ -2245,7 +2245,7 @@ MagnetMove_CheckUse: MagnetMove_PlayerSelectEffect: ldtx de, MagnetCheckText farcall Serial_TossCoin - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a jr c, .successful ; unsuccessful @@ -2267,14 +2267,14 @@ MagnetMove_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a or a ret MagnetMove_AISelectEffect: ldtx de, MagnetCheckText farcall Serial_TossCoin - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret nc ld de, DEX_MAGNEMITE ld a, CARDSEARCH_POKEDEX_NUMBER @@ -2283,7 +2283,7 @@ MagnetMove_AISelectEffect: ld hl, wDuelTempList .loop ld a, [hli] - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a cp $ff ret z farcall ExecuteCardSearchFunc @@ -2292,10 +2292,10 @@ MagnetMove_AISelectEffect: MagnetMove_AddToPlayAreaEffect: farcall SetUsedPkmnPowerThisTurnFlag - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a ret z ; not successful - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] cp $ff jr z, .finish call SearchCardInDeckAndAddToHand @@ -2304,7 +2304,7 @@ MagnetMove_AddToPlayAreaEffect: farcall IsPlayerTurn jr c, .finish ; show card to player - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] ldtx hl, PlacedOnBenchText bank1call DisplayCardDetailScreen .finish @@ -2318,7 +2318,7 @@ Superconductivity_AIEffect: Superconductivity_AISelectEffect: farcall AIFindTargetForPlayAreaAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Superconductivity_PlayerSelectEffect: @@ -2326,7 +2326,7 @@ Superconductivity_PlayerSelectEffect: ret Superconductivity_DamageArenaEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .bench farcall PreparePlayAreaAttackAgainstArena @@ -2340,7 +2340,7 @@ Superconductivity_DamageArenaEffect: ret Superconductivity_DamageBenchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; arena call SwapTurn @@ -2363,53 +2363,53 @@ Microwave_AIEffect: Microwave_AISelectEffect: farcall AIFindTargetForPlayAreaAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn call CreateArenaOrBenchEnergyCardList - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call SwapTurn ret c ; no energy cards ldtx de, IfHeadsDiscard1EnergyCardText farcall Serial_TossCoin - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret nc ; tails ; select energy card to discard call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call CreateArenaOrBenchEnergyCardList call SwapTurn ; simply select first card in list ld a, [wDuelTempList + 0] - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a ret Microwave_PlayerSelectEffect: farcall HandlePlayerSelectOppPlayAreaPkmn call SwapTurn call CreateArenaOrBenchEnergyCardList - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call SwapTurn ret c ; no energy cards ldtx de, IfHeadsDiscard1EnergyCardText farcall Serial_TossCoin - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret nc ; tails ; select energy card to discard call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] bank1call DisplayEnergyDiscardMenu .loop bank1call HandleAttachedEnergyMenuInput jr c, .loop ; mandatory selection call SwapTurn ldh a, [hTempCardIndex_ff98] - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a ret Microwave_ArenaDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .bench farcall PreparePlayAreaAttackAgainstArena @@ -2423,31 +2423,31 @@ Microwave_ArenaDamageEffect: ret Microwave_BenchDamageAndDiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr z, .arena call SwapTurn ld a, ATK_ANIM_THUNDER_WAVE_BENCH ld [wLoadedAttackAnimation], a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld b, a ld de, 20 call DealDamageToPlayAreaPokemon call SwapTurn .arena - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a ret z ; no energy to discard call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect jr c, .skip_discard - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] call DiscardCard .skip_discard call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT @@ -2549,25 +2549,25 @@ MatchPunch_InitialEffect: MatchPunch_AISelectEffect: xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a farcall CheckNonTurnDuelistHasBench ret c ; no bench ldtx de, IfHeads10DamageToBenchText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails farcall AIFindTargetForBenchAttack - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret MatchPunch_PlayerSelectEffect: xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a farcall CheckNonTurnDuelistHasBench ret c ; no bench ldtx de, IfHeads10DamageToBenchText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails ldtx hl, ChooseBenchedPokemonToGiveDamageText call DrawWideTextBox_WaitForInput @@ -2579,15 +2579,15 @@ MatchPunch_PlayerSelectEffect: bank1call OpenPlayAreaScreenForSelection jr c, .loop ; mandatory selection .got_selection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call SwapTurn ret MatchPunch_DamageBenchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] cp $ff ret z call SwapTurn @@ -2617,7 +2617,7 @@ Fossilize_CheckUse: Fossilize_PlayerSelectEffect: ld a, $ff - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ldtx de, FossilizeCheckText farcall Serial_TossCoin jr c, .successful @@ -2641,18 +2641,18 @@ Fossilize_PlayerSelectEffect: call CheckIfCardIsFossilPokemon jr c, .loop_select ; not a valid target ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a or a ret Fossilize_DevolveEffect: farcall SetUsedPkmnPowerThisTurnFlag - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] cp $ff ret z ; didn't choose any target ; devolve this card in Play Area - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldh [hTempPlayAreaLocation_ff9d], a add DUELVARS_ARENA_CARD get_turn_duelist_var @@ -2674,14 +2674,14 @@ Fossilize_DevolveEffect: .devolved farcall ResetDevolvedCardStatus - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call PrintPlayAreaCardKnockedOutIfNoHP farcall IsPlayerTurn jr c, .skip_show_changes ; show changes to player xor a ld [wDuelDisplayedScreen], a - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] farcall DrawPlayAreaScreenToShowChanges .skip_show_changes bank1call HandleDestinyBondAndBetweenTurnKnockOuts @@ -2731,14 +2731,14 @@ RagingThunder_InitialEffect: RagingThunder_AISelectEffect: ldtx de, IfTails30DamageTo1OfYourPokemonText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret c ; heads ; this is incorrect, if AI doesn't have bench then - ; it will output whatever value is in hTempPlayAreaLocation_ffa1 already + ; it will output whatever value is in hDuelActionArgs + 1 already ; seems like they wanted to output PLAY_AREA_ARENA here instead xor a - ldh [hTemp_ffa0], a ; bug, should be ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 0], a ; bug, should be ldh [hDuelActionArgs + 1], a farcall CheckIfTurnDuelistHasBench ret c ; no bench @@ -2761,13 +2761,13 @@ RagingThunder_AISelectEffect: jr nz, .loop_bench ; e has the bench location with highest remaining HP ld a, e - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret RagingThunder_PlayerSelectEffect: ldtx de, IfTails30DamageTo1OfYourPokemonText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret c ; heads ; player has to choose a card in play area to damage @@ -2777,17 +2777,17 @@ RagingThunder_PlayerSelectEffect: .loop bank1call OpenPlayAreaScreenForSelection jr c, .loop ; mandatory selection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret RagingThunder_DamageOwnPlayAreaEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; got heads ; deal 30 damage to selected target farcall SetIsDamageToSelf - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld b, a ld de, 30 call DealDamageToPlayAreaPokemon_RegularAnim @@ -2802,14 +2802,14 @@ ThunderCrash_AIEffect: ThunderCrash_DamageBoostOrRecoilEffect: ldtx de, Plus20DamageIfHeads20DamageToYourselfIfTailsText farcall TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails, will recoil instead ld a, 20 farcall AddToDamage ret ThunderCrash_RecoilEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; got heads ld a, 20 @@ -2856,7 +2856,7 @@ DryUp_PlayerSelectPlayAreaPkmnEffect: bank1call HasAlivePokemonInPlayArea .loop_select bank1call OpenPlayAreaScreenForSelection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr c, .got_selection call GetNumberOfWaterEnergiesAttachedToPlayAreaCard or a @@ -2899,32 +2899,32 @@ MirrorMoveDryUpCheck: ; Mirror Move Dry Up is forced to select Arena card as target MirrorMoveDryUpSelectArenaCard: xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret HandleDryUpPlayerSelection: call SwapTurn ld a, 1 ldh [hCurSelectionItem], a - ldh a, [hTemp_ffa0] ; selected play area card + ldh a, [hDuelActionArgs + 0] ; selected play area card call GetNumberOfWaterEnergiesAttachedToPlayAreaCard call SwapTurn - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a call TossCoinsUntilTails - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a or a jr z, .no_heads ; got at least 1 heads call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] bank1call DisplayEnergyDiscardMenu ; can only select up to the number of Water/Rainbow cards ; that are attached to target - ldh a, [hTempPlayAreaLocation_ffa1] - ld hl, hPlayAreaEffectTarget + ldh a, [hDuelActionArgs + 1] + ld hl, hDuelActionArgs + 2 cp [hl] jr c, .got_num_to_select ld a, [hl] @@ -3012,16 +3012,16 @@ AISelectTargetForDryUp: .got_target call SwapTurn ld a, e - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret AISelectEnergiesForDryUp: call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call GetNumberOfWaterEnergiesAttachedToPlayAreaCard call SwapTurn call TossCoinsUntilTails - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ; cap num of energies to discard to 13 cp 14 @@ -3049,7 +3049,7 @@ AISelectEnergiesForDryUp: ret DryUpProcessArenaEffects: - ldh a, [hTemp_ffa0] ; target chosen + ldh a, [hDuelActionArgs + 0] ; target chosen or a ret nz ; is in bench ; was there any energy cards chosen? @@ -3072,7 +3072,7 @@ DiscardDryUpEnergies: cp $ff jr z, .none_chosen call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect jr c, .done ; unaffected @@ -3089,7 +3089,7 @@ DiscardDryUpEnergies: .none_chosen call SwapTurn .show_changes - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] farcall DrawPlayAreaScreenToShowChanges .done call SwapTurn @@ -3253,13 +3253,13 @@ RollingNeedle_MultiplierEffect: ldtx de, Plus10DamageToOppAndYourselfForEachHeadsText ld a, 3 farcall TossCoinATimes_Bank1a - ldh [hTemp_ffa0], a ; save num of heads + ldh [hDuelActionArgs + 0], a ; save num of heads call ATimes10 farcall AddToDamage ret RollingNeedle_RecoilEffect: - ldh a, [hTemp_ffa0] ; num of heads + ldh a, [hDuelActionArgs + 0] ; num of heads call ATimes10 call DealRecoilDamageToSelf ret @@ -3322,7 +3322,7 @@ SwiftLunge_AIEffect: SwiftLunge_NoDamage50PercentEffect: ldtx de, IfTailsNoDamageToOppAnd20ToYourselfText farcall TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret c ; heads xor a ; ATK_ANIM_NONE ld [wLoadedAttackAnimation], a @@ -3331,7 +3331,7 @@ SwiftLunge_NoDamage50PercentEffect: ret SwiftLunge_RecoilEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; got heads ld a, 20 @@ -3340,7 +3340,7 @@ SwiftLunge_RecoilEffect: FoxFire_AISelectEffect: farcall AIFindTargetForPlayAreaAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret FoxFire_PlayerSelectEffect: @@ -3355,12 +3355,12 @@ FoxFire_PlayerSelectEffect: ; don't switch xor a .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn ret FoxFire_SwitchAndDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .chose_bench_card ; just attack Arena card normally @@ -3370,7 +3370,7 @@ FoxFire_SwitchAndDamageEffect: xor a ld [wNoDamageOrEffect], a call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect jr nc, .affected @@ -3412,7 +3412,7 @@ Disable_CheckAttacks: Disable_AISelectEffect: ldtx de, AttackSuccessCheckText farcall Serial_TossCoin - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret nc farcall AIPickAttackForAmnesia ret @@ -3420,7 +3420,7 @@ Disable_AISelectEffect: Disable_PlayerSelectEffect: ldtx de, AttackSuccessCheckText farcall Serial_TossCoin - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret nc ; was tails .select_atk farcall PlayerPickAttackForAmnesia @@ -3428,7 +3428,7 @@ Disable_PlayerSelectEffect: ret Disable_DisableEffect: - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a jr z, .unsuccessful ld a, SUBSTATUS2_DISABLE @@ -3460,7 +3460,7 @@ ErrandRunning_DeckCheck: ErrandRunning_PlayerSelectEffect: ldtx de, AttackSuccessCheckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails call CreateDeckCardList ldtx hl, ChooseATrainerCardFromDeckText @@ -3472,13 +3472,13 @@ ErrandRunning_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret ErrandRunning_AISelectEffect: ldtx de, AttackSuccessCheckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails ld a, CARDSEARCH_TRAINER farcall SetCardSearchFuncParams @@ -3486,7 +3486,7 @@ ErrandRunning_AISelectEffect: ld hl, wDuelTempList .loop ld a, [hli] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a cp $ff ret z farcall ExecuteCardSearchFunc @@ -3494,7 +3494,7 @@ ErrandRunning_AISelectEffect: ret ErrandRunning_SetAnimationEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; was heads xor a ; ATK_ANIM_NONE @@ -3502,10 +3502,10 @@ ErrandRunning_SetAnimationEffect: ret ErrandRunning_AddToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; got tails - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] cp $ff jr z, .finish call SearchCardInDeckAndAddToHand @@ -3513,7 +3513,7 @@ ErrandRunning_AddToHandEffect: farcall IsPlayerTurn jr c, .finish ; show to the player - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldtx hl, WasPlacedInTheHandText bank1call DisplayCardDetailScreen .finish @@ -3533,7 +3533,7 @@ GrowlitheLv16Ember_AISelectEffect: ret GrowlitheLv16Ember_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -3676,10 +3676,10 @@ FocusBlast_AIEffect: FocusBlast_PlayerSelectEffect: xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ldtx de, IfHeads20DamageTo1OfOppPokemonText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails ldtx hl, ChoosePokemonToGiveDamageText call DrawWideTextBox_WaitForInput @@ -3689,17 +3689,17 @@ FocusBlast_PlayerSelectEffect: bank1call OpenPlayAreaScreenForSelection jr c, .select_pkmn ; mandatory selection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call SwapTurn ret FocusBlast_AISelectEffect: ldtx de, IfHeads20DamageTo1OfOppPokemonText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails farcall AIFindTargetForPlayAreaAttack - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret FocusBlast_ClearAnimationEffect: @@ -3708,11 +3708,11 @@ FocusBlast_ClearAnimationEffect: ret FocusBlast_DealDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; got tails ld e, ATK_ANIM_FOCUS_BLAST - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a jr z, .got_anim ld e, ATK_ANIM_FOCUS_BLAST_BENCH @@ -3720,17 +3720,17 @@ FocusBlast_DealDamageEffect: ld a, e ld [wLoadedAttackAnimation], a - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a jr nz, .bench ld hl, wLoadedAttackCategory res RESIDUAL_F, [hl] .bench - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call SwapTurn bank1call LoadPlayAreaCardID_ToTempNonTurnDuelistCardID call SwapTurn - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld c, a ld b, 0 ld de, 20 @@ -3777,11 +3777,11 @@ SeethingAnger_DamageBoostEffect: MachampFling_CheckBench: farcall HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret MachampFling_SwitchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] farcall HandleSwitchDefendingPokemonEffect ret @@ -3855,31 +3855,31 @@ Dissolve_ArenaEnergyCheck: Dissolve_PlayerSelectEffect: xor a - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a farcall CreateNonTurnDuelistArenaEnergyCardList ret c ; no energies ldtx de, IfHeadsDiscard1EnergyCardFromOpponentText farcall Serial_TossCoin - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret nc ; got tails farcall HandleDiscardEnergyFromDefendingCardPlayerSelection ret Dissolve_AISelectEffect: xor a - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a farcall CreateNonTurnDuelistArenaEnergyCardList ret c ; no energies ldtx de, IfHeadsDiscard1EnergyCardFromOpponentText farcall Serial_TossCoin - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret nc ; got tails farcall _AIPickEnergyCardToDiscardFromDefendingPokemon - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Dissolve_DiscardEnergyEffect: - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a ret z ; got tails or no energy to discard farcall DiscardEnergyEffect @@ -3891,7 +3891,7 @@ BoulderSmash_InitialEffect: BoulderSmash_PlayerSelectEffect: xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a farcall CheckNonTurnDuelistHasBench ret c ; no bench ; flip 2 coins, for each heads @@ -3904,7 +3904,7 @@ BoulderSmash_PlayerSelectEffect: BoulderSmash_AISelectEffect: xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a farcall CheckNonTurnDuelistHasBench ret c ; no bench ldtx de, ForEachHeads10DamageToBenchInAnyWayYouLikeText @@ -3914,7 +3914,7 @@ BoulderSmash_AISelectEffect: ret BoulderSmash_BenchDamageEffect: - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld a, [hli] or a ret z ; no selections @@ -3948,7 +3948,7 @@ BoulderSmash_BenchDamageEffect: ; input: ; - a = number of selections that can be chosen BenchMultiSelectMenuPlayerSelection: - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret z ; can't choose any @@ -3959,7 +3959,7 @@ BenchMultiSelectMenuPlayerSelection: jr nc, .has_bench ; no bench, output 0 xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .has_bench @@ -4018,7 +4018,7 @@ BenchMultiSelectMenuPlayerSelection: ld hl, wPlayAreaMultiSelectMenuNumSelections inc [hl] ; is it equal to total selections allowed? - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp [hl] jr nz, .select_loop ; done all allowable selections @@ -4090,7 +4090,7 @@ BenchMultiSelectMenuParameters: menu_params 0, 3, 3, MAX_PLAY_AREA_POKEMON, SYM_CURSOR_R, SYM_SPACE, NULL BenchMultiSelectMenuAISelection: - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret z ; can't choose any @@ -4101,12 +4101,12 @@ BenchMultiSelectMenuAISelection: jr nc, .has_bench ; no bench, output 0 xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .has_bench ld c, 1 - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp 1 jr z, .only_1_selection farcall CheckNonTurnDuelistHasBench @@ -4181,7 +4181,7 @@ RockBlast_EnergiesCheck: RockBlast_AISelectEffect: ; don't select any cards to discard xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret RockBlast_PlayerSelectEffect: @@ -4232,7 +4232,7 @@ RockBlast_PlayerSelectEffect: ldh a, [hCurSelectionItem] sub 2 - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr z, .got_play_area_selection call SwapTurn @@ -4281,7 +4281,7 @@ RockBlast_PlayerSelectEffect: ld hl, wPlayAreaMultiSelectMenuNumSelections inc [hl] ; is it equal to total selections allowed? - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp [hl] jr nz, .select_loop ; done all allowable selections @@ -4303,7 +4303,7 @@ RockBlast_PlayerSelectEffect: .got_play_area_selection ; wPlayAreaList list holds number of times each ; bench Pokémon was chosen - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a ld d, $00 ld hl, hTempList + 2 @@ -4319,7 +4319,7 @@ RockBlast_PlayerSelectEffect: ret RockBlast_DiscardEnergiesAndDamageArenaEffect: - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld a, [hli] or a jr nz, .loop_discard @@ -4354,7 +4354,7 @@ RockBlast_DiscardEnergiesAndDamageArenaEffect: ret RockBlast_DamageBenchEffect: - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld a, [hli] or a ret z ; no cards discarded @@ -4440,18 +4440,18 @@ Fireworks_AIEffect: Fireworks_AISelectEffect: ldtx de, IfTailsDiscard1EnergyCardFromYourselfText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret c ; got heads xor a ; PLAY_AREA_ARENA call CreateArenaOrBenchEnergyCardList ld a, [wDuelTempList + 0] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret Fireworks_PlayerSelectEffect: ldtx de, IfTailsDiscard1EnergyCardFromYourselfText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr c, .heads ; got tails, needs to discard a fire energy @@ -4466,16 +4466,16 @@ Fireworks_PlayerSelectEffect: jr c, .select ; mandatory selection ldh a, [hTempCardIndex_ff98] .got_selection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a .heads or a ret Fireworks_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; got heads - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] cp $ff ret z ; selected a card call DiscardCard @@ -4606,7 +4606,7 @@ PowerOfDarkness_InitialEffect: PowerOfDarkness_PlayerSelectEffect: ldtx de, PowerOfDarknessCheckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails ldtx hl, ChoosePokemonToReturnToHandText call DrawWideTextBox_WaitForInput @@ -4616,18 +4616,18 @@ PowerOfDarkness_PlayerSelectEffect: bank1call OpenPlayAreaScreenForSelection jr c, .select ; mandatory selection call SwapTurn - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret PowerOfDarkness_ReturnToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; got tails ; add to hand all cards that are in ; the chosen Play Area location call SwapTurn - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or CARD_LOCATION_PLAY_AREA ld b, a ld a, DUELVARS_CARD_LOCATIONS @@ -4644,7 +4644,7 @@ PowerOfDarkness_ReturnToHandEffect: cp DECK_SIZE jr c, .loop_add_to_hand - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] add DUELVARS_ARENA_CARD ld l, a ld a, [hl] @@ -4652,7 +4652,7 @@ PowerOfDarkness_ReturnToHandEffect: ; indicate empty play area location ld [hl], $ff ; zero out its HP - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] add DUELVARS_ARENA_CARD_HP ld l, a ld [hl], $00 @@ -4708,13 +4708,13 @@ SaltWater_DeckCheck: SaltWater_AIEffect: ; this selection is handled in AISelectSpecialAttackParameters xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret SaltWater_PlayerSelectEffect: ldtx de, IfHeadsAttachUpTo3WaterEnergyFromDeckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails ; was heads @@ -4757,7 +4757,7 @@ SaltWater_PlayerSelectEffect: ret SaltWater_ClearAnimationIfFailed: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; was heads ; a = ATK_ANIM_NONE @@ -4765,7 +4765,7 @@ SaltWater_ClearAnimationIfFailed: ret SaltWater_AttachToArenaEffect: - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld a, [hli] or a ret z ; was tails @@ -4806,20 +4806,20 @@ BoneToss_AIEffect: BoneToss_AISelectEffect: ldtx de, IfHeads30DamageToOppIfTails10DamageToBenchText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret c ; heads ; tails, choose a Bench pkmn to damage farcall CheckNonTurnDuelistHasBench jr c, SetUnsuccessfulBoneToss farcall AIFindTargetForBenchAttack - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret BoneToss_PlayerSelectEffect: ldtx de, IfHeads30DamageToOppIfTails10DamageToBenchText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret c ; heads ; tails, choose a Bench pkmn to damage @@ -4832,18 +4832,18 @@ BoneToss_PlayerSelectEffect: .select bank1call OpenPlayAreaScreenForSelection jr c, .select ; mandatory selection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a call SwapTurn ret SetUnsuccessfulBoneToss: xor a - ldh [hTemp_ffa0], a - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 0], a + ldh [hDuelActionArgs + 1], a ret BoneToss_ArenaDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr z, .set_atk_anim_none ; attack Arena card @@ -4856,10 +4856,10 @@ BoneToss_ArenaDamageEffect: ret BoneToss_BenchDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; got heads - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a ret z ; no selection @@ -4996,7 +4996,7 @@ WaterBomb_AISelectEffect: ret WaterBomb_BenchDamageEffect: - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld a, [hli] or a ret z ; no damage to bench @@ -5053,7 +5053,7 @@ BurningFire_AIEffect: BurningFire_AISelectEffect: ; this selection is handled in AISelectSpecialAttackParameters ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret BurningFire_PlayerSelectEffect: @@ -5130,7 +5130,7 @@ BurningFire_PlayerSelectEffect: ret BurningFire_DiscardAndMultiplierEffect: - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld c, 0 ; energy discarded tally .loop_discard ld a, [hli] @@ -5160,15 +5160,15 @@ KickingAndStamping_Switch50PercentEffect: ; AI flips a coin, if tails, defending card is forced to switch ldtx de, KickingAndStampingCheckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret c ; tails, will do more damage farcall HandleMandatorySwitchSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret KickingAndStamping_DamageBoostEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; was tails, no damage boost ld a, 10 @@ -5176,10 +5176,10 @@ KickingAndStamping_DamageBoostEffect: ret KickingAndStamping_SwitchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret nz ; was heads, no switching - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] farcall HandleSwitchDefendingPokemonEffect ret @@ -5236,17 +5236,17 @@ TentacleGrip_FlipCoinsEffect: ; a = num of Water energies attached to Arena card ldtx de, DrawCardForEachHeadsText farcall TossCoinATimes_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret TentacleGrip_DrawEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; no heads add a ; * 2 ; a = num of cards to draw farcall DisplayDrawNCardsScreen - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add a ld c, a .loop_draw @@ -5342,12 +5342,12 @@ PsychoBlast_InitialEffect: PsychoBlast_PlayerSelectEffect: xor a - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a farcall CreateNonTurnDuelistArenaEnergyCardList ret c ; arena has no energy attached ldtx de, IfHeadsDiscard1EnergyCardFromOpponentText farcall Serial_TossCoin - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret nc ; tails ; discard an energy from Defending card farcall HandleDiscardEnergyFromDefendingCardPlayerSelection @@ -5355,20 +5355,20 @@ PsychoBlast_PlayerSelectEffect: PsychoBlast_AISelectEffect: xor a - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a farcall CreateNonTurnDuelistArenaEnergyCardList ret c ; arena has no energy attached ldtx de, IfHeadsDiscard1EnergyCardFromOpponentText farcall Serial_TossCoin - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret nc ; tails ; discard an energy from Defending card farcall _AIPickEnergyCardToDiscardFromDefendingPokemon - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret PsychoBlast_DiscardEffect: - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a ret z ; no discard farcall DiscardEnergyEffect @@ -5400,26 +5400,26 @@ ClearProfit_DeckCheck: ClearProfit_FlipCoinUntilTailsEffect: xor a ; num of heads - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a .loop_coin_toss ldtx de, ClearProfitCheckText xor a farcall TossCoinATimes_Bank1a jr nc, .done ; tails ; heads, increment tally - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 inc [hl] jr .loop_coin_toss .done ret ClearProfit_DrawEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; no heads ; a = num of cards to draw farcall DisplayDrawNCardsScreen - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld c, a .loop_draw call DrawCardFromDeck @@ -5445,14 +5445,14 @@ TextureMagic_ResistanceCheck: TextureMagic_AISelectEffect: ; this is handled in AISelectSpecialAttackParameters ld a, $ff - ldh [hTemp_ffa0], a - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 0], a + ldh [hDuelActionArgs + 1], a ret TextureMagic_PlayerSelectEffect: ; assume Defending card has no weakness ld a, $ff - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a farcall CheckIfDefendingCardHasWeakness jr nc, .has_weakness ; no weakness, skip @@ -5461,24 +5461,24 @@ TextureMagic_PlayerSelectEffect: jr .handle_selection_of_resistance .has_weakness farcall HandleConversion1PlayerSelection - ldh a, [hTemp_ffa0] - ldh [hTempPlayAreaLocation_ffa1], a + ldh a, [hDuelActionArgs + 0] + ldh [hDuelActionArgs + 1], a .handle_selection_of_resistance farcall HandleConversion2PlayerSelection ret TextureMagic_ChangeWeaknessAndResistanceEffect: - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] cp $ff jr z, .skip_change_weakness - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] push af - ldh a, [hTempPlayAreaLocation_ffa1] - ldh [hTemp_ffa0], a + ldh a, [hDuelActionArgs + 1] + ldh [hDuelActionArgs + 0], a farcall ChangeDefendingCardsWeakness call WaitForWideTextBoxInput pop af - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a .skip_change_weakness farcall ChangeAttackingCardsResistance ret @@ -5542,13 +5542,13 @@ Rollout_AIEffect: Rollout_AISelectEffect: ; this is handled in AISelectSpecialAttackParameters xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Rollout_PlayerSelectEffect: ld a, DUELVARS_ARENA_CARD_FOOD_COUNTERS get_turn_duelist_var - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret z ; has 0 counters, nothing to do inc a @@ -5600,7 +5600,7 @@ Rollout_PlayerSelectEffect: cp $ff jr z, .cancelled ; got choice - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret .cancelled @@ -5609,7 +5609,7 @@ Rollout_PlayerSelectEffect: Rollout_RemoveCountersAndDamageBoostEffect: ; decrease num food counters selected - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a ld a, DUELVARS_ARENA_CARD_FOOD_COUNTERS get_turn_duelist_var @@ -5661,13 +5661,13 @@ EnergyControl_EnergyCheck: EnergyControl_AISelectEffect: ; this is handled in AISelectSpecialAttackParameters xor a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret EnergyControl_PlayerSelectEffect: ldtx de, AttackSuccessCheckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a jr c, .successful ; unsuccessful farcall SetWasUnsuccessful @@ -5690,13 +5690,13 @@ EnergyControl_PlayerSelectEffect: jr c, .select_play_area_1 ; no energy cards ; has basic energy cards, select energy card ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld e, a bank1call DisplayEnergyDiscardMenu bank1call HandleAttachedEnergyMenuInput jr c, .start_selection ldh a, [hTempCardIndex_ff98] - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ; got selection of donor of energy card, ; now select receiver of this energy @@ -5707,30 +5707,30 @@ EnergyControl_PlayerSelectEffect: bank1call OpenPlayAreaScreenForSelection jr c, .select_play_area_2 ; mandatory selection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hAIEnergyTransPlayAreaLocation], a + ldh [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA], a call SwapTurn ret EnergyControl_SwitchEnergyEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; none chosen call SwapTurn - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect jr c, .done - ldh a, [hAIEnergyTransPlayAreaLocation] + ldh a, [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect jr c, .done - ldh a, [hAIEnergyTransPlayAreaLocation] + ldh a, [hDuelActionArgs + ENERGYTRANS_ARGS_TO_PLAY_AREA] ld e, a - ldh a, [hTempRetreatCostCards] + ldh a, [hDuelActionArgs + RETREAT_ARGS_COST_LIST] call AddCardToHand call PutHandCardInPlayArea - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a jr nz, .done ld a, DUELVARS_ARENA_CARD_LAST_TURN_EFFECT @@ -5751,11 +5751,11 @@ Telekinesis_PlayerSelectEffect: Telekinesis_AISelectEffect: farcall AIFindTargetForPlayAreaAttack - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Telekinesis_ArenaDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .bench ; arena @@ -5770,7 +5770,7 @@ Telekinesis_ArenaDamageEffect: ret Telekinesis_BenchDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; arena @@ -5799,7 +5799,7 @@ Recharge_PlayerSelectEffect: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Recharge_AISelectEffect: @@ -5809,7 +5809,7 @@ Recharge_AISelectEffect: ld hl, wDuelTempList .loop ld a, [hli] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a cp $ff ret z farcall ExecuteCardSearchFunc @@ -5817,7 +5817,7 @@ Recharge_AISelectEffect: ret Recharge_AttachFromDeckEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .finish ; attach it from the deck @@ -6144,7 +6144,7 @@ SpecialDelivery_UseAndDeckCheck: SpecialDelivery_PlayerSelectEffect: ; draw a card (temporarily) call DrawCardFromDeck - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ldh [hTempCardIndex_ff98], a call AddCardToHand bank1call DisplayPlayerDrawCardScreen @@ -6157,10 +6157,10 @@ SpecialDelivery_PlayerSelectEffect: .select_card bank1call DisplayCardList jr c, .select_card ; mandatory selection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ; return drawn card back to deck, it will be drawn in next step - ldh a, [hTempRetreatCostCards] + ldh a, [hDuelActionArgs + RETREAT_ARGS_COST_LIST] call RemoveCardFromHand call ReturnCardToDeck or a @@ -6174,7 +6174,7 @@ SpecialDelivery_DrawAndPlaceInDeckEffect: call AddCardToHand ; return selected card to deck - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call RemoveCardFromHand call ReturnCardToDeck ret @@ -6395,7 +6395,7 @@ GrowlitheLv12Ember_AISelectEffect: ret GrowlitheLv12Ember_DiscardEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard ret @@ -6413,7 +6413,7 @@ SuperScoopUp_PlayerSelection: ; toss coin to check if successful ldtx de, TrainerCardSuccessCheckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails ; print text box @@ -6426,7 +6426,7 @@ SuperScoopUp_PlayerSelection: bank1call OpenPlayAreaScreenForSelection jr c, .select_pkmn ; mandatory selection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a or a ret nz ; if it wasn't the Active Pokemon, we are done @@ -6436,20 +6436,20 @@ SuperScoopUp_PlayerSelection: call DrawWideTextBox_WaitForInput bank1call HasAlivePokemonInBench bank1call OpenPlayAreaScreenForSelection - ldh [hTempRetreatCostCards], a + ldh [hDuelActionArgs + RETREAT_ARGS_COST_LIST], a ret SuperScoopUp_ReturnToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; got tails ; store chosen card location to Scoop Up - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] add DUELVARS_ARENA_CARD get_turn_duelist_var ldh [hTempCardIndex_ff98], a - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or CARD_LOCATION_PLAY_AREA ld c, a @@ -6472,7 +6472,7 @@ SuperScoopUp_ReturnToHandEffect: ; since the card has been moved to hand, ; DiscardPlayAreaCard will take care ; of discarding every higher stage cards and other cards attached. - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a call DiscardPlayAreaCard @@ -6481,7 +6481,7 @@ SuperScoopUp_ReturnToHandEffect: farcall IsPlayerTurn jr c, .player_turn ldtx hl, PokemonWasReturnedFromArenaToHandText - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a jr z, .display_list ldtx hl, PokemonWasReturnedFromBenchToHandText @@ -6491,11 +6491,11 @@ SuperScoopUp_ReturnToHandEffect: .player_turn ; if the Pokemon was in the Arena, clear status - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] or a jr nz, .skip_clear_status call ClearAllStatusConditions - ldh a, [hTempRetreatCostCards] + ldh a, [hDuelActionArgs + RETREAT_ARGS_COST_LIST] ld d, a ld e, $00 call SwapPlayAreaPokemon @@ -6509,7 +6509,7 @@ BillsTeleporterEffect: ret nc ; got tails ; successful, remove Bill's Teleporter from hand - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call RemoveCardFromHand ; draw 4 cards @@ -6539,13 +6539,13 @@ DarknessVeilEffect: DarkSong_Sleep50PercentEffect: ldtx de, SleepInflictionCheckText farcall TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret nc ; tails farcall SleepEffect ret DarkSong_BenchDamageEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; got tails @@ -6582,11 +6582,11 @@ DarkSong_BenchDamageEffect: Bother_Success50PercentEffect: ldtx de, BotherCheckText farcall TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Bother_ReturnTrainerCardToDeckEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; got tails @@ -6716,14 +6716,14 @@ PushAside_Success50PercentEffect: ld [wLoadedAttackAnimation], a ldtx de, AttackSuccessCheckText farcall TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret c ; got tails ; set it as unsuccessful farcall SetWasUnsuccessful ret PushAside_ReturnToDeckEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; got tails @@ -6732,20 +6732,20 @@ PushAside_ReturnToDeckEffect: ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA get_turn_duelist_var call Random - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ldh [hTempPlayAreaLocation_ff9d], a ; play animation ld a, ATK_ANIM_PUSH_ASIDE farcall PlayAttackAnimationOverAttackingPokemon - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a bank1call HandlePlayAreaCardNoDamageOrEffect call SwapTurn ret c ; unaffected - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld e, a ld b, e ld a, e ; redundant load @@ -6803,7 +6803,7 @@ PushAside_ReturnToDeckEffect: Rebirth_UseCheck: ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a bank1call CheckIsIncapableOfUsingPkmnPower ret @@ -6877,14 +6877,14 @@ Rebirth_DiscardAndAddStaryuEffect: SpinningShower_Success50PercentEffect: ldtx de, AttackSuccessCheckText farcall TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret c ; heads xor a ; ATK_ANIM_NONE ld [wLoadedAttackAnimation], a ret SpinningShower_AttackRandomPlayAreaCardsEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; got tails @@ -7275,9 +7275,9 @@ SuperPotion_PlayerSelectEffect: ret c ; exit if B was pressed ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld e, a ; cap the healing damage if @@ -7289,16 +7289,16 @@ SuperPotion_PlayerSelectEffect: ld c, a .heal ld a, c - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a or a ret SuperPotion_HealEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call DiscardCard - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldh [hTempPlayAreaLocation_ff9d], a - ldh a, [hTempRetreatCostCards] + ldh a, [hDuelActionArgs + RETREAT_ARGS_COST_LIST] call HealPlayAreaPokemon ret @@ -7335,8 +7335,8 @@ CheckIfThereAreAnyEnergyCardsAttached: ; 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 +; [hDuelActionArgs + 0] = play area location +; [hDuelActionArgs + 1] = index of energy card HandlePokemonAndEnergySelectionScreen: .start bank1call HasAlivePokemonInPlayArea @@ -7358,9 +7358,9 @@ HandlePokemonAndEnergySelectionScreen: bank1call DisplayEnergyDiscardMenu bank1call HandleAttachedEnergyMenuInput ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ldh a, [hTempCardIndex_ff98] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret ImakuniEffect: @@ -7405,7 +7405,7 @@ EnergyRemoval_AISelection: EnergyRemoval_DiscardEffect: call SwapTurn - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call DiscardCard call SwapTurn call CallIfIsPlayerTurn @@ -7413,7 +7413,7 @@ EnergyRemoval_DiscardEffect: ; show Player which Pokemon was affected call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] farcall DrawPlayAreaScreenToShowChanges call SwapTurn ret @@ -7434,12 +7434,12 @@ EnergyRetrieval_PlayerHandSelection: ldtx hl, ChooseCardFromHandToDiscardText call DrawWideTextBox_WaitForInput call CreateHandCardList - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call RemoveCardFromDuelTempList bank1call InitAndDrawCardListScreenLayout_WithSelectCheckMenu bank1call DisplayCardList ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret EnergyRetrieval_PlayerDiscardPileSelection: @@ -7479,7 +7479,7 @@ EnergyRetrieval_PlayerDiscardPileSelection: ret EnergyRetrieval_DiscardAndAddToHandEffect: - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld a, [hli] call RemoveCardFromHand call PutCardInDiscardPile @@ -7519,11 +7519,11 @@ EnergySearch_PlayerSelection: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret EnergySearch_AddToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff jr z, .done ; add to hand @@ -7532,7 +7532,7 @@ EnergySearch_AddToHandEffect: call CallIfIsPlayerTurn jr c, .done ; done if Player played card ; display card in screen - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, WasPlacedInTheHandText bank1call DisplayCardDetailScreen .done @@ -7593,7 +7593,7 @@ Potion_PlayerSelection: bank1call OpenPlayAreaScreenForSelection ret c ; exit is B was pressed ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld e, a call GetCardDamageAndMaxHP or a @@ -7605,23 +7605,23 @@ Potion_PlayerSelection: ld c, a .skip_cap ld a, c - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a or a ret Potion_HealEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldh [hTempPlayAreaLocation_ff9d], a - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call HealPlayAreaPokemon ret GamblerEffect: ldtx de, GamblerQuantityCheckText farcall TossCoin_Bank1a - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; discard Gambler card from hand - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call RemoveCardFromHand call PutCardInDiscardPile @@ -7640,7 +7640,7 @@ GamblerEffect: .check_coin_toss call CallShuffleCardsInDeck ld c, 8 - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .draw_cards ; coin toss was heads? ; if tails, number of cards to draw is 1 @@ -7713,25 +7713,25 @@ Defender_PlayerSelection: bank1call HasAlivePokemonInPlayArea bank1call OpenPlayAreaScreenForSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Defender_AttachDefenderEffect: ; attach Trainer card to Play Area Pokemon - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call PutHandCardInPlayArea ; increase number of Defender cards of this location by 1 - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD_ATTACHED_DEFENDER get_turn_duelist_var inc [hl] call CallIfIsPlayerTurn ret c - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] farcall DrawPlayAreaScreenToShowChanges ret @@ -7740,7 +7740,7 @@ MysteriousFossil_BenchCheck: ret MysteriousFossil_PlaceInPlayAreaEffect: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call PutHandPokemonCardInPlayArea ret @@ -7847,7 +7847,7 @@ ClefairyDoll_BenchCheck: ret ClefairyDoll_PlaceInPlayAreaEffect: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call PutHandPokemonCardInPlayArea ret @@ -7861,12 +7861,12 @@ MrFuji_PlayerSelection: bank1call HasAlivePokemonInBench bank1call OpenPlayAreaScreenForSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret MrFuji_ReturnToDeckEffect: ; get Play Area location's card index - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] add DUELVARS_ARENA_CARD get_turn_duelist_var ldh [hTempCardIndex_ff98], a @@ -7874,7 +7874,7 @@ MrFuji_ReturnToDeckEffect: ; 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] + ldh a, [hDuelActionArgs + 0] or $10 ld e, a ld a, DUELVARS_CARD_LOCATIONS @@ -7896,7 +7896,7 @@ MrFuji_ReturnToDeckEffect: jr c, .loop_cards ; clear Play Area location of card - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call EmptyPlayAreaSlot ld l, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA @@ -7924,7 +7924,7 @@ MrFuji_ReturnToDeckEffect: PlusPowerEffect: ; attach Trainer card to Arena Pokemon ld e, PLAY_AREA_ARENA - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call PutHandCardInPlayArea ; increase number of Defender cards of this location by 1 @@ -7944,11 +7944,11 @@ Switch_PlayerSelection: bank1call HasAlivePokemonInBench bank1call OpenPlayAreaScreenForSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Switch_SwitchEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call SwapArenaWithBenchPokemon ret @@ -8039,13 +8039,13 @@ PokemonFlute_PlayerSelection: bank1call DisplayCardList call SwapTurn ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret PokemonFlute_PlaceInPlayAreaText: ; place selected card in non-Turn Duelist's Bench call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call MoveDiscardPileCardToHand call AddCardToHand call PutHandPokemonCardInPlayArea @@ -8056,7 +8056,7 @@ PokemonFlute_PlaceInPlayAreaText: call CallIfIsPlayerTurn ret c call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, CardWasChosenText bank1call DisplayCardDetailScreen call SwapTurn @@ -8085,7 +8085,7 @@ PokemonBreeder_PlayerSelection: ret c ; exit if B was pressed ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ldtx hl, ChooseBasicPokemonToEvolveText call DrawWideTextBox_WaitForInput @@ -8095,9 +8095,9 @@ PokemonBreeder_PlayerSelection: bank1call OpenPlayAreaScreenForSelection ret c ; exit if B was pressed ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ld e, a - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld d, a call CheckIfCanEvolveInto_BasicToStage2 jr c, .read_input ; loop back if cannot evolve this card @@ -8105,12 +8105,12 @@ PokemonBreeder_PlayerSelection: ret PokemonBreeder_EvolveEffect: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] push af - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld a, [hli] ldh [hTempCardIndex_ff98], a - ld a, [hl] ; hTempPlayAreaLocation_ffa1 + ld a, [hl] ; hDuelActionArgs + 1 ldh [hTempPlayAreaLocation_ff9d], a ; load the Basic Pokemon card name to RAM @@ -8146,7 +8146,7 @@ PokemonBreeder_EvolveEffect: ldtx hl, PokemonEvolvedIntoPokemonText call DrawWideTextBox_WaitForInput pop af - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ret ; creates list in wDuelTempList of all Stage2 Pokemon cards @@ -8242,7 +8242,7 @@ ScoopUp_PlayerSelection: bank1call OpenPlayAreaScreenForSelection ret c ; exit if B was pressed - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret nz ; if it wasn't the Active Pokemon, we are done @@ -8252,12 +8252,12 @@ ScoopUp_PlayerSelection: call DrawWideTextBox_WaitForInput bank1call HasAlivePokemonInBench bank1call OpenPlayAreaScreenForSelection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret ScoopUp_ReturnToHandEffect: ; store chosen card location to Scoop Up - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or CARD_LOCATION_PLAY_AREA ld e, a @@ -8294,12 +8294,12 @@ ScoopUp_ReturnToHandEffect: cp DECK_SIZE jr c, .loop - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call DiscardPlayAreaCard ; if the Pokemon was in the Arena, clear status - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr nz, .skip_clear_status call ClearAllStatusConditions @@ -8310,7 +8310,7 @@ ScoopUp_ReturnToHandEffect: call CallIfIsPlayerTurn jr c, .shift_or_switch ldtx hl, PokemonWasReturnedFromArenaToHandText - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr z, .asm_67231 ldtx hl, PokemonWasReturnedFromBenchToHandText @@ -8320,7 +8320,7 @@ ScoopUp_ReturnToHandEffect: .shift_or_switch ; if card was in Bench, simply shift Pokemon slots... - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a jr z, .switch call ShiftAllPokemonToFirstPlayAreaSlots @@ -8328,7 +8328,7 @@ ScoopUp_ReturnToHandEffect: .switch ; ...if Pokemon was in Arena, then switch it with the selected Bench card. - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ld d, a ld e, $00 call SwapPlayAreaPokemon @@ -8361,13 +8361,13 @@ PokemonTrader_PlayerHandSelection: ldtx de, DuelistHandText bank1call SetCardListHeaderAndInfoText bank1call DisplayCardList - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret PokemonTrader_PlayerDeckSelection: ; temporarily place chosen hand card in deck ; so it can be potentially chosen to be traded. - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call RemoveCardFromHand call ReturnCardToDeck @@ -8392,8 +8392,8 @@ PokemonTrader_PlayerDeckSelection: ; 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] + ldh [hDuelActionArgs + 1], a + ldh a, [hDuelActionArgs + 0] call SearchCardInDeckAndAddToHand call AddCardToHand or a @@ -8401,22 +8401,22 @@ PokemonTrader_PlayerDeckSelection: PokemonTrader_TradeCardsEffect: ; place hand card in deck - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call RemoveCardFromHand call ReturnCardToDeck ; place deck card in hand - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call SearchCardInDeckAndAddToHand call AddCardToHand ; display cards if the Pokemon Trader wasn't played by Player call CallIfIsPlayerTurn jr c, .done - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, PokemonWasReturnedToDeckText bank1call DisplayCardDetailScreen - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldtx hl, WasPlacedInTheHandText bank1call DisplayCardDetailScreen .done @@ -8578,7 +8578,7 @@ Pokedex_PlayerSelection: push bc ld c, a ld b, $00 - ld hl, hTempCardIndex_ff9f + ld hl, hDuelActionCardIndex add hl, bc ld a, [de] ld [hl], a @@ -8640,7 +8640,7 @@ Pokedex_OrderDeckCardsEffect: ret BillEffect: - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call RemoveCardFromHand ld a, 2 farcall DisplayDrawNCardsScreen @@ -8663,7 +8663,7 @@ BillEffect: LassEffect: ; first discard Lass card that was used - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call RemoveCardFromHand call PutCardInDiscardPile @@ -8764,10 +8764,10 @@ Maintenance_PlayerSelection: Maintenance_ReturnToDeckAndDrawEffect: ; return both selected cards to the deck - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call RemoveCardFromHand call ReturnCardToDeck - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] call RemoveCardFromHand call ReturnCardToDeck call CallShuffleCardsInDeck @@ -8791,7 +8791,7 @@ PokeBall_DeckCheck: PokeBall_PlayerSelection: ldtx de, TrainerCardSuccessCheckText farcall Serial_TossCoin - ldh [hTemp_ffa0], a ; store coin result + ldh [hDuelActionArgs + 0], a ; store coin result ret nc ; create list of all Pokemon cards in deck to search for @@ -8805,15 +8805,15 @@ PokeBall_PlayerSelection: ldtx de, DuelistDeckText farcall SelectCardSearchTarget .got_selection - ldh [hTempPlayAreaLocation_ffa1], a + ldh [hDuelActionArgs + 1], a ret PokeBall_AddToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] or a ret z ; return if coin toss was tails - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] cp $ff jr z, .done ; skip if no Pokemon was chosen @@ -8823,7 +8823,7 @@ PokeBall_AddToHandEffect: call AddCardToHand call CallIfIsPlayerTurn jr c, .done - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] ldtx hl, WasPlacedInTheHandText bank1call DisplayCardDetailScreen .done @@ -8858,17 +8858,17 @@ Recycle_PlayerSelection: ; Discard Pile card was chosen ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret .tails ld a, $ff - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a or a ret Recycle_AddToHandEffect: - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] cp $ff ret z ; return if no card was selected @@ -8878,7 +8878,7 @@ Recycle_AddToHandEffect: call ReturnCardToDeck call CallIfIsPlayerTurn ret c - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, CardWasChosenText bank1call DisplayCardDetailScreen ret @@ -8906,12 +8906,12 @@ Revive_PlayerSelection: ; store selection ldh a, [hTempCardIndex_ff98] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Revive_PlaceInPlayAreaEffect: ; place selected Pokemon in the Bench - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call MoveDiscardPileCardToHand call AddCardToHand call PutHandPokemonCardInPlayArea @@ -8929,7 +8929,7 @@ Revive_PlaceInPlayAreaEffect: ret c ; done if Player played Revive ; display card - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ldtx hl, PlacedOnBenchText bank1call DisplayCardDetailScreen ret @@ -9015,7 +9015,7 @@ DevolutionSpray_PlayerSelection: ; store this Play Area location in first item of temp list ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ; update Play Area location display of this Pokemon call EmptyScreen @@ -9077,7 +9077,7 @@ DevolutionSpray_DevolutionEffect: pop hl ld d, [hl] farcall PrintDevolvedCardNameAndLevelText - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] call PrintPlayAreaCardKnockedOutIfNoHP bank1call HandleDestinyBondAndBetweenTurnKnockOuts ret @@ -9127,7 +9127,7 @@ SuperEnergyRemoval_PlayerSelection: .has_energy ; store this Pokemon's Play Area location ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hPlayAreaEffectTarget], a + ldh [hDuelActionArgs + 2], a ; store which energy card to discard from it bank1call CreateArenaOrBenchEnergyCardList ldh a, [hTempPlayAreaLocation_ff9d] @@ -9201,13 +9201,13 @@ SuperEnergyRemoval_DiscardEffect: ret c ; ...otherwise show Play Area of affected Pokemon ; in opponent's Play Area - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] farcall DrawPlayAreaScreenToShowChanges ; in player's Play Area xor a ld [wDuelDisplayedScreen], a call SwapTurn - ldh a, [hPlayAreaEffectTarget] + ldh a, [hDuelActionArgs + 2] farcall DrawPlayAreaScreenToShowChanges call SwapTurn ret @@ -9269,7 +9269,7 @@ SuperEnergyRetrieval_PlayerDiscardPileSelection: SuperEnergyRetrieval_DiscardAndAddToHandEffect: ; discard 2 cards selected from the hand - ld hl, hTemp_ffa0 + ld hl, hDuelActionArgs + 0 ld a, [hli] call RemoveCardFromHand call PutCardInDiscardPile @@ -9307,7 +9307,7 @@ HandlePlayerSelection2HandCardsToDiscard: ; 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]. +; assumes Trainer card index being used is in [hDuelActionCardIndex]. ; stores selection of cards in hTempList. ; returns carry if Player cancels operation. ; input: @@ -9320,7 +9320,7 @@ HandlePlayerSelection2HandCards: ; remove the Trainer card being used from list ; of cards to select from hand. call CreateHandCardList - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] call RemoveCardFromDuelTempList xor a @@ -9362,7 +9362,7 @@ GustOfWind_PlayerSelection: bank1call HasAlivePokemonInBench bank1call OpenPlayAreaScreenForSelection ldh a, [hTempPlayAreaLocation_ff9d] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a call SwapTurn ret @@ -9373,7 +9373,7 @@ GustOfWind_SwitchEffect: ; switch Arena card call SwapTurn - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] ld e, a call SwapArenaWithBenchPokemon call SwapTurn diff --git a/src/engine/duel/special_attacks.asm b/src/engine/duel/special_attacks.asm index 2dac32f..9f6c680 100644 --- a/src/engine/duel/special_attacks.asm +++ b/src/engine/duel/special_attacks.asm @@ -1537,7 +1537,7 @@ HandleSpecialAIAttacks: jr nc, .is_cool_porygon_already_resistant call AISelectSpecialAttackParameters.SelectAttackParameters - ldh a, [hTempPlayAreaLocation_ffa1] + ldh a, [hDuelActionArgs + 1] cp $ff jr z, .is_cool_porygon_already_resistant call TranslateColorToWR diff --git a/src/home/ai.asm b/src/home/ai.asm index a9fb1f4..f301009 100644 --- a/src/home/ai.asm +++ b/src/home/ai.asm @@ -80,7 +80,7 @@ AIDoAction_ForcedSwitch:: AIDoAction_KOSwitch:: ld a, AIACTION_KO_SWITCH call AIDoAction - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret AIDoAction_TakePrize:: @@ -119,7 +119,7 @@ AIAcceptOrDeclineChallenge:: ; AI always declines challenge, which ; corresponds to an output of TRUE ld a, TRUE - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret ; looks like scrapped code to select Pokémon in the deck for AI diff --git a/src/home/duel.asm b/src/home/duel.asm index 3e51ad0..be368ec 100644 --- a/src/home/duel.asm +++ b/src/home/duel.asm @@ -1231,7 +1231,7 @@ GetNonTurnDuelistVariable:: ret ; copies, given a card identified by register hl (card ID): -; - e into wSelectedAttack and d into hTempCardIndex_ff9f +; - e into wSelectedAttack and d into hDuelActionCardIndex ; - Attack1 (if e == 0) or Attack2 (if e == 1) data into wLoadedAttack ; - Also from that attack, its Damage field into wDamage ; finally, clears wNoDamageOrEffect and wDealtDamage @@ -1241,14 +1241,14 @@ CopyAttackDataAndDamage_FromCardID:: ld a, e ld [wSelectedAttack], a ld a, d - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a pop de call LoadCardDataToBuffer1_FromCardID pop de jr CopyAttackDataAndDamage ; copies, given a card identified by register d (0-59 deck index): -; - e into wSelectedAttack and d into hTempCardIndex_ff9f +; - e into wSelectedAttack and d into hDuelActionCardIndex ; - Attack1 (if e == 0) or Attack2 (if e == 1) data into wLoadedAttack ; - Also from that attack, its Damage field into wDamage ; finally, clears wNoDamageOrEffect and wDealtDamage @@ -1256,7 +1256,7 @@ CopyAttackDataAndDamage_FromDeckIndex:: ld a, e ld [wSelectedAttack], a ld a, d - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a call LoadCardDataToBuffer1_FromDeckIndex ; fallthrough @@ -1292,7 +1292,7 @@ CopyAttackDataAndDamage: UpdateTempDuelistCardIDsAndClearTwoTurnDuelVars:: ld a, DUELVARS_ARENA_CARD get_turn_duelist_var - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a call UpdateTempDuelistCardIDs call ClearTwoTurnDuelVars ret @@ -1336,7 +1336,7 @@ ClearTwoTurnDuelVars:: UseAttackOrPokemonPower:: ld a, [wSelectedAttack] ld [wPlayerAttackingAttackIndex], a - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] ld [wPlayerAttackingCardIndex], a ld a, [wTempCardID_ccc2] ld [wPlayerAttackingCardID], a @@ -1371,7 +1371,7 @@ UseAttackOrPokemonPower:: ; if we're here then it means that the Metronome attack ; does not have its requirements met to be used ld a, $ff - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, OPPACTION_ATTACK_ANIM_AND_DAMAGE call SetOppAction_SerialSendDuelData call ShowMetronomeUnsuccessfulText @@ -1536,23 +1536,23 @@ SendAttackDataToLinkOpponent:: ld a, [wccec] or a ret nz - ldh a, [hTemp_ffa0] + ldh a, [hDuelActionArgs + 0] push af - ldh a, [hTempCardIndex_ff9f] + ldh a, [hDuelActionCardIndex] push af ld a, $1 ld [wccec], a ld a, [wPlayerAttackingCardIndex] - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a ld a, [wPlayerAttackingAttackIndex] - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ld a, OPPACTION_BEGIN_ATTACK call SetOppAction_SerialSendDuelData call ExchangeRNG pop af - ldh [hTempCardIndex_ff9f], a + ldh [hDuelActionCardIndex], a pop af - ldh [hTemp_ffa0], a + ldh [hDuelActionArgs + 0], a ret Func_189d: diff --git a/src/home/serial.asm b/src/home/serial.asm index 17b53a7..5812d1e 100644 --- a/src/home/serial.asm +++ b/src/home/serial.asm @@ -547,8 +547,8 @@ ExchangeRNG:: ret ; sets hOppActionTableIndex to an AI action specified in register a. -; send 18 bytes of data to the other game from hOppActionTableIndex, hTempCardIndex_ff9f, -; hTemp_ffa0, and hTempPlayAreaLocation_ffa1, and hTempRetreatCostCards. +; send 18 bytes of data to the other game from hOppActionTableIndex, hDuelActionCardIndex, +; hDuelActionArgs + 0, and hDuelActionArgs + 1, and hDuelActionArgs + RETREAT_ARGS_COST_LIST. ; finally exchange RNG data. ; the receiving side will use this data to read the OPPACTION_* value in ; [hOppActionTableIndex] and match it by calling the corresponding OppAction* function @@ -559,7 +559,7 @@ SetOppAction_SerialSendDuelData:: ld a, [wDuelType] cp DUELIST_TYPE_LINK_OPP jr nz, .not_link - ld hl, hOppActionTableIndex + ld hl, hDuelAction ld bc, 18 call SerialSendBytes call ExchangeRNG @@ -569,12 +569,12 @@ SetOppAction_SerialSendDuelData:: ret ; receive 18 bytes of data from wSerialRecvBuf and store them into hOppActionTableIndex, -; hTempCardIndex_ff9f, hTemp_ffa0, and hTempPlayAreaLocation_ffa1, -; and hTempRetreatCostCards. also exchange RNG data. +; hDuelActionCardIndex, hDuelActionArgs + 0, and hDuelActionArgs + 1, +; and hDuelActionArgs + RETREAT_ARGS_COST_LIST. also exchange RNG data. SerialRecvDuelData:: push hl push bc - ld hl, hOppActionTableIndex + ld hl, hDuelAction ld bc, 18 call SerialRecvBytes call ExchangeRNG diff --git a/src/hram.asm b/src/hram.asm index e0db6d1..b807b62 100644 --- a/src/hram.asm +++ b/src/hram.asm @@ -1,3 +1,6 @@ +INCLUDE "macros.asm" +INCLUDE "constants.asm" + SECTION "HRAM", HRAM[$ff80] hBankROM:: ; ff80 @@ -74,54 +77,32 @@ hTempCardID_ff9b:: ; ff9d hTempPlayAreaLocation_ff9d:: ; ff9f ds $1 +; $ff-terminated 10-byte buffer for the current in-duel action, +; structured as DUEL_ACTION_STRUCT_* (action index, card index, 7 args, terminator). +; mirrors poketcg (tcg1) PR #187; NOTE tcg2's addresses are shifted +2 vs tcg1. +hDuelAction:: ; ffa0 + ; index for AIActionTable hOppActionTableIndex:: ; ffa0 ds $1 ; deck index of a card (0-59) -hTempCardIndex_ff9f:: ; ffa1 +hDuelActionCardIndex:: ; ffa1 ds $1 UNION -; multipurpose temp storage (card's deck index, selected attack index, status condition...) -hTemp_ffa0:: ; ffa2 - ds $1 - -; a PLAY_AREA_* constant (0: arena card, 1-5: bench card) -hTempPlayAreaLocation_ffa1:: ; ffa3 - ds $1 - -; $ff-terminated list of cards to be discarded upon retreat -hTempRetreatCostCards:: ; ffa4 - ds $6 +; $ff-terminated list of arguments of the current in-duel action. +; indexed by the *_ARGS_* offset constants in duel_action_constants.asm. +hDuelActionArgs:: ; ffa2 + ds DUEL_ACTION_ARGS_SIZE + 1 NEXTU - ds $1 - -; parameter to be used by the AI's Pkmn Power effect -hAIPkmnPowerEffectParam:: ; ffa3 - ds $1 - -; parameters chosen by AI in Energy Trans routine. -; 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:: ; ffa4 - -; PLAY_AREA_* of target selected for some Pkmn Powers, -; (e.g. Curse, Damage Swap) and for trainer card effect. -hPlayAreaEffectTarget:: ; ffa4 - ds $1 - -hAIEnergyTransPlayAreaLocation:: ; ffa5 - ds $1 - -NEXTU - -; list of various items, such as -; cards selected for various effects, +; list of various items, such as cards selected for various effects, ; Play Area locations, etc. +; tcg2-specific: 15 bytes (vs tcg1's 8), kept as a separate union member +; because tcg2's hCurSelectionItem follows the union at $ffb2. hTempList:: ; ffa2 ds 15 diff --git a/src/wram.asm b/src/wram.asm index bb837b0..3e149bd 100644 --- a/src/wram.asm +++ b/src/wram.asm @@ -444,7 +444,7 @@ wPlayAreaScreenLoaded:: ; cbcc wPlayAreaSelectAction:: ; cbcd ds $1 -; low byte of the address of the next slot in the hTempRetreatCostCards array to be used +; low byte of the address of the next slot in the hDuelActionArgs[2-] array to be used wTempRetreatCostCardsPos:: ; cbce ds $1