pokecrystal-board/engine/events/daycare.asm

793 lines
14 KiB
NASM
Raw Normal View History

2015-12-18 17:07:09 -08:00
const_def
const DAYCARETEXT_MAN_INTRO
const DAYCARETEXT_MAN_EGG
const DAYCARETEXT_LADY_INTRO
const DAYCARETEXT_LADY_EGG
const DAYCARETEXT_WHICH_ONE
const DAYCARETEXT_DEPOSIT
const DAYCARETEXT_CANT_BREED_EGG
const DAYCARETEXT_LAST_MON
const DAYCARETEXT_LAST_ALIVE_MON
const DAYCARETEXT_COME_BACK_LATER
const DAYCARETEXT_REMOVE_MAIL
const DAYCARETEXT_GENIUSES
const DAYCARETEXT_ASK_WITHDRAW
const DAYCARETEXT_WITHDRAW
const DAYCARETEXT_TOO_SOON
const DAYCARETEXT_PARTY_FULL
const DAYCARETEXT_NOT_ENOUGH_MONEY
const DAYCARETEXT_OH_FINE
const DAYCARETEXT_COME_AGAIN
2015-12-18 17:07:09 -08:00
const DAYCARETEXT_13
2015-11-16 18:46:36 -08:00
Special_DayCareMan: ; 166d6
ld hl, wDayCareMan
2015-11-16 18:46:36 -08:00
bit 0, [hl]
2015-12-18 17:07:09 -08:00
jr nz, .AskWithdrawMon
ld hl, wDayCareMan
ld a, DAYCARETEXT_MAN_INTRO
2015-12-18 17:07:09 -08:00
call DayCareManIntroText
jr c, .cancel
call DayCareAskDepositPokemon
jr c, .print_text
2017-12-24 09:47:30 -08:00
farcall DepositMonWithDayCareMan
ld hl, wDayCareMan
2015-11-16 18:46:36 -08:00
set 0, [hl]
2015-12-18 17:07:09 -08:00
call DayCare_DepositPokemonText
call DayCare_InitBreeding
2015-11-16 18:46:36 -08:00
ret
.AskWithdrawMon:
2017-12-24 09:47:30 -08:00
farcall GetBreedMon1LevelGrowth
2015-11-16 18:46:36 -08:00
ld hl, wBreedMon1Nick
call GetPriceToRetrieveBreedmon
call DayCare_AskWithdrawBreedMon
2015-12-18 17:07:09 -08:00
jr c, .print_text
2017-12-24 09:47:30 -08:00
farcall RetrievePokemonFromDayCareMan
call DayCare_TakeMoney_PlayCry
ld hl, wDayCareMan
2015-11-16 18:46:36 -08:00
res 0, [hl]
res 5, [hl]
2015-12-18 17:07:09 -08:00
jr .cancel
2015-11-16 18:46:36 -08:00
2015-12-18 17:07:09 -08:00
.print_text
call PrintDayCareText
2015-11-16 18:46:36 -08:00
2015-12-18 17:07:09 -08:00
.cancel
ld a, DAYCARETEXT_13
call PrintDayCareText
2015-11-16 18:46:36 -08:00
ret
; 1672a
Special_DayCareLady: ; 1672a
ld hl, wDayCareLady
2015-11-16 18:46:36 -08:00
bit 0, [hl]
2015-12-18 17:07:09 -08:00
jr nz, .AskWithdrawMon
ld hl, wDayCareLady
ld a, DAYCARETEXT_LADY_INTRO
2015-12-18 17:07:09 -08:00
call DayCareLadyIntroText
jr c, .cancel
call DayCareAskDepositPokemon
jr c, .print_text
2017-12-24 09:47:30 -08:00
farcall DepositMonWithDayCareLady
ld hl, wDayCareLady
2015-11-16 18:46:36 -08:00
set 0, [hl]
2015-12-18 17:07:09 -08:00
call DayCare_DepositPokemonText
call DayCare_InitBreeding
2015-11-16 18:46:36 -08:00
ret
.AskWithdrawMon:
2017-12-24 09:47:30 -08:00
farcall GetBreedMon2LevelGrowth
2015-11-16 18:46:36 -08:00
ld hl, wBreedMon2Nick
call GetPriceToRetrieveBreedmon
call DayCare_AskWithdrawBreedMon
2015-12-18 17:07:09 -08:00
jr c, .print_text
2017-12-24 09:47:30 -08:00
farcall RetrievePokemonFromDayCareLady
call DayCare_TakeMoney_PlayCry
ld hl, wDayCareLady
2015-11-16 18:46:36 -08:00
res 0, [hl]
ld hl, wDayCareMan
2015-11-16 18:46:36 -08:00
res 5, [hl]
2015-12-18 17:07:09 -08:00
jr .cancel
2015-11-16 18:46:36 -08:00
2015-12-18 17:07:09 -08:00
.print_text
call PrintDayCareText
2015-11-16 18:46:36 -08:00
2015-12-18 17:07:09 -08:00
.cancel
ld a, DAYCARETEXT_13
call PrintDayCareText
2015-11-16 18:46:36 -08:00
ret
; 16781
2015-12-18 17:07:09 -08:00
DayCareLadyIntroText: ; 16781
2015-11-16 18:46:36 -08:00
bit 7, [hl]
2015-12-18 17:07:09 -08:00
jr nz, .okay
2015-11-16 18:46:36 -08:00
set 7, [hl]
inc a
2015-12-18 17:07:09 -08:00
.okay
call PrintDayCareText
2015-11-16 18:46:36 -08:00
call YesNoBox
ret
; 1678f
2015-12-18 17:07:09 -08:00
DayCareManIntroText: ; 1678f
2015-11-16 18:46:36 -08:00
set 7, [hl]
2015-12-18 17:07:09 -08:00
call PrintDayCareText
2015-11-16 18:46:36 -08:00
call YesNoBox
ret
; 16798
2015-12-18 17:07:09 -08:00
DayCareAskDepositPokemon: ; 16798
2015-11-16 18:46:36 -08:00
ld a, [PartyCount]
cp 2
2015-12-18 17:07:09 -08:00
jr c, .OnlyOneMon
ld a, DAYCARETEXT_WHICH_ONE
2015-12-18 17:07:09 -08:00
call PrintDayCareText
ld b, PARTYMENUACTION_GIVE_MON
2017-12-24 09:47:30 -08:00
farcall SelectTradeOrDayCareMon
2015-12-18 17:07:09 -08:00
jr c, .Declined
2015-11-16 18:46:36 -08:00
ld a, [CurPartySpecies]
cp EGG
2015-12-18 17:07:09 -08:00
jr z, .Egg
2017-12-24 09:47:30 -08:00
farcall CheckCurPartyMonFainted
2015-12-18 17:07:09 -08:00
jr c, .OutOfUsableMons
2015-11-16 18:46:36 -08:00
ld hl, PartyMon1Item
ld bc, PARTYMON_STRUCT_LENGTH
ld a, [CurPartyMon]
call AddNTimes
ld d, [hl]
2017-12-24 09:47:30 -08:00
farcall ItemIsMail
2015-12-18 17:07:09 -08:00
jr c, .HoldingMail
2015-11-16 18:46:36 -08:00
ld hl, PartyMonNicknames
ld a, [CurPartyMon]
call GetNick
and a
ret
.Declined:
ld a, DAYCARETEXT_COME_AGAIN
2015-11-16 18:46:36 -08:00
scf
ret
.Egg:
ld a, DAYCARETEXT_CANT_BREED_EGG
2015-11-16 18:46:36 -08:00
scf
ret
.OnlyOneMon:
ld a, DAYCARETEXT_LAST_MON
2015-11-16 18:46:36 -08:00
scf
ret
.OutOfUsableMons:
ld a, DAYCARETEXT_LAST_ALIVE_MON
2015-11-16 18:46:36 -08:00
scf
ret
.HoldingMail:
ld a, DAYCARETEXT_REMOVE_MAIL
2015-11-16 18:46:36 -08:00
scf
ret
; 167f1
2015-12-18 17:07:09 -08:00
.DummyText: ; 0x167f1
2015-11-16 18:46:36 -08:00
;
text_jump UnknownText_0x1bdaa7
db "@"
; 0x167f6
2015-12-18 17:07:09 -08:00
DayCare_DepositPokemonText: ; 167f6
ld a, DAYCARETEXT_DEPOSIT
2015-12-18 17:07:09 -08:00
call PrintDayCareText
2015-11-16 18:46:36 -08:00
ld a, [CurPartySpecies]
call PlayCry
ld a, DAYCARETEXT_COME_BACK_LATER
2015-12-18 17:07:09 -08:00
call PrintDayCareText
2015-11-16 18:46:36 -08:00
ret
; 16807
DayCare_AskWithdrawBreedMon: ; 16807
2015-11-16 18:46:36 -08:00
ld a, [StringBuffer2 + 1]
and a
jr nz, .grew_at_least_one_level
ld a, DAYCARETEXT_PARTY_FULL
2015-12-18 17:07:09 -08:00
call PrintDayCareText
2015-11-16 18:46:36 -08:00
call YesNoBox
jr c, .refused
jr .check_money
2015-11-16 18:46:36 -08:00
.grew_at_least_one_level
ld a, DAYCARETEXT_GENIUSES
2015-12-18 17:07:09 -08:00
call PrintDayCareText
2015-11-16 18:46:36 -08:00
call YesNoBox
jr c, .refused
ld a, DAYCARETEXT_ASK_WITHDRAW
2015-12-18 17:07:09 -08:00
call PrintDayCareText
2015-11-16 18:46:36 -08:00
call YesNoBox
jr c, .refused
2015-11-16 18:46:36 -08:00
.check_money
2015-11-16 18:46:36 -08:00
ld de, Money
ld bc, StringBuffer2 + 2
2017-12-24 09:47:30 -08:00
farcall CompareMoney
jr c, .not_enough_money
2015-11-16 18:46:36 -08:00
ld a, [PartyCount]
cp PARTY_LENGTH
jr nc, .PartyFull
2015-11-16 18:46:36 -08:00
and a
ret
.refused
ld a, DAYCARETEXT_COME_AGAIN
2015-11-16 18:46:36 -08:00
scf
ret
.not_enough_money
ld a, DAYCARETEXT_OH_FINE
2015-11-16 18:46:36 -08:00
scf
ret
.PartyFull:
ld a, DAYCARETEXT_NOT_ENOUGH_MONEY
2015-11-16 18:46:36 -08:00
scf
ret
; 16850
DayCare_TakeMoney_PlayCry: ; 16850
2015-11-16 18:46:36 -08:00
ld bc, StringBuffer2 + 2
ld de, Money
2017-12-24 09:47:30 -08:00
farcall TakeMoney
ld a, DAYCARETEXT_WITHDRAW
2015-12-18 17:07:09 -08:00
call PrintDayCareText
2015-11-16 18:46:36 -08:00
ld a, [CurPartySpecies]
call PlayCry
ld a, DAYCARETEXT_TOO_SOON
2015-12-18 17:07:09 -08:00
call PrintDayCareText
2015-11-16 18:46:36 -08:00
ret
; 1686d
GetPriceToRetrieveBreedmon: ; 1686d
2015-11-16 18:46:36 -08:00
ld a, b
ld [StringBuffer2], a
ld a, d
ld [StringBuffer2 + 1], a
ld de, StringBuffer1
ld bc, NAME_LENGTH
call CopyBytes
ld hl, 0
ld bc, 100
2015-11-16 18:46:36 -08:00
ld a, [StringBuffer2 + 1]
call AddNTimes
ld de, 100
2015-11-16 18:46:36 -08:00
add hl, de
xor a
ld [StringBuffer2 + 2], a
ld a, h
ld [StringBuffer2 + 3], a
ld a, l
ld [StringBuffer2 + 4], a
ret
; 1689b
2015-12-18 17:07:09 -08:00
PrintDayCareText: ; 1689b
2015-11-16 18:46:36 -08:00
ld e, a
ld d, 0
ld hl, .TextTable
2015-11-16 18:46:36 -08:00
add hl, de
2015-12-26 18:59:03 -08:00
add hl, de
2015-11-16 18:46:36 -08:00
ld a, [hli]
ld h, [hl]
ld l, a
call PrintText
ret
; 168aa
.TextTable: ; 168aa
2015-12-18 17:07:09 -08:00
dw .DayCareManIntro ; 00
dw .DayCareManOddEgg ; 01
dw .DayCareLadyIntro ; 02
dw .DayCareLadyOddEgg ; 03
dw .WhichOne ; 04
dw .OkayIllRaiseYourMon ; 05
dw .CantAcceptEgg ; 06
dw .JustOneMon ; 07
dw .LastHealthyMon ; 08
dw .ComeBackForItLater ; 09
dw .RemoveMail ; 0a
dw .AreWeGeniusesOrWhat ; 0b
dw .AskRetrieveMon ; 0c
dw .PerfectHeresYourMon ; 0d
dw .GotBackMon ; 0e
dw .ImmediatelyWithdrawMon ; 0f
dw .PartyFull ; 10
dw .NotEnoughMoney ; 11
dw .OhFineThen ; 12
dw .ComeAgain ; 13
2015-11-16 18:46:36 -08:00
; 168d2
2015-12-18 17:07:09 -08:00
.DayCareManIntro: ; 0x168d2
2015-11-16 18:46:36 -08:00
; I'm the DAY-CARE MAN. Want me to raise a #MON?
text_jump UnknownText_0x1bdaa9
db "@"
; 0x168d7
2015-12-18 17:07:09 -08:00
.DayCareManOddEgg: ; 0x168d7
2015-11-16 18:46:36 -08:00
; I'm the DAY-CARE MAN. Do you know about EGGS? I was raising #MON with my wife, you see. We were shocked to find an EGG! How incredible is that? So, want me to raise a #MON?
text_jump UnknownText_0x1bdad8
db "@"
; 0x168dc
2015-12-18 17:07:09 -08:00
.DayCareLadyIntro: ; 0x168dc
2015-11-16 18:46:36 -08:00
; I'm the DAY-CARE LADY. Should I raise a #MON for you?
text_jump UnknownText_0x1bdb85
db "@"
; 0x168e1
2015-12-18 17:07:09 -08:00
.DayCareLadyOddEgg: ; 0x168e1
2015-11-16 18:46:36 -08:00
; I'm the DAY-CARE LADY. Do you know about EGGS? My husband and I were raising some #MON, you see. We were shocked to find an EGG! How incredible could that be? Should I raise a #MON for you?
text_jump UnknownText_0x1bdbbb
db "@"
; 0x168e6
2015-12-18 17:07:09 -08:00
.WhichOne: ; 0x168e6
2015-11-16 18:46:36 -08:00
; What should I raise for you?
text_jump UnknownText_0x1bdc79
db "@"
; 0x168eb
2015-12-18 17:07:09 -08:00
.JustOneMon: ; 0x168eb
2015-11-16 18:46:36 -08:00
; Oh? But you have just one #MON.
text_jump UnknownText_0x1bdc97
db "@"
; 0x168f0
2015-12-18 17:07:09 -08:00
.CantAcceptEgg: ; 0x168f0
2015-11-16 18:46:36 -08:00
; Sorry, but I can't accept an EGG.
text_jump UnknownText_0x1bdcb8
db "@"
; 0x168f5
2015-12-18 17:07:09 -08:00
.RemoveMail: ; 0x168f5
2015-11-16 18:46:36 -08:00
; Remove MAIL before you come see me.
text_jump UnknownText_0x1bdcda
db "@"
; 0x168fa
2015-12-18 17:07:09 -08:00
.LastHealthyMon: ; 0x168fa
2015-11-16 18:46:36 -08:00
; If you give me that, what will you battle with?
text_jump UnknownText_0x1bdcff
db "@"
; 0x168ff
2015-12-18 17:07:09 -08:00
.OkayIllRaiseYourMon: ; 0x168ff
2015-11-16 18:46:36 -08:00
; OK. I'll raise your @ .
text_jump UnknownText_0x1bdd30
db "@"
; 0x16904
2015-12-18 17:07:09 -08:00
.ComeBackForItLater: ; 0x16904
2015-11-16 18:46:36 -08:00
; Come back for it later.
text_jump UnknownText_0x1bdd4b
db "@"
; 0x16909
2015-12-18 17:07:09 -08:00
.AreWeGeniusesOrWhat: ; 0x16909
2015-11-16 18:46:36 -08:00
; Are we geniuses or what? Want to see your @ ?
text_jump UnknownText_0x1bdd64
db "@"
; 0x1690e
2015-12-18 17:07:09 -08:00
.AskRetrieveMon: ; 0x1690e
2015-11-16 18:46:36 -08:00
; Your @ has grown a lot. By level, it's grown by @ . If you want your #MON back, it will cost ¥@ .
text_jump UnknownText_0x1bdd96
db "@"
; 0x16913
2015-12-18 17:07:09 -08:00
.PerfectHeresYourMon: ; 0x16913
2015-11-16 18:46:36 -08:00
; Perfect! Here's your #MON.
text_jump UnknownText_0x1bde04
db "@"
; 0x16918
2015-12-18 17:07:09 -08:00
.GotBackMon: ; 0x16918
2015-11-16 18:46:36 -08:00
; got back @ .
text_jump UnknownText_0x1bde1f
db "@"
; 0x1691d
2015-12-18 17:07:09 -08:00
.ImmediatelyWithdrawMon: ; 0x1691d
2015-11-16 18:46:36 -08:00
; Huh? Back already? Your @ needs a little more time with us. If you want your #MON back, it will cost ¥100.
text_jump UnknownText_0x1bde32
db "@"
; 0x16922
2015-12-18 17:07:09 -08:00
.PartyFull: ; 0x16922
2015-11-16 18:46:36 -08:00
; You have no room for it.
text_jump UnknownText_0x1bdea2
db "@"
; 0x16927
2015-12-18 17:07:09 -08:00
.NotEnoughMoney: ; 0x16927
2015-11-16 18:46:36 -08:00
; You don't have enough money.
text_jump UnknownText_0x1bdebc
db "@"
; 0x1692c
2015-12-18 17:07:09 -08:00
.OhFineThen: ; 0x1692c
2015-11-16 18:46:36 -08:00
; Oh, fine then.
text_jump UnknownText_0x1bded9
db "@"
; 0x16931
2015-12-18 17:07:09 -08:00
.ComeAgain: ; 0x16931
2015-11-16 18:46:36 -08:00
; Come again.
text_jump UnknownText_0x1bdee9
db "@"
; 0x16936
Special_DayCareManOutside: ; 16936
ld hl, wDayCareMan
2015-11-16 18:46:36 -08:00
bit 6, [hl]
2015-12-18 17:07:09 -08:00
jr nz, .AskGiveEgg
ld hl, .NotYet
2015-11-16 18:46:36 -08:00
call PrintText
ret
2015-12-18 17:07:09 -08:00
.NotYet: ; 0x16944
2015-11-16 18:46:36 -08:00
; Not yet…
text_jump UnknownText_0x1bdef6
db "@"
; 0x16949
2015-12-18 17:07:09 -08:00
.AskGiveEgg: ; 16949
ld hl, .IntroText
2015-11-16 18:46:36 -08:00
call PrintText
call YesNoBox
2015-12-18 17:07:09 -08:00
jr c, .Declined
2015-11-16 18:46:36 -08:00
ld a, [PartyCount]
cp PARTY_LENGTH
2015-12-18 17:07:09 -08:00
jr nc, .PartyFull
call DayCare_GiveEgg
ld hl, wDayCareMan
2015-11-16 18:46:36 -08:00
res 6, [hl]
2015-12-18 17:07:09 -08:00
call DayCare_InitBreeding
ld hl, .GotEggText
2015-11-16 18:46:36 -08:00
call PrintText
ld de, SFX_GET_EGG_FROM_DAY_CARE_LADY
2015-11-16 18:46:36 -08:00
call PlaySFX
ld c, 120
call DelayFrames
2015-12-18 17:07:09 -08:00
ld hl, .TakeGoodCareOfItText
jr .Load0
2015-11-16 18:46:36 -08:00
.Declined:
2015-12-18 17:07:09 -08:00
ld hl, .IllKeepItThanksText
2015-11-16 18:46:36 -08:00
.Load0:
2015-11-16 18:46:36 -08:00
call PrintText
xor a
ld [ScriptVar], a
ret
.PartyFull:
2015-12-18 17:07:09 -08:00
ld hl, .PartyFullText
2015-11-16 18:46:36 -08:00
call PrintText
ld a, $1
ld [ScriptVar], a
ret
; 16993
2015-12-18 17:07:09 -08:00
.IntroText: ; 0x16993
2015-11-16 18:46:36 -08:00
; Ah, it's you! We were raising your #MON, and my goodness, were we surprised! Your #MON had an EGG! We don't know how it got there, but your #MON had it. You want it?
text_jump UnknownText_0x1bdf00
db "@"
; 0x16998
2015-12-18 17:07:09 -08:00
.GotEggText: ; 0x16998
2015-11-16 18:46:36 -08:00
; received the EGG!
text_jump UnknownText_0x1bdfa5
db "@"
; 0x1699d
2015-12-18 17:07:09 -08:00
.TakeGoodCareOfItText: ; 0x1699d
2015-11-16 18:46:36 -08:00
; Take good care of it.
text_jump UnknownText_0x1bdfba
db "@"
; 0x169a2
2015-12-18 17:07:09 -08:00
.IllKeepItThanksText: ; 0x169a2
2015-11-16 18:46:36 -08:00
; Well then, I'll keep it. Thanks!
text_jump UnknownText_0x1bdfd1
db "@"
; 0x169a7
2015-12-18 17:07:09 -08:00
.PartyFullText: ; 0x169a7
2015-11-16 18:46:36 -08:00
; You have no room in your party. Come back later.
text_jump UnknownText_0x1bdff2
db "@"
; 0x169ac
2015-12-18 17:07:09 -08:00
DayCare_GiveEgg: ; 169ac
2015-11-16 18:46:36 -08:00
ld a, [wEggMonLevel]
ld [CurPartyLevel], a
ld hl, PartyCount
ld a, [hl]
cp PARTY_LENGTH
2015-12-18 17:07:09 -08:00
jr nc, .PartyFull
2015-11-16 18:46:36 -08:00
inc a
ld [hl], a
2015-12-18 17:07:09 -08:00
2015-11-16 18:46:36 -08:00
ld c, a
ld b, 0
add hl, bc
ld a, EGG
ld [hli], a
ld a, [wEggMonSpecies]
ld [CurSpecies], a
ld [CurPartySpecies], a
2015-12-18 17:07:09 -08:00
ld a, -1
2015-11-16 18:46:36 -08:00
ld [hl], a
2015-12-18 17:07:09 -08:00
2015-11-16 18:46:36 -08:00
ld hl, PartyMonNicknames
ld bc, PKMN_NAME_LENGTH
2015-12-18 17:07:09 -08:00
call DayCare_GetCurrentPartyMember
2015-11-16 18:46:36 -08:00
ld hl, wEggNick
call CopyBytes
2015-12-18 17:07:09 -08:00
2015-11-16 18:46:36 -08:00
ld hl, PartyMonOT
ld bc, NAME_LENGTH
2015-12-18 17:07:09 -08:00
call DayCare_GetCurrentPartyMember
2015-11-16 18:46:36 -08:00
ld hl, wEggOT
call CopyBytes
2015-12-18 17:07:09 -08:00
2015-11-16 18:46:36 -08:00
ld hl, PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
2015-12-18 17:07:09 -08:00
call DayCare_GetCurrentPartyMember
2015-11-16 18:46:36 -08:00
ld hl, wEggMon
ld bc, wEggMonEnd - wEggMon
call CopyBytes
2015-12-18 17:07:09 -08:00
2015-11-16 18:46:36 -08:00
call GetBaseData
ld a, [PartyCount]
dec a
ld hl, PartyMon1
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld b, h
ld c, l
ld hl, MON_ID + 1
add hl, bc
push hl
ld hl, MON_MAXHP
add hl, bc
ld d, h
ld e, l
pop hl
push bc
ld b, $0
predef CalcPkmnStats
pop bc
ld hl, MON_HP
add hl, bc
xor a
ld [hli], a
ld [hl], a
and a
ret
.PartyFull:
2015-11-16 18:46:36 -08:00
scf
ret
; 16a31
2015-12-18 17:07:09 -08:00
DayCare_GetCurrentPartyMember: ; 16a31
2015-11-16 18:46:36 -08:00
ld a, [PartyCount]
dec a
call AddNTimes
ld d, h
ld e, l
ret
; 16a3b
2015-12-18 17:07:09 -08:00
DayCare_InitBreeding: ; 16a3b
ld a, [wDayCareLady]
2015-11-16 18:46:36 -08:00
bit 0, a
ret z
ld a, [wDayCareMan]
2015-11-16 18:46:36 -08:00
bit 0, a
ret z
2017-12-24 09:47:30 -08:00
callfar CheckBreedmonCompatibility
2015-11-16 18:46:36 -08:00
ld a, [wd265]
and a
ret z
inc a
ret z
ld hl, wDayCareMan
2015-11-16 18:46:36 -08:00
set 5, [hl]
2015-12-18 17:07:09 -08:00
.loop
2015-11-16 18:46:36 -08:00
call Random
cp 150
2015-12-18 17:07:09 -08:00
jr c, .loop
2015-11-16 18:46:36 -08:00
ld [wStepsToEgg], a
2015-12-18 17:07:09 -08:00
jp .UselessJump
2015-11-16 18:46:36 -08:00
; 16a66
2015-12-18 17:07:09 -08:00
.UselessJump: ; 16a66
2015-11-16 18:46:36 -08:00
xor a
ld hl, wEggMon
ld bc, wEggMonEnd - wEggMon
call ByteFill
ld hl, wEggNick
ld bc, PKMN_NAME_LENGTH
call ByteFill
ld hl, wEggOT
ld bc, NAME_LENGTH
call ByteFill
ld a, [wBreedMon1DVs]
ld [TempMonDVs], a
ld a, [wBreedMon1DVs + 1]
ld [TempMonDVs + 1], a
ld a, [wBreedMon1Species]
ld [CurPartySpecies], a
ld a, $3
ld [MonType], a
ld a, [wBreedMon1Species]
cp DITTO
ld a, $1
2015-12-18 17:07:09 -08:00
jr z, .LoadWhichBreedmonIsTheMother
2015-11-16 18:46:36 -08:00
ld a, [wBreedMon2Species]
cp DITTO
ld a, $0
2015-12-18 17:07:09 -08:00
jr z, .LoadWhichBreedmonIsTheMother
2017-12-24 09:47:30 -08:00
farcall GetGender
2015-11-16 18:46:36 -08:00
ld a, $0
2015-12-18 17:07:09 -08:00
jr z, .LoadWhichBreedmonIsTheMother
2015-11-16 18:46:36 -08:00
inc a
.LoadWhichBreedmonIsTheMother:
2015-12-18 17:07:09 -08:00
ld [wBreedMotherOrNonDitto], a
2015-11-16 18:46:36 -08:00
and a
ld a, [wBreedMon1Species]
2015-12-18 17:07:09 -08:00
jr z, .GotMother
2015-11-16 18:46:36 -08:00
ld a, [wBreedMon2Species]
.GotMother:
2015-11-16 18:46:36 -08:00
ld [CurPartySpecies], a
2017-12-24 09:47:30 -08:00
callfar GetPreEvolution
callfar GetPreEvolution
2015-11-16 18:46:36 -08:00
ld a, EGG_LEVEL
ld [CurPartyLevel], a
ld a, [CurPartySpecies]
cp NIDORAN_F
2015-12-18 17:07:09 -08:00
jr nz, .GotEggSpecies
2015-11-16 18:46:36 -08:00
call Random
2015-12-18 17:07:09 -08:00
cp 1 + 50 percent
2015-11-16 18:46:36 -08:00
ld a, NIDORAN_F
2015-12-18 17:07:09 -08:00
jr c, .GotEggSpecies
2015-11-16 18:46:36 -08:00
ld a, NIDORAN_M
.GotEggSpecies:
2015-11-16 18:46:36 -08:00
ld [CurPartySpecies], a
ld [CurSpecies], a
ld [wEggMonSpecies], a
call GetBaseData
ld hl, wEggNick
2015-12-18 17:07:09 -08:00
ld de, .String_EGG
2015-11-16 18:46:36 -08:00
call CopyName2
ld hl, PlayerName
ld de, wEggOT
ld bc, NAME_LENGTH
call CopyBytes
xor a
ld [wEggMonItem], a
ld de, wEggMonMoves
xor a
ld [Buffer1], a
predef FillMoves
2017-12-24 09:47:30 -08:00
farcall InitEggMoves
2015-11-16 18:46:36 -08:00
ld hl, wEggMonID
ld a, [PlayerID]
ld [hli], a
ld a, [PlayerID + 1]
ld [hl], a
ld a, [CurPartyLevel]
ld d, a
2017-12-24 09:47:30 -08:00
callfar CalcExpAtLevel
2015-11-16 18:46:36 -08:00
ld hl, wEggMonExp
ld a, [hMultiplicand]
ld [hli], a
2015-12-18 17:07:09 -08:00
ld a, [hMultiplicand + 1]
2015-11-16 18:46:36 -08:00
ld [hli], a
2015-12-18 17:07:09 -08:00
ld a, [hMultiplicand + 2]
2015-11-16 18:46:36 -08:00
ld [hl], a
xor a
2015-12-18 17:07:09 -08:00
ld b, wEggMonDVs - wEggMonStatExp
2015-11-16 18:46:36 -08:00
ld hl, wEggMonStatExp
2015-12-18 17:07:09 -08:00
.loop2
2015-11-16 18:46:36 -08:00
ld [hli], a
dec b
2015-12-18 17:07:09 -08:00
jr nz, .loop2
2015-11-16 18:46:36 -08:00
ld hl, wEggMonDVs
call Random
ld [hli], a
ld [TempMonDVs], a
call Random
ld [hld], a
ld [TempMonDVs + 1], a
ld de, wBreedMon1DVs
ld a, [wBreedMon1Species]
cp DITTO
2015-12-18 17:07:09 -08:00
jr z, .GotDVs
2015-11-16 18:46:36 -08:00
ld de, wBreedMon2DVs
ld a, [wBreedMon2Species]
cp DITTO
2015-12-18 17:07:09 -08:00
jr z, .GotDVs
2016-05-11 14:16:03 -07:00
ld a, TEMPMON
2015-11-16 18:46:36 -08:00
ld [MonType], a
push hl
2017-12-24 09:47:30 -08:00
farcall GetGender
2015-11-16 18:46:36 -08:00
pop hl
ld de, wBreedMon1DVs
ld bc, wBreedMon2DVs
2015-12-18 17:07:09 -08:00
jr c, .SkipDVs
jr z, .ParentCheck2
ld a, [wBreedMotherOrNonDitto]
2015-11-16 18:46:36 -08:00
and a
2015-12-18 17:07:09 -08:00
jr z, .GotDVs
2015-11-16 18:46:36 -08:00
ld d, b
ld e, c
2015-12-18 17:07:09 -08:00
jr .GotDVs
2015-11-16 18:46:36 -08:00
.ParentCheck2:
2015-12-18 17:07:09 -08:00
ld a, [wBreedMotherOrNonDitto]
2015-11-16 18:46:36 -08:00
and a
2015-12-18 17:07:09 -08:00
jr nz, .GotDVs
2015-11-16 18:46:36 -08:00
ld d, b
ld e, c
.GotDVs:
2015-11-16 18:46:36 -08:00
ld a, [de]
inc de
and $f
ld b, a
ld a, [hl]
and $f0
add b
ld [hli], a
ld a, [de]
and $7
ld b, a
ld a, [hl]
and $f8
add b
ld [hl], a
.SkipDVs:
2015-11-16 18:46:36 -08:00
ld hl, StringBuffer1
2015-12-18 17:07:09 -08:00
ld de, wMonOrItemNameBuffer
2015-11-16 18:46:36 -08:00
ld bc, NAME_LENGTH
call CopyBytes
ld hl, wEggMonMoves
ld de, wEggMonPP
predef FillPP
2015-12-18 17:07:09 -08:00
ld hl, wMonOrItemNameBuffer
2015-11-16 18:46:36 -08:00
ld de, StringBuffer1
ld bc, NAME_LENGTH
call CopyBytes
ld a, [BaseEggSteps]
ld hl, wEggMonHappiness
ld [hli], a
xor a
ld [hli], a
2015-12-26 18:59:03 -08:00
ld [hli], a
2015-11-16 18:46:36 -08:00
ld [hl], a
ld a, [CurPartyLevel]
ld [wEggMonLevel], a
ret
; 16be0
2015-12-18 17:07:09 -08:00
.String_EGG: ; 16be0
2015-11-16 18:46:36 -08:00
db "EGG@"
; 16be4