This commit is contained in:
Zeta_Null 2023-10-26 15:26:09 -04:00
commit a8a942cefb
57 changed files with 501 additions and 34 deletions

View file

@ -420,3 +420,8 @@ TrainerHouse:
ld a, [sMysteryGiftTrainerHouseFlag]
ld [wScriptVar], a
jp CloseSRAM
; Tradeback NPC tutorial
TradebackNPC:
farcall TradebackGuy
ret

View file

@ -0,0 +1,140 @@
; Fun fact, the 'trade' part of a trade isn't checked to evolve a Pokémon.
; It seems that just the trade animation and the link state are enough.
; No Pokémon is actualy ever moved to or from your party because of that fact.
TradebackGuy::
ld hl, TradebackGuyText
call PrintText
call YesNoBox
ld hl, TradebackGuyCanceledText
jr c, .done
; Select a Pokémon from the party.
ld b, PARTYMENUACTION_GIVE_MON
farcall SelectTradeOrDayCareMon
ld a, [wCurPartyMon]
ld hl, TradebackGuyCanceledText
jr c, .done
ld hl, NPCTradeCableText
call PrintText
call TradeWithTradebackGuy
call RestartMapMusic
ld hl, TradebackGuyCompleteText
call PrintText
ret
.done
call PrintText
ret
; Loads the appropriate data to perform the trade animation.
TradeWithTradebackGuy:
; Sets the link state to trading so that evolution is possible.
ld a, LINK_TRADECENTER
ld [wLinkMode], a
; Establish names of trading trainers
ld hl, wPlayerName
ld de, wPlayerTrademonSenderName
ld bc, NAME_LENGTH
call CopyBytes
ld hl, .tradeback_guy_name
ld de, wOTTrademonSenderName
ld bc, NAME_LENGTH
call CopyBytes
.tradeback_guy_name:
db "TRADER@@@"
; Establish the Pokémon's species.
ld a, [wCurPartyMon]
ld hl, wPartySpecies
ld b, 0
ld c, a
add hl, bc
ld a, [hl]
ld [wPlayerTrademonSpecies], a
ld [wOTTrademonSpecies], a
; Establish Pokémon's ID number.
ld hl, wPartyMon1ID
ld a, [wCurPartyMon]
call GetPartyLocation
ld a, [hli]
ld [wPlayerTrademonID], a
ld [wOTTrademonID], a
ld a, [hl]
ld [wPlayerTrademonID + 1], a
ld [wOTTrademonID + 1], a
; Correctly display Pokémon shiny status on the trade screen.
ld hl, wPartyMon1DVs
ld a, [wCurPartyMon]
call GetPartyLocation
ld a, [hli]
ld [wPlayerTrademonDVs], a
ld [wOTTrademonDVs], a
ld a, [hl]
ld [wPlayerTrademonDVs + 1], a
ld [wOTTrademonDVs + 1], a
; Establish Pokémon's OT's name
ld a, [wCurPartyMon]
ld hl, wPartyMonOTs
call SkipNames
ld de, wPlayerTrademonOTName
ld bc, NAME_LENGTH
call CopyBytes
ld hl, wPartyMonOTs
ld de, wOTTrademonOTName
ld bc, NAME_LENGTH
call CopyBytes
; Makes it so that pressing B will not cancel the evolution.
; This is standard for trade based evolution.
ld a, 1
ld [wForceEvolution], a
; Run the trade animation/ evolves the mon if applicable.
call DisableSpriteUpdates
; wTradeDialog aliases wFrameCounter, which TradeAnimation uses.
ld a, [wTradeDialog]
push af
predef TradeAnimation
callfar EvolvePokemon
pop af
ld [wTradeDialog], a
call ReturnToMapWithSpeechTextbox
; Changes the link mode back to not linked, battles won't work right otherwise.
ld a, LINK_NULL
ld [wLinkMode], a
ret
TradebackGuyText::
text "Hey there! I'm"
line "the TRADER!"
para "I love helping"
line "TRAINERs evolve"
cont "their #MON!"
para "Wanna try?"
done
TradebackGuyCanceledText::
text "Oh, ok then."
para "Come back if you"
line "change your mind!"
done
TradebackGuyCompleteText::
text "And...done!"
para "I hope that"
line "was helpful!"
done

View file

@ -148,14 +148,14 @@ ItemEffects:
dw NoEffect ; STAR_PIECE
dw BasementKeyEffect ; BASEMENT_KEY
dw NoEffect ; PASS
dw NoEffect ; ITEM_87
dw NoEffect ; ITEM_88
dw NoEffect ; ITEM_89
dw EvoStoneEffect ; HEART_STONE
dw EvoStoneEffect ; POISON_STONE
dw EvoStoneEffect ; ICE_STONE
dw NoEffect ; CHARCOAL
dw RestoreHPEffect ; BERRY_JUICE
dw NoEffect ; SCOPE_LENS
dw NoEffect ; ITEM_8D
dw NoEffect ; ITEM_8E
dw EvoStoneEffect ; DUSK_STONE
dw EvoStoneEffect ; SHINY_STONE
dw NoEffect ; METAL_COAT
dw NoEffect ; DRAGON_FANG
dw NoEffect ; ITEM_91