Add new field end turn effects

This commit is contained in:
DizzyEggg 2018-07-21 13:24:20 +02:00
parent 66a3c13f49
commit 6cffd5b045
5 changed files with 160 additions and 2 deletions

View File

@ -3237,6 +3237,51 @@ BattleScript_TailwindEnds::
printstring STRINGID_TAILWINDENDS
waitmessage 0x40
end2
BattleScript_TrickRoomEnds::
printstring STRINGID_TRICKROOMENDS
waitmessage 0x40
end2
BattleScript_WonderRoomEnds::
printstring STRINGID_WONDERROOMENDS
waitmessage 0x40
end2
BattleScript_MagicRoomEnds::
printstring STRINGID_MAGICROOMENDS
waitmessage 0x40
end2
BattleScript_ElectricTerrainEnds::
printstring STRINGID_ELECTRICTERRAINENDS
waitmessage 0x40
end2
BattleScript_MistyTerrainEnds::
printstring STRINGID_MISTYTERRAINENDS
waitmessage 0x40
end2
BattleScript_GrassyTerrainEnds::
printstring STRINGID_GRASSYTERRAINENDS
waitmessage 0x40
end2
BattleScript_PsychicTerrainEnds::
printstring STRINGID_PSYCHICTERRAINENDS
waitmessage 0x40
end2
BattleScript_MudSportEnds::
printstring STRINGID_MUDSPORTENDS
waitmessage 0x40
end2
BattleScript_WaterSportEnds::
printstring STRINGID_WATERSPORTENDS
waitmessage 0x40
end2
BattleScript_SafeguardProtected::
pause 0x20

View File

@ -294,5 +294,14 @@ extern const u8 BattleScript_AquaRingHeal[];
extern const u8 BattleScript_AuroraVeilEnds[];
extern const u8 BattleScript_LuckyChantEnds[];
extern const u8 BattleScript_TailwindEnds[];
extern const u8 BattleScript_TrickRoomEnds[];
extern const u8 BattleScript_WonderRoomEnds[];
extern const u8 BattleScript_MagicRoomEnds[];
extern const u8 BattleScript_ElectricTerrainEnds[];
extern const u8 BattleScript_MistyTerrainEnds[];
extern const u8 BattleScript_GrassyTerrainEnds[];
extern const u8 BattleScript_PsychicTerrainEnds[];
extern const u8 BattleScript_MudSportEnds[];
extern const u8 BattleScript_WaterSportEnds[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -446,7 +446,11 @@
#define STRINGID_GRAVITYENDS 443
#define STRINGID_AQUARINGHEAL 444
#define STRINGID_AURORAVEILENDS 445
#define STRINGID_ELECTRICTERRAINENDS 446
#define STRINGID_MISTYTERRAINENDS 447
#define STRINGID_PSYCHICTERRAINENDS 448
#define STRINGID_GRASSYTERRAINENDS 449
#define BATTLESTRINGS_COUNT 434
#define BATTLESTRINGS_COUNT 438
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H

View File

@ -589,6 +589,10 @@ static const u8 sText_AquaRingHeal[] = _("Aqua Ring restored\n{B_ATK_NAME_WITH_P
// These strings are currently placeholders, to be fixed.
static const u8 sText_AuroraVeilEnds[] = _("");
static const u8 sText_ElectricTerrainEnds[] = _("");
static const u8 sText_MistyTerrainEnds[] = _("");
static const u8 sText_PsychicTerrainEnds[] = _("");
static const u8 sText_GrassyTerrainEnds[] = _("");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
@ -1026,6 +1030,11 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
sText_WaterSportEnds, // 442
sText_GravityEnds, // 443
sText_AquaRingHeal, // 444
sText_AuroraVeilEnds, // 445
sText_ElectricTerrainEnds, // 446
sText_MistyTerrainEnds, // 447
sText_PsychicTerrainEnds, // 448
sText_GrassyTerrainEnds, // 449
};
const u16 gMissStringIds[] =

View File

@ -758,13 +758,21 @@ enum
ENDTURN_SANDSTORM,
ENDTURN_SUN,
ENDTURN_HAIL,
ENDTURN_WATER_SPORT,
ENDTURN_MUD_SPORT,
ENDTURN_TRICK_ROOM,
ENDTURN_WONDER_ROOM,
ENDTURN_MAGIC_ROOM,
ENDTURN_ELECTRIC_TERRAIN,
ENDTURN_MISTY_TERRAIN,
ENDTURN_GRASSY_TERRAIN,
ENDTURN_PSYCHIC_TERRAIN,
ENDTURN_FIELD_COUNT,
};
u8 DoFieldEndTurnEffects(void)
{
u8 effect = 0;
s32 i;
for (gBattlerAttacker = 0; gBattlerAttacker < gBattlersCount && gAbsentBattlerFlags & gBitTable[gBattlerAttacker]; gBattlerAttacker++)
{
@ -775,6 +783,7 @@ u8 DoFieldEndTurnEffects(void)
do
{
s32 i;
u8 side;
switch (gBattleStruct->turnCountersTracker)
@ -1077,11 +1086,93 @@ u8 DoFieldEndTurnEffects(void)
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_TRICK_ROOM:
if (gFieldStatuses & STATUS_FIELD_TRICK_ROOM && --gFieldTimers.trickRoomTimer == 0)
{
gFieldStatuses &= ~(STATUS_FIELD_TRICK_ROOM);
BattleScriptExecute(BattleScript_TrickRoomEnds);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_WONDER_ROOM:
if (gFieldStatuses & STATUS_FIELD_WONDER_ROOM && --gFieldTimers.wonderRoomTimer == 0)
{
gFieldStatuses &= ~(STATUS_FIELD_WONDER_ROOM);
BattleScriptExecute(BattleScript_WonderRoomEnds);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_MAGIC_ROOM:
if (gFieldStatuses & STATUS_FIELD_MAGIC_ROOM && --gFieldTimers.magicRoomTimer == 0)
{
gFieldStatuses &= ~(STATUS_FIELD_MAGIC_ROOM);
BattleScriptExecute(BattleScript_MagicRoomEnds);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_ELECTRIC_TERRAIN:
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && --gFieldTimers.electricTerrainTimer == 0)
{
gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN);
BattleScriptExecute(BattleScript_ElectricTerrainEnds);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_MISTY_TERRAIN:
if (gFieldStatuses & STATUS_FIELD_MISTY_TERRAIN && --gFieldTimers.mistyTerrainTimer == 0)
{
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN);
BattleScriptExecute(BattleScript_MistyTerrainEnds);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_GRASSY_TERRAIN:
if (gFieldStatuses & STATUS_FIELD_GRASSY_TERRAIN && --gFieldTimers.grassyTerrainTimer == 0)
{
gFieldStatuses &= ~(STATUS_FIELD_GRASSY_TERRAIN);
BattleScriptExecute(BattleScript_GrassyTerrainEnds);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_PSYCHIC_TERRAIN:
if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN && --gFieldTimers.psychicTerrainTimer == 0)
{
gFieldStatuses &= ~(STATUS_FIELD_PSYCHIC_TERRAIN);
BattleScriptExecute(BattleScript_PsychicTerrainEnds);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_WATER_SPORT:
if (gFieldStatuses & STATUS_FIELD_WATERSPORT && --gFieldTimers.waterSportTimer == 0)
{
gFieldStatuses &= ~(STATUS_FIELD_WATERSPORT);
BattleScriptExecute(BattleScript_WaterSportEnds);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_MUD_SPORT:
if (gFieldStatuses & STATUS_FIELD_MUDSPORT && --gFieldTimers.mudSportTimer == 0)
{
gFieldStatuses &= ~(STATUS_FIELD_MUDSPORT);
BattleScriptExecute(BattleScript_MudSportEnds);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_FIELD_COUNT:
effect++;
break;
}
} while (effect == 0);
return (gBattleMainFunc != BattleTurnPassed);
}