Skip to content

Commit

Permalink
send gift mons w/o mail to box if party full (Rangi42#617)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdarsh authored Apr 8, 2021
1 parent 1b711b2 commit c08304a
Show file tree
Hide file tree
Showing 26 changed files with 327 additions and 595 deletions.
3 changes: 3 additions & 0 deletions constants/misc_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ MAX_DAY_CARE_EXP EQU $500000
; hall of fame
HOF_MASTER_COUNT EQU 200

; Kirk ID
KIRK_SHUCKIE_ID EQU 00518

; crash error codes
const_def
const ERR_RST_0
Expand Down
5 changes: 0 additions & 5 deletions data/events/special_pointers.asm
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ SpecialsPointers::
add_special Special_ActivateFishingSwarm
add_special ToggleMaptileDecorations
add_special ToggleDecorationsVisibility
add_special SpecialGiveShuckie
add_special ReturnShuckie
add_special TeachShuckiePoisonJab
add_special Special_BillsGrandfather
add_special SpecialCheckPokerus
add_special Special_DisplayCoinCaseBalance
Expand Down Expand Up @@ -115,7 +113,6 @@ SpecialsPointers::
add_special CheckCaughtCelebi
add_special JudgeMachine
add_special SpecialBuenasPassword
add_special TeachDratiniExtremeSpeed
add_special Special_SampleKenjiBreakCountdown
add_special SpecialBeastsCheck
add_special SpecialBirdsCheck
Expand Down Expand Up @@ -154,13 +151,11 @@ SpecialsPointers::
add_special RestoreMusic
add_special DeleteSavedMusic
add_special CheckIfTrendyPhraseIsLucky
add_special TeachMagikarpDragonRage
add_special Special_ChooseItem
add_special GetGourmetManiacPrice
add_special GetOreManiacPrice
add_special GetFossilManiacPrice
add_special Give_hMoneyTemp
add_special SetLastPartyMonBall
add_special CheckForSurfingPikachu
add_special InitializeHiddenGrotto
add_special GetHiddenGrottoContents
Expand Down
12 changes: 10 additions & 2 deletions data/text/common.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2588,8 +2588,16 @@ MailMovedFromBoxText::
line "from the Mailbox."
prompt

SECTION "Text_WasSentToBillsPC", ROMX
Text_WasSentToBillsPC::
SECTION "_ReceivedGiftMonText", ROMX
_ReceivedGiftMonText::
text "<PLAYER> received"
line ""
text_ram wStringBuffer1
text "!"
done

SECTION "_WasSentToBillsPCText", ROMX
_WasSentToBillsPCText::
text_ram wStringBuffer1
text " was"
line "sent to Bill's PC."
Expand Down
3 changes: 1 addition & 2 deletions engine/events/daycare.asm
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,7 @@ DayCare_GenerateEgg:

.GotMother:
ld [wCurPartySpecies], a
farcall GetPreEvolution
farcall GetPreEvolution
farcall GetBaseEvolution
ld a, EGG_LEVEL
ld [wCurPartyLevel], a

Expand Down
7 changes: 7 additions & 0 deletions engine/events/shiny_ditto.asm
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,10 @@ endr

.Nickname:
rawchar "Masuda@"

_GetLastPartyMonAttribute:
ld a, [wPartyCount]
dec a
ld bc, PARTYMON_STRUCT_LENGTH
rst AddNTimes
ret
73 changes: 0 additions & 73 deletions engine/events/shuckle.asm
Original file line number Diff line number Diff line change
@@ -1,73 +1,3 @@
KIRK_SHUCKIE_ID EQU 00518

SpecialGiveShuckie:
; Adding to the party.
xor a
ld [wMonType], a

; Level 20 Shuckle.
ld a, SHUCKLE
ld [wCurPartySpecies], a
ld a, 20
ld [wCurPartyLevel], a

predef TryAddMonToParty
jr nc, .NotGiven

; Caught data.
lb bc, MALE, NET_BALL
farcall SetGiftPartyMonCaughtData

; Holding a Berry Juice.
ld hl, wPartyMon1Item
call _GetLastPartyMonAttribute
ld [hl], BERRY_JUICE

; OT ID.
ld hl, wPartyMon1ID
call _GetLastPartyMonAttribute
ld a, HIGH(KIRK_SHUCKIE_ID)
ld [hli], a
ld [hl], LOW(KIRK_SHUCKIE_ID)

; Nickname.
ld a, [wPartyCount]
dec a
ld hl, wPartyMonNicknames
call SkipNames
ld de, SpecialShuckleNickname
call CopyName2

; OT and Extra.
ld a, [wPartyCount]
dec a
ld hl, wPartyMonOTs
call SkipNames
ld d, h
ld e, l
ld hl, SpecialShuckleOTAndExtra
ld bc, PLAYER_NAME_LENGTH + 3
rst CopyBytes

; Engine flag for this event.
ld hl, wDailyFlags
set 5, [hl] ; ENGINE_GOT_SHUCKIE_TODAY
ld a, TRUE
ldh [hScriptVar], a
ret

.NotGiven:
xor a ; ld a, FALSE
ldh [hScriptVar], a
ret

_GetLastPartyMonAttribute:
ld a, [wPartyCount]
dec a
ld bc, PARTYMON_STRUCT_LENGTH
rst AddNTimes
ret

ReturnShuckie:
farcall SelectMonFromParty
jr c, .refused
Expand Down Expand Up @@ -139,6 +69,3 @@ ReturnShuckie:
SpecialShuckleOTAndExtra:
rawchar "Kirk@@@@"
db 0, 0, 0

SpecialShuckleNickname:
rawchar "Shuckie@"
100 changes: 0 additions & 100 deletions engine/events/special_movesets.asm

This file was deleted.

7 changes: 2 additions & 5 deletions engine/link/link.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1658,11 +1658,8 @@ LinkTrade:
ld a, [hl]
ld [wCurPartySpecies], a
ld hl, wOTPartyMon1Species
ld a, c
call GetPartyLocation
ld de, wTempMonSpecies
ld bc, PARTYMON_STRUCT_LENGTH
rst CopyBytes
ld b, $80
farcall CopyBetweenPartyAndTemp
farcall AddTempMonToParty
ld a, [wPartyCount]
dec a
Expand Down
11 changes: 8 additions & 3 deletions engine/overworld/scripting.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,8 @@ Script_checkphonecall:
ret

Script_givepoke:
; return 0 in hScriptVar if no room in party or box
; return 1 if sent to party, return 2 if sent to box
call GetScriptByte
ld [wCurPartySpecies], a
call GetScriptByte
Expand All @@ -2007,17 +2009,20 @@ Script_givepoke:
call GetScriptByte
ld [wCurItem], a
call GetScriptByte
ld [wGiftMonBall], a
call GetScriptByte
ld [wCurPlayerMove], a
call GetScriptByte
and a
ld b, a
jr z, .ok
ld hl, wScriptPos
ld e, [hl]
inc hl
ld d, [hl]
rept 6
call GetScriptByte
call GetScriptByte
call GetScriptByte
call GetScriptByte
endr
.ok
farcall GivePoke
ld a, b
Expand Down
7 changes: 7 additions & 0 deletions engine/pokemon/evolve.asm
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,13 @@ EvoFlagAction:
pop de
ret

GetBaseEvolution:
; Find the first mon in the evolution chain including wCurPartySpecies.

; Return carry and the new species in wCurPartySpecies
; if a base evolution is found.

call GetPreEvolution
GetPreEvolution:
; Find the first mon to evolve into wCurPartySpecies.

Expand Down
Loading

0 comments on commit c08304a

Please sign in to comment.