Merge pull request #1786 from Xavion3/damage_debug

Adds simulated damage to the debug menu
This commit is contained in:
ghoulslash 2021-10-19 12:14:38 -04:00 committed by GitHub
commit 416c517e49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 6 deletions

View file

@ -596,6 +596,7 @@ struct BattleStruct
bool8 spriteIgnore0Hp; bool8 spriteIgnore0Hp;
struct Illusion illusion[MAX_BATTLERS_COUNT]; struct Illusion illusion[MAX_BATTLERS_COUNT];
s8 aiFinalScore[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT][MAX_MON_MOVES]; // AI, target, moves to make debugging easier s8 aiFinalScore[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT][MAX_MON_MOVES]; // AI, target, moves to make debugging easier
s32 aiSimulatedDamage[MAX_BATTLERS_COUNT][MAX_BATTLERS_COUNT][MAX_MON_MOVES]; // attacker, target, move to make debugging easier
u8 soulheartBattlerId; u8 soulheartBattlerId;
u8 friskedBattler; // Frisk needs to identify 2 battlers in double battles. u8 friskedBattler; // Frisk needs to identify 2 battlers in double battles.
bool8 friskedAbility; // If identifies two mons, show the ability pop-up only once. bool8 friskedAbility; // If identifies two mons, show the ability pop-up only once.

View file

@ -177,10 +177,10 @@ void BattleAI_SetupAIData(u8 defaultScoreMoves)
} }
sBattler_AI = gActiveBattler; sBattler_AI = gActiveBattler;
// Simulate dmg for all AI moves against all opposing targets // Simulate dmg for all AI moves against all other targets
for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++) for (gBattlerTarget = 0; gBattlerTarget < gBattlersCount; gBattlerTarget++)
{ {
if (GET_BATTLER_SIDE2(sBattler_AI) == GET_BATTLER_SIDE2(gBattlerTarget)) if (sBattler_AI == gBattlerTarget)
continue; continue;
for (i = 0; i < MAX_MON_MOVES; i++) for (i = 0; i < MAX_MON_MOVES; i++)
{ {
@ -266,8 +266,10 @@ static u8 ChooseMoveOrAction_Singles(void)
AI_THINKING_STRUCT->movesetIndex = 0; AI_THINKING_STRUCT->movesetIndex = 0;
} }
for (i = 0; i < MAX_MON_MOVES; i++) for (i = 0; i < MAX_MON_MOVES; i++) {
gBattleStruct->aiFinalScore[sBattler_AI][gBattlerTarget][i] = AI_THINKING_STRUCT->score[i]; gBattleStruct->aiFinalScore[sBattler_AI][gBattlerTarget][i] = AI_THINKING_STRUCT->score[i];
gBattleStruct->aiSimulatedDamage[sBattler_AI][gBattlerTarget][i] = AI_THINKING_STRUCT->simulatedDmg[sBattler_AI][gBattlerTarget][i];
}
// Check special AI actions. // Check special AI actions.
if (AI_THINKING_STRUCT->aiAction & AI_ACTION_FLEE) if (AI_THINKING_STRUCT->aiAction & AI_ACTION_FLEE)
@ -432,8 +434,10 @@ static u8 ChooseMoveOrAction_Doubles(void)
} }
} }
for (j = 0; j < MAX_MON_MOVES; j++) for (j = 0; j < MAX_MON_MOVES; j++) {
gBattleStruct->aiFinalScore[sBattler_AI][gBattlerTarget][j] = AI_THINKING_STRUCT->score[j]; gBattleStruct->aiFinalScore[sBattler_AI][gBattlerTarget][j] = AI_THINKING_STRUCT->score[j];
gBattleStruct->aiSimulatedDamage[sBattler_AI][gBattlerTarget][j] = AI_THINKING_STRUCT->simulatedDmg[sBattler_AI][gBattlerTarget][j];
}
} }
} }

View file

@ -232,7 +232,7 @@ static const u8 sText_InDoubles[] = _("In Doubles");
static const u8 sText_HpAware[] = _("HP aware"); static const u8 sText_HpAware[] = _("HP aware");
static const u8 sText_Unknown[] = _("Unknown"); static const u8 sText_Unknown[] = _("Unknown");
static const u8 sText_InLove[] = _("In Love"); static const u8 sText_InLove[] = _("In Love");
static const u8 sText_AIMovePts[] = _("AI Move Pts"); static const u8 sText_AIMovePts[] = _("AI Pts/Dmg");
static const u8 sText_AiKnowledge[] = _("AI Info"); static const u8 sText_AiKnowledge[] = _("AI Info");
static const u8 sText_EffectOverride[] = _("Effect Override"); static const u8 sText_EffectOverride[] = _("Effect Override");
@ -731,6 +731,12 @@ static void PutMovesPointsText(struct BattleDebugMenu *data)
gBattleStruct->aiFinalScore[data->aiBattlerId][gSprites[data->aiIconSpriteIds[j]].data[0]][i], gBattleStruct->aiFinalScore[data->aiBattlerId][gSprites[data->aiIconSpriteIds[j]].data[0]][i],
STR_CONV_MODE_RIGHT_ALIGN, 3); STR_CONV_MODE_RIGHT_ALIGN, 3);
AddTextPrinterParameterized(data->aiMovesWindowId, 1, text, 83 + count * 54, i * 15, 0, NULL); AddTextPrinterParameterized(data->aiMovesWindowId, 1, text, 83 + count * 54, i * 15, 0, NULL);
ConvertIntToDecimalStringN(text,
gBattleStruct->aiSimulatedDamage[data->aiBattlerId][gSprites[data->aiIconSpriteIds[j]].data[0]][i],
STR_CONV_MODE_RIGHT_ALIGN, 3);
AddTextPrinterParameterized(data->aiMovesWindowId, 1, text, 110 + count * 54, i * 15, 0, NULL);
count++; count++;
} }
} }
@ -798,7 +804,7 @@ static void Task_ShowAiPoints(u8 taskId)
break; break;
// Put text // Put text
case 1: case 1:
winTemplate = CreateWindowTemplate(1, 0, 4, 27, 14, 15, 0x200); winTemplate = CreateWindowTemplate(1, 0, 4, 30, 14, 15, 0x200);
data->aiMovesWindowId = AddWindow(&winTemplate); data->aiMovesWindowId = AddWindow(&winTemplate);
PutWindowTilemap(data->aiMovesWindowId); PutWindowTilemap(data->aiMovesWindowId);
PutMovesPointsText(data); PutMovesPointsText(data);