summaryrefslogtreecommitdiff
path: root/src/engine/home.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2020-12-20 13:19:33 -0600
committerdannye <33dannye@gmail.com>2020-12-20 13:19:33 -0600
commitb276b23d4e9ea34d64766ddb92c768b4bc4f1b8f (patch)
tree9ba304cf8d635d6f6c81c85ce864b0311108b414 /src/engine/home.asm
parenta134c1f9a9c197ee9662c8177fa487ec938f5294 (diff)
parent68f371effcfc31927dc093a68505af85f523d243 (diff)
Merge branch 'master' of https://github.com/pret/poketcg
Diffstat (limited to 'src/engine/home.asm')
-rw-r--r--src/engine/home.asm67
1 files changed, 45 insertions, 22 deletions
diff --git a/src/engine/home.asm b/src/engine/home.asm
index 0094924..140fcc9 100644
--- a/src/engine/home.asm
+++ b/src/engine/home.asm
@@ -2778,7 +2778,7 @@ ExchangeRNG: ; 0f58 (0:0f58)
; send 10 bytes of data to the other game from hOppActionTableIndex, hTempCardIndex_ff9f,
; hTemp_ffa0, and hTempPlayAreaLocation_ffa1, and hTempRetreatCostCards.
; finally exchange RNG data.
-; the receiving side will use this data to read the OPP_ACTION_* value in
+; the receiving side will use this data to read the OPPACTION_* value in
; [hOppActionTableIndex] and match it by calling the correspoding OppAction* function
SetOppAction_SerialSendDuelData: ; 0f7f (0:0f7f)
push hl
@@ -3604,6 +3604,7 @@ GetCardIDFromDeckIndex: ; 1324 (0:1324)
ret
; remove card c from wDuelTempList (it contains a $ff-terminated list of deck indexes)
+; returns carry if no matches were found.
RemoveCardFromDuelTempList: ; 132f (0:132f)
push hl
push de
@@ -3703,9 +3704,9 @@ LoadCardDataToBuffer2_FromDeckIndex: ; 138c (0:138c)
ret
; evolve a turn holder's Pokemon card in the play area slot determined by hTempPlayAreaLocation_ff9d
-; into another turn holder's Pokemon card identifier by it's deck index (0-59) in hTempCardIndex_ff98.
-; return nc if evolution was succesful.
-EvolvePokemonCard: ; 13a2 (0:13a2)
+; into another turn holder's Pokemon card identifier by its deck index (0-59) in hTempCardIndex_ff98.
+; return nc if evolution was successful.
+EvolvePokemonCardIfPossible: ; 13a2 (0:13a2)
; first make sure the attempted evolution is viable
ldh a, [hTempCardIndex_ff98]
ld d, a
@@ -3713,7 +3714,12 @@ EvolvePokemonCard: ; 13a2 (0:13a2)
ld e, a
call CheckIfCanEvolveInto
ret c ; return if it's not capable of evolving into the selected Pokemon
- ; place the evolved Pokemon card in the play area location of the pre-evolved Pokemon card
+; fallthrough
+
+; evolve a turn holder's Pokemon card in the play area slot determined by hTempPlayAreaLocation_ff9d
+; into another turn holder's Pokemon card identifier by its deck index (0-59) in hTempCardIndex_ff98.
+EvolvePokemonCard: ; 13ac (0:13ac)
+; place the evolved Pokemon card in the play area location of the pre-evolved Pokemon card
ldh a, [hTempPlayAreaLocation_ff9d]
ld e, a
add DUELVARS_ARENA_CARD
@@ -3738,7 +3744,7 @@ EvolvePokemonCard: ; 13a2 (0:13a2)
ld [hl], a
; reset status (if in arena) and set the flag that prevents it from evolving again this turn
ld a, e
- add DUELVARS_ARENA_CARD_FLAGS_C2
+ add DUELVARS_ARENA_CARD_FLAGS
ld l, a
ld [hl], $00
ld a, e
@@ -3785,7 +3791,7 @@ CheckIfCanEvolveInto: ; 13f7 (0:13f7)
jr nz, .cant_evolve ; jump if they are incompatible to evolve
pop de
ld a, e
- add DUELVARS_ARENA_CARD_FLAGS_C2
+ add DUELVARS_ARENA_CARD_FLAGS
call GetTurnDuelistVariable
and CAN_EVOLVE_THIS_TURN
jr nz, .can_evolve
@@ -3810,7 +3816,7 @@ CheckIfCanEvolveInto: ; 13f7 (0:13f7)
; return carry if not basic to stage 2 evolution, or if evolution not possible this turn.
CheckIfCanEvolveInto_BasicToStage2: ; 142b (0:142b)
ld a, e
- add DUELVARS_ARENA_CARD_FLAGS_C2
+ add DUELVARS_ARENA_CARD_FLAGS
call GetTurnDuelistVariable
and CAN_EVOLVE_THIS_TURN
jr nz, .can_evolve
@@ -3904,7 +3910,7 @@ PutHandPokemonCardInPlayArea: ; 1485 (0:1485)
ld l, a
ld a, [wLoadedCard2HP]
ld [hl], a ; set card's HP
- ld a, DUELVARS_ARENA_CARD_FLAGS_C2
+ ld a, DUELVARS_ARENA_CARD_FLAGS
add e
ld l, a
ld [hl], $0
@@ -4051,7 +4057,7 @@ SwapPlayAreaPokemon: ; 1548 (0:1548)
call .swap_duelvar
ld a, DUELVARS_ARENA_CARD_HP
call .swap_duelvar
- ld a, DUELVARS_ARENA_CARD_FLAGS_C2
+ ld a, DUELVARS_ARENA_CARD_FLAGS
call .swap_duelvar
ld a, DUELVARS_ARENA_CARD_STAGE
call .swap_duelvar
@@ -4379,8 +4385,8 @@ Func_16f6: ; 16f6 (0:16f6)
ld [wEffectFailed], a
ld [wIsDamageToSelf], a
ld [wccef], a
- ld [wccf0], a
- ld [wNoEffectFromStatus], a
+ ld [wMetronomeEnergyCost], a
+ ld [wNoEffectFromWhichStatus], a
bank1call ClearNonTurnTemporaryDuelvars_CopyStatus
ret
@@ -4516,7 +4522,7 @@ ClearNonTurnTemporaryDuelvars_ResetCarry: ; 1823 (0:1823)
ret
; called when attacker deals damage to itself due to confusion
-; display the corresponding animation and deal damage to self
+; display the corresponding animation and deal 20 damage to self
HandleConfusionDamageToSelf: ; 1828 (0:1828)
bank1call DrawDuelMainScene
ld a, 1
@@ -4690,13 +4696,17 @@ LoadNonPokemonCardEffectCommands: ; 1944 (0:1944)
ld [de], a
ret
-Func_1955: ; 1955 (0:1955)
+; Make turn holder deal A damage to self due to recoil (e.g. Thrash, Selfdestruct)
+; display recoil animation
+DealRecoilDamageToSelf: ; 1955 (0:1955)
push af
ld a, $7a
ld [wLoadedMoveAnimation], a
pop af
; fallthrough
+; Make turn holder deal A damage to self due to confusion
+; display animation at wLoadedMoveAnimation
DealConfusionDamageToSelf: ; 195c (0:195c)
ld hl, wDamage
ld [hli], a
@@ -4965,10 +4975,18 @@ PrintKnockedOut: ; 1ad3 (0:1ad3)
; deal damage to turn holder's Pokemon card at play area location at b (PLAY_AREA_*).
; damage to deal is given in de.
; shows the defending player's play area screen when dealing the damage
-; instead of the main duel interface, and has a fixed move animation.
-DealDamageToPlayAreaPokemon: ; 1af3 (0:1af3)
+; instead of the main duel interface with regular attack animation.
+DealDamageToPlayAreaPokemon_RegularAnim: ; 1af3 (0:1af3)
ld a, $78
ld [wLoadedMoveAnimation], a
+; fallthrough
+
+; deal damage to turn holder's Pokemon card at play area location at b (PLAY_AREA_*).
+; damage to deal is given in de.
+; shows the defending player's play area screen when dealing the damage
+; instead of the main duel interface.
+; plays animation that is loaded in wLoadedMoveAnimation.
+DealDamageToPlayAreaPokemon: ; 1af8 (0:1af8)
ld a, b
ld [wTempPlayAreaLocation_cceb], a
or a ; cp PLAY_AREA_ARENA
@@ -5172,9 +5190,13 @@ MoveCardToDiscardPileIfInArena: ; 1c13 (0:1c13)
jr c, .next_card
ret
-; calculate damage of card at CARD_LOCATION_* in e
-; return the result in a
-GetCardDamage: ; 1c35 (0:1c35)
+; calculate damage and max HP of card at PLAY_AREA_* in e.
+; input:
+; e = PLAY_AREA_* of card;
+; output:
+; a = damage;
+; c = max HP.
+GetCardDamageAndMaxHP: ; 1c35 (0:1c35)
push hl
push de
ld a, DUELVARS_ARENA_CARD
@@ -10297,7 +10319,7 @@ GetPlayAreaCardColor: ; 36f7 (0:36f7)
ld e, a
add DUELVARS_ARENA_CARD_CHANGED_TYPE
call GetTurnDuelistVariable
- bit 7, a
+ bit HAS_CHANGED_COLOR_F, a
jr nz, .has_changed_color
.regular_color
ld a, e
@@ -11047,9 +11069,10 @@ Func_3b11: ; 3b11 (0:3b11)
Func_3b21: ; 3b21 (0:3b21)
ldh a, [hBankROM]
push af
- ld a, $07
+ ld a, BANK(Func_1c8bc)
call BankswitchROM
- call $48bc
+ call Func_1c8bc
+
pop af
call BankswitchROM
ret