mirror of
https://github.com/rh-hideout/pokeemerald-expansion.git
synced 2026-04-26 02:14:22 -05:00
Battle file cleanup & documentation (#8903)
This commit is contained in:
parent
550fe9a7de
commit
786c3d948f
|
|
@ -538,7 +538,7 @@ struct PartyState
|
|||
u32 timesGotHit:5;
|
||||
u32 changedSpecies:11; // For forms when multiple mons can change into the same pokemon.
|
||||
u32 sentOut:1;
|
||||
u32 knockedOffItem;
|
||||
u32 isKnockedOff:1;
|
||||
u32 padding:8;
|
||||
u16 usedHeldItem;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ static inline bool32 IsMoveUnusable(u32 moveIndex, enum Move move, u32 moveLimit
|
|||
|
||||
typedef bool32 (*MoveFlag)(enum Move move);
|
||||
|
||||
bool32 AI_IsFaster(u32 battlerAi, u32 battlerDef, u32 aiMove, u32 playerMove, enum ConsiderPriority considerPriority);
|
||||
bool32 AI_IsSlower(u32 battlerAi, u32 battlerDef, u32 aiMove, u32 playerMove, enum ConsiderPriority considerPriority);
|
||||
bool32 AI_IsFaster(u32 battlerAi, u32 battlerDef, enum Move aiMove, enum Move playerMove, enum ConsiderPriority considerPriority);
|
||||
bool32 AI_IsSlower(u32 battlerAi, u32 battlerDef, enum Move aiMove, enum Move playerMove, enum ConsiderPriority considerPriority);
|
||||
bool32 AI_RandLessThan(u32 val);
|
||||
bool32 AI_IsBattlerGrounded(u32 battler);
|
||||
enum MoveTarget AI_GetBattlerMoveTargetType(u32 battler, enum Move move);
|
||||
|
|
@ -114,7 +114,7 @@ s32 AI_WhoStrikesFirst(u32 battlerAI, u32 battler2, enum Move aiMoveConsidered,
|
|||
bool32 CanTargetFaintAi(u32 battlerDef, u32 battlerAtk);
|
||||
u32 NoOfHitsForTargetToFaintBattler(u32 battlerDef, u32 battlerAtk, enum AiConsiderEndure considerEndure);
|
||||
void GetBestDmgMovesFromBattler(u32 battlerAtk, u32 battlerDef, enum DamageCalcContext calcContext, enum Move *bestMoves);
|
||||
u16 GetMoveIndex(u32 battler, enum Move move);
|
||||
u32 GetMoveIndex(u32 battler, enum Move move);
|
||||
bool32 IsBestDmgMove(u32 battlerAtk, u32 battlerDef, enum DamageCalcContext calcContext, enum Move move);
|
||||
bool32 BestDmgMoveHasEffect(u32 battlerAtk, u32 battlerDef, enum DamageCalcContext calcContext, enum BattleMoveEffects moveEffect);
|
||||
u32 GetBestDmgFromBattler(u32 battler, u32 battlerTarget, enum DamageCalcContext calcContext);
|
||||
|
|
@ -146,7 +146,7 @@ bool32 IsRecycleEncouragedItem(u32 item);
|
|||
bool32 ShouldRestoreHpBerry(u32 battlerAtk, u32 item);
|
||||
bool32 IsStatBoostingBerry(u32 item);
|
||||
bool32 CanKnockOffItem(u32 fromBattler, u32 battler, u32 item);
|
||||
bool32 IsAbilityOfRating(enum Ability ability, s8 rating);
|
||||
bool32 IsAbilityOfRating(enum Ability ability, s32 rating);
|
||||
bool32 AI_IsAbilityOnSide(u32 battlerId, enum Ability ability);
|
||||
bool32 AI_MoveMakesContact(enum Ability ability, enum HoldEffect holdEffect, enum Move move);
|
||||
bool32 IsConsideringZMove(u32 battlerAtk, u32 battlerDef, enum Move move);
|
||||
|
|
@ -253,7 +253,7 @@ bool32 AI_CanBurn(u32 battlerAtk, u32 battlerDef, enum Ability defAbility, u32 b
|
|||
bool32 AI_CanGiveFrostbite(u32 battlerAtk, u32 battlerDef, enum Ability defAbility, u32 battlerAtkPartner, enum Move move, enum Move partnerMove);
|
||||
bool32 AI_CanBeInfatuated(u32 battlerAtk, u32 battlerDef, enum Ability defAbility);
|
||||
bool32 AnyPartyMemberStatused(u32 battlerId, bool32 checkSoundproof);
|
||||
u32 ShouldTryToFlinch(u32 battlerAtk, u32 battlerDef, enum Ability atkAbility, enum Ability defAbility, enum Move move);
|
||||
bool32 ShouldTryToFlinch(u32 battlerAtk, u32 battlerDef, enum Ability atkAbility, enum Ability defAbility, enum Move move);
|
||||
bool32 ShouldTrap(u32 battlerAtk, u32 battlerDef, enum Move move);
|
||||
bool32 IsWakeupTurn(u32 battler);
|
||||
bool32 AI_IsBattlerAsleepOrComatose(u32 battlerId);
|
||||
|
|
@ -288,7 +288,7 @@ bool32 PartnerMoveIsSameNoTarget(u32 battlerAtkPartner, enum Move move, enum Mov
|
|||
bool32 PartnerMoveActivatesSleepClause(enum Move partnerMove);
|
||||
bool32 ShouldUseWishAromatherapy(u32 battlerAtk, u32 battlerDef, enum Move move);
|
||||
u32 GetFriendlyFireKOThreshold(u32 battler);
|
||||
bool32 IsAllyProtectingFromMove(u32 battlerAtk, u32 attackerMove, enum Move allyMove);
|
||||
bool32 IsAllyProtectingFromMove(u32 battlerAtk, enum Move attackerMove, enum Move allyMove);
|
||||
|
||||
// party logic
|
||||
struct BattlePokemon *AllocSaveBattleMons(void);
|
||||
|
|
@ -304,9 +304,9 @@ u32 GetActiveBattlerIds(u32 battler, u32 *battlerIn1, u32 *battlerIn2);
|
|||
bool32 IsPartyMonOnFieldOrChosenToSwitch(u32 partyIndex, u32 battlerIn1, u32 battlerIn2);
|
||||
|
||||
// score increases
|
||||
u32 IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, enum StatChange statId);
|
||||
u32 IncreaseStatUpScoreContrary(u32 battlerAtk, u32 battlerDef, enum StatChange statId);
|
||||
u32 IncreaseStatDownScore(u32 battlerAtk, u32 battlerDef, enum Stat stat);
|
||||
enum AIScore IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, enum StatChange statId);
|
||||
enum AIScore IncreaseStatUpScoreContrary(u32 battlerAtk, u32 battlerDef, enum StatChange statId);
|
||||
enum AIScore IncreaseStatDownScore(u32 battlerAtk, u32 battlerDef, enum Stat stat);
|
||||
void IncreasePoisonScore(u32 battlerAtk, u32 battlerDef, enum Move move, s32 *score);
|
||||
void IncreaseBurnScore(u32 battlerAtk, u32 battlerDef, enum Move move, s32 *score);
|
||||
void IncreaseParalyzeScore(u32 battlerAtk, u32 battlerDef, enum Move move, s32 *score);
|
||||
|
|
@ -334,7 +334,6 @@ bool32 CanMoveBeBouncedBack(u32 battler, enum Move move);
|
|||
// Switching and item helpers
|
||||
bool32 AiExpectsToFaintPlayer(u32 battler);
|
||||
|
||||
|
||||
// These are for the purpose of not doubling up on moves during double battles.
|
||||
// Used in GetAIEffectGroup for move effects and GetAIEffectGroupFromMove for additional effects
|
||||
#define AI_EFFECT_NONE 0
|
||||
|
|
|
|||
|
|
@ -1018,5 +1018,4 @@ extern const u8 gBattleAnimSpecial_SubstituteToMon[];
|
|||
extern const u8 gBattleAnimSpecial_MonToSubstitute[];
|
||||
extern const u8 gBattleAnimSpecial_CriticalCaptureBallThrow[];
|
||||
|
||||
|
||||
#endif // GUARD_BATTLE_ANIM_SCRIPTS_H
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ bool32 CanDynamax(u32 battler);
|
|||
bool32 IsGigantamaxed(u32 battler);
|
||||
void ApplyDynamaxHPMultiplier(struct Pokemon *mon);
|
||||
void ActivateDynamax(u32 battler);
|
||||
u16 GetNonDynamaxHP(u32 battler);
|
||||
u16 GetNonDynamaxMaxHP(u32 battler);
|
||||
u32 GetNonDynamaxHP(u32 battler);
|
||||
u32 GetNonDynamaxMaxHP(u32 battler);
|
||||
void UndoDynamax(u32 battler);
|
||||
bool32 IsMoveBlockedByMaxGuard(enum Move move);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef GUARD_BATTLE_END_TURN
|
||||
#define GUARD_BATTLE_END_TURN
|
||||
|
||||
u32 DoEndTurnEffects(void);
|
||||
bool32 DoEndTurnEffects(void);
|
||||
|
||||
#endif // GUARD_BATTLE_END_TURN
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ void AnimSetCenterToCornerVecX(struct Sprite *sprite);
|
|||
void BeginBattleIntroDummy(void);
|
||||
void BeginBattleIntro(void);
|
||||
void SwitchInClearSetData(u32 battler, struct Volatiles *volatilesCopy);
|
||||
const u8* FaintClearSetData(u32 battler);
|
||||
const u8 *FaintClearSetData(u32 battler);
|
||||
void BattleTurnPassed(void);
|
||||
u8 IsRunningFromBattleImpossible(u32 battler);
|
||||
void SwitchTwoBattlersInParty(u32 battler, u32 battler2);
|
||||
|
|
|
|||
|
|
@ -155,6 +155,15 @@ enum MoveCanceler
|
|||
MOVE_STEP_FAILURE, // Move failed, jump to script that handles the failure
|
||||
};
|
||||
|
||||
enum ImmunityHealStatusOutcome
|
||||
{
|
||||
IMMUNITY_NO_EFFECT,
|
||||
IMMUNITY_STATUS_CLEARED,
|
||||
IMMUNITY_CONFUSION_CLEARED,
|
||||
IMMUNITY_INFATUATION_CLEARED,
|
||||
IMMUNITY_TAUNT_CLEARED,
|
||||
};
|
||||
|
||||
extern const struct TypePower gNaturalGiftTable[];
|
||||
|
||||
struct BattleContext
|
||||
|
|
@ -232,7 +241,7 @@ uq4_12_t CalcTypeEffectivenessMultiplierHelper(enum Move move, enum Type moveTyp
|
|||
u32 GetCurrentBattleWeather(void);
|
||||
bool32 EndOrContinueWeather(void);
|
||||
bool32 IsUnnerveBlocked(u32 battler, u32 itemId);
|
||||
bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, enum Move move);
|
||||
bool32 IsAffectedByFollowMe(u32 battlerAtk, enum BattleSide defSide, enum Move move);
|
||||
void DetermineTarget(enum MoveTarget moveTarget, bool32 overwriteTarget);
|
||||
void HandleAction_UseMove(void);
|
||||
void HandleAction_Switch(void);
|
||||
|
|
@ -269,12 +278,11 @@ bool32 AreAllMovesUnusable(u32 battler);
|
|||
u8 GetImprisonedMovesCount(u32 battler, enum Move move);
|
||||
s32 GetDrainedBigRootHp(u32 battler, s32 hp);
|
||||
bool32 IsAbilityAndRecord(u32 battler, enum Ability battlerAbility, enum Ability abilityToCheck);
|
||||
u32 DoEndTurnEffects(void);
|
||||
bool32 HandleFaintedMonActions(void);
|
||||
void TryClearRageAndFuryCutter(void);
|
||||
enum MoveCanceler AtkCanceler_MoveSuccessOrder(void);
|
||||
bool32 HasNoMonsToSwitch(u32 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2);
|
||||
bool32 TryChangeBattleWeather(u32 battler, u32 battleWeatherId, u32 ability);
|
||||
bool32 TryChangeBattleWeather(u32 battler, u32 battleWeatherId, enum Ability ability);
|
||||
bool32 TryChangeBattleTerrain(u32 battler, u32 statusFlag);
|
||||
bool32 CanAbilityBlockMove(u32 battlerAtk, u32 battlerDef, enum Ability abilityAtk, enum Ability abilityDef, u32 move, enum ResultOption option);
|
||||
bool32 CanTargetBlockPranksterMove(struct BattleContext *ctx, s32 movePriority);
|
||||
|
|
@ -286,9 +294,9 @@ u32 AbilityBattleEffects(enum AbilityEffect caseID, u32 battler, enum Ability ab
|
|||
bool32 TryPrimalReversion(u32 battler);
|
||||
bool32 IsNeutralizingGasOnField(void);
|
||||
bool32 IsMoldBreakerTypeAbility(u32 battler, enum Ability ability);
|
||||
u32 GetBattlerAbilityIgnoreMoldBreaker(u32 battler);
|
||||
u32 GetBattlerAbilityNoAbilityShield(u32 battler);
|
||||
u32 GetBattlerAbilityInternal(u32 battler, bool32 ignoreMoldBreaker, bool32 noAbilityShield);
|
||||
enum Ability GetBattlerAbilityIgnoreMoldBreaker(u32 battler);
|
||||
enum Ability GetBattlerAbilityNoAbilityShield(u32 battler);
|
||||
enum Ability GetBattlerAbilityInternal(u32 battler, bool32 ignoreMoldBreaker, bool32 noAbilityShield);
|
||||
enum Ability GetBattlerAbility(u32 battler);
|
||||
u32 IsAbilityOnSide(u32 battler, enum Ability ability);
|
||||
u32 IsAbilityOnOpposingSide(u32 battler, enum Ability ability);
|
||||
|
|
@ -296,7 +304,7 @@ u32 IsAbilityOnField(enum Ability ability);
|
|||
u32 IsAbilityOnFieldExcept(u32 battler, enum Ability ability);
|
||||
u32 IsAbilityPreventingEscape(u32 battler);
|
||||
bool32 IsBattlerProtected(struct BattleContext *ctx);
|
||||
u32 GetProtectType(enum ProtectMethod method);
|
||||
enum ProtectType GetProtectType(enum ProtectMethod method);
|
||||
bool32 CanBattlerEscape(u32 battler); // no ability check
|
||||
void BattleScriptExecute(const u8 *BS_ptr);
|
||||
void BattleScriptPushCursorAndCallback(const u8 *BS_ptr);
|
||||
|
|
@ -304,7 +312,7 @@ void ClearVariousBattlerFlags(u32 battler);
|
|||
void HandleAction_RunBattleScript(void);
|
||||
u32 SetRandomTarget(u32 battler);
|
||||
u32 GetBattleMoveTarget(enum Move move, enum MoveTarget moveTarget);
|
||||
u8 GetAttackerObedienceForAction();
|
||||
enum Obedience GetAttackerObedienceForAction(void);
|
||||
enum HoldEffect GetBattlerHoldEffect(u32 battler);
|
||||
enum HoldEffect GetBattlerHoldEffectIgnoreAbility(u32 battler);
|
||||
enum HoldEffect GetBattlerHoldEffectIgnoreNegation(u32 battler);
|
||||
|
|
@ -335,7 +343,7 @@ void ActivateUltraBurst(u32 battler);
|
|||
bool32 IsBattlerMegaEvolved(u32 battler);
|
||||
bool32 IsBattlerPrimalReverted(u32 battler);
|
||||
bool32 IsBattlerUltraBursted(u32 battler);
|
||||
u16 GetBattleFormChangeTargetSpecies(u32 battler, enum FormChanges method);
|
||||
u32 GetBattleFormChangeTargetSpecies(u32 battler, enum FormChanges method);
|
||||
bool32 TryRevertPartyMonFormChange(u32 partyIndex);
|
||||
bool32 TryBattleFormChange(u32 battler, enum FormChanges method);
|
||||
bool32 DoBattlersShareType(u32 battler1, u32 battler2);
|
||||
|
|
@ -346,8 +354,8 @@ u32 GetIllusionMonSpecies(u32 battler);
|
|||
struct Pokemon *GetIllusionMonPtr(u32 battler);
|
||||
void ClearIllusionMon(u32 battler);
|
||||
u32 GetIllusionMonPartyId(struct Pokemon *party, struct Pokemon *mon, struct Pokemon *partnerMon, u32 battler);
|
||||
bool32 SetIllusionMon(struct Pokemon *mon, u32 battler);
|
||||
u32 TryImmunityAbilityHealStatus(u32 battler);
|
||||
void SetIllusionMon(struct Pokemon *mon, u32 battler);
|
||||
enum ImmunityHealStatusOutcome TryImmunityAbilityHealStatus(u32 battler);
|
||||
bool32 ShouldGetStatBadgeBoost(u16 flagId, u32 battler);
|
||||
uq4_12_t GetBadgeBoostModifier(void);
|
||||
enum DamageCategory GetBattleMoveCategory(enum Move move);
|
||||
|
|
@ -367,7 +375,7 @@ bool32 CanStealItem(u32 battlerStealing, u32 battlerItem, u16 item);
|
|||
void TrySaveExchangedItem(u32 battler, u16 stolenItem);
|
||||
bool32 IsBattlerAffectedByHazards(u32 battler, enum HoldEffect holdEffect, bool32 toxicSpikes);
|
||||
void SortBattlersBySpeed(u8 *battlers, bool32 slowToFast);
|
||||
bool32 CompareStat(u32 battler, enum Stat statId, u8 cmpTo, u8 cmpKind, enum Ability ability);
|
||||
bool32 CompareStat(u32 battler, enum Stat statId, u32 cmpTo, u32 cmpKind, enum Ability ability);
|
||||
bool32 BlocksPrankster(enum Move move, u32 battlerPrankster, u32 battlerDef, bool32 checkTarget);
|
||||
bool32 PickupHasValidTarget(u32 battler);
|
||||
bool32 CantPickupItem(u32 battler);
|
||||
|
|
@ -413,19 +421,19 @@ u32 CountBattlerStatIncreases(u32 battler, bool32 countEvasionAcc);
|
|||
bool32 BattlerHasCopyableChanges(u32 battler);
|
||||
bool32 ChangeTypeBasedOnTerrain(u32 battler);
|
||||
void RemoveConfusionStatus(u32 battler);
|
||||
u8 GetBattlerGender(u32 battler);
|
||||
u32 GetBattlerGender(u32 battler);
|
||||
bool32 AreBattlersOfOppositeGender(u32 battler1, u32 battler2);
|
||||
bool32 AreBattlersOfSameGender(u32 battler1, u32 battler2);
|
||||
u32 CalcSecondaryEffectChance(u32 battler, enum Ability battlerAbility, const struct AdditionalEffect *additionalEffect);
|
||||
bool32 MoveEffectIsGuaranteed(u32 battler, enum Ability battlerAbility, const struct AdditionalEffect *additionalEffect);
|
||||
void GetBattlerTypes(u32 battler, bool32 ignoreTera, enum Type types[static 3]);
|
||||
enum Type GetBattlerType(u32 battler, u32 typeIndex, bool32 ignoreTera);
|
||||
bool8 CanMonParticipateInSkyBattle(struct Pokemon *mon);
|
||||
bool32 CanMonParticipateInSkyBattle(struct Pokemon *mon);
|
||||
void RemoveBattlerType(u32 battler, enum Type type);
|
||||
enum Type GetBattleMoveType(enum Move move);
|
||||
void TryActivateSleepClause(u32 battler, u32 indexInParty);
|
||||
void TryDeactivateSleepClause(u32 battlerSide, u32 indexInParty);
|
||||
bool32 IsSleepClauseActiveForSide(u32 battlerSide);
|
||||
void TryDeactivateSleepClause(enum BattleSide battlerSide, u32 indexInParty);
|
||||
bool32 IsSleepClauseActiveForSide(enum BattleSide battlerSide);
|
||||
bool32 IsSleepClauseEnabled(void);
|
||||
void ClearDamageCalcResults(void);
|
||||
u32 DoesDestinyBondFail(u32 battler);
|
||||
|
|
@ -447,12 +455,12 @@ void BestowItem(u32 battlerAtk, u32 battlerDef);
|
|||
ARM_FUNC u32 GetBattlerVolatile(u32 battler, enum Volatile _volatile);
|
||||
void SetMonVolatile(u32 battler, enum Volatile _volatile, u32 newValue);
|
||||
bool32 ItemHealMonVolatile(u32 battler, u16 itemId);
|
||||
void PushHazardTypeToQueue(u32 side, enum Hazards hazardType);
|
||||
bool32 IsHazardOnSide(u32 side, enum Hazards hazardType);
|
||||
bool32 AreAnyHazardsOnSide(u32 side);
|
||||
void RemoveAllHazardsFromField(u32 side);
|
||||
bool32 IsHazardOnSideAndClear(u32 side, enum Hazards hazardType);
|
||||
void RemoveHazardFromField(u32 side, enum Hazards hazardType);
|
||||
void PushHazardTypeToQueue(enum BattleSide side, enum Hazards hazardType);
|
||||
bool32 IsHazardOnSide(enum BattleSide side, enum Hazards hazardType);
|
||||
bool32 AreAnyHazardsOnSide(enum BattleSide side);
|
||||
void RemoveAllHazardsFromField(enum BattleSide side);
|
||||
bool32 IsHazardOnSideAndClear(enum BattleSide side, enum Hazards hazardType);
|
||||
void RemoveHazardFromField(enum BattleSide side, enum Hazards hazardType);
|
||||
bool32 CanMoveSkipAccuracyCalc(u32 battlerAtk, u32 battlerDef, enum Ability abilityAtk, enum Ability abilityDef, enum Move move, enum ResultOption option);
|
||||
u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, enum Move move, enum Ability atkAbility, enum Ability defAbility, enum HoldEffect atkHoldEffect, enum HoldEffect defHoldEffect);
|
||||
bool32 IsSemiInvulnerable(u32 battler, enum SemiInvulnerableExclusion excludeCommander);
|
||||
|
|
@ -474,7 +482,7 @@ void ResetStartingStatuses(void);
|
|||
bool32 IsUsableWhileAsleepEffect(enum BattleMoveEffects effect);
|
||||
void SetWrapTurns(u32 battler, enum HoldEffect holdEffect);
|
||||
bool32 ChangeOrderTargetAfterAttacker(void);
|
||||
void TryUpdateEvolutionTracker(u32 evolutionCondition, u32 upAmount, enum Move usedMove);
|
||||
void TryUpdateEvolutionTracker(enum EvolutionConditions evolutionCondition, u32 upAmount, enum Move usedMove);
|
||||
bool32 CanUseMoveConsecutively(u32 battler);
|
||||
void TryResetConsecutiveUseCounter(u32 battler);
|
||||
void SetOrClearRageVolatile(void);
|
||||
|
|
|
|||
|
|
@ -493,7 +493,7 @@ u32 BattleAI_ChooseMoveIndex(u32 battler)
|
|||
return chosenMoveIndex;
|
||||
}
|
||||
|
||||
static void CopyBattlerDataToAIParty(u32 bPosition, u32 side)
|
||||
static void CopyBattlerDataToAIParty(u32 bPosition, enum BattleSide side)
|
||||
{
|
||||
u32 battler = GetBattlerAtPosition(bPosition);
|
||||
struct AiPartyMon *aiMon = &gAiPartyData->mons[side][gBattlerPartyIndexes[battler]];
|
||||
|
|
@ -555,7 +555,7 @@ void Ai_InitPartyStruct(void)
|
|||
|
||||
void Ai_UpdateSwitchInData(u32 battler)
|
||||
{
|
||||
u32 side = GetBattlerSide(battler);
|
||||
enum BattleSide side = GetBattlerSide(battler);
|
||||
struct AiPartyMon *aiMon = &gAiPartyData->mons[side][gBattlerPartyIndexes[battler]];
|
||||
|
||||
// See if the switched-in mon has been already in battle
|
||||
|
|
@ -5496,7 +5496,8 @@ static s32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, enum Move move
|
|||
IncreaseBurnScore(battlerAtk, battlerDef, move, &score);
|
||||
break;
|
||||
case MOVE_EFFECT_FLINCH:
|
||||
score += ShouldTryToFlinch(battlerAtk, battlerDef, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], move);
|
||||
if (ShouldTryToFlinch(battlerAtk, battlerDef, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], move))
|
||||
score += 2;
|
||||
break;
|
||||
case MOVE_EFFECT_PARALYSIS:
|
||||
IncreaseParalyzeScore(battlerAtk, battlerDef, move, &score);
|
||||
|
|
@ -5895,7 +5896,8 @@ static s32 AI_CalcAdditionalEffectScore(u32 battlerAtk, u32 battlerDef, enum Mov
|
|||
switch (additionalEffect->moveEffect)
|
||||
{
|
||||
case MOVE_EFFECT_FLINCH:
|
||||
score += ShouldTryToFlinch(battlerAtk, battlerDef, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], move);
|
||||
if (ShouldTryToFlinch(battlerAtk, battlerDef, aiData->abilities[battlerAtk], aiData->abilities[battlerDef], move))
|
||||
score += 2;
|
||||
break;
|
||||
case MOVE_EFFECT_SPD_MINUS_1:
|
||||
case MOVE_EFFECT_SPD_MINUS_2:
|
||||
|
|
@ -6726,9 +6728,9 @@ static s32 AI_PowerfulStatus(u32 battlerAtk, u32 battlerDef, enum Move move, s32
|
|||
return score;
|
||||
}
|
||||
|
||||
bool32 DoesSideHaveDamagingHazards(u32 side)
|
||||
bool32 DoesSideHaveDamagingHazards(enum BattleSide side)
|
||||
{
|
||||
for (u32 counter = 0; counter < HAZARDS_MAX_COUNT; counter++)
|
||||
for (enum Hazards counter = 0; counter < HAZARDS_MAX_COUNT; counter++)
|
||||
{
|
||||
switch (gBattleStruct->hazardsQueue[side][counter])
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1428,7 +1428,7 @@ static u32 GetSwitchinHazardsDamage(u32 battler)
|
|||
u32 maxHP = gBattleMons[battler].maxHP;
|
||||
enum Ability ability = gAiLogicData->abilities[battler], status = gBattleMons[battler].status1;
|
||||
u32 spikesDamage = 0, tSpikesDamage = 0, hazardDamage = 0;
|
||||
u32 side = GetBattlerSide(battler);
|
||||
enum BattleSide side = GetBattlerSide(battler);
|
||||
|
||||
// Check ways mon might avoid all hazards
|
||||
if (ability != ABILITY_MAGIC_GUARD || (heldItemEffect == HOLD_EFFECT_HEAVY_DUTY_BOOTS &&
|
||||
|
|
|
|||
|
|
@ -114,12 +114,12 @@ u32 AI_GetDamage(u32 battlerAtk, u32 battlerDef, u32 moveIndex, enum DamageCalcC
|
|||
}
|
||||
}
|
||||
|
||||
bool32 AI_IsFaster(u32 battlerAi, u32 battlerDef, u32 aiMove, u32 playerMove, enum ConsiderPriority considerPriority)
|
||||
bool32 AI_IsFaster(u32 battlerAi, u32 battlerDef, enum Move aiMove, enum Move playerMove, enum ConsiderPriority considerPriority)
|
||||
{
|
||||
return (AI_WhoStrikesFirst(battlerAi, battlerDef, aiMove, playerMove, considerPriority) == AI_IS_FASTER);
|
||||
}
|
||||
|
||||
bool32 AI_IsSlower(u32 battlerAi, u32 battlerDef, u32 aiMove, u32 playerMove, enum ConsiderPriority considerPriority)
|
||||
bool32 AI_IsSlower(u32 battlerAi, u32 battlerDef, enum Move aiMove, enum Move playerMove, enum ConsiderPriority considerPriority)
|
||||
{
|
||||
return (AI_WhoStrikesFirst(battlerAi, battlerDef, aiMove, playerMove, considerPriority) == AI_IS_SLOWER);
|
||||
}
|
||||
|
|
@ -1614,7 +1614,7 @@ void GetBestDmgMovesFromBattler(u32 battlerAtk, u32 battlerDef, enum DamageCalcC
|
|||
}
|
||||
}
|
||||
|
||||
u16 GetMoveIndex(u32 battler, enum Move move)
|
||||
u32 GetMoveIndex(u32 battler, enum Move move)
|
||||
{
|
||||
enum Move *moves = GetMovesArray(battler);
|
||||
|
||||
|
|
@ -1630,7 +1630,7 @@ u16 GetMoveIndex(u32 battler, enum Move move)
|
|||
bool32 IsBestDmgMove(u32 battlerAtk, u32 battlerDef, enum DamageCalcContext calcContext, enum Move move)
|
||||
{
|
||||
enum Move bestMoves[MAX_MON_MOVES] = {MOVE_NONE};
|
||||
u16 index = GetMoveIndex(battlerAtk, move);
|
||||
u32 index = GetMoveIndex(battlerAtk, move);
|
||||
|
||||
if (CanIndexMoveFaintTarget(battlerAtk, battlerDef, index, AI_ATTACKING))
|
||||
return TRUE;
|
||||
|
|
@ -2079,7 +2079,7 @@ bool32 IsHazardClearingMove(enum Move move)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsAllyProtectingFromMove(u32 battlerAtk, u32 attackerMove, enum Move allyMove)
|
||||
bool32 IsAllyProtectingFromMove(u32 battlerAtk, enum Move attackerMove, enum Move allyMove)
|
||||
{
|
||||
enum BattleMoveEffects effect = GetMoveEffect(allyMove);
|
||||
|
||||
|
|
@ -2356,9 +2356,9 @@ bool32 CanLowerStat(u32 battlerAtk, u32 battlerDef, struct AiLogicData *aiData,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
u32 IncreaseStatDownScore(u32 battlerAtk, u32 battlerDef, enum Stat stat)
|
||||
enum AIScore IncreaseStatDownScore(u32 battlerAtk, u32 battlerDef, enum Stat stat)
|
||||
{
|
||||
u32 tempScore = NO_INCREASE;
|
||||
enum AIScore tempScore = NO_INCREASE;
|
||||
|
||||
// Don't increase score if target is already -3 stat stage
|
||||
if (stat != STAT_SPEED && gBattleMons[battlerDef].statStages[stat] <= DEFAULT_STAT_STAGE - 3)
|
||||
|
|
@ -3705,7 +3705,7 @@ bool32 AI_CanBeInfatuated(u32 battlerAtk, u32 battlerDef, enum Ability defAbilit
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
u32 ShouldTryToFlinch(u32 battlerAtk, u32 battlerDef, enum Ability atkAbility, enum Ability defAbility, enum Move move)
|
||||
bool32 ShouldTryToFlinch(u32 battlerAtk, u32 battlerDef, enum Ability atkAbility, enum Ability defAbility, enum Move move)
|
||||
{
|
||||
enum Move predictedMoveSpeedCheck = GetIncomingMoveSpeedCheck(battlerAtk, battlerDef, gAiLogicData);
|
||||
if (((!IsMoldBreakerTypeAbility(battlerAtk, gAiLogicData->abilities[battlerAtk]) && (defAbility == ABILITY_SHIELD_DUST || defAbility == ABILITY_INNER_FOCUS))
|
||||
|
|
@ -3713,7 +3713,7 @@ u32 ShouldTryToFlinch(u32 battlerAtk, u32 battlerDef, enum Ability atkAbility, e
|
|||
|| DoesSubstituteBlockMove(battlerAtk, battlerDef, move)
|
||||
|| AI_IsSlower(battlerAtk, battlerDef, move, predictedMoveSpeedCheck, CONSIDER_PRIORITY))) // Opponent goes first
|
||||
{
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
else if ((atkAbility == ABILITY_SERENE_GRACE
|
||||
|| gBattleMons[battlerDef].status1 & STATUS1_PARALYSIS
|
||||
|
|
@ -3721,10 +3721,10 @@ u32 ShouldTryToFlinch(u32 battlerAtk, u32 battlerDef, enum Ability atkAbility, e
|
|||
|| gBattleMons[battlerDef].volatiles.confusionTurns > 0)
|
||||
|| ((AI_IsFaster(battlerAtk, battlerDef, move, predictedMoveSpeedCheck, CONSIDER_PRIORITY)) && CanTargetFaintAi(battlerDef, battlerAtk)))
|
||||
{
|
||||
return 2; // good idea to flinch
|
||||
return TRUE; // good idea to flinch
|
||||
}
|
||||
|
||||
return 0; // don't try to flinch
|
||||
return FALSE; // don't try to flinch
|
||||
}
|
||||
|
||||
bool32 ShouldTrap(u32 battlerAtk, u32 battlerDef, enum Move move)
|
||||
|
|
@ -4599,7 +4599,7 @@ bool32 SideHasMoveCategory(u32 battlerId, enum DamageCategory category)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsAbilityOfRating(enum Ability ability, s8 rating)
|
||||
bool32 IsAbilityOfRating(enum Ability ability, s32 rating)
|
||||
{
|
||||
if (gAbilitiesInfo[ability].aiRating >= rating)
|
||||
return TRUE;
|
||||
|
|
@ -4925,12 +4925,12 @@ bool32 HasHPForDamagingSetup(u32 battlerAtk, u32 battlerDef, u32 hpThreshold)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
u32 IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, enum StatChange statChange)
|
||||
enum AIScore IncreaseStatUpScore(u32 battlerAtk, u32 battlerDef, enum StatChange statChange)
|
||||
{
|
||||
return IncreaseStatUpScoreInternal(battlerAtk, battlerDef, statChange, TRUE);
|
||||
}
|
||||
|
||||
u32 IncreaseStatUpScoreContrary(u32 battlerAtk, u32 battlerDef, enum StatChange statChange)
|
||||
enum AIScore IncreaseStatUpScoreContrary(u32 battlerAtk, u32 battlerDef, enum StatChange statChange)
|
||||
{
|
||||
return IncreaseStatUpScoreInternal(battlerAtk, battlerDef, statChange, FALSE);
|
||||
}
|
||||
|
|
@ -6122,8 +6122,8 @@ s32 BattlerBenefitsFromAbilityScore(u32 battler, enum Ability ability, struct Ai
|
|||
}
|
||||
else
|
||||
{
|
||||
s32 score1 = IncreaseStatDownScore(battler, LEFT_FOE(battler), STAT_ATK);
|
||||
s32 score2 = IncreaseStatDownScore(battler, RIGHT_FOE(battler), STAT_ATK);
|
||||
enum AIScore score1 = IncreaseStatDownScore(battler, LEFT_FOE(battler), STAT_ATK);
|
||||
enum AIScore score2 = IncreaseStatDownScore(battler, RIGHT_FOE(battler), STAT_ATK);
|
||||
if (score1 > score2)
|
||||
return score1;
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1686,7 +1686,7 @@ static void ValueToCharDigits(u8 *charDigits, u32 newValue, u8 maxDigits)
|
|||
|
||||
static void ChangeHazardsValue(struct BattleDebugMenu *data)
|
||||
{
|
||||
u32 side = GetBattlerSide(data->battlerId);
|
||||
enum BattleSide side = GetBattlerSide(data->battlerId);
|
||||
|
||||
switch (data->currentSecondaryListItemId)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include "constants/items.h"
|
||||
#include "constants/moves.h"
|
||||
|
||||
static u32 GetMaxPowerTier(enum Move move);
|
||||
static enum MaxPowerTier GetMaxPowerTier(enum Move move);
|
||||
|
||||
struct GMaxMove
|
||||
{
|
||||
|
|
@ -144,7 +144,7 @@ void ApplyDynamaxHPMultiplier(struct Pokemon* mon)
|
|||
}
|
||||
|
||||
// Returns the non-Dynamax HP of a Pokemon.
|
||||
u16 GetNonDynamaxHP(u32 battler)
|
||||
u32 GetNonDynamaxHP(u32 battler)
|
||||
{
|
||||
if (GetActiveGimmick(battler) != GIMMICK_DYNAMAX || gBattleMons[battler].species == SPECIES_SHEDINJA)
|
||||
return gBattleMons[battler].hp;
|
||||
|
|
@ -158,7 +158,7 @@ u16 GetNonDynamaxHP(u32 battler)
|
|||
}
|
||||
|
||||
// Returns the non-Dynamax Max HP of a Pokemon.
|
||||
u16 GetNonDynamaxMaxHP(u32 battler)
|
||||
u32 GetNonDynamaxMaxHP(u32 battler)
|
||||
{
|
||||
if (GetActiveGimmick(battler) != GIMMICK_DYNAMAX || gBattleMons[battler].species == SPECIES_SHEDINJA)
|
||||
return gBattleMons[battler].maxHP;
|
||||
|
|
@ -234,7 +234,7 @@ bool32 IsMoveBlockedByMaxGuard(enum Move move)
|
|||
}
|
||||
}
|
||||
|
||||
static u16 GetTypeBasedMaxMove(u32 battler, enum Type type)
|
||||
static enum Move GetTypeBasedMaxMove(u32 battler, enum Type type)
|
||||
{
|
||||
// Gigantamax check
|
||||
u32 i;
|
||||
|
|
@ -288,9 +288,9 @@ enum Move GetMaxMove(u32 battler, enum Move baseMove)
|
|||
}
|
||||
|
||||
// First value is for Fighting, Poison and Multi-Attack. The second is for everything else.
|
||||
enum
|
||||
enum MaxPowerTier
|
||||
{
|
||||
MAX_POWER_TIER_1, // 70 or 90 damage
|
||||
MAX_POWER_TIER_1, // 70 or 90 damage
|
||||
MAX_POWER_TIER_2, // 75 or 100 damage
|
||||
MAX_POWER_TIER_3, // 80 or 110 damage
|
||||
MAX_POWER_TIER_4, // 85 or 120 damage
|
||||
|
|
@ -303,7 +303,6 @@ enum
|
|||
// Gets the base power of a Max Move.
|
||||
u32 GetMaxMovePower(enum Move move)
|
||||
{
|
||||
u32 tier;
|
||||
// G-Max Drum Solo, G-Max Hydrosnipe, and G-Max Fireball always have 160 base power.
|
||||
if (MoveHasAdditionalEffect(move, MOVE_EFFECT_FIXED_POWER))
|
||||
return 160;
|
||||
|
|
@ -318,7 +317,7 @@ u32 GetMaxMovePower(enum Move move)
|
|||
default: break;
|
||||
}
|
||||
|
||||
tier = GetMaxPowerTier(move);
|
||||
enum MaxPowerTier tier = GetMaxPowerTier(move);
|
||||
enum Type moveType = GetMoveType(move);
|
||||
if (moveType == TYPE_FIGHTING
|
||||
|| moveType == TYPE_POISON
|
||||
|
|
@ -354,7 +353,7 @@ u32 GetMaxMovePower(enum Move move)
|
|||
}
|
||||
}
|
||||
|
||||
static u32 GetMaxPowerTier(enum Move move)
|
||||
static enum MaxPowerTier GetMaxPowerTier(enum Move move)
|
||||
{
|
||||
u32 strikeCount = GetMoveStrikeCount(move);
|
||||
if (strikeCount >= 2 && strikeCount <= 5)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include "constants/items.h"
|
||||
#include "constants/moves.h"
|
||||
|
||||
static u32 GetBattlerSideForMessage(u32 side)
|
||||
static u32 GetBattlerSideForMessage(enum BattleSide side)
|
||||
{
|
||||
u32 battler = 0;
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ static bool32 HandleEndTurnWish(u32 battler)
|
|||
static bool32 HandleEndTurnFirstEventBlock(u32 battler)
|
||||
{
|
||||
bool32 effect = FALSE;
|
||||
u32 side;
|
||||
enum BattleSide side;
|
||||
|
||||
if (!IsBattlerAlive(battler))
|
||||
{
|
||||
|
|
@ -961,7 +961,7 @@ static bool32 HandleEndTurnSecondEventBlock(u32 battler)
|
|||
{
|
||||
bool32 effect = FALSE;
|
||||
|
||||
u32 side = gBattleStruct->eventState.battlerSide;
|
||||
enum BattleSide side = gBattleStruct->eventState.battlerSide;
|
||||
|
||||
switch (gBattleStruct->eventState.endTurnBlock)
|
||||
{
|
||||
|
|
@ -1483,9 +1483,9 @@ static bool32 (*const sEndTurnEffectHandlers[])(u32 battler) =
|
|||
[ENDTURN_TRAINER_PARTNER_SLIDES] = HandleEndTurnTrainerPartnerSlides,
|
||||
};
|
||||
|
||||
u32 DoEndTurnEffects(void)
|
||||
bool32 DoEndTurnEffects(void)
|
||||
{
|
||||
u32 battler = MAX_BATTLERS_COUNT;
|
||||
enum BattlerId battler = MAX_BATTLERS_COUNT;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -867,7 +867,7 @@ static enum MoveEndResult MoveEnd_MoveBlock(void)
|
|||
&& CanBattlerGetOrLoseItem(gBattlerTarget, gBattlerAttacker, gBattleMons[gBattlerTarget].item)
|
||||
&& !NoAliveMonsForEitherParty())
|
||||
{
|
||||
u32 side = GetBattlerSide(gBattlerTarget);
|
||||
enum BattleSide side = GetBattlerSide(gBattlerTarget);
|
||||
|
||||
if (GetBattlerAbility(gBattlerTarget) == ABILITY_STICKY_HOLD)
|
||||
{
|
||||
|
|
@ -893,7 +893,7 @@ static enum MoveEndResult MoveEnd_MoveBlock(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
GetBattlerPartyState(gBattlerTarget)->knockedOffItem = TRUE;
|
||||
GetBattlerPartyState(gBattlerTarget)->isKnockedOff = TRUE;
|
||||
}
|
||||
|
||||
BattleScriptCall(BattleScript_KnockedOff);
|
||||
|
|
@ -1481,7 +1481,7 @@ static enum MoveEndResult MoveEnd_Pickpocket(void)
|
|||
|
||||
if (IsBattlerAlive(gBattlerAttacker)
|
||||
&& gBattleMons[gBattlerAttacker].item != ITEM_NONE // Attacker must be holding an item
|
||||
&& !GetBattlerPartyState(gBattlerAttacker)->knockedOffItem // But not knocked off
|
||||
&& !GetBattlerPartyState(gBattlerAttacker)->isKnockedOff // But not knocked off
|
||||
&& IsMoveMakingContact(gBattlerAttacker, gBattlerTarget, GetBattlerAbility(gBattlerAttacker), GetBattlerHoldEffect(gBattlerAttacker), gCurrentMove) // Pickpocket requires contact
|
||||
&& !IsBattlerUnaffectedByMove(gBattlerTarget)) // Obviously attack needs to have worked
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2341,7 +2341,7 @@ void StealTargetItem(u8 battlerStealer, u8 itemBattler)
|
|||
|
||||
static inline bool32 TrySetReflect(u32 battler)
|
||||
{
|
||||
u32 side = GetBattlerSide(battler);
|
||||
enum BattleSide side = GetBattlerSide(battler);
|
||||
if (!(gSideStatuses[side] & SIDE_STATUS_REFLECT))
|
||||
{
|
||||
gSideStatuses[side] |= SIDE_STATUS_REFLECT;
|
||||
|
|
@ -2362,7 +2362,7 @@ static inline bool32 TrySetReflect(u32 battler)
|
|||
|
||||
static inline bool32 TrySetLightScreen(u32 battler)
|
||||
{
|
||||
u32 side = GetBattlerSide(battler);
|
||||
enum BattleSide side = GetBattlerSide(battler);
|
||||
if (!(gSideStatuses[side] & SIDE_STATUS_LIGHTSCREEN))
|
||||
{
|
||||
gSideStatuses[side] |= SIDE_STATUS_LIGHTSCREEN;
|
||||
|
|
@ -3981,7 +3981,7 @@ static void Cmd_jumpifsideaffecting(void)
|
|||
{
|
||||
CMD_ARGS(u8 battler, u32 flags, const u8 *jumpInstr);
|
||||
|
||||
u32 side = GetBattlerSide(GetBattlerForBattleScript(cmd->battler));
|
||||
enum BattleSide side = GetBattlerSide(GetBattlerForBattleScript(cmd->battler));
|
||||
|
||||
if (gSideStatuses[side] & cmd->flags)
|
||||
gBattlescriptCurrInstr = cmd->jumpInstr;
|
||||
|
|
@ -5238,7 +5238,7 @@ static void Cmd_switchindataupdate(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (GetBattlerPartyState(battler)->knockedOffItem)
|
||||
if (GetBattlerPartyState(battler)->isKnockedOff)
|
||||
{
|
||||
gBattleMons[battler].item = ITEM_NONE;
|
||||
}
|
||||
|
|
@ -7020,7 +7020,7 @@ static void RemoveAllTerrains(void)
|
|||
} \
|
||||
}
|
||||
|
||||
static bool32 DefogClearHazards(u32 saveBattler, u32 side, bool32 clear)
|
||||
static bool32 DefogClearHazards(u32 saveBattler, enum BattleSide side, bool32 clear)
|
||||
{
|
||||
if (!AreAnyHazardsOnSide(side))
|
||||
return FALSE;
|
||||
|
|
@ -10044,7 +10044,7 @@ static void Cmd_tryswapitems(void)
|
|||
| BATTLE_TYPE_FRONTIER
|
||||
| BATTLE_TYPE_SECRET_BASE
|
||||
| BATTLE_TYPE_RECORDED_LINK))
|
||||
&& (GetBattlerPartyState(gBattlerAttacker)->knockedOffItem || GetBattlerPartyState(gBattlerTarget)->knockedOffItem))
|
||||
&& (GetBattlerPartyState(gBattlerAttacker)->isKnockedOff || GetBattlerPartyState(gBattlerTarget)->isKnockedOff))
|
||||
{
|
||||
gBattlescriptCurrInstr = cmd->failInstr;
|
||||
}
|
||||
|
|
@ -12620,7 +12620,7 @@ void BS_SetPledgeStatus(void)
|
|||
NATIVE_ARGS(u8 battler, u32 sideStatus);
|
||||
|
||||
u32 battler = GetBattlerForBattleScript(cmd->battler);
|
||||
u32 side = GetBattlerSide(battler);
|
||||
enum BattleSide side = GetBattlerSide(battler);
|
||||
|
||||
gBattleStruct->pledgeMove = FALSE;
|
||||
if (!(gSideStatuses[side] & cmd->sideStatus))
|
||||
|
|
@ -14083,7 +14083,7 @@ void BS_ArenaJudgmentWindow(void)
|
|||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
|
||||
static void SetArenMonLostValues(u32 battler, u32 side)
|
||||
static void SetArenMonLostValues(u32 battler, enum BattleSide side)
|
||||
{
|
||||
gBattleMons[battler].hp = 0;
|
||||
gHitMarker |= HITMARKER_FAINTED(battler);
|
||||
|
|
@ -14392,7 +14392,7 @@ void BS_PlayMoveAnimation(void)
|
|||
void BS_SetLuckyChant(void)
|
||||
{
|
||||
NATIVE_ARGS(const u8 *failInstr);
|
||||
u32 side = GetBattlerSide(gBattlerAttacker);
|
||||
enum BattleSide side = GetBattlerSide(gBattlerAttacker);
|
||||
if (!(gSideStatuses[side] & SIDE_STATUS_LUCKY_CHANT))
|
||||
{
|
||||
gSideStatuses[side] |= SIDE_STATUS_LUCKY_CHANT;
|
||||
|
|
@ -14683,7 +14683,7 @@ void BS_TryBestow(void)
|
|||
|| gBattleMons[gBattlerTarget].item != ITEM_NONE
|
||||
|| !CanBattlerGetOrLoseItem(gBattlerAttacker, gBattlerTarget, gBattleMons[gBattlerAttacker].item)
|
||||
|| !CanBattlerGetOrLoseItem(gBattlerTarget, gBattlerAttacker, gBattleMons[gBattlerAttacker].item)
|
||||
|| GetBattlerPartyState(gBattlerTarget)->knockedOffItem)
|
||||
|| GetBattlerPartyState(gBattlerTarget)->isKnockedOff)
|
||||
{
|
||||
gBattlescriptCurrInstr = cmd->failInstr;
|
||||
}
|
||||
|
|
@ -14784,7 +14784,7 @@ void BS_TryTrainerSlideMsgLastOn(void)
|
|||
void BS_SetAuroraVeil(void)
|
||||
{
|
||||
NATIVE_ARGS();
|
||||
u32 side = GetBattlerSide(gBattlerAttacker);
|
||||
enum BattleSide side = GetBattlerSide(gBattlerAttacker);
|
||||
if (gSideStatuses[side] & SIDE_STATUS_AURORA_VEIL)
|
||||
{
|
||||
gBattleStruct->moveResultFlags[gBattlerTarget] |= MOVE_RESULT_MISSED;
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ static void SetDmgHazardsBattlescript(u8 battler, u8 multistringId)
|
|||
static bool32 TryHazardsOnSwitchIn(u32 battler, enum Ability ability, enum HoldEffect holdEffect, enum Hazards hazardType)
|
||||
{
|
||||
bool32 effect = FALSE;
|
||||
u32 side = GetBattlerSide(battler);
|
||||
enum BattleSide side = GetBattlerSide(battler);
|
||||
bool32 clearedToxicSpikes = FALSE;
|
||||
|
||||
switch (hazardType)
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ static inline bool32 IsDragonDartsSecondHit(u32 battlerAtk, enum Move move)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, enum Move move)
|
||||
bool32 IsAffectedByFollowMe(u32 battlerAtk, enum BattleSide defSide, enum Move move)
|
||||
{
|
||||
enum Ability ability = GetBattlerAbility(battlerAtk);
|
||||
enum BattleMoveEffects effect = GetMoveEffect(move);
|
||||
|
|
@ -418,7 +418,7 @@ static bool32 HandleMoveTargetRedirection(void)
|
|||
u32 redirectorOrderNum = MAX_BATTLERS_COUNT;
|
||||
enum MoveTarget moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);
|
||||
enum BattleMoveEffects moveEffect = GetMoveEffect(gCurrentMove);
|
||||
u32 side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker));
|
||||
enum BattleSide side = BATTLE_OPPOSITE(GetBattlerSide(gBattlerAttacker));
|
||||
|
||||
if (moveEffect == EFFECT_REFLECT_DAMAGE)
|
||||
{
|
||||
|
|
@ -1284,7 +1284,7 @@ bool32 IsLastMonToMove(u32 battler)
|
|||
|
||||
bool32 ShouldDefiantCompetitiveActivate(u32 battler, enum Ability ability)
|
||||
{
|
||||
u32 side = GetBattlerSide(battler);
|
||||
enum BattleSide side = GetBattlerSide(battler);
|
||||
if (ability != ABILITY_DEFIANT && ability != ABILITY_COMPETITIVE)
|
||||
return FALSE;
|
||||
// if an ally dropped the stats (except for Sticky Web), don't activate
|
||||
|
|
@ -3754,7 +3754,7 @@ bool32 HasNoMonsToSwitch(u32 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2
|
|||
}
|
||||
}
|
||||
|
||||
bool32 TryChangeBattleWeather(u32 battler, u32 battleWeatherId, u32 ability)
|
||||
bool32 TryChangeBattleWeather(u32 battler, u32 battleWeatherId, enum Ability ability)
|
||||
{
|
||||
if (gBattleWeather & sBattleWeatherInfo[battleWeatherId].flag)
|
||||
return FALSE;
|
||||
|
|
@ -4209,7 +4209,7 @@ static bool32 TryMagicCoat(struct BattleContext *ctx)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static u32 GetFirstBattlerOnSide(u32 side)
|
||||
static u32 GetFirstBattlerOnSide(enum BattleSide side)
|
||||
{
|
||||
for (u32 battler = 0; battler < gBattlersCount; battler++)
|
||||
{
|
||||
|
|
@ -4237,7 +4237,7 @@ static inline bool32 SetStartingFieldStatus(u32 flag, u32 message, u32 anim, u16
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static inline bool32 SetStartingSideStatus(u32 flag, u32 side, u32 message, u32 anim, u16 *timer, u16 time)
|
||||
static inline bool32 SetStartingSideStatus(u32 flag, enum BattleSide side, u32 message, u32 anim, u16 *timer, u16 time)
|
||||
{
|
||||
if (!(gSideStatuses[side] & flag))
|
||||
{
|
||||
|
|
@ -6156,7 +6156,7 @@ u32 AbilityBattleEffects(enum AbilityEffect caseID, u32 battler, enum Ability ab
|
|||
&& battlerDef != battler
|
||||
&& IsBattlerTurnDamaged(battlerDef)
|
||||
&& CanStealItem(battler, battlerDef, gBattleMons[battlerDef].item)
|
||||
&& !GetBattlerPartyState(battlerDef)->knockedOffItem
|
||||
&& !GetBattlerPartyState(battlerDef)->isKnockedOff
|
||||
&& !DoesSubstituteBlockMove(battler, battlerDef, move)
|
||||
&& (GetBattlerAbility(battlerDef) != ABILITY_STICKY_HOLD || !IsBattlerAlive(battlerDef)))
|
||||
{
|
||||
|
|
@ -6619,12 +6619,12 @@ static inline bool32 CanBreakThroughAbility(u32 battlerAtk, u32 battlerDef, bool
|
|||
return gBattleStruct->moldBreakerActive && gAbilitiesInfo[gBattleMons[battlerDef].ability].breakable;
|
||||
}
|
||||
|
||||
u32 GetBattlerAbilityNoAbilityShield(u32 battler)
|
||||
enum Ability GetBattlerAbilityNoAbilityShield(u32 battler)
|
||||
{
|
||||
return GetBattlerAbilityInternal(battler, FALSE, TRUE);
|
||||
}
|
||||
|
||||
u32 GetBattlerAbilityIgnoreMoldBreaker(u32 battler)
|
||||
enum Ability GetBattlerAbilityIgnoreMoldBreaker(u32 battler)
|
||||
{
|
||||
return GetBattlerAbilityInternal(battler, TRUE, FALSE);
|
||||
}
|
||||
|
|
@ -6634,7 +6634,7 @@ enum Ability GetBattlerAbility(u32 battler)
|
|||
return GetBattlerAbilityInternal(battler, FALSE, FALSE);
|
||||
}
|
||||
|
||||
u32 GetBattlerAbilityInternal(u32 battler, bool32 ignoreMoldBreaker, bool32 noAbilityShield)
|
||||
enum Ability GetBattlerAbilityInternal(u32 battler, bool32 ignoreMoldBreaker, bool32 noAbilityShield)
|
||||
{
|
||||
bool32 hasAbilityShield = !noAbilityShield && GetBattlerHoldEffectIgnoreAbility(battler) == HOLD_EFFECT_ABILITY_SHIELD;
|
||||
bool32 abilityCantBeSuppressed = gAbilitiesInfo[gBattleMons[battler].ability].cantBeSuppressed;
|
||||
|
|
@ -7016,7 +7016,7 @@ bool32 CanGetFrostbite(u32 battlerAtk, u32 battlerDef, enum Ability abilityDef)
|
|||
bool32 CanSetNonVolatileStatus(u32 battlerAtk, u32 battlerDef, enum Ability abilityAtk, enum Ability abilityDef, enum MoveEffect effect, enum ResultOption option)
|
||||
{
|
||||
const u8 *battleScript = NULL;
|
||||
u32 sideBattler = ABILITY_NONE;
|
||||
u32 sideBattler = 0;
|
||||
bool32 abilityAffected = FALSE;
|
||||
|
||||
// Move specific checks
|
||||
|
|
@ -7292,7 +7292,7 @@ u32 SetRandomTarget(u32 battlerAtk)
|
|||
u32 GetBattleMoveTarget(enum Move move, enum MoveTarget moveTarget)
|
||||
{
|
||||
u32 targetBattler = 0;
|
||||
u32 side;
|
||||
enum BattleSide side;
|
||||
enum Type moveType = GetBattleMoveType(move);
|
||||
|
||||
if (moveTarget == TARGET_NONE)
|
||||
|
|
@ -7379,7 +7379,7 @@ u32 GetBattleMoveTarget(enum Move move, enum MoveTarget moveTarget)
|
|||
return targetBattler;
|
||||
}
|
||||
|
||||
u8 GetAttackerObedienceForAction()
|
||||
enum Obedience GetAttackerObedienceForAction(void)
|
||||
{
|
||||
s32 rnd;
|
||||
s32 calc;
|
||||
|
|
@ -7620,7 +7620,7 @@ bool32 IsBattlerProtected(struct BattleContext *ctx)
|
|||
return isProtected;
|
||||
}
|
||||
|
||||
u32 GetProtectType(enum ProtectMethod method)
|
||||
enum ProtectType GetProtectType(enum ProtectMethod method)
|
||||
{
|
||||
switch (method)
|
||||
{
|
||||
|
|
@ -10299,7 +10299,7 @@ bool32 IsBattlerInTeraForm(u32 battler)
|
|||
}
|
||||
|
||||
// Returns SPECIES_NONE if no form change is possible
|
||||
u16 GetBattleFormChangeTargetSpecies(u32 battler, enum FormChanges method)
|
||||
u32 GetBattleFormChangeTargetSpecies(u32 battler, enum FormChanges method)
|
||||
{
|
||||
u32 i;
|
||||
u32 species = gBattleMons[battler].species;
|
||||
|
|
@ -10643,14 +10643,14 @@ u32 GetIllusionMonPartyId(struct Pokemon *party, struct Pokemon *mon, struct Pok
|
|||
return PARTY_SIZE;
|
||||
}
|
||||
|
||||
bool32 SetIllusionMon(struct Pokemon *mon, u32 battler)
|
||||
void SetIllusionMon(struct Pokemon *mon, u32 battler)
|
||||
{
|
||||
struct Pokemon *party, *partnerMon;
|
||||
u32 id;
|
||||
|
||||
gBattleStruct->illusion[battler].state = ILLUSION_OFF;
|
||||
if (GetMonAbility(mon) != ABILITY_ILLUSION)
|
||||
return FALSE;
|
||||
return;
|
||||
|
||||
party = GetBattlerParty(battler);
|
||||
|
||||
|
|
@ -10664,15 +10664,12 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battler)
|
|||
{
|
||||
gBattleStruct->illusion[battler].state = ILLUSION_ON;
|
||||
gBattleStruct->illusion[battler].mon = &party[id];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u32 TryImmunityAbilityHealStatus(u32 battler)
|
||||
enum ImmunityHealStatusOutcome TryImmunityAbilityHealStatus(u32 battler)
|
||||
{
|
||||
u32 effect = 0;
|
||||
enum ImmunityHealStatusOutcome outcome = IMMUNITY_NO_EFFECT;
|
||||
switch (GetBattlerAbilityIgnoreMoldBreaker(battler))
|
||||
{
|
||||
case ABILITY_IMMUNITY:
|
||||
|
|
@ -10680,21 +10677,21 @@ u32 TryImmunityAbilityHealStatus(u32 battler)
|
|||
if (gBattleMons[battler].status1 & (STATUS1_POISON | STATUS1_TOXIC_POISON | STATUS1_TOXIC_COUNTER))
|
||||
{
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_PoisonJpn);
|
||||
effect = 1;
|
||||
outcome = IMMUNITY_STATUS_CLEARED;
|
||||
}
|
||||
break;
|
||||
case ABILITY_OWN_TEMPO:
|
||||
if (gBattleMons[battler].volatiles.confusionTurns > 0)
|
||||
{
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_ConfusionJpn);
|
||||
effect = 2;
|
||||
outcome = IMMUNITY_CONFUSION_CLEARED;
|
||||
}
|
||||
break;
|
||||
case ABILITY_LIMBER:
|
||||
if (gBattleMons[battler].status1 & STATUS1_PARALYSIS)
|
||||
{
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_ParalysisJpn);
|
||||
effect = 1;
|
||||
outcome = IMMUNITY_STATUS_CLEARED;
|
||||
}
|
||||
break;
|
||||
case ABILITY_INSOMNIA:
|
||||
|
|
@ -10704,7 +10701,7 @@ u32 TryImmunityAbilityHealStatus(u32 battler)
|
|||
TryDeactivateSleepClause(GetBattlerSide(battler), gBattlerPartyIndexes[battler]);
|
||||
gBattleMons[battler].volatiles.nightmare = FALSE;
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_SleepJpn);
|
||||
effect = 1;
|
||||
outcome = IMMUNITY_STATUS_CLEARED;
|
||||
}
|
||||
break;
|
||||
case ABILITY_WATER_VEIL:
|
||||
|
|
@ -10713,53 +10710,52 @@ u32 TryImmunityAbilityHealStatus(u32 battler)
|
|||
if (gBattleMons[battler].status1 & STATUS1_BURN)
|
||||
{
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_BurnJpn);
|
||||
effect = 1;
|
||||
outcome = IMMUNITY_STATUS_CLEARED;
|
||||
}
|
||||
break;
|
||||
case ABILITY_MAGMA_ARMOR:
|
||||
if (gBattleMons[battler].status1 & (STATUS1_FREEZE | STATUS1_FROSTBITE))
|
||||
{
|
||||
StringCopy(gBattleTextBuff1, gStatusConditionString_IceJpn);
|
||||
effect = 1;
|
||||
outcome = IMMUNITY_STATUS_CLEARED;
|
||||
}
|
||||
break;
|
||||
case ABILITY_OBLIVIOUS:
|
||||
if (gBattleMons[battler].volatiles.infatuation)
|
||||
effect = 3;
|
||||
outcome = IMMUNITY_INFATUATION_CLEARED;
|
||||
else if (GetConfig(CONFIG_OBLIVIOUS_TAUNT) >= GEN_6 && gBattleMons[battler].volatiles.tauntTimer != 0)
|
||||
effect = 4;
|
||||
outcome = IMMUNITY_TAUNT_CLEARED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (effect != 0)
|
||||
switch (outcome)
|
||||
{
|
||||
switch (effect)
|
||||
{
|
||||
case 1: // status cleared
|
||||
gBattleMons[battler].status1 = 0;
|
||||
BattleScriptCall(BattleScript_AbilityCuredStatus);
|
||||
break;
|
||||
case 2: // get rid of confusion
|
||||
RemoveConfusionStatus(battler);
|
||||
BattleScriptCall(BattleScript_AbilityCuredStatus);
|
||||
break;
|
||||
case 3: // get rid of infatuation
|
||||
gBattleMons[battler].volatiles.infatuation = 0;
|
||||
BattleScriptCall(BattleScript_AbilityCuredStatus);
|
||||
break;
|
||||
case 4: // get rid of taunt
|
||||
gBattleMons[battler].volatiles.tauntTimer = 0;
|
||||
BattleScriptCall(BattleScript_AbilityCuredStatus);
|
||||
break;
|
||||
}
|
||||
|
||||
gBattleScripting.battler = gBattlerAbility = battler;
|
||||
BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1);
|
||||
MarkBattlerForControllerExec(battler);
|
||||
return effect;
|
||||
case IMMUNITY_STATUS_CLEARED:
|
||||
gBattleMons[battler].status1 = 0;
|
||||
BattleScriptCall(BattleScript_AbilityCuredStatus);
|
||||
break;
|
||||
case IMMUNITY_CONFUSION_CLEARED:
|
||||
RemoveConfusionStatus(battler);
|
||||
BattleScriptCall(BattleScript_AbilityCuredStatus);
|
||||
break;
|
||||
case IMMUNITY_INFATUATION_CLEARED:
|
||||
gBattleMons[battler].volatiles.infatuation = 0;
|
||||
BattleScriptCall(BattleScript_AbilityCuredStatus);
|
||||
break;
|
||||
case IMMUNITY_TAUNT_CLEARED:
|
||||
gBattleMons[battler].volatiles.tauntTimer = 0;
|
||||
BattleScriptCall(BattleScript_AbilityCuredStatus);
|
||||
break;
|
||||
case IMMUNITY_NO_EFFECT:
|
||||
return IMMUNITY_NO_EFFECT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
gBattleScripting.battler = gBattlerAbility = battler;
|
||||
BtlController_EmitSetMonData(battler, B_COMM_TO_CONTROLLER, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1);
|
||||
MarkBattlerForControllerExec(battler);
|
||||
return outcome;
|
||||
}
|
||||
|
||||
uq4_12_t GetBadgeBoostModifier(void)
|
||||
|
|
@ -11002,7 +10998,7 @@ bool32 CanStealItem(u32 battlerStealing, u32 battlerItem, u16 item)
|
|||
| BATTLE_TYPE_LINK
|
||||
| BATTLE_TYPE_RECORDED_LINK
|
||||
| BATTLE_TYPE_SECRET_BASE))
|
||||
&& GetBattlerPartyState(battlerStealing)->knockedOffItem)
|
||||
&& GetBattlerPartyState(battlerStealing)->isKnockedOff)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -11058,10 +11054,10 @@ bool32 IsSheerForceAffected(enum Move move, enum Ability ability)
|
|||
}
|
||||
|
||||
// This function is the body of "jumpifstat", but can be used dynamically in a function
|
||||
bool32 CompareStat(u32 battler, enum Stat statId, u8 cmpTo, u8 cmpKind, enum Ability ability)
|
||||
bool32 CompareStat(u32 battler, enum Stat statId, u32 cmpTo, u32 cmpKind, enum Ability ability)
|
||||
{
|
||||
bool32 ret = FALSE;
|
||||
u8 statValue = gBattleMons[battler].statStages[statId];
|
||||
u32 statValue = gBattleMons[battler].statStages[statId];
|
||||
|
||||
// Because this command is used as a way of checking if a stat can be lowered/raised,
|
||||
// we need to do some modification at run-time.
|
||||
|
|
@ -11272,7 +11268,7 @@ void RemoveConfusionStatus(u32 battler)
|
|||
gBattleMons[battler].volatiles.infiniteConfusion = FALSE;
|
||||
}
|
||||
|
||||
u8 GetBattlerGender(u32 battler)
|
||||
u32 GetBattlerGender(u32 battler)
|
||||
{
|
||||
return GetGenderFromSpeciesAndPersonality(gBattleMons[battler].species,
|
||||
gBattleMons[battler].personality);
|
||||
|
|
@ -11280,16 +11276,16 @@ u8 GetBattlerGender(u32 battler)
|
|||
|
||||
bool32 AreBattlersOfOppositeGender(u32 battler1, u32 battler2)
|
||||
{
|
||||
u8 gender1 = GetBattlerGender(battler1);
|
||||
u8 gender2 = GetBattlerGender(battler2);
|
||||
u32 gender1 = GetBattlerGender(battler1);
|
||||
u32 gender2 = GetBattlerGender(battler2);
|
||||
|
||||
return (gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS && gender1 != gender2);
|
||||
}
|
||||
|
||||
bool32 AreBattlersOfSameGender(u32 battler1, u32 battler2)
|
||||
{
|
||||
u8 gender1 = GetBattlerGender(battler1);
|
||||
u8 gender2 = GetBattlerGender(battler2);
|
||||
u32 gender1 = GetBattlerGender(battler1);
|
||||
u32 gender2 = GetBattlerGender(battler2);
|
||||
|
||||
return (gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS && gender1 == gender2);
|
||||
}
|
||||
|
|
@ -11394,14 +11390,14 @@ bool32 MoveIsAffectedBySheerForce(enum Move move)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 CanMonParticipateInSkyBattle(struct Pokemon *mon)
|
||||
bool32 CanMonParticipateInSkyBattle(struct Pokemon *mon)
|
||||
{
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
u16 monAbilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM);
|
||||
u32 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
u32 monAbilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM);
|
||||
|
||||
bool8 hasLevitateAbility = GetSpeciesAbility(species, monAbilityNum) == ABILITY_LEVITATE;
|
||||
bool8 isFlyingType = GetSpeciesType(species, 0) == TYPE_FLYING || GetSpeciesType(species, 1) == TYPE_FLYING;
|
||||
bool8 monIsValidAndNotEgg = GetMonData(mon, MON_DATA_SANITY_HAS_SPECIES) && !GetMonData(mon, MON_DATA_IS_EGG);
|
||||
bool32 hasLevitateAbility = GetSpeciesAbility(species, monAbilityNum) == ABILITY_LEVITATE;
|
||||
bool32 isFlyingType = GetSpeciesType(species, 0) == TYPE_FLYING || GetSpeciesType(species, 1) == TYPE_FLYING;
|
||||
bool32 monIsValidAndNotEgg = GetMonData(mon, MON_DATA_SANITY_HAS_SPECIES) && !GetMonData(mon, MON_DATA_IS_EGG);
|
||||
|
||||
if (monIsValidAndNotEgg)
|
||||
{
|
||||
|
|
@ -11558,7 +11554,7 @@ void TryActivateSleepClause(u32 battler, u32 indexInParty)
|
|||
gBattleStruct->monCausingSleepClause[GetBattlerSide(battler)] = indexInParty;
|
||||
}
|
||||
|
||||
void TryDeactivateSleepClause(u32 battlerSide, u32 indexInParty)
|
||||
void TryDeactivateSleepClause(enum BattleSide battlerSide, u32 indexInParty)
|
||||
{
|
||||
// If the pokemon on the given side at the given index in the party is the one causing Sleep Clause to be active,
|
||||
// set monCausingSleepClause[battlerSide] = PARTY_SIZE, which means Sleep Clause is not active for the given side
|
||||
|
|
@ -11566,7 +11562,7 @@ void TryDeactivateSleepClause(u32 battlerSide, u32 indexInParty)
|
|||
gBattleStruct->monCausingSleepClause[battlerSide] = PARTY_SIZE;
|
||||
}
|
||||
|
||||
bool32 IsSleepClauseActiveForSide(u32 battlerSide)
|
||||
bool32 IsSleepClauseActiveForSide(enum BattleSide battlerSide)
|
||||
{
|
||||
// If monCausingSleepClause[battlerSide] == PARTY_SIZE, Sleep Clause is not active for the given side.
|
||||
// If monCausingSleepClause[battlerSide] < PARTY_SIZE, it means it is storing the index of the mon that is causing Sleep Clause to be active,
|
||||
|
|
@ -11914,13 +11910,13 @@ bool32 ItemHealMonVolatile(u32 battler, u16 itemId)
|
|||
}
|
||||
|
||||
// Hazards are added to a queue and applied based in order (FIFO)
|
||||
void PushHazardTypeToQueue(u32 side, enum Hazards hazardType)
|
||||
void PushHazardTypeToQueue(enum BattleSide side, enum Hazards hazardType)
|
||||
{
|
||||
if (!IsHazardOnSide(side, hazardType)) // Failsafe
|
||||
gBattleStruct->hazardsQueue[side][gBattleStruct->numHazards[side]++] = hazardType;
|
||||
}
|
||||
|
||||
bool32 IsHazardOnSide(u32 side, enum Hazards hazardType)
|
||||
bool32 IsHazardOnSide(enum BattleSide side, enum Hazards hazardType)
|
||||
{
|
||||
for (u32 i = 0; i < HAZARDS_MAX_COUNT; i++)
|
||||
{
|
||||
|
|
@ -11930,12 +11926,12 @@ bool32 IsHazardOnSide(u32 side, enum Hazards hazardType)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 AreAnyHazardsOnSide(u32 side)
|
||||
bool32 AreAnyHazardsOnSide(enum BattleSide side)
|
||||
{
|
||||
return gBattleStruct->numHazards[side] > 0;
|
||||
}
|
||||
|
||||
bool32 IsHazardOnSideAndClear(u32 side, enum Hazards hazardType)
|
||||
bool32 IsHazardOnSideAndClear(enum BattleSide side, enum Hazards hazardType)
|
||||
{
|
||||
for (u32 i = 0; i < HAZARDS_MAX_COUNT; i++)
|
||||
{
|
||||
|
|
@ -11952,7 +11948,7 @@ bool32 IsHazardOnSideAndClear(u32 side, enum Hazards hazardType)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void RemoveAllHazardsFromField(u32 side)
|
||||
void RemoveAllHazardsFromField(enum BattleSide side)
|
||||
{
|
||||
gSideTimers[side].spikesAmount = 0;
|
||||
gSideTimers[side].toxicSpikesAmount = 0;
|
||||
|
|
@ -11961,7 +11957,7 @@ void RemoveAllHazardsFromField(u32 side)
|
|||
gBattleStruct->hazardsQueue[side][i] = HAZARDS_NONE;
|
||||
}
|
||||
|
||||
void RemoveHazardFromField(u32 side, enum Hazards hazardType)
|
||||
void RemoveHazardFromField(enum BattleSide side, enum Hazards hazardType)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < HAZARDS_MAX_COUNT; i++)
|
||||
|
|
@ -12629,7 +12625,7 @@ bool32 ChangeOrderTargetAfterAttacker(void)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void TryUpdateEvolutionTracker(u32 evolutionCondition, u32 upAmount, enum Move usedMove)
|
||||
void TryUpdateEvolutionTracker(enum EvolutionConditions evolutionCondition, u32 upAmount, enum Move usedMove)
|
||||
{
|
||||
u32 i, j;
|
||||
|
||||
|
|
@ -12678,6 +12674,9 @@ void TryUpdateEvolutionTracker(u32 evolutionCondition, u32 upAmount, enum Move u
|
|||
&& GetMonData(monDef, MON_DATA_HELD_ITEM) == evolutions[i].params[j].arg2)
|
||||
SetMonData(monAtk, MON_DATA_EVOLUTION_TRACKER, &val);
|
||||
break;
|
||||
default:
|
||||
assertf(FALSE, "evolution condition %d is not handled within TryUpdateEvolutionTracker", evolutionCondition) {}
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3591,7 +3591,7 @@ void PokemonToBattleMon(struct Pokemon *src, struct BattlePokemon *dst)
|
|||
|
||||
void CopyPartyMonToBattleData(u32 battler, u32 partyIndex)
|
||||
{
|
||||
u32 side = GetBattlerSide(battler);
|
||||
enum BattleSide side = GetBattlerSide(battler);
|
||||
struct Pokemon *party = GetSideParty(side);
|
||||
PokemonToBattleMon(&party[partyIndex], &gBattleMons[battler]);
|
||||
gBattleStruct->battlerState[battler].hpOnSwitchout = gBattleMons[battler].hp;
|
||||
|
|
|
|||
|
|
@ -41,17 +41,17 @@
|
|||
#include "battle_message.h"
|
||||
|
||||
static u32 BattlerHPPercentage(u32 battler, u32 operation, u32 threshold);
|
||||
static u32 GetPartyMonCount(u32 firstId, u32 lastId, u32 side, bool32 onlyAlive);
|
||||
static u32 GetPartyMonCount(u32 firstId, u32 lastId, enum BattleSide side, bool32 onlyAlive);
|
||||
static bool32 DoesTrainerHaveSlideMessage(enum DifficultyLevel difficulty, u32 trainerId, u32 slideId);
|
||||
static bool32 ShouldRunTrainerSlidePlayerLandsFirstCriticalHit(u32 battler, enum TrainerSlideType slideId);
|
||||
static bool32 ShouldRunTrainerSlideEnemyLandsFirstCriticalHit(u32 battler, enum TrainerSlideType slideId);
|
||||
static bool32 ShouldRunTrainerSlidePlayerLandsFirstSuperEffectiveHit(u32 battler, enum TrainerSlideType slideId);
|
||||
static bool32 ShouldRunTrainerSlidePlayerLandsFirstSTABMove(u32 firstId, u32 lastId, u32 side, u32 battler, enum TrainerSlideType slideId);
|
||||
static bool32 ShouldRunTrainerSlidePlayerLandsFirstDown(u32 firstId, u32 lastId, u32 side);
|
||||
static bool32 ShouldRunTrainerSlideEnemyMonUnaffected(u32 firstId, u32 lastId, u32 side, u32 battler, enum TrainerSlideType slideId);
|
||||
static bool32 ShouldRunTrainerSlidePlayerLandsFirstSTABMove(u32 firstId, u32 lastId, enum BattleSide side, u32 battler, enum TrainerSlideType slideId);
|
||||
static bool32 ShouldRunTrainerSlidePlayerLandsFirstDown(u32 firstId, u32 lastId, enum BattleSide side);
|
||||
static bool32 ShouldRunTrainerSlideEnemyMonUnaffected(u32 firstId, u32 lastId, enum BattleSide side, u32 battler, enum TrainerSlideType slideId);
|
||||
static bool32 ShouldRunTrainerSlideLastSwitchIn(u32 battler);
|
||||
static bool32 ShouldRunTrainerSlideLastHalfHP(u32 firstId, u32 lastId, u32 side, u32 battler);
|
||||
static bool32 ShouldRunTrainerSlideLastLowHp(u32 firstId, u32 lastId, u32 side, u32 battler);
|
||||
static bool32 ShouldRunTrainerSlideLastHalfHP(u32 firstId, u32 lastId, enum BattleSide side, u32 battler);
|
||||
static bool32 ShouldRunTrainerSlideLastLowHp(u32 firstId, u32 lastId, enum BattleSide side, u32 battler);
|
||||
static void SetTrainerSlideParameters(u32 battler, u32* firstId, u32* lastId, u32* trainerId, u32* retValue);
|
||||
static bool32 IsSlideInitalizedOrPlayed(u32 battler, enum TrainerSlideType slideId);
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ static u32 BattlerHPPercentage(u32 battler, u32 operation, u32 threshold)
|
|||
|
||||
static const s8 sMultiBattleOrder[] = {0, 2, 3, 1, 4, 5};
|
||||
|
||||
static u32 GetPartyMonCount(u32 firstId, u32 lastId, u32 side, bool32 onlyAlive)
|
||||
static u32 GetPartyMonCount(u32 firstId, u32 lastId, enum BattleSide side, bool32 onlyAlive)
|
||||
{
|
||||
u32 count = 0;
|
||||
struct Pokemon* party = (side == B_SIDE_OPPONENT ? gEnemyParty : gPlayerParty);
|
||||
|
|
@ -201,7 +201,7 @@ static bool32 ShouldRunTrainerSlidePlayerLandsFirstSuperEffectiveHit(u32 battler
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static bool32 ShouldRunTrainerSlidePlayerLandsFirstSTABMove(u32 firstId, u32 lastId, u32 side, u32 battler, enum TrainerSlideType slideId)
|
||||
static bool32 ShouldRunTrainerSlidePlayerLandsFirstSTABMove(u32 firstId, u32 lastId, enum BattleSide side, u32 battler, enum TrainerSlideType slideId)
|
||||
{
|
||||
if (!IsTrainerSlideInitialized(battler, slideId))
|
||||
return FALSE;
|
||||
|
|
@ -212,12 +212,12 @@ static bool32 ShouldRunTrainerSlidePlayerLandsFirstSTABMove(u32 firstId, u32 las
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static bool32 ShouldRunTrainerSlidePlayerLandsFirstDown(u32 firstId, u32 lastId, u32 side)
|
||||
static bool32 ShouldRunTrainerSlidePlayerLandsFirstDown(u32 firstId, u32 lastId, enum BattleSide side)
|
||||
{
|
||||
return ((GetPartyMonCount(firstId, lastId, side, TRUE) == (GetPartyMonCount(firstId, lastId, side, FALSE) - 1)));
|
||||
}
|
||||
|
||||
static bool32 ShouldRunTrainerSlideEnemyMonUnaffected(u32 firstId, u32 lastId, u32 side, u32 battler, enum TrainerSlideType slideId)
|
||||
static bool32 ShouldRunTrainerSlideEnemyMonUnaffected(u32 firstId, u32 lastId, enum BattleSide side, u32 battler, enum TrainerSlideType slideId)
|
||||
{
|
||||
if (!IsTrainerSlideInitialized(battler, slideId))
|
||||
return FALSE;
|
||||
|
|
@ -230,7 +230,7 @@ static bool32 ShouldRunTrainerSlideLastSwitchIn(u32 battler)
|
|||
return !CanBattlerSwitch(battler);
|
||||
}
|
||||
|
||||
static bool32 ShouldRunTrainerSlideLastHalfHP(u32 firstId, u32 lastId, u32 side, u32 battler)
|
||||
static bool32 ShouldRunTrainerSlideLastHalfHP(u32 firstId, u32 lastId, enum BattleSide side, u32 battler)
|
||||
{
|
||||
if (GetPartyMonCount(firstId, lastId, side, TRUE) != 1)
|
||||
return FALSE;
|
||||
|
|
@ -241,7 +241,7 @@ static bool32 ShouldRunTrainerSlideLastHalfHP(u32 firstId, u32 lastId, u32 side,
|
|||
return (BattlerHPPercentage(battler, GREATER_THAN, 4));
|
||||
}
|
||||
|
||||
static bool32 ShouldRunTrainerSlideLastLowHp(u32 firstId, u32 lastId, u32 side, u32 battler)
|
||||
static bool32 ShouldRunTrainerSlideLastLowHp(u32 firstId, u32 lastId, enum BattleSide side, u32 battler)
|
||||
{
|
||||
if (GetPartyMonCount(firstId, lastId, side, TRUE) != 1)
|
||||
return FALSE;
|
||||
|
|
@ -291,7 +291,7 @@ static void SetTrainerSlideParameters(u32 battler, u32* firstId, u32* lastId, u3
|
|||
enum TrainerSlideTargets ShouldDoTrainerSlide(u32 battler, enum TrainerSlideType slideId)
|
||||
{
|
||||
u32 firstId = 0, lastId = PARTY_SIZE, trainerId = 0;
|
||||
u32 side = GetBattlerSide(battler);
|
||||
enum BattleSide side = GetBattlerSide(battler);
|
||||
u32 retValue = TRAINER_SLIDE_TARGET_TRAINER_A;
|
||||
bool32 shouldRun = FALSE;
|
||||
|
||||
|
|
|
|||
|
|
@ -2733,7 +2733,7 @@ void MoveGetIdAndSlot(s32 battlerId, struct MoveContext *ctx, u32 *moveId, u32 *
|
|||
u32 item = GetMonData(mon, MON_DATA_HELD_ITEM);
|
||||
enum HoldEffect holdEffect = GetItemHoldEffect(item);
|
||||
u32 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||
u32 side = battlerId & BIT_SIDE;
|
||||
enum BattleSide side = battlerId & BIT_SIDE;
|
||||
|
||||
// Check invalid item usage.
|
||||
INVALID_IF(ctx->gimmick == GIMMICK_MEGA && holdEffect != HOLD_EFFECT_MEGA_STONE && species != SPECIES_RAYQUAZA, "Cannot Mega Evolve without a Mega Stone");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user