From 90442ffbc251b61a73db690c8266c875cfec8dac Mon Sep 17 00:00:00 2001 From: Eduardo Alvaro Quezada D'Ottone Date: Sat, 8 Feb 2020 05:51:55 -0300 Subject: [PATCH] Battle config options (#243) * Option to use pre-GenVI critical hit multiplier. * Clarified the option that multiplies EXP by 1.5 for trainer battles. * Fixed code style. * Option to change Burn damage. * Option to change to Gen 7 paralysis drop. * Ordered settings. * Implemented review suggestions. --- include/constants/battle_config.h | 17 +++++++++++++---- src/battle_main.c | 2 +- src/battle_script_commands.c | 2 +- src/battle_util.c | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 1480a9cf48..49a86c6489 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -45,16 +45,25 @@ #define GEN_6 3 #define GEN_7 4 +// Calculation settings #define B_CRIT_CHANCE GEN_6 // Chances of a critical hit landing. See atk04_critcalc. +#define B_CRIT_MULTIPLIER GEN_6 // Starting from gen6, critical hits multiply damage by 1.5 instead of 2. +#define B_EXP_CATCH GEN_6 // Starting from gen6, pokemon get experience from catching. +#define B_TRAINER_EXP_MULTIPLIER GEN_6 // Gen7 no longer gives a 1.5 multiplier to exp gain in trainer battles. +#define B_BURN_DAMAGE GEN_6 // In Gen7, burn damage is 1/16th of max HP instead of 1/8th. +#define B_PARALYSIS_SPEED GEN_6 // In Gen7, speed is decreased by 50% instead of 75%. + +// Move settings #define B_FELL_STINGER_STAT_RAISE GEN_6 // Gen6 Atk+2, Gen7 Atk+3. +#define B_SOUND_SUBSTITUTE GEN_6 // Starting from gen6 sound moves bypass Substitute. + +// Ability settings +#define B_ABILITY_POP_UP GEN_6 // Starting from gen5, the pokemon abilities are displayed in a pop-up, when they activate in battle. #define B_ABILITY_WEATHER GEN_6 // Up to gen5 - weather induced by abilities such as Drought or Drizzle lasted till the battle's end or weather change by a move. From Gen6 onwards, weather caused by abilities lasts the same amount of turns as induced from a move. #define B_GALE_WINGS GEN_6 // Gen7 requires full hp. -#define B_SOUND_SUBSTITUTE GEN_6 // Starting from gen6 sound moves bypass Substitute. -#define B_EXP_CATCH GEN_6 // Starting from gen6, pokemon get experience from catching. -#define B_ABILITY_POP_UP GEN_6 // Starting from gen5, the pokemon abilities are displayed in a pop-up, when they activate in battle. #define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7, Aegislash's form change does not happen, if the pokemon cannot use a move, because of confusion, paralysis, etc. In gen6, the form change occurs despite not being able to move. -#define B_TRAINER_BATTLE_MULTIPLIER GEN_6 // Gen7 no longer gives a 1.5 multiplier to exp gain. +// Other #define B_FAST_INTRO TRUE // If set to TRUE, battle intro texts print at the same time as animation of a pokemon, as opposing to waiting for the animation to end. #endif // GUARD_CONSTANTS_BATTLE_CONFIG_H diff --git a/src/battle_main.c b/src/battle_main.c index 097828c788..9840a56ac4 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4314,7 +4314,7 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId) // paralysis drop if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && ability != ABILITY_QUICK_FEET) - speed /= 4; + speed /= (B_PARALYSIS_SPEED >= GEN_7 ? 2 : 4); return speed; } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 160d110db9..d223f1053b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3507,7 +3507,7 @@ static void Cmd_getexp(void) gBattleMoveDamage += gExpShareExp; if (holdEffect == HOLD_EFFECT_LUCKY_EGG) gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; - if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && B_TRAINER_BATTLE_MULTIPLIER != GEN_7) + if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && B_TRAINER_EXP_MULTIPLIER != GEN_7) gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; if (IsTradedMon(&gPlayerParty[gBattleStruct->expGetterMonId])) diff --git a/src/battle_util.c b/src/battle_util.c index cf69e381b8..a432da9046 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1519,7 +1519,7 @@ u8 DoBattlerEndTurnEffects(void) && gBattleMons[gActiveBattler].hp != 0 && ability != ABILITY_MAGIC_GUARD) { - gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8; + gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / (B_BURN_DAMAGE >= GEN_7 ? 16 : 8); if (ability == ABILITY_HEATPROOF) gBattleMoveDamage /= 2; if (gBattleMoveDamage == 0) @@ -5859,7 +5859,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move // check crit if (isCrit) - dmg = ApplyModifier(UQ_4_12(1.5), dmg); + dmg = ApplyModifier((B_CRIT_MULTIPLIER >= GEN_6 ? UQ_4_12(1.5) : UQ_4_12(2.0)), dmg); // check burn if (gBattleMons[battlerAtk].status1 & STATUS1_BURN && IS_MOVE_PHYSICAL(move)