Add two EV-related configs (#2825)

This commit is contained in:
citrusbolt 2023-04-20 08:05:32 -06:00 committed by GitHub
parent 115efe7ea5
commit 6c7f5881e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 8 deletions

View File

@ -2,12 +2,13 @@
#define GUARD_CONFIG_ITEM_H #define GUARD_CONFIG_ITEM_H
// Item config // Item config
#define I_SHINY_CHARM_REROLLS 3 // Amount of re-rolls if the player has the Shiny Charm. Set to 0 to disable Shiny Charm's effects. #define I_SHINY_CHARM_REROLLS 3 // Amount of re-rolls if the player has the Shiny Charm. Set to 0 to disable Shiny Charm's effects.
#define I_KEY_FOSSILS GEN_LATEST // In Gen4+, all Gen 3 fossils became regular items. #define I_KEY_FOSSILS GEN_LATEST // In Gen4+, all Gen 3 fossils became regular items.
#define I_KEY_ESCAPE_ROPE GEN_LATEST // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts. #define I_KEY_ESCAPE_ROPE GEN_LATEST // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts.
#define I_HEALTH_RECOVERY GEN_LATEST // In Gen7+, certain healing items recover a different amount of HP than they used to. #define I_HEALTH_RECOVERY GEN_LATEST // In Gen7+, certain healing items recover a different amount of HP than they used to.
#define I_SITRUS_BERRY_HEAL GEN_LATEST // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP. #define I_SITRUS_BERRY_HEAL GEN_LATEST // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP.
#define I_VITAMIN_EV_CAP GEN_LATEST // In Gen8, the Vitamins no longer have a cap of 100 EV per stat. #define I_VITAMIN_EV_CAP GEN_LATEST // In Gen8+, the Vitamins no longer have a cap of 100 EV per stat.
#define I_BERRY_EV_JUMP GEN_LATEST // In Gen4 only, EV-lowering Berries lower a stat's EV to 100 if it is above 100.
// TM config // TM config
#define I_REUSABLE_TMS FALSE // In Gen5-8, TMs are reusable. Setting this to TRUE will make all vanilla TMs reusable, though they can also be cherry-picked by setting their importance to 1. #define I_REUSABLE_TMS FALSE // In Gen5-8, TMs are reusable. Setting this to TRUE will make all vanilla TMs reusable, though they can also be cherry-picked by setting their importance to 1.

View File

@ -21,6 +21,7 @@
// Other settings // Other settings
#define P_LEGENDARY_PERFECT_IVS GEN_LATEST // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs. #define P_LEGENDARY_PERFECT_IVS GEN_LATEST // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs.
#define P_EV_CAP GEN_LATEST // Since Gen 6, the max EVs per stat is 252 instead of 255.
// Flag settings // Flag settings
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to. // To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.

View File

@ -201,7 +201,11 @@
#define MAX_PER_STAT_IVS 31 #define MAX_PER_STAT_IVS 31
#define MAX_IV_MASK 31 #define MAX_IV_MASK 31
#define USE_RANDOM_IVS (MAX_PER_STAT_IVS + 1) #define USE_RANDOM_IVS (MAX_PER_STAT_IVS + 1)
#if P_EV_CAP >= GEN_6
#define MAX_PER_STAT_EVS 252
#else
#define MAX_PER_STAT_EVS 255 #define MAX_PER_STAT_EVS 255
#endif
#define MAX_TOTAL_EVS 510 #define MAX_TOTAL_EVS 510
#if I_VITAMIN_EV_CAP >= GEN_8 #if I_VITAMIN_EV_CAP >= GEN_8
#define EV_ITEM_RAISE_LIMIT MAX_PER_STAT_EVS #define EV_ITEM_RAISE_LIMIT MAX_PER_STAT_EVS

View File

@ -5854,7 +5854,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (itemEffect[10] & ITEM10_IS_VITAMIN) if (itemEffect[10] & ITEM10_IS_VITAMIN)
evCap = EV_ITEM_RAISE_LIMIT; evCap = EV_ITEM_RAISE_LIMIT;
else else
evCap = 252; evCap = MAX_PER_STAT_EVS;
if (dataSigned >= evCap) if (dataSigned >= evCap)
break; break;
@ -5880,6 +5880,10 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
break; break;
} }
dataSigned += evChange; dataSigned += evChange;
#if I_EV_LOWERING_BERRY_JUMP == GEN_4
if (dataSigned > 100)
dataSigned = 100;
#endif
if (dataSigned < 0) if (dataSigned < 0)
dataSigned = 0; dataSigned = 0;
} }
@ -6030,7 +6034,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (itemEffect[10] & ITEM10_IS_VITAMIN) if (itemEffect[10] & ITEM10_IS_VITAMIN)
evCap = EV_ITEM_RAISE_LIMIT; evCap = EV_ITEM_RAISE_LIMIT;
else else
evCap = 252; evCap = MAX_PER_STAT_EVS;
if (dataSigned >= evCap) if (dataSigned >= evCap)
break; break;
@ -6056,6 +6060,10 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
break; break;
} }
dataSigned += evChange; dataSigned += evChange;
#if I_BERRY_EV_JUMP == GEN_4
if (dataSigned > 100)
dataSigned = 100;
#endif
if (dataSigned < 0) if (dataSigned < 0)
dataSigned = 0; dataSigned = 0;
} }