mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Fixed Grassy Terrain not healing
This commit is contained in:
parent
2658fe32c2
commit
1da65c4051
@ -2127,15 +2127,25 @@ enum
|
||||
ENDTURN_FIELD_COUNT,
|
||||
};
|
||||
|
||||
static bool32 TryEndTerrain(u32 terrainFlag, u32 stringTableId)
|
||||
static bool32 EndTurnTerrain(u32 terrainFlag, u32 stringTableId)
|
||||
{
|
||||
if (gFieldStatuses & terrainFlag
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.terrainTimer == 0))
|
||||
if (gFieldStatuses & terrainFlag)
|
||||
{
|
||||
if (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.terrainTimer == 0)
|
||||
{
|
||||
gFieldStatuses &= ~terrainFlag;
|
||||
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 FALSE;
|
||||
@ -2492,19 +2502,19 @@ u8 DoFieldEndTurnEffects(void)
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
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++;
|
||||
break;
|
||||
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++;
|
||||
break;
|
||||
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++;
|
||||
break;
|
||||
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++;
|
||||
break;
|
||||
case ENDTURN_WATER_SPORT:
|
||||
|
16
test/terrain_grassy.c
Normal file
16
test/terrain_grassy.c
Normal file
@ -0,0 +1,16 @@
|
||||
#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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user