mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
parent
bf6aa6a176
commit
2c172a3636
19
graphics/items/icon_palettes/shiny_charm.pal
Normal file
19
graphics/items/icon_palettes/shiny_charm.pal
Normal file
@ -0,0 +1,19 @@
|
||||
JASC-PAL
|
||||
0100
|
||||
16
|
||||
245 218 38
|
||||
82 123 230
|
||||
90 156 246
|
||||
156 255 106
|
||||
41 115 148
|
||||
156 246 246
|
||||
57 205 246
|
||||
132 214 255
|
||||
189 189 239
|
||||
222 222 255
|
||||
90 90 90
|
||||
32 32 32
|
||||
206 173 247
|
||||
140 140 247
|
||||
173 107 255
|
||||
230 206 255
|
BIN
graphics/items/icons/shiny_charm.png
Normal file
BIN
graphics/items/icons/shiny_charm.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 356 B |
@ -700,7 +700,9 @@
|
||||
#define ITEM_MAGMA_EMBLEM 614
|
||||
#define ITEM_OLD_SEA_MAP 615
|
||||
|
||||
#define ITEMS_COUNT 616
|
||||
#define ITEM_SHINY_CHARM 616
|
||||
|
||||
#define ITEMS_COUNT 617
|
||||
#define ITEM_FIELD_ARROW ITEMS_COUNT
|
||||
|
||||
#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY
|
||||
|
@ -86,6 +86,7 @@
|
||||
|
||||
// Shiny odds
|
||||
#define SHINY_ODDS 8 // Actual probability is SHINY_ODDS/65536
|
||||
#define SHINY_CHARM_REROLLS 3 // Amount of re-rolls if has Shiny Charm.
|
||||
|
||||
// Flags for Get(Box)MonData / Set(Box)MonData
|
||||
#define MON_DATA_PERSONALITY 0
|
||||
|
@ -4056,6 +4056,8 @@ extern const u32 gItemIcon_NormalGem[];
|
||||
extern const u32 gItemIconPalette_NormalGem[];
|
||||
extern const u32 gItemIcon_FairyGem[];
|
||||
extern const u32 gItemIconPalette_FairyGem[];
|
||||
extern const u32 gItemIcon_ShinyCharm[];
|
||||
extern const u32 gItemIconPalette_ShinyCharm[];
|
||||
// Gen 6 Items
|
||||
extern const u32 gItemIcon_AssaultVest[];
|
||||
extern const u32 gItemIconPalette_AssaultVest[];
|
||||
|
@ -1002,6 +1002,9 @@ const u32 gItemIconPalette_NormalGem[] = INCBIN_U32("graphics/items/icon_palette
|
||||
const u32 gItemIcon_FairyGem[] = INCBIN_U32("graphics/items/icons/fairy_gem.4bpp.lz");
|
||||
const u32 gItemIconPalette_FairyGem[] = INCBIN_U32("graphics/items/icon_palettes/fairy_gem.gbapal.lz");
|
||||
|
||||
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");
|
||||
|
||||
// Gen 6 Items
|
||||
|
||||
const u32 gItemIcon_AssaultVest[] = INCBIN_U32("graphics/items/icons/assault_vest.4bpp.lz");
|
||||
|
@ -417,6 +417,7 @@ const u32 *const gItemIconTable[][2] =
|
||||
[ITEM_STEEL_GEM] = {gItemIcon_SteelGem, gItemIconPalette_SteelGem},
|
||||
[ITEM_NORMAL_GEM] = {gItemIcon_NormalGem, gItemIconPalette_NormalGem},
|
||||
[ITEM_FAIRY_GEM] = {gItemIcon_FairyGem, gItemIconPalette_FairyGem},
|
||||
[ITEM_SHINY_CHARM] = {gItemIcon_ShinyCharm, gItemIconPalette_ShinyCharm},
|
||||
// Gen 6 Items
|
||||
[ITEM_ASSAULT_VEST] = {gItemIcon_AssaultVest, gItemIconPalette_AssaultVest},
|
||||
[ITEM_PIXIE_PLATE] = {gItemIcon_PixiePlate, gItemIconPalette_PixiePlate},
|
||||
|
@ -7448,5 +7448,17 @@ const struct Item gItems[] =
|
||||
.type = 4,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
||||
.secondaryId = 0,
|
||||
}
|
||||
},
|
||||
|
||||
[ITEM_SHINY_CHARM] =
|
||||
{
|
||||
.name = _("Shiny Charm"),
|
||||
.itemId = ITEM_SHINY_CHARM,
|
||||
.price = 0,
|
||||
.description = sShinyCharmDesc,
|
||||
.pocket = POCKET_KEY_ITEMS,
|
||||
.type = 4,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
|
||||
.secondaryId = 0,
|
||||
},
|
||||
};
|
||||
|
@ -2788,3 +2788,8 @@ static const u8 sPrettyWingDesc[] = _(
|
||||
"A beautiful yet\n"
|
||||
"plain feather that\n"
|
||||
"does nothing.");
|
||||
|
||||
static const u8 sShinyCharmDesc[] = _(
|
||||
"A charm that will\n"
|
||||
"raise the chance\n"
|
||||
"of Shiny Pokémon.");
|
||||
|
@ -2175,8 +2175,6 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||
else
|
||||
personality = Random32();
|
||||
|
||||
SetBoxMonData(boxMon, MON_DATA_PERSONALITY, &personality);
|
||||
|
||||
//Determine original trainer ID
|
||||
if (otIdType == OT_ID_RANDOM_NO_SHINY) //Pokemon cannot be shiny
|
||||
{
|
||||
@ -2197,8 +2195,21 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||
| (gSaveBlock2Ptr->playerTrainerId[1] << 8)
|
||||
| (gSaveBlock2Ptr->playerTrainerId[2] << 16)
|
||||
| (gSaveBlock2Ptr->playerTrainerId[3] << 24);
|
||||
|
||||
if (CheckBagHasItem(ITEM_SHINY_CHARM, 1))
|
||||
{
|
||||
u32 shinyValue;
|
||||
u32 rolls = 0;
|
||||
do
|
||||
{
|
||||
personality = Random32();
|
||||
shinyValue = HIHALF(value) ^ LOHALF(value) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||
rolls++;
|
||||
} while (shinyValue >= SHINY_ODDS && rolls < SHINY_CHARM_REROLLS);
|
||||
}
|
||||
}
|
||||
|
||||
SetBoxMonData(boxMon, MON_DATA_PERSONALITY, &personality);
|
||||
SetBoxMonData(boxMon, MON_DATA_OT_ID, &value);
|
||||
|
||||
checksum = CalculateBoxMonChecksum(boxMon);
|
||||
|
Loading…
Reference in New Issue
Block a user