Skip to content

Commit

Permalink
Wonder Trade uses random trainer names
Browse files Browse the repository at this point in the history
  • Loading branch information
JustRegularLuna committed Nov 6, 2018
1 parent b15c7c5 commit e3bb4bb
Show file tree
Hide file tree
Showing 2 changed files with 538 additions and 10 deletions.
33 changes: 23 additions & 10 deletions engine/wonder_trade.asm
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ WonderTrade_PrepareTradeData: ; Get the data setup for the trade
ld de, wTradedPlayerMonOT
ld bc, $b
call WonderTrade_CopyData
ld hl, WonderTrade_TrainerString
ld bc, $2
ld hl, hRandomAdd
ld de, wTradedEnemyMonOTID
call WonderTrade_CopyData
call WonderTrade_GetOTName
ld bc, $8
ld de, wTradedEnemyMonOT
call WonderTrade_CopyData
ld de, wLinkEnemyTrainerName
Expand All @@ -171,11 +176,7 @@ WonderTrade_PrepareTradeData: ; Get the data setup for the trade
call AddNTimes
ld de, wTradedPlayerMonOTID
ld bc, $2
call WonderTrade_CopyData
call Random
ld hl, hRandomAdd
ld de, wTradedEnemyMonOTID
jp CopyData
jp WonderTrade_CopyData

; copies name of species a to hl
WonderTrade_GetMonName:
Expand Down Expand Up @@ -206,8 +207,8 @@ WonderTrade_CopyDataToReceivedMon: ; Copy the Nickname and OT from RAM to the Po
ld hl, wPartyMonOT
ld bc, $b
call WonderTrade_GetReceivedMonPointer
ld hl, WonderTrade_TrainerString
ld bc, $b
ld hl, wLinkEnemyTrainerName
ld bc, $8
call CopyData
ld hl, wPartyMon1OTID
ld bc, wPartyMon2 - wPartyMon1
Expand All @@ -226,8 +227,18 @@ WonderTrade_GetReceivedMonPointer:
ld d, h
ret

WonderTrade_TrainerString:
db "Mystery@@@@"
WonderTrade_GetOTName:
ld hl, wTradedEnemyMonOTID
ld a, [hli]
and 1
ld a, [hl]
ld hl, WonderTradeOTNames1
jr z, .ok
ld hl, WonderTradeOTNames2
.ok
ld bc, $8
call AddNTimes
ret

; Stores a random Pokemon ID into register a
; Makes sure it is a valid Pokemon ID
Expand Down Expand Up @@ -555,3 +566,5 @@ AreYouSureText:
para "Are you sure you"
line "want to trade?@@"

INCLUDE "text/wonder_trade_OT_names.asm"
Loading

0 comments on commit e3bb4bb

Please sign in to comment.