diff options
Diffstat (limited to 'src/engine/effect_functions.asm')
-rw-r--r-- | src/engine/effect_functions.asm | 263 |
1 files changed, 232 insertions, 31 deletions
diff --git a/src/engine/effect_functions.asm b/src/engine/effect_functions.asm index 92a1f3d..b381661 100644 --- a/src/engine/effect_functions.asm +++ b/src/engine/effect_functions.asm @@ -297,7 +297,7 @@ SetDefiniteDamage: ; 2c166 (b:4166) ; overwrites wAIMinDamage and wAIMaxDamage ; with value in wDamage. -SetMinMaxDamageSameAsDamage: ; 2c174 (b:4174) +SetDefiniteAIDamage: ; 2c174 (b:4174) ld a, [wDamage] ld [wAIMinDamage], a ld [wAIMaxDamage], a @@ -1431,7 +1431,12 @@ DrawSymbolOnPlayAreaCursor: ; 2c6cc (b:46cc) ret ; 0x2c6d9 - INCROM $2c6d9, $2c6e0 +; possibly unreferenced +Func_2c6d9: ; 2c6d9 (b:46d9) + ldtx hl, IncompleteText + call DrawWideTextBox_WaitForInput + ret +; 0x2c6e0 PlayAreaSelectionMenuParameters: ; 2c6e0 (b:46e0) db 0, 0 ; cursor x, cursor y @@ -1911,7 +1916,7 @@ Thrash_ModifierEffect: ; 2c973 (b:4973) call AddToDamage ret -Thrash_LowRecoilEffect: ; 2c982 (b:4982) +Thrash_RecoilEffect: ; 2c982 (b:4982) ldh a, [hTemp_ffa0] or a ret nz @@ -2954,7 +2959,7 @@ HydroPumpEffect: ; 2cf48 (b:4f48) KinglerFlail_AIEffect: ; 2cf4e (b:4f4e) call KinglerFlail_HPCheck - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2cf54 KinglerFlail_HPCheck: ; 2cf54 (b:4f54) @@ -3074,7 +3079,7 @@ KrabbyCallForFamily_PutInPlayAreaEffect: ; 2cfca (b:4fca) MagikarpFlail_AIEffect: ; 2cfff (b:4fff) call MagikarpFlail_HPCheck - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2d005 MagikarpFlail_HPCheck: ; 2d005 (b:5005) @@ -3780,7 +3785,7 @@ FlamesOfRage_DiscardEffect: ; 2d3de (b:53de) FlamesOfRage_AIEffect: ; 2d3e9 (b:53e9) call FlamesOfRage_DamageBoostEffect - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2d3ef FlamesOfRage_DamageBoostEffect: ; 2d3ef (b:53ef) @@ -4244,7 +4249,7 @@ EnergyBurnCheck_Unreferenced: ; 2d620 (b:5620) FlareonRage_AIEffect: ; 2d638 (b:5638) call FlareonRage_DamageBoostEffect - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2d63e FlareonRage_DamageBoostEffect: ; 2d63e (b:563e) @@ -5249,7 +5254,7 @@ InvisibleWallEffect: ; 2db77 (b:5b77) MrMimeMeditate_AIEffect: ; 2db79 (b:5b79) call MrMimeMeditate_DamageBoostEffect - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2db7f MrMimeMeditate_DamageBoostEffect: ; 2db7f (b:5b7f) @@ -5641,7 +5646,7 @@ NeutralizingShieldEffect: ; 2dd79 (b:5d79) Psychic_AIEffect: ; 2dd7b (b:5d7b) call Psychic_DamageBoostEffect - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2dd81 Psychic_DamageBoostEffect: ; 2dd81 (b:5d81) @@ -6101,7 +6106,7 @@ JynxDoubleslap_MultiplierEffect: ; 2dfcf (b:5fcf) JynxMeditate_AIEffect: ; 2dff2 (b:5ff2) call JynxMeditate_DamageBoostEffect - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2dfec JynxMeditate_DamageBoostEffect: ; 2dfec (b:5fec) @@ -6274,7 +6279,7 @@ SnivelEffect: ; 2e0cb (b:60cb) CuboneRage_AIEffect: ; 2e0d1 (b:60d1) call CuboneRage_DamageBoostEffect - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2e0d7 CuboneRage_DamageBoostEffect: ; 2e0d7 (b:60d7) @@ -6423,7 +6428,7 @@ MarowakCallForFamily_PutInPlayAreaEffect: ; 2e194 (b:6194) KarateChop_AIEffect: ; 2e1b4 (b:61b4) call KarateChop_DamageSubtractionEffect - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2e1ba KarateChop_DamageSubtractionEffect: ; 2e1ba (b:61ba) @@ -8242,7 +8247,7 @@ Rampage_AIEffect: ; 2eb96 (b:6b96) ld e, PLAY_AREA_ARENA call GetCardDamageAndMaxHP call AddToDamage - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2eba1 Rampage_Confusion50PercentEffect: ; 2eba1 (b:6ba1) @@ -8282,7 +8287,7 @@ RetreatAidEffect: ; 2ebd7 (b:6bd7) DodrioRage_AIEffect: ; 2ebd9 (b:6bd9) call DodrioRage_DamageBoostEffect - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2ebdf DodrioRage_DamageBoostEffect: ; 2ebdf (b:6bdf) @@ -8900,7 +8905,7 @@ ChanseyDoubleEdgeEffect: ; 2eefb (b:6efb) SuperFang_AIEffect: ; 2ef01 (b:6f01) call SuperFang_HalfHPEffect - jp SetMinMaxDamageSameAsDamage + jp SetDefiniteAIDamage ; 0x2ef07 SuperFang_HalfHPEffect: ; 2ef07 (b:6f07) @@ -9037,7 +9042,37 @@ Dragonite1Slam_MultiplierEffect: ; 2efa4 (b:6fa4) ret ; 0x2efbc - INCROM $2efbc, $2efe0 +; possibly unreferenced +Func_2efbc: ; 2efbc (b:6fbc) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld c, a + ld l, DUELVARS_ARENA_CARD_HP + ld de, wce76 +.asm_2efc7 + ld a, [hli] + ld [de], a + inc de + dec c + jr nz, .asm_2efc7 + ret +; 0x2efce + +; possibly unreferenced +Func_2efce: ; 2efce (b:6fce) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetTurnDuelistVariable + ld c, a + ld l, DUELVARS_ARENA_CARD_HP + ld de, wce76 +.asm_2efd9 + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .asm_2efd9 + ret +; 0x2efe0 CatPunchEffect: ; 2efe0 (b:6fe0) call SwapTurn @@ -11388,7 +11423,8 @@ DevolutionSpray_DevolutionEffect: ; 2fc99 (b:7c99) ret ; 0x2fcd0 -Func_2fcd0: ; 2fcd0 (b:7cd0) +; returns carry if neither duelist has any energy cards attached +SuperEnergyRemoval_EnergyCheck: ; 2fcd0 (b:7cd0) call CheckIfThereAreAnyEnergyCardsAttached ldtx hl, NoEnergyCardsAttachedToPokemonInYourPlayAreaText ret c @@ -11399,7 +11435,7 @@ Func_2fcd0: ; 2fcd0 (b:7cd0) ret ; 0x2fce4 -Func_2fce4: ; 2fce4 (b:7ce4) +SuperEnergyRemoval_PlayerSelection: ; 2fce4 (b:7ce4) ; handle selection of Energy to discard in own Play Area ldtx hl, ChoosePokemonInYourAreaThenPokemonInYourOppText call DrawWideTextBox_WaitForInput @@ -11434,18 +11470,21 @@ Func_2fce4: ; 2fce4 (b:7ce4) ; store this Pokemon's Play Area location ldh a, [hTempPlayAreaLocation_ff9d] ldh [hPlayAreaEffectTarget], a - +; store which energy card to discard from it bank1call CreateArenaOrBenchEnergyCardList ldh a, [hTempPlayAreaLocation_ff9d] bank1call DisplayEnergyDiscardScreen ld a, 2 ld [wcbfa], a -.asm_2fd2a + +.loop_discard_energy_selection bank1call HandleEnergyDiscardMenuInput - jr nc, .asm_2fd4a + jr nc, .energy_selected + ; B pressed ld a, 5 call AskWhetherToQuitSelectingCards - jr nc, .asm_2fd69 + jr nc, .done ; finish operation + ; player selected to continue selection ld a, [wcbfb] push af ldh a, [hTempPlayAreaLocation_ff9d] @@ -11454,8 +11493,10 @@ Func_2fce4: ; 2fce4 (b:7ce4) ld [wcbfa], a pop af ld [wcbfb], a - jr .asm_2fd2a -.asm_2fd4a + jr .loop_discard_energy_selection + +.energy_selected +; store energy cards to discard from opponent call GetNextPositionInTempList_TrainerEffects ldh a, [hTempCardIndex_ff98] ld [hl], a @@ -11463,14 +11504,15 @@ Func_2fce4: ; 2fce4 (b:7ce4) ld hl, wcbfb inc [hl] ldh a, [hCurSelectionItem] - cp $05 - jr nc, .asm_2fd69 + cp 5 + jr nc, .done ; no more energy cards to select ld a, [wDuelTempList] cp $ff - jr z, .asm_2fd69 + jr z, .done ; no more energy cards to select bank1call DisplayEnergyDiscardMenu - jr .asm_2fd2a -.asm_2fd69 + jr .loop_discard_energy_selection + +.done call GetNextPositionInTempList_TrainerEffects ld [hl], $ff call SwapTurn @@ -11478,7 +11520,130 @@ Func_2fce4: ; 2fce4 (b:7ce4) ret ; 0x2fd73 - INCROM $2fd73, $2fe25 +SuperEnergyRemoval_DiscardEffect: ; 2fd73 (b:7d73) + ld hl, hTempList + 1 + +; discard energy card of own Play Area + ld a, [hli] + call PutCardInDiscardPile + +; iterate and discard opponent's energy cards + inc hl + call SwapTurn +.loop + ld a, [hli] + cp $ff + jr z, .done_discard + call PutCardInDiscardPile + jr .loop + +.done_discard +; if it's Player's turn, return... + call SwapTurn + call IsPlayerTurn + ret c +; ...otherwise show Play Area of affected Pokemon +; in opponent's Play Area + ldh a, [hTemp_ffa0] + call Func_2c10b +; in player's Play Area + xor a + ld [wDuelDisplayedScreen], a + call SwapTurn + ldh a, [hPlayAreaEffectTarget] + call Func_2c10b + call SwapTurn + ret +; 0x2fda4 + +; return carry if not enough cards in hand to +; discard for Super Energy Retrieval effect +; or if the Discard Pile has no basic Energy cards +SuperEnergyRetrieval_HandEnergyCheck: ; 2fda4 (b:7da4) + ld a, DUELVARS_NUMBER_OF_CARDS_IN_HAND + call GetTurnDuelistVariable + ldtx hl, NotEnoughCardsInHandText + cp 3 + ret c + call CreateEnergyCardListFromDiscardPile_OnlyBasic + ldtx hl, ThereAreNoBasicEnergyCardsInDiscardPileText + ret +; 0x2fdb6 + +SuperEnergyRetrieval_PlayerHandSelection: ; 2fdb6 (b:7db6) + call HandlePlayerSelection2HandCardsToDiscard + ret +; 0x2fdba + +SuperEnergyRetrieval_PlayerDiscardPileSelection: ; 2fdba (b:7dba) + ldtx hl, ChooseUpTo4FromDiscardPileText + call DrawWideTextBox_WaitForInput + call CreateEnergyCardListFromDiscardPile_OnlyBasic + +.loop_discard_pile_selection + bank1call InitAndDrawCardListScreenLayout + ldtx hl, PleaseSelectCardText + ldtx de, PlayerDiscardPileText + bank1call SetCardListHeaderText + bank1call DisplayCardList + jr nc, .store_selected_card + ; B pressed + ld a, 6 + call AskWhetherToQuitSelectingCards + jr c, .loop_discard_pile_selection ; player selected to continue + jr .done + +.store_selected_card + ldh a, [hTempCardIndex_ff98] + call GetTurnDuelistVariable + call GetNextPositionInTempList_TrainerEffects + ldh a, [hTempCardIndex_ff98] + ld [hl], a ; store selected energy card + call RemoveCardFromDuelTempList + jr c, .done + ; this shouldn't happen + ldh a, [hCurSelectionItem] + cp 6 + jr c, .loop_discard_pile_selection + +.done +; insert terminating byte + call GetNextPositionInTempList_TrainerEffects + ld [hl], $ff + or a + ret +; 0x2fdfa + +SuperEnergyRetrieval_DiscardAndAddToHandEffect: ; 2fdfa (b:7dfa) +; discard 2 cards selected from the hand + ld hl, hTemp_ffa0 + ld a, [hli] + call RemoveCardFromHand + call PutCardInDiscardPile + ld a, [hli] + call RemoveCardFromHand + call PutCardInDiscardPile + +; put selected cards in hand + ld de, wDuelTempList +.loop + ld a, [hli] + ld [de], a + inc de + cp $ff + jr z, .done + call MoveDiscardPileCardToHand + call AddCardToHand + jr .loop + +.done +; if Player played the card, exit + call IsPlayerTurn + ret c +; if not, show card list selected by Opponent + bank1call Func_4b38 + ret +; 0x2fe25 ; outputs in hl the next position ; in hTempList to place a new card, @@ -11551,7 +11716,43 @@ HandlePlayerSelection2HandCards: ; 2fe3a (b:7e3a) ret ; 0x2fe6e - INCROM $2fe6e, $2fea9 +; return carry if non-turn duelist has no benched Pokemon +GustOfWind_BenchCheck: ; 2fe6e (b:7e6e) + ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA + call GetNonTurnDuelistVariable + ldtx hl, EffectNoPokemonOnTheBenchText + cp 2 + ret +; 0x2fe79 + +GustOfWind_PlayerSelection: ; 2fe79 (b:7e79) + ldtx hl, ChooseAPokemonToSwitchWithActivePokemonText + call DrawWideTextBox_WaitForInput + call SwapTurn + bank1call HasAlivePokemonInBench + bank1call OpenPlayAreaScreenForSelection + ldh a, [hTempPlayAreaLocation_ff9d] + ldh [hTemp_ffa0], a + call SwapTurn + ret +; 0x2fe90 + +GustOfWind_SwitchEffect: ; 2fe90 (b:7e90) +; play whirlwind animation + ld a, $8d + call Func_2fea9 + +; switch Arena card + call SwapTurn + ldh a, [hTemp_ffa0] + ld e, a + call SwapArenaWithBenchPokemon + call SwapTurn + call ClearDamageReductionSubstatus2 + xor a + ld [wDuelDisplayedScreen], a + ret +; 0x2fea9 ; input: ; a = move animation to play |