Skip to content

Commit

Permalink
Borrow some substatus function labels from poketcg2 dissassembly
Browse files Browse the repository at this point in the history
  • Loading branch information
Sha0den committed Sep 16, 2024
1 parent 68f981d commit fb2b749
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/engine/duel/ai/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ CheckIfCardCanBePlayed:
ret

.trainer_card
bank1call CheckCantUseTrainerDueToHeadache
bank1call CheckCantUseTrainerDueToEffect
ret c
call LoadNonPokemonCardEffectCommands
ld a, EFFECTCMDTYPE_INITIAL_EFFECT_1
Expand Down
2 changes: 1 addition & 1 deletion src/engine/duel/ai/decks/legendary_moltres.asm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ AIDoTurn_LegendaryMoltres:
cp DECK_SIZE - 9
jr nc, .skip_moltres ; skip if cards in deck <= 9
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
jr c, .skip_moltres ; skip if Muk in play
ld a, MOLTRES_LV37
call LookForCardIDInHandList_Bank5
Expand Down
4 changes: 2 additions & 2 deletions src/engine/duel/ai/decks/legendary_ronald.asm
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ AIDoTurn_LegendaryRonald:
cp DECK_SIZE - 9
jr nc, .skip_moltres_1 ; skip if cards in deck <= 9
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
jr c, .skip_moltres_1 ; skip if Muk in play
ld a, MOLTRES_LV37
call LookForCardIDInHandList_Bank5
Expand Down Expand Up @@ -167,7 +167,7 @@ AIDoTurn_LegendaryRonald:
cp DECK_SIZE - 9
jr nc, .skip_moltres_2 ; skip if cards in deck <= 9
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
jr c, .skip_moltres_2 ; skip if Muk in play
ld a, MOLTRES_LV37
call LookForCardIDInHandList_Bank5
Expand Down
4 changes: 2 additions & 2 deletions src/engine/duel/ai/energy.asm
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ AIProcessEnergyCards:
; add to AI score
.check_venusaur
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
jr c, .check_if_active
ld a, VENUSAUR_LV67
call CountPokemonIDInPlayArea
call CountTurnDuelistPokemonWithActivePkmnPower
jr nc, .check_if_active
ld a, 1
call AddToAIScore
Expand Down
6 changes: 3 additions & 3 deletions src/engine/duel/ai/hand_pokemon.asm
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ AIDecideSpecialEvolutions:
; if there's no Muk, raise score
.check_muk
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
jr c, .lower_score
ld a, 10
call AddToAIScore
Expand Down Expand Up @@ -590,7 +590,7 @@ AIDecidePlayLegendaryBirds:
.check_muk_and_snorlax
; checks for Muk in both Play Areas
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
jr c, .subtract
; checks if player's active card is Snorlax
ld a, DUELVARS_ARENA_CARD
Expand Down Expand Up @@ -622,6 +622,6 @@ AIDecidePlayLegendaryBirds:
.zapdos
; checks for Muk in both Play Areas
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
jr c, .subtract
ret
16 changes: 8 additions & 8 deletions src/engine/duel/ai/pkmn_powers.asm
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ HandleAIEnergyTrans:
ret z ; return if no Bench cards

ld a, VENUSAUR_LV67
call CountPokemonIDInPlayArea
call CountTurnDuelistPokemonWithActivePkmnPower
ret nc ; return if no VenusaurLv67 found in own Play Area

ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
ret c ; return if Muk found in any Play Area

ld a, [wce06]
Expand Down Expand Up @@ -411,7 +411,7 @@ AIEnergyTransTransferEnergyToBench:
; returns carry if turn ended.
HandleAIPkmnPowers:
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
ccf
ret nc ; return no carry if Muk is in play

Expand Down Expand Up @@ -944,7 +944,7 @@ HandleAICurse:
; handles AI logic for Cowardice
HandleAICowardice:
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
ret c ; return if there's Muk in play

farcall AIChooseRandomlyNotToDoAction
Expand Down Expand Up @@ -1041,10 +1041,10 @@ HandleAIDamageSwap:
ret c

ld a, ALAKAZAM
call CountPokemonIDInPlayArea
call CountTurnDuelistPokemonWithActivePkmnPower
ret nc ; return if no Alakazam
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
ret c ; return if there's Muk in play

; only take damage off certain cards in Arena
Expand Down Expand Up @@ -1207,10 +1207,10 @@ HandleAIGoGoRainDanceEnergy:
ret nz ; return if not Go Go Rain Dance deck

ld a, BLASTOISE
call CountPokemonIDInPlayArea
call CountTurnDuelistPokemonWithActivePkmnPower
ret nc ; return if no Blastoise
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
ret c ; return if there's Muk in play

; play all the energy cards that is needed.
Expand Down
14 changes: 7 additions & 7 deletions src/engine/duel/ai/trainer_cards.asm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ _AIProcessHandTrainerCards:

; if Headache effects prevent playing card
; move on to the next item in list.
bank1call CheckCantUseTrainerDueToHeadache
bank1call CheckCantUseTrainerDueToEffect
jp c, .next_in_data

call LoadNonPokemonCardEffectCommands
Expand Down Expand Up @@ -2348,12 +2348,12 @@ AIDecide_ProfessorOak:

.handle_blastoise
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
jr c, .check_hand

; no Muk in Play Area
ld a, BLASTOISE
call CountPokemonIDInPlayArea
call CountTurnDuelistPokemonWithActivePkmnPower
jr nc, .check_hand

; at least one Blastoise in AI Play Area
Expand Down Expand Up @@ -2635,10 +2635,10 @@ AIDecide_EnergyRetrieval:
cp GO_GO_RAIN_DANCE_DECK_ID
jr nz, .start
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
jr c, .start
ld a, BLASTOISE
call CountPokemonIDInPlayArea
call CountTurnDuelistPokemonWithActivePkmnPower
jp nc, .no_carry

.start
Expand Down Expand Up @@ -2897,10 +2897,10 @@ AIDecide_SuperEnergyRetrieval:
cp GO_GO_RAIN_DANCE_DECK_ID
jr nz, .start
ld a, MUK
call CountPokemonIDInBothPlayAreas
call CountPokemonWithActivePkmnPowerInBothPlayAreas
jr c, .start
ld a, BLASTOISE
call CountPokemonIDInPlayArea
call CountTurnDuelistPokemonWithActivePkmnPower
jp nc, .no_carry

.start
Expand Down
2 changes: 1 addition & 1 deletion src/engine/duel/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ OpenVariousPlayAreaScreens_FromSelectPresses:
; some status condition or due the bench containing no alive Pokemon.
; return carry if unable, nc if able.
CheckAbleToRetreat:
call CheckCantRetreatDueToAcid
call CheckUnableToRetreatDueToEffect
ret c
call CheckIfActiveCardParalyzedOrAsleep
ret c
Expand Down
32 changes: 16 additions & 16 deletions src/engine/duel/effect_functions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ QueueStatusCondition:
cp SNORLAX
jr nz, .can_induce_status
call SwapTurn
xor a
xor a ; PLAY_AREA_ARENA
; ...unless already so, or if affected by Muk's Toxic Gas
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
call SwapTurn
jr c, .can_induce_status

Expand Down Expand Up @@ -2150,7 +2150,7 @@ EnergyTrans_CheckPlayArea:
ldh a, [hTempPlayAreaLocation_ff9d]
ldh [hTemp_ffa0], a
ldh a, [hTempPlayAreaLocation_ff9d]
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
ret c ; cannot use Pkmn Power

; search in Play Area for at least 1 Grass Energy type
Expand Down Expand Up @@ -2459,7 +2459,7 @@ Shift_OncePerTurnCheck:
and USED_PKMN_POWER_THIS_TURN
jr nz, .already_used
ldh a, [hTempPlayAreaLocation_ff9d]
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
ret
.already_used
ldtx hl, OnlyOncePerTurnText
Expand Down Expand Up @@ -2568,7 +2568,7 @@ Heal_OncePerTurnCheck:
ret c ; no damage counters to heal

ldh a, [hTempPlayAreaLocation_ff9d]
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
ret

.already_used
Expand Down Expand Up @@ -2666,7 +2666,7 @@ SolarPower_CheckUse:
jr nz, .already_used

ldh a, [hTempPlayAreaLocation_ff9d]
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
ret c ; can't use PKMN due to status or Toxic Gas

; return carry if none of the Arena cards have status conditions
Expand Down Expand Up @@ -3372,7 +3372,7 @@ Blizzard_BenchDamageEffect:
Cowardice_Check:
ldh a, [hTempPlayAreaLocation_ff9d]
ldh [hTemp_ffa0], a
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
ret c ; return if cannot use

ld a, DUELVARS_NUMBER_OF_POKEMON_IN_PLAY_AREA
Expand Down Expand Up @@ -3997,8 +3997,8 @@ FireSpin_DiscardEffect:
; or if Arena card is not Charizard.
; this is unused.
EnergyBurnCheck_Unreferenced:
xor a
bank1call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
xor a ; PLAY_AREA_ARENA
bank1call CheckIsIncapableOfUsingPkmnPower
ret c
ld a, DUELVARS_ARENA_CARD
push de
Expand Down Expand Up @@ -4373,7 +4373,7 @@ Curse_CheckDamageAndBench:
; return carry if Pkmn Power cannot be used due
; to Toxic Gas or status.
ldh a, [hTempPlayAreaLocation_ff9d]
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
ret

.set_carry
Expand Down Expand Up @@ -5000,7 +5000,7 @@ DamageSwap_CheckDamage:
call CheckIfPlayAreaHasAnyDamage
jr c, .no_damage
ldh a, [hTempPlayAreaLocation_ff9d]
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
ret
.no_damage
ldtx hl, NoPokemonWithDamageCountersText
Expand Down Expand Up @@ -5510,7 +5510,7 @@ StrangeBehavior_CheckDamage:
jr c, .set_carry
; can Pkmn Power be used?
ldh a, [hTempPlayAreaLocation_ff9d]
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
ret

.set_carry
Expand Down Expand Up @@ -6231,7 +6231,7 @@ Peek_OncePerTurnCheck:
and USED_PKMN_POWER_THIS_TURN
jr nz, .already_used
ldh a, [hTempPlayAreaLocation_ff9d]
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
ret
.already_used
ldtx hl, OnlyOncePerTurnText
Expand Down Expand Up @@ -7679,7 +7679,7 @@ StepIn_BenchCheck:
jr nz, .set_carry

ldh a, [hTempPlayAreaLocation_ff9d]
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
ret

.set_carry
Expand Down Expand Up @@ -8950,8 +8950,8 @@ ImakuniEffect:
; cannot confuse Snorlax if its Pkmn Power is active
cp SNORLAX
jr nz, .success
xor a
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
xor a ; PLAY_AREA_ARENA
call CheckIsIncapableOfUsingPkmnPower
jr c, .success
; fallthrough if Thick Skinned is active

Expand Down
6 changes: 3 additions & 3 deletions src/home/card_color.asm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ GetPlayAreaCardColor::
ret
.has_changed_color
ld a, e
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
call CheckIsIncapableOfUsingPkmnPower
jr c, .regular_color ; jump if can't use Shift
ld a, e
add DUELVARS_ARENA_CARD_CHANGED_TYPE
Expand Down Expand Up @@ -97,8 +97,8 @@ HandleEnergyBurn::
ld a, e
cp CHARIZARD
ret nz
xor a
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
xor a ; PLAY_AREA_ARENA
call CheckIsIncapableOfUsingPkmnPower
ret c
ld hl, wAttachedEnergies
ld c, NUM_COLORED_TYPES
Expand Down
6 changes: 3 additions & 3 deletions src/home/duel.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1367,8 +1367,8 @@ ProcessPlayedPokemonCard::
ld a, [wLoadedCard1ID]
cp MUK
jr z, .use_pokemon_power
ld a, $01 ; check only Muk
call CheckCannotUseDueToStatus_OnlyToxicGasIfANon0
ld a, PLAY_AREA_BENCH_1 ; don't check status
call CheckIsIncapableOfUsingPkmnPower
jr nc, .use_pokemon_power
call DisplayUsePokemonPowerScreen
ldtx hl, UnableToUsePkmnPowerDueToToxicGasText
Expand Down Expand Up @@ -1752,7 +1752,7 @@ CheckSelfConfusionDamage::
; a trainer card is like an attack effect, with its own effect commands.
; return nc if the card was played, carry if it wasn't.
PlayTrainerCard::
call CheckCantUseTrainerDueToHeadache
call CheckCantUseTrainerDueToEffect
jr c, .cant_use
ldh a, [hWhoseTurn]
ld h, a
Expand Down
Loading

0 comments on commit fb2b749

Please sign in to comment.