Converted most battle preproc ifs to regular ifs
This commit is contained in:
parent
410dc1d6c0
commit
d1c672d3ce
24 changed files with 720 additions and 1077 deletions
|
@ -33,14 +33,14 @@
|
|||
#define ABILITYEFFECT_TRACE2 10
|
||||
#define ABILITYEFFECT_MOVE_END_OTHER 11
|
||||
#define ABILITYEFFECT_NEUTRALIZINGGAS 12
|
||||
#define ABILITYEFFECT_FIELD_SPORT 13 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_FIELD_SPORT 13 // Only used if B_SPORT_TURNS >= GEN_6
|
||||
#define ABILITYEFFECT_ON_WEATHER 14
|
||||
#define ABILITYEFFECT_ON_TERRAIN 15
|
||||
#define ABILITYEFFECT_SWITCH_IN_TERRAIN 16
|
||||
#define ABILITYEFFECT_SWITCH_IN_WEATHER 17
|
||||
// Special cases
|
||||
#define ABILITYEFFECT_MUD_SPORT 252 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_WATER_SPORT 253 // Only used if B_SPORT_TURNS < GEN_6
|
||||
#define ABILITYEFFECT_MUD_SPORT 252 // Only used if B_SPORT_TURNS >= GEN_6
|
||||
#define ABILITYEFFECT_WATER_SPORT 253 // Only used if B_SPORT_TURNS >= GEN_6
|
||||
|
||||
// For the first argument of ItemBattleEffects, to deteremine which block of item effects to try
|
||||
#define ITEMEFFECT_ON_SWITCH_IN 0
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#define B_RECALCULATE_STATS GEN_LATEST // In Gen5+, the stats of the Pokémon who participate in battle are recalculated at the end of each battle.
|
||||
|
||||
// Damage settings
|
||||
#define B_BURN_DAMAGE GEN_LATEST // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th.
|
||||
#define B_BURN_DAMAGE GEN_LATEST // In Gen7+, burn damage is 1/16th of max HP instead of 1/8th. Also applies to Frostbite.
|
||||
#define B_BURN_FACADE_DMG GEN_LATEST // In Gen6+, burn's effect of lowering the Attack stat no longer applies to Facade.
|
||||
#define B_BINDING_DAMAGE GEN_LATEST // In Gen6+, binding damage is 1/8 of max HP instead of 1/16. (With Binding Band, 1/6 and 1/8 respectively.)
|
||||
#define B_PSYWAVE_DMG GEN_LATEST // Psywave's damage formula. See Cmd_psywavedamageeffect.
|
||||
|
@ -128,14 +128,14 @@
|
|||
#define B_SNOW_WARNING GEN_LATEST // In Gen9+, Snow Warning will summon snow instead of hail.
|
||||
|
||||
// Item settings
|
||||
#define B_HP_BERRIES GEN_LATEST // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.
|
||||
#define B_HP_BERRIES GEN_LATEST // 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_LATEST // 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_LATEST // Before Gen7, Figy and similar berries restore 1/8th of HP and trigger at half HP. In Gen7 they restore half HP, triggering at 25% HP. In Gen8 they heal 1/3rd of HP.
|
||||
#define B_X_ITEMS_BUFF GEN_LATEST // In Gen7+, the X Items raise a stat by 2 stages instead of 1.
|
||||
#define B_MENTAL_HERB GEN_LATEST // 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_RESTORE_HELD_BATTLE_ITEMS TRUE // In Gen9 all non berry items are restored after battle.
|
||||
#define B_SOUL_DEW_BOOST GEN_LATEST // In Gens3-6, Soul Dew boosts Lati@s' Sp. Atk and Sp. Def. In Gen7+ it boosts the power of their Psychic and Dragon type moves instead.
|
||||
#define B_SOUL_DEW_BOOST GEN_LATEST // In Gens3-6, Soul Dew boosts Latis' 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_LATEST // In Gen7+, Net Ball's catch multiplier is x5 instead of x3.
|
||||
#define B_DIVE_BALL_MODIFIER GEN_LATEST // In Gen4+, Dive Ball's effectiveness increases by when Surfing or Fishing.
|
||||
#define B_NEST_BALL_MODIFIER GEN_LATEST // Nest Ball's formula varies depending on the Gen. See Cmd_handleballthrow.
|
||||
|
|
|
@ -938,11 +938,10 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
} // ignore def ability check
|
||||
|
||||
// gen7+ dark type mons immune to priority->elevated moves from prankster
|
||||
#if B_PRANKSTER_DARK_TYPES >= GEN_7
|
||||
if (aiData->abilities[battlerAtk] == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) && IS_MOVE_STATUS(move)
|
||||
if (B_PRANKSTER_DARK_TYPES >= GEN_7 && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK)
|
||||
&& aiData->abilities[battlerAtk] == ABILITY_PRANKSTER && IS_MOVE_STATUS(move)
|
||||
&& !(moveTarget & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_USER)))
|
||||
RETURN_SCORE_MINUS(10);
|
||||
#endif
|
||||
|
||||
// terrain & effect checks
|
||||
if (AI_IsTerrainAffected(battlerDef, STATUS_FIELD_ELECTRIC_TERRAIN))
|
||||
|
@ -1126,10 +1125,9 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
ADJUST_SCORE(-20);
|
||||
else if (!HasMoveWithType(battlerAtk, TYPE_ELECTRIC))
|
||||
ADJUST_SCORE(-10);
|
||||
#if B_CHARGE_SPDEF_RAISE >= GEN_5
|
||||
else if (!BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF))
|
||||
else if (B_CHARGE_SPDEF_RAISE >= GEN_5
|
||||
&& !BattlerStatCanRise(battlerAtk, aiData->abilities[battlerAtk], STAT_SPDEF))
|
||||
ADJUST_SCORE(-5);
|
||||
#endif
|
||||
break;
|
||||
case EFFECT_QUIVER_DANCE:
|
||||
case EFFECT_GEOMANCY:
|
||||
|
@ -1416,10 +1414,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
ADJUST_SCORE(-10);
|
||||
break;
|
||||
case EFFECT_OHKO:
|
||||
#if B_SHEER_COLD_IMMUNITY >= GEN_7
|
||||
if (move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE))
|
||||
if (B_SHEER_COLD_IMMUNITY >= GEN_7 && move == MOVE_SHEER_COLD && IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE))
|
||||
return 0;
|
||||
#endif
|
||||
if (!ShouldTryOHKO(battlerAtk, battlerDef, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], move))
|
||||
ADJUST_SCORE(-10);
|
||||
break;
|
||||
|
@ -1447,10 +1443,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
ADJUST_SCORE(-8);
|
||||
else if (aiData->hpPercents[battlerAtk] <= 25)
|
||||
ADJUST_SCORE(-10);
|
||||
#if B_SOUND_SUBSTITUTE >= GEN_6
|
||||
else if (HasSoundMove(battlerDef))
|
||||
else if (B_SOUND_SUBSTITUTE >= GEN_6 && HasSoundMove(battlerDef))
|
||||
ADJUST_SCORE(-8);
|
||||
#endif
|
||||
break;
|
||||
case EFFECT_LEECH_SEED:
|
||||
if (gStatuses3[battlerDef] & STATUS3_LEECHSEED
|
||||
|
@ -1462,9 +1456,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
break;
|
||||
case EFFECT_DISABLE:
|
||||
if (gDisableStructs[battlerDef].disableTimer == 0
|
||||
#if B_MENTAL_HERB >= GEN_5
|
||||
&& aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB
|
||||
#endif
|
||||
&& (B_MENTAL_HERB < GEN_5 || aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)
|
||||
&& !PartnerHasSameMoveEffectWithoutTarget(BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove))
|
||||
{
|
||||
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first
|
||||
|
@ -1484,9 +1476,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
break;
|
||||
case EFFECT_ENCORE:
|
||||
if (gDisableStructs[battlerDef].encoreTimer == 0
|
||||
#if B_MENTAL_HERB >= GEN_5
|
||||
&& aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB
|
||||
#endif
|
||||
&& (B_MENTAL_HERB < GEN_5 || aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB)
|
||||
&& !DoesPartnerHaveSameMoveEffect(BATTLE_PARTNER(battlerAtk), battlerDef, move, aiData->partnerMove))
|
||||
{
|
||||
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // Attacker should go first
|
||||
|
@ -1715,10 +1705,8 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
|
|||
ADJUST_SCORE(-10);
|
||||
break;
|
||||
}
|
||||
#if B_MENTAL_HERB >= GEN_5
|
||||
if (aiData->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB)
|
||||
if (B_MENTAL_HERB >= GEN_5 && aiData->holdEffects[battlerDef] == HOLD_EFFECT_MENTAL_HERB)
|
||||
ADJUST_SCORE(-6);
|
||||
#endif
|
||||
break;
|
||||
case EFFECT_WILL_O_WISP:
|
||||
if (!AI_CanBurn(battlerAtk, battlerDef, aiData->abilities[battlerDef], BATTLE_PARTNER(battlerAtk), move, aiData->partnerMove))
|
||||
|
@ -3829,10 +3817,7 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
|
|||
break;
|
||||
case EFFECT_DISABLE:
|
||||
if (gDisableStructs[battlerDef].disableTimer == 0
|
||||
#if B_MENTAL_HERB >= GEN_5
|
||||
&& aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb
|
||||
#endif
|
||||
)
|
||||
&& (B_MENTAL_HERB < GEN_5 || aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB))
|
||||
{
|
||||
if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER) // AI goes first
|
||||
{
|
||||
|
@ -3853,10 +3838,7 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
|
|||
break;
|
||||
case EFFECT_ENCORE:
|
||||
if (gDisableStructs[battlerDef].encoreTimer == 0
|
||||
#if B_MENTAL_HERB >= GEN_5
|
||||
&& aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB // mental herb
|
||||
#endif
|
||||
)
|
||||
&& (B_MENTAL_HERB < GEN_5 || aiData->holdEffects[battlerDef] != HOLD_EFFECT_MENTAL_HERB))
|
||||
{
|
||||
if (IsEncoreEncouragedEffect(gBattleMoves[gLastMoves[battlerDef]].effect))
|
||||
ADJUST_SCORE(3);
|
||||
|
@ -3905,9 +3887,8 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
|
|||
{
|
||||
bool32 canSteal = FALSE;
|
||||
|
||||
#if 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)
|
||||
canSteal = TRUE;
|
||||
|
||||
|
@ -4363,9 +4344,8 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
|
|||
case EFFECT_CHARGE:
|
||||
if (HasDamagingMoveOfType(battlerAtk, TYPE_ELECTRIC))
|
||||
ADJUST_SCORE(2);
|
||||
#if B_CHARGE_SPDEF_RAISE >= GEN_5
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPDEF, &score);
|
||||
#endif
|
||||
if (B_CHARGE_SPDEF_RAISE >= GEN_5)
|
||||
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPDEF, &score);
|
||||
break;
|
||||
case EFFECT_TAUNT:
|
||||
if (IS_MOVE_STATUS(predictedMove))
|
||||
|
|
|
@ -651,10 +651,8 @@ bool32 IsBattlerTrapped(u32 battler, bool32 checkSwitch)
|
|||
{
|
||||
u32 holdEffect = AI_DATA->holdEffects[battler];
|
||||
|
||||
#if B_GHOSTS_ESCAPE >= GEN_6
|
||||
if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|
||||
if (B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|
||||
return FALSE;
|
||||
#endif
|
||||
if (checkSwitch && holdEffect == HOLD_EFFECT_SHED_SHELL)
|
||||
return FALSE;
|
||||
else if (!checkSwitch && GetBattlerAbility(battler) == ABILITY_RUN_AWAY)
|
||||
|
@ -702,9 +700,7 @@ bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler)
|
|||
bool32 IsAffectedByPowder(u32 battler, u32 ability, u32 holdEffect)
|
||||
{
|
||||
if (ability == ABILITY_OVERCOAT
|
||||
#if B_POWDER_GRASS >= GEN_6
|
||||
|| IS_BATTLER_OF_TYPE(battler, TYPE_GRASS)
|
||||
#endif
|
||||
|| (B_POWDER_GRASS >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GRASS))
|
||||
|| holdEffect == HOLD_EFFECT_SAFETY_GOGGLES)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
|
@ -846,8 +842,8 @@ s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectivenes
|
|||
case EFFECT_FINAL_GAMBIT:
|
||||
dmg = gBattleMons[battlerAtk].hp;
|
||||
break;
|
||||
#if B_BEAT_UP >= GEN_5
|
||||
case EFFECT_BEAT_UP:
|
||||
if (B_BEAT_UP >= GEN_5)
|
||||
{
|
||||
u32 partyCount = CalculatePartyCount(GetBattlerParty(battlerAtk));
|
||||
u32 i;
|
||||
|
@ -859,7 +855,6 @@ s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectivenes
|
|||
gBattleStruct->beatUpSlot = 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Handle other multi-strike moves
|
||||
|
@ -1672,10 +1667,8 @@ bool32 IsMoveEncouragedToHit(u32 battlerAtk, u32 battlerDef, u32 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
|
||||
if (gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON))
|
||||
if (B_TOXIC_NEVER_MISS >= GEN_6 && gBattleMoves[move].effect == EFFECT_TOXIC && IS_BATTLER_OF_TYPE(battlerAtk, TYPE_POISON))
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
// discouraged from hitting
|
||||
weather = AI_GetWeather(AI_DATA);
|
||||
|
@ -1687,9 +1680,7 @@ bool32 IsMoveEncouragedToHit(u32 battlerAtk, u32 battlerDef, u32 move)
|
|||
if ((((weather & B_WEATHER_RAIN) && (gBattleMoves[move].effect == EFFECT_THUNDER || gBattleMoves[move].effect == EFFECT_HURRICANE))
|
||||
|| (((weather & (B_WEATHER_HAIL | B_WEATHER_SNOW)) && move == MOVE_BLIZZARD)))
|
||||
|| (gBattleMoves[move].effect == EFFECT_VITAL_THROW)
|
||||
#if B_MINIMIZE_DMG_ACC >= GEN_6
|
||||
|| ((gStatuses3[battlerDef] & STATUS3_MINIMIZED) && gBattleMoves[move].minimizeDoubleDamage)
|
||||
#endif
|
||||
|| (B_MINIMIZE_DMG_ACC >= GEN_6 && (gStatuses3[battlerDef] & STATUS3_MINIMIZED) && gBattleMoves[move].minimizeDoubleDamage)
|
||||
|| (gBattleMoves[move].accuracy == 0))
|
||||
{
|
||||
return TRUE;
|
||||
|
@ -1722,10 +1713,8 @@ bool32 ShouldTryOHKO(u32 battlerAtk, u32 battlerDef, u32 atkAbility, u32 defAbil
|
|||
else // test the odds
|
||||
{
|
||||
u32 odds = accuracy + (gBattleMons[battlerAtk].level - gBattleMons[battlerDef].level);
|
||||
#if B_SHEER_COLD_ACC >= GEN_7
|
||||
if (move == MOVE_SHEER_COLD && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_ICE))
|
||||
if (B_SHEER_COLD_ACC >= GEN_7 && move == 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;
|
||||
}
|
||||
|
@ -2340,9 +2329,6 @@ bool32 IsStatRaisingEffect(u32 effect)
|
|||
case EFFECT_EVASION_UP_2:
|
||||
case EFFECT_MINIMIZE:
|
||||
case EFFECT_DEFENSE_CURL:
|
||||
#if B_CHARGE_SPDEF_RAISE >= GEN_5
|
||||
case EFFECT_CHARGE:
|
||||
#endif
|
||||
case EFFECT_CALM_MIND:
|
||||
case EFFECT_COSMIC_POWER:
|
||||
case EFFECT_DRAGON_DANCE:
|
||||
|
@ -2359,6 +2345,8 @@ bool32 IsStatRaisingEffect(u32 effect)
|
|||
case EFFECT_STOCKPILE:
|
||||
case EFFECT_VICTORY_DANCE:
|
||||
return TRUE;
|
||||
case EFFECT_CHARGE:
|
||||
return B_CHARGE_SPDEF_RAISE >= GEN_5;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2520,15 +2508,10 @@ static u32 GetTrapDamage(u32 battlerId)
|
|||
if (gBattleMons[battlerId].status2 & STATUS2_WRAPPED)
|
||||
{
|
||||
if (holdEffect == HOLD_EFFECT_BINDING_BAND)
|
||||
#if B_BINDING_DAMAGE >= GEN_6
|
||||
damage = gBattleMons[battlerId].maxHP / 6;
|
||||
damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6 ? 6 : 8);
|
||||
else
|
||||
damage = gBattleMons[battlerId].maxHP / 8;
|
||||
#else
|
||||
damage = gBattleMons[battlerId].maxHP / 8;
|
||||
else
|
||||
damage = gBattleMons[battlerId].maxHP / 16;
|
||||
#endif
|
||||
damage = gBattleMons[battlerId].maxHP / (B_BINDING_DAMAGE >= GEN_6 ? 8 : 16);
|
||||
|
||||
if (damage == 0)
|
||||
damage = 1;
|
||||
}
|
||||
|
@ -2768,9 +2751,7 @@ bool32 ShouldPivot(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32
|
|||
|
||||
if (!IS_MOVE_STATUS(move) && (shouldSwitch
|
||||
|| (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
|
||||
#if B_STURDY >= GEN_5
|
||||
|| defAbility == ABILITY_STURDY
|
||||
#endif
|
||||
|| (B_STURDY >= GEN_5 && defAbility == ABILITY_STURDY)
|
||||
|| defAbility == ABILITY_MULTISCALE
|
||||
|| defAbility == ABILITY_SHADOW_SHIELD))))
|
||||
return PIVOT; // pivot to break sash/sturdy/multiscale
|
||||
|
@ -2778,9 +2759,7 @@ bool32 ShouldPivot(u32 battlerAtk, u32 battlerDef, u32 defAbility, u32 move, u32
|
|||
else if (!hasStatBoost)
|
||||
{
|
||||
if (!IS_MOVE_STATUS(move) && (AtMaxHp(battlerDef) && (AI_DATA->holdEffects[battlerDef] == HOLD_EFFECT_FOCUS_SASH
|
||||
#if B_STURDY >= GEN_5
|
||||
|| (defAbility == ABILITY_STURDY)
|
||||
#endif
|
||||
|| (B_STURDY >= GEN_5 && defAbility == ABILITY_STURDY)
|
||||
|| defAbility == ABILITY_MULTISCALE
|
||||
|| defAbility == ABILITY_SHADOW_SHIELD)))
|
||||
return PIVOT; // pivot to break sash/sturdy/multiscale
|
||||
|
@ -2921,9 +2900,7 @@ bool32 CanKnockOffItem(u32 battler, u32 item)
|
|||
| BATTLE_TYPE_LINK
|
||||
| BATTLE_TYPE_RECORDED_LINK
|
||||
| BATTLE_TYPE_SECRET_BASE
|
||||
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE
|
||||
| BATTLE_TYPE_TRAINER
|
||||
#endif
|
||||
| (B_TRAINERS_KNOCK_OFF_ITEMS == TRUE ? BATTLE_TYPE_TRAINER : 0)
|
||||
)) && GetBattlerSide(battler) == B_SIDE_PLAYER)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -1468,10 +1468,8 @@ static void LoadDefaultBg(void)
|
|||
{
|
||||
if (IsContest())
|
||||
LoadContestBgAfterMoveAnim();
|
||||
#if B_TERRAIN_BG_CHANGE == TRUE
|
||||
else if (gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
|
||||
else if (B_TERRAIN_BG_CHANGE == TRUE && gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)
|
||||
DrawTerrainTypeBattleBackground();
|
||||
#endif
|
||||
else
|
||||
DrawMainBattleBackground();
|
||||
}
|
||||
|
|
|
@ -856,11 +856,10 @@ void LoadBattleTextboxAndBackground(void)
|
|||
CopyBgTilemapBufferToVram(0);
|
||||
LoadCompressedPalette(gBattleTextboxPalette, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
|
||||
LoadBattleMenuWindowGfx();
|
||||
#if B_TERRAIN_BG_CHANGE == TRUE
|
||||
DrawTerrainTypeBattleBackground();
|
||||
#else
|
||||
DrawMainBattleBackground();
|
||||
#endif
|
||||
if (B_TERRAIN_BG_CHANGE == TRUE)
|
||||
DrawTerrainTypeBattleBackground();
|
||||
else
|
||||
DrawMainBattleBackground();
|
||||
}
|
||||
|
||||
static void DrawLinkBattleParticipantPokeballs(u8 taskId, u8 multiplayerId, u8 bgId, u8 destX, u8 destY)
|
||||
|
|
|
@ -590,9 +590,8 @@ static void OpponentHandleChooseMove(u32 battler)
|
|||
target = GetBattlerAtPosition(Random() & 2);
|
||||
} while (!CanTargetBattler(battler, target, move));
|
||||
|
||||
#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))
|
||||
if (B_WILD_NATURAL_ENEMIES == TRUE && !(gBattleMoves[move].target & MOVE_TARGET_BOTH))
|
||||
{
|
||||
u16 i, speciesAttacker, speciesTarget, isPartnerEnemy = FALSE;
|
||||
static const u16 naturalEnemies[][2] =
|
||||
|
@ -622,8 +621,9 @@ static void OpponentHandleChooseMove(u32 battler)
|
|||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (target << 8));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (target << 8));
|
||||
}
|
||||
}
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(battler, BUFFER_B, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8));
|
||||
|
|
|
@ -716,25 +716,26 @@ static void HandleInputChooseMove(u32 battler)
|
|||
canSelectTarget = 0;
|
||||
}
|
||||
|
||||
#if B_SHOW_TARGETS == TRUE
|
||||
// Show all available targets for multi-target moves
|
||||
if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS)
|
||||
if (B_SHOW_TARGETS == TRUE)
|
||||
{
|
||||
u32 i = 0;
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
TryShowAsTarget(i);
|
||||
// Show all available targets for multi-target moves
|
||||
if ((moveTarget & MOVE_TARGET_ALL_BATTLERS) == MOVE_TARGET_ALL_BATTLERS)
|
||||
{
|
||||
u32 i = 0;
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
TryShowAsTarget(i);
|
||||
|
||||
canSelectTarget = 3;
|
||||
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(battler));
|
||||
canSelectTarget = 2;
|
||||
}
|
||||
}
|
||||
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(battler));
|
||||
canSelectTarget = 2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (canSelectTarget)
|
||||
|
|
|
@ -591,13 +591,16 @@ void BattleLoadMonSpriteGfx(struct Pokemon *mon, u32 battler)
|
|||
else
|
||||
{
|
||||
species = gBattleSpritesDataPtr->battlerData[battler].transformSpecies;
|
||||
#if B_TRANSFORM_SHINY >= GEN_4
|
||||
if (B_TRANSFORM_SHINY >= GEN_4)
|
||||
{
|
||||
currentPersonality = gTransformedPersonalities[battler];
|
||||
currentOtId = gTransformedOtIds[battler];
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
currentPersonality = monsPersonality;
|
||||
currentOtId = otId;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
position = GetBattlerPosition(battler);
|
||||
|
@ -886,14 +889,12 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bo
|
|||
|
||||
if (GetBattlerSide(battlerAtk) == B_SIDE_PLAYER)
|
||||
{
|
||||
#if B_TRANSFORM_SHINY >= GEN_4
|
||||
if (trackEnemyPersonality)
|
||||
if (B_TRANSFORM_SHINY >= GEN_4 && trackEnemyPersonality)
|
||||
{
|
||||
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
||||
|
@ -907,15 +908,13 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool32 megaEvo, bo
|
|||
}
|
||||
else
|
||||
{
|
||||
#if B_TRANSFORM_SHINY >= GEN_4
|
||||
if (trackEnemyPersonality)
|
||||
if (B_TRANSFORM_SHINY >= GEN_4 && trackEnemyPersonality)
|
||||
{
|
||||
personalityValue = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
||||
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_PERSONALITY);
|
||||
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerAtk]], MON_DATA_OT_ID);
|
||||
|
|
|
@ -995,10 +995,8 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHPBoxes)
|
|||
|
||||
MegaIndicator_UpdateOamPriority(healthboxLeftSpriteId, priority);
|
||||
|
||||
#if B_HIDE_HEALTHBOX_IN_ANIMS
|
||||
if (hideHPBoxes && IsBattlerAlive(i))
|
||||
if (B_HIDE_HEALTHBOX_IN_ANIMS == TRUE && hideHPBoxes && IsBattlerAlive(i))
|
||||
TryToggleHealboxVisibility(priority, healthboxLeftSpriteId, healthboxRightSpriteId, healthbarSpriteId);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2614,15 +2612,12 @@ s32 MoveBattleBar(u8 battlerId, u8 healthboxSpriteId, u8 whichBar, u8 unused)
|
|||
|
||||
if (whichBar == HEALTH_BAR) // health bar
|
||||
{
|
||||
u16 hpFraction = B_FAST_HP_DRAIN == FALSE ? 1 : max(gBattleSpritesDataPtr->battleBars[battlerId].maxValue / B_HEALTHBAR_PIXELS, 1);
|
||||
currentBarValue = CalcNewBarValue(gBattleSpritesDataPtr->battleBars[battlerId].maxValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].oldValue,
|
||||
gBattleSpritesDataPtr->battleBars[battlerId].receivedValue,
|
||||
&gBattleSpritesDataPtr->battleBars[battlerId].currValue,
|
||||
#if B_FAST_HP_DRAIN == TRUE
|
||||
B_HEALTHBAR_PIXELS / 8, max(gBattleSpritesDataPtr->battleBars[battlerId].maxValue / B_HEALTHBAR_PIXELS, 1));
|
||||
#else
|
||||
B_HEALTHBAR_PIXELS / 8, 1);
|
||||
#endif
|
||||
B_HEALTHBAR_PIXELS / 8, hpFraction);
|
||||
}
|
||||
else // exp bar
|
||||
{
|
||||
|
@ -3239,10 +3234,12 @@ 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 == FALSE)
|
||||
return;
|
||||
|
||||
if (gTestRunnerEnabled)
|
||||
{
|
||||
TestRunner_Battle_RecordAbilityPopUp(battlerId, ability);
|
||||
|
@ -3312,7 +3309,6 @@ 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)
|
||||
|
@ -3395,18 +3391,10 @@ static const struct OamData sOamData_LastUsedBall =
|
|||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
#if B_LAST_USED_BALL_CYCLE == TRUE
|
||||
.shape = SPRITE_SHAPE(32x64),
|
||||
#else
|
||||
.shape = SPRITE_SHAPE(32x32),
|
||||
#endif
|
||||
.shape = (B_LAST_USED_BALL_CYCLE == TRUE ? SPRITE_SHAPE(32x64) : SPRITE_SHAPE(32x32)),
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
#if B_LAST_USED_BALL_CYCLE == TRUE
|
||||
.size = SPRITE_SIZE(32x64),
|
||||
#else
|
||||
.size = SPRITE_SIZE(32x32),
|
||||
#endif
|
||||
.size = (B_LAST_USED_BALL_CYCLE == TRUE ? SPRITE_SIZE(32x64) : SPRITE_SIZE(32x32)),
|
||||
.tileNum = 0,
|
||||
.priority = 1,
|
||||
.paletteNum = 0,
|
||||
|
@ -3457,9 +3445,8 @@ static const struct SpriteSheet sSpriteSheet_LastUsedBallWindow =
|
|||
|
||||
bool32 CanThrowLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == FALSE
|
||||
return FALSE;
|
||||
#else
|
||||
if (B_LAST_USED_BALL == FALSE)
|
||||
return FALSE;
|
||||
if (!CanThrowBall())
|
||||
return FALSE;
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_FRONTIER))
|
||||
|
@ -3468,12 +3455,12 @@ bool32 CanThrowLastUsedBall(void)
|
|||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void TryAddLastUsedBallItemSprites(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (B_LAST_USED_BALL == FALSE)
|
||||
return;
|
||||
if (gLastThrownBall == 0
|
||||
|| (gLastThrownBall != 0 && !CheckBagHasItem(gLastThrownBall, 1)))
|
||||
{
|
||||
|
@ -3510,10 +3497,8 @@ void TryAddLastUsedBallItemSprites(void)
|
|||
gSprites[gBattleStruct->ballSpriteIds[1]].sHide = FALSE; // restore
|
||||
gLastUsedBallMenuPresent = TRUE;
|
||||
}
|
||||
#if B_LAST_USED_BALL_CYCLE == TRUE
|
||||
ArrowsChangeColorLastBallCycle(0); //Default the arrows to be invisible
|
||||
#endif
|
||||
#endif
|
||||
if (B_LAST_USED_BALL_CYCLE == TRUE)
|
||||
ArrowsChangeColorLastBallCycle(0); //Default the arrows to be invisible
|
||||
}
|
||||
|
||||
static void DestroyLastUsedBallWinGfx(struct Sprite *sprite)
|
||||
|
@ -3571,7 +3556,8 @@ static void SpriteCB_LastUsedBall(struct Sprite *sprite)
|
|||
|
||||
static void TryHideOrRestoreLastUsedBall(u8 caseId)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (B_LAST_USED_BALL == FALSE)
|
||||
return;
|
||||
if (gBattleStruct->ballSpriteIds[0] == MAX_SPRITES)
|
||||
return;
|
||||
|
||||
|
@ -3592,27 +3578,25 @@ static void TryHideOrRestoreLastUsedBall(u8 caseId)
|
|||
gLastUsedBallMenuPresent = TRUE;
|
||||
break;
|
||||
}
|
||||
#if B_LAST_USED_BALL_CYCLE == TRUE
|
||||
ArrowsChangeColorLastBallCycle(0); //Default the arrows to be invisible
|
||||
#endif
|
||||
#endif
|
||||
if (B_LAST_USED_BALL_CYCLE == TRUE)
|
||||
ArrowsChangeColorLastBallCycle(0); //Default the arrows to be invisible
|
||||
}
|
||||
|
||||
void TryHideLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
TryHideOrRestoreLastUsedBall(0);
|
||||
#endif
|
||||
if (B_LAST_USED_BALL == TRUE)
|
||||
TryHideOrRestoreLastUsedBall(0);
|
||||
}
|
||||
|
||||
void TryRestoreLastUsedBall(void)
|
||||
{
|
||||
#if B_LAST_USED_BALL == TRUE
|
||||
if (B_LAST_USED_BALL == FALSE)
|
||||
return;
|
||||
|
||||
if (gBattleStruct->ballSpriteIds[0] != MAX_SPRITES)
|
||||
TryHideOrRestoreLastUsedBall(1);
|
||||
else
|
||||
TryAddLastUsedBallItemSprites();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void SpriteCB_LastUsedBallBounce(struct Sprite *sprite)
|
||||
|
|
|
@ -3516,11 +3516,10 @@ static void DoBattleIntro(void)
|
|||
}
|
||||
else // Skip party summary since it is a wild battle.
|
||||
{
|
||||
#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
|
||||
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.
|
||||
}
|
||||
break;
|
||||
case 5: // draw party summary in trainer battles
|
||||
|
@ -3589,11 +3588,10 @@ static void DoBattleIntro(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
#if B_FAST_INTRO == TRUE
|
||||
*state = 15; // Wait for text to be printed.
|
||||
#else
|
||||
*state = 14; // Wait for text and sprite.
|
||||
#endif
|
||||
if (B_FAST_INTRO == TRUE)
|
||||
*state = 15; // Wait for text to be printed.
|
||||
else
|
||||
*state = 14; // Wait for text and sprite.
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -3631,11 +3629,10 @@ static void DoBattleIntro(void)
|
|||
BtlController_EmitIntroTrainerBallThrow(battler, BUFFER_A);
|
||||
MarkBattlerForControllerExec(battler);
|
||||
}
|
||||
#if B_FAST_INTRO == TRUE
|
||||
if (!(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK)))
|
||||
if (B_FAST_INTRO == TRUE
|
||||
&& !(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
|
||||
|
@ -3655,14 +3652,13 @@ static void DoBattleIntro(void)
|
|||
battler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
|
||||
|
||||
// A hack that makes fast intro work in trainer battles too.
|
||||
#if B_FAST_INTRO == TRUE
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
|
||||
if (B_FAST_INTRO == TRUE
|
||||
&& gBattleTypeFlags & BATTLE_TYPE_TRAINER
|
||||
&& !(gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_RECORDED_IS_MASTER | BATTLE_TYPE_LINK))
|
||||
&& gSprites[gHealthboxSpriteIds[battler ^ BIT_SIDE]].callback == SpriteCallbackDummy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
PrepareStringBattle(STRINGID_INTROSENDOUT, battler);
|
||||
}
|
||||
|
@ -3994,10 +3990,8 @@ u8 IsRunningFromBattleImpossible(u32 battler)
|
|||
|
||||
if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN)
|
||||
return BATTLE_RUN_SUCCESS;
|
||||
#if B_GHOSTS_ESCAPE >= GEN_6
|
||||
if (IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|
||||
return BATTLE_RUN_SUCCESS;
|
||||
#endif
|
||||
if (B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|
||||
return BATTLE_RUN_SUCCESS;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
return BATTLE_RUN_SUCCESS;
|
||||
if (GetBattlerAbility(battler) == ABILITY_RUN_AWAY)
|
||||
|
@ -4661,11 +4655,7 @@ u32 GetBattlerTotalSpeedStatArgs(u32 battler, u32 ability, u32 holdEffect)
|
|||
|
||||
// paralysis drop
|
||||
if (gBattleMons[battler].status1 & STATUS1_PARALYSIS && ability != ABILITY_QUICK_FEET)
|
||||
#if B_PARALYSIS_SPEED >= GEN_7
|
||||
speed /= 2;
|
||||
#else
|
||||
speed /= 4;
|
||||
#endif
|
||||
speed /= B_PARALYSIS_SPEED >= GEN_7 ? 2 : 4;
|
||||
|
||||
return speed;
|
||||
}
|
||||
|
@ -4697,9 +4687,7 @@ s8 GetMovePriority(u32 battler, u16 move)
|
|||
|
||||
priority = gBattleMoves[move].priority;
|
||||
if (ability == ABILITY_GALE_WINGS
|
||||
#if B_GALE_WINGS >= GEN_7
|
||||
&& BATTLER_MAX_HP(battler)
|
||||
#endif
|
||||
&& (B_GALE_WINGS < GEN_7 || BATTLER_MAX_HP(battler))
|
||||
&& gBattleMoves[move].type == TYPE_FLYING)
|
||||
{
|
||||
priority++;
|
||||
|
@ -5050,9 +5038,8 @@ static bool32 TryDoMegaEvosBeforeMoves(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if B_MEGA_EVO_TURN_ORDER >= GEN_7
|
||||
if (B_MEGA_EVO_TURN_ORDER >= GEN_7)
|
||||
TryChangeTurnOrder(); // This will just do nothing if no mon has mega evolved.
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -5404,9 +5391,8 @@ static void HandleEndTurn_FinishBattle(void)
|
|||
TestRunner_Battle_AfterLastTurn();
|
||||
BeginFastPaletteFade(3);
|
||||
FadeOutMapMusic(5);
|
||||
#if B_TRAINERS_KNOCK_OFF_ITEMS == TRUE || B_RESTORE_HELD_BATTLE_ITEMS == TRUE
|
||||
if (B_TRAINERS_KNOCK_OFF_ITEMS == TRUE || B_RESTORE_HELD_BATTLE_ITEMS == TRUE)
|
||||
TryRestoreHeldItems();
|
||||
#endif
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
bool8 changedForm = FALSE;
|
||||
|
@ -5422,11 +5408,9 @@ static void HandleEndTurn_FinishBattle(void)
|
|||
gBattleStruct->changedSpecies[B_SIDE_PLAYER][i] = SPECIES_NONE;
|
||||
gBattleStruct->changedSpecies[B_SIDE_OPPONENT][i] = SPECIES_NONE;
|
||||
|
||||
#if B_RECALCULATE_STATS >= GEN_5
|
||||
// Recalculate the stats of every party member before the end
|
||||
if (!changedForm)
|
||||
if (!changedForm && B_RECALCULATE_STATS >= GEN_5)
|
||||
CalculateMonStats(&gPlayerParty[i]);
|
||||
#endif
|
||||
}
|
||||
// Clear battle mon species to avoid a bug on the next battle that causes
|
||||
// healthboxes loading incorrectly due to it trying to create a Mega Indicator
|
||||
|
@ -5459,10 +5443,9 @@ static void FreeResetData_ReturnToOvOrDoEvolutions(void)
|
|||
| BATTLE_TYPE_FRONTIER
|
||||
| BATTLE_TYPE_EREADER_TRAINER
|
||||
| BATTLE_TYPE_WALLY_TUTORIAL))
|
||||
#if B_EVOLUTION_AFTER_WHITEOUT <= GEN_5
|
||||
&& (gBattleOutcome == B_OUTCOME_WON || gBattleOutcome == B_OUTCOME_CAUGHT)
|
||||
#endif
|
||||
)
|
||||
&& (B_EVOLUTION_AFTER_WHITEOUT >= GEN_6
|
||||
|| gBattleOutcome == B_OUTCOME_WON
|
||||
|| gBattleOutcome == B_OUTCOME_CAUGHT))
|
||||
{
|
||||
gBattleMainFunc = TrySpecialEvolution;
|
||||
}
|
||||
|
|
|
@ -1850,11 +1850,7 @@ const u16 gWeatherStartsStringIds[] =
|
|||
[WEATHER_SUNNY_CLOUDS] = STRINGID_ITISRAINING,
|
||||
[WEATHER_SUNNY] = STRINGID_ITISRAINING,
|
||||
[WEATHER_RAIN] = STRINGID_ITISRAINING,
|
||||
#if B_OVERWORLD_SNOW >= GEN_9
|
||||
[WEATHER_SNOW] = STRINGID_STARTEDSNOW,
|
||||
#else
|
||||
[WEATHER_SNOW] = STRINGID_STARTEDHAIL,
|
||||
#endif
|
||||
[WEATHER_SNOW] = (B_OVERWORLD_SNOW >= GEN_9 ? STRINGID_STARTEDSNOW : STRINGID_STARTEDHAIL),
|
||||
[WEATHER_RAIN_THUNDERSTORM] = STRINGID_ITISRAINING,
|
||||
[WEATHER_FOG_HORIZONTAL] = STRINGID_ITISRAINING,
|
||||
[WEATHER_VOLCANIC_ASH] = STRINGID_ITISRAINING,
|
||||
|
|
|
@ -861,10 +861,7 @@ static bool8 DoesTypePreventStatus(u16 species, u32 status)
|
|||
break;
|
||||
case STATUS1_PARALYSIS:
|
||||
if (gSpeciesInfo[species].types[0] == TYPE_GROUND || gSpeciesInfo[species].types[1] == TYPE_GROUND
|
||||
#if B_PARALYZE_ELECTRIC >= GEN_6
|
||||
|| gSpeciesInfo[species].types[0] == TYPE_ELECTRIC || gSpeciesInfo[species].types[1] == TYPE_ELECTRIC
|
||||
#endif
|
||||
)
|
||||
|| (B_PARALYZE_ELECTRIC >= GEN_6 && (gSpeciesInfo[species].types[0] == TYPE_ELECTRIC || gSpeciesInfo[species].types[1] == TYPE_ELECTRIC)))
|
||||
ret = TRUE;
|
||||
break;
|
||||
case STATUS1_BURN:
|
||||
|
@ -916,11 +913,7 @@ static bool8 TryInflictRandomStatus(void)
|
|||
if (rand < 35)
|
||||
sStatusFlags = STATUS1_TOXIC_POISON;
|
||||
else if (rand < 60)
|
||||
#if B_USE_FROSTBITE == TRUE
|
||||
sStatusFlags = STATUS1_FROSTBITE;
|
||||
#else
|
||||
sStatusFlags = STATUS1_FREEZE;
|
||||
#endif
|
||||
sStatusFlags = B_USE_FROSTBITE ? STATUS1_FROSTBITE : STATUS1_FREEZE;
|
||||
else if (rand < 80)
|
||||
sStatusFlags = STATUS1_PARALYSIS;
|
||||
else if (rand < 90)
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -4078,11 +4078,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
|
|||
|
||||
[MOVE_HIDDEN_POWER] =
|
||||
{
|
||||
#if B_HIDDEN_POWER_DMG >= GEN_6
|
||||
.power = 60,
|
||||
#else
|
||||
.power = 1,
|
||||
#endif
|
||||
.power = B_HIDDEN_POWER_DMG >= GEN_6 ? 60 : 1,
|
||||
.effect = EFFECT_HIDDEN_POWER,
|
||||
.type = TYPE_NORMAL,
|
||||
.accuracy = 100,
|
||||
|
|
|
@ -4844,11 +4844,7 @@ const struct Item gItems[] =
|
|||
.name = _("Soul Dew"),
|
||||
.price = 0,
|
||||
.holdEffect = HOLD_EFFECT_SOUL_DEW,
|
||||
#if B_SOUL_DEW_BOOST >= GEN_7
|
||||
.holdEffectParam = 20,
|
||||
#else
|
||||
.holdEffectParam = 50,
|
||||
#endif
|
||||
.holdEffectParam = B_SOUL_DEW_BOOST >= GEN_7 ? 20 : 50,
|
||||
.description = sSoulDewDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
|
|
|
@ -1051,10 +1051,8 @@ static u32 GetBallThrowableState(void)
|
|||
return BALL_THROW_UNABLE_TWO_MONS;
|
||||
else if (IsPlayerPartyAndPokemonStorageFull() == TRUE)
|
||||
return BALL_THROW_UNABLE_NO_ROOM;
|
||||
#if B_SEMI_INVULNERABLE_CATCH >= GEN_4
|
||||
else if (gStatuses3[GetCatchingBattler()] & STATUS3_SEMI_INVULNERABLE)
|
||||
else if (B_SEMI_INVULNERABLE_CATCH >= GEN_4 && (gStatuses3[GetCatchingBattler()] & STATUS3_SEMI_INVULNERABLE))
|
||||
return BALL_THROW_UNABLE_SEMI_INVULNERABLE;
|
||||
#endif
|
||||
else if (FlagGet(B_FLAG_NO_CATCHING))
|
||||
return BALL_THROW_UNABLE_DISABLED_FLAG;
|
||||
|
||||
|
@ -1093,14 +1091,12 @@ void ItemUseInBattle_PokeBall(u8 taskId)
|
|||
else
|
||||
DisplayItemMessageInBattlePyramid(taskId, gText_BoxFull, Task_CloseBattlePyramidBagMessage);
|
||||
break;
|
||||
#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
|
||||
case BALL_THROW_UNABLE_DISABLED_FLAG:
|
||||
if (!InBattlePyramid())
|
||||
DisplayItemMessage(taskId, FONT_NORMAL, sText_CantThrowPokeBall_Disabled, CloseItemMessage);
|
||||
|
@ -1210,12 +1206,10 @@ static bool32 CannotUseBagBattleItem(u16 itemId)
|
|||
failStr = gText_BoxFull;
|
||||
cannotUse++;
|
||||
break;
|
||||
#if B_SEMI_INVULNERABLE_CATCH >= GEN_4
|
||||
case BALL_THROW_UNABLE_SEMI_INVULNERABLE:
|
||||
failStr = sText_CantThrowPokeBall_SemiInvulnerable;
|
||||
cannotUse++;
|
||||
break;
|
||||
#endif
|
||||
case BALL_THROW_UNABLE_DISABLED_FLAG:
|
||||
failStr = sText_CantThrowPokeBall_Disabled;
|
||||
cannotUse++;
|
||||
|
|
|
@ -358,9 +358,8 @@ static void (*const sMovementStatusHandler[])(struct LinkPlayerObjectEvent *, st
|
|||
void DoWhiteOut(void)
|
||||
{
|
||||
RunScriptImmediately(EventScript_WhiteOut);
|
||||
#if B_WHITEOUT_MONEY == GEN_3
|
||||
SetMoney(&gSaveBlock1Ptr->money, GetMoney(&gSaveBlock1Ptr->money) / 2);
|
||||
#endif
|
||||
if (B_WHITEOUT_MONEY == GEN_3)
|
||||
SetMoney(&gSaveBlock1Ptr->money, GetMoney(&gSaveBlock1Ptr->money) / 2);
|
||||
HealPlayerParty();
|
||||
Overworld_ResetStateAfterWhiteOut();
|
||||
SetWarpDestinationToLastHealLocation();
|
||||
|
@ -425,9 +424,8 @@ static void Overworld_ResetStateAfterWhiteOut(void)
|
|||
FlagClear(FLAG_SYS_SAFARI_MODE);
|
||||
FlagClear(FLAG_SYS_USE_STRENGTH);
|
||||
FlagClear(FLAG_SYS_USE_FLASH);
|
||||
#if B_RESET_FLAGS_VARS_AFTER_WHITEOUT == TRUE
|
||||
Overworld_ResetBattleFlagsAndVars();
|
||||
#endif
|
||||
if (B_RESET_FLAGS_VARS_AFTER_WHITEOUT == TRUE)
|
||||
Overworld_ResetBattleFlagsAndVars();
|
||||
// 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)
|
||||
|
|
|
@ -5781,12 +5781,6 @@ 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
|
||||
|
||||
// EXP candies store an index for this table in their holdEffectParam.
|
||||
const u32 sExpCandyExperienceTable[] = {
|
||||
[EXP_100 - 1] = 100,
|
||||
|
@ -6345,12 +6339,15 @@ 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);
|
||||
#endif
|
||||
if (B_X_ITEMS_BUFF >= GEN_7)
|
||||
{
|
||||
StringCopy(gBattleTextBuff2, gText_StatSharply);
|
||||
StringAppend(gBattleTextBuff2, gText_StatRose);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringCopy(gBattleTextBuff2, gText_StatRose);
|
||||
}
|
||||
BattleStringExpandPlaceholdersToDisplayedString(gText_DefendersStatRose);
|
||||
}
|
||||
|
||||
|
|
|
@ -3750,9 +3750,8 @@ static void PrintMoveDetails(u16 move)
|
|||
if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES)
|
||||
{
|
||||
moveEffect = gBattleMoves[move].effect;
|
||||
#if B_SHOW_SPLIT_ICON == TRUE
|
||||
ShowSplitIcon(GetBattleMoveSplit(move));
|
||||
#endif
|
||||
if (B_SHOW_SPLIT_ICON == TRUE)
|
||||
ShowSplitIcon(GetBattleMoveSplit(move));
|
||||
PrintMovePowerAndAccuracy(move);
|
||||
|
||||
if (moveEffect != EFFECT_PLACEHOLDER)
|
||||
|
|
|
@ -418,10 +418,7 @@ 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
|
||||
#if B_SYNCHRONIZE_NATURE <= GEN_7
|
||||
&& (Random() % 2 == 0)
|
||||
#endif
|
||||
)
|
||||
&& (B_SYNCHRONIZE_NATURE >= GEN_8 || Random() % 2 == 0))
|
||||
{
|
||||
return GetMonData(&gPlayerParty[0], MON_DATA_PERSONALITY) % NUM_NATURES;
|
||||
}
|
||||
|
@ -1114,20 +1111,13 @@ static void ApplyCleanseTagEncounterRateMod(u32 *encRate)
|
|||
|
||||
bool8 TryDoDoubleWildBattle(void)
|
||||
{
|
||||
#if B_DOUBLE_WILD_REQUIRE_2_MONS == TRUE
|
||||
if (GetSafariZoneFlag() || GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS)
|
||||
#else
|
||||
if (GetSafariZoneFlag())
|
||||
#endif
|
||||
if (GetSafariZoneFlag()
|
||||
|| (B_DOUBLE_WILD_REQUIRE_2_MONS == TRUE && GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS))
|
||||
return FALSE;
|
||||
#if B_FLAG_FORCE_DOUBLE_WILD != 0
|
||||
else if (FlagGet(B_FLAG_FORCE_DOUBLE_WILD))
|
||||
else if (B_FLAG_FORCE_DOUBLE_WILD != 0 && FlagGet(B_FLAG_FORCE_DOUBLE_WILD))
|
||||
return TRUE;
|
||||
#endif
|
||||
#if B_DOUBLE_WILD_CHANCE != 0
|
||||
else if ((Random() % 100) + 1 <= B_DOUBLE_WILD_CHANCE)
|
||||
else if (B_DOUBLE_WILD_CHANCE != 0 && ((Random() % 100) + 1 <= B_DOUBLE_WILD_CHANCE))
|
||||
return TRUE;
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ SINGLE_BATTLE_TEST("Rayquaza can Mega Evolve knowing Dragon Ascent")
|
|||
SINGLE_BATTLE_TEST("Mega Evolution affects turn order")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(B_MEGA_EVO_TURN_ORDER);
|
||||
ASSUME(B_MEGA_EVO_TURN_ORDER >= GEN_7);
|
||||
PLAYER(SPECIES_GARDEVOIR) { Item(ITEM_GARDEVOIRITE); Speed(105); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Speed(106); }
|
||||
} WHEN {
|
||||
|
@ -90,7 +90,7 @@ SINGLE_BATTLE_TEST("Mega Evolution affects turn order")
|
|||
SINGLE_BATTLE_TEST("Abilities replaced by Mega Evolution do not affect turn order")
|
||||
{
|
||||
GIVEN {
|
||||
ASSUME(B_MEGA_EVO_TURN_ORDER);
|
||||
ASSUME(B_MEGA_EVO_TURN_ORDER >= GEN_7);
|
||||
ASSUME(gSpeciesInfo[SPECIES_SABLEYE_MEGA].abilities[0] != ABILITY_STALL
|
||||
&& gSpeciesInfo[SPECIES_SABLEYE_MEGA].abilities[1] != ABILITY_STALL);
|
||||
PLAYER(SPECIES_SABLEYE) { Item(ITEM_SABLENITE); Ability(ABILITY_STALL); Speed(105); }
|
||||
|
|
|
@ -62,7 +62,7 @@ SINGLE_BATTLE_TEST("Ultra Burst affects turn order")
|
|||
{
|
||||
GIVEN {
|
||||
ASSUME(P_GEN_7_POKEMON == TRUE);
|
||||
ASSUME(B_MEGA_EVO_TURN_ORDER);
|
||||
ASSUME(B_MEGA_EVO_TURN_ORDER >= GEN_7);
|
||||
PLAYER(SPECIES_NECROZMA_DUSK_MANE) { Item(ITEM_ULTRANECROZIUM_Z); Speed(105); }
|
||||
OPPONENT(SPECIES_WOBBUFFET) { Speed(106); }
|
||||
} WHEN {
|
||||
|
|
Loading…
Reference in a new issue