Test battlers always have their forced abilities (#4707)
* Test battlers always have their forced abilities * indentation
This commit is contained in:
parent
0b02527e5c
commit
3fa6bf46db
5 changed files with 65 additions and 0 deletions
|
@ -1609,6 +1609,15 @@ static u32 GetBattlerMonData(u32 battler, struct Pokemon *party, u32 monId, u8 *
|
||||||
src = (u8 *)&battleMon;
|
src = (u8 *)&battleMon;
|
||||||
for (size = 0; size < sizeof(battleMon); size++)
|
for (size = 0; size < sizeof(battleMon); size++)
|
||||||
dst[size] = src[size];
|
dst[size] = src[size];
|
||||||
|
#if TESTING
|
||||||
|
if (gTestRunnerEnabled)
|
||||||
|
{
|
||||||
|
u32 side = GetBattlerSide(battler);
|
||||||
|
u32 partyIndex = gBattlerPartyIndexes[battler];
|
||||||
|
if (TestRunner_Battle_GetForcedAbility(side, partyIndex))
|
||||||
|
gBattleMons[battler].ability = gBattleStruct->overwrittenAbilities[battler] = TestRunner_Battle_GetForcedAbility(side, partyIndex);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case REQUEST_SPECIES_BATTLE:
|
case REQUEST_SPECIES_BATTLE:
|
||||||
data16 = GetMonData(&party[monId], MON_DATA_SPECIES);
|
data16 = GetMonData(&party[monId], MON_DATA_SPECIES);
|
||||||
|
|
|
@ -3477,6 +3477,15 @@ static void DoBattleIntro(void)
|
||||||
gBattleMons[battler].status2 = 0;
|
gBattleMons[battler].status2 = 0;
|
||||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||||
gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE;
|
gBattleMons[battler].statStages[i] = DEFAULT_STAT_STAGE;
|
||||||
|
#if TESTING
|
||||||
|
if (gTestRunnerEnabled)
|
||||||
|
{
|
||||||
|
u32 side = GetBattlerSide(battler);
|
||||||
|
u32 partyIndex = gBattlerPartyIndexes[battler];
|
||||||
|
if (TestRunner_Battle_GetForcedAbility(side, partyIndex))
|
||||||
|
gBattleMons[battler].ability = gBattleStruct->overwrittenAbilities[battler] = TestRunner_Battle_GetForcedAbility(side, partyIndex);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw sprite.
|
// Draw sprite.
|
||||||
|
|
|
@ -6518,6 +6518,15 @@ static void Cmd_switchindataupdate(void)
|
||||||
gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1];
|
gBattleMons[battler].type2 = gSpeciesInfo[gBattleMons[battler].species].types[1];
|
||||||
gBattleMons[battler].type3 = TYPE_MYSTERY;
|
gBattleMons[battler].type3 = TYPE_MYSTERY;
|
||||||
gBattleMons[battler].ability = GetAbilityBySpecies(gBattleMons[battler].species, gBattleMons[battler].abilityNum);
|
gBattleMons[battler].ability = GetAbilityBySpecies(gBattleMons[battler].species, gBattleMons[battler].abilityNum);
|
||||||
|
#if TESTING
|
||||||
|
if (gTestRunnerEnabled)
|
||||||
|
{
|
||||||
|
u32 side = GetBattlerSide(battler);
|
||||||
|
u32 partyIndex = gBattlerPartyIndexes[battler];
|
||||||
|
if (TestRunner_Battle_GetForcedAbility(side, partyIndex))
|
||||||
|
gBattleMons[battler].ability = gBattleStruct->overwrittenAbilities[battler] = TestRunner_Battle_GetForcedAbility(side, partyIndex);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// check knocked off item
|
// check knocked off item
|
||||||
i = GetBattlerSide(battler);
|
i = GetBattlerSide(battler);
|
||||||
|
@ -13232,7 +13241,17 @@ static void Cmd_healpartystatus(void)
|
||||||
else if (isDoublesPartner)
|
else if (isDoublesPartner)
|
||||||
ability = GetBattlerAbility(partner);
|
ability = GetBattlerAbility(partner);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ability = GetAbilityBySpecies(species, abilityNum);
|
ability = GetAbilityBySpecies(species, abilityNum);
|
||||||
|
#if TESTING
|
||||||
|
if (gTestRunnerEnabled)
|
||||||
|
{
|
||||||
|
u32 side = GetBattlerSide(gBattlerAttacker);
|
||||||
|
if (TestRunner_Battle_GetForcedAbility(side, i))
|
||||||
|
ability = TestRunner_Battle_GetForcedAbility(side, i);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (ability != ABILITY_SOUNDPROOF)
|
if (ability != ABILITY_SOUNDPROOF)
|
||||||
toHeal |= (1 << i);
|
toHeal |= (1 << i);
|
||||||
|
|
27
test/battle/test_runner_features.c
Normal file
27
test/battle/test_runner_features.c
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#include "global.h"
|
||||||
|
#include "test/battle.h"
|
||||||
|
|
||||||
|
ASSUMPTIONS {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < NUM_ABILITY_SLOTS; i++) {
|
||||||
|
ASSUME(gSpeciesInfo[SPECIES_KADABRA].abilities[i] != ABILITY_QUARK_DRIVE);
|
||||||
|
ASSUME(gSpeciesInfo[SPECIES_ALAKAZAM].abilities[i] != ABILITY_ELECTRIC_SURGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Forced abilities activate on switch-in")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_ALAKAZAM);
|
||||||
|
PLAYER(SPECIES_KADABRA) { Ability(ABILITY_QUARK_DRIVE); SpAttack(400);}
|
||||||
|
OPPONENT(SPECIES_ARON);
|
||||||
|
OPPONENT(SPECIES_ALAKAZAM) { Ability(ABILITY_ELECTRIC_SURGE); };
|
||||||
|
} WHEN {
|
||||||
|
TURN { SWITCH(player, 1); SWITCH(opponent, 1);}
|
||||||
|
} SCENE {
|
||||||
|
ABILITY_POPUP(opponent, ABILITY_ELECTRIC_SURGE);
|
||||||
|
ABILITY_POPUP(player, ABILITY_QUARK_DRIVE);
|
||||||
|
MESSAGE("The Electric Terrain activated Kadabra's Quark Drive!");
|
||||||
|
MESSAGE("Kadabra's Sp. Atk was heightened!");
|
||||||
|
}
|
||||||
|
}
|
|
@ -1624,6 +1624,7 @@ void Ability_(u32 sourceLine, u32 ability)
|
||||||
u32 species;
|
u32 species;
|
||||||
const struct SpeciesInfo *info;
|
const struct SpeciesInfo *info;
|
||||||
INVALID_IF(!DATA.currentMon, "Ability outside of PLAYER/OPPONENT");
|
INVALID_IF(!DATA.currentMon, "Ability outside of PLAYER/OPPONENT");
|
||||||
|
INVALID_IF(ability >= ABILITIES_COUNT, "Illegal ability id: %d", ability);
|
||||||
species = GetMonData(DATA.currentMon, MON_DATA_SPECIES);
|
species = GetMonData(DATA.currentMon, MON_DATA_SPECIES);
|
||||||
info = &gSpeciesInfo[species];
|
info = &gSpeciesInfo[species];
|
||||||
for (i = 0; i < NUM_ABILITY_SLOTS; i++)
|
for (i = 0; i < NUM_ABILITY_SLOTS; i++)
|
||||||
|
|
Loading…
Reference in a new issue