Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config refactor #2297

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions data/battle_anim_scripts.s
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
#include "constants/battle.h"
#include "constants/battle_anim.h"
#include "constants/rgb.h"
Expand Down Expand Up @@ -23570,26 +23571,25 @@ Move_SECRET_POWER:
jumpargeq 0, BATTLE_TERRAIN_PUDDLE, Move_MUD_SHOT
jumpargeq 0, BATTLE_TERRAIN_MARSH, 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_VOLCANO, Move_INCINERATE
jumpargeq 0, BATTLE_TERRAIN_DISTORTION_WORLD, Move_POUND
jumpargeq 0, BATTLE_TERRAIN_SPACE, Move_SWIFT
jumpargeq 0, BATTLE_TERRAIN_ULTRA_SPACE, Move_PSYWAVE
.if B_SECRET_POWER_ANIMATION >= GEN_7
jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_ICE_SHARD
jumpargeq 0, BATTLE_TERRAIN_BUILDING, 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
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
goto Move_MUD_SLAP
.else
jumpargeq 0, BATTLE_TERRAIN_SNOW, Move_AVALANCHE
jumpargeq 0, BATTLE_TERRAIN_BUILDING, Move_STRENGTH
goto Move_SLAM
.endif
Expand Down
1 change: 1 addition & 0 deletions data/battle_scripts_1.s
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "config.h"
#include "constants/global.h"
#include "constants/battle.h"
#include "constants/pokemon.h"
Expand Down
9 changes: 9 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,13 @@
#define POKEMON_EXPANSION
#define ITEM_EXPANSION

// Generation constants used in configs to define behavior
#define GEN_3 0
#define GEN_4 1
#define GEN_5 2
#define GEN_6 3
#define GEN_7 4
#define GEN_8 5
#define GEN_LATEST GEN_8

#endif // GUARD_CONFIG_H
244 changes: 117 additions & 127 deletions include/constants/battle_config.h

Large diffs are not rendered by default.

21 changes: 6 additions & 15 deletions include/constants/item_config.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
#ifndef GUARD_CONSTANTS_ITEM_CONFIG_H
#define GUARD_CONSTANTS_ITEM_CONFIG_H

#ifndef GEN_3
#define GEN_3 0
#define GEN_4 1
#define GEN_5 2
#define GEN_6 3
#define GEN_7 4
#define GEN_8 5
#endif

// Item config
#define I_SHINY_CHARM_REROLLS 3 // Amount of re-rolls if the player has the Shiny Charm. Set to 0 to disable Shiny Charm's effects.
#define I_KEY_FOSSILS GEN_7 // In Gen4+, all Gen 3 fossils became regular items.
#define I_KEY_ESCAPE_ROPE GEN_7 // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts.
#define I_HEALTH_RECOVERY GEN_7 // In Gen7+, certain healing items recover a different amount of HP than they used to.
#define I_SITRUS_BERRY_HEAL GEN_7 // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP.
#define I_VITAMIN_EV_CAP GEN_8 // In Gen8, the Vitamins no longer have a cap of 100 EV per stat.
#define I_SHINY_CHARM_REROLLS 3 // Amount of re-rolls if the player has the Shiny Charm. Set to 0 to disable Shiny Charm's effects.
#define I_KEY_FOSSILS GEN_LATEST // In Gen4+, all Gen 3 fossils became regular items.
#define I_KEY_ESCAPE_ROPE GEN_LATEST // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts.
#define I_HEALTH_RECOVERY GEN_LATEST // In Gen7+, certain healing items recover a different amount of HP than they used to.
#define I_SITRUS_BERRY_HEAL GEN_LATEST // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP.
#define I_VITAMIN_EV_CAP GEN_LATEST // In Gen8, the Vitamins no longer have a cap of 100 EV per stat.

#endif // GUARD_CONSTANTS_ITEM_CONFIG_H
29 changes: 10 additions & 19 deletions include/constants/pokemon_config.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
#ifndef GUARD_CONSTANTS_POKEMON_CONFIG_H
#define GUARD_CONSTANTS_POKEMON_CONFIG_H

#ifndef GEN_3
#define GEN_3 0
#define GEN_4 1
#define GEN_5 2
#define GEN_6 3
#define GEN_7 4
#define GEN_8 5
#endif
#define P_UPDATED_TYPES GEN_LATEST // Since Gen 6, several Pokémon were changed to be partially or fully Fairy type.
#define P_UPDATED_STATS GEN_LATEST // Since Gen 6, Pokémon stats are updated with each passing generation.
#define P_UPDATED_ABILITIES GEN_LATEST // Since Gen 6, certain Pokémon have their abilities changed.
#define P_UPDATED_EGG_GROUPS GEN_LATEST // Since Gen 8, certain Pokémon have gained new egg groups.
#define P_SHEDINJA_BALL GEN_LATEST // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball.
#define P_LEGENDARY_PERFECT_IVS GEN_LATEST // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs.
#define P_KADABRA_EVERSTONE GEN_LATEST // Since Gen 4, Kadabra can evolve even when holding an Everstone.
#define P_NIDORAN_M_DITTO_BREED GEN_LATEST // Since Gen 5, when Nidoran♂ breeds with Ditto it can produce Nidoran♀ offspring. Before, it would only yield male offspring. This change also applies to Volbeat.

#define P_UPDATED_TYPES GEN_8 // Since Gen 6, several Pokémon were changed to be partially or fully Fairy type.
#define P_UPDATED_STATS GEN_8 // Since Gen 6, Pokémon stats are updated with each passing generation.
#define P_UPDATED_ABILITIES GEN_8 // Since Gen 6, certain Pokémon have their abilities changed.
#define P_UPDATED_EGG_GROUPS GEN_8 // Since Gen 8, certain Pokémon have gained new egg groups.
#define P_SHEDINJA_BALL GEN_8 // Since Gen 4, Shedinja requires a Poké Ball for its evolution. In Gen 3, Shedinja inherits Nincada's Ball.
#define P_LEGENDARY_PERFECT_IVS GEN_8 // Since Gen 6, Legendaries, Mythicals and Ultra Beasts found in the wild or given through gifts have at least 3 perfect IVs.
#define P_KADABRA_EVERSTONE GEN_8 // Since Gen 4, Kadabra can evolve even when holding an Everstone.
#define P_NIDORAN_M_DITTO_BREED GEN_8 // Since Gen 5, when Nidoran♂ breeds with Ditto it can produce Nidoran♀ offspring. Before, it would only yield male offspring. This change also applies to Volbeat.
#define P_NEW_POKEMON TRUE // Turning this to FALSE will remove all newly added Pokémon and Forms. Only Unown, Castform and Deoxys forms will remain.

#define P_NEW_POKEMON TRUE // Turning this to FALSE will remove all newly added Pokémon and Forms. Only Unown, Castform and Deoxys forms will remain.

#define P_ENABLE_DEBUG TRUE // Enables a debug menu for pokemon sprites and icons, accessed by pressing SELECT in the summary screen.
#define P_ENABLE_DEBUG TRUE // Enables a debug menu for pokemon sprites and icons, accessed by pressing SELECT in the summary screen.

#endif // GUARD_CONSTANTS_POKEMON_CONFIG_H
43 changes: 29 additions & 14 deletions src/battle_ai_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ static u32 GetWildAiFlags(void)
if (avgLevel >= 80)
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);
#endif

return flags;
}
Expand Down Expand Up @@ -1273,10 +1275,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score -= 10;
break;
case EFFECT_OHKO:
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
if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE))
return 0;
#endif
if (!ShouldTryOHKO(battlerAtk, battlerDef, AI_DATA->abilities[battlerAtk], AI_DATA->abilities[battlerDef], move))
score -= 10;
break;
Expand Down Expand Up @@ -1304,8 +1306,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score -= 8;
else if (AI_DATA->hpPercents[battlerAtk] <= 25)
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;
#endif
break;
case EFFECT_LEECH_SEED:
if (gStatuses3[battlerDef] & STATUS3_LEECHSEED
Expand All @@ -1317,8 +1321,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break;
case EFFECT_DISABLE:
if (gDisableStructs[battlerDef].disableTimer == 0
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)
&& !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove))
#if B_MENTAL_HERB >= GEN_5
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB
#endif
&& !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove))
{
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first
{
Expand All @@ -1337,8 +1343,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break;
case EFFECT_ENCORE:
if (gDisableStructs[battlerDef].encoreTimer == 0
&& (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)
&& !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove))
#if B_MENTAL_HERB >= GEN_5
&& AI_DATA->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB
#endif
&& !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, AI_DATA->partnerMove))
{
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first
{
Expand Down Expand Up @@ -1570,9 +1578,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score -= 10;
break;
}

if (B_MENTAL_HERB >= GEN_5 && AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB)
#if B_MENTAL_HERB >= GEN_5
if (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB)
score -= 6;
#endif
break;
case EFFECT_WILL_O_WISP:
if (!AI_CanBurn(battlerAtk, battlerDef, AI_DATA->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, AI_DATA->partnerMove))
Expand Down Expand Up @@ -3545,7 +3554,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break;
case EFFECT_DISABLE:
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
{
Expand All @@ -3567,7 +3579,10 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
break;
case EFFECT_ENCORE:
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))
score += 3;
Expand Down Expand Up @@ -3616,7 +3631,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
{
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;
#endif
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER || GetBattlerSide(battlerAtk) == B_SIDE_PLAYER)
Expand Down
89 changes: 56 additions & 33 deletions src/battle_ai_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,21 +600,25 @@ bool32 AtMaxHp(u8 battlerId)
bool32 IsBattlerTrapped(u8 battler, bool8 checkSwitch)
{
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)
|| (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY)
|| (!checkSwitch && holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN))
{

#if B_GHOSTS_ESCAPE >= GEN_6
if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
return FALSE;
}
else
{
if (gBattleMons[battler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED)
|| IsAbilityPreventingEscape(battler)
|| gStatuses3[battler] & (STATUS3_ROOTED | STATUS3_SKY_DROPPED)
|| (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK))
return TRUE;
}
#endif
if (checkSwitch && holdEffect == HOLD_EFFECT_SHED_SHELL)
return FALSE;
else if (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY)
return FALSE;
else if (!checkSwitch && holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)
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 FALSE;
}
Expand Down Expand Up @@ -647,9 +651,11 @@ bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler)
// move checks
bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect)
{
if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS))
|| ability == ABILITY_OVERCOAT
|| holdEffect == HOLD_EFFECT_SAFETY_GOGGLES)
if (ability == ABILITY_OVERCOAT
#if B_POWDER_GRASS >= GEN_6
|| IS_BATTLER_OF_TYPE(battler, TYPE_GRASS)
#endif
|| holdEffect == HOLD_EFFECT_SAFETY_GOGGLES)
return FALSE;
return TRUE;
}
Expand Down Expand Up @@ -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)
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;
#endif

// discouraged from hitting
if (AI_WeatherHasEffect() && (gBattleWeather & B_WEATHER_SUN)
Expand All @@ -1426,10 +1434,12 @@ bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move)
// increased accuracy but don't always hit
if ((AI_WeatherHasEffect() &&
(((gBattleWeather & B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE))
|| (((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD))))
|| (gBattleMoves[move].effect == EFFECT_VITAL_THROW)
|| (gBattleMoves[move].accuracy == 0)
|| ((B_MINIMIZE_DMG_ACC >= GEN_6) && (gStatuses3[battlerDef] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE)))
|| (((gBattleWeather & B_WEATHER_HAIL) && move == MOVE_BLIZZARD))))
|| (gBattleMoves[move].effect == EFFECT_VITAL_THROW)
#if B_MINIMIZE_DMG_ACC >= GEN_6
|| ((gStatuses3[battlerDef] & STATUS3_MINIMIZED) && (gBattleMoves[move].flags & FLAG_DMG_MINIMIZE))
#endif
|| (gBattleMoves[move].accuracy == 0))
{
return TRUE;
}
Expand Down Expand Up @@ -1461,10 +1471,10 @@ bool32 ShouldTryOHKO(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbilit
else // test the odds
{
u16 odds = accuracy + (gBattleMons[battlerAtk].level - gBattleMons[battlerDef].level);
#if B_SHEER_COLD_ACC >= GEN_7
if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE))
odds -= 10;
#endif
#if B_SHEER_COLD_ACC >= GEN_7
if (gCurrentMove == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE))
odds -= 10;
#endif
if (Random() % 100 + 1 < odds && gBattleMons[battlerAtk].level >= gBattleMons[battlerDef].level)
return TRUE;
}
Expand Down Expand Up @@ -2240,10 +2250,15 @@ static u32 GetTrapDamage(u8 battlerId)
if (gBattleMons[battlerId].status2 & STATUS2_WRAPPED)
{
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
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)
damage = 1;
}
Expand Down Expand Up @@ -2462,14 +2477,22 @@ bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 mo
return PIVOT; // Won't get the two turns, pivot

if (!IS_MOVE_STATUS(move) && (shouldSwitch
|| (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
|| (defAbility == ABILITY_STURDY && B_STURDY >= GEN_5) || defAbility == ABILITY_MULTISCALE || defAbility == ABILITY_SHADOW_SHIELD))))
|| (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
#if B_STURDY >= GEN_5
|| defAbility == ABILITY_STURDY
#endif
|| defAbility == ABILITY_MULTISCALE
|| defAbility == ABILITY_SHADOW_SHIELD))))
return PIVOT; // pivot to break sash/sturdy/multiscale
}
else if (!hasStatBoost)
{
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

if (shouldSwitch)
Expand Down Expand Up @@ -2608,7 +2631,7 @@ bool32 CanKnockOffItem(u8 battler, u16 item)
| BATTLE_TYPE_LINK
| BATTLE_TYPE_RECORDED_LINK
| BATTLE_TYPE_SECRET_BASE
#if defined B_TRAINERS_KNOCK_OFF_ITEMS
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
| BATTLE_TYPE_TRAINER
#endif
)) && GetBattlerSide(battler) == B_SIDE_PLAYER)
Expand Down
4 changes: 2 additions & 2 deletions src/battle_anim.c
Original file line number Diff line number Diff line change
Expand Up @@ -1266,10 +1266,10 @@ static void LoadDefaultBg(void)
{
if (IsContest())
LoadContestBgAfterMoveAnim();
#if B_TERRAIN_BG_CHANGE == TRUE
#if B_TERRAIN_BG_CHANGE == TRUE
else if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
DrawTerrainTypeBattleBackground();
#endif
#endif
else
DrawMainBattleBackground();
}
Expand Down
Loading