mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 22:03:53 +01:00
Fixed Grassy Terrain not healing + Added To-Do test results (#2857)
This commit is contained in:
commit
d2d2e05a62
@ -2127,15 +2127,22 @@ enum
|
|||||||
ENDTURN_FIELD_COUNT,
|
ENDTURN_FIELD_COUNT,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool32 TryEndTerrain(u32 terrainFlag, u32 stringTableId)
|
static bool32 EndTurnTerrain(u32 terrainFlag, u32 stringTableId)
|
||||||
{
|
{
|
||||||
if (gFieldStatuses & terrainFlag
|
if (gFieldStatuses & terrainFlag)
|
||||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.terrainTimer == 0))
|
|
||||||
{
|
{
|
||||||
gFieldStatuses &= ~terrainFlag;
|
if (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.terrainTimer == 0)
|
||||||
TryToRevertMimicry();
|
{
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = stringTableId;
|
gFieldStatuses &= ~terrainFlag;
|
||||||
BattleScriptExecute(BattleScript_TerrainEnds);
|
TryToRevertMimicry();
|
||||||
|
if (!(terrainFlag & STATUS_FIELD_GRASSY_TERRAIN))
|
||||||
|
{
|
||||||
|
gBattleCommunication[MULTISTRING_CHOOSER] = stringTableId;
|
||||||
|
BattleScriptExecute(BattleScript_TerrainEnds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (terrainFlag & STATUS_FIELD_GRASSY_TERRAIN)
|
||||||
|
BattleScriptExecute(BattleScript_GrassyTerrainHeals);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -2492,19 +2499,19 @@ u8 DoFieldEndTurnEffects(void)
|
|||||||
gBattleStruct->turnCountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
break;
|
break;
|
||||||
case ENDTURN_ELECTRIC_TERRAIN:
|
case ENDTURN_ELECTRIC_TERRAIN:
|
||||||
effect = TryEndTerrain(STATUS_FIELD_ELECTRIC_TERRAIN, B_MSG_TERRAINENDS_ELECTRIC);
|
effect = EndTurnTerrain(STATUS_FIELD_ELECTRIC_TERRAIN, B_MSG_TERRAINENDS_ELECTRIC);
|
||||||
gBattleStruct->turnCountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
break;
|
break;
|
||||||
case ENDTURN_MISTY_TERRAIN:
|
case ENDTURN_MISTY_TERRAIN:
|
||||||
effect = TryEndTerrain(STATUS_FIELD_MISTY_TERRAIN, B_MSG_TERRAINENDS_MISTY);
|
effect = EndTurnTerrain(STATUS_FIELD_MISTY_TERRAIN, B_MSG_TERRAINENDS_MISTY);
|
||||||
gBattleStruct->turnCountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
break;
|
break;
|
||||||
case ENDTURN_GRASSY_TERRAIN:
|
case ENDTURN_GRASSY_TERRAIN:
|
||||||
effect = TryEndTerrain(STATUS_FIELD_GRASSY_TERRAIN, B_MSG_TERRAINENDS_GRASS);
|
effect = EndTurnTerrain(STATUS_FIELD_GRASSY_TERRAIN, B_MSG_TERRAINENDS_GRASS);
|
||||||
gBattleStruct->turnCountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
break;
|
break;
|
||||||
case ENDTURN_PSYCHIC_TERRAIN:
|
case ENDTURN_PSYCHIC_TERRAIN:
|
||||||
effect = TryEndTerrain(STATUS_FIELD_PSYCHIC_TERRAIN, B_MSG_TERRAINENDS_PSYCHIC);
|
effect = EndTurnTerrain(STATUS_FIELD_PSYCHIC_TERRAIN, B_MSG_TERRAINENDS_PSYCHIC);
|
||||||
gBattleStruct->turnCountersTracker++;
|
gBattleStruct->turnCountersTracker++;
|
||||||
break;
|
break;
|
||||||
case ENDTURN_WATER_SPORT:
|
case ENDTURN_WATER_SPORT:
|
||||||
|
19
test/terrain_grassy.c
Normal file
19
test/terrain_grassy.c
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "test_battle.h"
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Grassy Terrain recovers 1/16th HP at end of turn")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { MaxHP(100); HP(1); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_GRASSY_TERRAIN); }
|
||||||
|
} SCENE {
|
||||||
|
s32 maxHP = GetMonData(&PLAYER_PARTY[0], MON_DATA_MAX_HP);
|
||||||
|
MESSAGE("Wobbuffet is healed by the grassy terrain!");
|
||||||
|
HP_BAR(player, damage: -maxHP / 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TO_DO_BATTLE_TEST("Grassy Terrain increases power of Grass-type moves by 30/50 percent")
|
||||||
|
TO_DO_BATTLE_TEST("Grassy Terrain decreases power of Earthquake, Magnitude and Bulldoze by 50 percent")
|
@ -13,6 +13,7 @@ enum TestResult
|
|||||||
TEST_RESULT_INVALID,
|
TEST_RESULT_INVALID,
|
||||||
TEST_RESULT_ERROR,
|
TEST_RESULT_ERROR,
|
||||||
TEST_RESULT_TIMEOUT,
|
TEST_RESULT_TIMEOUT,
|
||||||
|
TEST_RESULT_TODO,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TestRunner
|
struct TestRunner
|
||||||
@ -161,4 +162,10 @@ s32 MgbaPrintf_(const char *fmt, ...);
|
|||||||
|
|
||||||
#define PARAMETRIZE if (gFunctionTestRunnerState->parameters++ == gFunctionTestRunnerState->runParameter)
|
#define PARAMETRIZE if (gFunctionTestRunnerState->parameters++ == gFunctionTestRunnerState->runParameter)
|
||||||
|
|
||||||
|
#define TO_DO \
|
||||||
|
Test_ExpectedResult(TEST_RESULT_TODO)
|
||||||
|
|
||||||
|
#define EXPECT_TO_DO \
|
||||||
|
Test_ExitWithResult(TEST_RESULT_TODO, "%s:%d: EXPECT_TO_DO", gTestRunnerState.test->filename, __LINE__)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -634,6 +634,15 @@ extern struct BattleTestRunnerState *gBattleTestRunnerState;
|
|||||||
|
|
||||||
/* Test */
|
/* Test */
|
||||||
|
|
||||||
|
#define TO_DO_BATTLE_TEST(_name) \
|
||||||
|
SINGLE_BATTLE_TEST("TODO: " _name) \
|
||||||
|
{ \
|
||||||
|
TO_DO; \
|
||||||
|
GIVEN { PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } \
|
||||||
|
WHEN { TURN { } } \
|
||||||
|
THEN { EXPECT_TO_DO; } \
|
||||||
|
}
|
||||||
|
|
||||||
#define SINGLE_BATTLE_TEST(_name, ...) \
|
#define SINGLE_BATTLE_TEST(_name, ...) \
|
||||||
struct CAT(Result, __LINE__) { MEMBERS(__VA_ARGS__) }; \
|
struct CAT(Result, __LINE__) { MEMBERS(__VA_ARGS__) }; \
|
||||||
static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *, u32, struct BattlePokemon *, struct BattlePokemon *); \
|
static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *, u32, struct BattlePokemon *, struct BattlePokemon *); \
|
||||||
|
@ -195,6 +195,10 @@ void CB2_TestRunner(void)
|
|||||||
result = "ASSUMPTION_FAIL";
|
result = "ASSUMPTION_FAIL";
|
||||||
color = "\e[33m";
|
color = "\e[33m";
|
||||||
break;
|
break;
|
||||||
|
case TEST_RESULT_TODO:
|
||||||
|
result = "TO_DO";
|
||||||
|
color = "\e[33m";
|
||||||
|
break;
|
||||||
case TEST_RESULT_INVALID:
|
case TEST_RESULT_INVALID:
|
||||||
result = "INVALID";
|
result = "INVALID";
|
||||||
break;
|
break;
|
||||||
@ -213,6 +217,8 @@ void CB2_TestRunner(void)
|
|||||||
MgbaPrintf_(":P%s%s\e[0m", color, result);
|
MgbaPrintf_(":P%s%s\e[0m", color, result);
|
||||||
else if (gTestRunnerState.result == TEST_RESULT_ASSUMPTION_FAIL)
|
else if (gTestRunnerState.result == TEST_RESULT_ASSUMPTION_FAIL)
|
||||||
MgbaPrintf_(":A%s%s\e[0m", color, result);
|
MgbaPrintf_(":A%s%s\e[0m", color, result);
|
||||||
|
else if (gTestRunnerState.result == TEST_RESULT_TODO)
|
||||||
|
MgbaPrintf_(":T%s%s\e[0m", color, result);
|
||||||
else if (gTestRunnerState.expectedResult == gTestRunnerState.result)
|
else if (gTestRunnerState.expectedResult == gTestRunnerState.result)
|
||||||
MgbaPrintf_(":K%s%s\e[0m", color, result);
|
MgbaPrintf_(":K%s%s\e[0m", color, result);
|
||||||
else
|
else
|
||||||
|
@ -44,6 +44,7 @@ struct Runner
|
|||||||
char *output_buffer;
|
char *output_buffer;
|
||||||
int passes;
|
int passes;
|
||||||
int knownFails;
|
int knownFails;
|
||||||
|
int todos;
|
||||||
int assumptionFails;
|
int assumptionFails;
|
||||||
int fails;
|
int fails;
|
||||||
int results;
|
int results;
|
||||||
@ -87,6 +88,9 @@ static void handle_read(struct Runner *runner)
|
|||||||
case 'K':
|
case 'K':
|
||||||
runner->knownFails++;
|
runner->knownFails++;
|
||||||
goto add_to_results;
|
goto add_to_results;
|
||||||
|
case 'T':
|
||||||
|
runner->todos++;
|
||||||
|
goto add_to_results;
|
||||||
case 'A':
|
case 'A':
|
||||||
runner->assumptionFails++;
|
runner->assumptionFails++;
|
||||||
goto add_to_results;
|
goto add_to_results;
|
||||||
@ -427,6 +431,7 @@ int main(int argc, char *argv[])
|
|||||||
int exit_code = 0;
|
int exit_code = 0;
|
||||||
int passes = 0;
|
int passes = 0;
|
||||||
int knownFails = 0;
|
int knownFails = 0;
|
||||||
|
int todos = 0;
|
||||||
int assumptionFails = 0;
|
int assumptionFails = 0;
|
||||||
int fails = 0;
|
int fails = 0;
|
||||||
int results = 0;
|
int results = 0;
|
||||||
@ -444,6 +449,7 @@ int main(int argc, char *argv[])
|
|||||||
exit_code = WEXITSTATUS(wstatus);
|
exit_code = WEXITSTATUS(wstatus);
|
||||||
passes += runners[i].passes;
|
passes += runners[i].passes;
|
||||||
knownFails += runners[i].knownFails;
|
knownFails += runners[i].knownFails;
|
||||||
|
todos += runners[i].todos;
|
||||||
assumptionFails += runners[i].assumptionFails;
|
assumptionFails += runners[i].assumptionFails;
|
||||||
fails += runners[i].fails;
|
fails += runners[i].fails;
|
||||||
results += runners[i].results;
|
results += runners[i].results;
|
||||||
@ -459,6 +465,8 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stdout, "- Tests \e[32mPASSED\e[0m: %d\n", passes);
|
fprintf(stdout, "- Tests \e[32mPASSED\e[0m: %d\n", passes);
|
||||||
if (knownFails > 0)
|
if (knownFails > 0)
|
||||||
fprintf(stdout, "- Tests \e[33mKNOWN_FAILING\e[0m: %d\n", knownFails);
|
fprintf(stdout, "- Tests \e[33mKNOWN_FAILING\e[0m: %d\n", knownFails);
|
||||||
|
if (todos > 0)
|
||||||
|
fprintf(stdout, "- Tests \e[33mTO_DO\e[0m: %d\n", todos);
|
||||||
if (fails > 0)
|
if (fails > 0)
|
||||||
fprintf(stdout, "- Tests \e[31mFAILED\e[0m : %d\n", fails);
|
fprintf(stdout, "- Tests \e[31mFAILED\e[0m : %d\n", fails);
|
||||||
if (assumptionFails > 0)
|
if (assumptionFails > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user