mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
allow for illegal abilities within tests
This commit is contained in:
parent
a1a49cef8f
commit
53fa7e524c
@ -6,7 +6,7 @@
|
||||
// still has them in the ROM. This is because the developers forgot
|
||||
// to define NDEBUG before release, however this has been changed as
|
||||
// Ruby's actual debug build does not use the AGBPrint features.
|
||||
#define NDEBUG
|
||||
// #define NDEBUG
|
||||
|
||||
// To enable printf debugging, comment out "#define NDEBUG". This allows
|
||||
// the various AGBPrint functions to be used. (See include/gba/isagbprint.h).
|
||||
|
@ -17,6 +17,8 @@ void TestRunner_Battle_AfterLastTurn(void);
|
||||
|
||||
void TestRunner_Battle_CheckBattleRecordActionType(u32 battlerId, u32 recordIndex, u32 actionType);
|
||||
|
||||
u32 TestRunner_Battle_GetForcedAbility(u32 side, u32 partyIndex);
|
||||
|
||||
#else
|
||||
|
||||
#define TestRunner_Battle_RecordAbilityPopUp(...) (void)0
|
||||
@ -28,6 +30,8 @@ void TestRunner_Battle_CheckBattleRecordActionType(u32 battlerId, u32 recordInde
|
||||
|
||||
#define TestRunner_Battle_CheckBattleRecordActionType(...) (void)0
|
||||
|
||||
#define TestRunner_Battle_GetForcedAbility(...) (u32)0
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -3302,6 +3302,14 @@ void SwitchInClearSetData(void)
|
||||
// Clear selected party ID so Revival Blessing doesn't get confused.
|
||||
gSelectedMonPartyId = PARTY_SIZE;
|
||||
|
||||
// Allow for illegal abilities within tests.
|
||||
if (gTestRunnerEnabled)
|
||||
{
|
||||
u32 side = GetBattlerSide(gActiveBattler);
|
||||
u32 partyIndex = gBattlerPartyIndexes[gActiveBattler];
|
||||
gBattleMons[gActiveBattler].ability = gBattleStruct->overwrittenAbilities[gActiveBattler] = TestRunner_Battle_GetForcedAbility(side, partyIndex);
|
||||
}
|
||||
|
||||
Ai_UpdateSwitchInData(gActiveBattler);
|
||||
}
|
||||
|
||||
@ -3794,6 +3802,18 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
}
|
||||
}
|
||||
|
||||
// Allow for illegal abilities within tests.
|
||||
if (gTestRunnerEnabled && gBattleStruct->switchInAbilitiesCounter == 0)
|
||||
{
|
||||
for (i = 0; i < gBattlersCount; ++i)
|
||||
{
|
||||
u32 side = GetBattlerSide(i);
|
||||
u32 partyIndex = gBattlerPartyIndexes[i];
|
||||
if (TestRunner_Battle_GetForcedAbility(side, partyIndex))
|
||||
gBattleMons[i].ability = gBattleStruct->overwrittenAbilities[i] = TestRunner_Battle_GetForcedAbility(side, partyIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if (gBattleStruct->switchInAbilitiesCounter == 0)
|
||||
{
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
|
@ -574,6 +574,7 @@ struct BattleTestData
|
||||
struct Pokemon *currentMon;
|
||||
u8 gender;
|
||||
u8 nature;
|
||||
u16 forcedAbilities[NUM_BATTLE_SIDES][PARTY_SIZE];
|
||||
|
||||
u8 currentMonIndexes[MAX_BATTLERS_COUNT];
|
||||
u8 turnState;
|
||||
|
@ -1090,7 +1090,14 @@ void Ability_(u32 sourceLine, u32 ability)
|
||||
break;
|
||||
}
|
||||
}
|
||||
INVALID_IF(i == NUM_ABILITY_SLOTS, "%S cannot have %S", gSpeciesNames[species], gAbilityNames[ability]);
|
||||
|
||||
// Store forced ability to be set when the battle starts if invalid.
|
||||
if (i == NUM_ABILITY_SLOTS)
|
||||
{
|
||||
DATA.forcedAbilities[DATA.currentSide][DATA.currentPartyIndex] = ability;
|
||||
}
|
||||
|
||||
// INVALID_IF(i == NUM_ABILITY_SLOTS, "%S cannot have %S", gSpeciesNames[species], gAbilityNames[ability]);
|
||||
}
|
||||
|
||||
void Level_(u32 sourceLine, u32 level)
|
||||
@ -1774,3 +1781,8 @@ void ValidateFinally(u32 sourceLine)
|
||||
return;
|
||||
INVALID_IF(STATE->parametersCount == 0, "FINALLY without PARAMETRIZE");
|
||||
}
|
||||
|
||||
u32 TestRunner_Battle_GetForcedAbility(u32 side, u32 partyIndex)
|
||||
{
|
||||
return DATA.forcedAbilities[side][partyIndex];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user