-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EV Caps and EV Items #5269
EV Caps and EV Items #5269
Conversation
Introduces EV caps, inspired by level caps, with configurable options for various cap implementations. Additionally, modifies EV items to interact with these caps based on a configurable setting.
Changed the EV caps to be less redundant and work better overall.
Set the items back to ItemUseOutOfBattle_Medicine, got rid of ItemUseOutOfBattle_EVItem and ItemUseCB_EVItem, and reverted CB2_ReturnToPartyMenuUsingItem to CB2_ReturnToPartyMenuUsingRareCandy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is something broken since once I reach the cap it loops over starting from 0. I used vitamins to increase the evs.
src/pokemon.c
Outdated
@@ -5195,6 +5199,7 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies) | |||
int i, multiplier; | |||
u8 stat; | |||
u8 bonus; | |||
u32 currentEVCap = GetCurrentEVCap(); // Get the current EV cap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comment is redundant since it restates the function name.
src/pokemon.c
Outdated
@@ -5224,7 +5229,7 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies) | |||
|
|||
for (i = 0; i < NUM_STATS; i++) | |||
{ | |||
if (totalEVs >= MAX_TOTAL_EVS) | |||
if (totalEVs >= currentEVCap) // Use currentEVCap instead of MAX_TOTAL_EVS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment seems redundant here as well.
src/pokemon.c
Outdated
@@ -5275,8 +5280,8 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies) | |||
if (holdEffect == HOLD_EFFECT_MACHO_BRACE) | |||
evIncrease *= 2; | |||
|
|||
if (totalEVs + (s16)evIncrease > MAX_TOTAL_EVS) | |||
evIncrease = ((s16)evIncrease + MAX_TOTAL_EVS) - (totalEVs + evIncrease); | |||
if (totalEVs + (s16)evIncrease > currentEVCap) // Use currentEVCap instead of MAX_TOTAL_EVS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also comment not needed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed all the unnecessary comments.
Fixed being able to use EV items to go over 252 limit on single stats.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more minor thing and then it can be merged.
Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
Description
Introduces EV caps, inspired by level caps, with configurable options for various cap implementations. Additionally, modifies EV items to interact with these caps based on a configurable setting.
Feature List for EV Caps Implementation
EV Cap Configurations:
EV_CAP_NONE: No EV cap applied; EV growth is unrestricted.
EV_CAP_FLAG_LIST: Caps EVs at predefined milestones, halting further EV gain from battles once the cap is reached.
EV_CAP_VARIABLE: Dynamic EV cap determined by a modifiable variable, allowing for flexible adjustments during gameplay.
EV_CAP_NO_GAIN: Completely disables EV gain from battles and other sources.
EV-Boosting Items Interaction:
B_EV_ITEMS_CAP: When set to TRUE, EV-boosting items are modified to respect the current EV cap:
Below Cap: If using an item would exceed the cap, the EV increase is reduced to match the cap.
At Cap: Items cannot be used if the Pokémon is already at the cap, preventing any EV gain.
Additional Features:
Script Integration: Supports dynamic changes to EV caps via scripts.
Milestone Management: Allows for structured progression of EV caps with predefined milestones.
Enhanced EV Management: Ensures EV growth is properly halted at the cap, both from battles and item usage, maintaining balanced gameplay.
Images
The demonstration below has the EV cap set to 16 and I'm using archie's Stat Editor to show the EV values.
Properly gaining EVs from battle but not being able to go over the EV from it:
Properly gaining EVs from EV items, having the increase reduced to the EV cap, and not being able to use EV items when at the EV cap:
People who collaborated with me in this PR
Heavily inspired by Level Cap system and reviewed by @AlexOn1ine
Feature(s) this PR does NOT handle:
This doesn't include any way to look at a Pokemon's current EVs. There's also no indicator for the current EV cap in game.
Discord contact info
Discord: flash1lucky