Draft Change

This commit is contained in:
AlexOn1ine 2024-12-25 11:03:32 +01:00
parent 573200d56a
commit 9c34634dd6
5 changed files with 240 additions and 152 deletions

View File

@ -5841,8 +5841,26 @@ BattleScript_LearnedNewMove::
BattleScript_LearnMoveReturn::
return
@@@ === NEW WEATHER SCRIPT
BattleScript_WeatherContinues::
printfromtable gWeatherTurnStringIds
waitmessage B_WAIT_TIME_LONG
playanimation_var BS_ATTACKER, sB_ANIM_ARG1
setbyte gBattleCommunication, 0
call BattleScript_ActivateWeatherAbilities
end2
BattleScript_WeatherFaded::
printfromtable gWeatherEndsStringIds
waitmessage B_WAIT_TIME_LONG
call BattleScript_ActivateWeatherAbilities
end2
@@@ === NEW WEATHER SCRIPT
BattleScript_RainContinuesOrEnds::
printfromtable gRainContinuesStringIds
@printfromtable gRainContinuesStringIds
waitmessage B_WAIT_TIME_LONG
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_RAIN_STOPPED, BattleScript_RainContinuesOrEndsEnd
playanimation BS_ATTACKER, B_ANIM_RAIN_CONTINUES
@ -5851,14 +5869,14 @@ BattleScript_RainContinuesOrEndsEnd::
end2
BattleScript_DamagingWeatherContinues::
printfromtable gSandStormHailSnowContinuesStringIds
@printfromtable gSandStormHailSnowContinuesStringIds
waitmessage B_WAIT_TIME_LONG
playanimation_var BS_ATTACKER, sB_ANIM_ARG1
setbyte gBattleCommunication, 0
end2
BattleScript_DamagingWeather::
printfromtable gSandStormHailDmgStringIds
@printfromtable gSandStormHailDmgStringIds
waitmessage B_WAIT_TIME_LONG
effectivenesssound
hitanimation BS_SCRIPTING
@ -5874,7 +5892,7 @@ BattleScript_IceBodyHeal::
end2
BattleScript_SandStormHailSnowEnds::
printfromtable gSandStormHailSnowEndStringIds
@printfromtable gSandStormHailSnowEndStringIds
waitmessage B_WAIT_TIME_LONG
call BattleScript_ActivateWeatherAbilities
end2

View File

@ -50,6 +50,10 @@ extern const u8 BattleScript_DoSwitchOut[];
extern const u8 BattleScript_MoveSwitchOpenPartyScreen[];
extern const u8 BattleScript_Pausex20[];
extern const u8 BattleScript_LevelUp[];
extern const u8 BattleScript_WeatherContinues[];
extern const u8 BattleScript_WeatherFaded[];
extern const u8 BattleScript_RainContinuesOrEnds[];
extern const u8 BattleScript_SnowContinuesOrEnds[];
extern const u8 BattleScript_DamagingWeatherContinues[];

View File

@ -784,14 +784,25 @@
// gWeatherEndsStringIds
#define B_MSG_WEATHER_END_RAIN 0
#define B_MSG_WEATHER_END_SANDSTORM 1
#define B_MSG_WEATHER_END_SUN 2
#define B_MSG_WEATHER_END_SUN 1
#define B_MSG_WEATHER_END_SANDSTORM 2
#define B_MSG_WEATHER_END_HAIL 3
#define B_MSG_WEATHER_END_STRONG_WINDS 4
#define B_MSG_WEATHER_END_SNOW 5
#define B_MSG_WEATHER_END_FOG 6
#define B_MSG_WEATHER_END_SNOW 4
#define B_MSG_WEATHER_END_FOG 5
#define B_MSG_WEATHER_END_STRONG_WINDS 6
#define B_MSG_WEATHER_END_COUNT 7
// gWeatherTurnStringIds
#define B_MSG_WEATHER_TURN_RAIN 0
#define B_MSG_WEATHER_TURN_DOWNPOUR 1
#define B_MSG_WEATHER_TURN_SUN 2
#define B_MSG_WEATHER_TURN_SANDSTORM 3
#define B_MSG_WEATHER_TURN_HAIL 4
#define B_MSG_WEATHER_TURN_SNOW 5
#define B_MSG_WEATHER_TURN_FOG 6
#define B_MSG_WEATHER_TURN_STRONG_WINDS 7
#define B_MSG_WEATHER_TURN_COUNT 8
// gRainContinuesStringIds
#define B_MSG_RAIN_CONTINUES 0
#define B_MSG_DOWNPOUR_CONTINUES 1

View File

@ -1013,20 +1013,25 @@ const u16 gMoveWeatherChangeStringIds[] =
const u16 gWeatherEndsStringIds[B_MSG_WEATHER_END_COUNT] =
{
[B_MSG_WEATHER_END_RAIN] = STRINGID_RAINSTOPPED,
[B_MSG_WEATHER_END_SANDSTORM] = STRINGID_SANDSTORMSUBSIDED,
[B_MSG_WEATHER_END_SUN] = STRINGID_SUNLIGHTFADED,
[B_MSG_WEATHER_END_HAIL] = STRINGID_HAILSTOPPED,
[B_MSG_WEATHER_END_RAIN] = STRINGID_RAINSTOPPED,
[B_MSG_WEATHER_END_SUN] = STRINGID_SUNLIGHTFADED,
[B_MSG_WEATHER_END_SANDSTORM] = STRINGID_SANDSTORMSUBSIDED,
[B_MSG_WEATHER_END_HAIL] = STRINGID_HAILSTOPPED,
[B_MSG_WEATHER_END_SNOW] = STRINGID_SNOWSTOPPED,
[B_MSG_WEATHER_END_FOG] = STRINGID_FOGLIFTED,
[B_MSG_WEATHER_END_STRONG_WINDS] = STRINGID_STRONGWINDSDISSIPATED,
[B_MSG_WEATHER_END_SNOW] = STRINGID_SNOWSTOPPED,
[B_MSG_WEATHER_END_FOG] = STRINGID_FOGLIFTED,
};
const u16 gSandStormHailSnowContinuesStringIds[] =
const u16 gWeatherTurnStringIds[] =
{
[B_MSG_SANDSTORM] = STRINGID_SANDSTORMRAGES,
[B_MSG_HAIL] = STRINGID_HAILCONTINUES,
[B_MSG_SNOW] = STRINGID_SNOWCONTINUES,
[B_MSG_WEATHER_TURN_RAIN] = STRINGID_RAINCONTINUES,
[B_MSG_WEATHER_TURN_DOWNPOUR] = STRINGID_DOWNPOURCONTINUES,
[B_MSG_WEATHER_TURN_SUN] = STRINGID_SUNLIGHTSTRONG,
[B_MSG_WEATHER_TURN_SANDSTORM] = STRINGID_SANDSTORMRAGES,
[B_MSG_WEATHER_TURN_HAIL] = STRINGID_HAILCONTINUES,
[B_MSG_WEATHER_TURN_SNOW] = STRINGID_SNOWCONTINUES,
[B_MSG_WEATHER_TURN_FOG] = STRINGID_FOGISDEEP,
[B_MSG_WEATHER_TURN_STRONG_WINDS] = STRINGID_MYSTERIOUSAIRCURRENTBLOWSON,
};
const u16 gSandStormHailDmgStringIds[] =
@ -1035,20 +1040,6 @@ const u16 gSandStormHailDmgStringIds[] =
[B_MSG_HAIL] = STRINGID_PKMNPELTEDBYHAIL
};
const u16 gSandStormHailSnowEndStringIds[] =
{
[B_MSG_SANDSTORM] = STRINGID_SANDSTORMSUBSIDED,
[B_MSG_HAIL] = STRINGID_HAILSTOPPED,
[B_MSG_SNOW] = STRINGID_SNOWSTOPPED,
};
const u16 gRainContinuesStringIds[] =
{
[B_MSG_RAIN_CONTINUES] = STRINGID_RAINCONTINUES,
[B_MSG_DOWNPOUR_CONTINUES] = STRINGID_DOWNPOURCONTINUES,
[B_MSG_RAIN_STOPPED] = STRINGID_RAINSTOPPED
};
const u16 gProtectLikeUsedStringIds[] =
{
[B_MSG_PROTECTED_ITSELF] = STRINGID_PKMNPROTECTEDITSELF2,

View File

@ -1520,12 +1520,13 @@ enum
ENDTURN_SAFEGUARD,
ENDTURN_TAILWIND,
ENDTURN_WISH,
ENDTURN_RAIN,
ENDTURN_SANDSTORM,
ENDTURN_SUN,
ENDTURN_HAIL,
ENDTURN_SNOW,
ENDTURN_FOG,
ENDTURN_WEATHER,
// ENDTURN_RAIN,
// ENDTURN_SANDSTORM,
// ENDTURN_SUN,
// ENDTURN_HAIL,
// ENDTURN_SNOW,
// ENDTURN_FOG,
ENDTURN_DAMAGE_NON_TYPES,
ENDTURN_GRAVITY,
ENDTURN_WATER_SPORT,
@ -1567,6 +1568,65 @@ static bool32 EndTurnTerrain(u32 terrainFlag, u32 stringTableId)
return FALSE;
}
#define BATTLE_WEATHER_MESSAGE_STOPPED 0
#define BATTLE_WEATHER_MESSAGE_TURN 1
#define BATTLE_WEATHER_ANIMATION 2
static const u32 sBattleWeatherAttributes[][3] =
{
// Type of Weather // End Message // Weather Continues // Weather Animation
[BATTLE_WEATHER_RAIN] = {B_MSG_WEATHER_END_RAIN, B_MSG_WEATHER_TURN_RAIN, B_ANIM_RAIN_CONTINUES},
[BATTLE_WEATHER_RAIN_DOWNPOUR] = {B_MSG_WEATHER_END_RAIN, B_MSG_WEATHER_TURN_DOWNPOUR, B_ANIM_RAIN_CONTINUES},
[BATTLE_WEATHER_SUN] = {B_MSG_WEATHER_END_SUN, B_MSG_WEATHER_TURN_SUN, B_ANIM_SUN_CONTINUES},
[BATTLE_WEATHER_SANDSTORM] = {B_MSG_WEATHER_END_SANDSTORM, B_MSG_WEATHER_TURN_SANDSTORM, B_ANIM_SANDSTORM_CONTINUES},
[BATTLE_WEATHER_HAIL] = {B_MSG_WEATHER_END_HAIL, B_MSG_WEATHER_TURN_HAIL, B_ANIM_HAIL_CONTINUES},
[BATTLE_WEATHER_SNOW] = {B_MSG_WEATHER_END_SNOW, B_MSG_WEATHER_TURN_SNOW, B_ANIM_SNOW_CONTINUES},
[BATTLE_WEATHER_FOG] = {B_MSG_WEATHER_END_FOG, B_MSG_WEATHER_TURN_FOG, B_ANIM_FOG_CONTINUES},
[BATTLE_WEATHER_STRONG_WINDS] = {B_MSG_WEATHER_END_STRONG_WINDS, B_MSG_WEATHER_TURN_STRONG_WINDS, B_ANIM_STRONG_WINDS},
};
static bool32 TryEndTurnWeather(void)
{
u32 effect = 0;
u32 currBattleWeather = 0xFF;
if (gBattleWeather & B_WEATHER_RAIN) currBattleWeather = BATTLE_WEATHER_RAIN;
else if (gBattleWeather & B_WEATHER_SUN) currBattleWeather = BATTLE_WEATHER_SUN;
else if (gBattleWeather & B_WEATHER_SANDSTORM) currBattleWeather = BATTLE_WEATHER_SANDSTORM;
else if (gBattleWeather & B_WEATHER_HAIL) currBattleWeather = BATTLE_WEATHER_HAIL;
else if (gBattleWeather & B_WEATHER_SNOW) currBattleWeather = BATTLE_WEATHER_SNOW;
else if (gBattleWeather & B_WEATHER_FOG) currBattleWeather = BATTLE_WEATHER_FOG;
else if (gBattleWeather & B_WEATHER_STRONG_WINDS) currBattleWeather = BATTLE_WEATHER_STRONG_WINDS;
if (currBattleWeather == 0xFF)
return effect;
if (gBattleWeather & B_WEATHER_PRIMAL_ANY) // Might be redundant. handled in else case?
{
gBattleCommunication[MULTISTRING_CHOOSER] = sBattleWeatherAttributes[currBattleWeather][BATTLE_WEATHER_MESSAGE_TURN];
gBattleScripting.animArg1 = sBattleWeatherAttributes[currBattleWeather][BATTLE_WEATHER_ANIMATION];
BattleScriptExecute(BattleScript_WeatherContinues);
effect++;
}
else if (gWishFutureKnock.weatherDuration > 0 && --gWishFutureKnock.weatherDuration == 0)
{
gBattleCommunication[MULTISTRING_CHOOSER] = sBattleWeatherAttributes[currBattleWeather][BATTLE_WEATHER_MESSAGE_STOPPED];
BattleScriptExecute(BattleScript_WeatherFaded);
effect++;
}
else
{
gBattleCommunication[MULTISTRING_CHOOSER] = sBattleWeatherAttributes[currBattleWeather][BATTLE_WEATHER_MESSAGE_TURN];
gBattleScripting.animArg1 = sBattleWeatherAttributes[currBattleWeather][BATTLE_WEATHER_ANIMATION];
BattleScriptExecute(BattleScript_WeatherContinues);
effect++;
}
return effect;
}
#undef BATTLE_WEATHER_MESSAGE_STOPPED
#undef BATTLE_WEATHER_MESSAGE_TURN
#undef BATTLE_WEATHER_ANIMATION
u8 DoFieldEndTurnEffects(void)
{
u8 effect = 0;
@ -1799,126 +1859,130 @@ u8 DoFieldEndTurnEffects(void)
gBattleStruct->turnSideTracker = 0;
}
break;
case ENDTURN_RAIN:
if (gBattleWeather & B_WEATHER_RAIN)
{
if (!(gBattleWeather & B_WEATHER_RAIN_PRIMAL)
&& gWishFutureKnock.weatherDuration > 0
&& --gWishFutureKnock.weatherDuration == 0)
{
gBattleWeather &= ~(B_WEATHER_RAIN | B_WEATHER_RAIN_DOWNPOUR);
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_STOPPED;
}
else if (gBattleWeather & B_WEATHER_RAIN_DOWNPOUR)
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOWNPOUR_CONTINUES;
else
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_CONTINUES;
BattleScriptExecute(BattleScript_RainContinuesOrEnds);
effect++;
}
case ENDTURN_WEATHER:
effect = TryEndTurnWeather();
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_SANDSTORM:
if (gBattleWeather & B_WEATHER_SANDSTORM)
{
if (gWishFutureKnock.weatherDuration > 0 && --gWishFutureKnock.weatherDuration == 0)
{
gBattleWeather &= ~B_WEATHER_SANDSTORM;
gBattlescriptCurrInstr = BattleScript_SandStormHailSnowEnds;
}
else
{
gBattlescriptCurrInstr = BattleScript_DamagingWeatherContinues;
}
// case ENDTURN_RAIN:
// if (gBattleWeather & B_WEATHER_RAIN)
// {
// if (!(gBattleWeather & B_WEATHER_RAIN_PRIMAL)
// && gWishFutureKnock.weatherDuration > 0
// && --gWishFutureKnock.weatherDuration == 0)
// {
// gBattleWeather &= ~(B_WEATHER_RAIN | B_WEATHER_RAIN_DOWNPOUR);
// gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_STOPPED;
// }
// else if (gBattleWeather & B_WEATHER_RAIN_DOWNPOUR)
// gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_DOWNPOUR_CONTINUES;
// else
// gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_RAIN_CONTINUES;
gBattleScripting.animArg1 = B_ANIM_SANDSTORM_CONTINUES;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SANDSTORM;
BattleScriptExecute(gBattlescriptCurrInstr);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_SUN:
if (gBattleWeather & B_WEATHER_SUN)
{
if (!(gBattleWeather & B_WEATHER_SUN_PRIMAL)
&& gWishFutureKnock.weatherDuration > 0
&& --gWishFutureKnock.weatherDuration == 0)
{
for (i = 0; i < gBattlersCount; i++)
gDisableStructs[i].weatherAbilityDone = FALSE;
gBattleWeather &= ~B_WEATHER_SUN;
gBattlescriptCurrInstr = BattleScript_SunlightFaded;
}
else
{
gBattlescriptCurrInstr = BattleScript_SunlightContinues;
}
// BattleScriptExecute(BattleScript_RainContinuesOrEnds);
// effect++;
// }
// gBattleStruct->turnCountersTracker++;
// break;
// case ENDTURN_SANDSTORM:
// if (gBattleWeather & B_WEATHER_SANDSTORM)
// {
// if (gWishFutureKnock.weatherDuration > 0 && --gWishFutureKnock.weatherDuration == 0)
// {
// gBattleWeather &= ~B_WEATHER_SANDSTORM;
// gBattlescriptCurrInstr = BattleScript_SandStormHailSnowEnds;
// }
// else
// {
// gBattlescriptCurrInstr = BattleScript_DamagingWeatherContinues;
// }
BattleScriptExecute(gBattlescriptCurrInstr);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_HAIL:
if (gBattleWeather & B_WEATHER_HAIL)
{
if (gWishFutureKnock.weatherDuration > 0 && --gWishFutureKnock.weatherDuration == 0)
{
gBattleWeather &= ~B_WEATHER_HAIL;
gBattlescriptCurrInstr = BattleScript_SandStormHailSnowEnds;
}
else
{
gBattlescriptCurrInstr = BattleScript_DamagingWeatherContinues;
}
// gBattleScripting.animArg1 = B_ANIM_SANDSTORM_CONTINUES;
// gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SANDSTORM;
// BattleScriptExecute(gBattlescriptCurrInstr);
// effect++;
// }
// gBattleStruct->turnCountersTracker++;
// break;
// case ENDTURN_SUN:
// if (gBattleWeather & B_WEATHER_SUN)
// {
// if (!(gBattleWeather & B_WEATHER_SUN_PRIMAL)
// && gWishFutureKnock.weatherDuration > 0
// && --gWishFutureKnock.weatherDuration == 0)
// {
// for (i = 0; i < gBattlersCount; i++)
// gDisableStructs[i].weatherAbilityDone = FALSE;
// gBattleWeather &= ~B_WEATHER_SUN;
// gBattlescriptCurrInstr = BattleScript_SunlightFaded;
// }
// else
// {
// gBattlescriptCurrInstr = BattleScript_SunlightContinues;
// }
gBattleScripting.animArg1 = B_ANIM_HAIL_CONTINUES;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_HAIL;
BattleScriptExecute(gBattlescriptCurrInstr);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_SNOW:
if (gBattleWeather & B_WEATHER_SNOW)
{
if (gWishFutureKnock.weatherDuration > 0 && --gWishFutureKnock.weatherDuration == 0)
{
gBattleWeather &= ~B_WEATHER_SNOW;
gBattlescriptCurrInstr = BattleScript_SandStormHailSnowEnds;
}
else
{
gBattlescriptCurrInstr = BattleScript_DamagingWeatherContinues;
}
// BattleScriptExecute(gBattlescriptCurrInstr);
// effect++;
// }
// gBattleStruct->turnCountersTracker++;
// break;
// case ENDTURN_HAIL:
// if (gBattleWeather & B_WEATHER_HAIL)
// {
// if (gWishFutureKnock.weatherDuration > 0 && --gWishFutureKnock.weatherDuration == 0)
// {
// gBattleWeather &= ~B_WEATHER_HAIL;
// gBattlescriptCurrInstr = BattleScript_SandStormHailSnowEnds;
// }
// else
// {
// gBattlescriptCurrInstr = BattleScript_DamagingWeatherContinues;
// }
gBattleScripting.animArg1 = B_ANIM_SNOW_CONTINUES;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SNOW;
BattleScriptExecute(gBattlescriptCurrInstr);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_FOG:
if (gBattleWeather & B_WEATHER_FOG)
{
if (gWishFutureKnock.weatherDuration > 0 && --gWishFutureKnock.weatherDuration == 0)
{
gBattleWeather &= ~B_WEATHER_FOG;
gBattlescriptCurrInstr = BattleScript_FogEnded;
}
else
{
gBattlescriptCurrInstr = BattleScript_FogContinues;
}
// gBattleScripting.animArg1 = B_ANIM_HAIL_CONTINUES;
// gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_HAIL;
// BattleScriptExecute(gBattlescriptCurrInstr);
// effect++;
// }
// gBattleStruct->turnCountersTracker++;
// break;
// case ENDTURN_SNOW:
// if (gBattleWeather & B_WEATHER_SNOW)
// {
// if (gWishFutureKnock.weatherDuration > 0 && --gWishFutureKnock.weatherDuration == 0)
// {
// gBattleWeather &= ~B_WEATHER_SNOW;
// gBattlescriptCurrInstr = BattleScript_SandStormHailSnowEnds;
// }
// else
// {
// gBattlescriptCurrInstr = BattleScript_DamagingWeatherContinues;
// }
BattleScriptExecute(gBattlescriptCurrInstr);
effect++;
}
gBattleStruct->turnCountersTracker++;
break;
// gBattleScripting.animArg1 = B_ANIM_SNOW_CONTINUES;
// gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SNOW;
// BattleScriptExecute(gBattlescriptCurrInstr);
// effect++;
// }
// gBattleStruct->turnCountersTracker++;
// break;
// case ENDTURN_FOG:
// if (gBattleWeather & B_WEATHER_FOG)
// {
// if (gWishFutureKnock.weatherDuration > 0 && --gWishFutureKnock.weatherDuration == 0)
// {
// gBattleWeather &= ~B_WEATHER_FOG;
// gBattlescriptCurrInstr = BattleScript_FogEnded;
// }
// else
// {
// gBattlescriptCurrInstr = BattleScript_FogContinues;
// }
// BattleScriptExecute(gBattlescriptCurrInstr);
// effect++;
// }
// gBattleStruct->turnCountersTracker++;
// break;
case ENDTURN_DAMAGE_NON_TYPES:
while (gBattleStruct->turnSideTracker < 2)
{