mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
optimize battle util and item functions by setting u32 variables
This commit is contained in:
parent
44bd830d2a
commit
9778587935
@ -65,7 +65,6 @@ s8 GetMovePriority(u32 battlerId, u16 move);
|
|||||||
u8 GetWhoStrikesFirst(u8 battlerId1, u8 battlerId2, bool8 ignoreChosenMoves);
|
u8 GetWhoStrikesFirst(u8 battlerId1, u8 battlerId2, bool8 ignoreChosenMoves);
|
||||||
void RunBattleScriptCommands_PopCallbacksStack(void);
|
void RunBattleScriptCommands_PopCallbacksStack(void);
|
||||||
void RunBattleScriptCommands(void);
|
void RunBattleScriptCommands(void);
|
||||||
bool8 TryRunFromBattle(u8 battlerId);
|
|
||||||
void SpecialStatusesClear(void);
|
void SpecialStatusesClear(void);
|
||||||
void SetTypeBeforeUsingMove(u16 move, u32 battlerAtk);
|
void SetTypeBeforeUsingMove(u16 move, u32 battlerAtk);
|
||||||
bool32 IsWildMonSmart(void);
|
bool32 IsWildMonSmart(void);
|
||||||
|
@ -101,6 +101,7 @@ bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move);
|
|||||||
void HandleAction_UseMove(void);
|
void HandleAction_UseMove(void);
|
||||||
void HandleAction_Switch(void);
|
void HandleAction_Switch(void);
|
||||||
void HandleAction_UseItem(void);
|
void HandleAction_UseItem(void);
|
||||||
|
bool32 TryRunFromBattle(u32 battler);
|
||||||
void HandleAction_Run(void);
|
void HandleAction_Run(void);
|
||||||
void HandleAction_WatchesCarefully(void);
|
void HandleAction_WatchesCarefully(void);
|
||||||
void HandleAction_SafariZoneBallThrow(void);
|
void HandleAction_SafariZoneBallThrow(void);
|
||||||
@ -115,59 +116,59 @@ u8 GetBattlerForBattleScript(u8 caseId);
|
|||||||
void PressurePPLose(u8 target, u8 attacker, u16 move);
|
void PressurePPLose(u8 target, u8 attacker, u16 move);
|
||||||
void PressurePPLoseOnUsingPerishSong(u8 attacker);
|
void PressurePPLoseOnUsingPerishSong(u8 attacker);
|
||||||
void PressurePPLoseOnUsingImprison(u8 attacker);
|
void PressurePPLoseOnUsingImprison(u8 attacker);
|
||||||
bool32 IsBattlerMarkedForControllerExec(u8 battler);
|
bool32 IsBattlerMarkedForControllerExec(u32 battler);
|
||||||
void MarkBattlerForControllerExec(u8 battler);
|
void MarkBattlerForControllerExec(u32 battler);
|
||||||
void MarkBattlerReceivedLinkData(u8 battler);
|
void MarkBattlerReceivedLinkData(u32 battler);
|
||||||
void CancelMultiTurnMoves(u8 battler);
|
void CancelMultiTurnMoves(u32 battler);
|
||||||
bool8 WasUnableToUseMove(u8 battler);
|
bool32 WasUnableToUseMove(u32 battler);
|
||||||
void PrepareStringBattle(u16 stringId, u8 battler);
|
void PrepareStringBattle(u16 stringId, u32 battler);
|
||||||
void ResetSentPokesToOpponentValue(void);
|
void ResetSentPokesToOpponentValue(void);
|
||||||
void OpponentSwitchInResetSentPokesToOpponentValue(u8 battler);
|
void OpponentSwitchInResetSentPokesToOpponentValue(u32 battler);
|
||||||
void UpdateSentPokesToOpponentValue(u8 battler);
|
void UpdateSentPokesToOpponentValue(u32 battler);
|
||||||
void BattleScriptPush(const u8 *bsPtr);
|
void BattleScriptPush(const u8 *bsPtr);
|
||||||
void BattleScriptPushCursor(void);
|
void BattleScriptPushCursor(void);
|
||||||
void BattleScriptPop(void);
|
void BattleScriptPop(void);
|
||||||
u32 TrySetCantSelectMoveBattleScript(u32 battler);
|
u32 TrySetCantSelectMoveBattleScript(u32 battler);
|
||||||
u8 CheckMoveLimitations(u8 battler, u8 unusableMoves, u16 check);
|
u8 CheckMoveLimitations(u32 battler, u8 unusableMoves, u16 check);
|
||||||
bool32 AreAllMovesUnusable(u32 battler);
|
bool32 AreAllMovesUnusable(u32 battler);
|
||||||
u8 GetImprisonedMovesCount(u8 battler, u16 move);
|
u8 GetImprisonedMovesCount(u32 battler, u16 move);
|
||||||
u8 DoFieldEndTurnEffects(void);
|
u8 DoFieldEndTurnEffects(void);
|
||||||
s32 GetDrainedBigRootHp(u32 battler, s32 hp);
|
s32 GetDrainedBigRootHp(u32 battler, s32 hp);
|
||||||
u8 DoBattlerEndTurnEffects(void);
|
u8 DoBattlerEndTurnEffects(void);
|
||||||
bool8 HandleWishPerishSongOnTurnEnd(void);
|
bool32 HandleWishPerishSongOnTurnEnd(void);
|
||||||
bool8 HandleFaintedMonActions(void);
|
bool32 HandleFaintedMonActions(void);
|
||||||
void TryClearRageAndFuryCutter(void);
|
void TryClearRageAndFuryCutter(void);
|
||||||
u8 AtkCanceller_UnableToUseMove(u32 moveType);
|
u8 AtkCanceller_UnableToUseMove(u32 moveType);
|
||||||
void SetAtkCancellerForCalledMove(void);
|
void SetAtkCancellerForCalledMove(void);
|
||||||
u8 AtkCanceller_UnableToUseMove2(void);
|
u8 AtkCanceller_UnableToUseMove2(void);
|
||||||
bool8 HasNoMonsToSwitch(u8 battler, u8 r1, u8 r2);
|
bool32 HasNoMonsToSwitch(u32 battler, u8 r1, u8 r2);
|
||||||
bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility);
|
bool32 TryChangeBattleWeather(u32 battler, u32 weatherEnumId, bool32 viaAbility);
|
||||||
u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 moveArg);
|
u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 moveArg);
|
||||||
bool32 TryPrimalReversion(u8 battler);
|
bool32 TryPrimalReversion(u32 battler);
|
||||||
bool32 IsNeutralizingGasOnField(void);
|
bool32 IsNeutralizingGasOnField(void);
|
||||||
u32 GetBattlerAbility(u8 battler);
|
u32 GetBattlerAbility(u32 battler);
|
||||||
u32 IsAbilityOnSide(u32 battler, u32 ability);
|
u32 IsAbilityOnSide(u32 battler, u32 ability);
|
||||||
u32 IsAbilityOnOpposingSide(u32 battler, u32 ability);
|
u32 IsAbilityOnOpposingSide(u32 battler, u32 ability);
|
||||||
u32 IsAbilityOnField(u32 ability);
|
u32 IsAbilityOnField(u32 ability);
|
||||||
u32 IsAbilityOnFieldExcept(u32 battler, u32 ability);
|
u32 IsAbilityOnFieldExcept(u32 battler, u32 ability);
|
||||||
u32 IsAbilityPreventingEscape(u32 battler);
|
u32 IsAbilityPreventingEscape(u32 battler);
|
||||||
bool32 IsBattlerProtected(u8 battler, u16 move);
|
bool32 IsBattlerProtected(u32 battler, u32 move);
|
||||||
bool32 CanBattlerEscape(u32 battler); // no ability check
|
bool32 CanBattlerEscape(u32 battler); // no ability check
|
||||||
void BattleScriptExecute(const u8 *BS_ptr);
|
void BattleScriptExecute(const u8 *BS_ptr);
|
||||||
void BattleScriptPushCursorAndCallback(const u8 *BS_ptr);
|
void BattleScriptPushCursorAndCallback(const u8 *BS_ptr);
|
||||||
u8 ItemBattleEffects(u8 caseID, u8 battler, bool8 moveTurn);
|
u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn);
|
||||||
void ClearFuryCutterDestinyBondGrudge(u8 battler);
|
void ClearFuryCutterDestinyBondGrudge(u32 battler);
|
||||||
void HandleAction_RunBattleScript(void);
|
void HandleAction_RunBattleScript(void);
|
||||||
u32 SetRandomTarget(u32 battler);
|
u32 SetRandomTarget(u32 battler);
|
||||||
u32 GetMoveTarget(u16 move, u8 setTarget);
|
u32 GetMoveTarget(u16 move, u8 setTarget);
|
||||||
u8 IsMonDisobedient(void);
|
u8 IsMonDisobedient(void);
|
||||||
u32 GetBattlerHoldEffect(u32 battler, bool32 checkNegating);
|
u32 GetBattlerHoldEffect(u32 battler, bool32 checkNegating);
|
||||||
u32 GetBattlerHoldEffectParam(u8 battler);
|
u32 GetBattlerHoldEffectParam(u32 battler);
|
||||||
bool32 IsMoveMakingContact(u16 move, u32 battlerAtk);
|
bool32 IsMoveMakingContact(u32 move, u32 battlerAtk);
|
||||||
bool32 IsBattlerGrounded(u8 battler);
|
bool32 IsBattlerGrounded(u32 battler);
|
||||||
bool32 IsBattlerAlive(u8 battler);
|
bool32 IsBattlerAlive(u32 battler);
|
||||||
u8 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u16 move);
|
u32 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u32 move);
|
||||||
u32 GetBattlerWeight(u8 battler);
|
u32 GetBattlerWeight(u32 battler);
|
||||||
u32 CalcRolloutBasePower(u32 battlerAtk, u32 basePower, u32 rolloutTimer);
|
u32 CalcRolloutBasePower(u32 battlerAtk, u32 basePower, u32 rolloutTimer);
|
||||||
u32 CalcFuryCutterBasePower(u32 basePower, u32 furyCutterCounter);
|
u32 CalcFuryCutterBasePower(u32 basePower, u32 furyCutterCounter);
|
||||||
s32 CalculateMoveDamage(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor, bool32 updateFlags);
|
s32 CalculateMoveDamage(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor, bool32 updateFlags);
|
||||||
@ -175,46 +176,46 @@ s32 CalculateMoveDamageAndEffectiveness(u32 move, u32 battlerAtk, u32 battlerDef
|
|||||||
uq4_12_t CalcTypeEffectivenessMultiplier(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, bool32 recordAbilities);
|
uq4_12_t CalcTypeEffectivenessMultiplier(u32 move, u32 moveType, u32 battlerAtk, u32 battlerDef, bool32 recordAbilities);
|
||||||
uq4_12_t CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilityDef);
|
uq4_12_t CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u16 abilityDef);
|
||||||
uq4_12_t GetTypeModifier(u32 atkType, u32 defType);
|
uq4_12_t GetTypeModifier(u32 atkType, u32 defType);
|
||||||
s32 GetStealthHazardDamage(u8 hazardType, u8 battler);
|
s32 GetStealthHazardDamage(u8 hazardType, u32 battler);
|
||||||
s32 GetStealthHazardDamageByTypesAndHP(u8 hazardType, u8 type1, u8 type2, u32 maxHp);
|
s32 GetStealthHazardDamageByTypesAndHP(u8 hazardType, u8 type1, u8 type2, u32 maxHp);
|
||||||
bool32 CanMegaEvolve(u8 battler);
|
bool32 CanMegaEvolve(u32 battler);
|
||||||
bool32 CanUltraBurst(u8 battler);
|
bool32 CanUltraBurst(u32 battler);
|
||||||
bool32 IsBattlerMegaEvolved(u8 battler);
|
bool32 IsBattlerMegaEvolved(u32 battler);
|
||||||
bool32 IsBattlerPrimalReverted(u8 battler);
|
bool32 IsBattlerPrimalReverted(u32 battler);
|
||||||
bool32 IsBattlerUltraBursted(u8 battler);
|
bool32 IsBattlerUltraBursted(u32 battler);
|
||||||
u16 GetBattleFormChangeTargetSpecies(u8 battler, u16 method);
|
u16 GetBattleFormChangeTargetSpecies(u32 battler, u16 method);
|
||||||
bool32 TryBattleFormChange(u8 battler, u16 method);
|
bool32 TryBattleFormChange(u32 battler, u16 method);
|
||||||
bool32 DoBattlersShareType(u32 battler1, u32 battler2);
|
bool32 DoBattlersShareType(u32 battler1, u32 battler2);
|
||||||
bool32 CanBattlerGetOrLoseItem(u8 battler, u16 itemId);
|
bool32 CanBattlerGetOrLoseItem(u32 battler, u16 itemId);
|
||||||
u32 GetIllusionMonSpecies(u32 battler);
|
u32 GetIllusionMonSpecies(u32 battler);
|
||||||
struct Pokemon *GetIllusionMonPtr(u32 battler);
|
struct Pokemon *GetIllusionMonPtr(u32 battler);
|
||||||
void ClearIllusionMon(u32 battler);
|
void ClearIllusionMon(u32 battler);
|
||||||
bool32 SetIllusionMon(struct Pokemon *mon, u32 battler);
|
bool32 SetIllusionMon(struct Pokemon *mon, u32 battler);
|
||||||
bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battler);
|
bool32 ShouldGetStatBadgeBoost(u16 flagId, u32 battler);
|
||||||
u8 GetBattleMoveSplit(u32 moveId);
|
u8 GetBattleMoveSplit(u32 moveId);
|
||||||
bool32 CanFling(u32 battler);
|
bool32 CanFling(u32 battler);
|
||||||
bool32 IsTelekinesisBannedSpecies(u16 species);
|
bool32 IsTelekinesisBannedSpecies(u16 species);
|
||||||
bool32 IsHealBlockPreventingMove(u32 battler, u32 move);
|
bool32 IsHealBlockPreventingMove(u32 battler, u32 move);
|
||||||
bool32 HasEnoughHpToEatBerry(u32 battler, u32 hpFraction, u32 itemId);
|
bool32 HasEnoughHpToEatBerry(u32 battler, u32 hpFraction, u32 itemId);
|
||||||
bool32 IsPartnerMonFromSameTrainer(u8 battler);
|
bool32 IsPartnerMonFromSameTrainer(u32 battler);
|
||||||
u8 GetSplitBasedOnStats(u8 battler);
|
u8 GetSplitBasedOnStats(u32 battler);
|
||||||
bool32 TestSheerForceFlag(u8 battler, u16 move);
|
bool32 TestSheerForceFlag(u32 battler, u16 move);
|
||||||
void TryRestoreHeldItems(void);
|
void TryRestoreHeldItems(void);
|
||||||
bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item);
|
bool32 CanStealItem(u32 battlerStealing, u32 battlerItem, u16 item);
|
||||||
void TrySaveExchangedItem(u8 battler, u16 stolenItem);
|
void TrySaveExchangedItem(u32 battler, u16 stolenItem);
|
||||||
bool32 IsPartnerMonFromSameTrainer(u8 battler);
|
bool32 IsPartnerMonFromSameTrainer(u32 battler);
|
||||||
u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 execute);
|
u8 TryHandleSeed(u32 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 execute);
|
||||||
bool32 IsBattlerAffectedByHazards(u8 battler, bool32 toxicSpikes);
|
bool32 IsBattlerAffectedByHazards(u32 battler, bool32 toxicSpikes);
|
||||||
void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast);
|
void SortBattlersBySpeed(u8 *battlers, bool32 slowToFast);
|
||||||
bool32 CompareStat(u8 battler, u8 statId, u8 cmpTo, u8 cmpKind);
|
bool32 CompareStat(u32 battler, u8 statId, u8 cmpTo, u8 cmpKind);
|
||||||
bool32 TryRoomService(u8 battler);
|
bool32 TryRoomService(u32 battler);
|
||||||
void BufferStatChange(u8 battler, u8 statId, u8 stringId);
|
void BufferStatChange(u32 battler, u8 statId, u8 stringId);
|
||||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u32 battlerDef, bool32 checkTarget);
|
bool32 BlocksPrankster(u16 move, u32 battlerPrankster, u32 battlerDef, bool32 checkTarget);
|
||||||
u16 GetUsedHeldItem(u8 battler);
|
u16 GetUsedHeldItem(u32 battler);
|
||||||
bool32 IsBattlerWeatherAffected(u8 battler, u32 weatherFlags);
|
bool32 IsBattlerWeatherAffected(u32 battler, u32 weatherFlags);
|
||||||
u32 GetBattlerMoveTargetType(u8 battler, u16 move);
|
u32 GetBattlerMoveTargetType(u32 battler, u32 move);
|
||||||
bool32 CanTargetBattler(u32 battlerAtk, u32 battlerDef, u16 move);
|
bool32 CanTargetBattler(u32 battlerAtk, u32 battlerDef, u16 move);
|
||||||
bool8 IsMoveAffectedByParentalBond(u16 move, u8 battler);
|
bool32 IsMoveAffectedByParentalBond(u16 move, u32 battler);
|
||||||
void CopyMonLevelAndBaseStatsToBattleMon(u32 battler, struct Pokemon *mon);
|
void CopyMonLevelAndBaseStatsToBattleMon(u32 battler, struct Pokemon *mon);
|
||||||
void CopyMonAbilityAndTypesToBattleMon(u32 battler, struct Pokemon *mon);
|
void CopyMonAbilityAndTypesToBattleMon(u32 battler, struct Pokemon *mon);
|
||||||
void RecalcBattlerStats(u32 battler, struct Pokemon *mon);
|
void RecalcBattlerStats(u32 battler, struct Pokemon *mon);
|
||||||
@ -230,21 +231,21 @@ bool32 IsGastroAcidBannedAbility(u16 ability);
|
|||||||
bool32 IsEntrainmentBannedAbilityAttacker(u16 ability);
|
bool32 IsEntrainmentBannedAbilityAttacker(u16 ability);
|
||||||
bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability);
|
bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability);
|
||||||
|
|
||||||
bool32 CanSleep(u8 battler);
|
bool32 CanSleep(u32 battler);
|
||||||
bool32 CanBePoisoned(u8 battlerAttacker, u8 battlerTarget);
|
bool32 CanBePoisoned(u32 battlerAttacker, u32 battlerTarget);
|
||||||
bool32 CanBeBurned(u8 battler);
|
bool32 CanBeBurned(u32 battler);
|
||||||
bool32 CanBeParalyzed(u8 battler);
|
bool32 CanBeParalyzed(u32 battler);
|
||||||
bool32 CanBeFrozen(u8 battler);
|
bool32 CanBeFrozen(u32 battler);
|
||||||
bool32 CanGetFrostbite(u8 battler);
|
bool32 CanGetFrostbite(u32 battler);
|
||||||
bool32 CanBeConfused(u8 battler);
|
bool32 CanBeConfused(u32 battler);
|
||||||
bool32 IsBattlerTerrainAffected(u8 battler, u32 terrainFlag);
|
bool32 IsBattlerTerrainAffected(u32 battler, u32 terrainFlag);
|
||||||
u32 GetBattlerFriendshipScore(u8 battler);
|
u32 GetBattlerFriendshipScore(u32 battler);
|
||||||
u32 CountBattlerStatIncreases(u8 battler, bool32 countEvasionAcc);
|
u32 CountBattlerStatIncreases(u32 battler, bool32 countEvasionAcc);
|
||||||
bool32 IsMyceliumMightOnField(void);
|
bool32 IsMyceliumMightOnField(void);
|
||||||
bool8 ChangeTypeBasedOnTerrain(u8 battler);
|
bool32 ChangeTypeBasedOnTerrain(u32 battler);
|
||||||
void RemoveConfusionStatus(u8 battler);
|
void RemoveConfusionStatus(u32 battler);
|
||||||
u8 GetBattlerGender(u8 battler);
|
u8 GetBattlerGender(u32 battler);
|
||||||
bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2);
|
bool32 AreBattlersOfOppositeGender(u32 battler1, u32 battler2);
|
||||||
u32 CalcSecondaryEffectChance(u8 battler, u8 secondaryEffectChance);
|
u32 CalcSecondaryEffectChance(u32 battler, u8 secondaryEffectChance);
|
||||||
|
|
||||||
#endif // GUARD_BATTLE_UTIL_H
|
#endif // GUARD_BATTLE_UTIL_H
|
||||||
|
@ -63,8 +63,8 @@ bool8 AddPyramidBagItem(u16 itemId, u16 count);
|
|||||||
bool8 RemovePyramidBagItem(u16 itemId, u16 count);
|
bool8 RemovePyramidBagItem(u16 itemId, u16 count);
|
||||||
const u8 *ItemId_GetName(u16 itemId);
|
const u8 *ItemId_GetName(u16 itemId);
|
||||||
u16 ItemId_GetPrice(u16 itemId);
|
u16 ItemId_GetPrice(u16 itemId);
|
||||||
u8 ItemId_GetHoldEffect(u16 itemId);
|
u32 ItemId_GetHoldEffect(u32 itemId);
|
||||||
u8 ItemId_GetHoldEffectParam(u16 itemId);
|
u32 ItemId_GetHoldEffectParam(u32 itemId);
|
||||||
const u8 *ItemId_GetDescription(u16 itemId);
|
const u8 *ItemId_GetDescription(u16 itemId);
|
||||||
u8 ItemId_GetImportance(u16 itemId);
|
u8 ItemId_GetImportance(u16 itemId);
|
||||||
u8 ItemId_GetPocket(u16 itemId);
|
u8 ItemId_GetPocket(u16 itemId);
|
||||||
@ -72,7 +72,7 @@ u8 ItemId_GetType(u16 itemId);
|
|||||||
ItemUseFunc ItemId_GetFieldFunc(u16 itemId);
|
ItemUseFunc ItemId_GetFieldFunc(u16 itemId);
|
||||||
u8 ItemId_GetBattleUsage(u16 itemId);
|
u8 ItemId_GetBattleUsage(u16 itemId);
|
||||||
u8 ItemId_GetSecondaryId(u16 itemId);
|
u8 ItemId_GetSecondaryId(u16 itemId);
|
||||||
u8 ItemId_GetFlingPower(u16 itemId);
|
u32 ItemId_GetFlingPower(u32 itemId);
|
||||||
u32 GetItemStatus1Mask(u16 itemId);
|
u32 GetItemStatus1Mask(u16 itemId);
|
||||||
u32 GetItemStatus2Mask(u16 itemId);
|
u32 GetItemStatus2Mask(u16 itemId);
|
||||||
|
|
||||||
|
@ -57,14 +57,14 @@ match the ROM; this is also why sSoundMovesTable's declaration is in the middle
|
|||||||
functions instead of at the top of the file with the other declarations.
|
functions instead of at the top of the file with the other declarations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool32 TryRemoveScreens(u8 battler);
|
static bool32 TryRemoveScreens(u32 battler);
|
||||||
static bool32 IsUnnerveAbilityOnOpposingSide(u8 battler);
|
static bool32 IsUnnerveAbilityOnOpposingSide(u32 battler);
|
||||||
static u8 GetFlingPowerFromItemId(u16 itemId);
|
static u32 GetFlingPowerFromItemId(u32 itemId);
|
||||||
static void SetRandomMultiHitCounter();
|
static void SetRandomMultiHitCounter();
|
||||||
static u32 GetBattlerItemHoldEffectParam(u8 battler, u16 item);
|
static u32 GetBattlerItemHoldEffectParam(u32 battler, u32 item);
|
||||||
static uq4_12_t GetInverseTypeMultiplier(uq4_12_t multiplier);
|
static uq4_12_t GetInverseTypeMultiplier(uq4_12_t multiplier);
|
||||||
static uq4_12_t GetSupremeOverlordModifier(u8 battler);
|
static uq4_12_t GetSupremeOverlordModifier(u32 battler);
|
||||||
static bool8 CanBeInfinitelyConfused(u8 battler);
|
static bool32 CanBeInfinitelyConfused(u32 battler);
|
||||||
|
|
||||||
extern const u8 *const gBattleScriptsForMoveEffects[];
|
extern const u8 *const gBattleScriptsForMoveEffects[];
|
||||||
extern const u8 *const gBattlescriptsForRunningByItem[];
|
extern const u8 *const gBattlescriptsForRunningByItem[];
|
||||||
@ -557,9 +557,9 @@ void HandleAction_UseItem(void)
|
|||||||
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
gCurrentActionFuncId = B_ACTION_EXEC_SCRIPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 TryRunFromBattle(u8 battler)
|
bool32 TryRunFromBattle(u32 battler)
|
||||||
{
|
{
|
||||||
bool8 effect = FALSE;
|
bool32 effect = FALSE;
|
||||||
u8 holdEffect;
|
u8 holdEffect;
|
||||||
u8 pyramidMultiplier;
|
u8 pyramidMultiplier;
|
||||||
u8 speedVar;
|
u8 speedVar;
|
||||||
@ -864,8 +864,8 @@ void HandleAction_ActionFinished(void)
|
|||||||
{
|
{
|
||||||
for (j = i + 1; j < gBattlersCount; j++)
|
for (j = i + 1; j < gBattlersCount; j++)
|
||||||
{
|
{
|
||||||
u8 battler1 = gBattlerByTurnOrder[i];
|
u32 battler1 = gBattlerByTurnOrder[i];
|
||||||
u8 battler2 = gBattlerByTurnOrder[j];
|
u32 battler2 = gBattlerByTurnOrder[j];
|
||||||
|
|
||||||
if (gProtectStructs[battler1].quash || gProtectStructs[battler2].quash
|
if (gProtectStructs[battler1].quash || gProtectStructs[battler2].quash
|
||||||
|| gProtectStructs[battler1].shellTrap || gProtectStructs[battler2].shellTrap)
|
|| gProtectStructs[battler1].shellTrap || gProtectStructs[battler2].shellTrap)
|
||||||
@ -1315,7 +1315,7 @@ static void MarkAllBattlersForControllerExec(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsBattlerMarkedForControllerExec(u8 battler)
|
bool32 IsBattlerMarkedForControllerExec(u32 battler)
|
||||||
{
|
{
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||||
return (gBattleControllerExecFlags & (gBitTable[battler] << 0x1C)) != 0;
|
return (gBattleControllerExecFlags & (gBitTable[battler] << 0x1C)) != 0;
|
||||||
@ -1323,7 +1323,7 @@ bool32 IsBattlerMarkedForControllerExec(u8 battler)
|
|||||||
return (gBattleControllerExecFlags & (gBitTable[battler])) != 0;
|
return (gBattleControllerExecFlags & (gBitTable[battler])) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkBattlerForControllerExec(u8 battler)
|
void MarkBattlerForControllerExec(u32 battler)
|
||||||
{
|
{
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||||
gBattleControllerExecFlags |= gBitTable[battler] << (32 - MAX_BATTLERS_COUNT);
|
gBattleControllerExecFlags |= gBitTable[battler] << (32 - MAX_BATTLERS_COUNT);
|
||||||
@ -1331,7 +1331,7 @@ void MarkBattlerForControllerExec(u8 battler)
|
|||||||
gBattleControllerExecFlags |= gBitTable[battler];
|
gBattleControllerExecFlags |= gBitTable[battler];
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkBattlerReceivedLinkData(u8 battler)
|
void MarkBattlerReceivedLinkData(u32 battler)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
@ -1341,7 +1341,7 @@ void MarkBattlerReceivedLinkData(u8 battler)
|
|||||||
gBattleControllerExecFlags &= ~((1 << 28) << battler);
|
gBattleControllerExecFlags &= ~((1 << 28) << battler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CancelMultiTurnMoves(u8 battler)
|
void CancelMultiTurnMoves(u32 battler)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
gBattleMons[battler].status2 &= ~(STATUS2_MULTIPLETURNS);
|
gBattleMons[battler].status2 &= ~(STATUS2_MULTIPLETURNS);
|
||||||
@ -1422,7 +1422,7 @@ void CancelMultiTurnMoves(u8 battler)
|
|||||||
gDisableStructs[battler].furyCutterCounter = 0;
|
gDisableStructs[battler].furyCutterCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 WasUnableToUseMove(u8 battler)
|
bool32 WasUnableToUseMove(u32 battler)
|
||||||
{
|
{
|
||||||
if (gProtectStructs[battler].prlzImmobility
|
if (gProtectStructs[battler].prlzImmobility
|
||||||
|| gProtectStructs[battler].usedImprisonedMove
|
|| gProtectStructs[battler].usedImprisonedMove
|
||||||
@ -1441,7 +1441,7 @@ bool8 WasUnableToUseMove(u8 battler)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrepareStringBattle(u16 stringId, u8 battler)
|
void PrepareStringBattle(u16 stringId, u32 battler)
|
||||||
{
|
{
|
||||||
u32 targetSide = GetBattlerSide(gBattlerTarget);
|
u32 targetSide = GetBattlerSide(gBattlerTarget);
|
||||||
u16 battlerAbility = GetBattlerAbility(battler);
|
u16 battlerAbility = GetBattlerAbility(battler);
|
||||||
@ -1512,7 +1512,7 @@ void ResetSentPokesToOpponentValue(void)
|
|||||||
gSentPokesToOpponent[(i & BIT_FLANK) >> 1] = bits;
|
gSentPokesToOpponent[(i & BIT_FLANK) >> 1] = bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpponentSwitchInResetSentPokesToOpponentValue(u8 battler)
|
void OpponentSwitchInResetSentPokesToOpponentValue(u32 battler)
|
||||||
{
|
{
|
||||||
s32 i = 0;
|
s32 i = 0;
|
||||||
u32 bits = 0;
|
u32 bits = 0;
|
||||||
@ -1531,7 +1531,7 @@ void OpponentSwitchInResetSentPokesToOpponentValue(u8 battler)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateSentPokesToOpponentValue(u8 battler)
|
void UpdateSentPokesToOpponentValue(u32 battler)
|
||||||
{
|
{
|
||||||
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
||||||
{
|
{
|
||||||
@ -1827,7 +1827,7 @@ u32 TrySetCantSelectMoveBattleScript(u32 battler)
|
|||||||
return limitations;
|
return limitations;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 CheckMoveLimitations(u8 battler, u8 unusableMoves, u16 check)
|
u8 CheckMoveLimitations(u32 battler, u8 unusableMoves, u16 check)
|
||||||
{
|
{
|
||||||
u8 holdEffect = GetBattlerHoldEffect(battler, TRUE);
|
u8 holdEffect = GetBattlerHoldEffect(battler, TRUE);
|
||||||
u16 *choicedMove = &gBattleStruct->choicedMove[battler];
|
u16 *choicedMove = &gBattleStruct->choicedMove[battler];
|
||||||
@ -1907,11 +1907,11 @@ bool32 AreAllMovesUnusable(u32 battler)
|
|||||||
return (unusable == ALL_MOVES_MASK);
|
return (unusable == ALL_MOVES_MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetImprisonedMovesCount(u8 battler, u16 move)
|
u8 GetImprisonedMovesCount(u32 battler, u16 move)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
u8 imprisonedMoves = 0;
|
u8 imprisonedMoves = 0;
|
||||||
u8 battlerSide = GetBattlerSide(battler);
|
u32 battlerSide = GetBattlerSide(battler);
|
||||||
|
|
||||||
for (i = 0; i < gBattlersCount; i++)
|
for (i = 0; i < gBattlersCount; i++)
|
||||||
{
|
{
|
||||||
@ -1931,7 +1931,7 @@ u8 GetImprisonedMovesCount(u8 battler, u16 move)
|
|||||||
return imprisonedMoves;
|
return imprisonedMoves;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetBattlerFriendshipScore(u8 battler)
|
u32 GetBattlerFriendshipScore(u32 battler)
|
||||||
{
|
{
|
||||||
u8 side = GetBattlerSide(battler);
|
u8 side = GetBattlerSide(battler);
|
||||||
struct Pokemon *party = GetSideParty(side);
|
struct Pokemon *party = GetSideParty(side);
|
||||||
@ -3100,7 +3100,7 @@ u8 DoBattlerEndTurnEffects(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 HandleWishPerishSongOnTurnEnd(void)
|
bool32 HandleWishPerishSongOnTurnEnd(void)
|
||||||
{
|
{
|
||||||
u32 battler;
|
u32 battler;
|
||||||
|
|
||||||
@ -3203,7 +3203,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void)
|
|||||||
|
|
||||||
#define FAINTED_ACTIONS_MAX_CASE 8
|
#define FAINTED_ACTIONS_MAX_CASE 8
|
||||||
|
|
||||||
bool8 HandleFaintedMonActions(void)
|
bool32 HandleFaintedMonActions(void)
|
||||||
{
|
{
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
|
if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -3811,7 +3811,7 @@ u8 AtkCanceller_UnableToUseMove2(void)
|
|||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
|
bool32 HasNoMonsToSwitch(u32 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
|
||||||
{
|
{
|
||||||
u32 i, side, playerId, flankId;
|
u32 i, side, playerId, flankId;
|
||||||
struct Pokemon *party;
|
struct Pokemon *party;
|
||||||
@ -3966,7 +3966,7 @@ static const u16 sWeatherFlagsInfo[][3] =
|
|||||||
[ENUM_WEATHER_SNOW] = {B_WEATHER_SNOW_TEMPORARY, B_WEATHER_SNOW_PERMANENT, HOLD_EFFECT_ICY_ROCK},
|
[ENUM_WEATHER_SNOW] = {B_WEATHER_SNOW_TEMPORARY, B_WEATHER_SNOW_PERMANENT, HOLD_EFFECT_ICY_ROCK},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ShouldChangeFormInWeather(u8 battler)
|
static void ShouldChangeFormInWeather(u32 battler)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int side = GetBattlerSide(battler);
|
int side = GetBattlerSide(battler);
|
||||||
@ -3981,7 +3981,7 @@ static void ShouldChangeFormInWeather(u8 battler)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility)
|
bool32 TryChangeBattleWeather(u32 battler, u32 weatherEnumId, bool32 viaAbility)
|
||||||
{
|
{
|
||||||
u16 battlerAbility = GetBattlerAbility(battler);
|
u16 battlerAbility = GetBattlerAbility(battler);
|
||||||
if (gBattleWeather & B_WEATHER_PRIMAL_ANY
|
if (gBattleWeather & B_WEATHER_PRIMAL_ANY
|
||||||
@ -4031,10 +4031,10 @@ static bool32 TryChangeBattleTerrain(u32 battler, u32 statusFlag, u8 *timer)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 ForewarnChooseMove(u32 battler)
|
static void ForewarnChooseMove(u32 battler)
|
||||||
{
|
{
|
||||||
struct Forewarn {
|
struct Forewarn {
|
||||||
u8 battler;
|
u32 battler;
|
||||||
u8 power;
|
u8 power;
|
||||||
u16 moveId;
|
u16 moveId;
|
||||||
};
|
};
|
||||||
@ -4089,9 +4089,9 @@ static u8 ForewarnChooseMove(u32 battler)
|
|||||||
Free(data);
|
Free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ChangeTypeBasedOnTerrain(u8 battler)
|
bool32 ChangeTypeBasedOnTerrain(u32 battler)
|
||||||
{
|
{
|
||||||
u8 battlerType;
|
u32 battlerType;
|
||||||
|
|
||||||
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)
|
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)
|
||||||
battlerType = TYPE_ELECTRIC;
|
battlerType = TYPE_ELECTRIC;
|
||||||
@ -4111,12 +4111,12 @@ bool8 ChangeTypeBasedOnTerrain(u8 battler)
|
|||||||
|
|
||||||
// Supreme Overlord adds a damage boost for each fainted ally.
|
// Supreme Overlord adds a damage boost for each fainted ally.
|
||||||
// The first ally adds a x1.2 boost, and subsequent allies add an extra x0.1 boost each.
|
// The first ally adds a x1.2 boost, and subsequent allies add an extra x0.1 boost each.
|
||||||
static uq4_12_t GetSupremeOverlordModifier(u8 battler)
|
static uq4_12_t GetSupremeOverlordModifier(u32 battler)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
struct Pokemon *party = GetBattlerParty(battler);
|
struct Pokemon *party = GetBattlerParty(battler);
|
||||||
uq4_12_t modifier = UQ_4_12(1.0);
|
uq4_12_t modifier = UQ_4_12(1.0);
|
||||||
bool8 appliedFirstBoost = FALSE;
|
bool32 appliedFirstBoost = FALSE;
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
@ -4130,9 +4130,9 @@ static uq4_12_t GetSupremeOverlordModifier(u8 battler)
|
|||||||
return modifier;
|
return modifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 moveArg)
|
u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32 moveArg)
|
||||||
{
|
{
|
||||||
u8 effect = 0;
|
u32 effect = 0;
|
||||||
u32 speciesAtk, speciesDef;
|
u32 speciesAtk, speciesDef;
|
||||||
u32 moveType, move;
|
u32 moveType, move;
|
||||||
u32 i, j;
|
u32 i, j;
|
||||||
@ -5376,7 +5376,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||||||
&& IsBattlerAlive(gBattlerAttacker)
|
&& IsBattlerAlive(gBattlerAttacker)
|
||||||
&& IsMoveMakingContact(move, gBattlerAttacker))
|
&& IsMoveMakingContact(move, gBattlerAttacker))
|
||||||
{
|
{
|
||||||
u8 battler;
|
u32 battler;
|
||||||
if ((battler = IsAbilityOnField(ABILITY_DAMP)))
|
if ((battler = IsAbilityOnField(ABILITY_DAMP)))
|
||||||
{
|
{
|
||||||
gBattleScripting.battler = battler - 1;
|
gBattleScripting.battler = battler - 1;
|
||||||
@ -6065,7 +6065,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
|||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 TryPrimalReversion(u8 battler)
|
bool32 TryPrimalReversion(u32 battler)
|
||||||
{
|
{
|
||||||
if (GetBattlerHoldEffect(battler, FALSE) == HOLD_EFFECT_PRIMAL_ORB
|
if (GetBattlerHoldEffect(battler, FALSE) == HOLD_EFFECT_PRIMAL_ORB
|
||||||
&& GetBattleFormChangeTargetSpecies(battler, FORM_CHANGE_BATTLE_PRIMAL_REVERSION) != SPECIES_NONE)
|
&& GetBattleFormChangeTargetSpecies(battler, FORM_CHANGE_BATTLE_PRIMAL_REVERSION) != SPECIES_NONE)
|
||||||
@ -6135,7 +6135,7 @@ bool32 IsMyceliumMightOnField(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetBattlerAbility(u8 battler)
|
u32 GetBattlerAbility(u32 battler)
|
||||||
{
|
{
|
||||||
if (gStatuses3[battler] & STATUS3_GASTRO_ACID)
|
if (gStatuses3[battler] & STATUS3_GASTRO_ACID)
|
||||||
return ABILITY_NONE;
|
return ABILITY_NONE;
|
||||||
@ -6268,7 +6268,7 @@ enum
|
|||||||
ITEM_STATS_CHANGE,
|
ITEM_STATS_CHANGE,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool32 IsBattlerTerrainAffected(u8 battler, u32 terrainFlag)
|
bool32 IsBattlerTerrainAffected(u32 battler, u32 terrainFlag)
|
||||||
{
|
{
|
||||||
if (!(gFieldStatuses & terrainFlag))
|
if (!(gFieldStatuses & terrainFlag))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -6278,7 +6278,7 @@ bool32 IsBattlerTerrainAffected(u8 battler, u32 terrainFlag)
|
|||||||
return IsBattlerGrounded(battler);
|
return IsBattlerGrounded(battler);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanSleep(u8 battler)
|
bool32 CanSleep(u32 battler)
|
||||||
{
|
{
|
||||||
u16 ability = GetBattlerAbility(battler);
|
u16 ability = GetBattlerAbility(battler);
|
||||||
if (ability == ABILITY_INSOMNIA
|
if (ability == ABILITY_INSOMNIA
|
||||||
@ -6293,7 +6293,7 @@ bool32 CanSleep(u8 battler)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanBePoisoned(u8 battlerAttacker, u8 battlerTarget)
|
bool32 CanBePoisoned(u32 battlerAttacker, u32 battlerTarget)
|
||||||
{
|
{
|
||||||
u16 ability = GetBattlerAbility(battlerTarget);
|
u16 ability = GetBattlerAbility(battlerTarget);
|
||||||
|
|
||||||
@ -6309,7 +6309,7 @@ bool32 CanBePoisoned(u8 battlerAttacker, u8 battlerTarget)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanBeBurned(u8 battler)
|
bool32 CanBeBurned(u32 battler)
|
||||||
{
|
{
|
||||||
u16 ability = GetBattlerAbility(battler);
|
u16 ability = GetBattlerAbility(battler);
|
||||||
if (IS_BATTLER_OF_TYPE(battler, TYPE_FIRE)
|
if (IS_BATTLER_OF_TYPE(battler, TYPE_FIRE)
|
||||||
@ -6325,7 +6325,7 @@ bool32 CanBeBurned(u8 battler)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanBeParalyzed(u8 battler)
|
bool32 CanBeParalyzed(u32 battler)
|
||||||
{
|
{
|
||||||
u16 ability = GetBattlerAbility(battler);
|
u16 ability = GetBattlerAbility(battler);
|
||||||
if (
|
if (
|
||||||
@ -6342,7 +6342,7 @@ bool32 CanBeParalyzed(u8 battler)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanBeFrozen(u8 battler)
|
bool32 CanBeFrozen(u32 battler)
|
||||||
{
|
{
|
||||||
u16 ability = GetBattlerAbility(battler);
|
u16 ability = GetBattlerAbility(battler);
|
||||||
if (IS_BATTLER_OF_TYPE(battler, TYPE_ICE)
|
if (IS_BATTLER_OF_TYPE(battler, TYPE_ICE)
|
||||||
@ -6357,7 +6357,7 @@ bool32 CanBeFrozen(u8 battler)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanGetFrostbite(u8 battler)
|
bool32 CanGetFrostbite(u32 battler)
|
||||||
{
|
{
|
||||||
u16 ability = GetBattlerAbility(battler);
|
u16 ability = GetBattlerAbility(battler);
|
||||||
if (IS_BATTLER_OF_TYPE(battler, TYPE_ICE)
|
if (IS_BATTLER_OF_TYPE(battler, TYPE_ICE)
|
||||||
@ -6371,7 +6371,7 @@ bool32 CanGetFrostbite(u8 battler)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanBeConfused(u8 battler)
|
bool32 CanBeConfused(u32 battler)
|
||||||
{
|
{
|
||||||
if (GetBattlerAbility(battler) == ABILITY_OWN_TEMPO
|
if (GetBattlerAbility(battler) == ABILITY_OWN_TEMPO
|
||||||
|| gBattleMons[battler].status2 & STATUS2_CONFUSION
|
|| gBattleMons[battler].status2 & STATUS2_CONFUSION
|
||||||
@ -6411,7 +6411,7 @@ bool32 HasEnoughHpToEatBerry(u32 battler, u32 hpFraction, u32 itemId)
|
|||||||
#define CONFUSE_BERRY_HP_FRACTION 2
|
#define CONFUSE_BERRY_HP_FRACTION 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static u8 HealConfuseBerry(u32 battler, u32 itemId, u8 flavorId, bool32 end2)
|
static u8 HealConfuseBerry(u32 battler, u32 itemId, u32 flavorId, bool32 end2)
|
||||||
{
|
{
|
||||||
if (HasEnoughHpToEatBerry(battler, CONFUSE_BERRY_HP_FRACTION, itemId)
|
if (HasEnoughHpToEatBerry(battler, CONFUSE_BERRY_HP_FRACTION, itemId)
|
||||||
#if B_HEAL_BLOCKING >= GEN_5
|
#if B_HEAL_BLOCKING >= GEN_5
|
||||||
@ -6554,7 +6554,7 @@ static u8 TrySetMicleBerry(u32 battler, u32 itemId, bool32 end2)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 DamagedStatBoostBerryEffect(u8 battler, u8 statId, u8 split)
|
static u8 DamagedStatBoostBerryEffect(u32 battler, u8 statId, u8 split)
|
||||||
{
|
{
|
||||||
if (IsBattlerAlive(battler)
|
if (IsBattlerAlive(battler)
|
||||||
&& TARGET_TURN_DAMAGED
|
&& TARGET_TURN_DAMAGED
|
||||||
@ -6580,7 +6580,7 @@ static u8 DamagedStatBoostBerryEffect(u8 battler, u8 statId, u8 split)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 TryHandleSeed(u8 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 execute)
|
u8 TryHandleSeed(u32 battler, u32 terrainFlag, u8 statId, u16 itemId, bool32 execute)
|
||||||
{
|
{
|
||||||
if (gFieldStatuses & terrainFlag && CompareStat(battler, statId, MAX_STAT_STAGE, CMP_LESS_THAN))
|
if (gFieldStatuses & terrainFlag && CompareStat(battler, statId, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||||
{
|
{
|
||||||
@ -6643,7 +6643,7 @@ static bool32 UnnerveOn(u32 battler, u32 itemId)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 GetMentalHerbEffect(u8 battler)
|
static bool32 GetMentalHerbEffect(u32 battler)
|
||||||
{
|
{
|
||||||
bool32 ret = FALSE;
|
bool32 ret = FALSE;
|
||||||
|
|
||||||
@ -6698,7 +6698,7 @@ static bool32 GetMentalHerbEffect(u8 battler)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 TryConsumeMirrorHerb(u8 battler, bool32 execute)
|
static u8 TryConsumeMirrorHerb(u32 battler, bool32 execute)
|
||||||
{
|
{
|
||||||
u8 effect = 0;
|
u8 effect = 0;
|
||||||
|
|
||||||
@ -6935,12 +6935,12 @@ static u8 ItemEffectMoveEnd(u32 battler, u16 holdEffect)
|
|||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 ItemBattleEffects(u8 caseID, u8 battler, bool8 moveTurn)
|
u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn)
|
||||||
{
|
{
|
||||||
int i = 0, moveType;
|
int i = 0, moveType;
|
||||||
u8 effect = ITEM_NO_EFFECT;
|
u8 effect = ITEM_NO_EFFECT;
|
||||||
u8 changedPP = 0;
|
u8 changedPP = 0;
|
||||||
u8 battlerHoldEffect, atkHoldEffect;
|
u32 battlerHoldEffect, atkHoldEffect;
|
||||||
u8 atkHoldEffectParam;
|
u8 atkHoldEffectParam;
|
||||||
u16 atkItem;
|
u16 atkItem;
|
||||||
|
|
||||||
@ -7849,7 +7849,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battler, bool8 moveTurn)
|
|||||||
return effect;
|
return effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearFuryCutterDestinyBondGrudge(u8 battler)
|
void ClearFuryCutterDestinyBondGrudge(u32 battler)
|
||||||
{
|
{
|
||||||
gDisableStructs[battler].furyCutterCounter = 0;
|
gDisableStructs[battler].furyCutterCounter = 0;
|
||||||
gBattleMons[battler].status2 &= ~STATUS2_DESTINY_BOND;
|
gBattleMons[battler].status2 &= ~STATUS2_DESTINY_BOND;
|
||||||
@ -7963,7 +7963,7 @@ u32 GetMoveTarget(u16 move, u8 setTarget)
|
|||||||
return targetBattler;
|
return targetBattler;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 IsBattlerModernFatefulEncounter(u8 battler)
|
static bool32 IsBattlerModernFatefulEncounter(u32 battler)
|
||||||
{
|
{
|
||||||
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -8120,7 +8120,7 @@ u32 GetBattlerHoldEffect(u32 battler, bool32 checkNegating)
|
|||||||
return ItemId_GetHoldEffect(gBattleMons[battler].item);
|
return ItemId_GetHoldEffect(gBattleMons[battler].item);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 GetBattlerItemHoldEffectParam(u8 battler, u16 item)
|
static u32 GetBattlerItemHoldEffectParam(u32 battler, u32 item)
|
||||||
{
|
{
|
||||||
if (item == ITEM_ENIGMA_BERRY_E_READER)
|
if (item == ITEM_ENIGMA_BERRY_E_READER)
|
||||||
return gEnigmaBerries[battler].holdEffectParam;
|
return gEnigmaBerries[battler].holdEffectParam;
|
||||||
@ -8128,7 +8128,7 @@ static u32 GetBattlerItemHoldEffectParam(u8 battler, u16 item)
|
|||||||
return ItemId_GetHoldEffectParam(item);
|
return ItemId_GetHoldEffectParam(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetBattlerHoldEffectParam(u8 battler)
|
u32 GetBattlerHoldEffectParam(u32 battler)
|
||||||
{
|
{
|
||||||
if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY_E_READER)
|
if (gBattleMons[battler].item == ITEM_ENIGMA_BERRY_E_READER)
|
||||||
return gEnigmaBerries[battler].holdEffectParam;
|
return gEnigmaBerries[battler].holdEffectParam;
|
||||||
@ -8136,9 +8136,9 @@ u32 GetBattlerHoldEffectParam(u8 battler)
|
|||||||
return ItemId_GetHoldEffectParam(gBattleMons[battler].item);
|
return ItemId_GetHoldEffectParam(gBattleMons[battler].item);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsMoveMakingContact(u16 move, u32 battlerAtk)
|
bool32 IsMoveMakingContact(u32 move, u32 battlerAtk)
|
||||||
{
|
{
|
||||||
u16 atkHoldEffect = GetBattlerHoldEffect(battlerAtk, TRUE);
|
u32 atkHoldEffect = GetBattlerHoldEffect(battlerAtk, TRUE);
|
||||||
|
|
||||||
if (!gBattleMoves[move].makesContact)
|
if (!gBattleMoves[move].makesContact)
|
||||||
{
|
{
|
||||||
@ -8159,7 +8159,7 @@ bool32 IsMoveMakingContact(u16 move, u32 battlerAtk)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsBattlerProtected(u8 battler, u16 move)
|
bool32 IsBattlerProtected(u32 battler, u32 move)
|
||||||
{
|
{
|
||||||
// Decorate bypasses protect and detect, but not crafty shield
|
// Decorate bypasses protect and detect, but not crafty shield
|
||||||
if (move == MOVE_DECORATE)
|
if (move == MOVE_DECORATE)
|
||||||
@ -8217,7 +8217,7 @@ bool32 IsBattlerProtected(u8 battler, u16 move)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only called directly when calculating damage type effectiveness
|
// Only called directly when calculating damage type effectiveness
|
||||||
static bool32 IsBattlerGrounded2(u8 battler, bool32 considerInverse)
|
static bool32 IsBattlerGrounded2(u32 battler, bool32 considerInverse)
|
||||||
{
|
{
|
||||||
if (GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_IRON_BALL)
|
if (GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_IRON_BALL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -8242,12 +8242,12 @@ static bool32 IsBattlerGrounded2(u8 battler, bool32 considerInverse)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsBattlerGrounded(u8 battler)
|
bool32 IsBattlerGrounded(u32 battler)
|
||||||
{
|
{
|
||||||
IsBattlerGrounded2(battler, FALSE);
|
IsBattlerGrounded2(battler, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsBattlerAlive(u8 battler)
|
bool32 IsBattlerAlive(u32 battler)
|
||||||
{
|
{
|
||||||
if (gBattleMons[battler].hp == 0)
|
if (gBattleMons[battler].hp == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -8259,9 +8259,9 @@ bool32 IsBattlerAlive(u8 battler)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u16 move)
|
u32 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u32 move)
|
||||||
{
|
{
|
||||||
u8 i;
|
u32 i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||||
{
|
{
|
||||||
@ -8271,7 +8271,7 @@ u8 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u16 move)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetBattlerWeight(u8 battler)
|
u32 GetBattlerWeight(u32 battler)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
u32 weight = GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[battler].species), 1);
|
u32 weight = GetPokedexHeightWeight(SpeciesToNationalPokedexNum(gBattleMons[battler].species), 1);
|
||||||
@ -8305,7 +8305,7 @@ u32 GetBattlerWeight(u8 battler)
|
|||||||
return weight;
|
return weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CountBattlerStatIncreases(u8 battler, bool32 countEvasionAcc)
|
u32 CountBattlerStatIncreases(u32 battler, bool32 countEvasionAcc)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
u32 count = 0;
|
u32 count = 0;
|
||||||
@ -8321,7 +8321,7 @@ u32 CountBattlerStatIncreases(u8 battler, bool32 countEvasionAcc)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetMoveTargetCount(u16 move, u32 battlerAtk, u32 battlerDef)
|
u32 GetMoveTargetCount(u32 move, u32 battlerAtk, u32 battlerDef)
|
||||||
{
|
{
|
||||||
switch (GetBattlerMoveTargetType(gBattlerAttacker, move))
|
switch (GetBattlerMoveTargetType(gBattlerAttacker, move))
|
||||||
{
|
{
|
||||||
@ -8460,10 +8460,10 @@ u32 CalcFuryCutterBasePower(u32 basePower, u32 furyCutterCounter)
|
|||||||
return basePower;
|
return basePower;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u16 CalcMoveBasePower(u16 move, u32 battlerAtk, u32 battlerDef, u32 abilityDef)
|
static inline u32 CalcMoveBasePower(u32 move, u32 battlerAtk, u32 battlerDef, u32 abilityDef, u32 weather)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
u16 basePower = gBattleMoves[move].power;
|
u32 basePower = gBattleMoves[move].power;
|
||||||
u32 weight, hpFraction, speed;
|
u32 weight, hpFraction, speed;
|
||||||
|
|
||||||
if (gBattleStruct->zmove.active)
|
if (gBattleStruct->zmove.active)
|
||||||
@ -8524,7 +8524,7 @@ static inline u16 CalcMoveBasePower(u16 move, u32 battlerAtk, u32 battlerDef, u3
|
|||||||
basePower *= 2;
|
basePower *= 2;
|
||||||
break;
|
break;
|
||||||
case EFFECT_WEATHER_BALL:
|
case EFFECT_WEATHER_BALL:
|
||||||
if (gBattleWeather & B_WEATHER_ANY && WEATHER_HAS_EFFECT)
|
if (weather & B_WEATHER_ANY)
|
||||||
basePower *= 2;
|
basePower *= 2;
|
||||||
break;
|
break;
|
||||||
case EFFECT_PURSUIT:
|
case EFFECT_PURSUIT:
|
||||||
@ -8716,11 +8716,11 @@ static inline u16 CalcMoveBasePower(u16 move, u32 battlerAtk, u32 battlerDef, u3
|
|||||||
return basePower;
|
return basePower;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u32 CalcMoveBasePowerAfterModifiers(u16 move, u32 battlerAtk, u32 battlerDef, u8 moveType, bool32 updateFlags, u32 atkAbility, u32 defAbility, u32 holdEffectAtk)
|
static inline u32 CalcMoveBasePowerAfterModifiers(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, bool32 updateFlags, u32 atkAbility, u32 defAbility, u32 holdEffectAtk, u32 weather)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
u32 holdEffectParamAtk;
|
u32 holdEffectParamAtk;
|
||||||
u16 basePower = CalcMoveBasePower(move, battlerAtk, battlerDef, defAbility);
|
u32 basePower = CalcMoveBasePower(move, battlerAtk, battlerDef, defAbility, weather);
|
||||||
uq4_12_t holdEffectModifier;
|
uq4_12_t holdEffectModifier;
|
||||||
uq4_12_t modifier = UQ_4_12(1.0);
|
uq4_12_t modifier = UQ_4_12(1.0);
|
||||||
u32 atkSide = GET_BATTLER_SIDE(battlerAtk);
|
u32 atkSide = GET_BATTLER_SIDE(battlerAtk);
|
||||||
@ -8833,7 +8833,7 @@ static inline u32 CalcMoveBasePowerAfterModifiers(u16 move, u32 battlerAtk, u32
|
|||||||
break;
|
break;
|
||||||
case ABILITY_SAND_FORCE:
|
case ABILITY_SAND_FORCE:
|
||||||
if ((moveType == TYPE_STEEL || moveType == TYPE_ROCK || moveType == TYPE_GROUND)
|
if ((moveType == TYPE_STEEL || moveType == TYPE_ROCK || moveType == TYPE_GROUND)
|
||||||
&& gBattleWeather & B_WEATHER_SANDSTORM && WEATHER_HAS_EFFECT)
|
&& weather & B_WEATHER_SANDSTORM)
|
||||||
modifier = uq4_12_multiply(modifier, UQ_4_12(1.3));
|
modifier = uq4_12_multiply(modifier, UQ_4_12(1.3));
|
||||||
break;
|
break;
|
||||||
case ABILITY_RIVALRY:
|
case ABILITY_RIVALRY:
|
||||||
@ -8913,7 +8913,7 @@ static inline u32 CalcMoveBasePowerAfterModifiers(u16 move, u32 battlerAtk, u32
|
|||||||
case ABILITY_PROTOSYNTHESIS:
|
case ABILITY_PROTOSYNTHESIS:
|
||||||
{
|
{
|
||||||
u8 atkHighestStat = GetHighestStatId(battlerAtk);
|
u8 atkHighestStat = GetHighestStatId(battlerAtk);
|
||||||
if (gBattleWeather & B_WEATHER_SUN && WEATHER_HAS_EFFECT
|
if (weather & B_WEATHER_SUN
|
||||||
&& ((IS_MOVE_PHYSICAL(move) && atkHighestStat == STAT_ATK) || (IS_MOVE_SPECIAL(move) && atkHighestStat == STAT_SPATK)))
|
&& ((IS_MOVE_PHYSICAL(move) && atkHighestStat == STAT_ATK) || (IS_MOVE_SPECIAL(move) && atkHighestStat == STAT_SPATK)))
|
||||||
modifier = uq4_12_multiply(modifier, UQ_4_12(1.3));
|
modifier = uq4_12_multiply(modifier, UQ_4_12(1.3));
|
||||||
}
|
}
|
||||||
@ -8927,7 +8927,7 @@ static inline u32 CalcMoveBasePowerAfterModifiers(u16 move, u32 battlerAtk, u32
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ABILITY_ORICHALCUM_PULSE:
|
case ABILITY_ORICHALCUM_PULSE:
|
||||||
if (gBattleWeather & B_WEATHER_SUN && WEATHER_HAS_EFFECT)
|
if (weather & B_WEATHER_SUN)
|
||||||
modifier = uq4_12_multiply(modifier, UQ_4_12(1.3));
|
modifier = uq4_12_multiply(modifier, UQ_4_12(1.3));
|
||||||
break;
|
break;
|
||||||
case ABILITY_HADRON_ENGINE:
|
case ABILITY_HADRON_ENGINE:
|
||||||
@ -9003,7 +9003,7 @@ static inline u32 CalcMoveBasePowerAfterModifiers(u16 move, u32 battlerAtk, u32
|
|||||||
case ABILITY_PROTOSYNTHESIS:
|
case ABILITY_PROTOSYNTHESIS:
|
||||||
{
|
{
|
||||||
u8 defHighestStat = GetHighestStatId(battlerDef);
|
u8 defHighestStat = GetHighestStatId(battlerDef);
|
||||||
if (gBattleWeather & B_WEATHER_SUN && WEATHER_HAS_EFFECT
|
if (weather & B_WEATHER_SUN
|
||||||
&& ((IS_MOVE_PHYSICAL(move) && defHighestStat == STAT_DEF) || (IS_MOVE_SPECIAL(move) && defHighestStat == STAT_SPDEF)))
|
&& ((IS_MOVE_PHYSICAL(move) && defHighestStat == STAT_DEF) || (IS_MOVE_SPECIAL(move) && defHighestStat == STAT_SPDEF)))
|
||||||
modifier = uq4_12_multiply(modifier, UQ_4_12(0.7));
|
modifier = uq4_12_multiply(modifier, UQ_4_12(0.7));
|
||||||
}
|
}
|
||||||
@ -9096,7 +9096,7 @@ static inline u32 CalcMoveBasePowerAfterModifiers(u16 move, u32 battlerAtk, u32
|
|||||||
}
|
}
|
||||||
#undef TERRAIN_TYPE_BOOST
|
#undef TERRAIN_TYPE_BOOST
|
||||||
|
|
||||||
static inline u32 CalcAttackStat(u16 move, u32 battlerAtk, u32 battlerDef, u8 moveType, bool32 isCrit, bool32 updateFlags, u32 atkAbility, u32 defAbility, u32 holdEffectAtk)
|
static inline u32 CalcAttackStat(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, bool32 isCrit, bool32 updateFlags, u32 atkAbility, u32 defAbility, u32 holdEffectAtk)
|
||||||
{
|
{
|
||||||
u8 atkStage;
|
u8 atkStage;
|
||||||
u32 atkStat;
|
u32 atkStat;
|
||||||
@ -9300,7 +9300,7 @@ static bool32 CanEvolve(u32 species)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u32 CalcDefenseStat(u16 move, u32 battlerAtk, u32 battlerDef, u8 moveType, bool32 isCrit, bool32 updateFlags, u32 atkAbility, u32 defAbility, u32 holdEffectDef)
|
static inline u32 CalcDefenseStat(u32 move, u32 battlerAtk, u32 battlerDef, u32 moveType, bool32 isCrit, bool32 updateFlags, u32 atkAbility, u32 defAbility, u32 holdEffectDef, u32 weather)
|
||||||
{
|
{
|
||||||
bool32 usesDefStat;
|
bool32 usesDefStat;
|
||||||
u8 defStage;
|
u8 defStage;
|
||||||
@ -9432,10 +9432,10 @@ static inline u32 CalcDefenseStat(u16 move, u32 battlerAtk, u32 battlerDef, u8 m
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sandstorm sp.def boost for rock types
|
// sandstorm sp.def boost for rock types
|
||||||
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ROCK) && gBattleWeather & B_WEATHER_SANDSTORM && WEATHER_HAS_EFFECT && !usesDefStat)
|
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ROCK) && weather & B_WEATHER_SANDSTORM && !usesDefStat)
|
||||||
modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5));
|
modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5));
|
||||||
// snow def boost for ice types
|
// snow def boost for ice types
|
||||||
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE) && gBattleWeather & B_WEATHER_SNOW && WEATHER_HAS_EFFECT && usesDefStat)
|
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ICE) && weather & B_WEATHER_SNOW && usesDefStat)
|
||||||
modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5));
|
modifier = uq4_12_multiply_half_down(modifier, UQ_4_12(1.5));
|
||||||
|
|
||||||
// The defensive stats of a Player's Pokémon are boosted by x1.1 (+10%) if they have the 5th badge and 7th badges.
|
// The defensive stats of a Player's Pokémon are boosted by x1.1 (+10%) if they have the 5th badge and 7th badges.
|
||||||
@ -9500,22 +9500,22 @@ static inline uq4_12_t GetSameTypeAttackBonusModifier(u32 battlerAtk, u32 moveTy
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Utility Umbrella holders take normal damage from what would be rain- and sun-weakened attacks.
|
// Utility Umbrella holders take normal damage from what would be rain- and sun-weakened attacks.
|
||||||
static uq4_12_t GetWeatherDamageModifier(u32 battlerAtk, u32 move, u32 moveType, u32 holdEffectAtk, u32 holdEffectDef)
|
static uq4_12_t GetWeatherDamageModifier(u32 battlerAtk, u32 move, u32 moveType, u32 holdEffectAtk, u32 holdEffectDef, u32 weather)
|
||||||
{
|
{
|
||||||
if (!WEATHER_HAS_EFFECT)
|
if (weather == B_WEATHER_NONE)
|
||||||
return UQ_4_12(1.0);
|
return UQ_4_12(1.0);
|
||||||
if (gBattleMoves[move].effect == EFFECT_HYDRO_STEAM && (gBattleWeather & B_WEATHER_SUN) && holdEffectAtk != HOLD_EFFECT_UTILITY_UMBRELLA)
|
if (gBattleMoves[move].effect == EFFECT_HYDRO_STEAM && (weather & B_WEATHER_SUN) && holdEffectAtk != HOLD_EFFECT_UTILITY_UMBRELLA)
|
||||||
return UQ_4_12(1.5);
|
return UQ_4_12(1.5);
|
||||||
if (holdEffectDef == HOLD_EFFECT_UTILITY_UMBRELLA)
|
if (holdEffectDef == HOLD_EFFECT_UTILITY_UMBRELLA)
|
||||||
return UQ_4_12(1.0);
|
return UQ_4_12(1.0);
|
||||||
|
|
||||||
if (gBattleWeather & B_WEATHER_RAIN)
|
if (weather & B_WEATHER_RAIN)
|
||||||
{
|
{
|
||||||
if (moveType != TYPE_FIRE && moveType != TYPE_WATER)
|
if (moveType != TYPE_FIRE && moveType != TYPE_WATER)
|
||||||
return UQ_4_12(1.0);
|
return UQ_4_12(1.0);
|
||||||
return (moveType == TYPE_FIRE) ? UQ_4_12(0.5) : UQ_4_12(1.5);
|
return (moveType == TYPE_FIRE) ? UQ_4_12(0.5) : UQ_4_12(1.5);
|
||||||
}
|
}
|
||||||
if (gBattleWeather & B_WEATHER_SUN)
|
if (weather & B_WEATHER_SUN)
|
||||||
{
|
{
|
||||||
if (moveType != TYPE_FIRE && moveType != TYPE_WATER)
|
if (moveType != TYPE_FIRE && moveType != TYPE_WATER)
|
||||||
return UQ_4_12(1.0);
|
return UQ_4_12(1.0);
|
||||||
@ -9762,6 +9762,7 @@ static inline s32 DoMoveDamageCalc(u32 move, u32 battlerAtk, u32 battlerDef, u32
|
|||||||
bool32 isCrit, bool32 randomFactor, bool32 updateFlags, uq4_12_t typeEffectivenessModifier)
|
bool32 isCrit, bool32 randomFactor, bool32 updateFlags, uq4_12_t typeEffectivenessModifier)
|
||||||
{
|
{
|
||||||
s32 dmg;
|
s32 dmg;
|
||||||
|
u32 weather;
|
||||||
u32 userFinalAttack;
|
u32 userFinalAttack;
|
||||||
u32 targetFinalDefense;
|
u32 targetFinalDefense;
|
||||||
u32 holdEffectAtk = GetBattlerHoldEffect(battlerAtk, TRUE);
|
u32 holdEffectAtk = GetBattlerHoldEffect(battlerAtk, TRUE);
|
||||||
@ -9772,18 +9773,24 @@ static inline s32 DoMoveDamageCalc(u32 move, u32 battlerAtk, u32 battlerDef, u32
|
|||||||
if (typeEffectivenessModifier == UQ_4_12(0.0))
|
if (typeEffectivenessModifier == UQ_4_12(0.0))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// Store weather in a local variable, so there's no need to call WEATHER_HAS_EFFECT every time weather is checked.
|
||||||
|
if (gBattleWeather == B_WEATHER_NONE || !WEATHER_HAS_EFFECT)
|
||||||
|
weather = B_WEATHER_NONE;
|
||||||
|
else
|
||||||
|
weather = gBattleWeather;
|
||||||
|
|
||||||
if (fixedBasePower)
|
if (fixedBasePower)
|
||||||
gBattleMovePower = fixedBasePower;
|
gBattleMovePower = fixedBasePower;
|
||||||
else
|
else
|
||||||
gBattleMovePower = CalcMoveBasePowerAfterModifiers(move, battlerAtk, battlerDef, moveType, updateFlags, abilityAtk, abilityDef, holdEffectAtk);
|
gBattleMovePower = CalcMoveBasePowerAfterModifiers(move, battlerAtk, battlerDef, moveType, updateFlags, abilityAtk, abilityDef, holdEffectAtk, weather);
|
||||||
|
|
||||||
userFinalAttack = CalcAttackStat(move, battlerAtk, battlerDef, moveType, isCrit, updateFlags, abilityAtk, abilityDef, holdEffectAtk);
|
userFinalAttack = CalcAttackStat(move, battlerAtk, battlerDef, moveType, isCrit, updateFlags, abilityAtk, abilityDef, holdEffectAtk);
|
||||||
targetFinalDefense = CalcDefenseStat(move, battlerAtk, battlerDef, moveType, isCrit, updateFlags, abilityAtk, abilityDef, holdEffectDef);
|
targetFinalDefense = CalcDefenseStat(move, battlerAtk, battlerDef, moveType, isCrit, updateFlags, abilityAtk, abilityDef, holdEffectDef, weather);
|
||||||
|
|
||||||
dmg = CalculateBaseDamage(gBattleMovePower, userFinalAttack, gBattleMons[battlerAtk].level, targetFinalDefense);
|
dmg = CalculateBaseDamage(gBattleMovePower, userFinalAttack, gBattleMons[battlerAtk].level, targetFinalDefense);
|
||||||
DAMAGE_APPLY_MODIFIER(GetTargetDamageModifier(move, battlerAtk, battlerDef));
|
DAMAGE_APPLY_MODIFIER(GetTargetDamageModifier(move, battlerAtk, battlerDef));
|
||||||
DAMAGE_APPLY_MODIFIER(GetParentalBondModifier(battlerAtk));
|
DAMAGE_APPLY_MODIFIER(GetParentalBondModifier(battlerAtk));
|
||||||
DAMAGE_APPLY_MODIFIER(GetWeatherDamageModifier(battlerAtk, move, moveType, holdEffectAtk, holdEffectDef));
|
DAMAGE_APPLY_MODIFIER(GetWeatherDamageModifier(battlerAtk, move, moveType, holdEffectAtk, holdEffectDef, weather));
|
||||||
DAMAGE_APPLY_MODIFIER(GetCriticalModifier(isCrit));
|
DAMAGE_APPLY_MODIFIER(GetCriticalModifier(isCrit));
|
||||||
// TODO: Glaive Rush (Gen IX effect)
|
// TODO: Glaive Rush (Gen IX effect)
|
||||||
if (randomFactor)
|
if (randomFactor)
|
||||||
@ -10071,7 +10078,7 @@ s32 GetStealthHazardDamageByTypesAndHP(u8 hazardType, u8 type1, u8 type2, u32 ma
|
|||||||
return dmg;
|
return dmg;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 GetStealthHazardDamage(u8 hazardType, u8 battler)
|
s32 GetStealthHazardDamage(u8 hazardType, u32 battler)
|
||||||
{
|
{
|
||||||
u8 type1 = gBattleMons[battler].type1;
|
u8 type1 = gBattleMons[battler].type1;
|
||||||
u8 type2 = gBattleMons[battler].type2;
|
u8 type2 = gBattleMons[battler].type2;
|
||||||
@ -10080,7 +10087,7 @@ s32 GetStealthHazardDamage(u8 hazardType, u8 battler)
|
|||||||
return GetStealthHazardDamageByTypesAndHP(hazardType, type1, type2, maxHp);
|
return GetStealthHazardDamageByTypesAndHP(hazardType, type1, type2, maxHp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsPartnerMonFromSameTrainer(u8 battler)
|
bool32 IsPartnerMonFromSameTrainer(u32 battler)
|
||||||
{
|
{
|
||||||
if (GetBattlerSide(battler) == B_SIDE_OPPONENT && gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
|
if (GetBattlerSide(battler) == B_SIDE_OPPONENT && gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -10116,11 +10123,11 @@ bool32 DoesSpeciesUseHoldItemToChangeForm(u16 species, u16 heldItemId)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanMegaEvolve(u8 battler)
|
bool32 CanMegaEvolve(u32 battler)
|
||||||
{
|
{
|
||||||
u32 itemId, holdEffect, species;
|
u32 itemId, holdEffect, species;
|
||||||
struct Pokemon *mon;
|
struct Pokemon *mon;
|
||||||
u8 battlerPosition = GetBattlerPosition(battler);
|
u32 battlerPosition = GetBattlerPosition(battler);
|
||||||
u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battler));
|
u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battler));
|
||||||
struct MegaEvolutionData *mega = &(((struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]))->mega);
|
struct MegaEvolutionData *mega = &(((struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]))->mega);
|
||||||
|
|
||||||
@ -10180,11 +10187,11 @@ bool32 CanMegaEvolve(u8 battler)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanUltraBurst(u8 battler)
|
bool32 CanUltraBurst(u32 battler)
|
||||||
{
|
{
|
||||||
u32 itemId, holdEffect, species;
|
u32 itemId, holdEffect, species;
|
||||||
struct Pokemon *mon;
|
struct Pokemon *mon;
|
||||||
u8 battlerPosition = GetBattlerPosition(battler);
|
u32 battlerPosition = GetBattlerPosition(battler);
|
||||||
u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battler));
|
u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battler));
|
||||||
|
|
||||||
// Check if Player has a Z Ring
|
// Check if Player has a Z Ring
|
||||||
@ -10235,7 +10242,7 @@ bool32 CanUltraBurst(u8 battler)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsBattlerMegaEvolved(u8 battler)
|
bool32 IsBattlerMegaEvolved(u32 battler)
|
||||||
{
|
{
|
||||||
// While Transform does copy stats and visuals, it shouldn't be counted as true Mega Evolution.
|
// While Transform does copy stats and visuals, it shouldn't be counted as true Mega Evolution.
|
||||||
if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
|
if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
|
||||||
@ -10243,7 +10250,7 @@ bool32 IsBattlerMegaEvolved(u8 battler)
|
|||||||
return (gSpeciesInfo[gBattleMons[battler].species].flags & SPECIES_FLAG_MEGA_EVOLUTION);
|
return (gSpeciesInfo[gBattleMons[battler].species].flags & SPECIES_FLAG_MEGA_EVOLUTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsBattlerPrimalReverted(u8 battler)
|
bool32 IsBattlerPrimalReverted(u32 battler)
|
||||||
{
|
{
|
||||||
// While Transform does copy stats and visuals, it shouldn't be counted as true Primal Revesion.
|
// While Transform does copy stats and visuals, it shouldn't be counted as true Primal Revesion.
|
||||||
if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
|
if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
|
||||||
@ -10251,7 +10258,7 @@ bool32 IsBattlerPrimalReverted(u8 battler)
|
|||||||
return (gSpeciesInfo[gBattleMons[battler].species].flags & SPECIES_FLAG_PRIMAL_REVERSION);
|
return (gSpeciesInfo[gBattleMons[battler].species].flags & SPECIES_FLAG_PRIMAL_REVERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsBattlerUltraBursted(u8 battler)
|
bool32 IsBattlerUltraBursted(u32 battler)
|
||||||
{
|
{
|
||||||
// While Transform does copy stats and visuals, it shouldn't be counted as true Ultra Burst.
|
// While Transform does copy stats and visuals, it shouldn't be counted as true Ultra Burst.
|
||||||
if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
|
if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
|
||||||
@ -10260,7 +10267,7 @@ bool32 IsBattlerUltraBursted(u8 battler)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns SPECIES_NONE if no form change is possible
|
// Returns SPECIES_NONE if no form change is possible
|
||||||
u16 GetBattleFormChangeTargetSpecies(u8 battler, u16 method)
|
u16 GetBattleFormChangeTargetSpecies(u32 battler, u16 method)
|
||||||
{
|
{
|
||||||
u32 i, j;
|
u32 i, j;
|
||||||
u16 targetSpecies = SPECIES_NONE;
|
u16 targetSpecies = SPECIES_NONE;
|
||||||
@ -10347,7 +10354,7 @@ u16 GetBattleFormChangeTargetSpecies(u8 battler, u16 method)
|
|||||||
return targetSpecies;
|
return targetSpecies;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanBattlerFormChange(u8 battler, u16 method)
|
bool32 CanBattlerFormChange(u32 battler, u16 method)
|
||||||
{
|
{
|
||||||
// Can't change form if transformed.
|
// Can't change form if transformed.
|
||||||
if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED
|
if (gBattleMons[battler].status2 & STATUS2_TRANSFORMED
|
||||||
@ -10361,7 +10368,7 @@ bool32 CanBattlerFormChange(u8 battler, u16 method)
|
|||||||
return DoesSpeciesHaveFormChangeMethod(gBattleMons[battler].species, method);
|
return DoesSpeciesHaveFormChangeMethod(gBattleMons[battler].species, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 TryBattleFormChange(u8 battler, u16 method)
|
bool32 TryBattleFormChange(u32 battler, u16 method)
|
||||||
{
|
{
|
||||||
u8 monId = gBattlerPartyIndexes[battler];
|
u8 monId = gBattlerPartyIndexes[battler];
|
||||||
u8 side = GET_BATTLER_SIDE(battler);
|
u8 side = GET_BATTLER_SIDE(battler);
|
||||||
@ -10388,7 +10395,7 @@ bool32 TryBattleFormChange(u8 battler, u16 method)
|
|||||||
}
|
}
|
||||||
else if (gBattleStruct->changedSpecies[side][monId] != SPECIES_NONE)
|
else if (gBattleStruct->changedSpecies[side][monId] != SPECIES_NONE)
|
||||||
{
|
{
|
||||||
bool8 restoreSpecies = FALSE;
|
bool32 restoreSpecies = FALSE;
|
||||||
|
|
||||||
// Mega Evolved and Ultra Bursted Pokémon should always revert to normal upon fainting or ending the battle, so no need to add it to the form change tables.
|
// Mega Evolved and Ultra Bursted Pokémon should always revert to normal upon fainting or ending the battle, so no need to add it to the form change tables.
|
||||||
if ((IsBattlerMegaEvolved(battler) || IsBattlerUltraBursted(battler)) && (method == FORM_CHANGE_FAINT || method == FORM_CHANGE_END_BATTLE))
|
if ((IsBattlerMegaEvolved(battler) || IsBattlerUltraBursted(battler)) && (method == FORM_CHANGE_FAINT || method == FORM_CHANGE_END_BATTLE))
|
||||||
@ -10431,7 +10438,7 @@ bool32 DoBattlersShareType(u32 battler1, u32 battler2)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanBattlerGetOrLoseItem(u8 battler, u16 itemId)
|
bool32 CanBattlerGetOrLoseItem(u32 battler, u16 itemId)
|
||||||
{
|
{
|
||||||
u16 species = gBattleMons[battler].species;
|
u16 species = gBattleMons[battler].species;
|
||||||
u16 holdEffect = ItemId_GetHoldEffect(itemId);
|
u16 holdEffect = ItemId_GetHoldEffect(itemId);
|
||||||
@ -10521,7 +10528,7 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battler)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battler)
|
bool32 ShouldGetStatBadgeBoost(u16 badgeFlag, u32 battler)
|
||||||
{
|
{
|
||||||
#if B_BADGE_BOOST == GEN_3
|
#if B_BADGE_BOOST == GEN_3
|
||||||
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER))
|
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER))
|
||||||
@ -10555,10 +10562,10 @@ u8 GetBattleMoveSplit(u32 moveId)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 TryRemoveScreens(u8 battler)
|
static bool32 TryRemoveScreens(u32 battler)
|
||||||
{
|
{
|
||||||
bool32 removed = FALSE;
|
bool32 removed = FALSE;
|
||||||
u8 battlerSide = GetBattlerSide(battler);
|
u32 battlerSide = GetBattlerSide(battler);
|
||||||
u8 enemySide = GetBattlerSide(BATTLE_OPPOSITE(battler));
|
u8 enemySide = GetBattlerSide(BATTLE_OPPOSITE(battler));
|
||||||
|
|
||||||
// try to remove from battler's side
|
// try to remove from battler's side
|
||||||
@ -10584,7 +10591,7 @@ static bool32 TryRemoveScreens(u8 battler)
|
|||||||
return removed;
|
return removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 IsUnnerveAbilityOnOpposingSide(u8 battler)
|
static bool32 IsUnnerveAbilityOnOpposingSide(u32 battler)
|
||||||
{
|
{
|
||||||
if (IsAbilityOnOpposingSide(battler, ABILITY_UNNERVE)
|
if (IsAbilityOnOpposingSide(battler, ABILITY_UNNERVE)
|
||||||
|| IsAbilityOnOpposingSide(battler, ABILITY_AS_ONE_ICE_RIDER)
|
|| IsAbilityOnOpposingSide(battler, ABILITY_AS_ONE_ICE_RIDER)
|
||||||
@ -10594,7 +10601,7 @@ static bool32 IsUnnerveAbilityOnOpposingSide(u8 battler)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Photon geyser & light that burns the sky
|
// Photon geyser & light that burns the sky
|
||||||
u8 GetSplitBasedOnStats(u8 battler)
|
u8 GetSplitBasedOnStats(u32 battler)
|
||||||
{
|
{
|
||||||
u32 attack = gBattleMons[battler].attack;
|
u32 attack = gBattleMons[battler].attack;
|
||||||
u32 spAttack = gBattleMons[battler].spAttack;
|
u32 spAttack = gBattleMons[battler].spAttack;
|
||||||
@ -10611,11 +10618,11 @@ u8 GetSplitBasedOnStats(u8 battler)
|
|||||||
return SPLIT_PHYSICAL;
|
return SPLIT_PHYSICAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 GetFlingPowerFromItemId(u16 itemId)
|
static u32 GetFlingPowerFromItemId(u32 itemId)
|
||||||
{
|
{
|
||||||
if (itemId >= ITEM_TM01 && itemId <= ITEM_HM08)
|
if (itemId >= ITEM_TM01 && itemId <= ITEM_HM08)
|
||||||
{
|
{
|
||||||
u8 power = gBattleMoves[ItemIdToBattleMoveId(itemId)].power;
|
u32 power = gBattleMoves[ItemIdToBattleMoveId(itemId)].power;
|
||||||
if (power > 1)
|
if (power > 1)
|
||||||
return power;
|
return power;
|
||||||
return 10; // Status moves and moves with variable power always return 10 power.
|
return 10; // Status moves and moves with variable power always return 10 power.
|
||||||
@ -10721,7 +10728,7 @@ bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability)
|
|||||||
|
|
||||||
// Sort an array of battlers by speed
|
// Sort an array of battlers by speed
|
||||||
// Useful for effects like pickpocket, eject button, red card, dancer
|
// Useful for effects like pickpocket, eject button, red card, dancer
|
||||||
void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast)
|
void SortBattlersBySpeed(u8 *battlers, bool32 slowToFast)
|
||||||
{
|
{
|
||||||
int i, j, currSpeed, currBattler;
|
int i, j, currSpeed, currBattler;
|
||||||
u16 speeds[MAX_BATTLERS_COUNT] = {0};
|
u16 speeds[MAX_BATTLERS_COUNT] = {0};
|
||||||
@ -10777,7 +10784,7 @@ void TryRestoreHeldItems(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item)
|
bool32 CanStealItem(u32 battlerStealing, u32 battlerItem, u16 item)
|
||||||
{
|
{
|
||||||
u8 stealerSide = GetBattlerSide(battlerStealing);
|
u8 stealerSide = GetBattlerSide(battlerStealing);
|
||||||
|
|
||||||
@ -10817,7 +10824,7 @@ bool32 CanStealItem(u8 battlerStealing, u8 battlerItem, u16 item)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrySaveExchangedItem(u8 battler, u16 stolenItem)
|
void TrySaveExchangedItem(u32 battler, u16 stolenItem)
|
||||||
{
|
{
|
||||||
// Because BtlController_EmitSetMonData does SetMonData, we need to save the stolen item only if it matches the battler's original
|
// Because BtlController_EmitSetMonData does SetMonData, we need to save the stolen item only if it matches the battler's original
|
||||||
// So, if the player steals an item during battle and has it stolen from it, it will not end the battle with it (naturally)
|
// So, if the player steals an item during battle and has it stolen from it, it will not end the battle with it (naturally)
|
||||||
@ -10831,7 +10838,7 @@ void TrySaveExchangedItem(u8 battler, u16 stolenItem)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsBattlerAffectedByHazards(u8 battler, bool32 toxicSpikes)
|
bool32 IsBattlerAffectedByHazards(u32 battler, bool32 toxicSpikes)
|
||||||
{
|
{
|
||||||
bool32 ret = TRUE;
|
bool32 ret = TRUE;
|
||||||
u32 holdEffect = GetBattlerHoldEffect(battler, TRUE);
|
u32 holdEffect = GetBattlerHoldEffect(battler, TRUE);
|
||||||
@ -10848,7 +10855,7 @@ bool32 IsBattlerAffectedByHazards(u8 battler, bool32 toxicSpikes)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 TestSheerForceFlag(u8 battler, u16 move)
|
bool32 TestSheerForceFlag(u32 battler, u16 move)
|
||||||
{
|
{
|
||||||
if (GetBattlerAbility(battler) == ABILITY_SHEER_FORCE && gBattleMoves[move].sheerForceBoost)
|
if (GetBattlerAbility(battler) == ABILITY_SHEER_FORCE && gBattleMoves[move].sheerForceBoost)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -10857,9 +10864,9 @@ bool32 TestSheerForceFlag(u8 battler, u16 move)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This function is the body of "jumpifstat", but can be used dynamically in a function
|
// This function is the body of "jumpifstat", but can be used dynamically in a function
|
||||||
bool32 CompareStat(u8 battler, u8 statId, u8 cmpTo, u8 cmpKind)
|
bool32 CompareStat(u32 battler, u8 statId, u8 cmpTo, u8 cmpKind)
|
||||||
{
|
{
|
||||||
bool8 ret = FALSE;
|
bool32 ret = FALSE;
|
||||||
u8 statValue = gBattleMons[battler].statStages[statId];
|
u8 statValue = gBattleMons[battler].statStages[statId];
|
||||||
|
|
||||||
// Because this command is used as a way of checking if a stat can be lowered/raised,
|
// Because this command is used as a way of checking if a stat can be lowered/raised,
|
||||||
@ -10908,9 +10915,9 @@ bool32 CompareStat(u8 battler, u8 statId, u8 cmpTo, u8 cmpKind)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferStatChange(u8 battler, u8 statId, u8 stringId)
|
void BufferStatChange(u32 battler, u8 statId, u8 stringId)
|
||||||
{
|
{
|
||||||
bool8 hasContrary = (GetBattlerAbility(battler) == ABILITY_CONTRARY);
|
bool32 hasContrary = (GetBattlerAbility(battler) == ABILITY_CONTRARY);
|
||||||
|
|
||||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, statId);
|
PREPARE_STAT_BUFFER(gBattleTextBuff1, statId);
|
||||||
if (stringId == STRINGID_STATFELL)
|
if (stringId == STRINGID_STATFELL)
|
||||||
@ -10933,7 +10940,7 @@ void BufferStatChange(u8 battler, u8 statId, u8 stringId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 TryRoomService(u8 battler)
|
bool32 TryRoomService(u32 battler)
|
||||||
{
|
{
|
||||||
if (gFieldStatuses & STATUS_FIELD_TRICK_ROOM && CompareStat(battler, STAT_SPEED, MIN_STAT_STAGE, CMP_GREATER_THAN))
|
if (gFieldStatuses & STATUS_FIELD_TRICK_ROOM && CompareStat(battler, STAT_SPEED, MIN_STAT_STAGE, CMP_GREATER_THAN))
|
||||||
{
|
{
|
||||||
@ -10951,7 +10958,7 @@ bool32 TryRoomService(u8 battler)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u32 battlerDef, bool32 checkTarget)
|
bool32 BlocksPrankster(u16 move, u32 battlerPrankster, u32 battlerDef, bool32 checkTarget)
|
||||||
{
|
{
|
||||||
#if B_PRANKSTER_DARK_TYPES >= GEN_7
|
#if B_PRANKSTER_DARK_TYPES >= GEN_7
|
||||||
if (!gProtectStructs[battlerPrankster].pranksterElevated)
|
if (!gProtectStructs[battlerPrankster].pranksterElevated)
|
||||||
@ -10970,12 +10977,12 @@ bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u32 battlerDef, bool32 che
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 GetUsedHeldItem(u8 battler)
|
u16 GetUsedHeldItem(u32 battler)
|
||||||
{
|
{
|
||||||
return gBattleStruct->usedHeldItems[gBattlerPartyIndexes[battler]][GetBattlerSide(battler)];
|
return gBattleStruct->usedHeldItems[gBattlerPartyIndexes[battler]][GetBattlerSide(battler)];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 IsBattlerWeatherAffected(u8 battler, u32 weatherFlags)
|
bool32 IsBattlerWeatherAffected(u32 battler, u32 weatherFlags)
|
||||||
{
|
{
|
||||||
if (gBattleWeather & weatherFlags && WEATHER_HAS_EFFECT)
|
if (gBattleWeather & weatherFlags && WEATHER_HAS_EFFECT)
|
||||||
{
|
{
|
||||||
@ -10990,7 +10997,7 @@ bool32 IsBattlerWeatherAffected(u8 battler, u32 weatherFlags)
|
|||||||
|
|
||||||
// Gets move target before redirection effects etc. are applied
|
// Gets move target before redirection effects etc. are applied
|
||||||
// Possible return values are defined in battle.h following MOVE_TARGET_SELECTED
|
// Possible return values are defined in battle.h following MOVE_TARGET_SELECTED
|
||||||
u32 GetBattlerMoveTargetType(u8 battler, u16 move)
|
u32 GetBattlerMoveTargetType(u32 battler, u32 move)
|
||||||
{
|
{
|
||||||
u32 target;
|
u32 target;
|
||||||
|
|
||||||
@ -11055,13 +11062,13 @@ void RecalcBattlerStats(u32 battler, struct Pokemon *mon)
|
|||||||
CopyMonAbilityAndTypesToBattleMon(battler, mon);
|
CopyMonAbilityAndTypesToBattleMon(battler, mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveConfusionStatus(u8 battler)
|
void RemoveConfusionStatus(u32 battler)
|
||||||
{
|
{
|
||||||
gBattleMons[battler].status2 &= ~STATUS2_CONFUSION;
|
gBattleMons[battler].status2 &= ~STATUS2_CONFUSION;
|
||||||
gStatuses4[battler] &= ~STATUS4_INFINITE_CONFUSION;
|
gStatuses4[battler] &= ~STATUS4_INFINITE_CONFUSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 CanBeInfinitelyConfused(u8 battler)
|
static bool32 CanBeInfinitelyConfused(u32 battler)
|
||||||
{
|
{
|
||||||
if (gBattleMons[battler].ability == ABILITY_OWN_TEMPO
|
if (gBattleMons[battler].ability == ABILITY_OWN_TEMPO
|
||||||
|| IsBattlerTerrainAffected(battler, STATUS_FIELD_MISTY_TERRAIN)
|
|| IsBattlerTerrainAffected(battler, STATUS_FIELD_MISTY_TERRAIN)
|
||||||
@ -11072,13 +11079,13 @@ static bool8 CanBeInfinitelyConfused(u8 battler)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetBattlerGender(u8 battler)
|
u8 GetBattlerGender(u32 battler)
|
||||||
{
|
{
|
||||||
return GetGenderFromSpeciesAndPersonality(gBattleMons[battler].species,
|
return GetGenderFromSpeciesAndPersonality(gBattleMons[battler].species,
|
||||||
gBattleMons[battler].personality);
|
gBattleMons[battler].personality);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2)
|
bool32 AreBattlersOfOppositeGender(u32 battler1, u32 battler2)
|
||||||
{
|
{
|
||||||
u8 gender1 = GetBattlerGender(battler1);
|
u8 gender1 = GetBattlerGender(battler1);
|
||||||
u8 gender2 = GetBattlerGender(battler2);
|
u8 gender2 = GetBattlerGender(battler2);
|
||||||
@ -11086,7 +11093,7 @@ bool8 AreBattlersOfOppositeGender(u8 battler1, u8 battler2)
|
|||||||
return (gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS && gender1 != gender2);
|
return (gender1 != MON_GENDERLESS && gender2 != MON_GENDERLESS && gender1 != gender2);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 CalcSecondaryEffectChance(u8 battler, u8 secondaryEffectChance)
|
u32 CalcSecondaryEffectChance(u32 battler, u8 secondaryEffectChance)
|
||||||
{
|
{
|
||||||
if (GetBattlerAbility(battler) == ABILITY_SERENE_GRACE)
|
if (GetBattlerAbility(battler) == ABILITY_SERENE_GRACE)
|
||||||
secondaryEffectChance *= 2;
|
secondaryEffectChance *= 2;
|
||||||
|
@ -884,12 +884,12 @@ u16 ItemId_GetPrice(u16 itemId)
|
|||||||
return gItems[SanitizeItemId(itemId)].price;
|
return gItems[SanitizeItemId(itemId)].price;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 ItemId_GetHoldEffect(u16 itemId)
|
u32 ItemId_GetHoldEffect(u32 itemId)
|
||||||
{
|
{
|
||||||
return gItems[SanitizeItemId(itemId)].holdEffect;
|
return gItems[SanitizeItemId(itemId)].holdEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 ItemId_GetHoldEffectParam(u16 itemId)
|
u32 ItemId_GetHoldEffectParam(u32 itemId)
|
||||||
{
|
{
|
||||||
return gItems[SanitizeItemId(itemId)].holdEffectParam;
|
return gItems[SanitizeItemId(itemId)].holdEffectParam;
|
||||||
}
|
}
|
||||||
@ -956,7 +956,7 @@ u8 ItemId_GetSecondaryId(u16 itemId)
|
|||||||
return gItems[SanitizeItemId(itemId)].secondaryId;
|
return gItems[SanitizeItemId(itemId)].secondaryId;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 ItemId_GetFlingPower(u16 itemId)
|
u32 ItemId_GetFlingPower(u32 itemId)
|
||||||
{
|
{
|
||||||
return gItems[SanitizeItemId(itemId)].flingPower;
|
return gItems[SanitizeItemId(itemId)].flingPower;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user