diff options
author | Ryan Tandy <ryan@nardis.ca> | 2019-09-20 13:30:58 -0700 |
---|---|---|
committer | Ryan Tandy <ryan@nardis.ca> | 2019-09-20 13:30:58 -0700 |
commit | 111722c5e46588d34805b68e6eb59cfb05e099f2 (patch) | |
tree | 1934fdf2386397fc2546e2439a0f86113eb9fa2f | |
parent | cf4ab739af833709a6796e1434bee4dd07c1ea70 (diff) |
Sync daycare from pokecrystal
-rw-r--r-- | constants/engine_flags.asm | 6 | ||||
-rw-r--r-- | constants/wram_constants.asm | 11 | ||||
-rw-r--r-- | data/text/common_1.asm | 54 | ||||
-rw-r--r-- | engine/events/daycare.asm | 745 | ||||
-rwxr-xr-x | engine/events/happiness_egg.asm | 2 | ||||
-rwxr-xr-x | engine/move_mon.asm | 12 | ||||
-rw-r--r-- | main.asm | 34 | ||||
-rw-r--r-- | wram.asm | 7 |
8 files changed, 819 insertions, 52 deletions
diff --git a/constants/engine_flags.asm b/constants/engine_flags.asm index c4730b50..41d52d25 100644 --- a/constants/engine_flags.asm +++ b/constants/engine_flags.asm @@ -6,10 +6,10 @@ engine_flag_def ENGINE_EXPN_CARD, wPokegearFlags, 3 ; expn card engine_flag_def ENGINE_POKEGEAR, wPokegearFlags, 7 ; on/off - engine_flag_def ENGINE_DAY_CARE_MAN_HAS_EGG, wDayCareMan, 6 ; egg is ready - engine_flag_def ENGINE_DAY_CARE_MAN_HAS_MON, wDayCareMan, 0 ; monster 1 in daycare + engine_flag_def ENGINE_DAY_CARE_MAN_HAS_EGG, wDayCareMan, DAYCAREMAN_HAS_EGG_F + engine_flag_def ENGINE_DAY_CARE_MAN_HAS_MON, wDayCareMan, DAYCAREMAN_HAS_MON_F - engine_flag_def ENGINE_DAY_CARE_LADY_HAS_MON, wDaycareLady, 0 ; monster 2 in daycare + engine_flag_def ENGINE_DAY_CARE_LADY_HAS_MON, wDayCareLady, DAYCARELADY_HAS_MON_F engine_flag_def ENGINE_MOM_SAVING_MONEY, wMomSavingMoney, 0 ; mom saving money ; $8 engine_flag_def ENGINE_DST, wMomSavingMoney, 7 ; dst diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index 4c3917c8..656d2ef5 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -127,6 +127,17 @@ NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES REGISTERED_POCKET EQU %11000000 REGISTERED_NUMBER EQU %00111111 +; wDayCareMan:: ; dc40 +DAYCAREMAN_HAS_MON_F EQU 0 +DAYCAREMAN_MONS_COMPATIBLE_F EQU 5 +DAYCAREMAN_HAS_EGG_F EQU 6 + +; wDayCareLady:: ; dc77 +DAYCARELADY_HAS_MON_F EQU 0 + +; used with both wDayCareMan and wDayCareLady +DAYCARE_INTRO_SEEN_F EQU 7 + ; PlayerState: ; d95d PLAYER_NORMAL EQU 0 PLAYER_BIKE EQU 1 diff --git a/data/text/common_1.asm b/data/text/common_1.asm index 10c5c8aa..6012cdbc 100644 --- a/data/text/common_1.asm +++ b/data/text/common_1.asm @@ -1311,17 +1311,17 @@ UnknownText_0x1bda90:: line "you can." done -UnknownText_0x1bdaa7:: +_DaycareDummyText:: text_start done -UnknownText_0x1bdaa9:: +_DayCareManIntroText:: text "I'm the DAY-CARE" line "MAN. Want me to" cont "raise a #MON?" done -UnknownText_0x1bdad8:: +_DayCareManOddEggText:: text "I'm the DAY-CARE" line "MAN. Do you know" cont "about EGGS?" @@ -1340,7 +1340,7 @@ UnknownText_0x1bdad8:: line "raise a #MON?" done -UnknownText_0x1bdb85:: +_DayCareLadyIntroText:: text "I'm the DAY-CARE" line "LADY." @@ -1348,7 +1348,7 @@ UnknownText_0x1bdb85:: line "#MON for you?" done -UnknownText_0x1bdbbb:: +_DayCareLadyOddEggText:: text "I'm the DAY-CARE" line "LADY. Do you know" cont "about EGGS?" @@ -1367,45 +1367,45 @@ UnknownText_0x1bdbbb:: line "#MON for you?" done -UnknownText_0x1bdc79:: +_WhatShouldIRaiseText:: text "What should I" line "raise for you?" prompt -UnknownText_0x1bdc97:: +_OnlyOneMonText:: text "Oh? But you have" line "just one #MON." prompt -UnknownText_0x1bdcb8:: +_CantRaiseEggText:: text "Sorry, but I can't" line "accept an EGG." prompt -UnknownText_0x1bdcda:: +_RemoveMailText:: text "Remove MAIL before" line "you come see me." prompt -UnknownText_0x1bdcff:: +_LastHealthyMonText:: text "If you give me" line "that, what will" cont "you battle with?" prompt -UnknownText_0x1bdd30:: +_IllRaiseYourMonText:: text "OK. I'll raise" line "your @" text_from_ram wStringBuffer1 text "." prompt -UnknownText_0x1bdd4b:: +_ComeBackLaterText:: text "Come back for it" line "later." done -UnknownText_0x1bdd64:: +_AreWeGeniusesText:: text "Are we geniuses or" line "what? Want to see" cont "your @" @@ -1413,7 +1413,7 @@ UnknownText_0x1bdd64:: text "?" done -UnknownText_0x1bdd96:: +_YourMonHasGrownText:: text "Your @" text_from_ram wStringBuffer1 text_start @@ -1431,19 +1431,19 @@ UnknownText_0x1bdd96:: text "." done -UnknownText_0x1bde04:: +_PerfectHeresYourMonText:: text "Perfect! Here's" line "your #MON." prompt -UnknownText_0x1bde1f:: +_GotBackMonText:: text "<PLAYER> got back" line "@" text_from_ram wStringBuffer1 text "." prompt -UnknownText_0x1bde32:: +_BackAlreadyText:: text "Huh? Back already?" line "Your @" text_from_ram wStringBuffer1 @@ -1456,29 +1456,29 @@ UnknownText_0x1bde32:: cont "will cost ¥100." done -UnknownText_0x1bdea2:: +_HaveNoRoomText:: text "You have no room" line "for it." prompt -UnknownText_0x1bdebc:: +_DCNotEnoughMoneyText:: text "You don't have" line "enough money." prompt -UnknownText_0x1bded9:: +_OhFineThenText:: text "Oh, fine then." prompt -UnknownText_0x1bdee9:: +_ComeAgainText:: text "Come again." done -UnknownText_0x1bdef6:: +_NotYetText:: text "Not yet…" done -UnknownText_0x1bdf00:: +_FoundAnEggText:: text "Ah, it's you!" para "We were raising" @@ -1497,22 +1497,22 @@ UnknownText_0x1bdf00:: line "it. You want it?" done -UnknownText_0x1bdfa5:: +_ReceivedEggText:: text "<PLAYER> received" line "the EGG!" done -UnknownText_0x1bdfba:: +_TakeGoodCareOfEggText:: text "Take good care of" line "it." done -UnknownText_0x1bdfd1:: +_RefuseEggText:: text "Well then, I'll" line "keep it. Thanks!" done -UnknownText_0x1bdff2:: +_NoRoomForEggText:: text "You have no room" line "in your party." cont "Come back later." diff --git a/engine/events/daycare.asm b/engine/events/daycare.asm new file mode 100644 index 00000000..c06db6f1 --- /dev/null +++ b/engine/events/daycare.asm @@ -0,0 +1,745 @@ +; PrintDayCareText.TextTable indexes + 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_GOT_BACK + const DAYCARETEXT_TOO_SOON + const DAYCARETEXT_PARTY_FULL + const DAYCARETEXT_NOT_ENOUGH_MONEY + const DAYCARETEXT_OH_FINE + const DAYCARETEXT_COME_AGAIN + +DayCareMan: + ld hl, wDayCareMan + bit DAYCAREMAN_HAS_MON_F, [hl] + jr nz, .AskWithdrawMon + ld hl, wDayCareMan + ld a, DAYCARETEXT_MAN_INTRO + call DayCareIntroText + jr c, .cancel + call DayCareAskDepositPokemon + jr c, .print_text + farcall DepositMonWithDayCareMan + ld hl, wDayCareMan + set DAYCAREMAN_HAS_MON_F, [hl] + call DayCare_DepositPokemonText + call DayCare_InitBreeding + ret + +.AskWithdrawMon: + farcall GetBreedMon1LevelGrowth + ld hl, wBreedMon1Nick + call GetPriceToRetrieveBreedmon + call DayCare_AskWithdrawBreedMon + jr c, .print_text + farcall RetrieveMonFromDayCareMan + call DayCare_GetBackMonForMoney + ld hl, wDayCareMan + res DAYCAREMAN_HAS_MON_F, [hl] + res DAYCAREMAN_MONS_COMPATIBLE_F, [hl] + jr .cancel + +.print_text + call PrintDayCareText + +.cancel + ld a, DAYCARETEXT_COME_AGAIN + call PrintDayCareText + ret + +DayCareLady: + ld hl, wDayCareLady + bit DAYCARELADY_HAS_MON_F, [hl] + jr nz, .AskWithdrawMon + ld hl, wDayCareLady + ld a, DAYCARETEXT_LADY_INTRO + call DayCareIntroText + jr c, .cancel + call DayCareAskDepositPokemon + jr c, .print_text + farcall DepositMonWithDayCareLady + ld hl, wDayCareLady + set DAYCARELADY_HAS_MON_F, [hl] + call DayCare_DepositPokemonText + call DayCare_InitBreeding + ret + +.AskWithdrawMon: + farcall GetBreedMon2LevelGrowth + ld hl, wBreedMon2Nick + call GetPriceToRetrieveBreedmon + call DayCare_AskWithdrawBreedMon + jr c, .print_text + farcall RetrieveMonFromDayCareLady + call DayCare_GetBackMonForMoney + ld hl, wDayCareLady + res DAYCARELADY_HAS_MON_F, [hl] + ld hl, wDayCareMan + res DAYCAREMAN_MONS_COMPATIBLE_F, [hl] + jr .cancel + +.print_text + call PrintDayCareText + +.cancel + ld a, DAYCARETEXT_COME_AGAIN + call PrintDayCareText + ret + +DayCareIntroText: + bit DAYCARE_INTRO_SEEN_F, [hl] + jr nz, .okay + set DAYCARE_INTRO_SEEN_F, [hl] + inc a +.okay + call PrintDayCareText + call YesNoBox + ret + +DayCareAskDepositPokemon: + ld a, [wPartyCount] + cp 2 + jr c, .OnlyOneMon + ld a, DAYCARETEXT_WHICH_ONE + call PrintDayCareText + ld b, PARTYMENUACTION_GIVE_MON + farcall SelectTradeOrDayCareMon + jr c, .Declined + ld a, [wCurPartySpecies] + cp EGG + jr z, .Egg + farcall CheckCurPartyMonFainted + jr c, .OutOfUsableMons + ld hl, wPartyMon1Item + ld bc, PARTYMON_STRUCT_LENGTH + ld a, [wCurPartyMon] + call AddNTimes + ld d, [hl] + farcall ItemIsMail + jr c, .HoldingMail + ld hl, wPartyMonNicknames + ld a, [wCurPartyMon] + call GetNick + and a + ret + +.Declined: + ld a, DAYCARETEXT_OH_FINE + scf + ret + +.Egg: + ld a, DAYCARETEXT_CANT_BREED_EGG + scf + ret + +.OnlyOneMon: + ld a, DAYCARETEXT_LAST_MON + scf + ret + +.OutOfUsableMons: + ld a, DAYCARETEXT_LAST_ALIVE_MON + scf + ret + +.HoldingMail: + ld a, DAYCARETEXT_REMOVE_MAIL + scf + ret + +.DummyText: + ; + text_jump _DaycareDummyText + db "@" + +DayCare_DepositPokemonText: + ld a, DAYCARETEXT_DEPOSIT + call PrintDayCareText + ld a, [wCurPartySpecies] + call PlayMonCry + ld a, DAYCARETEXT_COME_BACK_LATER + call PrintDayCareText + ret + +DayCare_AskWithdrawBreedMon: + ld a, [wStringBuffer2 + 1] + and a + jr nz, .grew_at_least_one_level + ld a, DAYCARETEXT_TOO_SOON + call PrintDayCareText + call YesNoBox + jr c, .refused + jr .check_money + +.grew_at_least_one_level + ld a, DAYCARETEXT_GENIUSES + call PrintDayCareText + call YesNoBox + jr c, .refused + ld a, DAYCARETEXT_ASK_WITHDRAW + call PrintDayCareText + call YesNoBox + jr c, .refused + +.check_money + ld de, wMoney + ld bc, wStringBuffer2 + 2 + farcall CompareMoney + jr c, .not_enough_money + ld a, [wPartyCount] + cp PARTY_LENGTH + jr nc, .PartyFull + and a + ret + +.refused + ld a, DAYCARETEXT_OH_FINE + scf + ret + +.not_enough_money + ld a, DAYCARETEXT_NOT_ENOUGH_MONEY + scf + ret + +.PartyFull: + ld a, DAYCARETEXT_PARTY_FULL + scf + ret + +DayCare_GetBackMonForMoney: + ld bc, wStringBuffer2 + 2 + ld de, wMoney + farcall TakeMoney + ld a, DAYCARETEXT_WITHDRAW + call PrintDayCareText + ld a, [wCurPartySpecies] + call PlayMonCry + ld a, DAYCARETEXT_GOT_BACK + call PrintDayCareText + ret + +GetPriceToRetrieveBreedmon: + ld a, b + ld [wStringBuffer2], a + ld a, d + ld [wStringBuffer2 + 1], a + ld de, wStringBuffer1 + ld bc, NAME_LENGTH + call CopyBytes + ld hl, 0 + ld bc, 100 + ld a, [wStringBuffer2 + 1] + call AddNTimes + ld de, 100 + add hl, de + xor a + ld [wStringBuffer2 + 2], a + ld a, h + ld [wStringBuffer2 + 3], a + ld a, l + ld [wStringBuffer2 + 4], a + ret + +PrintDayCareText: + ld e, a + ld d, 0 + ld hl, .TextTable + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + call PrintText + ret + +.TextTable: +; entries correspond to DAYCARETEXT_* constants + 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 + +.DayCareManIntro: + ; I'm the DAY-CARE MAN. Want me to raise a #MON? + text_jump _DayCareManIntroText + db "@" + +.DayCareManOddEgg: + ; 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 _DayCareManOddEggText + db "@" + +.DayCareLadyIntro: + ; I'm the DAY-CARE LADY. Should I raise a #MON for you? + text_jump _DayCareLadyIntroText + db "@" + +.DayCareLadyOddEgg: + ; 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 _DayCareLadyOddEggText + db "@" + +.WhichOne: + ; What should I raise for you? + text_jump _WhatShouldIRaiseText + db "@" + +.JustOneMon: + ; Oh? But you have just one #MON. + text_jump _OnlyOneMonText + db "@" + +.CantAcceptEgg: + ; Sorry, but I can't accept an EGG. + text_jump _CantRaiseEggText + db "@" + +.RemoveMail: + ; Remove MAIL before you come see me. + text_jump _RemoveMailText + db "@" + +.LastHealthyMon: + ; If you give me that, what will you battle with? + text_jump _LastHealthyMonText + db "@" + +.OkayIllRaiseYourMon: + ; OK. I'll raise your @ . + text_jump _IllRaiseYourMonText + db "@" + +.ComeBackForItLater: + ; Come back for it later. + text_jump _ComeBackLaterText + db "@" + +.AreWeGeniusesOrWhat: + ; Are we geniuses or what? Want to see your @ ? + text_jump _AreWeGeniusesText + db "@" + +.AskRetrieveMon: + ; Your @ has grown a lot. By level, it's grown by @ . If you want your #MON back, it will cost ¥@ . + text_jump _YourMonHasGrownText + db "@" + +.PerfectHeresYourMon: + ; Perfect! Here's your #MON. + text_jump _PerfectHeresYourMonText + db "@" + +.GotBackMon: + ; got back @ . + text_jump _GotBackMonText + db "@" + +.ImmediatelyWithdrawMon: + ; Huh? Back already? Your @ needs a little more time with us. If you want your #MON back, it will cost ¥100. + text_jump _BackAlreadyText + db "@" + +.PartyFull: + ; You have no room for it. + text_jump _HaveNoRoomText + db "@" + +.NotEnoughMoney: + ; You don't have enough money. + text_jump _DCNotEnoughMoneyText + db "@" + +.OhFineThen: + ; Oh, fine then. + text_jump _OhFineThenText + db "@" + +.ComeAgain: + ; Come again. + text_jump _ComeAgainText + db "@" + +DayCareManOutside: + ld hl, wDayCareMan + bit DAYCAREMAN_HAS_EGG_F, [hl] + jr nz, .AskGiveEgg + ld hl, .NotYet + call PrintText + ret + +.NotYet: + ; Not yet… + text_jump _NotYetText + db "@" + +.AskGiveEgg: + ld hl, .IntroText + call PrintText + call YesNoBox + jr c, .Declined + ld a, [wPartyCount] + cp PARTY_LENGTH + jr nc, .PartyFull + call DayCare_GiveEgg + ld hl, wDayCareMan + res DAYCAREMAN_HAS_EGG_F, [hl] + call DayCare_InitBreeding + ld hl, .GotEggText + call PrintText + ld de, SFX_GET_EGG_FROM_DAYCARE_LADY + call PlaySFX + ld c, 120 + call DelayFrames + ld hl, .TakeGoodCareOfItText + jr .Load0 + +.Declined: + ld hl, .IllKeepItThanksText + +.Load0: + call PrintText + xor a ; FALSE + ld [wScriptVar], a + ret + +.PartyFull: + ld hl, .PartyFullText + call PrintText + ld a, TRUE + ld [wScriptVar], a + ret + +.IntroText: + ; 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 _FoundAnEggText + db "@" + +.GotEggText: + ; received the EGG! + text_jump _ReceivedEggText + db "@" + +.TakeGoodCareOfItText: + ; Take good care of it. + text_jump _TakeGoodCareOfEggText + db "@" + +.IllKeepItThanksText: + ; Well then, I'll keep it. Thanks! + text_jump _RefuseEggText + db "@" + +.PartyFullText: + ; You have no room in your party. Come back later. + text_jump _NoRoomForEggText + db "@" + +DayCare_GiveEgg: + ld a, [wEggMonLevel] + ld [wCurPartyLevel], a + ld hl, wPartyCount + ld a, [hl] + cp PARTY_LENGTH + jr nc, .PartyFull + inc a + ld [hl], a + + ld c, a + ld b, 0 + add hl, bc + ld a, EGG + ld [hli], a + ld a, [wEggMonSpecies] + ld [wCurSpecies], a + ld [wCurPartySpecies], a + ld a, -1 + ld [hl], a + + ld hl, wPartyMonNicknames + ld bc, MON_NAME_LENGTH + call DayCare_GetCurrentPartyMember + ld hl, wEggNick + call CopyBytes + + ld hl, wPartyMonOT + ld bc, NAME_LENGTH + call DayCare_GetCurrentPartyMember + ld hl, wEggOT + call CopyBytes + + ld hl, wPartyMon1 + ld bc, PARTYMON_STRUCT_LENGTH + call DayCare_GetCurrentPartyMember + ld hl, wEggMon + ld bc, wEggMonEnd - wEggMon + call CopyBytes + + call GetBaseData + ld a, [wPartyCount] + dec a + ld hl, wPartyMon1 + 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, FALSE + predef CalcPkmnStats + pop bc + ld hl, MON_HP + add hl, bc + xor a + ld [hli], a + ld [hl], a + and a + ret + +.PartyFull: + scf + ret + +DayCare_GetCurrentPartyMember: + ld a, [wPartyCount] + dec a + call AddNTimes + ld d, h + ld e, l + ret + +DayCare_InitBreeding: + ld a, [wDayCareLady] + bit DAYCARELADY_HAS_MON_F, a + ret z + ld a, [wDayCareMan] + bit DAYCAREMAN_HAS_MON_F, a + ret z + callfar CheckBreedmonCompatibility + ld a, [wBreedingCompatibility] + and a + ret z + inc a + ret z + ld hl, wDayCareMan + set DAYCAREMAN_MONS_COMPATIBLE_F, [hl] +.loop + call Random + cp 150 + jr c, .loop + ld [wStepsToEgg], a + jp .UselessJump + +.UselessJump: + xor a + ld hl, wEggMon + ld bc, wEggMonEnd - wEggMon + call ByteFill + ld hl, wEggNick + ld bc, MON_NAME_LENGTH + call ByteFill + ld hl, wEggOT + ld bc, NAME_LENGTH + call ByteFill + ld a, [wBreedMon1DVs] + ld [wTempMonDVs], a + ld a, [wBreedMon1DVs + 1] + ld [wTempMonDVs + 1], a + ld a, [wBreedMon1Species] + ld [wCurPartySpecies], a + ld a, $3 + ld [wMonType], a + ld a, [wBreedMon1Species] + cp DITTO + ld a, $1 + jr z, .LoadWhichBreedmonIsTheMother + ld a, [wBreedMon2Species] + cp DITTO + ld a, $0 + jr z, .LoadWhichBreedmonIsTheMother + farcall GetGender + ld a, $0 + jr z, .LoadWhichBreedmonIsTheMother + inc a + +.LoadWhichBreedmonIsTheMother: + ld [wBreedMotherOrNonDitto], a + and a + ld a, [wBreedMon1Species] + jr z, .GotMother + ld a, [wBreedMon2Species] + +.GotMother: + ld [wCurPartySpecies], a + callfar GetPreEvolution + callfar GetPreEvolution + ld a, EGG_LEVEL + ld [wCurPartyLevel], a + +; Nidoran♀ can give birth to either gender of Nidoran + ld a, [wCurPartySpecies] + cp NIDORAN_F + jr nz, .GotEggSpecies + call Random + cp 50 percent + 1 + ld a, NIDORAN_F + jr c, .GotEggSpecies + ld a, NIDORAN_M +.GotEggSpecies: + ld [wCurPartySpecies], a + ld [wCurSpecies], a + ld [wEggMonSpecies], a + + call GetBaseData + ld hl, wEggNick + ld de, .String_EGG + call CopyName2 + ld hl, wPlayerName + ld de, wEggOT + ld bc, NAME_LENGTH + call CopyBytes + xor a + ld [wEggMonItem], a + ld de, wEggMonMoves + xor a + ld [wBuffer1], a + predef FillMoves + farcall InitEggMoves + ld hl, wEggMonID + ld a, [wPlayerID] + ld [hli], a + ld a, [wPlayerID + 1] + ld [hl], a + ld a, [wCurPartyLevel] + ld d, a + callfar CalcExpAtLevel + ld hl, wEggMonExp + ldh a, [hMultiplicand] + ld [hli], a + ldh a, [hMultiplicand + 1] + ld [hli], a + ldh a, [hMultiplicand + 2] + ld [hl], a + xor a + ld b, wEggMonDVs - wEggMonStatExp + ld hl, wEggMonStatExp +.loop2 + ld [hli], a + dec b + jr nz, .loop2 + ld hl, wEggMonDVs + call Random + ld [hli], a + ld [wTempMonDVs], a + call Random + ld [hld], a + ld [wTempMonDVs + 1], a + ld de, wBreedMon1DVs + ld a, [wBreedMon1Species] + cp DITTO + jr z, .GotDVs + ld de, wBreedMon2DVs + ld a, [wBreedMon2Species] + cp DITTO + jr z, .GotDVs + ld a, TEMPMON + ld [wMonType], a + push hl + farcall GetGender + pop hl + ld de, wBreedMon1DVs + ld bc, wBreedMon2DVs + jr c, .SkipDVs + jr z, .ParentCheck2 + ld a, [wBreedMotherOrNonDitto] + and a + jr z, .GotDVs + ld d, b + ld e, c + jr .GotDVs + +.ParentCheck2: + ld a, [wBreedMotherOrNonDitto] + and a + jr nz, .GotDVs + ld d, b + ld e, c + +.GotDVs: + 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: + ld hl, wStringBuffer1 + ld de, wMonOrItemNameBuffer + ld bc, NAME_LENGTH + call CopyBytes + ld hl, wEggMonMoves + ld de, wEggMonPP + predef FillPP + ld hl, wMonOrItemNameBuffer + ld de, wStringBuffer1 + ld bc, NAME_LENGTH + call CopyBytes + ld a, [wBaseEggSteps] + ld hl, wEggMonHappiness + ld [hli], a + xor a + ld [hli], a + ld [hli], a + ld [hl], a + ld a, [wCurPartyLevel] + ld [wEggMonLevel], a + ret + +.String_EGG: + db "EGG@" diff --git a/engine/events/happiness_egg.asm b/engine/events/happiness_egg.asm index 70fca685..5281691d 100755 --- a/engine/events/happiness_egg.asm +++ b/engine/events/happiness_egg.asm @@ -193,7 +193,7 @@ DaycareStep:: call Random ld [hl], a - callab Function171d1 + callab CheckBreedmonCompatibility ld a, [wd151] cp 230 ld b, -1 + 32 percent diff --git a/engine/move_mon.asm b/engine/move_mon.asm index 4c5a9e94..28cda6ef 100755 --- a/engine/move_mon.asm +++ b/engine/move_mon.asm @@ -671,13 +671,13 @@ Functiondcbc: ; dcbc (3:5cbc) ld [wMenuCursorY], a ret -RetrievePokemonFromDaycareMan: +RetrieveMonFromDayCareMan: ld a, [wBreedMon1Species] ld [wCurPartySpecies], a ld de, SFX_TRANSACTION call PlaySFX call WaitSFX - call Functione673 + call GetBreedMon1LevelGrowth ld a, b ld [wMovementBufferCount], a ld a, e @@ -686,13 +686,13 @@ RetrievePokemonFromDaycareMan: ld [wPokemonWithdrawDepositParameter], a jp Functiondd6a -RetrievePokemonFromDaycareLady: +RetrieveMonFromDayCareLady: ld a, [wBreedMon2Species] ld [wCurPartySpecies], a ld de, SFX_TRANSACTION call PlaySFX call WaitSFX - call Functione68e + call GetBreedMon2LevelGrowth ld a, b ld [wMovementBufferCount], a ld a, e @@ -806,12 +806,14 @@ Functionde20: ; de20 (3:5e20) ld e, l ret +DepositMonWithDayCareMan: ld de, wBreedMon1Nick call Functionde4a xor a ld [wPokemonWithdrawDepositParameter], a jp RemoveMonFromPartyOrBox +DepositMonWithDayCareLady: ld de, wBreedMon2Nick call Functionde4a xor a @@ -1059,7 +1061,7 @@ GiveEgg: ; df92 (3:5f92) bit 1, a ld a, $1 jr nz, .asm_e028 - ld a, [wd12f] + ld a, [wBaseEggSteps] .asm_e028 ld [hl], a ld a, [wPartyCount] @@ -415,7 +415,7 @@ INCLUDE "engine/anim_hp_bar.asm" INCLUDE "engine/move_mon.asm" INCLUDE "engine/billspctop.asm" -Functione673: ; e673 (3:6673) +GetBreedMon1LevelGrowth: ld hl, wBreedMon1Species ld de, wTempMonSpecies ld bc, $20 @@ -429,7 +429,7 @@ Functione673: ; e673 (3:6673) ld d, a ret -Functione68e: ; e68e (3:668e) +GetBreedMon2LevelGrowth: ld hl, wBreedMon2Species ld de, wTempMon ld bc, $20 @@ -711,21 +711,23 @@ Function15612:: ; 15612 PokemonCenterPC: dr $15871, $159b0 Function159b0: - dr $159b0, $1646d + dr $159b0, $1624f +TakeMoney: + dr $1624f, $16260 +CompareMoney: + dr $16260, $1646d BankOfMom: dr $1646d, $16935 -DayCareMan: - dr $16935, $16989 -DayCareLady: - dr $16989, $16b8c -DayCareManOutside: - dr $16b8c, $16e3a + +INCLUDE "engine/events/daycare.asm" Function16e3a: dr $16e3a, $16ff7 PhotoStudio: dr $16ff7, $171d1 -Function171d1: - dr $171d1, $177a5 +CheckBreedmonCompatibility: + dr $171d1, $17467 +InitEggMoves: + dr $17467, $177a5 DayCareMon1: dr $177a5, $177c4 DayCareMon2: @@ -993,7 +995,10 @@ SECTION "bank13", ROMX, BANK[$13] SECTION "bank14", ROMX, BANK[$14] SelectMonFromParty: - dr $50000, $5004f + dr $50000, $5001d + +SelectTradeOrDayCareMon: + dr $5001d, $5004f LoadPartyMenuGFX: dr $5004f, $5005f @@ -1329,7 +1334,10 @@ TreeMonEncounter: dr $ba378, $ba3a1 RockMonEncounter: - dr $ba3a1, $bc000 + dr $ba3a1, $bbaed + +ItemIsMail: + dr $bbaed, $bc000 SECTION "bank2f", ROMX, BANK[$2f] dr $bc000, $c0000 @@ -2696,7 +2696,7 @@ wTrainerClass:: ds 1 ; d11d wd11e:: ds 1 ; d11e wd11f:: ds 1 ; d11f -wBaseData:: +wBaseData:: ; d120 wd120:: ds 1 ; d120 wd121:: ds 1 ; d121 wd122:: ds 1 ; d122 @@ -2712,7 +2712,7 @@ wd12b:: ds 1 ; d12b wd12c:: ds 1 ; d12c wd12d:: ds 1 ; d12d wd12e:: ds 1 ; d12e -wd12f:: ds 1 ; d12f +wBaseEggSteps:: db ; d12f wd130:: ds 1 ; d130 wd131:: ds 1 ; d131 wd132:: ds 1 ; d132 @@ -2750,6 +2750,7 @@ wd150:: ds 1 ; d150 wTempNumBuffer:: wNamedObjectIndexBuffer:: wDeciramBuffer:: +wBreedingCompatibility:: wd151:: ds 1 ; d151 wd152:: ds 1 ; d152 wd153:: ds 1 ; d153 @@ -3652,7 +3653,7 @@ wBreedMon1OT:: ds NAME_LENGTH ; dc4c ; TODO fix incorrect Stats label wBreedMon1Stats:: box_struct wBreedMon1 ; dc57 -wDaycareLady:: ; dc77 +wDayCareLady:: ; dc77 ; bit 7: active ; bit 0: monster 2 in day-care ds 1 |