Skip to content

Commit

Permalink
Merge pull request #155 from ElectroDeoxys/master
Browse files Browse the repository at this point in the history
Misc findings and documentation fixes
  • Loading branch information
dannye authored Nov 16, 2024
2 parents 0a1bcf7 + 81842fe commit e79d8c3
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/audio/sfx_headers.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
NumberOfSFX:
db $60
db NUM_SFX

SFXHeaderPointers:
table_width 2, SFXHeaderPointers
Expand Down
2 changes: 1 addition & 1 deletion src/engine/duel/ai/hand_pokemon.asm
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ AIDecidePlayLegendaryBirds:
ld a, DUELVARS_ARENA_CARD
call GetTurnDuelistVariable
ld d, a
ld e, $00
ld e, FIRST_ATTACK_OR_PKMN_POWER
call CopyAttackDataAndDamage_FromDeckIndex
call SwapTurn
ld a, [wLoadedAttackCategory]
Expand Down
10 changes: 5 additions & 5 deletions src/engine/duel/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5649,7 +5649,7 @@ DisplayPlayAreaScreenToUsePkmnPower:
ld a, [hl]
ldh [hTempCardIndex_ff98], a
ld d, a
ld e, $00
ld e, FIRST_ATTACK_OR_PKMN_POWER
call CopyAttackDataAndDamage_FromDeckIndex
call DisplayUsePokemonPowerScreen
ld a, EFFECTCMDTYPE_INITIAL_EFFECT_1
Expand Down Expand Up @@ -6699,7 +6699,7 @@ OppAction_ForceSwitchActive:
OppAction_UsePokemonPower:
ldh a, [hTempCardIndex_ff9f]
ld d, a
ld e, $00
ld e, FIRST_ATTACK_OR_PKMN_POWER
call CopyAttackDataAndDamage_FromDeckIndex
ldh a, [hTemp_ffa0]
ldh [hTempPlayAreaLocation_ff9d], a
Expand Down Expand Up @@ -6908,7 +6908,7 @@ DiscardAttachedPluspowers:
dec e
jr nz, .unattach_pluspower_loop
ld de, PLUSPOWER
jp MoveCardToDiscardPileIfInArena
jp MoveCardToDiscardPileIfInPlayArea

; discard any DEFENDER attached to the turn holder's arena and/or bench Pokemon
DiscardAttachedDefenders:
Expand All @@ -6921,7 +6921,7 @@ DiscardAttachedDefenders:
dec e
jr nz, .unattach_defender_loop
ld de, DEFENDER
jp MoveCardToDiscardPileIfInArena
jp MoveCardToDiscardPileIfInPlayArea

; return carry if the turn holder's arena Pokemon card is asleep, poisoned, or double poisoned.
; also, if confused, paralyzed, or asleep, return the status condition in a.
Expand Down Expand Up @@ -7594,7 +7594,7 @@ GetCardOneStageBelow:
; loads deck indices of the stages present in hTempPlayAreaLocation_ff9d.
; the three stages are loaded consecutively in wAllStagesIndices.
ldh a, [hTempPlayAreaLocation_ff9d]
or CARD_LOCATION_ARENA
or CARD_LOCATION_PLAY_AREA
ld c, a
ld a, DUELVARS_CARD_LOCATIONS
call GetTurnDuelistVariable
Expand Down
23 changes: 11 additions & 12 deletions src/engine/duel/effect_functions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3514,7 +3514,7 @@ AIPickFireEnergyCardToDiscard:
ArcanineFlamethrower_CheckEnergy:
ld e, PLAY_AREA_ARENA
call GetPlayAreaCardAttachedEnergies
ld a, [wAttachedEnergies]
ld a, [wAttachedEnergies + FIRE]
ldtx hl, NotEnoughFireEnergyText
cp 1
ret
Expand Down Expand Up @@ -3556,7 +3556,7 @@ ArcanineQuickAttack_DamageBoostEffect:
FlamesOfRage_CheckEnergy:
ld e, PLAY_AREA_ARENA
call GetPlayAreaCardAttachedEnergies
ld a, [wAttachedEnergies]
ld a, [wAttachedEnergies + FIRE]
ldtx hl, NotEnoughFireEnergyText
cp 2
ret
Expand Down Expand Up @@ -3673,7 +3673,7 @@ FireBlast_CheckEnergy:
ld e, PLAY_AREA_ARENA
call GetPlayAreaCardAttachedEnergies
ldtx hl, NotEnoughFireEnergyText
ld a, [wAttachedEnergies]
ld a, [wAttachedEnergies + FIRE]
cp 1
ret

Expand All @@ -3695,7 +3695,7 @@ Ember_CheckEnergy:
ld e, PLAY_AREA_ARENA
call GetPlayAreaCardAttachedEnergies
ldtx hl, NotEnoughFireEnergyText
ld a, [wAttachedEnergies]
ld a, [wAttachedEnergies + FIRE]
cp 1
ret

Expand All @@ -3717,7 +3717,7 @@ Wildfire_CheckEnergy:
ld e, PLAY_AREA_ARENA
call GetPlayAreaCardAttachedEnergies
ldtx hl, NotEnoughFireEnergyText
ld a, [wAttachedEnergies]
ld a, [wAttachedEnergies + FIRE]
cp 1
ret

Expand Down Expand Up @@ -3857,7 +3857,7 @@ FlareonFlamethrower_CheckEnergy:
ld e, PLAY_AREA_ARENA
call GetPlayAreaCardAttachedEnergies
ldtx hl, NotEnoughFireEnergyText
ld a, [wAttachedEnergies]
ld a, [wAttachedEnergies + FIRE]
cp 1
ret

Expand All @@ -3879,7 +3879,7 @@ MagmarFlamethrower_CheckEnergy:
ld e, PLAY_AREA_ARENA
call GetPlayAreaCardAttachedEnergies
ldtx hl, NotEnoughFireEnergyText
ld a, [wAttachedEnergies]
ld a, [wAttachedEnergies + FIRE]
cp 1
ret

Expand Down Expand Up @@ -3911,7 +3911,7 @@ CharmeleonFlamethrower_CheckEnergy:
ld e, PLAY_AREA_ARENA
call GetPlayAreaCardAttachedEnergies
ldtx hl, NotEnoughFireEnergyText
ld a, [wAttachedEnergies]
ld a, [wAttachedEnergies + FIRE]
cp 1
ret

Expand Down Expand Up @@ -8646,8 +8646,7 @@ MorphEffect:
ret

; picks a random Pokemon in the Deck to morph.
; needs to be a Basic Pokemon that doesn't have
; the same ID as the Arena card.
; needs to be a Basic Pokemon that isn't Ditto
; returns carry if no Pokemon were found.
.PickRandomBasicPokemonFromDeck
call CreateDeckCardList
Expand All @@ -8667,8 +8666,8 @@ MorphEffect:
or a
jr nz, .loop_deck ; skip non-Basic cards
ld a, [wLoadedCard2ID]
cp DUELVARS_ARENA_CARD
jr z, .loop_deck ; skip cards with same ID as Arena card
cp DITTO
jr z, .loop_deck ; skip other Ditto cards
ldh a, [hTempCardIndex_ff98]
or a
ret
Expand Down
4 changes: 2 additions & 2 deletions src/engine/menus/deck_configuration.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2411,9 +2411,9 @@ HandleDeckConfirmationMenu:
ld a, [wCardListCursorPos]
ld [wced7], a

; set wOwnedCardsCountList as current card list
; set wUniqueDeckCardList as current card list
; and show card page screen
ld de, wOwnedCardsCountList
ld de, wUniqueDeckCardList
ld hl, wCurCardListPtr
ld [hl], e
inc hl
Expand Down
4 changes: 2 additions & 2 deletions src/engine/menus/deck_machine.asm
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ HandleDeckMissingCardsList:
ld a, [wCardListCursorPos]
ld [wced7], a

; set wOwnedCardsCountList as current card list
; set wUniqueDeckCardList as current card list
; and show card page screen
ld de, wOwnedCardsCountList
ld de, wUniqueDeckCardList
ld hl, wCurCardListPtr
ld [hl], e
inc hl
Expand Down
2 changes: 1 addition & 1 deletion src/home/card_color.asm
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,5 @@ HandleEnergyBurn::
dec c
jr nz, .zero_next_energy
ld a, [wTotalAttachedEnergies]
ld [wAttachedEnergies], a
ld [wAttachedEnergies + FIRE], a
ret
19 changes: 10 additions & 9 deletions src/home/duel.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ ProcessPlayedPokemonCard::
call ClearChangedTypesIfMuk
ldh a, [hTempCardIndex_ff98]
ld d, a
ld e, $00
ld e, FIRST_ATTACK_OR_PKMN_POWER
call CopyAttackDataAndDamage_FromDeckIndex
call UpdateArenaCardIDsAndClearTwoTurnDuelVars
ldh a, [hTempCardIndex_ff98]
Expand Down Expand Up @@ -1861,14 +1861,14 @@ ApplyDamageModifiers_DamageToTarget::
ld d, [hl]
dec hl
ld e, [hl]
bit 7, d
jr z, .safe
res 7, d ; cap at 2^15
bit UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, d
jr z, .affected_by_wr
res UNAFFECTED_BY_WEAKNESS_RESISTANCE_F, d
xor a
ld [wDamageEffectiveness], a
call HandleDoubleDamageSubstatus
jr .check_pluspower_and_defender
.safe
.affected_by_wr
call HandleDoubleDamageSubstatus
ld a, e
or d
Expand Down Expand Up @@ -2268,15 +2268,16 @@ GetPlayAreaCardRetreatCost::
call GetLoadedCard1RetreatCost
ret

; move the turn holder's card with ID at de to the discard pile
; if it's currently in the arena.
MoveCardToDiscardPileIfInArena::
; move all turn holder's card with ID at de to the discard pile
; that are currently in the Play Area
; this is used to discard all attached Pluspowers and Defenders
MoveCardToDiscardPileIfInPlayArea::
ld c, e
ld b, d
ld l, DUELVARS_CARD_LOCATIONS
.next_card
ld a, [hl]
and CARD_LOCATION_ARENA
and CARD_LOCATION_PLAY_AREA
jr z, .skip ; jump if card not in arena
ld a, l
call GetCardIDFromDeckIndex
Expand Down
6 changes: 3 additions & 3 deletions src/macros/scripts.asm
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ ENDM
; Sets some NPC sprite attributes
MACRO set_sprite_attributes
run_command ScriptCommand_SetSpriteAttributes
db \1 ; Relates to LOADED_NPC_ANIM
db \2 ; Relates to LOADED_NPC_ANIM
db \3 ; Relates to LOADED_NPC_FLAGS
db \1 ; sprite animation non-CGB (SPRITE_ANIM_*)
db \2 ; sprite animation CGB (SPRITE_ANIM_*)
db \3 ; NPC animation flags (NPC_FLAG_*)
ENDM

; Sets the active NPC's coords
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/water_club.asm
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ Script_MeetAmy:
set_dialog_npc NPC_AMY
print_npc_text AmyMeetsPlayer2Text
close_text_box
set_sprite_attributes $09, $2f, $10
set_sprite_attributes SPRITE_ANIM_SGB_AMY_STAND, SPRITE_ANIM_CGB_AMY_STAND, NPC_FLAG_DIRECTIONLESS
do_frames 32
set_sprite_attributes $04, $0e, $00
set_sprite_attributes SPRITE_ANIM_DARK_NPC_UP, SPRITE_ANIM_BLUE_NPC_UP, $00
set_active_npc_coords 20, 4
set_player_direction WEST
move_player WEST, 1
Expand Down Expand Up @@ -306,7 +306,7 @@ Script_LostToAmy:
quit_script_fully

.ows_e34e
set_sprite_attributes $08, $2e, $10
set_sprite_attributes SPRITE_ANIM_SGB_AMY_LAYING, SPRITE_ANIM_CGB_AMY_LAYING, NPC_FLAG_DIRECTIONLESS
set_active_npc_coords 22, 4
quit_script_fully

Expand Down

0 comments on commit e79d8c3

Please sign in to comment.