add oval charm

This commit is contained in:
Evan 2020-07-16 09:48:25 -06:00
parent ad95f150a9
commit f923f5198e
9 changed files with 67 additions and 2 deletions

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
239 228 176
48 48 48
248 192 224
128 80 216
168 104 248
128 208 192
248 248 216
216 136 160
184 88 96
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

View File

@ -704,8 +704,9 @@
#define ITEM_OLD_SEA_MAP 615
#define ITEM_SHINY_CHARM 616
#define ITEM_OVAL_CHARM 617
#define ITEMS_COUNT 617
#define ITEMS_COUNT 618
#define ITEM_FIELD_ARROW ITEMS_COUNT
#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY

View File

@ -4211,6 +4211,8 @@ extern const u32 gItemIcon_PrettyWing[];
extern const u32 gItemIconPalette_PrettyWing[];
extern const u32 gItemIcon_ShinyCharm[];
extern const u32 gItemIconPalette_ShinyCharm[];
extern const u32 gItemIcon_OvalCharm[];
extern const u32 gItemIconPalette_OvalCharm[];
// Gen 6 Items
extern const u32 gItemIcon_AssaultVest[];
extern const u32 gItemIconPalette_AssaultVest[];

View File

@ -1235,6 +1235,8 @@ const u32 gItemIconPalette_PrettyWing[] = INCBIN_U32("graphics/items/icon_palett
const u32 gItemIcon_ShinyCharm[] = INCBIN_U32("graphics/items/icons/shiny_charm.4bpp.lz");
const u32 gItemIconPalette_ShinyCharm[] = INCBIN_U32("graphics/items/icon_palettes/shiny_charm.gbapal.lz");
const u32 gItemIcon_OvalCharm[] = INCBIN_U32("graphics/items/icons/oval_charm.4bpp.lz");
const u32 gItemIconPalette_OvalCharm[] = INCBIN_U32("graphics/items/icon_palettes/oval_charm.gbapal.lz");
// Gen 6 Items
const u32 gItemIcon_AssaultVest[] = INCBIN_U32("graphics/items/icons/assault_vest.4bpp.lz");

View File

@ -495,6 +495,7 @@ const u32 *const gItemIconTable[][2] =
[ITEM_SWIFT_WING] = {gItemIcon_SwiftWing, gItemIconPalette_SwiftWing},
[ITEM_PRETTY_WING] = {gItemIcon_PrettyWing, gItemIconPalette_PrettyWing},
[ITEM_SHINY_CHARM] = {gItemIcon_ShinyCharm, gItemIconPalette_ShinyCharm},
[ITEM_OVAL_CHARM] = {gItemIcon_OvalCharm, gItemIconPalette_OvalCharm},
// Gen 6 Items
[ITEM_ASSAULT_VEST] = {gItemIcon_AssaultVest, gItemIconPalette_AssaultVest},
[ITEM_PIXIE_PLATE] = {gItemIcon_PixiePlate, gItemIconPalette_PixiePlate},

View File

@ -7461,4 +7461,17 @@ const struct Item gItems[] =
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.secondaryId = 0,
},
[ITEM_OVAL_CHARM] =
{
.name = _("Oval Charm"),
.itemId = ITEM_OVAL_CHARM,
.price = 0,
.importance = 1,
.description = sOvalCharmDesc,
.pocket = POCKET_KEY_ITEMS,
.type = 4,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.secondaryId = 0,
},
};

View File

@ -2793,3 +2793,9 @@ static const u8 sShinyCharmDesc[] = _(
"A charm that will\n"
"raise the chance\n"
"of Shiny Pokémon.");
static const u8 sOvalCharmDesc[] = _(
"Increases the\n"
"chance of finding\n"
"eggs at the daycare.");

View File

@ -19,6 +19,7 @@
#include "party_menu.h"
#include "list_menu.h"
#include "overworld.h"
#include "item.h"
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/region_map_sections.h"
@ -29,6 +30,7 @@ static void ClearDaycareMonMail(struct DayCareMail *mail);
static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare *daycare);
static u8 GetDaycareCompatibilityScore(struct DayCare *daycare);
static void DaycarePrintMonInfo(u8 windowId, s32 daycareSlotId, u8 y);
static u8 ModifyBreedingScoreForOvalCharm(u8 score);
// RAM buffers used to assist with BuildEggMoveset()
EWRAM_DATA static u16 sHatchedEggLevelUpMoves[EGG_LVL_UP_MOVES_ARRAY_COUNT] = {0};
@ -887,7 +889,7 @@ static bool8 TryProduceOrHatchEgg(struct DayCare *daycare)
// Check if an egg should be produced
if (daycare->offspringPersonality == 0 && validEggs == DAYCARE_MON_COUNT && (daycare->mons[1].steps & 0xFF) == 0xFF)
{
u8 compatability = GetDaycareCompatibilityScore(daycare);
u8 compatability = ModifyBreedingScoreForOvalCharm(GetDaycareCompatibilityScore(daycare));
if (compatability > (Random() * 100u) / USHRT_MAX)
TriggerPendingDaycareEgg();
}
@ -1295,3 +1297,22 @@ void ChooseSendDaycareMon(void)
ChooseMonForDaycare();
gMain.savedCallback = CB2_ReturnToField;
}
static u8 ModifyBreedingScoreForOvalCharm(u8 score)
{
if (CheckBagHasItem(ITEM_OVAL_CHARM, 1))
{
switch (score)
{
case 20:
return 40;
case 50:
return 80;
case 70:
return 88;
}
}
return score;
}