From 1dcbf5968695900526369fe7ca3ef2a6dfe3e3ad Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Mon, 18 Jul 2022 08:11:02 -0400 Subject: [PATCH] Config for Plus and Minus interaction --- include/constants/battle_config.h | 1 + src/battle_util.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index a6f24a0c68..27e3b6f534 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -191,6 +191,7 @@ #define B_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned. #define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. It also activates Rattled. #define B_OBLIVIOUS_TAUNT GEN_7 // In Gen6+, Pokémon with Oblivious can't be taunted. +#define B_PLUS_MINUS_INTERACTION GEN_7 // In Gen5+, Plus and Minus can be activated with themselves and the opposite ability. Before, only the opposing ability could activate it. // Item settings #define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. diff --git a/src/battle_util.c b/src/battle_util.c index 0440cfba0e..57486558a3 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -8657,6 +8657,7 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b if (moveType == TYPE_GRASS && gBattleMons[battlerAtk].hp <= (gBattleMons[battlerAtk].maxHP / 3)) MulModifier(&modifier, UQ_4_12(1.5)); break; + #if B_PLUS_MINUS_INTERACTION >= GEN_5 case ABILITY_PLUS: case ABILITY_MINUS: if (IsBattlerAlive(BATTLE_PARTNER(battlerAtk))) @@ -8666,6 +8667,24 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b MulModifier(&modifier, UQ_4_12(1.5)); } break; + #else + case ABILITY_PLUS: + if (IsBattlerAlive(BATTLE_PARTNER(battlerAtk))) + { + u32 partnerAbility = GetBattlerAbility(BATTLE_PARTNER(battlerAtk)); + if (partnerAbility == ABILITY_MINUS) + MulModifier(&modifier, UQ_4_12(1.5)); + } + break; + case ABILITY_MINUS: + if (IsBattlerAlive(BATTLE_PARTNER(battlerAtk))) + { + u32 partnerAbility = GetBattlerAbility(BATTLE_PARTNER(battlerAtk)); + if (partnerAbility == ABILITY_PLUS) + MulModifier(&modifier, UQ_4_12(1.5)); + } + break; + #endif case ABILITY_FLOWER_GIFT: if (gBattleMons[battlerAtk].species == SPECIES_CHERRIM && IsBattlerWeatherAffected(battlerAtk, B_WEATHER_SUN) && IS_MOVE_PHYSICAL(move)) MulModifier(&modifier, UQ_4_12(1.5));