Config for LGPE friendship stat boost (#2257)

* Config for LGPE friendship stat boost

* Separated Exp and Stat settings
This commit is contained in:
Eduardo Quezada D'Ottone 2023-06-28 12:44:53 -04:00 committed by GitHub
parent 67b196cd86
commit 4c4365b0c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -9,12 +9,15 @@
#define B_MULTI_HIT_CHANCE GEN_LATEST // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values.
#define B_WHITEOUT_MONEY GEN_LATEST // In Gen4+, the amount of money lost by losing a battle is determined by the amount of badges earned. Previously, it would cut the current money by half. (While this change was also in FRLG, for the sake of simplicity, setting this to GEN_3 will result in RSE behavior.)
// Exp and stat settings
// Experience settings
#define B_EXP_CATCH GEN_LATEST // In Gen6+, Pokémon get experience from catching.
#define B_TRAINER_EXP_MULTIPLIER GEN_LATEST // In Gen7+, trainer battles no longer give a 1.5 multiplier to EXP gain.
#define B_SPLIT_EXP GEN_LATEST // In Gen6+, all participating mon get full experience.
#define B_SCALED_EXP GEN_LATEST // In Gen5 and Gen7+, experience is weighted by level difference.
// Stat settings
#define B_BADGE_BOOST GEN_LATEST // In Gen4+, Gym Badges no longer boost a Pokémon's stats.
#define B_FRIENDSHIP_BOOST FALSE // In LGPE only, all stats except HP are boosted up to 10% based on Friendship. Unlike B_BADGE_BOOST, these boosts are accounted when calculating base stats.
#define B_MAX_LEVEL_EV_GAINS GEN_LATEST // In Gen5+, Lv100 Pokémon can obtain Effort Values normally.
#define B_RECALCULATE_STATS GEN_LATEST // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle.

View File

@ -4074,12 +4074,19 @@ static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon)
return checksum;
}
#if B_FRIENDSHIP_BOOST == TRUE
#define CALC_FRIENDSHIP_BOOST() n = n + ((n * 10 * friendship) / (MAX_FRIENDSHIP * 100));
#else
#define CALC_FRIENDSHIP_BOOST()
#endif
#define CALC_STAT(base, iv, ev, statIndex, field) \
{ \
u8 baseStat = gSpeciesInfo[species].base; \
s32 n = (((2 * baseStat + iv + ev / 4) * level) / 100) + 5; \
u8 nature = GetNature(mon); \
n = ModifyStatByNature(nature, n, statIndex); \
CALC_FRIENDSHIP_BOOST() \
SetMonData(mon, field, &n); \
}
@ -4100,6 +4107,7 @@ void CalculateMonStats(struct Pokemon *mon)
s32 spDefenseIV = GetMonData(mon, MON_DATA_SPDEF_IV, NULL);
s32 spDefenseEV = GetMonData(mon, MON_DATA_SPDEF_EV, NULL);
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
u8 friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL);
s32 level = GetLevelFromMonExp(mon);
s32 newMaxHP;