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_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

View File

@ -77,7 +77,7 @@
// 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_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_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.
@ -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_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.
// 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_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_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.

View File

@ -141,9 +141,11 @@ static u32 GetWildAiFlags(void)
flags |= AI_FLAG_PREFER_STRONGEST_MOVE;
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;
}
@ -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;
@ -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
@ -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
{
@ -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
{
@ -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))
@ -3543,7 +3552,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
{
@ -3565,7 +3577,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;
@ -3614,7 +3629,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)

View File

@ -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;
}
@ -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;
}
@ -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)
@ -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;
}
@ -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;
}
@ -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;
}
@ -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)
@ -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)

View File

@ -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();
}

View File

@ -870,11 +870,11 @@ void LoadBattleTextboxAndBackground(void)
CopyBgTilemapBufferToVram(0);
LoadCompressedPalette(gBattleTextboxPalette, 0, 0x40);
LoadBattleMenuWindowGfx();
#if B_TERRAIN_BG_CHANGE == TRUE
DrawTerrainTypeBattleBackground();
#else
DrawMainBattleBackground();
#endif
#if B_TERRAIN_BG_CHANGE == TRUE
DrawTerrainTypeBattleBackground();
#else
DrawMainBattleBackground();
#endif
}
static void DrawLinkBattleParticipantPokeballs(u8 taskId, u8 multiplayerId, u8 bgId, u8 destX, u8 destY)

View File

@ -1618,7 +1618,7 @@ static void OpponentHandleChooseMove(void)
target = GetBattlerAtPosition(Random() & 2);
} while (!CanTargetBattler(gActiveBattler, target, move));
#if B_WILD_NATURAL_ENEMIES == TRUE
#if B_WILD_NATURAL_ENEMIES == TRUE
// Don't bother to loop through table if the move can't attack ally
if (!(gBattleMoves[move].target & MOVE_TARGET_BOTH))
{
@ -1650,7 +1650,7 @@ static void OpponentHandleChooseMove(void)
BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (target << 8));
}
else
#endif
#endif
BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (target << 8));
}
else

View File

@ -330,12 +330,14 @@ static void HandleInputChooseAction(void)
{
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);
PlayerBufferExecCompleted();
}
#if B_LAST_USED_BALL == TRUE
#endif
#if B_LAST_USED_BALL == TRUE
else if (JOY_NEW(B_LAST_USED_BALL_BUTTON) && CanThrowLastUsedBall())
{
PlaySE(SE_SELECT);
@ -343,7 +345,7 @@ static void HandleInputChooseAction(void)
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_THROW_BALL, 0);
PlayerBufferExecCompleted();
}
#endif
#endif
}
static void UnusedEndBounceEffect(void)
@ -652,26 +654,25 @@ static void HandleInputChooseMove(void)
canSelectTarget = 0;
}
#if B_SHOW_TARGETS == TRUE
// 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;
for (i = 0; i < gBattlersCount; i++)
TryShowAsTarget(i);
canSelectTarget = 3;
}
else if (moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))
{
TryShowAsTarget(gMultiUsePlayerCursor);
TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor));
if (moveTarget & MOVE_TARGET_FOES_AND_ALLY)
TryShowAsTarget(BATTLE_PARTNER(gActiveBattler));
canSelectTarget = 2;
}
u32 i = 0;
for (i = 0; i < gBattlersCount; i++)
TryShowAsTarget(i);
canSelectTarget = 3;
}
else if (moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))
{
TryShowAsTarget(gMultiUsePlayerCursor);
TryShowAsTarget(BATTLE_PARTNER(gMultiUsePlayerCursor));
if (moveTarget & MOVE_TARGET_FOES_AND_ALLY)
TryShowAsTarget(BATTLE_PARTNER(gActiveBattler));
canSelectTarget = 2;
}
#endif
}
switch (canSelectTarget)

View File

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

View File

@ -3361,10 +3361,11 @@ static void DoBattleIntro(void)
}
else // Skip party summary since it is a wild battle.
{
if (B_FAST_INTRO)
*state = 7; // Don't wait for sprite, print message at the same time.
else
*state = 6; // Wait for sprite to load.
#if B_FAST_INTRO == TRUE
*state = 7; // Don't wait for sprite, print message at the same time.
#else
*state = 6; // Wait for sprite to load.
#endif
}
break;
case 5: // draw party summary in trainer battles
@ -3433,10 +3434,11 @@ static void DoBattleIntro(void)
}
else
{
if (B_FAST_INTRO)
*state = 15; // Wait for text to be printed.
else
*state = 14; // Wait for text and sprite.
#if B_FAST_INTRO == TRUE
*state = 15; // Wait for text to be printed.
#else
*state = 14; // Wait for text and sprite.
#endif
}
}
break;
@ -3474,9 +3476,11 @@ static void DoBattleIntro(void)
BtlController_EmitIntroTrainerBallThrow(BUFFER_A);
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.
else
#endif
(*state)++;
break;
case 14: // wait for opponent 2 send out
@ -3496,13 +3500,14 @@ static void DoBattleIntro(void)
gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
// A hack that makes fast intro work in trainer battles too.
if (B_FAST_INTRO
&& gBattleTypeFlags & BATTLE_TYPE_TRAINER
#if B_FAST_INTRO == TRUE
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
&& !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))
&& gSprites[gHealthboxSpriteIds[gActiveBattler ^ BIT_SIDE]].callback == SpriteCallbackDummy)
{
return;
}
#endif
PrepareStringBattle(STRINGID_INTROSENDOUT, gActiveBattler);
}
@ -4456,7 +4461,11 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId)
// paralysis drop
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;
}
@ -4481,8 +4490,10 @@ s8 GetMovePriority(u32 battlerId, u16 move)
priority = gBattleMoves[move].priority;
if (ability == ABILITY_GALE_WINGS
&& gBattleMoves[move].type == TYPE_FLYING
&& (B_GALE_WINGS <= GEN_6 || BATTLER_MAX_HP(battlerId)))
#if B_GALE_WINGS >= GEN_7
&& BATTLER_MAX_HP(battlerId)
#endif
&& gBattleMoves[move].type == TYPE_FLYING)
{
priority++;
}
@ -5125,10 +5136,10 @@ static void HandleEndTurn_FinishBattle(void)
RecordedBattle_SetPlaybackFinished();
BeginFastPaletteFade(3);
FadeOutMapMusic(5);
#if B_TRAINERS_KNOCK_OFF_ITEMS
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
TryRestoreStolenItems();
#endif
#endif
for (i = 0; i < PARTY_SIZE; i++)
{
UndoMegaEvolution(i);
@ -5170,7 +5181,10 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void)
| BATTLE_TYPE_FRONTIER
| BATTLE_TYPE_EREADER_TRAINER
| 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;
}
@ -5455,5 +5469,9 @@ void SetTotemBoost(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;
case STATUS1_PARALYSIS:
if (gBaseStats[species].type1 == TYPE_GROUND || gBaseStats[species].type2 == TYPE_GROUND
|| (B_PARALYZE_ELECTRIC >= GEN_6 &&
(gBaseStats[species].type1 == TYPE_ELECTRIC || gBaseStats[species].type2 == TYPE_ELECTRIC)))
#if B_PARALYZE_ELECTRIC >= GEN_6
|| gBaseStats[species].type1 == TYPE_ELECTRIC || gBaseStats[species].type2 == TYPE_ELECTRIC
#endif
)
ret = TRUE;
break;
case STATUS1_BURN:

View File

@ -1395,10 +1395,10 @@ static void Cmd_attackcanceler(void)
gBattlescriptCurrInstr = BattleScript_MoveEnd;
return;
}
#if (B_STANCE_CHANGE_FAIL <= GEN_6)
#if B_STANCE_CHANGE_FAIL <= GEN_6
if (TryAegiFormChange())
return;
#endif
#endif
if (AtkCanceller_UnableToUseMove())
return;
@ -1430,10 +1430,10 @@ static void Cmd_attackcanceler(void)
gMoveResultFlags |= MOVE_RESULT_MISSED;
return;
}
#if (B_STANCE_CHANGE_FAIL >= GEN_7)
#if B_STANCE_CHANGE_FAIL >= GEN_7
if (TryAegiFormChange())
return;
#endif
#endif
gHitMarker &= ~HITMARKER_ALLOW_NO_PP;
@ -1601,13 +1601,13 @@ static bool32 AccuracyCalcHelper(u16 move)
JumpIfMoveFailed(7, move);
return TRUE;
}
else if (B_TOXIC_NEVER_MISS >= GEN_6
&& gBattleMoves[move].effect == EFFECT_TOXIC
&& IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON))
#if B_TOXIC_NEVER_MISS >= GEN_6
else if (gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_POISON))
{
JumpIfMoveFailed(7, move);
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.
else if (GetBattlerAbility(gBattlerAttacker) == ABILITY_NO_GUARD && (move != MOVE_SKY_DROP || gBattleStruct->skyDropTargets[gBattlerTarget] == 0xFF))
{
@ -1639,14 +1639,40 @@ static bool32 AccuracyCalcHelper(u16 move)
return TRUE;
}
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))))
|| (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)))
if (WEATHER_HAS_EFFECT)
{
if ((IsBattlerWeatherAffected(gBattlerTarget, B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE)))
{
// thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella
JumpIfMoveFailed(7, move);
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)
{
// thunder/hurricane ignore acc checks in rain unless target is holding utility umbrella
JumpIfMoveFailed(7, move);
return TRUE;
}
@ -2885,7 +2911,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1);
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
gBattleMons[gEffectBattler].status1 |= sStatusFlagsForMoveEffects[gBattleScripting.moveEffect];
@ -2987,7 +3017,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
{
gBattleMons[gEffectBattler].status2 |= STATUS2_MULTIPLETURNS;
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);
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
@ -3042,9 +3076,15 @@ void SetMoveEffect(bool32 primary, u32 certain)
{
gBattleMons[gEffectBattler].status2 |= STATUS2_WRAPPED;
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
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->wrappedBy[gEffectBattler] = gBattlerAttacker;
@ -3459,8 +3499,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
gBattlescriptCurrInstr++;
break;
case MOVE_EFFECT_INCINERATE:
if ((B_INCINERATE_GEMS >= GEN_6 && GetBattlerHoldEffect(gEffectBattler, FALSE) == HOLD_EFFECT_GEMS)
|| (gBattleMons[gEffectBattler].item >= FIRST_BERRY_INDEX && gBattleMons[gEffectBattler].item <= LAST_BERRY_INDEX))
if ((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;
gBattleMons[gEffectBattler].item = 0;
@ -4004,13 +4047,20 @@ static void Cmd_getexp(void)
gBattleMoveDamage = 0;
// 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;
#else
if (holdEffect == HOLD_EFFECT_EXP_SHARE && gBattleMoveDamage == 0)
gBattleMoveDamage += gExpShareExp;
#endif
if (holdEffect == HOLD_EFFECT_LUCKY_EGG)
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;
#if (B_SCALED_EXP >= GEN_5) && (B_SCALED_EXP != GEN_6)
#endif
#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
// because of multiplying by scaling factor(the value would simply be larger than an u32 can hold). Hence u64 is needed.
@ -4019,7 +4069,7 @@ static void Cmd_getexp(void)
value /= sExperienceScalingFactors[gBattleMons[gBattlerFainted].level + GetMonData(&gPlayerParty[gBattleStruct->expGetterMonId], MON_DATA_LEVEL) + 10];
gBattleMoveDamage = value + 1;
}
#endif
#endif
if (IsTradedMon(&gPlayerParty[gBattleStruct->expGetterMonId]))
{
@ -4720,14 +4770,14 @@ static void Cmd_playanimation(void)
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
argumentPtr = T2_READ_PTR(gBattlescriptCurrInstr + 3);
#if B_TERRAIN_BG_CHANGE == FALSE
#if B_TERRAIN_BG_CHANGE == FALSE
if (animId == B_ANIM_RESTORE_BG)
{
// workaround for .if not working
gBattlescriptCurrInstr += 7;
return;
}
#endif
#endif
if (animId == B_ANIM_STATS_CHANGE
|| animId == B_ANIM_SNATCH_MOVE
@ -5035,7 +5085,11 @@ static void Cmd_moveend(void)
i = gBattlerAttacker;
gBattlerAttacker = gBattlerTarget;
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();
gBattlescriptCurrInstr = BattleScript_KingsShieldEffect;
effect = 1;
@ -5605,17 +5659,19 @@ static void Cmd_moveend(void)
BattleScriptPushCursor();
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER || GetBattlerSide(i) == B_SIDE_PLAYER)
{
if (B_ABILITY_POP_UP)
gBattlescriptCurrInstr = BattleScript_EmergencyExit;
else
gBattlescriptCurrInstr = BattleScript_EmergencyExitNoPopUp;
#if B_ABILITY_POP_UP == TRUE
gBattlescriptCurrInstr = BattleScript_EmergencyExit;
#else
gBattlescriptCurrInstr = BattleScript_EmergencyExitNoPopUp;
#endif
}
else
{
if (B_ABILITY_POP_UP)
gBattlescriptCurrInstr = BattleScript_EmergencyExitWild;
else
gBattlescriptCurrInstr = BattleScript_EmergencyExitWildNoPopUp;
#if B_ABILITY_POP_UP == TRUE
gBattlescriptCurrInstr = BattleScript_EmergencyExitWild;
#else
gBattlescriptCurrInstr = BattleScript_EmergencyExitWildNoPopUp;
#endif
}
return;
}
@ -5628,12 +5684,12 @@ static void Cmd_moveend(void)
if (gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget)
*(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].dancerOriginalTarget & 0x3;
#if B_RAMPAGE_CANCELLING >= GEN_5
#if B_RAMPAGE_CANCELLING >= GEN_5
if (gBattleMoves[gCurrentMove].effect == EFFECT_RAMPAGE // If we're rampaging
&& (gMoveResultFlags & MOVE_RESULT_NO_EFFECT) // And it is unusable
&& (gBattleMons[gBattlerAttacker].status2 & STATUS2_LOCK_CONFUSE) != STATUS2_LOCK_CONFUSE_TURN(1)) // And won't end this turn
CancelMultiTurnMoves(gBattlerAttacker); // Cancel it
#endif
#endif
gProtectStructs[gBattlerAttacker].usesBouncedMove = FALSE;
gProtectStructs[gBattlerAttacker].targetAffected = FALSE;
@ -8361,11 +8417,11 @@ static void Cmd_various(void)
&& !NoAliveMonsForEitherParty()
&& CompareStat(gBattlerAttacker, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN))
{
if (B_FELL_STINGER_STAT_RAISE >= GEN_7)
SET_STATCHANGER(STAT_ATK, 3, FALSE);
else
SET_STATCHANGER(STAT_ATK, 2, FALSE);
#if B_FELL_STINGER_STAT_RAISE >= GEN_7
SET_STATCHANGER(STAT_ATK, 3, FALSE);
#else
SET_STATCHANGER(STAT_ATK, 2, FALSE);
#endif
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
BattleScriptPush(gBattlescriptCurrInstr + 3);
gBattlescriptCurrInstr = BattleScript_FellStingerRaisesStat;
@ -9944,13 +10000,16 @@ static void Cmd_manipulatedamage(void)
gBattleMoveDamage *= -1;
break;
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;
#endif
if (gBattleMoveDamage == 0)
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;
case DMG_DOUBLED:
gBattleMoveDamage *= 2;
@ -10569,8 +10628,9 @@ static void Cmd_setmultihitcounter(void)
{
gMultiHitCounter = 5;
}
else if (B_MULTI_HIT_CHANCE >= GEN_5)
else
{
#if B_MULTI_HIT_CHANCE >= GEN_5
// 2 and 3 hits: 33.3%
// 4 and 5 hits: 16.7%
gMultiHitCounter = Random() % 4;
@ -10584,9 +10644,7 @@ static void Cmd_setmultihitcounter(void)
}
else
gMultiHitCounter += 3;
}
else
{
#else
// 2 and 3 hits: 37.5%
// 4 and 5 hits: 12.5%
gMultiHitCounter = Random() % 4;
@ -10594,6 +10652,7 @@ static void Cmd_setmultihitcounter(void)
gMultiHitCounter = (Random() % 4) + 2;
else
gMultiHitCounter += 2;
#endif
}
}
@ -10987,10 +11046,10 @@ static void Cmd_tryKO(void)
else
{
u16 odds = gBattleMoves[gCurrentMove].accuracy + (gBattleMons[gBattlerAttacker].level - gBattleMons[gBattlerTarget].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[gBattlerAttacker].level >= gBattleMons[gBattlerTarget].level)
lands = TRUE;
}
@ -11354,10 +11413,11 @@ static void Cmd_dmgtolevel(void)
static void Cmd_psywavedamageeffect(void)
{
s32 randDamage;
if (B_PSYWAVE_DMG >= GEN_6)
randDamage = (Random() % 101);
else
randDamage = (Random() % 11) * 10;
#if B_PSYWAVE_DMG >= GEN_6
randDamage = (Random() % 101);
#else
randDamage = (Random() % 11) * 10;
#endif
gBattleMoveDamage = gBattleMons[gBattlerAttacker].level * (randDamage + 50) / 100;
gBattlescriptCurrInstr++;
}
@ -11428,12 +11488,13 @@ static void Cmd_disablelastusedattack(void)
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerTarget].moves[i])
gDisableStructs[gBattlerTarget].disabledMove = gBattleMons[gBattlerTarget].moves[i];
if (B_DISABLE_TURNS == GEN_3)
gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 2;
else if (B_DISABLE_TURNS == GEN_4)
gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 4;
else
gDisableStructs[gBattlerTarget].disableTimer = 4;
#if B_DISABLE_TURNS == GEN_3
gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 2;
#elif B_DISABLE_TURNS == GEN_4
gDisableStructs[gBattlerTarget].disableTimer = (Random() & 3) + 4;
#else
gDisableStructs[gBattlerTarget].disableTimer = 4;
#endif
gDisableStructs[gBattlerTarget].disableTimerStartValue = gDisableStructs[gBattlerTarget].disableTimer; // used to save the random amount of turns?
gBattlescriptCurrInstr += 5;
}
@ -11711,7 +11772,11 @@ static void Cmd_settailwind(void)
{
gSideStatuses[side] |= SIDE_STATUS_TAILWIND;
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;
}
else
@ -12634,7 +12699,7 @@ static void Cmd_tryswapitems(void)
| BATTLE_TYPE_FRONTIER
| BATTLE_TYPE_SECRET_BASE
| BATTLE_TYPE_RECORDED_LINK
#if B_TRAINERS_KNOCK_OFF_ITEMS
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
| BATTLE_TYPE_TRAINER
#endif
))))
@ -12773,14 +12838,14 @@ static void Cmd_trywish(void)
break;
case 1: // heal effect
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff1, gBattlerTarget, gWishFutureKnock.wishPartyId[gBattlerTarget])
#if B_WISH_HP_SOURCE >= GEN_5
if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER)
gBattleMoveDamage = max(1, GetMonData(&gPlayerParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2);
else
gBattleMoveDamage = max(1, GetMonData(&gEnemyParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2);
#else
gBattleMoveDamage = max(1, gBattleMons[gBattlerTarget].maxHP / 2);
#endif
#if B_WISH_HP_SOURCE >= GEN_5
if (GetBattlerSide(gBattlerTarget) == B_SIDE_PLAYER)
gBattleMoveDamage = max(1, GetMonData(&gPlayerParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2);
else
gBattleMoveDamage = max(1, GetMonData(&gEnemyParty[gWishFutureKnock.wishPartyId[gBattlerTarget]], MON_DATA_MAX_HP) / 2);
#else
gBattleMoveDamage = max(1, gBattleMons[gBattlerTarget].maxHP / 2);
#endif
gBattleMoveDamage *= -1;
if (gBattleMons[gBattlerTarget].hp == gBattleMons[gBattlerTarget].maxHP)
@ -13180,45 +13245,40 @@ u16 GetSecretPowerMoveEffect(void)
{
switch (gBattleTerrain)
{
case BATTLE_TERRAIN_GRASS:
#if B_SECRET_POWER_EFFECT >= GEN_4
moveEffect = MOVE_EFFECT_SLEEP;
#else
moveEffect = MOVE_EFFECT_POISON;
#endif
break;
#if B_SECRET_POWER_EFFECT >= GEN_6
case BATTLE_TERRAIN_GRASS: moveEffect = MOVE_EFFECT_SLEEP; break;
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
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
case BATTLE_TERRAIN_LONG_GRASS:
moveEffect = MOVE_EFFECT_SLEEP;
break;
case BATTLE_TERRAIN_SAND:
moveEffect = MOVE_EFFECT_ACC_MINUS_1;
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:
moveEffect = MOVE_EFFECT_ATK_MINUS_1;
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_BURIAL_GROUND:
case BATTLE_TERRAIN_SPACE:
@ -13230,13 +13290,6 @@ u16 GetSecretPowerMoveEffect(void)
case BATTLE_TERRAIN_SWAMP:
moveEffect = MOVE_EFFECT_SPD_MINUS_1;
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_ICE:
moveEffect = MOVE_EFFECT_FREEZE;
@ -13439,12 +13492,14 @@ bool32 DoesSubstituteBlockMove(u8 battlerAtk, u8 battlerDef, u32 move)
{
if (!(gBattleMons[battlerDef].status2 & STATUS2_SUBSTITUTE))
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;
else if (GetBattlerAbility(battlerAtk) == ABILITY_INFILTRATOR)
return FALSE;
else if (gBattleMoves[move].flags & FLAG_HIT_IN_SUBSTITUTE)
return FALSE;
else
return TRUE;
}
@ -13576,18 +13631,18 @@ static void Cmd_removelightscreenreflect(void)
u8 side;
bool32 failed;
#if B_BRICK_BREAK >= GEN_4
// From Gen 4 onwards, Brick Break can remove screens on the user's side if used on an ally
side = GetBattlerSide(gBattlerTarget);
#else
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
#endif
#if B_BRICK_BREAK >= GEN_4
// From Gen 4 onwards, Brick Break can remove screens on the user's side if used on an ally
side = GetBattlerSide(gBattlerTarget);
#else
side = GetBattlerSide(gBattlerAttacker) ^ BIT_SIDE;
#endif
#if B_BRICK_BREAK >= GEN_5
failed = (gMoveResultFlags & MOVE_RESULT_NO_EFFECT);
#else
failed = FALSE;
#endif
#if B_BRICK_BREAK >= GEN_5
failed = (gMoveResultFlags & MOVE_RESULT_NO_EFFECT);
#else
failed = FALSE;
#endif
if (!failed
&& (gSideTimers[side].reflectTimer
@ -13673,73 +13728,72 @@ static void Cmd_handleballthrow(void)
ballMultiplier = 15;
case ITEM_NET_BALL:
if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_WATER) || IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_BUG))
#if B_NET_BALL_MODIFIER >= GEN_7
ballMultiplier = 50;
#else
ballMultiplier = 30;
#endif
#if B_NET_BALL_MODIFIER >= GEN_7
ballMultiplier = 50;
#else
ballMultiplier = 30;
#endif
break;
case ITEM_DIVE_BALL:
if (GetCurrentMapType() == MAP_TYPE_UNDERWATER
#if B_DIVE_BALL_MODIFIER >= GEN_4
if (GetCurrentMapType() == MAP_TYPE_UNDERWATER || gIsFishingEncounter || gIsSurfingEncounter)
ballMultiplier = 35;
#else
if (GetCurrentMapType() == MAP_TYPE_UNDERWATER)
ballMultiplier = 35;
|| gIsFishingEncounter || gIsSurfingEncounter
#endif
)
ballMultiplier = 35;
break;
case ITEM_NEST_BALL:
#if B_NEST_BALL_MODIFIER >= GEN_6
//((41 - Pokémon's level) ÷ 10)× if Pokémon's level is between 1 and 29, 1× otherwise.
if (gBattleMons[gBattlerTarget].level < 30)
ballMultiplier = 41 - gBattleMons[gBattlerTarget].level;
#elif B_NEST_BALL_MODIFIER == GEN_5
//((41 - Pokémon's level) ÷ 10)×, minimum 1×
if (gBattleMons[gBattlerTarget].level < 31)
ballMultiplier = 41 - gBattleMons[gBattlerTarget].level;
#else
//((40 - Pokémon's level) ÷ 10)×, minimum 1×
if (gBattleMons[gBattlerTarget].level < 40)
{
ballMultiplier = 40 - gBattleMons[gBattlerTarget].level;
if (ballMultiplier <= 9)
ballMultiplier = 10;
}
#endif
#if B_NEST_BALL_MODIFIER >= GEN_6
//((41 - Pokémon's level) ÷ 10)× if Pokémon's level is between 1 and 29, 1× otherwise.
if (gBattleMons[gBattlerTarget].level < 30)
ballMultiplier = 41 - gBattleMons[gBattlerTarget].level;
#elif B_NEST_BALL_MODIFIER == GEN_5
//((41 - Pokémon's level) ÷ 10)×, minimum 1×
if (gBattleMons[gBattlerTarget].level < 31)
ballMultiplier = 41 - gBattleMons[gBattlerTarget].level;
#else
//((40 - Pokémon's level) ÷ 10)×, minimum 1×
if (gBattleMons[gBattlerTarget].level < 40)
{
ballMultiplier = 40 - gBattleMons[gBattlerTarget].level;
if (ballMultiplier <= 9)
ballMultiplier = 10;
}
#endif
break;
case ITEM_REPEAT_BALL:
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), FLAG_GET_CAUGHT))
#if B_REPEAT_BALL_MODIFIER >= GEN_7
ballMultiplier = 35;
#else
ballMultiplier = 30;
#endif
break;
case ITEM_TIMER_BALL:
#if B_TIMER_BALL_MODIFIER >= GEN_5
ballMultiplier = (gBattleResults.battleTurnCounter * 3) + 10;
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), FLAG_GET_CAUGHT))
#if B_REPEAT_BALL_MODIFIER >= GEN_7
ballMultiplier = 35;
#else
ballMultiplier = gBattleResults.battleTurnCounter + 10;
ballMultiplier = 30;
#endif
break;
case ITEM_TIMER_BALL:
#if B_TIMER_BALL_MODIFIER >= GEN_5
ballMultiplier = (gBattleResults.battleTurnCounter * 3) + 10;
#else
ballMultiplier = gBattleResults.battleTurnCounter + 10;
#endif
if (ballMultiplier > 40)
ballMultiplier = 40;
break;
case ITEM_DUSK_BALL:
RtcCalcLocalTime();
if ((gLocalTime.hours >= 20 && gLocalTime.hours <= 3) || gMapHeader.cave || gMapHeader.mapType == MAP_TYPE_UNDERGROUND)
#if B_DUSK_BALL_MODIFIER >= GEN_7
ballMultiplier = 30;
#else
ballMultiplier = 35;
#endif
#if B_DUSK_BALL_MODIFIER >= GEN_7
ballMultiplier = 30;
#else
ballMultiplier = 35;
#endif
break;
case ITEM_QUICK_BALL:
if (gBattleResults.battleTurnCounter == 0)
#if B_QUICK_BALL_MODIFIER >= GEN_5
ballMultiplier = 50;
#else
ballMultiplier = 40;
#endif
#if B_QUICK_BALL_MODIFIER >= GEN_5
ballMultiplier = 50;
#else
ballMultiplier = 40;
#endif
break;
case ITEM_LEVEL_BALL:
if (gBattleMons[gBattlerAttacker].level >= 4 * gBattleMons[gBattlerTarget].level)
@ -13751,11 +13805,11 @@ static void Cmd_handleballthrow(void)
break;
case ITEM_LURE_BALL:
if (gIsFishingEncounter)
#if B_LURE_BALL_MODIFIER >= GEN_7
ballMultiplier = 50;
#else
ballMultiplier = 30;
#endif
#if B_LURE_BALL_MODIFIER >= GEN_7
ballMultiplier = 50;
#else
ballMultiplier = 30;
#endif
break;
case ITEM_MOON_BALL:
for (i = 0; i < EVOS_PER_MON; i++)
@ -13781,44 +13835,44 @@ static void Cmd_handleballthrow(void)
break;
case ITEM_HEAVY_BALL:
i = GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[gBattlerTarget].species), 1);
#if B_HEAVY_BALL_MODIFIER >= GEN_7
if (i < 1000)
ballAddition = -20;
else if (i < 2000)
ballAddition = 0;
else if (i < 3000)
ballAddition = 20;
else
ballAddition = 30;
#elif B_HEAVY_BALL_MODIFIER >= GEN_4
if (i < 2048)
ballAddition = -20;
else if (i < 3072)
ballAddition = 20;
else if (i < 4096)
ballAddition = 30;
else
ballAddition = 40;
#else
if (i < 1024)
ballAddition = -20;
else if (i < 2048)
ballAddition = 0;
else if (i < 3072)
ballAddition = 20;
else if (i < 4096)
ballAddition = 30;
else
ballAddition = 40;
#endif
#if B_HEAVY_BALL_MODIFIER >= GEN_7
if (i < 1000)
ballAddition = -20;
else if (i < 2000)
ballAddition = 0;
else if (i < 3000)
ballAddition = 20;
else
ballAddition = 30;
#elif B_HEAVY_BALL_MODIFIER >= GEN_4
if (i < 2048)
ballAddition = -20;
else if (i < 3072)
ballAddition = 20;
else if (i < 4096)
ballAddition = 30;
else
ballAddition = 40;
#else
if (i < 1024)
ballAddition = -20;
else if (i < 2048)
ballAddition = 0;
else if (i < 3072)
ballAddition = 20;
else if (i < 4096)
ballAddition = 30;
else
ballAddition = 40;
#endif
break;
case ITEM_DREAM_BALL:
#if B_DREAM_BALL_MODIFIER >= GEN_8
if (gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP || GetBattlerAbility(gBattlerTarget) == ABILITY_COMATOSE)
ballMultiplier = 40;
#else
ballMultiplier = 10;
#endif
#if B_DREAM_BALL_MODIFIER >= GEN_8
if (gBattleMons[gBattlerTarget].status1 & STATUS1_SLEEP || GetBattlerAbility(gBattlerTarget) == ABILITY_COMATOSE)
ballMultiplier = 40;
#else
ballMultiplier = 10;
#endif
break;
case ITEM_BEAST_BALL:
ballMultiplier = 1;
@ -14210,13 +14264,11 @@ static const u16 sTelekinesisBanList[] =
{
SPECIES_DIGLETT,
SPECIES_DUGTRIO,
// #ifdef NEW_POKEMON
SPECIES_DIGLETT_ALOLAN,
SPECIES_DUGTRIO_ALOLAN,
SPECIES_SANDYGAST,
SPECIES_PALOSSAND,
SPECIES_GENGAR_MEGA,
// #endif
};
bool32 IsTelekinesisBannedSpecies(u16 species)
@ -14354,33 +14406,33 @@ static void Cmd_metalburstdamagecalculator(void)
static bool32 CriticalCapture(u32 odds)
{
#if B_CRITICAL_CAPTURE == TRUE
u32 numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT);
#if B_CRITICAL_CAPTURE == TRUE
u32 numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT);
if (numCaught <= (NATIONAL_DEX_COUNT * 30) / 650)
odds = 0;
else if (numCaught <= (NATIONAL_DEX_COUNT * 150) / 650)
odds /= 2;
else if (numCaught <= (NATIONAL_DEX_COUNT * 300) / 650)
; // odds = (odds * 100) / 100;
else if (numCaught <= (NATIONAL_DEX_COUNT * 450) / 650)
odds = (odds * 150) / 100;
else if (numCaught <= (NATIONAL_DEX_COUNT * 600) / 650)
odds *= 2;
else
odds = (odds * 250) / 100;
if (numCaught <= (NATIONAL_DEX_COUNT * 30) / 650)
odds = 0;
else if (numCaught <= (NATIONAL_DEX_COUNT * 150) / 650)
odds /= 2;
else if (numCaught <= (NATIONAL_DEX_COUNT * 300) / 650)
; // odds = (odds * 100) / 100;
else if (numCaught <= (NATIONAL_DEX_COUNT * 450) / 650)
odds = (odds * 150) / 100;
else if (numCaught <= (NATIONAL_DEX_COUNT * 600) / 650)
odds *= 2;
else
odds = (odds * 250) / 100;
#ifdef ITEM_CATCHING_CHARM
if (CheckBagHasItem(ITEM_CATCHING_CHARM, 1))
odds = (odds * (100 + B_CATCHING_CHARM_BOOST)) / 100;
#endif
odds /= 6;
if ((Random() % 255) < odds)
return TRUE;
return FALSE;
#else
return FALSE;
#ifdef ITEM_CATCHING_CHARM
if (CheckBagHasItem(ITEM_CATCHING_CHARM, 1))
odds = (odds * (100 + B_CATCHING_CHARM_BOOST)) / 100;
#endif
odds /= 6;
if ((Random() % 255) < odds)
return TRUE;
return FALSE;
#else
return FALSE;
#endif
}

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 IsUnnerveAbilityOnOpposingSide(u8 battlerId);
static u8 GetFlingPowerFromItemId(u16 itemId);
extern const u8 *const gBattleScriptsForMoveEffects[];
extern const u8 *const gBattlescriptsForRunningByItem[];
@ -2770,8 +2771,11 @@ u8 DoBattlerEndTurnEffects(void)
&& gBattleMons[gActiveBattler].hp != 0)
{
MAGIC_GUARD_CHECK;
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / (B_BURN_DAMAGE >= GEN_7 ? 16 : 8);
#if B_BURN_DAMAGE >= GEN_7
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 16;
#else
gBattleMoveDamage = gBattleMons[gActiveBattler].maxHP / 8;
#endif
if (ability == ABILITY_HEATPROOF)
{
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]);
gBattlescriptCurrInstr = BattleScript_WrapTurnDmg;
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
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)
gBattleMoveDamage = 1;
@ -3025,7 +3035,11 @@ u8 DoBattlerEndTurnEffects(void)
}
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);
MarkBattlerForControllerExec(gActiveBattler);
BattleScriptExecute(BattleScript_YawnMakesAsleep);
@ -3290,7 +3304,7 @@ bool8 HandleFaintedMonActions(void)
gBattleStruct->faintedActionsState = 3;
else
gBattleStruct->faintedActionsState = 1;
#if B_FAINT_SWITCH_IN >= GEN_4
#if B_FAINT_SWITCH_IN >= GEN_4
// Don't switch mons until all pokemon performed their actions or the battle's over.
if (gBattleOutcome == 0
&& !NoAliveMonsForEitherParty()
@ -3299,10 +3313,10 @@ bool8 HandleFaintedMonActions(void)
gAbsentBattlerFlags |= gBitTable[gBattlerFainted];
return FALSE;
}
#endif
#endif
break;
case 3:
#if B_FAINT_SWITCH_IN >= GEN_4
#if B_FAINT_SWITCH_IN >= GEN_4
// Don't switch mons until all pokemon performed their actions or the battle's over.
if (gBattleOutcome == 0
&& !NoAliveMonsForEitherParty()
@ -3310,7 +3324,7 @@ bool8 HandleFaintedMonActions(void)
{
return FALSE;
}
#endif
#endif
gBattleStruct->faintedActionsBattlerId = 0;
gBattleStruct->faintedActionsState++;
// fall through
@ -3572,7 +3586,12 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattleMons[gBattlerAttacker].status2 -= STATUS2_CONFUSION_TURN(1);
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;
gBattlerTarget = gBattlerAttacker;
@ -3675,8 +3694,11 @@ u8 AtkCanceller_UnableToUseMove(void)
case CANCELLER_POWDER_MOVE:
if ((gBattleMoves[gCurrentMove].flags & FLAG_POWDER) && (gBattlerAttacker != gBattlerTarget))
{
if ((B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS))
|| GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT)
#if B_POWDER_GRASS >= GEN_6
if (IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_GRASS) || GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT)
#else
if (GetBattlerAbility(gBattlerTarget) == ABILITY_OVERCOAT)
#endif
{
gBattlerAbility = gBattlerTarget;
effect = 1;
@ -4003,19 +4025,20 @@ bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
{
u16 battlerAbility = GetBattlerAbility(battler);
if (viaAbility && B_ABILITY_WEATHER <= GEN_5
&& !(gBattleWeather & sWeatherFlagsInfo[weatherEnumId][1]))
if (gBattleWeather & B_WEATHER_PRIMAL_ANY
&& battlerAbility != ABILITY_DESOLATE_LAND
&& battlerAbility != ABILITY_PRIMORDIAL_SEA
&& battlerAbility != ABILITY_DELTA_STREAM)
{
return FALSE;
}
#if B_ABILITY_WEATHER <= GEN_5
else if (viaAbility && !(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_PRIMORDIAL_SEA
&& battlerAbility != ABILITY_DELTA_STREAM)
{
return FALSE;
}
#endif
else if (!(gBattleWeather & (sWeatherFlagsInfo[weatherEnumId][0] | sWeatherFlagsInfo[weatherEnumId][1])))
{
gBattleWeather = (sWeatherFlagsInfo[weatherEnumId][0]);
@ -4214,7 +4237,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain);
effect++;
}
#if B_THUNDERSTORM_TERRAIN == TRUE
#if B_THUNDERSTORM_TERRAIN == TRUE
else if (GetCurrentWeather() == WEATHER_RAIN_THUNDERSTORM && !(gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN))
{
// overworld weather started rain, so just do electric terrain anim
@ -4223,7 +4246,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
BattleScriptPushCursorAndCallback(BattleScript_OverworldTerrain);
effect++;
}
#endif
#endif
break;
case ABILITYEFFECT_SWITCH_IN_WEATHER:
if (!(gBattleTypeFlags & BATTLE_TYPE_RECORDED))
@ -4745,7 +4768,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
if (gDisableStructs[battler].isFirstTurn != 2)
{
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++)
{
@ -4932,7 +4959,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
effect = 2, statId = STAT_ATK;
break;
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))
{
@ -5958,15 +5989,15 @@ u32 IsAbilityOnFieldExcept(u32 battlerId, u32 ability)
u32 IsAbilityPreventingEscape(u32 battlerId)
{
u32 id;
#if B_GHOSTS_ESCAPE >= GEN_6
if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST))
return 0;
#endif
#if B_SHADOW_TAG_ESCAPE >= GEN_4
if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && GetBattlerAbility(battlerId) != ABILITY_SHADOW_TAG)
#else
if (id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG))
#endif
#if B_GHOSTS_ESCAPE >= GEN_6
if (IS_BATTLER_OF_TYPE(battlerId, TYPE_GHOST))
return 0;
#endif
#if B_SHADOW_TAG_ESCAPE >= GEN_4
if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG)) && GetBattlerAbility(battlerId) != ABILITY_SHADOW_TAG)
#else
if (id = IsAbilityOnOpposingSide(battlerId, ABILITY_SHADOW_TAG))
#endif
return id;
if ((id = IsAbilityOnOpposingSide(battlerId, ABILITY_ARENA_TRAP)) && IsBattlerGrounded(battlerId))
return id;
@ -5980,7 +6011,11 @@ bool32 CanBattlerEscape(u32 battlerId) // no ability check
{
if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_SHED_SHELL)
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;
else if (gStatuses3[battlerId] & STATUS3_ROOTED)
return FALSE;
@ -6078,13 +6113,16 @@ bool32 CanBeBurned(u8 battlerId)
bool32 CanBeParalyzed(u8 battlerId)
{
u16 ability = GetBattlerAbility(battlerId);
if ((B_PARALYZE_ELECTRIC >= GEN_6 && IS_BATTLER_OF_TYPE(battlerId, TYPE_ELECTRIC))
|| gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_SAFEGUARD
|| ability == ABILITY_LIMBER
|| ability == ABILITY_COMATOSE
|| gBattleMons[battlerId].status1 & STATUS1_ANY
|| IsAbilityStatusProtected(battlerId)
|| IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN))
if (
#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_COMATOSE
|| gBattleMons[battlerId].status1 & STATUS1_ANY
|| IsAbilityStatusProtected(battlerId)
|| IsBattlerTerrainAffected(battlerId, STATUS_FIELD_MISTY_TERRAIN))
return FALSE;
return TRUE;
}
@ -6146,11 +6184,11 @@ bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId)
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 (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK))
#else
if (HasEnoughHpToEatBerry(battlerId, CONFUSE_BERRY_HP_FRACTION, itemId))
&& !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)
#endif
)
{
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)
{
#if B_HEAL_BLOCKING >= GEN_5
if (HasEnoughHpToEatBerry(battlerId, 2, itemId) && !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)
#else
if (HasEnoughHpToEatBerry(battlerId, 2, itemId)
#endif
&& !(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP))
if (!(gBattleScripting.overrideBerryRequirements && gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)
#if B_HEAL_BLOCKING >= GEN_5
&& !(gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)
#endif
&& HasEnoughHpToEatBerry(battlerId, 2, itemId))
{
if (percentHeal)
gBattleMoveDamage = (gBattleMons[battlerId].maxHP * GetBattlerHoldEffectParam(battlerId) / 100) * -1;
@ -6388,46 +6425,46 @@ static bool32 GetMentalHerbEffect(u8 battlerId)
StringCopy(gBattleTextBuff1, gStatusConditionString_LoveJpn);
ret = TRUE;
}
#if B_MENTAL_HERB >= GEN_5
// Check taunt
if (gDisableStructs[battlerId].tauntTimer != 0)
{
gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT);
ret = TRUE;
}
// Check encore
if (gDisableStructs[battlerId].encoreTimer != 0)
{
gDisableStructs[battlerId].encoredMove = 0;
gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED
ret = TRUE;
}
// Check torment
if (gBattleMons[battlerId].status2 & STATUS2_TORMENT)
{
gBattleMons[battlerId].status2 &= ~STATUS2_TORMENT;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TORMENT;
ret = TRUE;
}
// Check heal block
if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)
{
gStatuses3[battlerId] &= ~STATUS3_HEAL_BLOCK;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK;
ret = TRUE;
}
// Check disable
if (gDisableStructs[battlerId].disableTimer != 0)
{
gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0;
gDisableStructs[battlerId].disabledMove = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE;
ret = TRUE;
}
#endif
#if B_MENTAL_HERB >= GEN_5
// Check taunt
if (gDisableStructs[battlerId].tauntTimer != 0)
{
gDisableStructs[battlerId].tauntTimer = gDisableStructs[battlerId].tauntTimer2 = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TAUNT;
PREPARE_MOVE_BUFFER(gBattleTextBuff1, MOVE_TAUNT);
ret = TRUE;
}
// Check encore
if (gDisableStructs[battlerId].encoreTimer != 0)
{
gDisableStructs[battlerId].encoredMove = 0;
gDisableStructs[battlerId].encoreTimerStartValue = gDisableStructs[battlerId].encoreTimer = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_ENCORE; // STRINGID_PKMNENCOREENDED
ret = TRUE;
}
// Check torment
if (gBattleMons[battlerId].status2 & STATUS2_TORMENT)
{
gBattleMons[battlerId].status2 &= ~STATUS2_TORMENT;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_TORMENT;
ret = TRUE;
}
// Check heal block
if (gStatuses3[battlerId] & STATUS3_HEAL_BLOCK)
{
gStatuses3[battlerId] &= ~STATUS3_HEAL_BLOCK;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_HEALBLOCK;
ret = TRUE;
}
// Check disable
if (gDisableStructs[battlerId].disableTimer != 0)
{
gDisableStructs[battlerId].disableTimer = gDisableStructs[battlerId].disableTimerStartValue = 0;
gDisableStructs[battlerId].disabledMove = 0;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_MENTALHERBCURE_DISABLE;
ret = TRUE;
}
#endif
return ret;
}
@ -6478,48 +6515,39 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
BattleScriptExecute(BattleScript_WhiteHerbEnd2);
}
break;
#if B_BERRIES_INSTANT >= GEN_4
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2);
@ -6527,11 +6555,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_RANDOM_STAT_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE);
effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, TRUE);
break;
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;
BattleScriptExecute(BattleScript_BerryCurePrlzEnd2);
@ -6539,7 +6566,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
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);
BattleScriptExecute(BattleScript_BerryCurePsnEnd2);
@ -6547,7 +6574,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
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;
BattleScriptExecute(BattleScript_BerryCureBrnEnd2);
@ -6555,7 +6582,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
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;
BattleScriptExecute(BattleScript_BerryCureFrzEnd2);
@ -6563,7 +6590,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
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].status2 &= ~STATUS2_NIGHTMARE;
@ -6572,7 +6599,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
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;
if (gBattleMons[battlerId].status1 & STATUS1_PSN_ANY)
@ -6617,13 +6644,12 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
}
break;
case HOLD_EFFECT_RESTORE_HP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE);
effect = ItemHealHp(battlerId, gLastUsedItem, TRUE, FALSE);
break;
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;
#endif
case HOLD_EFFECT_AIR_BALLOON:
effect = ITEM_EFFECT_OTHER;
gBattleScripting.battler = battlerId;
@ -6984,62 +7010,52 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
DO_ITEMEFFECT_MOVE_END:
switch (battlerHoldEffect)
{
#if B_HP_BERRIES >= GEN_4
case HOLD_EFFECT_MICLE_BERRY:
if (B_HP_BERRIES >= GEN_4)
effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE);
effect = TrySetMicleBerry(battlerId, gLastUsedItem, FALSE);
break;
case HOLD_EFFECT_RESTORE_HP:
if (B_HP_BERRIES >= GEN_4)
effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE);
effect = ItemHealHp(battlerId, gLastUsedItem, FALSE, FALSE);
break;
#endif
#if B_BERRIES_INSTANT >= GEN_4
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
case HOLD_EFFECT_RANDOM_STAT_UP:
if (B_BERRIES_INSTANT >= GEN_4)
effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, FALSE);
effect = RandomStatRaiseBerry(battlerId, gLastUsedItem, FALSE);
break;
#endif
case HOLD_EFFECT_CURE_PAR:
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && !UnnerveOn(battlerId, gLastUsedItem))
{
@ -7173,10 +7189,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
switch (atkHoldEffect)
{
case HOLD_EFFECT_FLINCH:
#if B_SERENE_GRACE_BOOST >= GEN_5
if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE)
atkHoldEffectParam *= 2;
#endif
#if B_SERENE_GRACE_BOOST >= GEN_5
if (GetBattlerAbility(gBattlerAttacker) == ABILITY_SERENE_GRACE)
atkHoldEffectParam *= 2;
#endif
if (gBattleMoveDamage != 0 // Need to have done damage
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& TARGET_TURN_DAMAGED
@ -7722,9 +7738,12 @@ u32 GetBattlerHoldEffect(u8 battlerId, bool32 checkNegating)
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];
else if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY)
else
#endif
if (gBattleMons[battlerId].item == ITEM_ENIGMA_BERRY)
return gEnigmaBerries[battlerId].holdEffect;
else
return ItemId_GetHoldEffect(gBattleMons[battlerId].item);
@ -8058,7 +8077,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
// todo
break;
case EFFECT_FLING:
basePower = ItemId_GetFlingPower(gBattleMons[battlerAtk].item);
basePower = GetFlingPowerFromItemId(gBattleMons[battlerAtk].item);
break;
case EFFECT_ERUPTION:
basePower = gBattleMons[battlerAtk].hp * basePower / gBattleMons[battlerAtk].maxHP;
@ -8202,7 +8221,10 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
break;
case EFFECT_PAYBACK:
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;
break;
case EFFECT_BOLT_BEAK:
@ -8488,11 +8510,11 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
MulModifier(&modifier, holdEffectModifier);
break;
case HOLD_EFFECT_SOUL_DEW:
#if B_SOUL_DEW_BOOST >= GEN_7
#if B_SOUL_DEW_BOOST >= GEN_7
if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && (moveType == TYPE_PSYCHIC || moveType == TYPE_DRAGON))
#else
#else
if ((gBattleMons[battlerAtk].species == SPECIES_LATIAS || gBattleMons[battlerAtk].species == SPECIES_LATIOS) && !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER) && IS_MOVE_SPECIAL(move))
#endif
#endif
MulModifier(&modifier, holdEffectModifier);
break;
case HOLD_EFFECT_GEMS:
@ -8575,6 +8597,12 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe
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
if (gProtectStructs[battlerAtk].helpingHand)
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)
MulModifier(&modifier, UQ_4_12(1.5));
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))
MulModifier(&modifier, UQ_4_12(0.5));
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))
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 ((gFieldStatuses & STATUS_FIELD_MUDSPORT && moveType == TYPE_ELECTRIC)
|| (gFieldStatuses & STATUS_FIELD_WATERSPORT && moveType == TYPE_FIRE))
MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5));
if ((moveType == TYPE_ELECTRIC && gFieldStatuses & STATUS_FIELD_MUDSPORT)
|| (moveType == TYPE_FIRE && gFieldStatuses & STATUS_FIELD_WATERSPORT))
#else
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)))
MulModifier(&modifier, (B_SPORT_DMG_REDUCTION >= GEN_5) ? UQ_4_12(0.23) : UQ_4_12(0.5));
|| (moveType == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0)))
#endif
#if B_SPORT_DMG_REDUCTION >= GEN_5
MulModifier(&modifier, UQ_4_12(0.23));
#else
MulModifier(&modifier, UQ_4_12(0.5));
#endif
return ApplyModifier(modifier, basePower);
}
#undef TERRAIN_TYPE_BOOST
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
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
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)
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);
}
}
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);
}
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);
}
#endif
// Thousand Arrows ignores type modifiers for flying mons
if (!IsBattlerGrounded(battlerDef) && (gBattleMoves[move].flags & FLAG_DMG_UNGROUNDED_IGNORE_TYPE_IF_FLYING)
@ -9327,10 +9369,11 @@ u16 CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilit
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];
else
return sTypeEffectivenessTable[atkType][defType];
#endif
return sTypeEffectivenessTable[atkType][defType];
}
s32 GetStealthHazardDamage(u8 hazardType, u8 battlerId)
@ -9476,9 +9519,12 @@ bool32 CanMegaEvolve(u8 battlerId)
// Check if there is an entry in the evolution table for regular Mega Evolution.
if (GetMegaEvolutionSpecies(species, itemId) != SPECIES_NONE)
{
#if B_ENABLE_DEBUG == TRUE
if (B_ENABLE_DEBUG && 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;
else
holdEffect = ItemId_GetHoldEffect(itemId);
@ -9679,9 +9725,8 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId)
bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId)
{
if (B_BADGE_BOOST != GEN_3)
return FALSE;
else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER))
#if B_BADGE_BOOST != GEN_3
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER))
return FALSE;
else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
return FALSE;
@ -9689,8 +9734,8 @@ bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId)
return FALSE;
else if (FlagGet(badgeFlag))
return TRUE;
else
return FALSE;
#endif
return FALSE;
}
u8 GetBattleMoveSplit(u32 moveId)
@ -9699,12 +9744,17 @@ u8 GetBattleMoveSplit(u32 moveId)
return gBattleStruct->zmove.activeSplit;
if (gBattleStruct != NULL && gBattleStruct->swapDamageCategory) // Photon Geyser, Shell Side Arm, Light That Burns the Sky
return SPLIT_PHYSICAL;
else if (IS_MOVE_STATUS(moveId) || B_PHYSICAL_SPECIAL_SPLIT >= GEN_4)
return gBattleMoves[moveId].split;
#if B_PHYSICAL_SPECIAL_SPLIT >= GEN_4
return gBattleMoves[moveId].split;
#else
if (IS_MOVE_STATUS(moveId))
return SPLIT_STATUS;
else if (gBattleMoves[moveId].type < TYPE_MYSTERY)
return SPLIT_PHYSICAL;
else
return SPLIT_SPECIAL;
#endif
}
static bool32 TryRemoveScreens(u8 battler)
@ -9781,6 +9831,19 @@ struct Pokemon *GetBattlerPartyData(u8 battlerId)
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
bool32 CanFling(u8 battlerId)
{
@ -9793,7 +9856,7 @@ bool32 CanFling(u8 battlerId)
#endif
|| gFieldStatuses & STATUS_FIELD_MAGIC_ROOM
|| gDisableStructs[battlerId].embargoTimer != 0
|| ItemId_GetFlingPower(item) != 0
|| GetFlingPowerFromItemId(item) != 0
|| !CanBattlerGetOrLoseItem(battlerId, item))
return FALSE;
@ -9949,7 +10012,7 @@ bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item)
| BATTLE_TYPE_LINK
| BATTLE_TYPE_RECORDED_LINK
| BATTLE_TYPE_SECRET_BASE
#if B_TRAINERS_KNOCK_OFF_ITEMS
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
| BATTLE_TYPE_TRAINER
#endif
)))
@ -9978,14 +10041,14 @@ void TrySaveExchangedItem(u8 battlerId, u16 stolenItem)
{
// Because BtlController_EmitSetMonData does SetMonData, we need to save the stolen item only if it matches the battler's original
// So, if the player steals an item during battle and has it stolen from it, it will not end the battle with it (naturally)
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
// If regular trainer battle and mon's original item matches what is being stolen, save it to be restored at end of battle
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
&& !(gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
&& GetBattlerSide(battlerId) == B_SIDE_PLAYER
&& stolenItem == gBattleStruct->itemStolen[gBattlerPartyIndexes[battlerId]].originalItem)
gBattleStruct->itemStolen[gBattlerPartyIndexes[battlerId]].stolen = TRUE;
#endif
#endif
}
bool32 IsBattlerAffectedByHazards(u8 battlerId, bool32 toxicSpikes)

View File

@ -58,7 +58,6 @@ static u8 GetZMoveScore(u8 battlerAtk, u8 battlerDef, u16 baseMove, u16 zMove);
// Const Data
static const struct SignatureZMove sSignatureZMoves[] =
{
// #ifdef NEW_POKEMON
{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_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_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},
// #endif
{SPECIES_MEW, ITEM_MEWNIUM_Z, MOVE_PSYCHIC, MOVE_GENESIS_SUPERNOVA},
{SPECIES_PIKACHU, ITEM_PIKANIUM_Z, MOVE_VOLT_TACKLE, MOVE_CATASTROPIKA},
{SPECIES_EEVEE, ITEM_EEVIUM_Z, MOVE_LAST_RESORT, MOVE_EXTREME_EVOBOOST},
@ -189,10 +187,13 @@ bool32 IsViableZMove(u8 battlerId, u16 move)
if (IsPartnerMonFromSameTrainer(battlerId) && (mega->alreadyEvolved[partnerPosition] || (mega->toEvolve & gBitTable[BATTLE_PARTNER(battlerId)])))
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];
else if (item == ITEM_ENIGMA_BERRY)
else
#endif
if (item == ITEM_ENIGMA_BERRY)
return FALSE; // HoldEffect = gEnigmaBerries[battlerId].holdEffect;
else
holdEffect = ItemId_GetHoldEffect(item);

View File

@ -1014,16 +1014,16 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_Pencil, 0x0200, ANIM_TAG_PENCIL},
{gBattleAnimSpriteGfx_AirWave, 0x0100, ANIM_TAG_AIR_WAVE},
{gBattleAnimSpriteGfx_Orb, 0x0200, ANIM_TAG_ORB},
#if B_NEW_SWORD_PARTICLE
#if B_NEW_SWORD_PARTICLE
{gBattleAnimSpriteGfx_NewSword, 0x0400, ANIM_TAG_SWORD},
#else
#else
{gBattleAnimSpriteGfx_Sword, 0x0400, ANIM_TAG_SWORD},
#endif
#if B_NEW_LEECH_SEED_PARTICLE
#endif
#if B_NEW_LEECH_SEED_PARTICLE
{gBattleAnimSpriteGfx_NewLeechSeed, 0x0180, ANIM_TAG_SEED},
#else
#else
{gBattleAnimSpriteGfx_Seed, 0x0180, ANIM_TAG_SEED},
#endif
#endif
{gBattleAnimSpriteGfx_Explosion6, 0x0800, ANIM_TAG_EXPLOSION_6},
{gBattleAnimSpriteGfx_PinkOrb, 0x0020, ANIM_TAG_PINK_ORB},
{gBattleAnimSpriteGfx_Gust, 0x0400, ANIM_TAG_GUST},
@ -1046,11 +1046,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_HitDuplicate, 0x0A00, ANIM_TAG_HIT_DUPLICATE},
{gBattleAnimSpriteGfx_Leer, 0x0A00, ANIM_TAG_LEER},
{gBattleAnimSpriteGfx_BlueBurst, 0x0A00, ANIM_TAG_BLUE_BURST},
#if B_NEW_EMBER_PARTICLES
#if B_NEW_EMBER_PARTICLES
{gBattleAnimSpriteGfx_NewEmbers, 0x0A00, ANIM_TAG_SMALL_EMBER},
#else
#else
{gBattleAnimSpriteGfx_SmallEmber, 0x0A00, ANIM_TAG_SMALL_EMBER},
#endif
#endif
{gBattleAnimSpriteGfx_GraySmoke, 0x0A00, ANIM_TAG_GRAY_SMOKE},
{gBattleAnimSpriteGfx_BlueStar, 0x0E00, ANIM_TAG_BLUE_STAR},
{gBattleAnimSpriteGfx_BubbleBurst, 0x0380, ANIM_TAG_BUBBLE_BURST},
@ -1079,20 +1079,20 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_RedFist, 0x0200, ANIM_TAG_RED_FIST},
{gBattleAnimSpriteGfx_SlamHit, 0x1000, ANIM_TAG_SLAM_HIT},
{gBattleAnimSpriteGfx_Ring, 0x0180, ANIM_TAG_RING},
#if NEW_ROCKS_PARTICLE
#if NEW_ROCKS_PARTICLE
{gBattleAnimSpriteGfx_NewRocks, 0x0C00, ANIM_TAG_ROCKS},
#else
#else
{gBattleAnimSpriteGfx_Rocks, 0x0C00, ANIM_TAG_ROCKS},
#endif
#endif
{gBattleAnimSpriteGfx_Z, 0x0100, ANIM_TAG_Z},
{gBattleAnimSpriteGfx_YellowUnk2, 0x0040, ANIM_TAG_YELLOW_UNK_2},
{gBattleAnimSpriteGfx_AirSlash, 0x0180, ANIM_TAG_AIR_SLASH},
{gBattleAnimSpriteGfx_SpinningGreenOrbs, 0x0800, ANIM_TAG_SPINNING_GREEN_ORBS},
#if B_NEW_LEAF_PARTICLE
#if B_NEW_LEAF_PARTICLE
{gBattleAnimSpriteGfx_NewLeaf, 0x0480, ANIM_TAG_LEAF},
#else
#else
{gBattleAnimSpriteGfx_Leaf, 0x0480, ANIM_TAG_LEAF},
#endif
#endif
{gBattleAnimSpriteGfx_Finger, 0x0200, ANIM_TAG_FINGER},
{gBattleAnimSpriteGfx_PoisonPowder, 0x0200, ANIM_TAG_POISON_POWDER},
{gBattleAnimSpriteGfx_BrownTriangle, 0x0100, ANIM_TAG_BROWN_TRIANGLE},
@ -1156,11 +1156,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_Shock2, 0x0600, ANIM_TAG_SHOCK_2},
{gBattleAnimSpriteGfx_ClosingEye2, 0x0200, ANIM_TAG_CLOSING_EYE_2},
{gBattleAnimSpriteGfx_MetalBall, 0x0080, ANIM_TAG_METAL_BALL},
#if NEW_SUBSTITUTE_PARTICLE
#if NEW_SUBSTITUTE_PARTICLE
{gBattleAnimSpriteGfx_NewSubstituteFront, 0x0200, ANIM_TAG_MONSTER_DOLL},
#else
#else
{gBattleAnimSpriteGfx_MonsterDoll, 0x0200, ANIM_TAG_MONSTER_DOLL},
#endif
#endif
{gBattleAnimSpriteGfx_Whirlwind, 0x0800, ANIM_TAG_WHIRLWIND},
{gBattleAnimSpriteGfx_Whirlwind2, 0x0080, ANIM_TAG_WHIRLWIND_2},
{gBattleAnimSpriteGfx_Explosion4, 0x0a00, ANIM_TAG_EXPLOSION_4},
@ -1172,19 +1172,19 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_CircleImpact, 0x0020, ANIM_TAG_CIRCLE_IMPACT},
{gBattleAnimSpriteGfx_Scratch, 0x0a00, ANIM_TAG_SCRATCH},
{gBattleAnimSpriteGfx_Cut, 0x0800, ANIM_TAG_CUT},
#if B_NEW_TEETH_PARTICLE
#if B_NEW_TEETH_PARTICLE
{gBattleAnimSpriteGfx_NewTeeth, 0x0800, ANIM_TAG_SHARP_TEETH},
#else
#else
{gBattleAnimSpriteGfx_SharpTeeth, 0x0800, ANIM_TAG_SHARP_TEETH},
#endif
#endif
{gBattleAnimSpriteGfx_RainbowRings, 0x00c0, ANIM_TAG_RAINBOW_RINGS},
{gBattleAnimSpriteGfx_IceCrystals, 0x01c0, ANIM_TAG_ICE_CRYSTALS},
{gBattleAnimSpriteGfx_IceSpikes, 0x0100, ANIM_TAG_ICE_SPIKES},
#if B_NEW_HANDS_FEET_PARTICLE
#if B_NEW_HANDS_FEET_PARTICLE
{gBattleAnimSpriteGfx_NewHandsAndFeet, 0x0800, ANIM_TAG_HANDS_AND_FEET},
#else
#else
{gBattleAnimSpriteGfx_HandsAndFeet, 0x0800, ANIM_TAG_HANDS_AND_FEET},
#endif
#endif
{gBattleAnimSpriteGfx_MistCloud, 0x0200, ANIM_TAG_MIST_CLOUD},
{gBattleAnimSpriteGfx_Clamp, 0x0800, ANIM_TAG_CLAMP},
{gBattleAnimSpriteGfx_Bubble, 0x0180, ANIM_TAG_BUBBLE},
@ -1193,19 +1193,19 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_WaterOrb, 0x0200, ANIM_TAG_WATER_ORB},
{gBattleAnimSpriteGfx_PoisonBubble, 0x0180, ANIM_TAG_POISON_BUBBLE},
{gBattleAnimSpriteGfx_ToxicBubble, 0x0400, ANIM_TAG_TOXIC_BUBBLE},
#if B_NEW_SPIKES_PARTICLE
#if B_NEW_SPIKES_PARTICLE
{gBattleAnimSpriteGfx_NewSpikes, 0x0080, ANIM_TAG_SPIKES},
#else
#else
{gBattleAnimSpriteGfx_Spikes, 0x0080, ANIM_TAG_SPIKES},
#endif
#endif
{gBattleAnimSpriteGfx_HornHit2, 0x0100, ANIM_TAG_HORN_HIT_2},
{gBattleAnimSpriteGfx_AirWave2, 0x0100, ANIM_TAG_AIR_WAVE_2},
{gBattleAnimSpriteGfx_SmallBubbles, 0x0140, ANIM_TAG_SMALL_BUBBLES},
#if B_NEW_FLY_BUBBLE_PARTICLE
#if B_NEW_FLY_BUBBLE_PARTICLE
{gBattleAnimSpriteGfx_NewFly, 0x0800, ANIM_TAG_ROUND_SHADOW},
#else
#else
{gBattleAnimSpriteGfx_RoundShadow, 0x0800, ANIM_TAG_ROUND_SHADOW},
#endif
#endif
{gBattleAnimSpriteGfx_Sunlight, 0x0200, ANIM_TAG_SUNLIGHT},
{gBattleAnimSpriteGfx_Spore, 0x0100, ANIM_TAG_SPORE},
{gBattleAnimSpriteGfx_Flower, 0x00a0, ANIM_TAG_FLOWER},
@ -1236,11 +1236,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_FocusEnergy, 0x0400, ANIM_TAG_FOCUS_ENERGY},
{gBattleAnimSpriteGfx_SphereToCube, 0x0a00, ANIM_TAG_SPHERE_TO_CUBE},
{gBattleAnimSpriteGfx_Tendrils, 0x1000, ANIM_TAG_TENDRILS},
#if B_NEW_MEAN_LOOK_PARTICLE
#if B_NEW_MEAN_LOOK_PARTICLE
{gBattleAnimSpriteGfx_NewEye, 0x0800, ANIM_TAG_EYE},
#else
#else
{gBattleAnimSpriteGfx_Eye, 0x0800, ANIM_TAG_EYE},
#endif
#endif
{gBattleAnimSpriteGfx_WhiteShadow, 0x0400, ANIM_TAG_WHITE_SHADOW},
{gBattleAnimSpriteGfx_TealAlert, 0x0200, ANIM_TAG_TEAL_ALERT},
{gBattleAnimSpriteGfx_OpeningEye, 0x0800, ANIM_TAG_OPENING_EYE},
@ -1252,11 +1252,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_Spiral, 0x0800, ANIM_TAG_SPIRAL},
{gBattleAnimSpriteGfx_SnoreZ, 0x0200, ANIM_TAG_SNORE_Z},
{gBattleAnimSpriteGfx_Explosion, 0x0800, ANIM_TAG_EXPLOSION},
#if B_NEW_CURSE_NAIL_PARTICLE
#if B_NEW_CURSE_NAIL_PARTICLE
{gBattleAnimSpriteGfx_NewNail, 0x0400, ANIM_TAG_NAIL},
#else
#else
{gBattleAnimSpriteGfx_Nail, 0x0400, ANIM_TAG_NAIL},
#endif
#endif
{gBattleAnimSpriteGfx_GhostlySpirit, 0x0200, ANIM_TAG_GHOSTLY_SPIRIT},
{gBattleAnimSpriteGfx_WarmRock, 0x0a80, ANIM_TAG_WARM_ROCK},
{gBattleAnimSpriteGfx_BreakingEgg, 0x0600, ANIM_TAG_BREAKING_EGG},
@ -1283,11 +1283,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_Roots, 0x0800, ANIM_TAG_ROOTS},
{gBattleAnimSpriteGfx_ItemBag, 0x0200, ANIM_TAG_ITEM_BAG},
{gBattleAnimSpriteGfx_JaggedMusicNote, 0x0400, ANIM_TAG_JAGGED_MUSIC_NOTE},
#if B_NEW_BATON_PASS_BALL_PARTICLE
#if B_NEW_BATON_PASS_BALL_PARTICLE
{gBattleAnimSpriteGfx_NewPokeball, 0x0080, ANIM_TAG_POKEBALL},
#else
#else
{gBattleAnimSpriteGfx_Pokeball, 0x0080, ANIM_TAG_POKEBALL},
#endif
#endif
{gBattleAnimSpriteGfx_Spotlight, 0x0800, ANIM_TAG_SPOTLIGHT},
{gBattleAnimSpriteGfx_LetterZ, 0x0200, ANIM_TAG_LETTER_Z},
{gBattleAnimSpriteGfx_RapidSpin, 0x0300, ANIM_TAG_RAPID_SPIN},
@ -1302,11 +1302,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
{gBattleAnimSpriteGfx_PinkPetal, 0x0080, ANIM_TAG_PINK_PETAL},
{gBattleAnimSpriteGfx_PainSplit, 0x0180, ANIM_TAG_PAIN_SPLIT},
{gBattleAnimSpriteGfx_Confetti, 0x0180, ANIM_TAG_CONFETTI},
#if B_NEW_MORNING_SUN_STAR_PARTICLE
#if B_NEW_MORNING_SUN_STAR_PARTICLE
{gBattleAnimSpriteGfx_NewGreenStar, 0x0200, ANIM_TAG_GREEN_STAR},
#else
#else
{gBattleAnimSpriteGfx_GreenStar, 0x0200, ANIM_TAG_GREEN_STAR},
#endif
#endif
{gBattleAnimSpriteGfx_PinkCloud, 0x0200, ANIM_TAG_PINK_CLOUD},
{gBattleAnimSpriteGfx_SweatDrop, 0x0020, ANIM_TAG_SWEAT_DROP},
{gBattleAnimSpriteGfx_GuardRing, 0x0400, ANIM_TAG_GUARD_RING},
@ -1461,16 +1461,16 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_Pencil, ANIM_TAG_PENCIL},
{gBattleAnimSpritePal_AirWave, ANIM_TAG_AIR_WAVE},
{gBattleAnimSpritePal_Orb, ANIM_TAG_ORB},
#if B_NEW_SWORD_PARTICLE
#if B_NEW_SWORD_PARTICLE
{gBattleAnimSpritePal_NewSword, ANIM_TAG_SWORD},
#else
#else
{gBattleAnimSpritePal_Sword, ANIM_TAG_SWORD},
#endif
#if B_NEW_LEECH_SEED_PARTICLE
#endif
#if B_NEW_LEECH_SEED_PARTICLE
{gBattleAnimSpritePal_NewLeechSeed, ANIM_TAG_SEED},
#else
#else
{gBattleAnimSpritePal_Seed, ANIM_TAG_SEED},
#endif
#endif
{gBattleAnimSpritePal_Explosion6, ANIM_TAG_EXPLOSION_6},
{gBattleAnimSpritePal_PinkOrb, ANIM_TAG_PINK_ORB},
{gBattleAnimSpritePal_Gust, ANIM_TAG_GUST},
@ -1484,11 +1484,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_BlackSmoke, ANIM_TAG_BLACK_BALL},
{gBattleAnimSpritePal_Conversion, ANIM_TAG_CONVERSION},
{gBattleAnimSpritePal_Glass, ANIM_TAG_GLASS},
#if B_NEW_HORN_ATTACK_PARTICLE
#if B_NEW_HORN_ATTACK_PARTICLE
{gBattleAnimSpritePal_NewHornHit, ANIM_TAG_HORN_HIT},
#else
#else
{gBattleAnimSpritePal_HornHit, ANIM_TAG_HORN_HIT},
#endif
#endif
{gBattleAnimSpritePal_Hit, ANIM_TAG_HIT},
{gBattleAnimSpritePal_Hit2, ANIM_TAG_HIT_2},
{gBattleAnimSpritePal_BlueShards, ANIM_TAG_BLUE_SHARDS},
@ -1497,11 +1497,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_HitDuplicate, ANIM_TAG_HIT_DUPLICATE},
{gBattleAnimSpritePal_Leer, ANIM_TAG_LEER},
{gBattleAnimSpritePal_BlueBurst, ANIM_TAG_BLUE_BURST},
#if B_NEW_EMBER_PARTICLES
#if B_NEW_EMBER_PARTICLES
{gBattleAnimSpritePal_NewEmbers, ANIM_TAG_SMALL_EMBER},
#else
#else
{gBattleAnimSpritePal_SmallEmber, ANIM_TAG_SMALL_EMBER},
#endif
#endif
{gBattleAnimSpritePal_GraySmoke, ANIM_TAG_GRAY_SMOKE},
{gBattleAnimSpritePal_BlueStar, ANIM_TAG_BLUE_STAR},
{gBattleAnimSpritePal_BubbleBurst, ANIM_TAG_BUBBLE_BURST},
@ -1530,20 +1530,20 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_HumanoidFoot, ANIM_TAG_RED_FIST},
{gBattleAnimSpritePal_SlamHit, ANIM_TAG_SLAM_HIT},
{gBattleAnimSpritePal_Ring, ANIM_TAG_RING},
#if NEW_ROCKS_PARTICLE
#if NEW_ROCKS_PARTICLE
{gBattleAnimSpritePal_NewRocks, ANIM_TAG_ROCKS},
#else
#else
{gBattleAnimSpritePal_Rocks, ANIM_TAG_ROCKS},
#endif
#endif
{gBattleAnimSpritePal_Z, ANIM_TAG_Z},
{gBattleAnimSpritePal_YellowUnk2, ANIM_TAG_YELLOW_UNK_2},
{gBattleAnimSpritePal_AirSlash, ANIM_TAG_AIR_SLASH},
{gBattleAnimSpritePal_SpinningGreenOrbs, ANIM_TAG_SPINNING_GREEN_ORBS},
#if B_NEW_LEAF_PARTICLE
#if B_NEW_LEAF_PARTICLE
{gBattleAnimSpritePal_NewLeaf, ANIM_TAG_LEAF},
#else
#else
{gBattleAnimSpritePal_Leaf, ANIM_TAG_LEAF},
#endif
#endif
{gBattleAnimSpritePal_Finger, ANIM_TAG_FINGER},
{gBattleAnimSpritePal_PoisonPowder, ANIM_TAG_POISON_POWDER},
{gBattleAnimSpritePal_BrownTriangle, ANIM_TAG_BROWN_TRIANGLE},
@ -1607,11 +1607,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_Shock2, ANIM_TAG_SHOCK_2},
{gBattleAnimSpritePal_ClosingEye2, ANIM_TAG_CLOSING_EYE_2},
{gBattleAnimSpritePal_MetalBall, ANIM_TAG_METAL_BALL},
#if NEW_SUBSTITUTE_PARTICLE
#if NEW_SUBSTITUTE_PARTICLE
{gBattleAnimSpritePal_NewSubstituteFront, ANIM_TAG_MONSTER_DOLL},
#else
#else
{gBattleAnimSpritePal_MonsterDoll, ANIM_TAG_MONSTER_DOLL},
#endif
#endif
{gBattleAnimSpritePal_Whirlwind, ANIM_TAG_WHIRLWIND},
{gBattleAnimSpritePal_Whirlwind, ANIM_TAG_WHIRLWIND_2},
{gBattleAnimSpritePal_Explosion4, ANIM_TAG_EXPLOSION_4},
@ -1619,27 +1619,27 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_Tongue, ANIM_TAG_TONGUE},
{gBattleAnimSpritePal_Smoke, ANIM_TAG_SMOKE},
{gBattleAnimSpritePal_Smoke, ANIM_TAG_SMOKE_2},
#if B_NEW_IMPACT_PALETTE
#if B_NEW_IMPACT_PALETTE
{gBattleAnimSpritePal_NewImpact, ANIM_TAG_IMPACT},
#else
#else
{gBattleAnimSpritePal_Impact, ANIM_TAG_IMPACT},
#endif
#endif
{gBattleAnimSpritePal_CircleImpact, ANIM_TAG_CIRCLE_IMPACT},
{gBattleAnimSpritePal_Impact, ANIM_TAG_SCRATCH},
{gBattleAnimSpritePal_Impact, ANIM_TAG_CUT},
#if B_NEW_TEETH_PARTICLE
#if B_NEW_TEETH_PARTICLE
{gBattleAnimSpritePal_NewTeeth, ANIM_TAG_SHARP_TEETH},
#else
#else
{gBattleAnimSpritePal_SharpTeeth, ANIM_TAG_SHARP_TEETH},
#endif
#endif
{gBattleAnimSpritePal_RainbowRings, ANIM_TAG_RAINBOW_RINGS},
{gBattleAnimSpritePal_IceCrystals, ANIM_TAG_ICE_CRYSTALS},
{gBattleAnimSpritePal_IceCrystals, ANIM_TAG_ICE_SPIKES},
#if B_NEW_HANDS_FEET_PARTICLE
#if B_NEW_HANDS_FEET_PARTICLE
{gBattleAnimSpritePal_NewHandsAndFeet, ANIM_TAG_HANDS_AND_FEET},
#else
#else
{gBattleAnimSpritePal_HandsAndFeet, ANIM_TAG_HANDS_AND_FEET},
#endif
#endif
{gBattleAnimSpritePal_MistCloud, ANIM_TAG_MIST_CLOUD},
{gBattleAnimSpritePal_SharpTeeth, ANIM_TAG_CLAMP},
{gBattleAnimSpritePal_RainDrops, ANIM_TAG_BUBBLE},
@ -1648,19 +1648,19 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_WaterImpact, ANIM_TAG_WATER_ORB},
{gBattleAnimSpritePal_PoisonBubble, ANIM_TAG_POISON_BUBBLE},
{gBattleAnimSpritePal_PoisonBubble, ANIM_TAG_TOXIC_BUBBLE},
#if B_NEW_SPIKES_PARTICLE
#if B_NEW_SPIKES_PARTICLE
{gBattleAnimSpritePal_NewSpikes, ANIM_TAG_SPIKES},
#else
#else
{gBattleAnimSpritePal_Spikes, ANIM_TAG_SPIKES},
#endif
#endif
{gBattleAnimSpritePal_HornHit2, ANIM_TAG_HORN_HIT_2},
{gBattleAnimSpritePal_AirWave2, ANIM_TAG_AIR_WAVE_2},
{gBattleAnimSpritePal_SmallBubbles, ANIM_TAG_SMALL_BUBBLES},
#if B_NEW_FLY_BUBBLE_PARTICLE
#if B_NEW_FLY_BUBBLE_PARTICLE
{gBattleAnimSpritePal_NewFly, ANIM_TAG_ROUND_SHADOW},
#else
#else
{gBattleAnimSpritePal_RoundShadow, ANIM_TAG_ROUND_SHADOW},
#endif
#endif
{gBattleAnimSpritePal_Sunlight, ANIM_TAG_SUNLIGHT},
{gBattleAnimSpritePal_Spore, ANIM_TAG_SPORE},
{gBattleAnimSpritePal_Flower, ANIM_TAG_FLOWER},
@ -1691,11 +1691,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_FocusEnergy, ANIM_TAG_FOCUS_ENERGY},
{gBattleAnimSpritePal_SphereToCube, ANIM_TAG_SPHERE_TO_CUBE},
{gBattleAnimSpritePal_Tendrils, ANIM_TAG_TENDRILS},
#if B_NEW_MEAN_LOOK_PARTICLE
#if B_NEW_MEAN_LOOK_PARTICLE
{gBattleAnimSpritePal_NewEye, ANIM_TAG_EYE},
#else
#else
{gBattleAnimSpritePal_Eye, ANIM_TAG_EYE},
#endif
#endif
{gBattleAnimSpritePal_WhiteShadow, ANIM_TAG_WHITE_SHADOW},
{gBattleAnimSpritePal_TealAlert, ANIM_TAG_TEAL_ALERT},
{gBattleAnimSpritePal_OpeningEye, ANIM_TAG_OPENING_EYE},
@ -1734,11 +1734,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_Roots, ANIM_TAG_ROOTS},
{gBattleAnimSpritePal_ItemBag, ANIM_TAG_ITEM_BAG},
{gBattleAnimSpritePal_JaggedMusicNote, ANIM_TAG_JAGGED_MUSIC_NOTE},
#if B_NEW_BATON_PASS_BALL_PARTICLE
#if B_NEW_BATON_PASS_BALL_PARTICLE
{gBattleAnimSpritePal_NewPokeball, ANIM_TAG_POKEBALL},
#else
#else
{gBattleAnimSpritePal_Pokeball, ANIM_TAG_POKEBALL},
#endif
#endif
{gBattleAnimSpritePal_Pokeball, ANIM_TAG_SPOTLIGHT},
{gBattleAnimSpritePal_LetterZ, ANIM_TAG_LETTER_Z},
{gBattleAnimSpritePal_RapidSpin, ANIM_TAG_RAPID_SPIN},
@ -1753,11 +1753,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
{gBattleAnimSpritePal_PinkPetal, ANIM_TAG_PINK_PETAL},
{gBattleAnimSpritePal_PainSplit, ANIM_TAG_PAIN_SPLIT},
{gBattleAnimSpritePal_Confetti, ANIM_TAG_CONFETTI},
#if B_NEW_MORNING_SUN_STAR_PARTICLE
#if B_NEW_MORNING_SUN_STAR_PARTICLE
{gBattleAnimSpritePal_NewGreenStar, ANIM_TAG_GREEN_STAR},
#else
#else
{gBattleAnimSpritePal_GreenStar, ANIM_TAG_GREEN_STAR},
#endif
#endif
{gBattleAnimSpritePal_PinkCloud, ANIM_TAG_PINK_CLOUD},
{gBattleAnimSpritePal_SweatDrop, ANIM_TAG_SWEAT_DROP},
{gBattleAnimSpritePal_GuardRing, ANIM_TAG_GUARD_RING},

View File

@ -7794,7 +7794,7 @@ const struct Item gItems[] =
.flingPower = 10,
},
// TMs/HMs
// TMs/HMs. They don't have a set flingPower, as that's handled by GetFlingPowerFromItemId.
[ITEM_TM01_FOCUS_PUNCH] =
{
@ -7805,7 +7805,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 150,
},
[ITEM_TM02_DRAGON_CLAW] =
@ -7817,7 +7816,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 80,
},
[ITEM_TM03_WATER_PULSE] =
@ -7829,7 +7827,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 60,
},
[ITEM_TM04_CALM_MIND] =
@ -7841,7 +7838,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM05_ROAR] =
@ -7853,7 +7849,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM06_TOXIC] =
@ -7865,7 +7860,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM07_HAIL] =
@ -7877,7 +7871,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM08_BULK_UP] =
@ -7889,7 +7882,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM09_BULLET_SEED] =
@ -7901,11 +7893,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_5
.flingPower = 25,
#else
.flingPower = 10,
#endif
},
[ITEM_TM10_HIDDEN_POWER] =
@ -7917,11 +7904,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 60,
#else
.flingPower = 10,
#endif
},
[ITEM_TM11_SUNNY_DAY] =
@ -7933,7 +7915,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM12_TAUNT] =
@ -7945,7 +7926,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM13_ICE_BEAM] =
@ -7957,11 +7937,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 90,
#else
.flingPower = 95,
#endif
},
[ITEM_TM14_BLIZZARD] =
@ -7973,11 +7948,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 110,
#else
.flingPower = 120,
#endif
},
[ITEM_TM15_HYPER_BEAM] =
@ -7989,7 +7959,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 150,
},
[ITEM_TM16_LIGHT_SCREEN] =
@ -8001,7 +7970,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM17_PROTECT] =
@ -8013,7 +7981,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM18_RAIN_DANCE] =
@ -8025,7 +7992,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM19_GIGA_DRAIN] =
@ -8037,11 +8003,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_5
.flingPower = 75,
#else
.flingPower = 60,
#endif
},
[ITEM_TM20_SAFEGUARD] =
@ -8053,7 +8014,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM21_FRUSTRATION] =
@ -8065,7 +8025,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM22_SOLAR_BEAM] =
@ -8077,7 +8036,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 120,
},
[ITEM_TM23_IRON_TAIL] =
@ -8089,7 +8047,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 100,
},
[ITEM_TM24_THUNDERBOLT] =
@ -8101,11 +8058,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 90,
#else
.flingPower = 95,
#endif
},
[ITEM_TM25_THUNDER] =
@ -8117,11 +8069,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 110,
#else
.flingPower = 120,
#endif
},
[ITEM_TM26_EARTHQUAKE] =
@ -8133,7 +8080,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 100,
},
[ITEM_TM27_RETURN] =
@ -8145,7 +8091,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM28_DIG] =
@ -8157,11 +8102,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_4
.flingPower = 80,
#else
.flingPower = 60,
#endif
},
[ITEM_TM29_PSYCHIC] =
@ -8173,7 +8113,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 90,
},
[ITEM_TM30_SHADOW_BALL] =
@ -8185,7 +8124,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 80,
},
[ITEM_TM31_BRICK_BREAK] =
@ -8197,7 +8135,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 75,
},
[ITEM_TM32_DOUBLE_TEAM] =
@ -8209,7 +8146,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM33_REFLECT] =
@ -8221,7 +8157,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM34_SHOCK_WAVE] =
@ -8233,7 +8168,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 60,
},
[ITEM_TM35_FLAMETHROWER] =
@ -8245,11 +8179,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 90,
#else
.flingPower = 95,
#endif
},
[ITEM_TM36_SLUDGE_BOMB] =
@ -8261,7 +8190,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 90,
},
[ITEM_TM37_SANDSTORM] =
@ -8273,7 +8201,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM38_FIRE_BLAST] =
@ -8285,11 +8212,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 110,
#else
.flingPower = 120,
#endif
},
[ITEM_TM39_ROCK_TOMB] =
@ -8301,11 +8223,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 60,
#else
.flingPower = 50,
#endif
},
[ITEM_TM40_AERIAL_ACE] =
@ -8317,7 +8234,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 60,
},
[ITEM_TM41_TORMENT] =
@ -8329,7 +8245,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM42_FACADE] =
@ -8341,7 +8256,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM43_SECRET_POWER] =
@ -8353,7 +8267,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 70,
},
[ITEM_TM44_REST] =
@ -8365,7 +8278,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM45_ATTRACT] =
@ -8377,7 +8289,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM46_THIEF] =
@ -8389,11 +8300,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 60,
#else
.flingPower = 40,
#endif
},
[ITEM_TM47_STEEL_WING] =
@ -8405,7 +8311,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 70,
},
[ITEM_TM48_SKILL_SWAP] =
@ -8417,7 +8322,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM49_SNATCH] =
@ -8429,7 +8333,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_TM50_OVERHEAT] =
@ -8441,11 +8344,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 130,
#else
.flingPower = 140,
#endif
},
[ITEM_TM51] =
@ -9008,7 +8906,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 50,
},
[ITEM_HM02_FLY] =
@ -9021,11 +8918,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_4
.flingPower = 90,
#else
.flingPower = 70,
#endif
},
[ITEM_HM03_SURF] =
@ -9038,11 +8930,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_6
.flingPower = 90,
#else
.flingPower = 95,
#endif
},
[ITEM_HM04_STRENGTH] =
@ -9055,7 +8942,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 80,
},
[ITEM_HM05_FLASH] =
@ -9068,7 +8954,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 10,
},
[ITEM_HM06_ROCK_SMASH] =
@ -9081,11 +8966,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
#if B_UPDATED_MOVE_DATA >= GEN_4
.flingPower = 20,
#else
.flingPower = 40,
#endif
},
[ITEM_HM07_WATERFALL] =
@ -9098,7 +8978,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_TMHM,
.flingPower = 80,
},
[ITEM_HM08_DIVE] =
@ -9111,11 +8990,6 @@ const struct Item gItems[] =
.pocket = POCKET_TM_HM,
.type = ITEM_USE_PARTY_MENU,
.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[] = _(
"");
@ -79,11 +86,7 @@ static const u8 sFlyDescription[] = _(
static const u8 sBindDescription[] = _(
"Binds and squeezes the foe\n"
#if B_BINDING_TURNS >= GEN_5
"for 4 or 5 turns.");
#else
"for 2 to 5 turns.");
#endif
"for "BINDING_TURNS" turns.");
static const u8 sSlamDescription[] = _(
"Slams the foe with a long\n"
@ -143,11 +146,7 @@ static const u8 sBodySlamDescription[] = _(
static const u8 sWrapDescription[] = _(
"Wraps and squeezes the foe\n"
#if B_BINDING_TURNS >= GEN_5
"4 or 5 times with vines, etc.");
#else
"2 to 5 times with vines, etc.");
#endif
BINDING_TURNS" times with vines, etc.");
static const u8 sTakeDownDescription[] = _(
"A reckless charge attack\n"
@ -339,11 +338,7 @@ static const u8 sDragonRageDescription[] = _(
static const u8 sFireSpinDescription[] = _(
"Traps the foe in a ring of\n"
#if B_BINDING_TURNS >= GEN_5
"fire for 4 or 5 turns.");
#else
"fire for 2 to 5 turns.");
#endif
"fire for "BINDING_TURNS" turns.");
static const u8 sThunderShockDescription[] = _(
"An electrical attack that\n"
@ -523,11 +518,7 @@ static const u8 sWaterfallDescription[] = _(
static const u8 sClampDescription[] = _(
"Traps and squeezes the\n"
#if B_BINDING_TURNS >= GEN_5
"foe for 4 or 5 turns.");
#else
"foe for 2 to 5 turns.");
#endif
"foe for "BINDING_TURNS" turns.");
static const u8 sSwiftDescription[] = _(
"Sprays star-shaped rays\n"
@ -1015,11 +1006,7 @@ static const u8 sRockSmashDescription[] = _(
static const u8 sWhirlpoolDescription[] = _(
"Traps and hurts the foe in\n"
#if B_BINDING_TURNS >= GEN_5
"a whirlpool for 4 or 5 turns.");
#else
"a whirlpool for 2 to 5 turns.");
#endif
"a whirlpool for "BINDING_TURNS" turns.");
static const u8 sBeatUpDescription[] = _(
"Summons party Pokémon to\n"
@ -1030,7 +1017,11 @@ static const u8 sFakeOutDescription[] = _(
"that causes flinching.");
static const u8 sUproarDescription[] = _(
#if B_UPROAR_TURNS >= GEN_5
"Causes an uproar for 2 to 5\n"
#else
"Causes an uproar for 3\n"
#endif
"turns and prevents sleep.");
static const u8 sStockpileDescription[] = _(
@ -1331,11 +1322,7 @@ static const u8 sSkyUppercutDescription[] = _(
static const u8 sSandTombDescription[] = _(
"Traps and hurts the foe in\n"
#if B_BINDING_TURNS >= GEN_5
"quicksand for 4 or 5 turns.");
#else
"quicksand for 2 to 5 turns.");
#endif
"quicksand for "BINDING_TURNS" turns.");
static const u8 sSheerColdDescription[] = _(
"A chilling attack that\n"
@ -1839,11 +1826,7 @@ static const u8 sSpacialRendDescription[] = _(
static const u8 sMagmaStormDescription[] = _(
"Traps the foe in a vortex\n"
#if B_BINDING_TURNS >= GEN_5
"of fire for 4 or 5 turns.");
#else
"of fire for 2 to 5 turns.");
#endif
"of fire for "BINDING_TURNS" turns.");
static const u8 sDarkVoidDescription[] = _(
"Drags the foe into total\n"
@ -2395,11 +2378,7 @@ static const u8 sNuzzleDescription[] = _(
static const u8 sInfestationDescription[] = _(
"The foe is infested and\n"
#if B_BINDING_TURNS >= GEN_5
"attacked for 4 or 5 turns.");
#else
"attacked for 2 to 5 turns.");
#endif
"attacked for "BINDING_TURNS" turns.");
static const u8 sPowerUpPunchDescription[] = _(
"A hard punch that raises\n"
@ -2944,11 +2923,7 @@ static const u8 sSurgingStrikesDescription[] = _(
static const u8 sThunderCageDescription[] = _(
"Traps the foe in a cage of\n"
#if B_BINDING_TURNS >= GEN_5
"electricity for 4 or 5 turns.");
#else
"electricity for 2 to 5 turns.");
#endif
"electricity for "BINDING_TURNS" turns.");
static const u8 sDragonEnergyDescription[] = _(
"The higher the user's HP\n"
@ -2981,6 +2956,8 @@ static const u8 sEerieSpellDescription[] = _(
static const u8 sNotDoneYetDescription[] = _(
"Not done yet.");
#undef BINDING_TURNS
// 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] =
{

View File

@ -819,12 +819,12 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent
eggSpecies = SPECIES_NIDORAN_M;
else if (eggSpecies == SPECIES_ILLUMISE && daycare->offspringPersonality & EGG_GENDER_MALE)
eggSpecies = SPECIES_VOLBEAT;
#if P_NIDORAN_M_DITTO_BREED >= GEN_5
else if (eggSpecies == SPECIES_NIDORAN_M && !(daycare->offspringPersonality & EGG_GENDER_MALE))
eggSpecies = SPECIES_NIDORAN_F;
else if (eggSpecies == SPECIES_VOLBEAT && !(daycare->offspringPersonality & EGG_GENDER_MALE))
eggSpecies = SPECIES_ILLUMISE;
#endif
#if P_NIDORAN_M_DITTO_BREED >= GEN_5
else if (eggSpecies == SPECIES_NIDORAN_M && !(daycare->offspringPersonality & EGG_GENDER_MALE))
eggSpecies = SPECIES_NIDORAN_F;
else if (eggSpecies == SPECIES_VOLBEAT && !(daycare->offspringPersonality & EGG_GENDER_MALE))
eggSpecies = SPECIES_ILLUMISE;
#endif
else if (eggSpecies == SPECIES_MANAPHY)
eggSpecies = SPECIES_PHIONE;
else if (eggSpecies == SPECIES_SINISTEA_ANTIQUE)

View File

@ -551,7 +551,10 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon)
u32 data = 0;
u16 ball = ITEM_POKE_BALL;
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;
struct Pokemon *shedinja = &gPlayerParty[gPlayerPartyCount];
@ -563,10 +566,10 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon *mon)
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_MARKINGS, &data);
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_ENCRYPT_SEPARATOR, &data);
#if P_SHEDINJA_BALL >= GEN_4
#if P_SHEDINJA_BALL >= GEN_4
SetMonData(&gPlayerParty[gPlayerPartyCount], MON_DATA_POKEBALL, &ball);
RemoveBagItem(ball, 1);
#endif
#endif
for (i = MON_DATA_COOL_RIBBON; i < MON_DATA_COOL_RIBBON + CONTEST_CATEGORIES_COUNT; i++)
SetMonData(&gPlayerParty[gPlayerPartyCount], i, &data);

View File

@ -1000,14 +1000,14 @@ void ItemUseInBattle_PokeBall(u8 taskId)
else
DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage);
break;
#if B_SEMI_INVULNERABLE_CATCH >= GEN_4
#if B_SEMI_INVULNERABLE_CATCH >= GEN_4
case BALL_THROW_UNABLE_SEMI_INVULNERABLE:
if (!InBattlePyramid())
DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_SemiInvulnerable, CloseItemMessage);
else
DisplayItemMessageInBattlePyramid(taskId, sText_CantThrowPokeBall_SemiInvulnerable, Task_CloseBattlePyramidBagMessage);
break;
#endif
#endif
}
}

View File

@ -409,9 +409,9 @@ static void Overworld_ResetStateAfterWhiteOut(void)
FlagClear(FLAG_SYS_SAFARI_MODE);
FlagClear(FLAG_SYS_USE_STRENGTH);
FlagClear(FLAG_SYS_USE_FLASH);
#if VAR_TERRAIN != 0
VarSet(VAR_TERRAIN, 0);
#endif
#if VAR_TERRAIN != 0
VarSet(VAR_TERRAIN, 0);
#endif
// If you were defeated by Kyogre/Groudon and the step counter has
// maxed out, end the abnormal weather.
if (VarGet(VAR_SHOULD_END_ABNORMAL_WEATHER) == 1)

View File

@ -3334,49 +3334,49 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
iv = (value & (MAX_IV_MASK << 10)) >> 10;
SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv);
#if P_LEGENDARY_PERFECT_IVS >= GEN_6
if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST))
#if P_LEGENDARY_PERFECT_IVS >= GEN_6
if (gBaseStats[species].flags & (FLAG_LEGENDARY | FLAG_MYTHICAL | FLAG_ULTRA_BEAST))
{
iv = MAX_PER_STAT_IVS;
// Initialize a list of IV indices.
for (i = 0; i < NUM_STATS; i++)
{
iv = MAX_PER_STAT_IVS;
// Initialize a list of IV indices.
for (i = 0; i < NUM_STATS; i++)
{
availableIVs[i] = i;
}
availableIVs[i] = i;
}
// Select the 3 IVs that will be perfected.
for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++)
// Select the 3 IVs that will be perfected.
for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++)
{
u8 index = Random() % (NUM_STATS - i);
selectedIvs[i] = availableIVs[index];
RemoveIVIndexFromList(availableIVs, index);
}
for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++)
{
switch (selectedIvs[i])
{
u8 index = Random() % (NUM_STATS - i);
selectedIvs[i] = availableIVs[index];
RemoveIVIndexFromList(availableIVs, index);
}
for (i = 0; i < LEGENDARY_PERFECT_IV_COUNT; i++)
{
switch (selectedIvs[i])
{
case STAT_HP:
SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv);
break;
case STAT_ATK:
SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv);
break;
case STAT_DEF:
SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv);
break;
case STAT_SPEED:
SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv);
break;
case STAT_SPATK:
SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv);
break;
case STAT_SPDEF:
SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv);
break;
}
case STAT_HP:
SetBoxMonData(boxMon, MON_DATA_HP_IV, &iv);
break;
case STAT_ATK:
SetBoxMonData(boxMon, MON_DATA_ATK_IV, &iv);
break;
case STAT_DEF:
SetBoxMonData(boxMon, MON_DATA_DEF_IV, &iv);
break;
case STAT_SPEED:
SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &iv);
break;
case STAT_SPATK:
SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &iv);
break;
case STAT_SPDEF:
SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &iv);
break;
}
}
#endif
}
#endif
}
@ -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
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)
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_ATK] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_ATK] += 1;
gBattleMons[gActiveBattler].statStages[STAT_ATK] += X_ITEM_STAGES;
if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_ATK] = MAX_STAT_STAGE;
retVal = FALSE;
@ -5589,10 +5592,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_DEFENSE)
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_DEF] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_DEF] += 1;
gBattleMons[gActiveBattler].statStages[STAT_DEF] += X_ITEM_STAGES;
if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_DEF] = MAX_STAT_STAGE;
retVal = FALSE;
@ -5602,10 +5602,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_SPEED)
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += 1;
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += X_ITEM_STAGES;
if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_SPEED] = MAX_STAT_STAGE;
retVal = FALSE;
@ -5615,10 +5612,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_SPATK)
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += 1;
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += X_ITEM_STAGES;
if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_SPATK] = MAX_STAT_STAGE;
retVal = FALSE;
@ -5628,10 +5622,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_SPDEF)
&& gBattleMons[gActiveBattler].statStages[STAT_SPDEF] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += 1;
gBattleMons[gActiveBattler].statStages[STAT_SPDEF] += X_ITEM_STAGES;
if (gBattleMons[gActiveBattler].statStages[STAT_SPDEF] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_SPDEF] = MAX_STAT_STAGE;
retVal = FALSE;
@ -5641,10 +5632,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if ((itemEffect[i] & ITEM1_X_ACCURACY)
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE)
{
if (B_X_ITEMS_BUFF >= GEN_7)
gBattleMons[gActiveBattler].statStages[STAT_ACC] += 2;
else
gBattleMons[gActiveBattler].statStages[STAT_ACC] += 1;
gBattleMons[gActiveBattler].statStages[STAT_ACC] += X_ITEM_STAGES;
if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > MAX_STAT_STAGE)
gBattleMons[gActiveBattler].statStages[STAT_ACC] = MAX_STAT_STAGE;
retVal = FALSE;
@ -6204,15 +6192,12 @@ static void BufferStatRoseMessage(s32 statIdx)
{
gBattlerTarget = gBattlerInMenuId;
StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[statIdx]]);
if (B_X_ITEMS_BUFF >= GEN_7)
{
StringCopy(gBattleTextBuff2, gText_StatSharply);
StringAppend(gBattleTextBuff2, gText_StatRose);
}
else
{
StringCopy(gBattleTextBuff2, gText_StatRose);
}
#if B_X_ITEMS_BUFF >= GEN_7
StringCopy(gBattleTextBuff2, gText_StatSharply);
StringAppend(gBattleTextBuff2, gText_StatRose);
#else
StringCopy(gBattleTextBuff2, gText_StatRose);
#endif
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
if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE
&& 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;
switch (mode)

View File

@ -3735,8 +3735,9 @@ static void PrintMoveDetails(u16 move)
{
if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES)
{
if (B_SHOW_SPLIT_ICON == TRUE)
ShowSplitIcon(GetBattleMoveSplit(move));
#if B_SHOW_SPLIT_ICON == TRUE
ShowSplitIcon(GetBattleMoveSplit(move));
#endif
PrintMovePowerAndAccuracy(move);
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
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG)
&& 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;
}
@ -1003,11 +1006,13 @@ bool8 TryDoDoubleWildBattle(void)
{
if (GetSafariZoneFlag() || GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS)
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;
#if B_DOUBLE_WILD_CHANCE != 0
#endif
#if B_DOUBLE_WILD_CHANCE != 0
else if ((Random() % 100) + 1 < B_DOUBLE_WILD_CHANCE)
return TRUE;
#endif
#endif
return FALSE;
}