Cleaned up use of configs be almost exclusively preproc functions

This commit is contained in:
Eduardo Quezada 2022-08-23 21:00:08 -04:00
parent 7c7887aa65
commit 1f5adf93c7
24 changed files with 921 additions and 898 deletions

View File

@ -23548,26 +23548,25 @@ Move_SECRET_POWER:
jumpargeq 0, BATTLE_TERRAIN_PUDDLE, Move_MUD_SHOT jumpargeq 0, BATTLE_TERRAIN_PUDDLE, Move_MUD_SHOT
jumpargeq 0, BATTLE_TERRAIN_MARSH, Move_MUD_SHOT jumpargeq 0, BATTLE_TERRAIN_MARSH, Move_MUD_SHOT
jumpargeq 0, BATTLE_TERRAIN_SWAMP, Move_MUD_SHOT jumpargeq 0, BATTLE_TERRAIN_SWAMP, Move_MUD_SHOT
.if B_SECRET_POWER_ANIMATION >= GEN_7
jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_ICE_SHARD
.else
jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE
.endif
jumpargeq 0, BATTLE_TERRAIN_ICE, Move_ICE_SHARD jumpargeq 0, BATTLE_TERRAIN_ICE, Move_ICE_SHARD
jumpargeq 0, BATTLE_TERRAIN_VOLCANO, Move_INCINERATE jumpargeq 0, BATTLE_TERRAIN_VOLCANO, Move_INCINERATE
jumpargeq 0, BATTLE_TERRAIN_DISTORTION_WORLD, Move_POUND jumpargeq 0, BATTLE_TERRAIN_DISTORTION_WORLD, Move_POUND
jumpargeq 0, BATTLE_TERRAIN_SPACE, Move_SWIFT jumpargeq 0, BATTLE_TERRAIN_SPACE, Move_SWIFT
jumpargeq 0, BATTLE_TERRAIN_ULTRA_SPACE, Move_PSYWAVE jumpargeq 0, BATTLE_TERRAIN_ULTRA_SPACE, Move_PSYWAVE
.if B_SECRET_POWER_ANIMATION >= GEN_7 .if B_SECRET_POWER_ANIMATION >= GEN_7
jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_ICE_SHARD
jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_SPIT_UP jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_SPIT_UP
goto Move_SPIT_UP goto Move_SPIT_UP
.elseif B_SECRET_POWER_ANIMATION == GEN_6 .elseif B_SECRET_POWER_ANIMATION >= GEN_6
jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE
jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM
goto Move_BODY_SLAM goto Move_BODY_SLAM
.elseif B_SECRET_POWER_ANIMATION == GEN_5 || B_SECRET_POWER_ANIMATION == GEN_4 .elseif B_SECRET_POWER_ANIMATION >= GEN_4
jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE
jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_BODY_SLAM
goto Move_MUD_SLAP goto Move_MUD_SLAP
.else .else
jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE
jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH
goto Move_SLAM goto Move_SLAM
.endif .endif

View File

@ -77,7 +77,7 @@
// Move stat change settings // Move stat change settings
#define B_FELL_STINGER_STAT_RAISE GEN_7 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint. #define B_FELL_STINGER_STAT_RAISE GEN_7 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint.
#define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it. #define B_KINGS_SHIELD_LOWER_ATK GEN_7 // In Gen8+, it lowers Atk by 1 stage instead of 2 of oponents that hit it.
#define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage. #define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage.
#define B_CHARGE_SPDEF_RAISE GEN_7 // In Gen5+, Charge raises the user's Special Defense by 1 stage. #define B_CHARGE_SPDEF_RAISE GEN_7 // In Gen5+, Charge raises the user's Special Defense by 1 stage.
#define B_MINIMIZE_EVASION GEN_7 // In Gen5+, Minimize raises evasion by 2 stages instead of 1. #define B_MINIMIZE_EVASION GEN_7 // In Gen5+, Minimize raises evasion by 2 stages instead of 1.
@ -117,9 +117,8 @@
#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. #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.
#define B_BERRIES_INSTANT GEN_7 // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end. #define B_BERRIES_INSTANT GEN_7 // In Gen4+, most berries activate on battle start/switch-in if applicable. In Gen3, they only activate either at the move end or turn end.
#define B_CONFUSE_BERRIES_HEAL GEN_8 // Before Gen7, Figy and similar berries restore 1/8th of HP and trigger at half HP. In Gen7 they restore half HP, triggering at 25% HP. In Gen8 they heal 1/3rd of HP. #define B_CONFUSE_BERRIES_HEAL GEN_8 // Before Gen7, Figy and similar berries restore 1/8th of HP and trigger at half HP. In Gen7 they restore half HP, triggering at 25% HP. In Gen8 they heal 1/3rd of HP.
// Requires using Item Expansion or manually editing the holdEffectParam of Figy, Wiki, Mago, Aguav and Iapapa berries.
#define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1. #define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1.
#define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Infatuation, Taunt, Encore, Torment, Heal Block, and Disable #define B_MENTAL_HERB GEN_5 // In Gen5+, the Mental Herb cures Taunt, Encore, Torment, Heal Block, and Disable in addition to Infatuation from before.
#define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items. #define B_TRAINERS_KNOCK_OFF_ITEMS TRUE // If TRUE, trainers can steal/swap your items (non-berries are restored after battle). In vanilla games trainers cannot steal items.
#define B_SOUL_DEW_BOOST GEN_7 // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead. #define B_SOUL_DEW_BOOST GEN_7 // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead.
#define B_NET_BALL_MODIFIER GEN_7 // In Gen7+, Net Ball's catch multiplier is x5 instead of x3. #define B_NET_BALL_MODIFIER GEN_7 // In Gen7+, Net Ball's catch multiplier is x5 instead of x3.

View File

@ -142,8 +142,10 @@ static u32 GetWildAiFlags(void)
if (avgLevel >= 80) if (avgLevel >= 80)
flags |= AI_FLAG_HP_AWARE; flags |= AI_FLAG_HP_AWARE;
if (B_VAR_WILD_AI_FLAGS != 0 && VarGet(B_VAR_WILD_AI_FLAGS) != 0) #if B_VAR_WILD_AI_FLAGS != 0
if (VarGet(B_VAR_WILD_AI_FLAGS) != 0)
flags |= VarGet(B_VAR_WILD_AI_FLAGS); flags |= VarGet(B_VAR_WILD_AI_FLAGS);
#endif
return flags; return flags;
} }
@ -1273,10 +1275,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score -= 10; score -= 10;
break; break;
case EFFECT_OHKO: case EFFECT_OHKO:
if (B_SHEER_COLD_IMMUNITY >= GEN_7 #if B_SHEER_COLD_IMMUNITY >= GEN_7
&& move == MOVE_SHEER_COLD if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE))
&& IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE))
return 0; return 0;
#endif
if (!ShouldTryOHKO(battlerAtk, battlerDef, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], move)) if (!ShouldTryOHKO(battlerAtk, battlerDef, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], move))
score -= 10; score -= 10;
break; break;
@ -1304,8 +1306,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score -= 8; score -= 8;
else if (AI_DATA->hpPercents[battlerAtk] <= 25) else if (AI_DATA->hpPercents[battlerAtk] <= 25)
score -= 10; score -= 10;
else if (B_SOUND_SUBSTITUTE >= GEN_6 && TestMoveFlagsInMoveset(battlerDef, FLAG_SOUND)) #if B_SOUND_SUBSTITUTE >= GEN_6
else if (TestMoveFlagsInMoveset(battlerDef, FLAG_SOUND))
score -= 8; score -= 8;
#endif
break; break;
case EFFECT_LEECH_SEED: case EFFECT_LEECH_SEED:
if (gStatuses3[battlerDef] & STATUS3_LEECHSEED if (gStatuses3[battlerDef] & STATUS3_LEECHSEED
@ -1317,7 +1321,9 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break; break;
case EFFECT_DISABLE: case EFFECT_DISABLE:
if (gDisableStructs[battlerDef].disableTimer == 0 if (gDisableStructs[battlerDef].disableTimer == 0
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB) #if B_MENTAL_HERB >= GEN_5
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB
#endif
&& !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) && !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove))
{ {
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first
@ -1337,7 +1343,9 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break; break;
case EFFECT_ENCORE: case EFFECT_ENCORE:
if (gDisableStructs[battlerDef].encoreTimer == 0 if (gDisableStructs[battlerDef].encoreTimer == 0
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB) #if B_MENTAL_HERB >= GEN_5
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB
#endif
&& !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove)) && !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove))
{ {
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first
@ -1570,9 +1578,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score -= 10; score -= 10;
break; break;
} }
#if B_MENTAL_HERB >= GEN_5
if (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB) if (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB)
score -= 6; score -= 6;
#endif
break; break;
case EFFECT_WILL_O_WISP: case EFFECT_WILL_O_WISP:
if (!AI_CanBurn(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove)) if (!AI_CanBurn(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove))
@ -3543,7 +3552,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break; break;
case EFFECT_DISABLE: case EFFECT_DISABLE:
if (gDisableStructs[battlerDef].disableTimer == 0 if (gDisableStructs[battlerDef].disableTimer == 0
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)) // mental herb #if B_MENTAL_HERB >= GEN_5
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb
#endif
)
{ {
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // AI goes first if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // AI goes first
{ {
@ -3565,7 +3577,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break; break;
case EFFECT_ENCORE: case EFFECT_ENCORE:
if (gDisableStructs[battlerDef].encoreTimer == 0 if (gDisableStructs[battlerDef].encoreTimer == 0
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)) // mental herb #if B_MENTAL_HERB >= GEN_5
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb
#endif
)
{ {
if (IsEncoreEncouragedEffect(gBattleMoves[gLastMoves[battlerDef]].effect)) if (IsEncoreEncouragedEffect(gBattleMoves[gLastMoves[battlerDef]].effect))
score += 3; score += 3;
@ -3614,7 +3629,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
{ {
bool32 canSteal = FALSE; bool32 canSteal = FALSE;
#if defined B_TRAINERS_KNOCK_OFF_ITEMS && B_TRAINERS_KNOCK_OFF_ITEMS == TRUE #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
canSteal = TRUE; canSteal = TRUE;
#endif #endif
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || GetBattlerSide(battlerAtk) == B_SIDE_PLAYER) if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || GetBattlerSide(battlerAtk) == B_SIDE_PLAYER)

View File

@ -600,21 +600,25 @@ bool32 AtMaxHp(u8 battlerId)
bool32 IsBattlerTrapped(u8 battler, bool8 checkSwitch) bool32 IsBattlerTrapped(u8 battler, bool8 checkSwitch)
{ {
u8 holdEffect = AI_DATA->holdEffects[battler]; u8 holdEffect = AI_DATA->holdEffects[battler];
if ((B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|| (checkSwitch && holdEffect == HOLD_EFFECT_SHED_SHELL) #if B_GHOSTS_ESCAPE >= GEN_6
|| (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY) if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|| (!checkSwitch && holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN))
{
return FALSE; return FALSE;
} #endif
else if (checkSwitch && holdEffect == HOLD_EFFECT_SHED_SHELL)
{ return FALSE;
if (gBattleMons[battler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED) else if (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY)
|| IsAbilityPreventingEscape(battler) return FALSE;
|| gStatuses3[battler] & (STATUS3_ROOTED | STATUS3_SKY_DROPPED) else if (!checkSwitch && holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)
|| (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)) return FALSE;
else if (gBattleMons[battler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED))
return TRUE;
else if (gStatuses3[battler] & (STATUS3_ROOTED | STATUS3_SKY_DROPPED))
return TRUE;
else if (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)
return TRUE;
else if (IsAbilityPreventingEscape(battler))
return TRUE; return TRUE;
}
return FALSE; return FALSE;
} }
@ -647,8 +651,10 @@ bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler)
// move checks // move checks
bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect) bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect)
{ {
if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS)) if (ability == ABILITY_OVERCOAT
|| ability == ABILITY_OVERCOAT #if B_POWDER_GRASS >= GEN_6
|| IS_BATTLER_OF_TYPE(battler, TYPE_GRASS)
#endif
|| holdEffect == HOLD_EFFECT_SAFETY_GOGGLES) || holdEffect == HOLD_EFFECT_SAFETY_GOGGLES)
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -1415,8 +1421,10 @@ bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move)
if (AI_DATA->abilities[battlerDef] == ABILITY_NO_GUARD || AI_DATA->abilities[battlerAtk] == ABILITY_NO_GUARD) if (AI_DATA->abilities[battlerDef] == ABILITY_NO_GUARD || AI_DATA->abilities[battlerAtk] == ABILITY_NO_GUARD)
return TRUE; return TRUE;
if (B_TOXIC_NEVER_MISS >= GEN_6 && gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON)) #if B_TOXIC_NEVER_MISS >= GEN_6
if (gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON))
return TRUE; return TRUE;
#endif
// discouraged from hitting // discouraged from hitting
if (AI_WeatherHasEffect() && (gBattleWeather & B_WEATHER_SUN) if (AI_WeatherHasEffect() && (gBattleWeather & B_WEATHER_SUN)
@ -1428,8 +1436,10 @@ bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move)
(((gBattleWeather & B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) (((gBattleWeather & B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE))
|| (((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)))) || (((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD))))
|| (gBattleMoves[move].effect == EFFECT_VITAL_THROW) || (gBattleMoves[move].effect == EFFECT_VITAL_THROW)
|| (gBattleMoves[move].accuracy == 0) #if B_MINIMIZE_DMG_ACC >= GEN_6
|| ((B_MINIMIZE_DMG_ACC >= GEN_6) && (gStatuses3[battlerDef] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE))) || ((gStatuses3[battlerDef] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE))
#endif
|| (gBattleMoves[move].accuracy == 0))
{ {
return TRUE; return TRUE;
} }
@ -2240,10 +2250,15 @@ static u32 GetTrapDamage(u8 battlerId)
if (gBattleMons[battlerId].status2 & STATUS2_WRAPPED) if (gBattleMons[battlerId].status2 & STATUS2_WRAPPED)
{ {
if (holdEffect == HOLD_EFFECT_BINDING_BAND) if (holdEffect == HOLD_EFFECT_BINDING_BAND)
damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6) ? 6 : 8; #if B_BINDING_DAMAGE >= GEN_6
damage = gBattleMons[battlerId].maxHP / 6;
else else
damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6) ? 8 : 16; damage = gBattleMons[battlerId].maxHP / 8;
#else
damage = gBattleMons[battlerId].maxHP / 8;
else
damage = gBattleMons[battlerId].maxHP / 16;
#endif
if (damage == 0) if (damage == 0)
damage = 1; damage = 1;
} }
@ -2463,13 +2478,21 @@ bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 mo
if (!IS_MOVE_STATUS(move) && (shouldSwitch if (!IS_MOVE_STATUS(move) && (shouldSwitch
|| (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH || (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
|| (defAbility == ABILITY_STURDY && B_STURDY >= GEN_5) || defAbility == ABILITY_MULTISCALE || defAbility == ABILITY_SHADOW_SHIELD)))) #if B_STURDY >= GEN_5
|| defAbility == ABILITY_STURDY
#endif
|| defAbility == ABILITY_MULTISCALE
|| defAbility == ABILITY_SHADOW_SHIELD))))
return PIVOT; // pivot to break sash/sturdy/multiscale return PIVOT; // pivot to break sash/sturdy/multiscale
} }
else if (!hasStatBoost) else if (!hasStatBoost)
{ {
if (!IS_MOVE_STATUS(move) && (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH if (!IS_MOVE_STATUS(move) && (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
|| (defAbility == ABILITY_STURDY && B_STURDY >= GEN_5) || defAbility == ABILITY_MULTISCALE || defAbility == ABILITY_SHADOW_SHIELD))) #if B_STURDY >= GEN_5
|| (defAbility == ABILITY_STURDY)
#endif
|| defAbility == ABILITY_MULTISCALE
|| defAbility == ABILITY_SHADOW_SHIELD)))
return PIVOT; // pivot to break sash/sturdy/multiscale return PIVOT; // pivot to break sash/sturdy/multiscale
if (shouldSwitch) if (shouldSwitch)
@ -2608,7 +2631,7 @@ bool32 CanKnockOffItem(u8 battler, u16 item)
| BATTLE_TYPE_LINK | BATTLE_TYPE_LINK
| BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_LINK
| BATTLE_TYPE_SECRET_BASE | BATTLE_TYPE_SECRET_BASE
#if defined B_TRAINERS_KNOCK_OFF_ITEMS #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
| BATTLE_TYPE_TRAINER | BATTLE_TYPE_TRAINER
#endif #endif
)) && GetBattlerSide(battler) == B_SIDE_PLAYER) )) && GetBattlerSide(battler) == B_SIDE_PLAYER)

View File

@ -330,11 +330,13 @@ static void HandleInputChooseAction(void)
{ {
SwapHpBarsWithHpText(); SwapHpBarsWithHpText();
} }
else if (B_ENABLE_DEBUG && gMain.newKeys & SELECT_BUTTON) #if B_ENABLE_DEBUG == TRUE
else if (gMain.newKeys & SELECT_BUTTON)
{ {
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_DEBUG, 0); BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_DEBUG, 0);
PlayerBufferExecCompleted(); PlayerBufferExecCompleted();
} }
#endif
#if B_LAST_USED_BALL == TRUE #if B_LAST_USED_BALL == TRUE
else if (JOY_NEW(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall()) else if (JOY_NEW(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall())
{ {
@ -652,9 +654,8 @@ static void HandleInputChooseMove(void)
canSelectTarget = 0; canSelectTarget = 0;
} }
#if B_SHOW_TARGETS == TRUE
// Show all available targets for multi-target moves // Show all available targets for multi-target moves
if (B_SHOW_TARGETS)
{
if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS) if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS)
{ {
u32 i = 0; u32 i = 0;
@ -671,7 +672,7 @@ static void HandleInputChooseMove(void)
TryShowAsTarget(BATTLE_PARTNER(gActiveBattler)); TryShowAsTarget(BATTLE_PARTNER(gActiveBattler));
canSelectTarget = 2; canSelectTarget = 2;
} }
} #endif
} }
switch (canSelectTarget) switch (canSelectTarget)

View File

@ -3119,10 +3119,11 @@ static void RestoreOverwrittenPixels(u8 *tiles)
void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle) void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle)
{ {
#if B_ABILITY_POP_UP == TRUE
const s16 (*coords)[2]; const s16 (*coords)[2];
u8 spriteId1, spriteId2, battlerPosition, taskId; u8 spriteId1, spriteId2, battlerPosition, taskId;
if (!B_ABILITY_POP_UP)
return; return;
if (gBattleScripting.abilityPopupOverwrite != 0) if (gBattleScripting.abilityPopupOverwrite != 0)
@ -3189,6 +3190,7 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle)
PrintBattlerOnAbilityPopUp(battlerId, spriteId1, spriteId2); PrintBattlerOnAbilityPopUp(battlerId, spriteId1, spriteId2);
PrintAbilityOnAbilityPopUp(ability, spriteId1, spriteId2); PrintAbilityOnAbilityPopUp(ability, spriteId1, spriteId2);
RestoreOverwrittenPixels((void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32)); RestoreOverwrittenPixels((void*)(OBJ_VRAM0) + (gSprites[spriteId1].oam.tileNum * 32));
#endif
} }
void UpdateAbilityPopup(u8 battlerId) void UpdateAbilityPopup(u8 battlerId)

View File

@ -3361,10 +3361,11 @@ static void DoBattleIntro(void)
} }
else // Skip party summary since it is a wild battle. else // Skip party summary since it is a wild battle.
{ {
if (B_FAST_INTRO) #if B_FAST_INTRO == TRUE
*state = 7; // Don't wait for sprite, print message at the same time. *state = 7; // Don't wait for sprite, print message at the same time.
else #else
*state = 6; // Wait for sprite to load. *state = 6; // Wait for sprite to load.
#endif
} }
break; break;
case 5: // draw party summary in trainer battles case 5: // draw party summary in trainer battles
@ -3433,10 +3434,11 @@ static void DoBattleIntro(void)
} }
else else
{ {
if (B_FAST_INTRO) #if B_FAST_INTRO == TRUE
*state = 15; // Wait for text to be printed. *state = 15; // Wait for text to be printed.
else #else
*state = 14; // Wait for text and sprite. *state = 14; // Wait for text and sprite.
#endif
} }
} }
break; break;
@ -3474,9 +3476,11 @@ static void DoBattleIntro(void)
BtlController_EmitIntroTrainerBallThrow(BUFFER_A); BtlController_EmitIntroTrainerBallThrow(BUFFER_A);
MarkBattlerForControllerExec(gActiveBattler); MarkBattlerForControllerExec(gActiveBattler);
} }
if (B_FAST_INTRO && !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))) #if B_FAST_INTRO == TRUE
if (!(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK)))
*state = 15; // Print at the same time as trainer sends out second mon. *state = 15; // Print at the same time as trainer sends out second mon.
else else
#endif
(*state)++; (*state)++;
break; break;
case 14: // wait for opponent 2 send out case 14: // wait for opponent 2 send out
@ -3496,13 +3500,14 @@ static void DoBattleIntro(void)
gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT); gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
// A hack that makes fast intro work in trainer battles too. // A hack that makes fast intro work in trainer battles too.
if (B_FAST_INTRO #if B_FAST_INTRO == TRUE
&& gBattleTypeFlags & BATTLE_TYPE_TRAINER if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
&& !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK)) && !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))
&& gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_SIDE]].callback == SpriteCallbackDummy) && gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_SIDE]].callback == SpriteCallbackDummy)
{ {
return; return;
} }
#endif
PrepareStringBattle(STRINGID_INTROSENDOUT, gActiveBattler); PrepareStringBattle(STRINGID_INTROSENDOUT, gActiveBattler);
} }
@ -4456,7 +4461,11 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId)
// paralysis drop // paralysis drop
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && ability != ABILITY_QUICK_FEET) if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && ability != ABILITY_QUICK_FEET)
speed /= (B_PARALYSIS_SPEED >= GEN_7 ? 2 : 4); #if B_PARALYSIS_SPEED >= GEN_7
speed /= 2;
#else
speed /= 4;
#endif
return speed; return speed;
} }
@ -4481,8 +4490,10 @@ s8 GetMovePriority(u32 battlerId, u16 move)
priority = gBattleMoves[move].priority; priority = gBattleMoves[move].priority;
if (ability == ABILITY_GALE_WINGS if (ability == ABILITY_GALE_WINGS
&& gBattleMoves[move].type == TYPE_FLYING #if B_GALE_WINGS >= GEN_7
&& (B_GALE_WINGS <= GEN_6 || BATTLER_MAX_HP(battlerId))) && BATTLER_MAX_HP(battlerId)
#endif
&& gBattleMoves[move].type == TYPE_FLYING)
{ {
priority++; priority++;
} }
@ -5125,7 +5136,7 @@ static void HandleEndTurn_FinishBattle(void)
RecordedBattle_SetPlaybackFinished(); RecordedBattle_SetPlaybackFinished();
BeginFastPaletteFade(3); BeginFastPaletteFade(3);
FadeOutMapMusic(5); FadeOutMapMusic(5);
#if B_TRAINERS_KNOCK_OFF_ITEMS #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER) if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
TryRestoreStolenItems(); TryRestoreStolenItems();
#endif #endif
@ -5170,7 +5181,10 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void)
| BATTLE_TYPE_FRONTIER | BATTLE_TYPE_FRONTIER
| BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_EREADER_TRAINER
| BATTLE_TYPE_WALLY_TUTORIAL)) | BATTLE_TYPE_WALLY_TUTORIAL))
&& (B_EVOLUTION_AFTER_WHITEOUT >= GEN_6 || gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT)) #if B_EVOLUTION_AFTER_WHITEOUT <= GEN_5
&& (gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT)
#endif
)
{ {
gBattleMainFunc = TrySpecialEvolution; gBattleMainFunc = TrySpecialEvolution;
} }
@ -5455,5 +5469,9 @@ void SetTotemBoost(void)
bool32 IsWildMonSmart(void) bool32 IsWildMonSmart(void)
{ {
return (B_SMART_WILD_AI_FLAG != 0 && FlagGet(B_SMART_WILD_AI_FLAG)); #if B_SMART_WILD_AI_FLAG != 0
return (FlagGet(B_SMART_WILD_AI_FLAG));
#else
return FALSE;
#endif
} }

View File

@ -856,8 +856,10 @@ static bool8 DoesTypePreventStatus(u16 species, u32 status)
break; break;
case STATUS1_PARALYSIS: case STATUS1_PARALYSIS:
if (gBaseStats[species].type1 == TYPE_GROUND || gBaseStats[species].type2 == TYPE_GROUND if (gBaseStats[species].type1 == TYPE_GROUND || gBaseStats[species].type2 == TYPE_GROUND
|| (B_PARALYZE_ELECTRIC >= GEN_6 && #if B_PARALYZE_ELECTRIC >= GEN_6
(gBaseStats[species].type1 == TYPE_ELECTRIC || gBaseStats[species].type2 == TYPE_ELECTRIC))) || gBaseStats[species].type1 == TYPE_ELECTRIC || gBaseStats[species].type2 == TYPE_ELECTRIC
#endif
)
ret = TRUE; ret = TRUE;
break; break;
case STATUS1_BURN: case STATUS1_BURN:

View File

@ -1395,7 +1395,7 @@ static void Cmd_attackcanceler(void)
gBattlescriptCurrInstr = BattleScript_MoveEnd; gBattlescriptCurrInstr = BattleScript_MoveEnd;
return; return;
} }
#if (B_STANCE_CHANGE_FAIL <= GEN_6) #if B_STANCE_CHANGE_FAIL <= GEN_6
if (TryAegiFormChange()) if (TryAegiFormChange())
return; return;
#endif #endif
@ -1430,7 +1430,7 @@ static void Cmd_attackcanceler(void)
gMoveResultFlags |= MOVE_RESULT_MISSED; gMoveResultFlags |= MOVE_RESULT_MISSED;
return; return;
} }
#if (B_STANCE_CHANGE_FAIL >= GEN_7) #if B_STANCE_CHANGE_FAIL >= GEN_7
if (TryAegiFormChange()) if (TryAegiFormChange())
return; return;
#endif #endif
@ -1601,13 +1601,13 @@ static bool32 AccuracyCalcHelper(u16 move)
JumpIfMoveFailed(7, move); JumpIfMoveFailed(7, move);
return TRUE; return TRUE;
} }
else if (B_TOXIC_NEVER_MISS >= GEN_6 #if B_TOXIC_NEVER_MISS >= GEN_6
&& gBattleMoves[move].effect == EFFECT_TOXIC else if (gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON))
&& IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON))
{ {
JumpIfMoveFailed(7, move); JumpIfMoveFailed(7, move);
return TRUE; return TRUE;
} }
#endif
// If the attacker has the ability No Guard and they aren't targeting a Pokemon involved in a Sky Drop with the move Sky Drop, move hits. // If the attacker has the ability No Guard and they aren't targeting a Pokemon involved in a Sky Drop with the move Sky Drop, move hits.
else if (GetBattlerAbility(gBattlerAttacker) == ABILITY_NO_GUARD && (move != MOVE_SKY_DROP || gBattleStruct->skyDropTargets[gBattlerTarget] == 0xFF)) else if (GetBattlerAbility(gBattlerAttacker) == ABILITY_NO_GUARD && (move != MOVE_SKY_DROP || gBattleStruct->skyDropTargets[gBattlerTarget] == 0xFF))
{ {
@ -1639,17 +1639,43 @@ static bool32 AccuracyCalcHelper(u16 move)
return TRUE; return TRUE;
} }
if ((WEATHER_HAS_EFFECT && if (WEATHER_HAS_EFFECT)
((IsBattlerWeatherAffected(gBattlerTarget, B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)) {
|| ((B_BLIZZARD_HAIL >= GEN_4 && (gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)))) if ((IsBattlerWeatherAffected(gBattlerTarget, B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)))
|| (gBattleMoves[move].effect == EFFECT_VITAL_THROW)
|| (gBattleMoves[move].accuracy == 0)
|| ((B_MINIMIZE_DMG_ACC >= GEN_6) && (gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE)))
{ {
// thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella // thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella
JumpIfMoveFailed(7, move); JumpIfMoveFailed(7, move);
return TRUE; return TRUE;
} }
#if B_BLIZZARD_HAIL >= GEN_4
else if ((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD)
{
// thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella
JumpIfMoveFailed(7, move);
return TRUE;
}
#endif
}
if (gBattleMoves[move].effect == EFFECT_VITAL_THROW)
{
JumpIfMoveFailed(7, move);
return TRUE;
}
#if B_MINIMIZE_DMG_ACC >= GEN_6
if ((gStatuses3[gBattlerTarget] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE))
{
JumpIfMoveFailed(7, move);
return TRUE;
}
#endif
if (gBattleMoves[move].accuracy == 0)
{
JumpIfMoveFailed(7, move);
return TRUE;
}
return FALSE; return FALSE;
} }
@ -2885,7 +2911,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
if (sStatusFlagsForMoveEffects[gBattleScripting.moveEffect] == STATUS1_SLEEP) if (sStatusFlagsForMoveEffects[gBattleScripting.moveEffect] == STATUS1_SLEEP)
gBattleMons[gEffectBattler].status1 |= (B_SLEEP_TURNS >= GEN_5) ? ((Random() % 3) + 2) : ((Random() % 4) + 3); #if B_SLEEP_TURNS >= GEN_5
gBattleMons[gEffectBattler].status1 |= ((Random() % 3) + 2);
#else
gBattleMons[gEffectBattler].status1 |= ((Random() % 4) + 3);
#endif
else else
gBattleMons[gEffectBattler].status1 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect]; gBattleMons[gEffectBattler].status1 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect];
@ -2987,7 +3017,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
{ {
gBattleMons[gEffectBattler].status2 |= STATUS2_MULTIPLETURNS; gBattleMons[gEffectBattler].status2 |= STATUS2_MULTIPLETURNS;
gLockedMoves[gEffectBattler] = gCurrentMove; gLockedMoves[gEffectBattler] = gCurrentMove;
gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN(B_UPROAR_TURNS >= GEN_5 ? 3 : ((Random() & 3) + 2)); #if B_UPROAR_TURNS >= GEN_5
gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN(3);
#else
gBattleMons[gEffectBattler].status2 |= STATUS2_UPROAR_TURN((Random() & 3) + 2);
#endif
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect]; gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
@ -3042,9 +3076,15 @@ void SetMoveEffect(bool32 primary, u32 certain)
{ {
gBattleMons[gEffectBattler].status2 |= STATUS2_WRAPPED; gBattleMons[gEffectBattler].status2 |= STATUS2_WRAPPED;
if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_GRIP_CLAW) if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_GRIP_CLAW)
gDisableStructs[gEffectBattler].wrapTurns = (B_BINDING_TURNS >= GEN_5) ? 7 : 5; #if B_BINDING_TURNS >= GEN_5
gDisableStructs[gEffectBattler].wrapTurns = 7;
else else
gDisableStructs[gEffectBattler].wrapTurns = (B_BINDING_TURNS >= GEN_5) ? ((Random() % 2) + 4) : ((Random() % 4) + 2); gDisableStructs[gEffectBattler].wrapTurns = (Random() % 2) + 4;
#else
gDisableStructs[gEffectBattler].wrapTurns = 5;
else
gDisableStructs[gEffectBattler].wrapTurns = (Random() % 4) + 2;
#endif
gBattleStruct->wrappedMove[gEffectBattler] = gCurrentMove; gBattleStruct->wrappedMove[gEffectBattler] = gCurrentMove;
gBattleStruct->wrappedBy[gEffectBattler] = gBattlerAttacker; gBattleStruct->wrappedBy[gEffectBattler] = gBattlerAttacker;
@ -3459,8 +3499,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
break; break;
case MOVE_EFFECT_INCINERATE: case MOVE_EFFECT_INCINERATE:
if ((B_INCINERATE_GEMS >= GEN_6 && GetBattlerHoldEffect(gEffectBattler, FALSE) == HOLD_EFFECT_GEMS) if ((gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX)
|| (gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX)) #if B_INCINERATE_GEMS >= GEN_6
|| (GetBattlerHoldEffect(gEffectBattler, FALSE) == HOLD_EFFECT_GEMS)
#endif
)
{ {
gLastUsedItem = gBattleMons[gEffectBattler].item; gLastUsedItem = gBattleMons[gEffectBattler].item;
gBattleMons[gEffectBattler].item = 0; gBattleMons[gEffectBattler].item = 0;
@ -4004,12 +4047,19 @@ static void Cmd_getexp(void)
gBattleMoveDamage = 0; gBattleMoveDamage = 0;
// only give exp share bonus in later gens if the mon wasn't sent out // only give exp share bonus in later gens if the mon wasn't sent out
if ((holdEffect == HOLD_EFFECT_EXP_SHARE) && ((gBattleMoveDamage == 0) || (B_SPLIT_EXP < GEN_6))) #if B_SPLIT_EXP < GEN_6
if (holdEffect == HOLD_EFFECT_EXP_SHARE)
gBattleMoveDamage += gExpShareExp; gBattleMoveDamage += gExpShareExp;
#else
if (holdEffect == HOLD_EFFECT_EXP_SHARE && gBattleMoveDamage == 0)
gBattleMoveDamage += gExpShareExp;
#endif
if (holdEffect == HOLD_EFFECT_LUCKY_EGG) if (holdEffect == HOLD_EFFECT_LUCKY_EGG)
gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; gBattleMoveDamage = (gBattleMoveDamage * 150) / 100;
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && B_TRAINER_EXP_MULTIPLIER <= GEN_7) #if B_TRAINER_EXP_MULTIPLIER <= GEN_7
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
gBattleMoveDamage = (gBattleMoveDamage * 150) / 100; gBattleMoveDamage = (gBattleMoveDamage * 150) / 100;
#endif
#if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6) #if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6)
{ {
// Note: There is an edge case where if a pokemon receives a large amount of exp, it wouldn't be properly calculated // Note: There is an edge case where if a pokemon receives a large amount of exp, it wouldn't be properly calculated
@ -5035,7 +5085,11 @@ static void Cmd_moveend(void)
i = gBattlerAttacker; i = gBattlerAttacker;
gBattlerAttacker = gBattlerTarget; gBattlerAttacker = gBattlerTarget;
gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable gBattlerTarget = i; // gBattlerTarget and gBattlerAttacker are swapped in order to activate Defiant, if applicable
gBattleScripting.moveEffect = (B_KINGS_SHIELD_LOWER_ATK >= GEN_8) ? MOVE_EFFECT_ATK_MINUS_1 : MOVE_EFFECT_ATK_MINUS_2; #if B_KINGS_SHIELD_LOWER_ATK >= GEN_8
gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1;
#else
gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_2;
#endif
BattleScriptPushCursor(); BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_KingsShieldEffect; gBattlescriptCurrInstr = BattleScript_KingsShieldEffect;
effect = 1; effect = 1;
@ -5605,17 +5659,19 @@ static void Cmd_moveend(void)
BattleScriptPushCursor(); BattleScriptPushCursor();
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER || GetBattlerSide(i) == B_SIDE_PLAYER) if (gBattleTypeFlags & BATTLE_TYPE_TRAINER || GetBattlerSide(i) == B_SIDE_PLAYER)
{ {
if (B_ABILITY_POP_UP) #if B_ABILITY_POP_UP == TRUE
gBattlescriptCurrInstr = BattleScript_EmergencyExit; gBattlescriptCurrInstr = BattleScript_EmergencyExit;
else #else
gBattlescriptCurrInstr = BattleScript_EmergencyExitNoPopUp; gBattlescriptCurrInstr = BattleScript_EmergencyExitNoPopUp;
#endif
} }
else else
{ {
if (B_ABILITY_POP_UP) #if B_ABILITY_POP_UP == TRUE
gBattlescriptCurrInstr = BattleScript_EmergencyExitWild; gBattlescriptCurrInstr = BattleScript_EmergencyExitWild;
else #else
gBattlescriptCurrInstr = BattleScript_EmergencyExitWildNoPopUp; gBattlescriptCurrInstr = BattleScript_EmergencyExitWildNoPopUp;
#endif
} }
return; return;
} }
@ -8361,11 +8417,11 @@ static void Cmd_various(void)
&& !NoAliveMonsForEitherParty() && !NoAliveMonsForEitherParty()
&& CompareStat(gBattlerAttacker, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN)) && CompareStat(gBattlerAttacker, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN))
{ {
if (B_FELL_STINGER_STAT_RAISE >= GEN_7) #if B_FELL_STINGER_STAT_RAISE >= GEN_7
SET_STATCHANGER(STAT_ATK, 3, FALSE); SET_STATCHANGER(STAT_ATK, 3, FALSE);
else #else
SET_STATCHANGER(STAT_ATK, 2, FALSE); SET_STATCHANGER(STAT_ATK, 2, FALSE);
#endif
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK); PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
BattleScriptPush(gBattlescriptCurrInstr + 3); BattleScriptPush(gBattlescriptCurrInstr + 3);
gBattlescriptCurrInstr = BattleScript_FellStingerRaisesStat; gBattlescriptCurrInstr = BattleScript_FellStingerRaisesStat;
@ -9944,13 +10000,16 @@ static void Cmd_manipulatedamage(void)
gBattleMoveDamage *= -1; gBattleMoveDamage *= -1;
break; break;
case DMG_RECOIL_FROM_MISS: case DMG_RECOIL_FROM_MISS:
#if B_RECOIL_IF_MISS_DMG >= GEN_5
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2;
#elif B_RECOIL_IF_MISS_DMG == GEN_4
if ((gBattleMons[gBattlerTarget].maxHP / 2) < gBattleMoveDamage)
gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2;
#else
gBattleMoveDamage /= 2; gBattleMoveDamage /= 2;
#endif
if (gBattleMoveDamage == 0) if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1; gBattleMoveDamage = 1;
if (B_RECOIL_IF_MISS_DMG >= GEN_5)
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2;
if ((B_RECOIL_IF_MISS_DMG <= GEN_4) && ((gBattleMons[gBattlerTarget].maxHP / 2) < gBattleMoveDamage))
gBattleMoveDamage = gBattleMons[gBattlerTarget].maxHP / 2;
break; break;
case DMG_DOUBLED: case DMG_DOUBLED:
gBattleMoveDamage *= 2; gBattleMoveDamage *= 2;
@ -10569,8 +10628,9 @@ static void Cmd_setmultihitcounter(void)
{ {
gMultiHitCounter = 5; gMultiHitCounter = 5;
} }
else if (B_MULTI_HIT_CHANCE >= GEN_5) else
{ {
#if B_MULTI_HIT_CHANCE >= GEN_5
// 2 and 3 hits: 33.3% // 2 and 3 hits: 33.3%
// 4 and 5 hits: 16.7% // 4 and 5 hits: 16.7%
gMultiHitCounter = Random() % 4; gMultiHitCounter = Random() % 4;
@ -10584,9 +10644,7 @@ static void Cmd_setmultihitcounter(void)
} }
else else
gMultiHitCounter += 3; gMultiHitCounter += 3;
} #else
else
{
// 2 and 3 hits: 37.5% // 2 and 3 hits: 37.5%
// 4 and 5 hits: 12.5% // 4 and 5 hits: 12.5%
gMultiHitCounter = Random() % 4; gMultiHitCounter = Random() % 4;
@ -10594,6 +10652,7 @@ static void Cmd_setmultihitcounter(void)
gMultiHitCounter = (Random() % 4) + 2; gMultiHitCounter = (Random() % 4) + 2;
else else
gMultiHitCounter += 2; gMultiHitCounter += 2;
#endif
} }
} }
@ -11354,10 +11413,11 @@ static void Cmd_dmgtolevel(void)
static void Cmd_psywavedamageeffect(void) static void Cmd_psywavedamageeffect(void)
{ {
s32 randDamage; s32 randDamage;
if (B_PSYWAVE_DMG >= GEN_6) #if B_PSYWAVE_DMG >= GEN_6
randDamage = (Random() % 101); randDamage = (Random() % 101);
else #else
randDamage = (Random() % 11) * 10; randDamage = (Random() % 11) * 10;
#endif
gBattleMoveDamage = gBattleMons[gBattlerAttacker].level * (randDamage + 50) / 100; gBattleMoveDamage = gBattleMons[gBattlerAttacker].level * (randDamage + 50) / 100;
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
@ -11428,12 +11488,13 @@ static void Cmd_disablelastusedattack(void)
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerTarget].moves[i]) PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerTarget].moves[i])
gDisableStructs[gBattlerTarget].disabledMove = gBattleMons[gBattlerTarget].moves[i]; gDisableStructs[gBattlerTarget].disabledMove = gBattleMons[gBattlerTarget].moves[i];
if (B_DISABLE_TURNS == GEN_3) #if B_DISABLE_TURNS == GEN_3
gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 2; gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 2;
else if (B_DISABLE_TURNS == GEN_4) #elif B_DISABLE_TURNS == GEN_4
gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 4; gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 4;
else #else
gDisableStructs[gBattlerTarget].disableTimer = 4; gDisableStructs[gBattlerTarget].disableTimer = 4;
#endif
gDisableStructs[gBattlerTarget].disableTimerStartValue = gDisableStructs[gBattlerTarget].disableTimer; // used to save the random amount of turns? gDisableStructs[gBattlerTarget].disableTimerStartValue = gDisableStructs[gBattlerTarget].disableTimer; // used to save the random amount of turns?
gBattlescriptCurrInstr += 5; gBattlescriptCurrInstr += 5;
} }
@ -11711,7 +11772,11 @@ static void Cmd_settailwind(void)
{ {
gSideStatuses[side] |= SIDE_STATUS_TAILWIND; gSideStatuses[side] |= SIDE_STATUS_TAILWIND;
gSideTimers[side].tailwindBattlerId = gBattlerAttacker; gSideTimers[side].tailwindBattlerId = gBattlerAttacker;
gSideTimers[side].tailwindTimer = (B_TAILWIND_TURNS >= GEN_5) ? 4 : 3; #if B_TAILWIND_TURNS >= GEN_5
gSideTimers[side].tailwindTimer = 4;
#else
gSideTimers[side].tailwindTimer = 3;
#endif
gBattlescriptCurrInstr += 5; gBattlescriptCurrInstr += 5;
} }
else else
@ -12634,7 +12699,7 @@ static void Cmd_tryswapitems(void)
| BATTLE_TYPE_FRONTIER | BATTLE_TYPE_FRONTIER
| BATTLE_TYPE_SECRET_BASE | BATTLE_TYPE_SECRET_BASE
| BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_LINK
#if B_TRAINERS_KNOCK_OFF_ITEMS #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
| BATTLE_TYPE_TRAINER | BATTLE_TYPE_TRAINER
#endif #endif
)))) ))))
@ -13180,45 +13245,40 @@ u16 GetSecretPowerMoveEffect(void)
{ {
switch (gBattleTerrain) switch (gBattleTerrain)
{ {
case BATTLE_TERRAIN_GRASS: #if B_SECRET_POWER_EFFECT >= GEN_6
#if B_SECRET_POWER_EFFECT >= GEN_4 case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break;
moveEffect = MOVE_EFFECT_SLEEP; case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break;
case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break;
case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break;
case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break;
#elif B_SECRET_POWER_EFFECT >= GEN_5
case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break;
case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break;
case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break;
case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break;
case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break;
#elif B_SECRET_POWER_EFFECT >= GEN_4
case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break;
case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break;
case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_ATK_MINUS_1; break;
case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_FLINCH; break;
case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break;
#else #else
moveEffect = MOVE_EFFECT_POISON; case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_POISON; break;
case BATTLE_TERRAIN_UNDERWATER: moveEffect = MOVE_EFFECT_DEF_MINUS_1; break;
case BATTLE_TERRAIN_POND: moveEffect = MOVE_EFFECT_SPD_MINUS_1; break;
case BATTLE_TERRAIN_MOUNTAIN: moveEffect = MOVE_EFFECT_CONFUSION; break;
case BATTLE_TERRAIN_PUDDLE: moveEffect = MOVE_EFFECT_ACC_MINUS_1; break;
#endif #endif
break;
case BATTLE_TERRAIN_LONG_GRASS: case BATTLE_TERRAIN_LONG_GRASS:
moveEffect = MOVE_EFFECT_SLEEP; moveEffect = MOVE_EFFECT_SLEEP;
break; break;
case BATTLE_TERRAIN_SAND: case BATTLE_TERRAIN_SAND:
moveEffect = MOVE_EFFECT_ACC_MINUS_1; moveEffect = MOVE_EFFECT_ACC_MINUS_1;
break; break;
case BATTLE_TERRAIN_UNDERWATER:
#if B_SECRET_POWER_EFFECT >= GEN_6
moveEffect = MOVE_EFFECT_ATK_MINUS_1;
#else
moveEffect = MOVE_EFFECT_DEF_MINUS_1;
#endif
break;
case BATTLE_TERRAIN_WATER: case BATTLE_TERRAIN_WATER:
moveEffect = MOVE_EFFECT_ATK_MINUS_1; moveEffect = MOVE_EFFECT_ATK_MINUS_1;
break; break;
case BATTLE_TERRAIN_POND:
#if B_SECRET_POWER_EFFECT >= GEN_4
moveEffect = MOVE_EFFECT_ATK_MINUS_1;
#else
moveEffect = MOVE_EFFECT_SPD_MINUS_1;
#endif
break;
case BATTLE_TERRAIN_MOUNTAIN:
#if B_SECRET_POWER_EFFECT >= GEN_5
moveEffect = MOVE_EFFECT_ACC_MINUS_1;
#elif B_SECRET_POWER_EFFECT == GEN_4
moveEffect = MOVE_EFFECT_FLINCH;
#else
moveEffect = MOVE_EFFECT_CONFUSION;
#endif
break;
case BATTLE_TERRAIN_CAVE: case BATTLE_TERRAIN_CAVE:
case BATTLE_TERRAIN_BURIAL_GROUND: case BATTLE_TERRAIN_BURIAL_GROUND:
case BATTLE_TERRAIN_SPACE: case BATTLE_TERRAIN_SPACE:
@ -13230,13 +13290,6 @@ u16 GetSecretPowerMoveEffect(void)
case BATTLE_TERRAIN_SWAMP: case BATTLE_TERRAIN_SWAMP:
moveEffect = MOVE_EFFECT_SPD_MINUS_1; moveEffect = MOVE_EFFECT_SPD_MINUS_1;
break; break;
case BATTLE_TERRAIN_PUDDLE:
#if B_SECRET_POWER_EFFECT >= GEN_5
moveEffect = MOVE_EFFECT_SPD_MINUS_1;
#else
moveEffect = MOVE_EFFECT_ACC_MINUS_1;
#endif
break;
case BATTLE_TERRAIN_SNOW: case BATTLE_TERRAIN_SNOW:
case BATTLE_TERRAIN_ICE: case BATTLE_TERRAIN_ICE:
moveEffect = MOVE_EFFECT_FREEZE; moveEffect = MOVE_EFFECT_FREEZE;
@ -13439,12 +13492,14 @@ bool32 DoesSubstituteBlockMove(u8 battlerAtk, u8 battlerDef, u32 move)
{ {
if (!(gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE)) if (!(gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE))
return FALSE; return FALSE;
else if (gBattleMoves[move].flags & FLAG_SOUND && B_SOUND_SUBSTITUTE >= GEN_6) #if B_SOUND_SUBSTITUTE >= GEN_6
else if (gBattleMoves[move].flags & FLAG_SOUND)
return FALSE;
#endif
else if (gBattleMoves[move].flags & FLAG_HIT_IN_SUBSTITUTE)
return FALSE; return FALSE;
else if (GetBattlerAbility(battlerAtk) == ABILITY_INFILTRATOR) else if (GetBattlerAbility(battlerAtk) == ABILITY_INFILTRATOR)
return FALSE; return FALSE;
else if (gBattleMoves[move].flags & FLAG_HIT_IN_SUBSTITUTE)
return FALSE;
else else
return TRUE; return TRUE;
} }
@ -13680,13 +13735,12 @@ static void Cmd_handleballthrow(void)
#endif #endif
break; break;
case ITEM_DIVE_BALL: case ITEM_DIVE_BALL:
if (GetCurrentMapType() == MAP_TYPE_UNDERWATER
#if B_DIVE_BALL_MODIFIER >= GEN_4 #if B_DIVE_BALL_MODIFIER >= GEN_4
if (GetCurrentMapType() == MAP_TYPE_UNDERWATER || gIsFishingEncounter || gIsSurfingEncounter) || gIsFishingEncounter || gIsSurfingEncounter
ballMultiplier = 35;
#else
if (GetCurrentMapType() == MAP_TYPE_UNDERWATER)
ballMultiplier = 35;
#endif #endif
)
ballMultiplier = 35;
break; break;
case ITEM_NEST_BALL: case ITEM_NEST_BALL:
#if B_NEST_BALL_MODIFIER >= GEN_6 #if B_NEST_BALL_MODIFIER >= GEN_6
@ -14210,13 +14264,11 @@ static const u16 sTelekinesisBanList[] =
{ {
SPECIES_DIGLETT, SPECIES_DIGLETT,
SPECIES_DUGTRIO, SPECIES_DUGTRIO,
// #ifdef NEW_POKEMON
SPECIES_DIGLETT_ALOLAN, SPECIES_DIGLETT_ALOLAN,
SPECIES_DUGTRIO_ALOLAN, SPECIES_DUGTRIO_ALOLAN,
SPECIES_SANDYGAST, SPECIES_SANDYGAST,
SPECIES_PALOSSAND, SPECIES_PALOSSAND,
SPECIES_GENGAR_MEGA, SPECIES_GENGAR_MEGA,
// #endif
}; };
bool32 IsTelekinesisBannedSpecies(u16 species) bool32 IsTelekinesisBannedSpecies(u16 species)

View File

@ -57,6 +57,7 @@ functions instead of at the top of the file with the other declarations.
static bool32 TryRemoveScreens(u8 battler); static bool32 TryRemoveScreens(u8 battler);
static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId); static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId);
static u8 GetFlingPowerFromItemId(u16 itemId);
extern const u8 *const gBattleScriptsForMoveEffects[]; extern const u8 *const gBattleScriptsForMoveEffects[];
extern const u8 *const gBattlescriptsForRunningByItem[]; extern const u8 *const gBattlescriptsForRunningByItem[];
@ -2770,8 +2771,11 @@ u8 DoBattlerEndTurnEffects(void)
&& gBattleMons[gActiveBattler].hp != 0) && gBattleMons[gActiveBattler].hp != 0)
{ {
MAGIC_GUARD_CHECK; MAGIC_GUARD_CHECK;
#if B_BURN_DAMAGE >= GEN_7
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / (B_BURN_DAMAGE >= GEN_7 ? 16 : 8); gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16;
#else
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8;
#endif
if (ability == ABILITY_HEATPROOF) if (ability == ABILITY_HEATPROOF)
{ {
if (gBattleMoveDamage > (gBattleMoveDamage / 2) + 1) // Record ability if the burn takes less damage than it normally would. if (gBattleMoveDamage > (gBattleMoveDamage / 2) + 1) // Record ability if the burn takes less damage than it normally would.
@ -2832,9 +2836,15 @@ u8 DoBattlerEndTurnEffects(void)
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[gActiveBattler]); PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleStruct->wrappedMove[gActiveBattler]);
gBattlescriptCurrInstr = BattleScript_WrapTurnDmg; gBattlescriptCurrInstr = BattleScript_WrapTurnDmg;
if (GetBattlerHoldEffect(gBattleStruct->wrappedBy[gActiveBattler], TRUE) == HOLD_EFFECT_BINDING_BAND) if (GetBattlerHoldEffect(gBattleStruct->wrappedBy[gActiveBattler], TRUE) == HOLD_EFFECT_BINDING_BAND)
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / ((B_BINDING_DAMAGE >= GEN_6) ? 6 : 8); #if B_BINDING_DAMAGE >= GEN_6
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 6;
else else
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / ((B_BINDING_DAMAGE >= GEN_6) ? 8 : 16); gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8;
#else
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8;
else
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16;
#endif
if (gBattleMoveDamage == 0) if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1; gBattleMoveDamage = 1;
@ -3025,7 +3035,11 @@ u8 DoBattlerEndTurnEffects(void)
} }
else else
{ {
gBattleMons[gActiveBattler].status1 |= (B_SLEEP_TURNS >= GEN_5) ? ((Random() % 3) + 2) : ((Random() % 4) + 3); #if B_SLEEP_TURNS >= GEN_5
gBattleMons[gActiveBattler].status1 |= ((Random() % 3) + 2);
#else
gBattleMons[gActiveBattler].status1 |= ((Random() % 4) + 3);
#endif
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1); BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
MarkBattlerForControllerExec(gActiveBattler); MarkBattlerForControllerExec(gActiveBattler);
BattleScriptExecute(BattleScript_YawnMakesAsleep); BattleScriptExecute(BattleScript_YawnMakesAsleep);
@ -3572,7 +3586,12 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattleMons[gBattlerAttacker].status2 -= STATUS2_CONFUSION_TURN(1); gBattleMons[gBattlerAttacker].status2 -= STATUS2_CONFUSION_TURN(1);
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_CONFUSION) if (gBattleMons[gBattlerAttacker].status2 & STATUS2_CONFUSION)
{ {
if (Random() % ((B_CONFUSION_SELF_DMG_CHANCE >= GEN_7) ? 3 : 2) == 0) // confusion dmg // confusion dmg
#if B_CONFUSION_SELF_DMG_CHANCE >= GEN_7
if (Random() % 3 == 0)
#else
if (Random() % 2 == 0)
#endif
{ {
gBattleCommunication[MULTISTRING_CHOOSER] = TRUE; gBattleCommunication[MULTISTRING_CHOOSER] = TRUE;
gBattlerTarget = gBattlerAttacker; gBattlerTarget = gBattlerAttacker;
@ -3675,8 +3694,11 @@ u8 AtkCanceller_UnableToUseMove(void)
case CANCELLER_POWDER_MOVE: case CANCELLER_POWDER_MOVE:
if ((gBattleMoves[gCurrentMove].flags & FLAG_POWDER) && (gBattlerAttacker != gBattlerTarget)) if ((gBattleMoves[gCurrentMove].flags & FLAG_POWDER) && (gBattlerAttacker != gBattlerTarget))
{ {
if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS)) #if B_POWDER_GRASS >= GEN_6
|| GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT) if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS) || GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT)
#else
if (GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT)
#endif
{ {
gBattlerAbility = gBattlerTarget; gBattlerAbility = gBattlerTarget;
effect = 1; effect = 1;
@ -4003,19 +4025,20 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
{ {
u16 battlerAbility = GetBattlerAbility(battler); u16 battlerAbility = GetBattlerAbility(battler);
if (viaAbility && B_ABILITY_WEATHER <= GEN_5 if (gBattleWeather & B_WEATHER_PRIMAL_ANY
&& !(gBattleWeather & sWeatherFlagsInfo[weatherEnumId][1]))
{
gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]);
return TRUE;
}
else if (gBattleWeather & B_WEATHER_PRIMAL_ANY
&& battlerAbility != ABILITY_DESOLATE_LAND && battlerAbility != ABILITY_DESOLATE_LAND
&& battlerAbility != ABILITY_PRIMORDIAL_SEA && battlerAbility != ABILITY_PRIMORDIAL_SEA
&& battlerAbility != ABILITY_DELTA_STREAM) && battlerAbility != ABILITY_DELTA_STREAM)
{ {
return FALSE; return FALSE;
} }
#if B_ABILITY_WEATHER <= GEN_5
else if (viaAbility && !(gBattleWeather & sWeatherFlagsInfo[weatherEnumId][1]))
{
gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]);
return TRUE;
}
#endif
else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1]))) else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1])))
{ {
gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0]); gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0]);
@ -4745,7 +4768,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
if (gDisableStructs[battler].isFirstTurn != 2) if (gDisableStructs[battler].isFirstTurn != 2)
{ {
u32 validToRaise = 0, validToLower = 0; u32 validToRaise = 0, validToLower = 0;
u32 statsNum = (B_MOODY_ACC_EVASION != GEN_8) ? NUM_BATTLE_STATS : NUM_STATS; #if B_MOODY_ACC_EVASION < GEN_8
u32 statsNum = NUM_BATTLE_STATS;
#else
u32 statsNum = NUM_STATS;
#endif
for (i = STAT_ATK; i < statsNum; i++) for (i = STAT_ATK; i < statsNum; i++)
{ {
@ -4932,7 +4959,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
effect = 2, statId = STAT_ATK; effect = 2, statId = STAT_ATK;
break; break;
case ABILITY_FLASH_FIRE: case ABILITY_FLASH_FIRE:
if (moveType == TYPE_FIRE && !((gBattleMons[battler].status1 & STATUS1_FREEZE) && B_FLASH_FIRE_FROZEN <= GEN_4)) if (moveType == TYPE_FIRE
#if B_FLASH_FIRE_FROZEN <= GEN_4
&& !(gBattleMons[battler].status1 & STATUS1_FREEZE)
#endif
)
{ {
if (!(gBattleResources->flags->flags[battler] & RESOURCE_FLAG_FLASH_FIRE)) if (!(gBattleResources->flags->flags[battler] & RESOURCE_FLAG_FLASH_FIRE))
{ {
@ -5980,7 +6011,11 @@ bool32 CanBattlerEscape(u32 battlerId) // no ability check
{ {
if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_SHED_SHELL) if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_SHED_SHELL)
return TRUE; return TRUE;
else if ((B_GHOSTS_ESCAPE >= GEN_6 && !IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST)) && gBattleMons[battlerId].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)) #if B_GHOSTS_ESCAPE >= GEN_6
else if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST))
return TRUE;
#endif
else if (gBattleMons[battlerId].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED))
return FALSE; return FALSE;
else if (gStatuses3[battlerId] & STATUS3_ROOTED) else if (gStatuses3[battlerId] & STATUS3_ROOTED)
return FALSE; return FALSE;
@ -6078,8 +6113,11 @@ bool32 CanBeBurned(u8 battlerId)
bool32 CanBeParalyzed(u8 battlerId) bool32 CanBeParalyzed(u8 battlerId)
{ {
u16 ability = GetBattlerAbility(battlerId); u16 ability = GetBattlerAbility(battlerId);
if ((B_PARALYZE_ELECTRIC >= GEN_6 && IS_BATTLER_OF_TYPE(battlerId, TYPE_ELECTRIC)) if (
|| gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD #if B_PARALYZE_ELECTRIC >= GEN_6
IS_BATTLER_OF_TYPE(battlerId, TYPE_ELECTRIC) ||
#endif
gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD
|| ability == ABILITY_LIMBER || ability == ABILITY_LIMBER
|| ability == ABILITY_COMATOSE || ability == ABILITY_COMATOSE
|| gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status1 & STATUS1_ANY
@ -6146,11 +6184,11 @@ bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId)
static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2) static u8 HealConfuseBerry(u32 battlerId, u32 itemId, u8 flavorId, bool32 end2)
{ {
if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId)
#if B_HEAL_BLOCKING >= GEN_5 #if B_HEAL_BLOCKING >= GEN_5
if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)
#else
if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId))
#endif #endif
)
{ {
PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, flavorId); PREPARE_FLAVOR_BUFFER(gBattleTextBuff1, flavorId);
@ -6338,12 +6376,11 @@ u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 exec
static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal) static u8 ItemHealHp(u32 battlerId, u32 itemId, bool32 end2, bool32 percentHeal)
{ {
if (!(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)
#if B_HEAL_BLOCKING >= GEN_5 #if B_HEAL_BLOCKING >= GEN_5
if (HasEnoughHpToEatBerry(battlerId, 2, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)
#else
if (HasEnoughHpToEatBerry(battlerId, 2, itemId)
#endif #endif
&& !(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)) && HasEnoughHpToEatBerry(battlerId, 2, itemId))
{ {
if (percentHeal) if (percentHeal)
gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerHoldEffectParam(battlerId) / 100) * -1; gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerHoldEffectParam(battlerId) / 100) * -1;
@ -6478,48 +6515,39 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
BattleScriptExecute(BattleScript_WhiteHerbEnd2); BattleScriptExecute(BattleScript_WhiteHerbEnd2);
} }
break; break;
#if B_BERRIES_INSTANT >= GEN_4
case HOLD_EFFECT_CONFUSE_SPICY: case HOLD_EFFECT_CONFUSE_SPICY:
if (B_BERRIES_INSTANT >= GEN_4)
effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, TRUE); effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, TRUE);
break; break;
case HOLD_EFFECT_CONFUSE_DRY: case HOLD_EFFECT_CONFUSE_DRY:
if (B_BERRIES_INSTANT >= GEN_4)
effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, TRUE); effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, TRUE);
break; break;
case HOLD_EFFECT_CONFUSE_SWEET: case HOLD_EFFECT_CONFUSE_SWEET:
if (B_BERRIES_INSTANT >= GEN_4)
effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, TRUE); effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, TRUE);
break; break;
case HOLD_EFFECT_CONFUSE_BITTER: case HOLD_EFFECT_CONFUSE_BITTER:
if (B_BERRIES_INSTANT >= GEN_4)
effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, TRUE); effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, TRUE);
break; break;
case HOLD_EFFECT_CONFUSE_SOUR: case HOLD_EFFECT_CONFUSE_SOUR:
if (B_BERRIES_INSTANT >= GEN_4)
effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, TRUE); effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, TRUE);
break; break;
case HOLD_EFFECT_ATTACK_UP: case HOLD_EFFECT_ATTACK_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, TRUE); effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, TRUE);
break; break;
case HOLD_EFFECT_DEFENSE_UP: case HOLD_EFFECT_DEFENSE_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, TRUE); effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, TRUE);
break; break;
case HOLD_EFFECT_SPEED_UP: case HOLD_EFFECT_SPEED_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, TRUE); effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, TRUE);
break; break;
case HOLD_EFFECT_SP_ATTACK_UP: case HOLD_EFFECT_SP_ATTACK_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, TRUE); effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, TRUE);
break; break;
case HOLD_EFFECT_SP_DEFENSE_UP: case HOLD_EFFECT_SP_DEFENSE_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, TRUE); effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, TRUE);
break; break;
case HOLD_EFFECT_CRITICAL_UP: case HOLD_EFFECT_CRITICAL_UP:
if (B_BERRIES_INSTANT >= GEN_4 && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY) && HasEnoughHpToEatBerry(battlerId, GetBattlerHoldEffectParam(battlerId), gLastUsedItem)) if (!(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY) && HasEnoughHpToEatBerry(battlerId, GetBattlerHoldEffectParam(battlerId), gLastUsedItem))
{ {
gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY; gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY;
BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2); BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2);
@ -6527,11 +6555,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_RANDOM_STAT_UP: case HOLD_EFFECT_RANDOM_STAT_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE); effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE);
break; break;
case HOLD_EFFECT_CURE_PAR: case HOLD_EFFECT_CURE_PAR:
if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem))
{ {
gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS; gBattleMons[battlerId].status1 &= ~STATUS1_PARALYSIS;
BattleScriptExecute(BattleScript_BerryCurePrlzEnd2); BattleScriptExecute(BattleScript_BerryCurePrlzEnd2);
@ -6539,7 +6566,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_CURE_PSN: case HOLD_EFFECT_CURE_PSN:
if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_PSN_ANY && !UnnerveOn(battlerId, gLastUsedItem)) if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY && !UnnerveOn(battlerId, gLastUsedItem))
{ {
gBattleMons[battlerId].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER); gBattleMons[battlerId].status1 &= ~(STATUS1_PSN_ANY | STATUS1_TOXIC_COUNTER);
BattleScriptExecute(BattleScript_BerryCurePsnEnd2); BattleScriptExecute(BattleScript_BerryCurePsnEnd2);
@ -6547,7 +6574,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_CURE_BRN: case HOLD_EFFECT_CURE_BRN:
if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_BURN && !UnnerveOn(battlerId, gLastUsedItem)) if (gBattleMons[battlerId].status1 & STATUS1_BURN && !UnnerveOn(battlerId, gLastUsedItem))
{ {
gBattleMons[battlerId].status1 &= ~STATUS1_BURN; gBattleMons[battlerId].status1 &= ~STATUS1_BURN;
BattleScriptExecute(BattleScript_BerryCureBrnEnd2); BattleScriptExecute(BattleScript_BerryCureBrnEnd2);
@ -6555,7 +6582,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_CURE_FRZ: case HOLD_EFFECT_CURE_FRZ:
if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_FREEZE && !UnnerveOn(battlerId, gLastUsedItem)) if (gBattleMons[battlerId].status1 & STATUS1_FREEZE && !UnnerveOn(battlerId, gLastUsedItem))
{ {
gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE; gBattleMons[battlerId].status1 &= ~STATUS1_FREEZE;
BattleScriptExecute(BattleScript_BerryCureFrzEnd2); BattleScriptExecute(BattleScript_BerryCureFrzEnd2);
@ -6563,7 +6590,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_CURE_SLP: case HOLD_EFFECT_CURE_SLP:
if (B_BERRIES_INSTANT >= GEN_4 && gBattleMons[battlerId].status1 & STATUS1_SLEEP && !UnnerveOn(battlerId, gLastUsedItem)) if (gBattleMons[battlerId].status1 & STATUS1_SLEEP && !UnnerveOn(battlerId, gLastUsedItem))
{ {
gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP; gBattleMons[battlerId].status1 &= ~STATUS1_SLEEP;
gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE; gBattleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE;
@ -6572,7 +6599,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_CURE_STATUS: case HOLD_EFFECT_CURE_STATUS:
if (B_BERRIES_INSTANT >= GEN_4 && (gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) && !UnnerveOn(battlerId, gLastUsedItem)) if ((gBattleMons[battlerId].status1 & STATUS1_ANY || gBattleMons[battlerId].status2 & STATUS2_CONFUSION) && !UnnerveOn(battlerId, gLastUsedItem))
{ {
i = 0; i = 0;
if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY) if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY)
@ -6617,13 +6644,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
} }
break; break;
case HOLD_EFFECT_RESTORE_HP: case HOLD_EFFECT_RESTORE_HP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE); effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE);
break; break;
case HOLD_EFFECT_RESTORE_PCT_HP: case HOLD_EFFECT_RESTORE_PCT_HP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE); effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, TRUE);
break; break;
#endif
case HOLD_EFFECT_AIR_BALLOON: case HOLD_EFFECT_AIR_BALLOON:
effect = ITEM_EFFECT_OTHER; effect = ITEM_EFFECT_OTHER;
gBattleScripting.battler = battlerId; gBattleScripting.battler = battlerId;
@ -6984,62 +7010,52 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
DO_ITEMEFFECT_MOVE_END: DO_ITEMEFFECT_MOVE_END:
switch (battlerHoldEffect) switch (battlerHoldEffect)
{ {
#if B_HP_BERRIES >= GEN_4
case HOLD_EFFECT_MICLE_BERRY: case HOLD_EFFECT_MICLE_BERRY:
if (B_HP_BERRIES >= GEN_4)
effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE); effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE);
break; break;
case HOLD_EFFECT_RESTORE_HP: case HOLD_EFFECT_RESTORE_HP:
if (B_HP_BERRIES >= GEN_4)
effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE); effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE);
break; break;
#endif
#if B_BERRIES_INSTANT >= GEN_4
case HOLD_EFFECT_RESTORE_PCT_HP: case HOLD_EFFECT_RESTORE_PCT_HP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, TRUE); effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, TRUE);
break; break;
case HOLD_EFFECT_CONFUSE_SPICY: case HOLD_EFFECT_CONFUSE_SPICY:
if (B_BERRIES_INSTANT >= GEN_4)
effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, FALSE); effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SPICY, FALSE);
break; break;
case HOLD_EFFECT_CONFUSE_DRY: case HOLD_EFFECT_CONFUSE_DRY:
if (B_BERRIES_INSTANT >= GEN_4)
effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, FALSE); effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_DRY, FALSE);
break; break;
case HOLD_EFFECT_CONFUSE_SWEET: case HOLD_EFFECT_CONFUSE_SWEET:
if (B_BERRIES_INSTANT >= GEN_4)
effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, FALSE); effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SWEET, FALSE);
break; break;
case HOLD_EFFECT_CONFUSE_BITTER: case HOLD_EFFECT_CONFUSE_BITTER:
if (B_BERRIES_INSTANT >= GEN_4)
effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, FALSE); effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_BITTER, FALSE);
break; break;
case HOLD_EFFECT_CONFUSE_SOUR: case HOLD_EFFECT_CONFUSE_SOUR:
if (B_BERRIES_INSTANT >= GEN_4)
effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, FALSE); effect = HealConfuseBerry(battlerId, gLastUsedItem, FLAVOR_SOUR, FALSE);
break; break;
case HOLD_EFFECT_ATTACK_UP: case HOLD_EFFECT_ATTACK_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, FALSE); effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_ATK, FALSE);
break; break;
case HOLD_EFFECT_DEFENSE_UP: case HOLD_EFFECT_DEFENSE_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, FALSE); effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_DEF, FALSE);
break; break;
case HOLD_EFFECT_SPEED_UP: case HOLD_EFFECT_SPEED_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, FALSE); effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPEED, FALSE);
break; break;
case HOLD_EFFECT_SP_ATTACK_UP: case HOLD_EFFECT_SP_ATTACK_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, FALSE); effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPATK, FALSE);
break; break;
case HOLD_EFFECT_SP_DEFENSE_UP: case HOLD_EFFECT_SP_DEFENSE_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, FALSE); effect = StatRaiseBerry(battlerId, gLastUsedItem, STAT_SPDEF, FALSE);
break; break;
case HOLD_EFFECT_RANDOM_STAT_UP: case HOLD_EFFECT_RANDOM_STAT_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, FALSE); effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, FALSE);
break; break;
#endif
case HOLD_EFFECT_CURE_PAR: case HOLD_EFFECT_CURE_PAR:
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem)) if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem))
{ {
@ -7722,9 +7738,12 @@ u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating)
gPotentialItemEffectBattler = battlerId; gPotentialItemEffectBattler = battlerId;
if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId] != 0 && gBattleMons[battlerId].item) #if B_ENABLE_DEBUG == TRUE
if (gBattleStruct->debugHoldEffects[battlerId] != 0 && gBattleMons[battlerId].item)
return gBattleStruct->debugHoldEffects[battlerId]; return gBattleStruct->debugHoldEffects[battlerId];
else if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY) else
#endif
if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY)
return gEnigmaBerries[battlerId].holdEffect; return gEnigmaBerries[battlerId].holdEffect;
else else
return ItemId_GetHoldEffect(gBattleMons[battlerId].item); return ItemId_GetHoldEffect(gBattleMons[battlerId].item);
@ -8058,7 +8077,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
// todo // todo
break; break;
case EFFECT_FLING: case EFFECT_FLING:
basePower = ItemId_GetFlingPower(gBattleMons[battlerAtk].item); basePower = GetFlingPowerFromItemId(gBattleMons[battlerAtk].item);
break; break;
case EFFECT_ERUPTION: case EFFECT_ERUPTION:
basePower = gBattleMons[battlerAtk].hp * basePower / gBattleMons[battlerAtk].maxHP; basePower = gBattleMons[battlerAtk].hp * basePower / gBattleMons[battlerAtk].maxHP;
@ -8202,7 +8221,10 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
break; break;
case EFFECT_PAYBACK: case EFFECT_PAYBACK:
if (GetBattlerTurnOrderNum(battlerAtk) > GetBattlerTurnOrderNum(battlerDef) if (GetBattlerTurnOrderNum(battlerAtk) > GetBattlerTurnOrderNum(battlerDef)
&& (gDisableStructs[battlerDef].isFirstTurn != 2 || B_PAYBACK_SWITCH_BOOST < GEN_5)) #if B_PAYBACK_SWITCH_BOOST >= GEN_5
&& (gDisableStructs[battlerDef].isFirstTurn != 2)
#endif
)
basePower *= 2; basePower *= 2;
break; break;
case EFFECT_BOLT_BEAK: case EFFECT_BOLT_BEAK:
@ -8575,6 +8597,12 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
break; break;
} }
#if B_TERRAIN_TYPE_BOOST >= GEN_8
#define TERRAIN_TYPE_BOOST UQ_4_12(1.3)
#else
#define TERRAIN_TYPE_BOOST UQ_4_12(1.5)
#endif
// various effecs // various effecs
if (gProtectStructs[battlerAtk].helpingHand) if (gProtectStructs[battlerAtk].helpingHand)
MulModifier(&modifier, UQ_4_12(1.5)); MulModifier(&modifier, UQ_4_12(1.5));
@ -8583,24 +8611,28 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
if (gStatuses3[battlerAtk] & STATUS3_ME_FIRST) if (gStatuses3[battlerAtk] & STATUS3_ME_FIRST)
MulModifier(&modifier, UQ_4_12(1.5)); MulModifier(&modifier, UQ_4_12(1.5));
if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && moveType == TYPE_GRASS && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && moveType == TYPE_GRASS && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE))
MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); MulModifier(&modifier, TERRAIN_TYPE_BOOST);
if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && moveType == TYPE_DRAGON && IsBattlerGrounded(battlerDef) && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && moveType == TYPE_DRAGON && IsBattlerGrounded(battlerDef) && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE))
MulModifier(&modifier, UQ_4_12(0.5)); MulModifier(&modifier, UQ_4_12(0.5));
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && moveType == TYPE_ELECTRIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && moveType == TYPE_ELECTRIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE))
MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); MulModifier(&modifier, TERRAIN_TYPE_BOOST);
if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN && moveType == TYPE_PSYCHIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE)) if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN && moveType == TYPE_PSYCHIC && IsBattlerGrounded(battlerAtk) && !(gStatuses3[battlerAtk] & STATUS3_SEMI_INVULNERABLE))
MulModifier(&modifier, (B_TERRAIN_TYPE_BOOST >= GEN_8) ? UQ_4_12(1.3) : UQ_4_12(1.5)); MulModifier(&modifier, TERRAIN_TYPE_BOOST);
#if B_SPORT_TURNS >= GEN_6 #if B_SPORT_TURNS >= GEN_6
if ((gFieldStatuses & STATUS_FIELD_MUDSPORT && moveType == TYPE_ELECTRIC) if ((moveType == TYPE_ELECTRIC && gFieldStatuses & STATUS_FIELD_MUDSPORT)
|| (gFieldStatuses & STATUS_FIELD_WATERSPORT && moveType == TYPE_FIRE)) || (moveType == TYPE_FIRE && gFieldStatuses & STATUS_FIELD_WATERSPORT))
MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5));
#else #else
if ((moveType == TYPE_ELECTRIC && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_MUD_SPORT, 0)) if ((moveType == TYPE_ELECTRIC && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_MUD_SPORT, 0))
|| (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0))) || (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0)))
MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5)); #endif
#if B_SPORT_DMG_REDUCTION >= GEN_5
MulModifier(&modifier, UQ_4_12(0.23));
#else
MulModifier(&modifier, UQ_4_12(0.5));
#endif #endif
return ApplyModifier(modifier, basePower); return ApplyModifier(modifier, basePower);
} }
#undef TERRAIN_TYPE_BOOST
static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 isCrit, bool32 updateFlags) static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, bool32 isCrit, bool32 updateFlags)
{ {
@ -8976,11 +9008,17 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move
// check crit // check crit
if (isCrit) if (isCrit)
dmg = ApplyModifier((B_CRIT_MULTIPLIER >= GEN_6 ? UQ_4_12(1.5) : UQ_4_12(2.0)), dmg); #if B_CRIT_MULTIPLIER >= GEN_6
dmg = ApplyModifier(UQ_4_12(1.5), dmg);
#else
dmg = ApplyModifier(UQ_4_12(2.0), dmg);
#endif
// check burn // check burn
if (gBattleMons[battlerAtk].status1 & STATUS1_BURN && IS_MOVE_PHYSICAL(move) if (gBattleMons[battlerAtk].status1 & STATUS1_BURN && IS_MOVE_PHYSICAL(move)
&& (gBattleMoves[move].effect != EFFECT_FACADE || B_BURN_FACADE_DMG < GEN_6) #if B_BURN_FACADE_DMG >= GEN_6
&& gBattleMoves[move].effect != EFFECT_FACADE
#endif
&& abilityAtk != ABILITY_GUTS) && abilityAtk != ABILITY_GUTS)
dmg = ApplyModifier(UQ_4_12(0.5), dmg); dmg = ApplyModifier(UQ_4_12(0.5), dmg);
@ -9254,14 +9292,18 @@ static u16 CalcTypeEffectivenessMultiplierInternal(u16 move, u8 moveType, u8 bat
RecordAbilityBattle(battlerDef, ABILITY_LEVITATE); RecordAbilityBattle(battlerDef, ABILITY_LEVITATE);
} }
} }
else if (B_SHEER_COLD_IMMUNITY >= GEN_7 && move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE)) #if B_SHEER_COLD_IMMUNITY >= GEN_7
else if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE))
{ {
modifier = UQ_4_12(0.0); modifier = UQ_4_12(0.0);
} }
else if (B_GLARE_GHOST >= GEN_4 && move == MOVE_GLARE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST)) #endif
#if B_GLARE_GHOST >= GEN_4
else if (move == MOVE_GLARE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_GHOST))
{ {
modifier = UQ_4_12(1.0); modifier = UQ_4_12(1.0);
} }
#endif
// Thousand Arrows ignores type modifiers for flying mons // Thousand Arrows ignores type modifiers for flying mons
if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING) if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING)
@ -9327,9 +9369,10 @@ u16 CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilit
u16 GetTypeModifier(u8 atkType, u8 defType) u16 GetTypeModifier(u8 atkType, u8 defType)
{ {
if (B_FLAG_INVERSE_BATTLE != 0 && FlagGet(B_FLAG_INVERSE_BATTLE)) #if B_FLAG_INVERSE_BATTLE != 0
if (FlagGet(B_FLAG_INVERSE_BATTLE))
return sInverseTypeEffectivenessTable[atkType][defType]; return sInverseTypeEffectivenessTable[atkType][defType];
else #endif
return sTypeEffectivenessTable[atkType][defType]; return sTypeEffectivenessTable[atkType][defType];
} }
@ -9476,9 +9519,12 @@ bool32 CanMegaEvolve(u8 battlerId)
// Check if there is an entry in the evolution table for regular Mega Evolution. // Check if there is an entry in the evolution table for regular Mega Evolution.
if (GetMegaEvolutionSpecies(species, itemId) != SPECIES_NONE) if (GetMegaEvolutionSpecies(species, itemId) != SPECIES_NONE)
{ {
#if B_ENABLE_DEBUG == TRUE
if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId]) if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId])
holdEffect = gBattleStruct->debugHoldEffects[battlerId]; holdEffect = gBattleStruct->debugHoldEffects[battlerId];
else if (itemId == ITEM_ENIGMA_BERRY_E_READER) else
#endif
if (itemId == ITEM_ENIGMA_BERRY_E_READER)
holdEffect = gEnigmaBerries[battlerId].holdEffect; holdEffect = gEnigmaBerries[battlerId].holdEffect;
else else
holdEffect = ItemId_GetHoldEffect(itemId); holdEffect = ItemId_GetHoldEffect(itemId);
@ -9679,9 +9725,8 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId)
bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId) bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId)
{ {
if (B_BADGE_BOOST != GEN_3) #if B_BADGE_BOOST != GEN_3
return FALSE; if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER))
else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER))
return FALSE; return FALSE;
else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER) else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
return FALSE; return FALSE;
@ -9689,7 +9734,7 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId)
return FALSE; return FALSE;
else if (FlagGet(badgeFlag)) else if (FlagGet(badgeFlag))
return TRUE; return TRUE;
else #endif
return FALSE; return FALSE;
} }
@ -9699,12 +9744,17 @@ u8 GetBattleMoveSplit(u32 moveId)
return gBattleStruct->zmove.activeSplit; return gBattleStruct->zmove.activeSplit;
if (gBattleStruct != NULL && gBattleStruct->swapDamageCategory) // Photon Geyser, Shell Side Arm, Light That Burns the Sky if (gBattleStruct != NULL && gBattleStruct->swapDamageCategory) // Photon Geyser, Shell Side Arm, Light That Burns the Sky
return SPLIT_PHYSICAL; return SPLIT_PHYSICAL;
else if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4)
#if B_PHYSICAL_SPECIAL_SPLIT >= GEN_4
return gBattleMoves[moveId].split; return gBattleMoves[moveId].split;
#else
if (IS_MOVE_STATUS(moveId))
return SPLIT_STATUS;
else if (gBattleMoves[moveId].type < TYPE_MYSTERY) else if (gBattleMoves[moveId].type < TYPE_MYSTERY)
return SPLIT_PHYSICAL; return SPLIT_PHYSICAL;
else else
return SPLIT_SPECIAL; return SPLIT_SPECIAL;
#endif
} }
static bool32 TryRemoveScreens(u8 battler) static bool32 TryRemoveScreens(u8 battler)
@ -9781,6 +9831,19 @@ struct Pokemon *GetBattlerPartyData(u8 battlerId)
return mon; return mon;
} }
static u8 GetFlingPowerFromItemId(u16 itemId)
{
if (itemId >= ITEM_TM01 && itemId <= ITEM_HM08)
{
u8 power = gBattleMoves[ItemIdToBattleMoveId(itemId)].power;
if (power > 1)
return power;
return 10; // Status moves and moves with variable power always return 10 power.
}
else
return ItemId_GetFlingPower(itemId);
}
// Make sure the input bank is any bank on the specific mon's side // Make sure the input bank is any bank on the specific mon's side
bool32 CanFling(u8 battlerId) bool32 CanFling(u8 battlerId)
{ {
@ -9793,7 +9856,7 @@ bool32 CanFling(u8 battlerId)
#endif #endif
|| gFieldStatuses & STATUS_FIELD_MAGIC_ROOM || gFieldStatuses & STATUS_FIELD_MAGIC_ROOM
|| gDisableStructs[battlerId].embargoTimer != 0 || gDisableStructs[battlerId].embargoTimer != 0
|| ItemId_GetFlingPower(item) != 0 || GetFlingPowerFromItemId(item) != 0
|| !CanBattlerGetOrLoseItem(battlerId, item)) || !CanBattlerGetOrLoseItem(battlerId, item))
return FALSE; return FALSE;
@ -9949,7 +10012,7 @@ bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item)
| BATTLE_TYPE_LINK | BATTLE_TYPE_LINK
| BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_LINK
| BATTLE_TYPE_SECRET_BASE | BATTLE_TYPE_SECRET_BASE
#if B_TRAINERS_KNOCK_OFF_ITEMS #if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
| BATTLE_TYPE_TRAINER | BATTLE_TYPE_TRAINER
#endif #endif
))) )))

View File

@ -58,7 +58,6 @@ static u8 GetZMoveScore(u8 battlerAtk, u8 battlerDef, u16 baseMove, u16 zMove);
// Const Data // Const Data
static const struct SignatureZMove sSignatureZMoves[] = static const struct SignatureZMove sSignatureZMoves[] =
{ {
// #ifdef NEW_POKEMON
{SPECIES_PIKACHU_COSPLAY, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_PIKACHU_COSPLAY, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA},
{SPECIES_PIKACHU_ROCK_STAR, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_PIKACHU_ROCK_STAR, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA},
{SPECIES_PIKACHU_BELLE, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_PIKACHU_BELLE, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA},
@ -95,7 +94,6 @@ static const struct SignatureZMove sSignatureZMoves[] =
{SPECIES_TAPU_LELE, ITEM_TAPUNIUM_Z, MOVE_NATURES_MADNESS, MOVE_GUARDIAN_OF_ALOLA}, {SPECIES_TAPU_LELE, ITEM_TAPUNIUM_Z, MOVE_NATURES_MADNESS, MOVE_GUARDIAN_OF_ALOLA},
{SPECIES_TAPU_FINI, ITEM_TAPUNIUM_Z, MOVE_NATURES_MADNESS, MOVE_GUARDIAN_OF_ALOLA}, {SPECIES_TAPU_FINI, ITEM_TAPUNIUM_Z, MOVE_NATURES_MADNESS, MOVE_GUARDIAN_OF_ALOLA},
{SPECIES_NECROZMA_ULTRA, ITEM_ULTRANECROZIUM_Z, MOVE_PHOTON_GEYSER, MOVE_LIGHT_THAT_BURNS_THE_SKY}, {SPECIES_NECROZMA_ULTRA, ITEM_ULTRANECROZIUM_Z, MOVE_PHOTON_GEYSER, MOVE_LIGHT_THAT_BURNS_THE_SKY},
// #endif
{SPECIES_MEW, ITEM_MEWNIUM_Z, MOVE_PSYCHIC, MOVE_GENESIS_SUPERNOVA}, {SPECIES_MEW, ITEM_MEWNIUM_Z, MOVE_PSYCHIC, MOVE_GENESIS_SUPERNOVA},
{SPECIES_PIKACHU, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA}, {SPECIES_PIKACHU, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA},
{SPECIES_EEVEE, ITEM_EEVIUM_Z, MOVE_LAST_RESORT, MOVE_EXTREME_EVOBOOST}, {SPECIES_EEVEE, ITEM_EEVIUM_Z, MOVE_LAST_RESORT, MOVE_EXTREME_EVOBOOST},
@ -190,9 +188,12 @@ bool32 IsViableZMove(u8 battlerId, u16 move)
return FALSE; // Partner has mega evolved or is about to mega evolve return FALSE; // Partner has mega evolved or is about to mega evolve
} }
if (B_ENABLE_DEBUG && gBattleStruct->debugHoldEffects[battlerId]) #if B_ENABLE_DEBUG == TRUE
if (gBattleStruct->debugHoldEffects[battlerId])
holdEffect = gBattleStruct->debugHoldEffects[battlerId]; holdEffect = gBattleStruct->debugHoldEffects[battlerId];
else if (item == ITEM_ENIGMA_BERRY) else
#endif
if (item == ITEM_ENIGMA_BERRY)
return FALSE; // HoldEffect = gEnigmaBerries[battlerId].holdEffect; return FALSE; // HoldEffect = gEnigmaBerries[battlerId].holdEffect;
else else
holdEffect = ItemId_GetHoldEffect(item); holdEffect = ItemId_GetHoldEffect(item);

View File

@ -7794,7 +7794,7 @@ const struct Item gItems[] =
.flingPower = 10, .flingPower = 10,
}, },
// TMs/HMs // TMs/HMs. They don't have a set flingPower, as that's handled by GetFlingPowerFromItemId.
[ITEM_TM01_FOCUS_PUNCH] = [ITEM_TM01_FOCUS_PUNCH] =
{ {
@ -7805,7 +7805,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 150,
}, },
[ITEM_TM02_DRAGON_CLAW] = [ITEM_TM02_DRAGON_CLAW] =
@ -7817,7 +7816,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 80,
}, },
[ITEM_TM03_WATER_PULSE] = [ITEM_TM03_WATER_PULSE] =
@ -7829,7 +7827,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 60,
}, },
[ITEM_TM04_CALM_MIND] = [ITEM_TM04_CALM_MIND] =
@ -7841,7 +7838,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM05_ROAR] = [ITEM_TM05_ROAR] =
@ -7853,7 +7849,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM06_TOXIC] = [ITEM_TM06_TOXIC] =
@ -7865,7 +7860,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM07_HAIL] = [ITEM_TM07_HAIL] =
@ -7877,7 +7871,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM08_BULK_UP] = [ITEM_TM08_BULK_UP] =
@ -7889,7 +7882,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM09_BULLET_SEED] = [ITEM_TM09_BULLET_SEED] =
@ -7901,11 +7893,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_5
.flingPower = 25,
#else
.flingPower = 10,
#endif
}, },
[ITEM_TM10_HIDDEN_POWER] = [ITEM_TM10_HIDDEN_POWER] =
@ -7917,11 +7904,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 60,
#else
.flingPower = 10,
#endif
}, },
[ITEM_TM11_SUNNY_DAY] = [ITEM_TM11_SUNNY_DAY] =
@ -7933,7 +7915,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM12_TAUNT] = [ITEM_TM12_TAUNT] =
@ -7945,7 +7926,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM13_ICE_BEAM] = [ITEM_TM13_ICE_BEAM] =
@ -7957,11 +7937,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 90,
#else
.flingPower = 95,
#endif
}, },
[ITEM_TM14_BLIZZARD] = [ITEM_TM14_BLIZZARD] =
@ -7973,11 +7948,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 110,
#else
.flingPower = 120,
#endif
}, },
[ITEM_TM15_HYPER_BEAM] = [ITEM_TM15_HYPER_BEAM] =
@ -7989,7 +7959,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 150,
}, },
[ITEM_TM16_LIGHT_SCREEN] = [ITEM_TM16_LIGHT_SCREEN] =
@ -8001,7 +7970,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM17_PROTECT] = [ITEM_TM17_PROTECT] =
@ -8013,7 +7981,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM18_RAIN_DANCE] = [ITEM_TM18_RAIN_DANCE] =
@ -8025,7 +7992,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM19_GIGA_DRAIN] = [ITEM_TM19_GIGA_DRAIN] =
@ -8037,11 +8003,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_5
.flingPower = 75,
#else
.flingPower = 60,
#endif
}, },
[ITEM_TM20_SAFEGUARD] = [ITEM_TM20_SAFEGUARD] =
@ -8053,7 +8014,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM21_FRUSTRATION] = [ITEM_TM21_FRUSTRATION] =
@ -8065,7 +8025,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM22_SOLAR_BEAM] = [ITEM_TM22_SOLAR_BEAM] =
@ -8077,7 +8036,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 120,
}, },
[ITEM_TM23_IRON_TAIL] = [ITEM_TM23_IRON_TAIL] =
@ -8089,7 +8047,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 100,
}, },
[ITEM_TM24_THUNDERBOLT] = [ITEM_TM24_THUNDERBOLT] =
@ -8101,11 +8058,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 90,
#else
.flingPower = 95,
#endif
}, },
[ITEM_TM25_THUNDER] = [ITEM_TM25_THUNDER] =
@ -8117,11 +8069,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 110,
#else
.flingPower = 120,
#endif
}, },
[ITEM_TM26_EARTHQUAKE] = [ITEM_TM26_EARTHQUAKE] =
@ -8133,7 +8080,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 100,
}, },
[ITEM_TM27_RETURN] = [ITEM_TM27_RETURN] =
@ -8145,7 +8091,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM28_DIG] = [ITEM_TM28_DIG] =
@ -8157,11 +8102,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_4
.flingPower = 80,
#else
.flingPower = 60,
#endif
}, },
[ITEM_TM29_PSYCHIC] = [ITEM_TM29_PSYCHIC] =
@ -8173,7 +8113,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 90,
}, },
[ITEM_TM30_SHADOW_BALL] = [ITEM_TM30_SHADOW_BALL] =
@ -8185,7 +8124,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 80,
}, },
[ITEM_TM31_BRICK_BREAK] = [ITEM_TM31_BRICK_BREAK] =
@ -8197,7 +8135,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 75,
}, },
[ITEM_TM32_DOUBLE_TEAM] = [ITEM_TM32_DOUBLE_TEAM] =
@ -8209,7 +8146,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM33_REFLECT] = [ITEM_TM33_REFLECT] =
@ -8221,7 +8157,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM34_SHOCK_WAVE] = [ITEM_TM34_SHOCK_WAVE] =
@ -8233,7 +8168,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 60,
}, },
[ITEM_TM35_FLAMETHROWER] = [ITEM_TM35_FLAMETHROWER] =
@ -8245,11 +8179,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 90,
#else
.flingPower = 95,
#endif
}, },
[ITEM_TM36_SLUDGE_BOMB] = [ITEM_TM36_SLUDGE_BOMB] =
@ -8261,7 +8190,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 90,
}, },
[ITEM_TM37_SANDSTORM] = [ITEM_TM37_SANDSTORM] =
@ -8273,7 +8201,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM38_FIRE_BLAST] = [ITEM_TM38_FIRE_BLAST] =
@ -8285,11 +8212,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 110,
#else
.flingPower = 120,
#endif
}, },
[ITEM_TM39_ROCK_TOMB] = [ITEM_TM39_ROCK_TOMB] =
@ -8301,11 +8223,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 60,
#else
.flingPower = 50,
#endif
}, },
[ITEM_TM40_AERIAL_ACE] = [ITEM_TM40_AERIAL_ACE] =
@ -8317,7 +8234,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 60,
}, },
[ITEM_TM41_TORMENT] = [ITEM_TM41_TORMENT] =
@ -8329,7 +8245,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM42_FACADE] = [ITEM_TM42_FACADE] =
@ -8341,7 +8256,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM43_SECRET_POWER] = [ITEM_TM43_SECRET_POWER] =
@ -8353,7 +8267,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 70,
}, },
[ITEM_TM44_REST] = [ITEM_TM44_REST] =
@ -8365,7 +8278,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM45_ATTRACT] = [ITEM_TM45_ATTRACT] =
@ -8377,7 +8289,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM46_THIEF] = [ITEM_TM46_THIEF] =
@ -8389,11 +8300,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 60,
#else
.flingPower = 40,
#endif
}, },
[ITEM_TM47_STEEL_WING] = [ITEM_TM47_STEEL_WING] =
@ -8405,7 +8311,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 70,
}, },
[ITEM_TM48_SKILL_SWAP] = [ITEM_TM48_SKILL_SWAP] =
@ -8417,7 +8322,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM49_SNATCH] = [ITEM_TM49_SNATCH] =
@ -8429,7 +8333,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_TM50_OVERHEAT] = [ITEM_TM50_OVERHEAT] =
@ -8441,11 +8344,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 130,
#else
.flingPower = 140,
#endif
}, },
[ITEM_TM51] = [ITEM_TM51] =
@ -9008,7 +8906,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 50,
}, },
[ITEM_HM02_FLY] = [ITEM_HM02_FLY] =
@ -9021,11 +8918,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_4
.flingPower = 90,
#else
.flingPower = 70,
#endif
}, },
[ITEM_HM03_SURF] = [ITEM_HM03_SURF] =
@ -9038,11 +8930,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 90,
#else
.flingPower = 95,
#endif
}, },
[ITEM_HM04_STRENGTH] = [ITEM_HM04_STRENGTH] =
@ -9055,7 +8942,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 80,
}, },
[ITEM_HM05_FLASH] = [ITEM_HM05_FLASH] =
@ -9068,7 +8954,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
}, },
[ITEM_HM06_ROCK_SMASH] = [ITEM_HM06_ROCK_SMASH] =
@ -9081,11 +8966,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_4
.flingPower = 20,
#else
.flingPower = 40,
#endif
}, },
[ITEM_HM07_WATERFALL] = [ITEM_HM07_WATERFALL] =
@ -9098,7 +8978,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 80,
}, },
[ITEM_HM08_DIVE] = [ITEM_HM08_DIVE] =
@ -9111,11 +8990,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM, .pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU, .type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM, .fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_4
.flingPower = 80,
#else
.flingPower = 60,
#endif
}, },

View File

@ -1,3 +1,10 @@
#if B_BINDING_TURNS >= GEN_5
#define BINDING_TURNS "4 or 5"
#else
#define BINDING_TURNS "2 to 5"
#endif
static const u8 sNullDescription[] = _( static const u8 sNullDescription[] = _(
""); "");
@ -79,11 +86,7 @@ static const u8 sFlyDescription[] = _(
static const u8 sBindDescription[] = _( static const u8 sBindDescription[] = _(
"Binds and squeezes the foe\n" "Binds and squeezes the foe\n"
#if B_BINDING_TURNS >= GEN_5 "for "BINDING_TURNS" turns.");
"for 4 or 5 turns.");
#else
"for 2 to 5 turns.");
#endif
static const u8 sSlamDescription[] = _( static const u8 sSlamDescription[] = _(
"Slams the foe with a long\n" "Slams the foe with a long\n"
@ -143,11 +146,7 @@ static const u8 sBodySlamDescription[] = _(
static const u8 sWrapDescription[] = _( static const u8 sWrapDescription[] = _(
"Wraps and squeezes the foe\n" "Wraps and squeezes the foe\n"
#if B_BINDING_TURNS >= GEN_5 BINDING_TURNS" times with vines, etc.");
"4 or 5 times with vines, etc.");
#else
"2 to 5 times with vines, etc.");
#endif
static const u8 sTakeDownDescription[] = _( static const u8 sTakeDownDescription[] = _(
"A reckless charge attack\n" "A reckless charge attack\n"
@ -339,11 +338,7 @@ static const u8 sDragonRageDescription[] = _(
static const u8 sFireSpinDescription[] = _( static const u8 sFireSpinDescription[] = _(
"Traps the foe in a ring of\n" "Traps the foe in a ring of\n"
#if B_BINDING_TURNS >= GEN_5 "fire for "BINDING_TURNS" turns.");
"fire for 4 or 5 turns.");
#else
"fire for 2 to 5 turns.");
#endif
static const u8 sThunderShockDescription[] = _( static const u8 sThunderShockDescription[] = _(
"An electrical attack that\n" "An electrical attack that\n"
@ -523,11 +518,7 @@ static const u8 sWaterfallDescription[] = _(
static const u8 sClampDescription[] = _( static const u8 sClampDescription[] = _(
"Traps and squeezes the\n" "Traps and squeezes the\n"
#if B_BINDING_TURNS >= GEN_5 "foe for "BINDING_TURNS" turns.");
"foe for 4 or 5 turns.");
#else
"foe for 2 to 5 turns.");
#endif
static const u8 sSwiftDescription[] = _( static const u8 sSwiftDescription[] = _(
"Sprays star-shaped rays\n" "Sprays star-shaped rays\n"
@ -1015,11 +1006,7 @@ static const u8 sRockSmashDescription[] = _(
static const u8 sWhirlpoolDescription[] = _( static const u8 sWhirlpoolDescription[] = _(
"Traps and hurts the foe in\n" "Traps and hurts the foe in\n"
#if B_BINDING_TURNS >= GEN_5 "a whirlpool for "BINDING_TURNS" turns.");
"a whirlpool for 4 or 5 turns.");
#else
"a whirlpool for 2 to 5 turns.");
#endif
static const u8 sBeatUpDescription[] = _( static const u8 sBeatUpDescription[] = _(
"Summons party Pokémon to\n" "Summons party Pokémon to\n"
@ -1030,7 +1017,11 @@ static const u8 sFakeOutDescription[] = _(
"that causes flinching."); "that causes flinching.");
static const u8 sUproarDescription[] = _( static const u8 sUproarDescription[] = _(
#if B_UPROAR_TURNS >= GEN_5
"Causes an uproar for 2 to 5\n" "Causes an uproar for 2 to 5\n"
#else
"Causes an uproar for 3\n"
#endif
"turns and prevents sleep."); "turns and prevents sleep.");
static const u8 sStockpileDescription[] = _( static const u8 sStockpileDescription[] = _(
@ -1331,11 +1322,7 @@ static const u8 sSkyUppercutDescription[] = _(
static const u8 sSandTombDescription[] = _( static const u8 sSandTombDescription[] = _(
"Traps and hurts the foe in\n" "Traps and hurts the foe in\n"
#if B_BINDING_TURNS >= GEN_5 "quicksand for "BINDING_TURNS" turns.");
"quicksand for 4 or 5 turns.");
#else
"quicksand for 2 to 5 turns.");
#endif
static const u8 sSheerColdDescription[] = _( static const u8 sSheerColdDescription[] = _(
"A chilling attack that\n" "A chilling attack that\n"
@ -1839,11 +1826,7 @@ static const u8 sSpacialRendDescription[] = _(
static const u8 sMagmaStormDescription[] = _( static const u8 sMagmaStormDescription[] = _(
"Traps the foe in a vortex\n" "Traps the foe in a vortex\n"
#if B_BINDING_TURNS >= GEN_5 "of fire for "BINDING_TURNS" turns.");
"of fire for 4 or 5 turns.");
#else
"of fire for 2 to 5 turns.");
#endif
static const u8 sDarkVoidDescription[] = _( static const u8 sDarkVoidDescription[] = _(
"Drags the foe into total\n" "Drags the foe into total\n"
@ -2395,11 +2378,7 @@ static const u8 sNuzzleDescription[] = _(
static const u8 sInfestationDescription[] = _( static const u8 sInfestationDescription[] = _(
"The foe is infested and\n" "The foe is infested and\n"
#if B_BINDING_TURNS >= GEN_5 "attacked for "BINDING_TURNS" turns.");
"attacked for 4 or 5 turns.");
#else
"attacked for 2 to 5 turns.");
#endif
static const u8 sPowerUpPunchDescription[] = _( static const u8 sPowerUpPunchDescription[] = _(
"A hard punch that raises\n" "A hard punch that raises\n"
@ -2944,11 +2923,7 @@ static const u8 sSurgingStrikesDescription[] = _(
static const u8 sThunderCageDescription[] = _( static const u8 sThunderCageDescription[] = _(
"Traps the foe in a cage of\n" "Traps the foe in a cage of\n"
#if B_BINDING_TURNS >= GEN_5 "electricity for "BINDING_TURNS" turns.");
"electricity for 4 or 5 turns.");
#else
"electricity for 2 to 5 turns.");
#endif
static const u8 sDragonEnergyDescription[] = _( static const u8 sDragonEnergyDescription[] = _(
"The higher the user's HP\n" "The higher the user's HP\n"
@ -2981,6 +2956,8 @@ static const u8 sEerieSpellDescription[] = _(
static const u8 sNotDoneYetDescription[] = _( static const u8 sNotDoneYetDescription[] = _(
"Not done yet."); "Not done yet.");
#undef BINDING_TURNS
// MOVE_NONE is ignored in this table. Make sure to always subtract 1 before getting the right pointer. // MOVE_NONE is ignored in this table. Make sure to always subtract 1 before getting the right pointer.
const u8 *const gMoveDescriptionPointers[MOVES_COUNT - 1] = const u8 *const gMoveDescriptionPointers[MOVES_COUNT - 1] =
{ {

View File

@ -551,7 +551,10 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon)
u32 data = 0; u32 data = 0;
u16 ball = ITEM_POKE_BALL; u16 ball = ITEM_POKE_BALL;
if (gEvolutionTable[preEvoSpecies][0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < PARTY_SIZE if (gEvolutionTable[preEvoSpecies][0].method == EVO_LEVEL_NINJASK && gPlayerPartyCount < PARTY_SIZE
&& (P_SHEDINJA_BALL == GEN_3 || CheckBagHasItem(ball, 1))) #if P_SHEDINJA_BALL >= GEN_4
&& (CheckBagHasItem(ball, 1))
#endif
)
{ {
s32 i; s32 i;
struct Pokemon *shedinja = &gPlayerParty[gPlayerPartyCount]; struct Pokemon *shedinja = &gPlayerParty[gPlayerPartyCount];

View File

@ -5470,6 +5470,12 @@ bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex,
} \ } \
} }
#if B_X_ITEMS_BUFF >= GEN_7
#define X_ITEM_STAGES 2
#else
#define X_ITEM_STAGES 1
#endif
// Returns TRUE if the item has no effect on the Pokémon, FALSE otherwise // Returns TRUE if the item has no effect on the Pokémon, FALSE otherwise
bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex, bool8 usedByAI) bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex, bool8 usedByAI)
{ {
@ -5576,10 +5582,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_ATTACK) if ((itemEffect[i] & ITEM1_X_ATTACK)
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE) && gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE)
{ {
if (B_X_ITEMS_BUFF >= GEN_7) gBattleMons[gActiveBattler].statStages[STAT_ATK] += X_ITEM_STAGES;
gBattleMons[gActiveBattler].statStages[STAT_ATK] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_ATK] += 1;
if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > MAX_STAT_STAGE) if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_ATK] = MAX_STAT_STAGE; gBattleMons[gActiveBattler].statStages[STAT_ATK] = MAX_STAT_STAGE;
retVal = FALSE; retVal = FALSE;
@ -5589,10 +5592,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_DEFENSE) if ((itemEffect[i] & ITEM1_X_DEFENSE)
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE) && gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE)
{ {
if (B_X_ITEMS_BUFF >= GEN_7) gBattleMons[gActiveBattler].statStages[STAT_DEF] += X_ITEM_STAGES;
gBattleMons[gActiveBattler].statStages[STAT_DEF] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_DEF] += 1;
if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > MAX_STAT_STAGE) if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_DEF] = MAX_STAT_STAGE; gBattleMons[gActiveBattler].statStages[STAT_DEF] = MAX_STAT_STAGE;
retVal = FALSE; retVal = FALSE;
@ -5602,10 +5602,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_SPEED) if ((itemEffect[i] & ITEM1_X_SPEED)
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE) && gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE)
{ {
if (B_X_ITEMS_BUFF >= GEN_7) gBattleMons[gActiveBattler].statStages[STAT_SPEED] += X_ITEM_STAGES;
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 1;
if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > MAX_STAT_STAGE) if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_SPEED] = MAX_STAT_STAGE; gBattleMons[gActiveBattler].statStages[STAT_SPEED] = MAX_STAT_STAGE;
retVal = FALSE; retVal = FALSE;
@ -5615,10 +5612,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_SPATK) if ((itemEffect[i] & ITEM1_X_SPATK)
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE) && gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE)
{ {
if (B_X_ITEMS_BUFF >= GEN_7) gBattleMons[gActiveBattler].statStages[STAT_SPATK] += X_ITEM_STAGES;
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 1;
if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > MAX_STAT_STAGE) if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_SPATK] = MAX_STAT_STAGE; gBattleMons[gActiveBattler].statStages[STAT_SPATK] = MAX_STAT_STAGE;
retVal = FALSE; retVal = FALSE;
@ -5628,10 +5622,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_SPDEF) if ((itemEffect[i] & ITEM1_X_SPDEF)
&& gBattleMons[gActiveBattler].statStages[STAT_SPDEF] < MAX_STAT_STAGE) && gBattleMons[gActiveBattler].statStages[STAT_SPDEF] < MAX_STAT_STAGE)
{ {
if (B_X_ITEMS_BUFF >= GEN_7) gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += X_ITEM_STAGES;
gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 1;
if (gBattleMons[gActiveBattler].statStages[STAT_SPDEF] > MAX_STAT_STAGE) if (gBattleMons[gActiveBattler].statStages[STAT_SPDEF] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_SPDEF] = MAX_STAT_STAGE; gBattleMons[gActiveBattler].statStages[STAT_SPDEF] = MAX_STAT_STAGE;
retVal = FALSE; retVal = FALSE;
@ -5641,10 +5632,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_ACCURACY) if ((itemEffect[i] & ITEM1_X_ACCURACY)
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE) && gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE)
{ {
if (B_X_ITEMS_BUFF >= GEN_7) gBattleMons[gActiveBattler].statStages[STAT_ACC] += X_ITEM_STAGES;
gBattleMons[gActiveBattler].statStages[STAT_ACC] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_ACC] += 1;
if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > MAX_STAT_STAGE) if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_ACC] = MAX_STAT_STAGE; gBattleMons[gActiveBattler].statStages[STAT_ACC] = MAX_STAT_STAGE;
retVal = FALSE; retVal = FALSE;
@ -6204,15 +6192,12 @@ static void BufferStatRoseMessage(s32 statIdx)
{ {
gBattlerTarget = gBattlerInMenuId; gBattlerTarget = gBattlerInMenuId;
StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[statIdx]]); StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[statIdx]]);
if (B_X_ITEMS_BUFF >= GEN_7) #if B_X_ITEMS_BUFF >= GEN_7
{
StringCopy(gBattleTextBuff2, gText_StatSharply); StringCopy(gBattleTextBuff2, gText_StatSharply);
StringAppend(gBattleTextBuff2, gText_StatRose); StringAppend(gBattleTextBuff2, gText_StatRose);
} #else
else
{
StringCopy(gBattleTextBuff2, gText_StatRose); StringCopy(gBattleTextBuff2, gText_StatRose);
} #endif
BattleStringExpandPlaceholdersToDisplayedString(gText_DefendersStatRose); BattleStringExpandPlaceholdersToDisplayedString(gText_DefendersStatRose);
} }
@ -6324,7 +6309,10 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s
// Prevent evolution with Everstone, unless we're just viewing the party menu with an evolution item // Prevent evolution with Everstone, unless we're just viewing the party menu with an evolution item
if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE
&& mode != EVO_MODE_ITEM_CHECK && mode != EVO_MODE_ITEM_CHECK
&& (P_KADABRA_EVERSTONE < GEN_4 || species != SPECIES_KADABRA)) #if P_KADABRA_EVERSTONE >= GEN_4
&& species != SPECIES_KADABRA
#endif
)
return SPECIES_NONE; return SPECIES_NONE;
switch (mode) switch (mode)

View File

@ -3735,8 +3735,9 @@ static void PrintMoveDetails(u16 move)
{ {
if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES)
{ {
if (B_SHOW_SPLIT_ICON == TRUE) #if B_SHOW_SPLIT_ICON == TRUE
ShowSplitIcon(GetBattleMoveSplit(move)); ShowSplitIcon(GetBattleMoveSplit(move));
#endif
PrintMovePowerAndAccuracy(move); PrintMovePowerAndAccuracy(move);
PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0); PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0);
} }

View File

@ -367,7 +367,10 @@ static u8 PickWildMonNature(void)
// check synchronize for a pokemon with the same ability // check synchronize for a pokemon with the same ability
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG) if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)
&& GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE && GetMonAbility(&gPlayerParty[0]) == ABILITY_SYNCHRONIZE
&& ((B_SYNCHRONIZE_NATURE >= GEN_8) || Random() % 2 == 0)) #if B_SYNCHRONIZE_NATURE <= GEN_7
&& (Random() % 2 == 0)
#endif
)
{ {
return GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY) % NUM_NATURES; return GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY) % NUM_NATURES;
} }
@ -1003,8 +1006,10 @@ bool8 TryDoDoubleWildBattle(void)
{ {
if (GetSafariZoneFlag() || GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS) if (GetSafariZoneFlag() || GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS)
return FALSE; return FALSE;
else if (B_FLAG_FORCE_DOUBLE_WILD != 0 && FlagGet(B_FLAG_FORCE_DOUBLE_WILD)) #if B_FLAG_FORCE_DOUBLE_WILD != 0
else if (FlagGet(B_FLAG_FORCE_DOUBLE_WILD))
return TRUE; return TRUE;
#endif
#if B_DOUBLE_WILD_CHANCE != 0 #if B_DOUBLE_WILD_CHANCE != 0
else if ((Random() % 100) + 1 < B_DOUBLE_WILD_CHANCE) else if ((Random() % 100) + 1 < B_DOUBLE_WILD_CHANCE)
return TRUE; return TRUE;