parent
96650ffd27
commit
3f5335c4ba
@ -353,7 +353,7 @@ struct AI_ThinkingStruct
|
||||
u16 moveConsidered;
|
||||
s32 score[MAX_MON_MOVES];
|
||||
u32 funcResult;
|
||||
u32 aiFlags[MAX_BATTLERS_COUNT];
|
||||
u64 aiFlags[MAX_BATTLERS_COUNT];
|
||||
u8 aiAction;
|
||||
u8 aiLogicId;
|
||||
struct AI_SavedBattleMon saved[MAX_BATTLERS_COUNT];
|
||||
|
||||
@ -6,7 +6,7 @@ bool8 InBattleFactory(void);
|
||||
u8 GetFactoryMonFixedIV(u8 challengeNum, bool8 isLastBattle);
|
||||
void FillFactoryBrainParty(void);
|
||||
u8 GetNumPastRentalsRank(u8 battleMode, u8 lvlMode);
|
||||
u32 GetAiScriptsInBattleFactory(void);
|
||||
u64 GetAiScriptsInBattleFactory(void);
|
||||
void SetMonMoveAvoidReturn(struct Pokemon *mon, u16 moveArg, u8 moveSlot);
|
||||
|
||||
#endif // GUARD_BATTLE_FACTORY_H
|
||||
|
||||
@ -32,6 +32,9 @@
|
||||
#define AI_FLAG_PREDICT_INCOMING_MON (1 << 24) // AI will score against the predicting incoming mon if it predicts the player to switch. Requires AI_FLAG_PREDICT_SWITCH
|
||||
#define AI_FLAG_PP_STALL_PREVENTION (1 << 25) // AI keeps track of the player's switches where the incoming mon is immune to the chosen move
|
||||
|
||||
// Flags at and after 32 need different formatting, as in
|
||||
// #define AI_FLAG_PLACEHOLDER ((u64)1 << 32)
|
||||
|
||||
#define AI_FLAG_COUNT 26
|
||||
|
||||
// The following options are enough to have a basic/smart trainer. Any other addtion could make the trainer worse/better depending on the flag
|
||||
@ -40,10 +43,10 @@
|
||||
#define AI_FLAG_PREDICTION (AI_FLAG_PREDICT_SWITCH | AI_FLAG_PREDICT_INCOMING_MON)
|
||||
|
||||
// 'other' ai logic flags
|
||||
#define AI_FLAG_DYNAMIC_FUNC (1 << 28) // Create custom AI functions for specific battles via "setdynamicaifunc" cmd
|
||||
#define AI_FLAG_ROAMING (1 << 29)
|
||||
#define AI_FLAG_SAFARI (1 << 30)
|
||||
#define AI_FLAG_FIRST_BATTLE (1 << 31)
|
||||
#define AI_FLAG_DYNAMIC_FUNC ((u64)1 << 60) // Create custom AI functions for specific battles via "setdynamicaifunc" cmd
|
||||
#define AI_FLAG_ROAMING ((u64)1 << 61)
|
||||
#define AI_FLAG_SAFARI ((u64)1 << 62)
|
||||
#define AI_FLAG_FIRST_BATTLE ((u64)1 << 63)
|
||||
|
||||
#define AI_SCORE_DEFAULT 100 // Default score for all AI moves.
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ struct TrainerMon
|
||||
|
||||
struct Trainer
|
||||
{
|
||||
/*0x00*/ u32 aiFlags;
|
||||
/*0x00*/ u64 aiFlags;
|
||||
/*0x04*/ const struct TrainerMon *party;
|
||||
/*0x08*/ u16 items[MAX_TRAINER_ITEMS];
|
||||
/*0x10*/ u8 trainerClass;
|
||||
@ -295,7 +295,7 @@ static inline const struct TrainerMon *GetTrainerPartyFromId(u16 trainerId)
|
||||
return gTrainers[difficulty][sanitizedTrainerId].party;
|
||||
}
|
||||
|
||||
static inline const bool32 GetTrainerAIFlagsFromId(u16 trainerId)
|
||||
static inline const u64 GetTrainerAIFlagsFromId(u16 trainerId)
|
||||
{
|
||||
u32 sanitizedTrainerId = SanitizeTrainerId(trainerId);
|
||||
enum DifficultyLevel difficulty = GetTrainerDifficultyLevel(sanitizedTrainerId);
|
||||
|
||||
@ -6,6 +6,6 @@ extern const u8 Debug_FlagsAndVarNotSetBattleConfigMessage[];
|
||||
const u8 *GetWeatherName(u32 weatherId);
|
||||
|
||||
extern EWRAM_DATA bool8 gIsDebugBattle;
|
||||
extern EWRAM_DATA u32 gDebugAIFlags;
|
||||
extern EWRAM_DATA u64 gDebugAIFlags;
|
||||
|
||||
#endif // GUARD_DEBUG_H
|
||||
|
||||
@ -27,7 +27,7 @@ struct RecordedBattleSave
|
||||
u8 frontierBrainSymbol;
|
||||
u8 battleScene:1;
|
||||
u8 textSpeed:3;
|
||||
u32 AI_scripts;
|
||||
u64 AI_scripts;
|
||||
u8 recordMixFriendName[PLAYER_NAME_LENGTH + 1];
|
||||
u8 recordMixFriendClass;
|
||||
u8 apprenticeId;
|
||||
@ -81,7 +81,7 @@ u8 GetBattleSceneInRecordedBattle(void);
|
||||
u8 GetTextSpeedInRecordedBattle(void);
|
||||
void RecordedBattle_CopyBattlerMoves(u32 battler);
|
||||
void RecordedBattle_CheckMovesetChanges(u8 mode);
|
||||
u32 GetAiScriptsInRecordedBattle(void);
|
||||
u64 GetAiScriptsInRecordedBattle(void);
|
||||
void RecordedBattle_SetPlaybackFinished(void);
|
||||
bool8 RecordedBattle_CanStopPlayback(void);
|
||||
void GetRecordedBattleRecordMixFriendName(u8 *dst);
|
||||
|
||||
@ -873,7 +873,7 @@ void OpenPokemon(u32 sourceLine, u32 side, u32 species);
|
||||
void ClosePokemon(u32 sourceLine);
|
||||
|
||||
void RNGSeed_(u32 sourceLine, rng_value_t seed);
|
||||
void AIFlags_(u32 sourceLine, u32 flags);
|
||||
void AIFlags_(u32 sourceLine, u64 flags);
|
||||
void AILogScores(u32 sourceLine);
|
||||
void Gender_(u32 sourceLine, u32 gender);
|
||||
void Nature_(u32 sourceLine, u32 nature);
|
||||
|
||||
@ -125,10 +125,10 @@ void BattleAI_SetupItems(void)
|
||||
}
|
||||
}
|
||||
|
||||
static u32 GetWildAiFlags(void)
|
||||
static u64 GetWildAiFlags(void)
|
||||
{
|
||||
u32 avgLevel = GetMonData(&gEnemyParty[0], MON_DATA_LEVEL);
|
||||
u32 flags = 0;
|
||||
u64 flags = 0;
|
||||
|
||||
if (IsDoubleBattle())
|
||||
avgLevel = (GetMonData(&gEnemyParty[0], MON_DATA_LEVEL) + GetMonData(&gEnemyParty[1], MON_DATA_LEVEL)) / 2;
|
||||
@ -147,9 +147,9 @@ static u32 GetWildAiFlags(void)
|
||||
return flags;
|
||||
}
|
||||
|
||||
static u32 GetAiFlags(u16 trainerId)
|
||||
static u64 GetAiFlags(u16 trainerId)
|
||||
{
|
||||
u32 flags = 0;
|
||||
u64 flags = 0;
|
||||
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_HAS_AI) && !IsWildMonSmart())
|
||||
return 0;
|
||||
@ -240,12 +240,12 @@ void BattleAI_SetupFlags(void)
|
||||
void BattleAI_SetupAIData(u8 defaultScoreMoves, u32 battler)
|
||||
{
|
||||
u32 moveLimitations;
|
||||
u32 flags[MAX_BATTLERS_COUNT];
|
||||
u64 flags[MAX_BATTLERS_COUNT];
|
||||
|
||||
// Clear AI data but preserve the flags.
|
||||
memcpy(&flags[0], &AI_THINKING_STRUCT->aiFlags[0], sizeof(u32) * MAX_BATTLERS_COUNT);
|
||||
memcpy(&flags[0], &AI_THINKING_STRUCT->aiFlags[0], sizeof(u64) * MAX_BATTLERS_COUNT);
|
||||
memset(AI_THINKING_STRUCT, 0, sizeof(struct AI_ThinkingStruct));
|
||||
memcpy(&AI_THINKING_STRUCT->aiFlags[0], &flags[0], sizeof(u32) * MAX_BATTLERS_COUNT);
|
||||
memcpy(&AI_THINKING_STRUCT->aiFlags[0], &flags[0], sizeof(u64) * MAX_BATTLERS_COUNT);
|
||||
|
||||
moveLimitations = AI_DATA->moveLimitations[battler];
|
||||
|
||||
@ -607,7 +607,7 @@ static u32 ChooseMoveOrAction_Singles(u32 battlerAi)
|
||||
u8 consideredMoveArray[MAX_MON_MOVES];
|
||||
u32 numOfBestMoves;
|
||||
s32 i;
|
||||
u32 flags = AI_THINKING_STRUCT->aiFlags[battlerAi];
|
||||
u64 flags = AI_THINKING_STRUCT->aiFlags[battlerAi];
|
||||
|
||||
AI_DATA->partnerMove = 0; // no ally
|
||||
while (flags != 0)
|
||||
@ -619,7 +619,7 @@ static u32 ChooseMoveOrAction_Singles(u32 battlerAi)
|
||||
else
|
||||
BattleAI_DoAIProcessing(AI_THINKING_STRUCT, battlerAi, gBattlerTarget);
|
||||
}
|
||||
flags >>= 1;
|
||||
flags >>= (u64)1;
|
||||
AI_THINKING_STRUCT->aiLogicId++;
|
||||
}
|
||||
|
||||
@ -656,7 +656,7 @@ static u32 ChooseMoveOrAction_Singles(u32 battlerAi)
|
||||
static u32 ChooseMoveOrAction_Doubles(u32 battlerAi)
|
||||
{
|
||||
s32 i, j;
|
||||
u32 flags;
|
||||
u64 flags;
|
||||
s32 bestMovePointsForTarget[MAX_BATTLERS_COUNT];
|
||||
u8 mostViableTargetsArray[MAX_BATTLERS_COUNT];
|
||||
u8 actionOrMoveIndex[MAX_BATTLERS_COUNT];
|
||||
@ -696,7 +696,7 @@ static u32 ChooseMoveOrAction_Doubles(u32 battlerAi)
|
||||
else
|
||||
BattleAI_DoAIProcessing(AI_THINKING_STRUCT, battlerAi, gBattlerTarget);
|
||||
}
|
||||
flags >>= 1;
|
||||
flags >>= (u64)1;
|
||||
AI_THINKING_STRUCT->aiLogicId++;
|
||||
}
|
||||
|
||||
|
||||
@ -817,7 +817,7 @@ u8 GetNumPastRentalsRank(u8 battleMode, u8 lvlMode)
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 GetAiScriptsInBattleFactory(void)
|
||||
u64 GetAiScriptsInBattleFactory(void)
|
||||
{
|
||||
int lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
|
||||
|
||||
@ -337,7 +337,7 @@ static EWRAM_DATA struct DebugMonData *sDebugMonData = NULL;
|
||||
static EWRAM_DATA struct DebugMenuListData *sDebugMenuListData = NULL;
|
||||
static EWRAM_DATA struct DebugBattleData *sDebugBattleData = NULL;
|
||||
EWRAM_DATA bool8 gIsDebugBattle = FALSE;
|
||||
EWRAM_DATA u32 gDebugAIFlags = 0;
|
||||
EWRAM_DATA u64 gDebugAIFlags = 0;
|
||||
|
||||
// *******************************
|
||||
// Define functions
|
||||
|
||||
@ -49,7 +49,7 @@ EWRAM_DATA static u8 sFrontierPassFlag = 0;
|
||||
EWRAM_DATA static u8 sBattleScene = 0;
|
||||
EWRAM_DATA static u8 sTextSpeed = 0;
|
||||
EWRAM_DATA static u32 sBattleFlags = 0;
|
||||
EWRAM_DATA static u32 sAI_Scripts = 0;
|
||||
EWRAM_DATA static u64 sAI_Scripts = 0;
|
||||
EWRAM_DATA static struct Pokemon sSavedPlayerParty[PARTY_SIZE] = {0};
|
||||
EWRAM_DATA static struct Pokemon sSavedOpponentParty[PARTY_SIZE] = {0};
|
||||
EWRAM_DATA static u16 sPlayerMonMoves[MAX_BATTLERS_COUNT / 2][MAX_MON_MOVES] = {0};
|
||||
@ -785,7 +785,7 @@ void RecordedBattle_CheckMovesetChanges(u8 mode)
|
||||
}
|
||||
}
|
||||
|
||||
u32 GetAiScriptsInRecordedBattle(void)
|
||||
u64 GetAiScriptsInRecordedBattle(void)
|
||||
{
|
||||
return sAI_Scripts;
|
||||
}
|
||||
|
||||
@ -935,7 +935,7 @@ void FillHillTrainersParties(void)
|
||||
// This function is unused, but my best guess is
|
||||
// it was supposed to return AI scripts for trainer
|
||||
// hill trainers.
|
||||
u32 GetTrainerHillAIFlags(void)
|
||||
u64 GetTrainerHillAIFlags(void)
|
||||
{
|
||||
return (AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_TRY_TO_FAINT | AI_FLAG_CHECK_VIABILITY);
|
||||
}
|
||||
|
||||
@ -1485,7 +1485,7 @@ void RNGSeed_(u32 sourceLine, rng_value_t seed)
|
||||
DATA.recordedBattle.rngSeed = seed;
|
||||
}
|
||||
|
||||
void AIFlags_(u32 sourceLine, u32 flags)
|
||||
void AIFlags_(u32 sourceLine, u64 flags)
|
||||
{
|
||||
INVALID_IF(!IsAITest(), "AI_FLAGS is usable only in AI_SINGLE_BATTLE_TEST & AI_DOUBLE_BATTLE_TEST");
|
||||
DATA.recordedBattle.AI_scripts = flags;
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_TRAINER_AI_FLAGS 32
|
||||
#define MAX_TRAINER_AI_FLAGS 64
|
||||
#define MAX_TRAINER_ITEMS 4
|
||||
#define PARTY_SIZE 255
|
||||
#define MAX_MON_MOVES 4
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user