diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index bcf4491f9..bce49719e 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -123,6 +123,7 @@ #define B_CRASH_IF_TARGET_IMMUNE GEN_7 // In Gen4+, The user of Jump Kick or High Jump Kick will "keep going and crash" if it attacks a target that is immune to the move. #define B_TAILWIND_TIMER GEN_7 // In Gen5+, Tailwind lasts 4 turns instead of 3. #define B_MEMENTO_FAIL GEN_7 // In Gen4+, Memento fails if there is no target or if the target is protected or behind substitute. But not if Atk/Sp. Atk are at -6. +#define B_HIDDEN_POWER_DMG GEN_7 // In Gen6+, Hidden Power's base power was set to always be 60. Before, it was determined by the mon's IVs. // Ability settings #define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability. diff --git a/src/battle_util.c b/src/battle_util.c index 263d7f96d..88a5cc203 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7658,6 +7658,22 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef) basePower *= 2; #endif break; + case EFFECT_HIDDEN_POWER: + { + #if B_HIDDEN_POWER_DMG < GEN_6 + u8 powerBits; + + powerBits = ((gBattleMons[gBattlerAttacker].hpIV & 2) >> 1) + | ((gBattleMons[gBattlerAttacker].attackIV & 2) << 0) + | ((gBattleMons[gBattlerAttacker].defenseIV & 2) << 1) + | ((gBattleMons[gBattlerAttacker].speedIV & 2) << 2) + | ((gBattleMons[gBattlerAttacker].spAttackIV & 2) << 3) + | ((gBattleMons[gBattlerAttacker].spDefenseIV & 2) << 4); + + basePower = (40 * powerBits) / 63 + 30; + #endif + break; + } } // move-specific base power changes diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 1aa8c4dfd..8d2188958 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -3753,7 +3753,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_HIDDEN_POWER] = { - #if B_UPDATED_MOVE_DATA >= GEN_6 + #if B_HIDDEN_POWER_DMG >= GEN_6 .power = 60, #else .power = 1,