mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 09:24:19 +01:00
commit
28273af5ed
File diff suppressed because it is too large
Load Diff
@ -239,8 +239,35 @@ struct AI_SavedBattleMon
|
||||
u16 species;
|
||||
};
|
||||
|
||||
struct AiLogicData
|
||||
{
|
||||
//attacker data
|
||||
u16 atkAbility;
|
||||
u16 atkItem;
|
||||
u16 atkHoldEffect;
|
||||
u8 atkParam;
|
||||
u16 atkSpecies;
|
||||
// target data
|
||||
u16 defAbility;
|
||||
u16 defItem;
|
||||
u16 defHoldEffect;
|
||||
u8 defParam;
|
||||
u16 defSpecies;
|
||||
// attacker partner data
|
||||
u8 battlerAtkPartner;
|
||||
u16 partnerMove;
|
||||
u16 atkPartnerAbility;
|
||||
u16 atkPartnerHoldEffect;
|
||||
bool32 targetSameSide;
|
||||
// target partner data
|
||||
u8 battlerDefPartner;
|
||||
u16 defPartnerAbility;
|
||||
u16 defPartnerHoldEffect;
|
||||
};
|
||||
|
||||
struct AI_ThinkingStruct
|
||||
{
|
||||
struct AiLogicData data;
|
||||
u8 aiState;
|
||||
u8 movesetIndex;
|
||||
u16 moveConsidered;
|
||||
@ -293,11 +320,14 @@ struct BattleResources
|
||||
struct StatsArray* beforeLvlUp;
|
||||
struct AI_ThinkingStruct *ai;
|
||||
struct BattleHistory *battleHistory;
|
||||
struct BattleScriptsStack *AI_ScriptsStack;
|
||||
u8 bufferA[MAX_BATTLERS_COUNT][0x200];
|
||||
u8 bufferB[MAX_BATTLERS_COUNT][0x200];
|
||||
};
|
||||
|
||||
#define AI_THINKING_STRUCT ((struct AI_ThinkingStruct *)(gBattleResources->ai))
|
||||
#define AI_DATA ((struct AiLogicData *)(&gBattleResources->ai->data))
|
||||
#define BATTLE_HISTORY ((struct BattleHistory *)(gBattleResources->battleHistory))
|
||||
|
||||
struct BattleResults
|
||||
{
|
||||
u8 playerFaintCounter; // 0x0
|
||||
|
30
include/battle_ai_main.h
Normal file
30
include/battle_ai_main.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef GUARD_BATTLE_AI_MAIN_H
|
||||
#define GUARD_BATTLE_AI_MAIN_H
|
||||
|
||||
// return values for BattleAI_ChooseMoveOrAction
|
||||
// 0 - 3 are move idx
|
||||
#define AI_CHOICE_FLEE 4
|
||||
#define AI_CHOICE_WATCH 5
|
||||
#define AI_CHOICE_SWITCH 7
|
||||
|
||||
#define RETURN_SCORE_PLUS(val) \
|
||||
{ \
|
||||
score += val; \
|
||||
return score; \
|
||||
}
|
||||
|
||||
#define RETURN_SCORE_MINUS(val) \
|
||||
{ \
|
||||
score -= val; \
|
||||
return score; \
|
||||
}
|
||||
|
||||
|
||||
void BattleAI_SetupItems(void);
|
||||
void BattleAI_SetupFlags(void);
|
||||
void BattleAI_SetupAIData(u8 defaultScoreMoves);
|
||||
u8 BattleAI_ChooseMoveOrAction(void);
|
||||
|
||||
extern u8 sBattler_AI;
|
||||
|
||||
#endif // GUARD_BATTLE_AI_MAIN_H
|
@ -1,27 +0,0 @@
|
||||
#ifndef GUARD_BATTLE_AI_SCRIPT_COMMANDS_H
|
||||
#define GUARD_BATTLE_AI_SCRIPT_COMMANDS_H
|
||||
|
||||
// return values for BattleAI_ChooseMoveOrAction
|
||||
// 0 - 3 are move idx
|
||||
#define AI_CHOICE_FLEE 4
|
||||
#define AI_CHOICE_WATCH 5
|
||||
#define AI_CHOICE_SWITCH 7
|
||||
|
||||
s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef);
|
||||
s32 AI_CalcPartyMonDamage(u16 move, u8 battlerAtk, u8 battlerDef, struct Pokemon *mon);
|
||||
u16 AI_GetTypeEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef);
|
||||
void BattleAI_SetupItems(void);
|
||||
void BattleAI_SetupFlags(void);
|
||||
void BattleAI_SetupAIData(u8 defaultScoreMoves);
|
||||
u8 BattleAI_ChooseMoveOrAction(void);
|
||||
bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler);
|
||||
bool32 IsBattlerAIControlled(u32 battlerId);
|
||||
void ClearBattlerMoveHistory(u8 battlerId);
|
||||
void RecordLastUsedMoveBy(u32 battlerId, u32 move);
|
||||
void RecordKnownMove(u8 battlerId, u32 move);
|
||||
void RecordAbilityBattle(u8 battlerId, u16 abilityId);
|
||||
void ClearBattlerAbilityHistory(u8 battlerId);
|
||||
void RecordItemEffectBattle(u8 battlerId, u8 itemEffect);
|
||||
void ClearBattlerItemEffectHistory(u8 battlerId);
|
||||
|
||||
#endif // GUARD_BATTLE_AI_SCRIPT_COMMANDS_H
|
@ -34,5 +34,6 @@ enum {
|
||||
void GetAIPartyIndexes(u32 battlerId, s32 *firstId, s32 *lastId);
|
||||
void AI_TrySwitchOrUseItem(void);
|
||||
u8 GetMostSuitableMonToSwitchInto(void);
|
||||
bool32 ShouldSwitch(void);
|
||||
|
||||
#endif // GUARD_BATTLE_AI_SWITCH_ITEMS_H
|
||||
|
168
include/battle_ai_util.h
Normal file
168
include/battle_ai_util.h
Normal file
@ -0,0 +1,168 @@
|
||||
#ifndef GUARD_BATTLE_AI_UTIL_H
|
||||
#define GUARD_BATTLE_AI_UTIL_H
|
||||
|
||||
// for IsAiFaster
|
||||
#define AI_CHECK_FASTER 0 // if_user_faster
|
||||
#define AI_CHECK_SLOWER 1 // if_target_faster
|
||||
|
||||
#define FOE(battler) ((battler ^ BIT_SIDE) & BIT_SIDE)
|
||||
|
||||
bool32 AI_RandLessThan(u8 val);
|
||||
void RecordLastUsedMoveByTarget(void);
|
||||
bool32 IsBattlerAIControlled(u32 battlerId);
|
||||
void ClearBattlerMoveHistory(u8 battlerId);
|
||||
void RecordLastUsedMoveBy(u32 battlerId, u32 move);
|
||||
void RecordKnownMove(u8 battlerId, u32 move);
|
||||
void RecordAbilityBattle(u8 battlerId, u16 abilityId);
|
||||
void ClearBattlerAbilityHistory(u8 battlerId);
|
||||
void RecordItemEffectBattle(u8 battlerId, u8 itemEffect);
|
||||
void ClearBattlerItemEffectHistory(u8 battlerId);
|
||||
void SaveBattlerData(u8 battlerId);
|
||||
void SetBattlerData(u8 battlerId);
|
||||
void RestoreBattlerData(u8 battlerId);
|
||||
|
||||
u32 GetTotalBaseStat(u32 species);
|
||||
bool32 IsTruantMonVulnerable(u32 battlerAI, u32 opposingBattler);
|
||||
bool32 AtMaxHp(u8 battler);
|
||||
u32 GetHealthPercentage(u8 battler);
|
||||
bool32 IsBattlerTrapped(u8 battler, bool8 switching);
|
||||
bool32 IsAiFaster(u8 battler);
|
||||
bool32 CanTargetFaintAi(u8 battlerDef, u8 battlerAtk);
|
||||
bool32 CanMoveFaintBattler(u16 move, u8 battlerDef, u8 battlerAtk, u8 nHits);
|
||||
bool32 CanTargetFaintAiWithMod(u8 battlerDef, u8 battlerAtk, s32 hpMod, s32 dmgMod);
|
||||
s32 AI_GetAbility(u32 battlerId);
|
||||
u16 AI_GetHoldEffect(u32 battlerId);
|
||||
u32 AI_GetMoveAccuracy(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbility, u8 atkHoldEffect, u8 defHoldEffect, u16 move);
|
||||
bool32 DoesBattlerIgnoreAbilityChecks(u16 atkAbility, u16 move);
|
||||
bool32 AI_WeatherHasEffect(void);
|
||||
bool32 CanAttackerFaintTarget(u8 battlerAtk, u8 battlerDef, u8 index, u8 numHits);
|
||||
bool32 AI_IsBattlerGrounded(u8 battlerId);
|
||||
bool32 HasDamagingMove(u8 battlerId);
|
||||
bool32 HasDamagingMoveOfType(u8 battlerId, u8 type);
|
||||
u32 GetBattlerSecondaryDamage(u8 battlerId);
|
||||
bool32 BattlerWillFaintFromWeather(u8 battler, u16 ability);
|
||||
bool32 BattlerWillFaintFromSecondaryDamage(u8 battler, u16 ability);
|
||||
bool32 ShouldTryOHKO(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbility, u32 accuracy, u16 move);
|
||||
bool32 ShouldUseRecoilMove(u8 battlerAtk, u8 battlerDef, u32 recoilDmg, u8 moveIndex);
|
||||
u16 GetBattlerSideSpeedAverage(u8 battler);
|
||||
bool32 ShouldAbsorb(u8 battlerAtk, u8 battlerDef, u16 move, s32 damage);
|
||||
bool32 ShouldRecover(u8 battlerAtk, u8 battlerDef, u16 move, u8 healPercent);
|
||||
bool32 ShouldSetScreen(u8 battlerAtk, u8 battlerDef, u16 moveEffect);
|
||||
bool32 ShouldPivot(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u8 moveIndex);
|
||||
bool32 IsRecycleEncouragedItem(u16 item);
|
||||
bool32 CanKnockOffItem(u8 battler, u16 item);
|
||||
bool32 IsAbilityOfRating(u16 ability, s8 rating);
|
||||
s8 GetAbilityRating(u16 ability);
|
||||
|
||||
// stat stage checks
|
||||
bool32 AnyStatIsRaised(u8 battlerId);
|
||||
bool32 ShouldLowerStat(u8 battler, u16 battlerAbility, u8 stat);
|
||||
bool32 BattlerStatCanRise(u8 battler, u16 battlerAbility, u8 stat);
|
||||
bool32 AreBattlersStatsMaxed(u8 battler);
|
||||
bool32 BattlerHasAnyStatRaised(u8 battlerId);
|
||||
u32 CountPositiveStatStages(u8 battlerId);
|
||||
u32 CountNegativeStatStages(u8 battlerId);
|
||||
bool32 ShouldLowerAttack(u8 battlerAtk, u8 battlerDef, u16 defAbility);
|
||||
bool32 ShouldLowerDefense(u8 battlerAtk, u8 battlerDef, u16 defAbility);
|
||||
bool32 ShouldLowerSpeed(u8 battlerAtk, u8 battlerDef, u16 defAbility);
|
||||
bool32 ShouldLowerSpAtk(u8 battlerAtk, u8 battlerDef, u16 defAbility);
|
||||
bool32 ShouldLowerSpDef(u8 battlerAtk, u8 battlerDef, u16 defAbility);
|
||||
bool32 ShouldLowerAccuracy(u8 battlerAtk, u8 battlerDef, u16 defAbility);
|
||||
bool32 ShouldLowerEvasion(u8 battlerAtk, u8 battlerDef, u16 defAbility);
|
||||
|
||||
// move checks
|
||||
bool32 IsAffectedByPowder(u8 battler, u16 ability, u16 holdEffect);
|
||||
bool32 MovesWithSplitUnusable(u32 attacker, u32 target, u32 split);
|
||||
s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef);
|
||||
u8 GetMoveDamageResult(u16 move);
|
||||
u32 GetCurrDamageHpPercent(u8 battlerAtk, u8 battlerDef);
|
||||
u16 AI_GetTypeEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef);
|
||||
u8 AI_GetMoveEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef);
|
||||
u16 *GetMovesArray(u32 battler);
|
||||
bool32 IsConfusionMoveEffect(u16 moveEffect);
|
||||
bool32 HasMove(u32 battlerId, u32 move);
|
||||
bool32 HasOnlyMovesWithSplit(u32 battlerId, u32 split, bool32 onlyOffensive);
|
||||
bool32 HasMoveWithSplit(u32 battler, u32 split);
|
||||
bool32 HasMoveWithType(u32 battler, u8 type);
|
||||
bool32 HasMoveWithTypeAndSplit(u32 battler, u8 type, u8 split);
|
||||
bool32 HasMoveEffect(u32 battlerId, u16 moveEffect);
|
||||
bool32 HasMoveWithLowAccuracy(u8, u8, u8, bool32, u16, u16, u16, u16);
|
||||
bool32 TestMoveFlagsInMoveset(u8 battler, u32 flags);
|
||||
bool32 IsAromaVeilProtectedMove(u16 move);
|
||||
bool32 IsNonVolatileStatusMoveEffect(u16 moveEffect);
|
||||
bool32 IsStatLoweringMoveEffect(u16 moveEffect);
|
||||
bool32 IsMoveRedirectionPrevented(u16 move, u16 atkAbility);
|
||||
bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move);
|
||||
bool32 IsHazardMoveEffect(u16 moveEffect);
|
||||
bool32 MoveCallsOtherMove(u16 move);
|
||||
bool32 MoveRequiresRecharging(u16 move);
|
||||
bool32 IsInstructBannedMove(u16 move);
|
||||
bool32 IsEncoreEncouragedEffect(u16 moveEffect);
|
||||
void ProtectChecks(u8 battlerAtk, u8 battlerDef, u16 move, u16 predictedMove, s16 *score);
|
||||
bool32 ShouldSetSandstorm(u8 battler, u16 ability, u16 holdEffect);
|
||||
bool32 ShouldSetHail(u8 battler, u16 ability, u16 holdEffect);
|
||||
bool32 ShouldSetRain(u8 battlerAtk, u16 ability, u16 holdEffect);
|
||||
bool32 ShouldSetSun(u8 battlerAtk, u16 atkAbility, u16 holdEffect);
|
||||
bool32 HasSleepMoveWithLowAccuracy(u8 battlerAtk, u8 battlerDef);
|
||||
bool32 IsHealingMoveEffect(u16 effect);
|
||||
bool32 HasHealingEffect(u32 battler);
|
||||
bool32 IsTrappingMoveEffect(u16 effect);
|
||||
bool32 HasTrappingMoveEffect(u8 battler);
|
||||
bool32 ShouldFakeOut(u8 battlerAtk, u8 battlerDef, u16 move);
|
||||
bool32 HasThawingMove(u8 battlerId);
|
||||
bool32 IsStatRaisingEffect(u16 effect);
|
||||
bool32 IsStatLoweringEffect(u16 effect);
|
||||
bool32 IsStatRaisingEffect(u16 effect);
|
||||
bool32 IsAttackBoostMoveEffect(u16 effect);
|
||||
bool32 IsUngroundingEffect(u16 effect);
|
||||
bool32 IsSemiInvulnerable(u8 battlerDef, u16 move);
|
||||
|
||||
// status checks
|
||||
bool32 CanBeBurned(u8 battler, u16 ability);
|
||||
bool32 CanBePoisoned(u8 battler, u16 ability);
|
||||
bool32 CanBeConfused(u8 battler, u16 ability);
|
||||
bool32 CanSleep(u8 battler, u16 ability);
|
||||
bool32 IsBattlerIncapacitated(u8 battler, u16 ability);
|
||||
bool32 AI_CanPutToSleep(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove);
|
||||
bool32 ShouldPoisonSelf(u8 battler, u16 ability);
|
||||
bool32 AI_CanPoison(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove);
|
||||
bool32 AI_CanParalyze(u8 battlerAtk, u8 battlerDef, u16 defAbility, u16 move, u16 partnerMove);
|
||||
bool32 AI_CanConfuse(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove);
|
||||
bool32 ShouldBurnSelf(u8 battler, u16 ability);
|
||||
bool32 AI_CanBurn(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 battlerAtkPartner, u16 move, u16 partnerMove);
|
||||
bool32 AI_CanBeInfatuated(u8 battlerAtk, u8 battlerDef, u16 defAbility, u8 atkGender, u8 defGender);
|
||||
bool32 AnyPartyMemberStatused(u8 battlerId, bool32 checkSoundproof);
|
||||
u32 ShouldTryToFlinch(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbility, u16 move);
|
||||
bool32 ShouldTrap(u8 battlerAtk, u8 battlerDef, u16 move);
|
||||
bool32 IsWakeupTurn(u8 battler);
|
||||
|
||||
// partner logic
|
||||
u16 GetAllyChosenMove(void);
|
||||
bool32 IsValidDoubleBattle(u8 battlerAtk);
|
||||
bool32 IsTargetingPartner(u8 battlerAtk, u8 battlerDef);
|
||||
bool32 DoesPartnerHaveSameMoveEffect(u8 battlerAtkPartner, u8 battlerDef, u16 move, u16 partnerMove);
|
||||
bool32 PartnerHasSameMoveEffectWithoutTarget(u8 battlerAtkPartner, u16 move, u16 partnerMove);
|
||||
bool32 PartnerMoveEffectIsStatusSameTarget(u8 battlerAtkPartner, u8 battlerDef, u16 partnerMove);
|
||||
bool32 PartnerMoveEffectIsWeather(u8 battlerAtkPartner, u16 partnerMove);
|
||||
bool32 PartnerMoveEffectIsTerrain(u8 battlerAtkPartner, u16 partnerMove);
|
||||
bool32 PartnerMoveIs(u8 battlerAtkPartner, u16 partnerMove, u16 moveCheck);
|
||||
bool32 PartnerMoveIsSameAsAttacker(u8 battlerAtkPartner, u8 battlerDef, u16 move, u16 partnerMove);
|
||||
bool32 PartnerMoveIsSameNoTarget(u8 battlerAtkPartner, u16 move, u16 partnerMove);
|
||||
bool32 ShouldUseWishAromatherapy(u8 battlerAtk, u8 battlerDef, u16 move);
|
||||
|
||||
// party logic
|
||||
s32 AI_CalcPartyMonDamage(u16 move, u8 battlerAtk, u8 battlerDef, struct Pokemon *mon);
|
||||
s32 CountUsablePartyMons(u8 battlerId);
|
||||
bool32 IsPartyFullyHealedExceptBattler(u8 battler);
|
||||
bool32 PartyHasMoveSplit(u8 battlerId, u8 split);
|
||||
bool32 SideHasMoveSplit(u8 battlerId, u8 split);
|
||||
|
||||
// score increases
|
||||
void IncreaseStatUpScore(u8 battlerAtk, u8 battlerDef, u8 statId, s16 *score);
|
||||
void IncreasePoisonScore(u8 battlerAtk, u8 battlerdef, u16 move, s16 *score);
|
||||
void IncreaseBurnScore(u8 battlerAtk, u8 battlerdef, u16 move, s16 *score);
|
||||
void IncreaseParalyzeScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score);
|
||||
void IncreaseSleepScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score);
|
||||
void IncreaseConfusionScore(u8 battlerAtk, u8 battlerDef, u16 move, s16 *score);
|
||||
|
||||
#endif //GUARD_BATTLE_AI_UTIL_H
|
@ -6,6 +6,12 @@
|
||||
#define WINDOW_CLEAR 0x1
|
||||
#define WINDOW_x80 0x80
|
||||
|
||||
struct StatFractions
|
||||
{
|
||||
u8 dividend;
|
||||
u8 divisor;
|
||||
};
|
||||
|
||||
s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbility);
|
||||
u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move);
|
||||
u8 GetBattlerTurnOrderNum(u8 battlerId);
|
||||
@ -27,8 +33,11 @@ u32 IsLeafGuardProtected(u32 battler);
|
||||
bool32 IsShieldsDownProtected(u32 battler);
|
||||
u32 IsAbilityStatusProtected(u32 battler);
|
||||
bool32 TryResetBattlerStatChanges(u8 battler);
|
||||
bool32 CanCamouflage(u8 battlerId);
|
||||
u16 GetNaturePowerMove(void);
|
||||
|
||||
extern void (* const gBattleScriptingCommandsTable[])(void);
|
||||
extern const u8 gBattlePalaceNatureToMoveGroupLikelihood[NUM_NATURES][4];
|
||||
extern const struct StatFractions gAccuracyStageRatios[];
|
||||
|
||||
#endif // GUARD_BATTLE_SCRIPT_COMMANDS_H
|
||||
|
@ -131,6 +131,21 @@ void ClearIllusionMon(u32 battlerId);
|
||||
bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId);
|
||||
bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId);
|
||||
u8 GetBattleMoveSplit(u32 moveId);
|
||||
bool32 TestMoveFlags(u16 move, u32 flag);
|
||||
struct Pokemon *GetBattlerPartyData(u8 battlerId);
|
||||
bool32 CanFling(u8 battlerId);
|
||||
bool32 IsTelekinesisBannedSpecies(u16 species);
|
||||
bool32 IsHealBlockPreventingMove(u32 battler, u32 move);
|
||||
bool32 IsThawingMove(u8 battlerId, u16 move);
|
||||
bool32 HasEnoughHpToEatBerry(u32 battlerId, u32 hpFraction, u32 itemId);
|
||||
|
||||
// ability checks
|
||||
bool32 IsRolePlayBannedAbilityAtk(u16 ability);
|
||||
bool32 IsRolePlayBannedAbility(u16 ability);
|
||||
bool32 IsSkillSwapBannedAbility(u16 ability);
|
||||
bool32 IsWorrySeedBannedAbility(u16 ability);
|
||||
bool32 IsGastroAcidBannedAbility(u16 ability);
|
||||
bool32 IsEntrainmentBannedAbilityAttacker(u16 ability);
|
||||
bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability);
|
||||
|
||||
#endif // GUARD_BATTLE_UTIL_H
|
||||
|
@ -220,6 +220,9 @@
|
||||
#define SIDE_STATUS_CRAFTY_SHIELD (1 << 20)
|
||||
#define SIDE_STATUS_MAT_BLOCK (1 << 21)
|
||||
|
||||
#define SIDE_STATUS_HAZARDS_ANY (SIDE_STATUS_SPIKES | SIDE_STATUS_STICKY_WEB | SIDE_STATUS_TOXIC_SPIKES | SIDE_STATUS_STEALTH_ROCK)
|
||||
#define SIDE_STATUS_SCREEN_ANY (SIDE_STATUS_REFLECT | SIDE_STATUS_LIGHTSCREEN | SIDE_STATUS_AURORA_VEIL)
|
||||
|
||||
// Field affecting statuses.
|
||||
#define STATUS_FIELD_MAGIC_ROOM (1 << 0)
|
||||
#define STATUS_FIELD_TRICK_ROOM (1 << 1)
|
||||
|
@ -35,20 +35,29 @@
|
||||
#define MOVE_POWER_GOOD 2 // Similar dmg range with best.
|
||||
#define MOVE_POWER_WEAK 3 // Significantly lower than best and good.
|
||||
|
||||
// script's table id to bit
|
||||
#define AI_SCRIPT_CHECK_BAD_MOVE (1 << 0)
|
||||
#define AI_SCRIPT_TRY_TO_FAINT (1 << 1)
|
||||
#define AI_SCRIPT_CHECK_VIABILITY (1 << 2)
|
||||
#define AI_SCRIPT_SETUP_FIRST_TURN (1 << 3)
|
||||
#define AI_SCRIPT_RISKY (1 << 4)
|
||||
#define AI_SCRIPT_PREFER_STRONGEST_MOVE (1 << 5)
|
||||
#define AI_SCRIPT_PREFER_BATON_PASS (1 << 6)
|
||||
#define AI_SCRIPT_DOUBLE_BATTLE (1 << 7)
|
||||
#define AI_SCRIPT_HP_AWARE (1 << 8)
|
||||
#define AI_SCRIPT_UNKNOWN (1 << 9)
|
||||
// 10 - 28 are not used
|
||||
#define AI_SCRIPT_ROAMING (1 << 29)
|
||||
#define AI_SCRIPT_SAFARI (1 << 30)
|
||||
#define AI_SCRIPT_FIRST_BATTLE (1 << 31)
|
||||
// AI Flags. Most run specific functions to update score, new flags are used for internal logic in other scripts
|
||||
#define AI_FLAG_CHECK_BAD_MOVE (1 << 0)
|
||||
#define AI_FLAG_TRY_TO_FAINT (1 << 1)
|
||||
#define AI_FLAG_CHECK_VIABILITY (1 << 2)
|
||||
#define AI_FLAG_SETUP_FIRST_TURN (1 << 3)
|
||||
#define AI_FLAG_RISKY (1 << 4)
|
||||
#define AI_FLAG_PREFER_STRONGEST_MOVE (1 << 5)
|
||||
#define AI_FLAG_PREFER_BATON_PASS (1 << 6)
|
||||
#define AI_FLAG_DOUBLE_BATTLE (1 << 7) // removed, split between AI_FLAG_CHECK_BAD_MOVE & AI_FLAG_CHECK_GOOD_MOVE
|
||||
#define AI_FLAG_HP_AWARE (1 << 8)
|
||||
// New, Trainer Handicap Flags
|
||||
#define AI_FLAG_NEGATE_UNAWARE (1 << 9) // AI is NOT aware of negating effects like wonder room, mold breaker, etc
|
||||
#define AI_FLAG_WILL_SUICIDE (1 << 10) // AI will use explosion / self destruct / final gambit / etc
|
||||
// New, Trainer Strategy Flags
|
||||
#define AI_FLAG_HELP_PARTNER (1 << 11) // AI can try to help partner. If not set, will tend not to target partner
|
||||
#define AI_FLAG_PREFER_STATUS_MOVES (1 << 12) // AI gets a score bonus for status moves. Should be combined with AI_FLAG_CHECK_BAD_MOVE to prevent using only status moves
|
||||
#define AI_FLAG_STALL (1 << 13) // AI stalls battle and prefers secondary damage/trapping/etc. TODO not finished
|
||||
#define AI_FLAG_SCREENER (1 << 14) // AI prefers screening effects like reflect, mist, etc. TODO unfinished
|
||||
#define AI_FLAG_SMART_SWITCHING (1 << 15) // AI includes a lot more switching checks
|
||||
|
||||
// 'other' ai logic flags
|
||||
#define AI_FLAG_ROAMING (1 << 29)
|
||||
#define AI_FLAG_SAFARI (1 << 30)
|
||||
#define AI_FLAG_FIRST_BATTLE (1 << 31)
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_AI_H
|
||||
|
@ -129,6 +129,7 @@
|
||||
#define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn.
|
||||
#define B_BERRIES_INSTANT GEN_6 // In Gen4+, most berries activate on battle start/switch-in if applicable. In gen3, they only activate either at the move end or turn end.
|
||||
#define B_X_ITEMS_BUFF GEN_7 // In Gen7+, the X Items raise a stat by 2 stages instead of 1.
|
||||
#define B_MENTAL_HERB GEN_5 // In Gen5+, mental herb cures Taunt, Encore, Heal Block, and Disable
|
||||
|
||||
// Flag settings
|
||||
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.
|
||||
|
@ -142,6 +142,14 @@
|
||||
#define HOLD_EFFECT_MEMORY 153
|
||||
#define HOLD_EFFECT_PLATE 154
|
||||
|
||||
// Gen8 hold effects
|
||||
#define HOLD_EFFECT_UTILITY_UMBRELLA 155
|
||||
#define HOLD_EFFECT_EJECT_PACK 156
|
||||
#define HOLD_EFFECT_ROOM_SERVICE 157
|
||||
#define HOLD_EFFECT_BLUNDER_POLICY 158
|
||||
#define HOLD_EFFECT_HEAVY_DUTY_BOOTS 159
|
||||
#define HOLD_EFFECT_THROAT_SPRAY 160
|
||||
|
||||
#define HOLD_EFFECT_CHOICE(holdEffect)((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SCARF || holdEffect == HOLD_EFFECT_CHOICE_SPECS))
|
||||
|
||||
#endif // GUARD_HOLD_EFFECTS_H
|
||||
|
@ -74,5 +74,6 @@ ItemUseFunc ItemId_GetFieldFunc(u16 itemId);
|
||||
u8 ItemId_GetBattleUsage(u16 itemId);
|
||||
ItemUseFunc ItemId_GetBattleFunc(u16 itemId);
|
||||
u8 ItemId_GetSecondaryId(u16 itemId);
|
||||
bool32 IsPinchBerryItemEffect(u16 holdEffect);
|
||||
|
||||
#endif // GUARD_ITEM_H
|
||||
|
@ -213,7 +213,8 @@ SECTIONS {
|
||||
src/decoration.o(.text);
|
||||
src/slot_machine.o(.text);
|
||||
src/contest_painting.o(.text);
|
||||
src/battle_ai_script_commands.o(.text);
|
||||
src/battle_ai_main.o(.text);
|
||||
src/battle_ai_util.o(.text);
|
||||
src/trader.o(.text);
|
||||
src/starter_choose.o(.text);
|
||||
src/wallclock.o(.text);
|
||||
@ -345,7 +346,6 @@ SECTIONS {
|
||||
data/battle_scripts_1.o(script_data);
|
||||
data/field_effect_scripts.o(script_data);
|
||||
data/battle_scripts_2.o(script_data);
|
||||
data/battle_ai_scripts.o(script_data);
|
||||
data/contest_ai_scripts.o(script_data);
|
||||
data/mystery_event_script_cmd_table.o(script_data);
|
||||
} =0
|
||||
@ -587,7 +587,8 @@ SECTIONS {
|
||||
src/decoration.o(.rodata);
|
||||
src/slot_machine.o(.rodata);
|
||||
src/contest_painting.o(.rodata);
|
||||
src/battle_ai_script_commands.o(.rodata);
|
||||
src/battle_ai_main.o(.rodata);
|
||||
src/battle_ai_util.o(.rodata);
|
||||
src/trader.o(.rodata);
|
||||
src/starter_choose.o(.rodata);
|
||||
src/wallclock.o(.rodata);
|
||||
|
4976
src/battle_ai_main.c
Normal file
4976
src/battle_ai_main.c
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_ai_util.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_setup.h"
|
||||
@ -416,7 +417,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u16 flags, u8 moduloPercent)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool8 ShouldSwitch(void)
|
||||
bool32 ShouldSwitch(void)
|
||||
{
|
||||
u8 battlerIn1, battlerIn2;
|
||||
s32 firstId;
|
||||
|
3463
src/battle_ai_util.c
Normal file
3463
src/battle_ai_util.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_interface.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_interface.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_arena.h"
|
||||
#include "battle_controllers.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_message.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_interface.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_message.h"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_message.h"
|
||||
|
@ -18,7 +18,8 @@
|
||||
#include "text_window.h"
|
||||
#include "international_string_util.h"
|
||||
#include "strings.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_ai_util.h"
|
||||
#include "list_menu.h"
|
||||
#include "decompress.h"
|
||||
#include "trainer_pokemon_sprites.h"
|
||||
@ -32,6 +33,7 @@
|
||||
#include "constants/moves.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/rgb.h"
|
||||
#include "constants/hold_effects.h"
|
||||
|
||||
#define MAX_MODIFY_DIGITS 4
|
||||
|
||||
@ -98,6 +100,7 @@ enum
|
||||
LIST_ITEM_SIDE_STATUS,
|
||||
LIST_ITEM_AI,
|
||||
LIST_ITEM_AI_MOVES_PTS,
|
||||
LIST_ITEM_AI_INFO,
|
||||
LIST_ITEM_VARIOUS,
|
||||
LIST_ITEM_COUNT
|
||||
};
|
||||
@ -149,7 +152,11 @@ enum
|
||||
VARIOUS_IN_LOVE,
|
||||
};
|
||||
|
||||
// Static Declarations
|
||||
static const u8 *GetHoldEffectName(u16 holdEffect);
|
||||
|
||||
// const rom data
|
||||
static const u8 sText_HoldEffect[] = _("Hold Effect");
|
||||
static const u8 sText_Ability[] = _("Ability");
|
||||
static const u8 sText_Moves[] = _("Moves");
|
||||
static const u8 sText_Stats[] = _("Stats");
|
||||
@ -222,6 +229,7 @@ static const u8 sText_HpAware[] = _("HP aware");
|
||||
static const u8 sText_Unknown[] = _("Unknown");
|
||||
static const u8 sText_InLove[] = _("In Love");
|
||||
static const u8 sText_AIMovePts[] = _("AI Move Pts");
|
||||
static const u8 sText_AiKnowledge[] = _("AI Info");
|
||||
static const u8 sText_EffectOverride[] = _("Effect Override");
|
||||
|
||||
static const u8 sText_EmptyString[] = _("");
|
||||
@ -319,6 +327,7 @@ static const struct ListMenuItem sMainListItems[] =
|
||||
{sText_SideStatus, LIST_ITEM_SIDE_STATUS},
|
||||
{sText_AI, LIST_ITEM_AI},
|
||||
{sText_AIMovePts, LIST_ITEM_AI_MOVES_PTS},
|
||||
{sText_AiKnowledge, LIST_ITEM_AI_INFO},
|
||||
{sText_Various, LIST_ITEM_VARIOUS},
|
||||
};
|
||||
|
||||
@ -783,6 +792,114 @@ static void SwitchToAiPointsView(u8 taskId)
|
||||
GetStructPtr(taskId)->aiViewState = 0;
|
||||
}
|
||||
|
||||
static const u8 *const sAiInfoItemNames[] =
|
||||
{
|
||||
sText_Ability,
|
||||
sText_HeldItem,
|
||||
sText_HoldEffect,
|
||||
};
|
||||
static void PutAiInfoText(struct BattleDebugMenu *data)
|
||||
{
|
||||
u32 i, j, count;
|
||||
u8 *text = malloc(0x50);
|
||||
|
||||
FillWindowPixelBuffer(data->aiMovesWindowId, 0x11);
|
||||
|
||||
// item names
|
||||
for (i = 0; i < ARRAY_COUNT(sAiInfoItemNames); i++)
|
||||
{
|
||||
AddTextPrinterParameterized(data->aiMovesWindowId, 1, sAiInfoItemNames[i], 3, i * 15, 0, NULL);
|
||||
}
|
||||
|
||||
// items info
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (GET_BATTLER_SIDE(i) == B_SIDE_PLAYER && IsBattlerAlive(i))
|
||||
{
|
||||
u16 ability = AI_GetAbility(i);
|
||||
u16 holdEffect = AI_GetHoldEffect(i);
|
||||
u16 item = gBattleMons[i].item;
|
||||
u8 x = (i == B_POSITION_PLAYER_LEFT) ? 83 + (i) * 75 : 83 + (i-1) * 75;
|
||||
AddTextPrinterParameterized(data->aiMovesWindowId, 0, gAbilityNames[ability], x, 0, 0, NULL);
|
||||
AddTextPrinterParameterized(data->aiMovesWindowId, 0, ItemId_GetName(item), x, 15, 0, NULL);
|
||||
AddTextPrinterParameterized(data->aiMovesWindowId, 0, GetHoldEffectName(holdEffect), x, 30, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
CopyWindowToVram(data->aiMovesWindowId, 3);
|
||||
free(text);
|
||||
}
|
||||
|
||||
static void Task_ShowAiKnowledge(u8 taskId)
|
||||
{
|
||||
u32 i, count;
|
||||
struct WindowTemplate winTemplate;
|
||||
struct BattleDebugMenu *data = GetStructPtr(taskId);
|
||||
|
||||
switch (data->aiViewState)
|
||||
{
|
||||
case 0:
|
||||
HideBg(0);
|
||||
ShowBg(1);
|
||||
|
||||
// Swap battler if it's player mon
|
||||
data->aiBattlerId = data->battlerId;
|
||||
while (!IsBattlerAIControlled(data->aiBattlerId))
|
||||
{
|
||||
if (++data->aiBattlerId >= gBattlersCount)
|
||||
data->aiBattlerId = 0;
|
||||
}
|
||||
|
||||
LoadMonIconPalettes();
|
||||
for (count = 0, i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (GET_BATTLER_SIDE(i) == B_SIDE_PLAYER && IsBattlerAlive(i))
|
||||
{
|
||||
data->aiIconSpriteIds[i] = CreateMonIcon(gBattleMons[i].species,
|
||||
SpriteCallbackDummy,
|
||||
95 + (count * 80), 17, 0, 0, FALSE);
|
||||
gSprites[data->aiIconSpriteIds[i]].data[0] = i; // battler id
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
data->aiIconSpriteIds[i] = 0xFF;
|
||||
}
|
||||
}
|
||||
data->aiMonSpriteId = CreateMonPicSprite_HandleDeoxys(gBattleMons[data->aiBattlerId].species,
|
||||
gBattleMons[data->aiBattlerId].otId,
|
||||
gBattleMons[data->aiBattlerId].personality,
|
||||
TRUE,
|
||||
39, 130, 15, 0xFFFF);
|
||||
data->aiViewState++;
|
||||
break;
|
||||
// Put text
|
||||
case 1:
|
||||
winTemplate = CreateWindowTemplate(1, 0, 4, 27, 14, 15, 0x200);
|
||||
data->aiMovesWindowId = AddWindow(&winTemplate);
|
||||
PutWindowTilemap(data->aiMovesWindowId);
|
||||
PutAiInfoText(data);
|
||||
data->aiViewState++;
|
||||
break;
|
||||
// Input
|
||||
case 2:
|
||||
if (gMain.newKeys & (SELECT_BUTTON | B_BUTTON))
|
||||
{
|
||||
SwitchToDebugView(taskId);
|
||||
HideBg(1);
|
||||
ShowBg(0);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void SwitchToAiInfoView(u8 taskId)
|
||||
{
|
||||
gTasks[taskId].func = Task_ShowAiKnowledge;
|
||||
GetStructPtr(taskId)->aiViewState = 0;
|
||||
}
|
||||
|
||||
static void SwitchToDebugView(u8 taskId)
|
||||
{
|
||||
u32 i;
|
||||
@ -844,6 +961,11 @@ static void Task_DebugMenuProcessInput(u8 taskId)
|
||||
SwitchToAiPointsView(taskId);
|
||||
return;
|
||||
}
|
||||
else if (listItemId == LIST_ITEM_AI_INFO && gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
SwitchToAiInfoView(taskId);
|
||||
return;
|
||||
}
|
||||
data->currentMainListItemId = listItemId;
|
||||
|
||||
// Create the secondary menu list.
|
||||
@ -1040,6 +1162,7 @@ static void CreateSecondaryListMenu(struct BattleDebugMenu *data)
|
||||
itemsCount = ARRAY_COUNT(sSideStatusListItems);
|
||||
break;
|
||||
case LIST_ITEM_AI_MOVES_PTS:
|
||||
case LIST_ITEM_AI_INFO:
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1677,3 +1800,289 @@ static void UpdateMonData(struct BattleDebugMenu *data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const u8 sText_HoldEffectNone[] = _("????????");
|
||||
static const u8 sText_HoldEffectRestoreHp[] = _("Restore Hp");
|
||||
static const u8 sText_HoldEffectCurePar[] = _("Cure Par");
|
||||
static const u8 sText_HoldEffectCureSlp[] = _("Cure Slp");
|
||||
static const u8 sText_HoldEffectCurePsn[] = _("Cure Psn");
|
||||
static const u8 sText_HoldEffectCureBrn[] = _("Cure Brn");
|
||||
static const u8 sText_HoldEffectCureFrz[] = _("Cure Frz");
|
||||
static const u8 sText_HoldEffectRestorePp[] = _("Restore Pp");
|
||||
static const u8 sText_HoldEffectCureConfusion[] = _("Cure Confusion");
|
||||
static const u8 sText_HoldEffectCureStatus[] = _("Cure Status");
|
||||
static const u8 sText_HoldEffectConfuseSpicy[] = _("Confuse Spicy");
|
||||
static const u8 sText_HoldEffectConfuseDry[] = _("Confuse Dry");
|
||||
static const u8 sText_HoldEffectConfuseSweet[] = _("Confuse Sweet");
|
||||
static const u8 sText_HoldEffectConfuseBitter[] = _("Confuse Bitter");
|
||||
static const u8 sText_HoldEffectConfuseSour[] = _("Confuse Sour");
|
||||
static const u8 sText_HoldEffectAttackUp[] = _("Attack Up");
|
||||
static const u8 sText_HoldEffectDefenseUp[] = _("Defense Up");
|
||||
static const u8 sText_HoldEffectSpeedUp[] = _("Speed Up");
|
||||
static const u8 sText_HoldEffectSpAttackUp[] = _("Sp Attack Up");
|
||||
static const u8 sText_HoldEffectSpDefenseUp[] = _("Sp Defense Up");
|
||||
static const u8 sText_HoldEffectCriticalUp[] = _("Critical Up");
|
||||
static const u8 sText_HoldEffectRandomStatUp[] = _("Random Stat Up");
|
||||
static const u8 sText_HoldEffectEvasionUp[] = _("Evasion Up");
|
||||
static const u8 sText_HoldEffectRestoreStats[] = _("Restore Stats");
|
||||
static const u8 sText_HoldEffectMachoBrace[] = _("Macho Brace");
|
||||
static const u8 sText_HoldEffectExpShare[] = _("Exp Share");
|
||||
static const u8 sText_HoldEffectQuickClaw[] = _("Quick Claw");
|
||||
static const u8 sText_HoldEffectHappinessUp[] = _("Happiness Up");
|
||||
static const u8 sText_HoldEffectMentalHerb[] = _("Mental Herb");
|
||||
static const u8 sText_HoldEffectChoiceBand[] = _("Choice Band");
|
||||
static const u8 sText_HoldEffectFlinch[] = _("Flinch");
|
||||
static const u8 sText_HoldEffectBugPower[] = _("Bug Power");
|
||||
static const u8 sText_HoldEffectDoublePrize[] = _("Double Prize");
|
||||
static const u8 sText_HoldEffectRepel[] = _("Repel");
|
||||
static const u8 sText_HoldEffectSoulDew[] = _("Soul Dew");
|
||||
static const u8 sText_HoldEffectDeepSeaTooth[] = _("Deep Sea Tooth");
|
||||
static const u8 sText_HoldEffectDeepSeaScale[] = _("Deep Sea Scale");
|
||||
static const u8 sText_HoldEffectCanAlwaysRun[] = _("Can Always Run");
|
||||
static const u8 sText_HoldEffectPreventEvolve[] = _("Prevent Evolve");
|
||||
static const u8 sText_HoldEffectFocusBand[] = _("Focus Band");
|
||||
static const u8 sText_HoldEffectLuckyEgg[] = _("Lucky Egg");
|
||||
static const u8 sText_HoldEffectScopeLens[] = _("Scope Lens");
|
||||
static const u8 sText_HoldEffectSteelPower[] = _("Steel Power");
|
||||
static const u8 sText_HoldEffectLeftovers[] = _("Leftovers");
|
||||
static const u8 sText_HoldEffectDragonScale[] = _("Dragon Scale");
|
||||
static const u8 sText_HoldEffectLightBall[] = _("Light Ball");
|
||||
static const u8 sText_HoldEffectGroundPower[] = _("Ground Power");
|
||||
static const u8 sText_HoldEffectRockPower[] = _("Rock Power");
|
||||
static const u8 sText_HoldEffectGrassPower[] = _("Grass Power");
|
||||
static const u8 sText_HoldEffectDarkPower[] = _("Dark Power");
|
||||
static const u8 sText_HoldEffectFightingPower[] = _("Fighting Power");
|
||||
static const u8 sText_HoldEffectElectricPower[] = _("Electric Power");
|
||||
static const u8 sText_HoldEffectWaterPower[] = _("Water Power");
|
||||
static const u8 sText_HoldEffectFlyingPower[] = _("Flying Power");
|
||||
static const u8 sText_HoldEffectPoisonPower[] = _("Poison Power");
|
||||
static const u8 sText_HoldEffectIcePower[] = _("Ice Power");
|
||||
static const u8 sText_HoldEffectGhostPower[] = _("Ghost Power");
|
||||
static const u8 sText_HoldEffectPsychicPower[] = _("Psychic Power");
|
||||
static const u8 sText_HoldEffectFirePower[] = _("Fire Power");
|
||||
static const u8 sText_HoldEffectDragonPower[] = _("Dragon Power");
|
||||
static const u8 sText_HoldEffectNormalPower[] = _("Normal Power");
|
||||
static const u8 sText_HoldEffectUpGrade[] = _("Up Grade");
|
||||
static const u8 sText_HoldEffectShellBell[] = _("Shell Bell");
|
||||
static const u8 sText_HoldEffectLuckyPunch[] = _("Lucky Punch");
|
||||
static const u8 sText_HoldEffectMetalPowder[] = _("Metal Powder");
|
||||
static const u8 sText_HoldEffectThickClub[] = _("Thick Club");
|
||||
static const u8 sText_HoldEffectStick[] = _("Stick");
|
||||
static const u8 sText_HoldEffectChoiceScarf[] = _("Choice Scarf");
|
||||
static const u8 sText_HoldEffectChoiceSpecs[] = _("Choice Specs");
|
||||
static const u8 sText_HoldEffectDampRock[] = _("Damp Rock");
|
||||
static const u8 sText_HoldEffectGripClaw[] = _("Grip Claw");
|
||||
static const u8 sText_HoldEffectHeatRock[] = _("Heat Rock");
|
||||
static const u8 sText_HoldEffectIcyRock[] = _("Icy Rock");
|
||||
static const u8 sText_HoldEffectLightClay[] = _("Light Clay");
|
||||
static const u8 sText_HoldEffectSmoothRock[] = _("Smooth Rock");
|
||||
static const u8 sText_HoldEffectPowerHerb[] = _("Power Herb");
|
||||
static const u8 sText_HoldEffectBigRoot[] = _("Big Root");
|
||||
static const u8 sText_HoldEffectExpertBelt[] = _("Expert Belt");
|
||||
static const u8 sText_HoldEffectLifeOrb[] = _("Life Orb");
|
||||
static const u8 sText_HoldEffectMetronome[] = _("Metronome");
|
||||
static const u8 sText_HoldEffectMuscleBand[] = _("Muscle Band");
|
||||
static const u8 sText_HoldEffectWideLens[] = _("Wide Lens");
|
||||
static const u8 sText_HoldEffectWiseGlasses[] = _("Wise Glasses");
|
||||
static const u8 sText_HoldEffectZoomLens[] = _("Zoom Lens");
|
||||
static const u8 sText_HoldEffectLaggingTail[] = _("Lagging Tail");
|
||||
static const u8 sText_HoldEffectFocusSash[] = _("Focus Sash");
|
||||
static const u8 sText_HoldEffectFlameOrb[] = _("Flame Orb");
|
||||
static const u8 sText_HoldEffectToxicOrb[] = _("Toxic Orb");
|
||||
static const u8 sText_HoldEffectStickyBarb[] = _("Sticky Barb");
|
||||
static const u8 sText_HoldEffectIronBall[] = _("Iron Ball");
|
||||
static const u8 sText_HoldEffectBlackSludge[] = _("Black Sludge");
|
||||
static const u8 sText_HoldEffectDestinyKnot[] = _("Destiny Knot");
|
||||
static const u8 sText_HoldEffectShedShell[] = _("Shed Shell");
|
||||
static const u8 sText_HoldEffectQuickPowder[] = _("Quick Powder");
|
||||
static const u8 sText_HoldEffectAdamantOrb[] = _("Adamant Orb");
|
||||
static const u8 sText_HoldEffectLustrousOrb[] = _("Lustrous Orb");
|
||||
static const u8 sText_HoldEffectGriseousOrb[] = _("Griseous Orb");
|
||||
static const u8 sText_HoldEffectGracidea[] = _("Gracidea");
|
||||
static const u8 sText_HoldEffectResistBerry[] = _("Resist Berry");
|
||||
static const u8 sText_HoldEffectPowerItem[] = _("Power Item");
|
||||
static const u8 sText_HoldEffectRestorePctHp[] = _("Restore Pct Hp");
|
||||
static const u8 sText_HoldEffectMicleBerry[] = _("Micle Berry");
|
||||
static const u8 sText_HoldEffectCustapBerry[] = _("Custap Berry");
|
||||
static const u8 sText_HoldEffectJabocaBerry[] = _("Jaboca Berry");
|
||||
static const u8 sText_HoldEffectRowapBerry[] = _("Rowap Berry");
|
||||
static const u8 sText_HoldEffectKeeBerry[] = _("Kee Berry");
|
||||
static const u8 sText_HoldEffectMarangaBerry[] = _("Maranga Berry");
|
||||
static const u8 sText_HoldEffectFloatStone[] = _("Float Stone");
|
||||
static const u8 sText_HoldEffectEviolite[] = _("Eviolite");
|
||||
static const u8 sText_HoldEffectAssaultVest[] = _("Assault Vest");
|
||||
static const u8 sText_HoldEffectDrive[] = _("Drive");
|
||||
static const u8 sText_HoldEffectGems[] = _("Gems");
|
||||
static const u8 sText_HoldEffectRockyHelmet[] = _("Rocky Helmet");
|
||||
static const u8 sText_HoldEffectAirBalloon[] = _("Air Balloon");
|
||||
static const u8 sText_HoldEffectRedCard[] = _("Red Card");
|
||||
static const u8 sText_HoldEffectRingTarget[] = _("Ring Target");
|
||||
static const u8 sText_HoldEffectBindingBand[] = _("Binding Band");
|
||||
static const u8 sText_HoldEffectEjectButton[] = _("Eject Button");
|
||||
static const u8 sText_HoldEffectAbsorbBulb[] = _("Absorb Bulb");
|
||||
static const u8 sText_HoldEffectCellBattery[] = _("Cell Battery");
|
||||
static const u8 sText_HoldEffectFairyPower[] = _("Fairy Power");
|
||||
static const u8 sText_HoldEffectMegaStone[] = _("Mega Stone");
|
||||
static const u8 sText_HoldEffectSafetyGoogles[] = _("Safety Googles");
|
||||
static const u8 sText_HoldEffectLuminousMoss[] = _("Luminous Moss");
|
||||
static const u8 sText_HoldEffectSnowball[] = _("Snowball");
|
||||
static const u8 sText_HoldEffectWeaknessPolicy[] = _("Weakness Policy");
|
||||
static const u8 sText_HoldEffectProtectivePads[] = _("Protective Pads");
|
||||
static const u8 sText_HoldEffectTerrainExtender[] = _("Terrain Extender");
|
||||
static const u8 sText_HoldEffectSeeds[] = _("Seeds");
|
||||
static const u8 sText_HoldEffectAdrenalineOrb[] = _("Adrenaline Orb");
|
||||
static const u8 sText_HoldEffectMemory[] = _("Memory");
|
||||
static const u8 sText_HoldEffectPlate[] = _("Plate");
|
||||
static const u8 sText_HoldEffectUtilityUmbrella[] = _("Utility Umbrella");
|
||||
static const u8 sText_HoldEffectEjectPack[] = _("Eject Pack");
|
||||
static const u8 sText_HoldEffectRoomService[] = _("Room Service");
|
||||
static const u8 sText_HoldEffectBlunderPolicy[] = _("Blunder Policy");
|
||||
static const u8 sText_HoldEffectHeavyDutyBoots[] = _("Heavy Duty Boots");
|
||||
static const u8 sText_HoldEffectThroatSpray[] = _("Throat Spray");
|
||||
static const u8 *const sHoldEffectNames[] =
|
||||
{
|
||||
[HOLD_EFFECT_NONE] = sText_HoldEffectNone,
|
||||
[HOLD_EFFECT_RESTORE_HP] = sText_HoldEffectRestoreHp,
|
||||
[HOLD_EFFECT_CURE_PAR] = sText_HoldEffectCurePar,
|
||||
[HOLD_EFFECT_CURE_SLP] = sText_HoldEffectCureSlp,
|
||||
[HOLD_EFFECT_CURE_PSN] = sText_HoldEffectCurePsn,
|
||||
[HOLD_EFFECT_CURE_BRN] = sText_HoldEffectCureBrn,
|
||||
[HOLD_EFFECT_CURE_FRZ] = sText_HoldEffectCureFrz,
|
||||
[HOLD_EFFECT_RESTORE_PP] = sText_HoldEffectRestorePp,
|
||||
[HOLD_EFFECT_CURE_CONFUSION] = sText_HoldEffectCureConfusion,
|
||||
[HOLD_EFFECT_CURE_STATUS] = sText_HoldEffectCureStatus,
|
||||
[HOLD_EFFECT_CONFUSE_SPICY] = sText_HoldEffectConfuseSpicy,
|
||||
[HOLD_EFFECT_CONFUSE_DRY] = sText_HoldEffectConfuseDry,
|
||||
[HOLD_EFFECT_CONFUSE_SWEET] = sText_HoldEffectConfuseSweet,
|
||||
[HOLD_EFFECT_CONFUSE_BITTER] = sText_HoldEffectConfuseBitter,
|
||||
[HOLD_EFFECT_CONFUSE_SOUR] = sText_HoldEffectConfuseSour,
|
||||
[HOLD_EFFECT_ATTACK_UP] = sText_HoldEffectAttackUp,
|
||||
[HOLD_EFFECT_DEFENSE_UP] = sText_HoldEffectDefenseUp,
|
||||
[HOLD_EFFECT_SPEED_UP] = sText_HoldEffectSpeedUp,
|
||||
[HOLD_EFFECT_SP_ATTACK_UP] = sText_HoldEffectSpAttackUp,
|
||||
[HOLD_EFFECT_SP_DEFENSE_UP] = sText_HoldEffectSpDefenseUp,
|
||||
[HOLD_EFFECT_CRITICAL_UP] = sText_HoldEffectCriticalUp,
|
||||
[HOLD_EFFECT_RANDOM_STAT_UP] = sText_HoldEffectRandomStatUp,
|
||||
[HOLD_EFFECT_EVASION_UP] = sText_HoldEffectEvasionUp,
|
||||
[HOLD_EFFECT_RESTORE_STATS] = sText_HoldEffectRestoreStats,
|
||||
[HOLD_EFFECT_MACHO_BRACE] = sText_HoldEffectMachoBrace,
|
||||
[HOLD_EFFECT_EXP_SHARE] = sText_HoldEffectExpShare,
|
||||
[HOLD_EFFECT_QUICK_CLAW] = sText_HoldEffectQuickClaw,
|
||||
[HOLD_EFFECT_HAPPINESS_UP] = sText_HoldEffectHappinessUp,
|
||||
//[HOLD_EFFECT_MENTAL_HERB] = sText_HoldEffectMentalHerb,
|
||||
[HOLD_EFFECT_CHOICE_BAND] = sText_HoldEffectChoiceBand,
|
||||
[HOLD_EFFECT_FLINCH] = sText_HoldEffectFlinch,
|
||||
[HOLD_EFFECT_BUG_POWER] = sText_HoldEffectBugPower,
|
||||
[HOLD_EFFECT_DOUBLE_PRIZE] = sText_HoldEffectDoublePrize,
|
||||
[HOLD_EFFECT_REPEL] = sText_HoldEffectRepel,
|
||||
[HOLD_EFFECT_SOUL_DEW] = sText_HoldEffectSoulDew,
|
||||
[HOLD_EFFECT_DEEP_SEA_TOOTH] = sText_HoldEffectDeepSeaTooth,
|
||||
[HOLD_EFFECT_DEEP_SEA_SCALE] = sText_HoldEffectDeepSeaScale,
|
||||
[HOLD_EFFECT_CAN_ALWAYS_RUN] = sText_HoldEffectCanAlwaysRun,
|
||||
[HOLD_EFFECT_PREVENT_EVOLVE] = sText_HoldEffectPreventEvolve,
|
||||
[HOLD_EFFECT_FOCUS_BAND] = sText_HoldEffectFocusBand,
|
||||
[HOLD_EFFECT_LUCKY_EGG] = sText_HoldEffectLuckyEgg,
|
||||
[HOLD_EFFECT_SCOPE_LENS] = sText_HoldEffectScopeLens,
|
||||
[HOLD_EFFECT_STEEL_POWER] = sText_HoldEffectSteelPower,
|
||||
[HOLD_EFFECT_LEFTOVERS] = sText_HoldEffectLeftovers,
|
||||
[HOLD_EFFECT_DRAGON_SCALE] = sText_HoldEffectDragonScale,
|
||||
[HOLD_EFFECT_LIGHT_BALL] = sText_HoldEffectLightBall,
|
||||
[HOLD_EFFECT_GROUND_POWER] = sText_HoldEffectGroundPower,
|
||||
[HOLD_EFFECT_ROCK_POWER] = sText_HoldEffectRockPower,
|
||||
[HOLD_EFFECT_GRASS_POWER] = sText_HoldEffectGrassPower,
|
||||
[HOLD_EFFECT_DARK_POWER] = sText_HoldEffectDarkPower,
|
||||
[HOLD_EFFECT_FIGHTING_POWER] = sText_HoldEffectFightingPower,
|
||||
[HOLD_EFFECT_ELECTRIC_POWER] = sText_HoldEffectElectricPower,
|
||||
[HOLD_EFFECT_WATER_POWER] = sText_HoldEffectWaterPower,
|
||||
[HOLD_EFFECT_FLYING_POWER] = sText_HoldEffectFlyingPower,
|
||||
[HOLD_EFFECT_POISON_POWER] = sText_HoldEffectPoisonPower,
|
||||
[HOLD_EFFECT_ICE_POWER] = sText_HoldEffectIcePower,
|
||||
[HOLD_EFFECT_GHOST_POWER] = sText_HoldEffectGhostPower,
|
||||
[HOLD_EFFECT_PSYCHIC_POWER] = sText_HoldEffectPsychicPower,
|
||||
[HOLD_EFFECT_FIRE_POWER] = sText_HoldEffectFirePower,
|
||||
[HOLD_EFFECT_DRAGON_POWER] = sText_HoldEffectDragonPower,
|
||||
[HOLD_EFFECT_NORMAL_POWER] = sText_HoldEffectNormalPower,
|
||||
[HOLD_EFFECT_UP_GRADE] = sText_HoldEffectUpGrade,
|
||||
[HOLD_EFFECT_SHELL_BELL] = sText_HoldEffectShellBell,
|
||||
[HOLD_EFFECT_LUCKY_PUNCH] = sText_HoldEffectLuckyPunch,
|
||||
[HOLD_EFFECT_METAL_POWDER] = sText_HoldEffectMetalPowder,
|
||||
[HOLD_EFFECT_THICK_CLUB] = sText_HoldEffectThickClub,
|
||||
[HOLD_EFFECT_STICK] = sText_HoldEffectStick,
|
||||
[HOLD_EFFECT_CHOICE_SCARF] = sText_HoldEffectChoiceScarf,
|
||||
[HOLD_EFFECT_CHOICE_SPECS] = sText_HoldEffectChoiceSpecs,
|
||||
[HOLD_EFFECT_DAMP_ROCK] = sText_HoldEffectDampRock,
|
||||
[HOLD_EFFECT_GRIP_CLAW] = sText_HoldEffectGripClaw,
|
||||
[HOLD_EFFECT_HEAT_ROCK] = sText_HoldEffectHeatRock,
|
||||
[HOLD_EFFECT_ICY_ROCK] = sText_HoldEffectIcyRock,
|
||||
[HOLD_EFFECT_LIGHT_CLAY] = sText_HoldEffectLightClay,
|
||||
[HOLD_EFFECT_SMOOTH_ROCK] = sText_HoldEffectSmoothRock,
|
||||
[HOLD_EFFECT_POWER_HERB] = sText_HoldEffectPowerHerb,
|
||||
[HOLD_EFFECT_BIG_ROOT] = sText_HoldEffectBigRoot,
|
||||
[HOLD_EFFECT_EXPERT_BELT] = sText_HoldEffectExpertBelt,
|
||||
[HOLD_EFFECT_LIFE_ORB] = sText_HoldEffectLifeOrb,
|
||||
[HOLD_EFFECT_METRONOME] = sText_HoldEffectMetronome,
|
||||
[HOLD_EFFECT_MUSCLE_BAND] = sText_HoldEffectMuscleBand,
|
||||
[HOLD_EFFECT_WIDE_LENS] = sText_HoldEffectWideLens,
|
||||
[HOLD_EFFECT_WISE_GLASSES] = sText_HoldEffectWiseGlasses,
|
||||
[HOLD_EFFECT_ZOOM_LENS] = sText_HoldEffectZoomLens,
|
||||
[HOLD_EFFECT_LAGGING_TAIL] = sText_HoldEffectLaggingTail,
|
||||
[HOLD_EFFECT_FOCUS_SASH] = sText_HoldEffectFocusSash,
|
||||
[HOLD_EFFECT_FLAME_ORB] = sText_HoldEffectFlameOrb,
|
||||
[HOLD_EFFECT_TOXIC_ORB] = sText_HoldEffectToxicOrb,
|
||||
[HOLD_EFFECT_STICKY_BARB] = sText_HoldEffectStickyBarb,
|
||||
[HOLD_EFFECT_IRON_BALL] = sText_HoldEffectIronBall,
|
||||
[HOLD_EFFECT_BLACK_SLUDGE] = sText_HoldEffectBlackSludge,
|
||||
[HOLD_EFFECT_DESTINY_KNOT] = sText_HoldEffectDestinyKnot,
|
||||
[HOLD_EFFECT_SHED_SHELL] = sText_HoldEffectShedShell,
|
||||
[HOLD_EFFECT_QUICK_POWDER] = sText_HoldEffectQuickPowder,
|
||||
[HOLD_EFFECT_ADAMANT_ORB] = sText_HoldEffectAdamantOrb,
|
||||
[HOLD_EFFECT_LUSTROUS_ORB] = sText_HoldEffectLustrousOrb,
|
||||
[HOLD_EFFECT_GRISEOUS_ORB] = sText_HoldEffectGriseousOrb,
|
||||
[HOLD_EFFECT_GRACIDEA] = sText_HoldEffectGracidea,
|
||||
[HOLD_EFFECT_RESIST_BERRY] = sText_HoldEffectResistBerry,
|
||||
[HOLD_EFFECT_POWER_ITEM] = sText_HoldEffectPowerItem,
|
||||
[HOLD_EFFECT_RESTORE_PCT_HP] = sText_HoldEffectRestorePctHp,
|
||||
//[HOLD_EFFECT_MICLE_BERRY] = sText_HoldEffectMicleBerry,
|
||||
//[HOLD_EFFECT_CUSTAP_BERRY] = sText_HoldEffectCustapBerry,
|
||||
//[HOLD_EFFECT_JABOCA_BERRY] = sText_HoldEffectJabocaBerry,
|
||||
//[HOLD_EFFECT_ROWAP_BERRY] = sText_HoldEffectRowapBerry,
|
||||
//[HOLD_EFFECT_KEE_BERRY] = sText_HoldEffectKeeBerry,
|
||||
//[HOLD_EFFECT_MARANGA_BERRY] = sText_HoldEffectMarangaBerry,
|
||||
[HOLD_EFFECT_FLOAT_STONE] = sText_HoldEffectFloatStone,
|
||||
[HOLD_EFFECT_EVIOLITE] = sText_HoldEffectEviolite,
|
||||
[HOLD_EFFECT_ASSAULT_VEST] = sText_HoldEffectAssaultVest,
|
||||
[HOLD_EFFECT_DRIVE] = sText_HoldEffectDrive,
|
||||
[HOLD_EFFECT_GEMS] = sText_HoldEffectGems,
|
||||
[HOLD_EFFECT_ROCKY_HELMET] = sText_HoldEffectRockyHelmet,
|
||||
[HOLD_EFFECT_AIR_BALLOON] = sText_HoldEffectAirBalloon,
|
||||
[HOLD_EFFECT_RED_CARD] = sText_HoldEffectRedCard,
|
||||
[HOLD_EFFECT_RING_TARGET] = sText_HoldEffectRingTarget,
|
||||
[HOLD_EFFECT_BINDING_BAND] = sText_HoldEffectBindingBand,
|
||||
[HOLD_EFFECT_EJECT_BUTTON] = sText_HoldEffectEjectButton,
|
||||
[HOLD_EFFECT_ABSORB_BULB] = sText_HoldEffectAbsorbBulb,
|
||||
[HOLD_EFFECT_CELL_BATTERY] = sText_HoldEffectCellBattery,
|
||||
[HOLD_EFFECT_FAIRY_POWER] = sText_HoldEffectFairyPower,
|
||||
[HOLD_EFFECT_MEGA_STONE] = sText_HoldEffectMegaStone,
|
||||
[HOLD_EFFECT_SAFETY_GOOGLES] = sText_HoldEffectSafetyGoogles,
|
||||
[HOLD_EFFECT_LUMINOUS_MOSS] = sText_HoldEffectLuminousMoss,
|
||||
[HOLD_EFFECT_SNOWBALL] = sText_HoldEffectSnowball,
|
||||
[HOLD_EFFECT_WEAKNESS_POLICY] = sText_HoldEffectWeaknessPolicy,
|
||||
[HOLD_EFFECT_PROTECTIVE_PADS] = sText_HoldEffectProtectivePads,
|
||||
[HOLD_EFFECT_TERRAIN_EXTENDER] = sText_HoldEffectTerrainExtender,
|
||||
[HOLD_EFFECT_SEEDS] = sText_HoldEffectSeeds,
|
||||
[HOLD_EFFECT_ADRENALINE_ORB] = sText_HoldEffectAdrenalineOrb,
|
||||
[HOLD_EFFECT_MEMORY] = sText_HoldEffectMemory,
|
||||
[HOLD_EFFECT_PLATE] = sText_HoldEffectPlate,
|
||||
[HOLD_EFFECT_UTILITY_UMBRELLA] = sText_HoldEffectUtilityUmbrella,
|
||||
[HOLD_EFFECT_EJECT_PACK] = sText_HoldEffectEjectPack,
|
||||
[HOLD_EFFECT_ROOM_SERVICE] = sText_HoldEffectRoomService,
|
||||
[HOLD_EFFECT_BLUNDER_POLICY] = sText_HoldEffectBlunderPolicy,
|
||||
[HOLD_EFFECT_HEAVY_DUTY_BOOTS] = sText_HoldEffectHeavyDutyBoots,
|
||||
[HOLD_EFFECT_THROAT_SPRAY] = sText_HoldEffectThroatSpray,
|
||||
};
|
||||
static const u8 *GetHoldEffectName(u16 holdEffect)
|
||||
{
|
||||
if (holdEffect > ARRAY_COUNT(sHoldEffectNames))
|
||||
return sHoldEffectNames[0];
|
||||
return sHoldEffectNames[holdEffect];
|
||||
}
|
||||
|
@ -877,13 +877,13 @@ u32 GetAiScriptsInBattleFactory(void)
|
||||
int challengeNum = gSaveBlock2Ptr->frontier.factoryWinStreaks[battleMode][lvlMode] / 7;
|
||||
|
||||
if (gTrainerBattleOpponent_A == TRAINER_FRONTIER_BRAIN)
|
||||
return AI_SCRIPT_CHECK_BAD_MOVE | AI_SCRIPT_TRY_TO_FAINT | AI_SCRIPT_CHECK_VIABILITY;
|
||||
return AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY;
|
||||
else if (challengeNum < 2)
|
||||
return 0;
|
||||
else if (challengeNum < 4)
|
||||
return AI_SCRIPT_CHECK_BAD_MOVE;
|
||||
return AI_FLAG_CHECK_BAD_MOVE;
|
||||
else
|
||||
return AI_SCRIPT_CHECK_BAD_MOVE | AI_SCRIPT_TRY_TO_FAINT | AI_SCRIPT_CHECK_VIABILITY;
|
||||
return AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_anim.h"
|
||||
#include "constants/battle_anim.h"
|
||||
#include "battle_interface.h"
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_ai_util.h"
|
||||
#include "battle_arena.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_interface.h"
|
||||
@ -3031,6 +3032,7 @@ void SwitchInClearSetData(void)
|
||||
|
||||
ClearBattlerMoveHistory(gActiveBattler);
|
||||
ClearBattlerAbilityHistory(gActiveBattler);
|
||||
ClearBattlerItemEffectHistory(gActiveBattler);
|
||||
}
|
||||
|
||||
void FaintClearSetData(void)
|
||||
@ -3119,6 +3121,7 @@ void FaintClearSetData(void)
|
||||
|
||||
ClearBattlerMoveHistory(gActiveBattler);
|
||||
ClearBattlerAbilityHistory(gActiveBattler);
|
||||
ClearBattlerItemEffectHistory(gActiveBattler);
|
||||
UndoFormChange(gBattlerPartyIndexes[gActiveBattler], GET_BATTLER_SIDE(gActiveBattler));
|
||||
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
|
||||
UndoMegaEvolution(gBattlerPartyIndexes[gActiveBattler]);
|
||||
|
@ -4,7 +4,8 @@
|
||||
#include "constants/battle_script_commands.h"
|
||||
#include "battle_message.h"
|
||||
#include "battle_anim.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_ai_util.h"
|
||||
#include "battle_scripts.h"
|
||||
#include "constants/moves.h"
|
||||
#include "constants/abilities.h"
|
||||
@ -813,13 +814,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
|
||||
Cmd_metalburstdamagecalculator, //0xFF
|
||||
};
|
||||
|
||||
struct StatFractions
|
||||
{
|
||||
u8 dividend;
|
||||
u8 divisor;
|
||||
};
|
||||
|
||||
static const struct StatFractions sAccuracyStageRatios[] =
|
||||
const struct StatFractions gAccuracyStageRatios[] =
|
||||
{
|
||||
{ 33, 100}, // -6
|
||||
{ 36, 100}, // -5
|
||||
@ -1535,8 +1530,8 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move)
|
||||
if (defAbility == ABILITY_WONDER_SKIN && gBattleMoves[move].power == 0)
|
||||
moveAcc = 50;
|
||||
|
||||
calc = sAccuracyStageRatios[buff].dividend * moveAcc;
|
||||
calc /= sAccuracyStageRatios[buff].divisor;
|
||||
calc = gAccuracyStageRatios[buff].dividend * moveAcc;
|
||||
calc /= gAccuracyStageRatios[buff].divisor;
|
||||
|
||||
if (atkAbility == ABILITY_COMPOUND_EYES)
|
||||
calc = (calc * 130) / 100; // 1.3 compound eyes boost
|
||||
@ -7688,51 +7683,25 @@ static void Cmd_various(void)
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
case VARIOUS_SET_SIMPLE_BEAM:
|
||||
switch (gBattleMons[gActiveBattler].ability)
|
||||
if (IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gActiveBattler].ability))
|
||||
{
|
||||
case ABILITY_SIMPLE:
|
||||
case ABILITY_TRUANT:
|
||||
case ABILITY_STANCE_CHANGE:
|
||||
case ABILITY_DISGUISE:
|
||||
case ABILITY_MULTITYPE:
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMons[gActiveBattler].ability = ABILITY_SIMPLE;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
break;
|
||||
}
|
||||
return;
|
||||
case VARIOUS_TRY_ENTRAINMENT:
|
||||
switch (gBattleMons[gBattlerTarget].ability)
|
||||
if (IsEntrainmentBannedAbilityAttacker(gBattleMons[gBattlerAttacker].ability)
|
||||
|| IsEntrainmentTargetOrSimpleBeamBannedAbility(gBattleMons[gBattlerTarget].ability))
|
||||
{
|
||||
case ABILITY_TRUANT:
|
||||
case ABILITY_MULTITYPE:
|
||||
case ABILITY_STANCE_CHANGE:
|
||||
case ABILITY_SCHOOLING:
|
||||
case ABILITY_COMATOSE:
|
||||
case ABILITY_SHIELDS_DOWN:
|
||||
case ABILITY_DISGUISE:
|
||||
case ABILITY_RKS_SYSTEM:
|
||||
case ABILITY_BATTLE_BOND:
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
return;
|
||||
}
|
||||
switch (gBattleMons[gBattlerAttacker].ability)
|
||||
{
|
||||
case ABILITY_TRACE:
|
||||
case ABILITY_FORECAST:
|
||||
case ABILITY_FLOWER_GIFT:
|
||||
case ABILITY_ZEN_MODE:
|
||||
case ABILITY_ILLUSION:
|
||||
case ABILITY_IMPOSTER:
|
||||
case ABILITY_POWER_OF_ALCHEMY:
|
||||
case ABILITY_RECEIVER:
|
||||
case ABILITY_DISGUISE:
|
||||
case ABILITY_POWER_CONSTRUCT:
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
return;
|
||||
}
|
||||
|
||||
if (gBattleMons[gBattlerTarget].ability == gBattleMons[gBattlerAttacker].ability)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
@ -11062,6 +11031,12 @@ static void Cmd_callterrainattack(void) // nature power
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
u16 GetNaturePowerMove(void)
|
||||
{
|
||||
//TODO terrain
|
||||
return sNaturePowerMoves[gBattleTerrain];
|
||||
}
|
||||
|
||||
static void Cmd_cureifburnedparalysedorpoisoned(void) // refresh
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].status1 & (STATUS1_POISON | STATUS1_BURN | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON))
|
||||
@ -11228,18 +11203,20 @@ static void Cmd_tryswapitems(void) // trick
|
||||
|
||||
static void Cmd_trycopyability(void) // role play
|
||||
{
|
||||
switch (gBattleMons[gBattlerTarget].ability)
|
||||
u16 defAbility = gBattleMons[gBattlerTarget].ability;
|
||||
|
||||
if (gBattleMons[gBattlerAttacker].ability == defAbility
|
||||
|| defAbility == ABILITY_NONE
|
||||
|| IsRolePlayBannedAbilityAtk(gBattleMons[gBattlerAttacker].ability)
|
||||
|| IsRolePlayBannedAbility(defAbility))
|
||||
{
|
||||
case ABILITY_NONE:
|
||||
case ABILITY_WONDER_GUARD:
|
||||
case ABILITY_DISGUISE:
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
break;
|
||||
default:
|
||||
gBattleMons[gBattlerAttacker].ability = gBattleMons[gBattlerTarget].ability;
|
||||
gLastUsedAbility = gBattleMons[gBattlerTarget].ability;
|
||||
gBattlescriptCurrInstr += 5;
|
||||
break;
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMons[gBattlerAttacker].ability = defAbility;
|
||||
gLastUsedAbility = defAbility;
|
||||
gBattlescriptCurrInstr += 5;
|
||||
}
|
||||
}
|
||||
|
||||
@ -11293,28 +11270,14 @@ static void Cmd_settoxicspikes(void)
|
||||
|
||||
static void Cmd_setgastroacid(void)
|
||||
{
|
||||
switch (gBattleMons[gBattlerTarget].ability)
|
||||
if (IsGastroAcidBannedAbility(gBattleMons[gBattlerTarget].ability))
|
||||
{
|
||||
case ABILITY_AS_ONE_ICE_RIDER:
|
||||
case ABILITY_AS_ONE_SHADOW_RIDER:
|
||||
case ABILITY_BATTLE_BOND:
|
||||
case ABILITY_COMATOSE:
|
||||
case ABILITY_DISGUISE:
|
||||
case ABILITY_GULP_MISSILE:
|
||||
case ABILITY_ICE_FACE:
|
||||
case ABILITY_MULTITYPE:
|
||||
case ABILITY_POWER_CONSTRUCT:
|
||||
case ABILITY_RKS_SYSTEM:
|
||||
case ABILITY_SCHOOLING:
|
||||
case ABILITY_SHIELDS_DOWN:
|
||||
case ABILITY_STANCE_CHANGE:
|
||||
case ABILITY_ZEN_MODE:
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
else
|
||||
{
|
||||
gStatuses3[gBattlerTarget] |= STATUS3_GASTRO_ACID;
|
||||
gBattlescriptCurrInstr += 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -11383,24 +11346,13 @@ static void Cmd_setroom(void)
|
||||
|
||||
static void Cmd_tryswapabilities(void) // skill swap
|
||||
{
|
||||
switch (gBattleMons[gBattlerAttacker].ability)
|
||||
if (IsSkillSwapBannedAbility(gBattleMons[gBattlerAttacker].ability)
|
||||
|| IsSkillSwapBannedAbility(gBattleMons[gBattlerTarget].ability))
|
||||
{
|
||||
case ABILITY_NONE:
|
||||
case ABILITY_WONDER_GUARD:
|
||||
case ABILITY_DISGUISE:
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (gBattleMons[gBattlerTarget].ability)
|
||||
{
|
||||
case ABILITY_NONE:
|
||||
case ABILITY_WONDER_GUARD:
|
||||
case ABILITY_DISGUISE:
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
@ -11873,6 +11825,13 @@ static void Cmd_tryrecycleitem(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool32 CanCamouflage(u8 battlerId)
|
||||
{
|
||||
if (IS_BATTLER_OF_TYPE(battlerId, sTerrainToType[gBattleTerrain]))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void Cmd_settypetoterrain(void)
|
||||
{
|
||||
if (!IS_BATTLER_OF_TYPE(gBattlerAttacker, sTerrainToType[gBattleTerrain]))
|
||||
@ -12397,11 +12356,36 @@ static void Cmd_trainerslideout(void)
|
||||
gBattlescriptCurrInstr += 2;
|
||||
}
|
||||
|
||||
static const u16 sTelekinesisBanList[] =
|
||||
{
|
||||
SPECIES_DIGLETT,
|
||||
SPECIES_DUGTRIO,
|
||||
#ifdef POKEMON_EXPANSION
|
||||
SPECIES_DIGLETT_ALOLAN,
|
||||
SPECIES_DUGTRIO_ALOLAN,
|
||||
SPECIES_SANDYGAST,
|
||||
SPECIES_PALOSSAND,
|
||||
SPECIES_GENGAR_MEGA,
|
||||
#endif
|
||||
};
|
||||
|
||||
bool32 IsTelekinesisBannedSpecies(u16 species)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sTelekinesisBanList); i++)
|
||||
{
|
||||
if (species == sTelekinesisBanList[i])
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void Cmd_settelekinesis(void)
|
||||
{
|
||||
if (gStatuses3[gBattlerTarget] & (STATUS3_TELEKINESIS | STATUS3_ROOTED | STATUS3_SMACKED_DOWN)
|
||||
|| gFieldStatuses & STATUS_FIELD_GRAVITY
|
||||
|| (gBattleMons[gBattlerTarget].species == SPECIES_DIGLETT || gBattleMons[gBattlerTarget].species == SPECIES_DUGTRIO))
|
||||
|| IsTelekinesisBannedSpecies(gBattleMons[gBattlerTarget].species))
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
}
|
||||
@ -12469,19 +12453,14 @@ static void Cmd_trygetbaddreamstarget(void)
|
||||
|
||||
static void Cmd_tryworryseed(void)
|
||||
{
|
||||
switch (gBattleMons[gBattlerTarget].ability)
|
||||
if (IsWorrySeedBannedAbility(gBattleMons[gBattlerTarget].ability))
|
||||
{
|
||||
case ABILITY_INSOMNIA:
|
||||
case ABILITY_MULTITYPE:
|
||||
case ABILITY_TRUANT:
|
||||
case ABILITY_STANCE_CHANGE:
|
||||
case ABILITY_DISGUISE:
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattleMons[gBattlerTarget].ability = ABILITY_INSOMNIA;
|
||||
gBattlescriptCurrInstr += 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,8 @@
|
||||
#include "trig.h"
|
||||
#include "window.h"
|
||||
#include "battle_message.h"
|
||||
#include "battle_ai_script_commands.h"
|
||||
#include "battle_ai_main.h"
|
||||
#include "battle_ai_util.h"
|
||||
#include "event_data.h"
|
||||
#include "link.h"
|
||||
#include "malloc.h"
|
||||
@ -87,6 +88,134 @@ static const u8 sPkblToEscapeFactor[][3] = {
|
||||
static const u8 sGoNearCounterToCatchFactor[] = {4, 3, 2, 1};
|
||||
static const u8 sGoNearCounterToEscapeFactor[] = {4, 4, 4, 4};
|
||||
|
||||
static const u16 sSkillSwapBannedAbilities[] =
|
||||
{
|
||||
ABILITY_WONDER_GUARD,
|
||||
ABILITY_MULTITYPE,
|
||||
ABILITY_ILLUSION,
|
||||
ABILITY_STANCE_CHANGE,
|
||||
ABILITY_SCHOOLING,
|
||||
ABILITY_COMATOSE,
|
||||
ABILITY_SHIELDS_DOWN,
|
||||
ABILITY_DISGUISE,
|
||||
ABILITY_RKS_SYSTEM,
|
||||
ABILITY_BATTLE_BOND,
|
||||
ABILITY_POWER_CONSTRUCT,
|
||||
ABILITY_NEUTRALIZING_GAS,
|
||||
ABILITY_ICE_FACE,
|
||||
ABILITY_HUNGER_SWITCH,
|
||||
ABILITY_GULP_MISSILE,
|
||||
};
|
||||
|
||||
static const u16 sRolePlayBannedAbilities[] =
|
||||
{
|
||||
ABILITY_TRACE,
|
||||
ABILITY_WONDER_GUARD,
|
||||
ABILITY_FORECAST,
|
||||
ABILITY_FLOWER_GIFT,
|
||||
ABILITY_MULTITYPE,
|
||||
ABILITY_ILLUSION,
|
||||
ABILITY_ZEN_MODE,
|
||||
ABILITY_IMPOSTER,
|
||||
ABILITY_STANCE_CHANGE,
|
||||
ABILITY_POWER_OF_ALCHEMY,
|
||||
ABILITY_RECEIVER,
|
||||
ABILITY_SCHOOLING,
|
||||
ABILITY_COMATOSE,
|
||||
ABILITY_SHIELDS_DOWN,
|
||||
ABILITY_DISGUISE,
|
||||
ABILITY_RKS_SYSTEM,
|
||||
ABILITY_BATTLE_BOND,
|
||||
ABILITY_POWER_CONSTRUCT,
|
||||
ABILITY_ICE_FACE,
|
||||
ABILITY_HUNGER_SWITCH,
|
||||
ABILITY_GULP_MISSILE,
|
||||
};
|
||||
|
||||
static const u16 sRolePlayBannedAttackerAbilities[] =
|
||||
{
|
||||
ABILITY_MULTITYPE,
|
||||
ABILITY_ZEN_MODE,
|
||||
ABILITY_STANCE_CHANGE,
|
||||
ABILITY_SCHOOLING,
|
||||
ABILITY_COMATOSE,
|
||||
ABILITY_SHIELDS_DOWN,
|
||||
ABILITY_DISGUISE,
|
||||
ABILITY_RKS_SYSTEM,
|
||||
ABILITY_BATTLE_BOND,
|
||||
ABILITY_POWER_CONSTRUCT,
|
||||
ABILITY_ICE_FACE,
|
||||
ABILITY_GULP_MISSILE,
|
||||
};
|
||||
|
||||
static const u16 sWorrySeedBannedAbilities[] =
|
||||
{
|
||||
ABILITY_MULTITYPE,
|
||||
ABILITY_STANCE_CHANGE,
|
||||
ABILITY_SCHOOLING,
|
||||
ABILITY_COMATOSE,
|
||||
ABILITY_SHIELDS_DOWN,
|
||||
ABILITY_DISGUISE,
|
||||
ABILITY_RKS_SYSTEM,
|
||||
ABILITY_BATTLE_BOND,
|
||||
ABILITY_POWER_CONSTRUCT,
|
||||
ABILITY_TRUANT,
|
||||
ABILITY_ICE_FACE,
|
||||
ABILITY_GULP_MISSILE,
|
||||
};
|
||||
|
||||
static const u16 sGastroAcidBannedAbilities[] =
|
||||
{
|
||||
ABILITY_AS_ONE_ICE_RIDER,
|
||||
ABILITY_AS_ONE_SHADOW_RIDER,
|
||||
ABILITY_BATTLE_BOND,
|
||||
ABILITY_COMATOSE,
|
||||
ABILITY_DISGUISE,
|
||||
ABILITY_GULP_MISSILE,
|
||||
ABILITY_ICE_FACE,
|
||||
ABILITY_MULTITYPE,
|
||||
ABILITY_POWER_CONSTRUCT,
|
||||
ABILITY_RKS_SYSTEM,
|
||||
ABILITY_SCHOOLING,
|
||||
ABILITY_SHIELDS_DOWN,
|
||||
ABILITY_STANCE_CHANGE,
|
||||
ABILITY_ZEN_MODE,
|
||||
};
|
||||
|
||||
static const u16 sEntrainmentBannedAttackerAbilities[] =
|
||||
{
|
||||
ABILITY_TRACE,
|
||||
ABILITY_FORECAST,
|
||||
ABILITY_FLOWER_GIFT,
|
||||
ABILITY_ZEN_MODE,
|
||||
ABILITY_ILLUSION,
|
||||
ABILITY_IMPOSTER,
|
||||
ABILITY_POWER_OF_ALCHEMY,
|
||||
ABILITY_RECEIVER,
|
||||
ABILITY_DISGUISE,
|
||||
ABILITY_POWER_CONSTRUCT,
|
||||
ABILITY_NEUTRALIZING_GAS,
|
||||
ABILITY_ICE_FACE,
|
||||
ABILITY_HUNGER_SWITCH,
|
||||
ABILITY_GULP_MISSILE,
|
||||
};
|
||||
|
||||
static const u16 sEntrainmentTargetSimpleBeamBannedAbilities[] =
|
||||
{
|
||||
ABILITY_TRUANT,
|
||||
ABILITY_MULTITYPE,
|
||||
ABILITY_STANCE_CHANGE,
|
||||
ABILITY_SCHOOLING,
|
||||
ABILITY_COMATOSE,
|
||||
ABILITY_SHIELDS_DOWN,
|
||||
ABILITY_DISGUISE,
|
||||
ABILITY_RKS_SYSTEM,
|
||||
ABILITY_BATTLE_BOND,
|
||||
ABILITY_ICE_FACE,
|
||||
ABILITY_GULP_MISSILE,
|
||||
};
|
||||
|
||||
// Functions
|
||||
void HandleAction_UseMove(void)
|
||||
{
|
||||
u32 i, side, moveType, var = 4;
|
||||
@ -1407,11 +1536,11 @@ static bool32 IsGravityPreventingMove(u32 move)
|
||||
}
|
||||
}
|
||||
|
||||
static bool32 IsHealBlockPreventingMove(u32 battler, u32 move)
|
||||
bool32 IsHealBlockPreventingMove(u32 battler, u32 move)
|
||||
{
|
||||
if (!(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
|
||||
return FALSE;
|
||||
|
||||
|
||||
switch (gBattleMoves[move].effect)
|
||||
{
|
||||
case EFFECT_ABSORB:
|
||||
@ -2909,7 +3038,7 @@ void TryClearRageAndFuryCutter(void)
|
||||
}
|
||||
}
|
||||
|
||||
static bool32 IsThawingMove(u8 battlerId, u16 move)
|
||||
bool32 IsThawingMove(u8 battlerId, u16 move)
|
||||
{
|
||||
switch (move)
|
||||
{
|
||||
@ -5716,10 +5845,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
u8 ppBonuses;
|
||||
u16 move;
|
||||
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]];
|
||||
else
|
||||
mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]];
|
||||
mon = GetBattlerPartyData(battlerId);
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
move = GetMonData(mon, MON_DATA_MOVE1 + i);
|
||||
@ -8411,3 +8537,123 @@ static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 TestMoveFlags(u16 move, u32 flag)
|
||||
{
|
||||
if (gBattleMoves[move].flags & flag)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct Pokemon *GetBattlerPartyData(u8 battlerId)
|
||||
{
|
||||
struct Pokemon *mon;
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]];
|
||||
else
|
||||
mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]];
|
||||
|
||||
return mon;
|
||||
}
|
||||
|
||||
//Make sure the input bank is any bank on the specific mon's side
|
||||
bool32 CanFling(u8 battlerId)
|
||||
{
|
||||
u16 item = gBattleMons[battlerId].item;
|
||||
u16 itemEffect = ItemId_GetHoldEffect(item);
|
||||
|
||||
if (item == ITEM_NONE
|
||||
|| GetBattlerAbility(battlerId) == ABILITY_KLUTZ
|
||||
|| gFieldStatuses & STATUS_FIELD_MAGIC_ROOM
|
||||
|| gDisableStructs[battlerId].embargoTimer != 0
|
||||
|| !CanBattlerGetOrLoseItem(battlerId, item)
|
||||
//|| itemEffect == HOLD_EFFECT_PRIMAL_ORB
|
||||
|| itemEffect == HOLD_EFFECT_GEMS
|
||||
#ifdef ITEM_ABILITY_CAPSULE
|
||||
|| item == ITEM_ABILITY_CAPSULE
|
||||
#endif
|
||||
|| (ItemId_GetPocket(item) == POCKET_BERRIES && IsAbilityOnSide(battlerId, ABILITY_UNNERVE))
|
||||
|| GetPocketByItemId(item) == POCKET_POKE_BALLS)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ability checks
|
||||
bool32 IsRolePlayBannedAbilityAtk(u16 ability)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < ARRAY_COUNT(sRolePlayBannedAttackerAbilities); i++)
|
||||
{
|
||||
if (ability == sRolePlayBannedAttackerAbilities[i])
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsRolePlayBannedAbility(u16 ability)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < ARRAY_COUNT(sRolePlayBannedAbilities); i++)
|
||||
{
|
||||
if (ability == sRolePlayBannedAbilities[i])
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsSkillSwapBannedAbility(u16 ability)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < ARRAY_COUNT(sSkillSwapBannedAbilities); i++)
|
||||
{
|
||||
if (ability == sSkillSwapBannedAbilities[i])
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsWorrySeedBannedAbility(u16 ability)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < ARRAY_COUNT(sWorrySeedBannedAbilities); i++)
|
||||
{
|
||||
if (ability == sWorrySeedBannedAbilities[i])
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsGastroAcidBannedAbility(u16 ability)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < ARRAY_COUNT(sGastroAcidBannedAbilities); i++)
|
||||
{
|
||||
if (ability == sGastroAcidBannedAbilities[i])
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsEntrainmentBannedAbilityAttacker(u16 ability)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < ARRAY_COUNT(sEntrainmentBannedAttackerAbilities); i++)
|
||||
{
|
||||
if (ability == sEntrainmentBannedAttackerAbilities[i])
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsEntrainmentTargetOrSimpleBeamBannedAbility(u16 ability)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < ARRAY_COUNT(sEntrainmentTargetSimpleBeamBannedAbilities); i++)
|
||||
{
|
||||
if (ability == sEntrainmentTargetSimpleBeamBannedAbilities[i])
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ void AllocateBattleResources(void)
|
||||
gBattleResources->beforeLvlUp = AllocZeroed(sizeof(*gBattleResources->beforeLvlUp));
|
||||
gBattleResources->ai = AllocZeroed(sizeof(*gBattleResources->ai));
|
||||
gBattleResources->battleHistory = AllocZeroed(sizeof(*gBattleResources->battleHistory));
|
||||
gBattleResources->AI_ScriptsStack = AllocZeroed(sizeof(*gBattleResources->AI_ScriptsStack));
|
||||
|
||||
gLinkBattleSendBuffer = AllocZeroed(BATTLE_BUFFER_LINK_SIZE);
|
||||
gLinkBattleRecvBuffer = AllocZeroed(BATTLE_BUFFER_LINK_SIZE);
|
||||
@ -59,7 +58,6 @@ void FreeBattleResources(void)
|
||||
FREE_AND_SET_NULL(gBattleResources->beforeLvlUp);
|
||||
FREE_AND_SET_NULL(gBattleResources->ai);
|
||||
FREE_AND_SET_NULL(gBattleResources->battleHistory);
|
||||
FREE_AND_SET_NULL(gBattleResources->AI_ScriptsStack);
|
||||
FREE_AND_SET_NULL(gBattleResources);
|
||||
|
||||
FREE_AND_SET_NULL(gLinkBattleSendBuffer);
|
||||
|
1678
src/data/trainers.h
1678
src/data/trainers.h
File diff suppressed because it is too large
Load Diff
23
src/item.c
23
src/item.c
@ -953,3 +953,26 @@ u8 ItemId_GetSecondaryId(u16 itemId)
|
||||
{
|
||||
return gItems[SanitizeItemId(itemId)].secondaryId;
|
||||
}
|
||||
|
||||
bool32 IsPinchBerryItemEffect(u16 holdEffect)
|
||||
{
|
||||
switch (holdEffect)
|
||||
{
|
||||
case HOLD_EFFECT_ATTACK_UP:
|
||||
case HOLD_EFFECT_DEFENSE_UP:
|
||||
case HOLD_EFFECT_SPEED_UP:
|
||||
case HOLD_EFFECT_SP_ATTACK_UP:
|
||||
case HOLD_EFFECT_SP_DEFENSE_UP:
|
||||
case HOLD_EFFECT_CRITICAL_UP:
|
||||
case HOLD_EFFECT_RANDOM_STAT_UP:
|
||||
#ifdef HOLD_EFFECT_CUSTAP_BERRY
|
||||
case HOLD_EFFECT_CUSTAP_BERRY:
|
||||
#endif
|
||||
#ifdef HOLD_EFFECT_MICLE_BERRY
|
||||
case HOLD_EFFECT_MICLE_BERRY:
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ void FillHillTrainersParties(void)
|
||||
// hill trainers.
|
||||
u32 GetTrainerHillAIFlags(void)
|
||||
{
|
||||
return (AI_SCRIPT_CHECK_BAD_MOVE | AI_SCRIPT_TRY_TO_FAINT | AI_SCRIPT_CHECK_VIABILITY);
|
||||
return (AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY);
|
||||
}
|
||||
|
||||
u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId)
|
||||
|
@ -91,7 +91,7 @@
|
||||
.include "src/region_map.o"
|
||||
.include "src/decoration.o"
|
||||
.include "src/slot_machine.o"
|
||||
.include "src/battle_ai_script_commands.o"
|
||||
.include "src/battle_ai_main.o"
|
||||
.include "src/fldeff_misc.o"
|
||||
.include "src/pokeblock.o"
|
||||
.include "src/field_specials.o"
|
||||
|
Loading…
x
Reference in New Issue
Block a user