Add Gen 2 Moonlight, Morning Sun, Synthesis configuration (#7209)

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
i0brendan0 2025-06-26 14:00:02 -05:00 committed by GitHub
parent 8bbb84fc96
commit 206d2503d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 92 additions and 10 deletions

View File

@ -130,6 +130,8 @@
#define B_PURSUIT_TARGET GEN_LATEST // In Gen4+, Pursuit attacks a switching opponent even if they weren't targeting them. Before Gen4, Pursuit only attacks a switching opponent that it originally targeted.
#define B_SKIP_RECHARGE GEN_LATEST // In Gen1, recharging moves such as Hyper Beam skip the recharge if the target gets KO'd
#define B_ENCORE_TARGET GEN_LATEST // In Gen5+, encored moves are allowed to choose a target
#define B_TIME_OF_DAY_HEALING_MOVES GEN_LATEST // In Gen2, Morning Sun, Moonlight, and Synthesis heal twice as much HP based off the time of day. Also changes how much they heal. Evening affects Moonlight.
// If OW_TIMES_OF_DAY is set to Gen 3, then Morning Sun is boosted during the day.
// Ability settings
#define B_GALE_WINGS GEN_LATEST // In Gen7+ requires full HP to trigger.

View File

@ -19,6 +19,7 @@ enum GenConfigTag
GEN_CONFIG_FELL_STINGER_STAT_RAISE,
GEN_CONFIG_DEFIANT_STICKY_WEB,
GEN_CONFIG_ENCORE_TARGET,
GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES,
GEN_CONFIG_COUNT
};

View File

@ -22,6 +22,7 @@ static const u8 sGenerationalChanges[GEN_CONFIG_COUNT] =
[GEN_CONFIG_FELL_STINGER_STAT_RAISE] = B_FELL_STINGER_STAT_RAISE,
[GEN_CONFIG_DEFIANT_STICKY_WEB] = B_DEFIANT_STICKY_WEB,
[GEN_CONFIG_ENCORE_TARGET] = B_ENCORE_TARGET,
[GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES] = B_TIME_OF_DAY_HEALING_MOVES,
};
#if TESTING

View File

@ -14316,7 +14316,7 @@ static void Cmd_recoverbasedonsunlight(void)
else
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerAttacker) / 2;
}
else
else if (GetGenConfig(GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES) != GEN_2)
{
if (!(gBattleWeather & B_WEATHER_ANY) || !HasWeatherEffect() || GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_UTILITY_UMBRELLA)
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerAttacker) / 2;
@ -14325,6 +14325,39 @@ static void Cmd_recoverbasedonsunlight(void)
else // not sunny weather
gBattleStruct->moveDamage[gBattlerAttacker] = GetNonDynamaxMaxHP(gBattlerAttacker) / 4;
}
else // B_TIME_OF_DAY_HEALING_MOVES == GEN_2
{
u32 healingModifier = 1;
u32 time = GetTimeOfDay();
switch (GetMoveEffect(gCurrentMove))
{
case EFFECT_MOONLIGHT:
if (time == TIME_NIGHT || time == TIME_EVENING)
healingModifier = 2;
break;
case EFFECT_MORNING_SUN:
if ((OW_TIMES_OF_DAY == GEN_3 && time == TIME_DAY) // Gen 3 doesn't have morning
|| (OW_TIMES_OF_DAY != GEN_3 && time == TIME_MORNING))
healingModifier = 2;
break;
case EFFECT_SYNTHESIS:
if (time == TIME_DAY)
healingModifier = 2;
break;
default:
healingModifier = 1;
break;
}
if (!(gBattleWeather & B_WEATHER_ANY) || !HasWeatherEffect() || GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_UTILITY_UMBRELLA)
gBattleStruct->moveDamage[gBattlerAttacker] = healingModifier * GetNonDynamaxMaxHP(gBattlerAttacker) / 4;
else if (gBattleWeather & B_WEATHER_SUN)
gBattleStruct->moveDamage[gBattlerAttacker] = healingModifier * GetNonDynamaxMaxHP(gBattlerAttacker) / 2;
else // not sunny weather
gBattleStruct->moveDamage[gBattlerAttacker] = healingModifier * GetNonDynamaxMaxHP(gBattlerAttacker) / 8;
}
if (gBattleStruct->moveDamage[gBattlerAttacker] == 0)
gBattleStruct->moveDamage[gBattlerAttacker] = 1;

View File

@ -6,9 +6,10 @@ ASSUMPTIONS
ASSUME(GetMoveEffect(MOVE_MOONLIGHT) == EFFECT_MOONLIGHT);
}
SINGLE_BATTLE_TEST("Moonlight recovers 1/2 of the user's max HP")
SINGLE_BATTLE_TEST("Moonlight recovers 1/2 of the user's max HP (Gen3+)")
{
GIVEN {
WITH_CONFIG(GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES, GEN_3);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(200); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -18,9 +19,10 @@ SINGLE_BATTLE_TEST("Moonlight recovers 1/2 of the user's max HP")
}
}
SINGLE_BATTLE_TEST("Moonlight recovers 2/3 of the user's max HP in Sunlight")
SINGLE_BATTLE_TEST("Moonlight recovers 2/3 of the user's max HP in Sunlight (Gen3+)")
{
GIVEN {
WITH_CONFIG(GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES, GEN_3);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -30,7 +32,7 @@ SINGLE_BATTLE_TEST("Moonlight recovers 2/3 of the user's max HP in Sunlight")
}
}
SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in Rain, Sandstorm, Hail, and Snow")
SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in Rain, Sandstorm, Hail, and Snow (Gen3+)")
{
u32 move;
PARAMETRIZE { move = MOVE_RAIN_DANCE; }
@ -38,6 +40,7 @@ SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in Rain, Sandsto
PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN {
WITH_CONFIG(GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES, GEN_3);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -46,3 +49,15 @@ SINGLE_BATTLE_TEST("Moonlight recovers 1/4 of the user's max HP in Rain, Sandsto
HP_BAR(player, damage: -(400 / 4));
}
}
TO_DO_BATTLE_TEST("TODO: Moonlight recovers 1/4 of the user's max HP while it is not night or evening (Gen2)")
TO_DO_BATTLE_TEST("TODO: Moonlight recovers 1/2 of the user's max HP in Sunlight while it is not night or evening (Gen2)")
TO_DO_BATTLE_TEST("TODO: Moonlight recovers 1/8 of the user's max HP in Rain, Sandstorm, Hail, and Snow while it is not night or evening (Gen2)")
TO_DO_BATTLE_TEST("TODO: Moonlight recovers 2/4 of the user's max HP while it is night or evening (Gen2)")
TO_DO_BATTLE_TEST("TODO: Moonlight recovers 2/2 of the user's max HP in Sunlight while it is night or evening (Gen2)")
TO_DO_BATTLE_TEST("TODO: Moonlight recovers 2/8 of the user's max HP in Rain, Sandstorm, Hail, and Snow while it is night or evening (Gen2)")

View File

@ -6,9 +6,10 @@ ASSUMPTIONS
ASSUME(GetMoveEffect(MOVE_MORNING_SUN) == EFFECT_MORNING_SUN);
}
SINGLE_BATTLE_TEST("Morning Sun recovers 1/2 of the user's max HP")
SINGLE_BATTLE_TEST("Morning Sun recovers 1/2 of the user's max HP (Gen3+)")
{
GIVEN {
WITH_CONFIG(GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES, GEN_3);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(200); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -18,9 +19,10 @@ SINGLE_BATTLE_TEST("Morning Sun recovers 1/2 of the user's max HP")
}
}
SINGLE_BATTLE_TEST("Morning Sun recovers 2/3 of the user's max HP in Sunlight")
SINGLE_BATTLE_TEST("Morning Sun recovers 2/3 of the user's max HP in Sunlight (Gen3+)")
{
GIVEN {
WITH_CONFIG(GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES, GEN_3);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -30,7 +32,7 @@ SINGLE_BATTLE_TEST("Morning Sun recovers 2/3 of the user's max HP in Sunlight")
}
}
SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in Rain, Sandstorm, Hail, and Snow")
SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in Rain, Sandstorm, Hail, and Snow (Gen3+)")
{
u32 move;
PARAMETRIZE { move = MOVE_RAIN_DANCE; }
@ -38,6 +40,7 @@ SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in Rain, Sands
PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN {
WITH_CONFIG(GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES, GEN_3);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -46,3 +49,15 @@ SINGLE_BATTLE_TEST("Morning Sun recovers 1/4 of the user's max HP in Rain, Sands
HP_BAR(player, damage: -(400 / 4));
}
}
TO_DO_BATTLE_TEST("TODO: Morning Sun recovers 1/4 of the user's max HP while it is not morning (Gen2)")
TO_DO_BATTLE_TEST("TODO: Morning Sun recovers 1/2 of the user's max HP in Sunlight while it is not morning (Gen2)")
TO_DO_BATTLE_TEST("TODO: Morning Sun recovers 1/8 of the user's max HP in Rain, Sandstorm, Hail, and Snow while it is not morning (Gen2)")
TO_DO_BATTLE_TEST("TODO: Morning Sun recovers 2/4 of the user's max HP while it is morning (Gen2)")
TO_DO_BATTLE_TEST("TODO: Morning Sun recovers 2/2 of the user's max HP in Sunlight while it is morning (Gen2)")
TO_DO_BATTLE_TEST("TODO: Morning Sun recovers 2/8 of the user's max HP in Rain, Sandstorm, Hail, and Snow while it is morning (Gen2)")

View File

@ -6,9 +6,10 @@ ASSUMPTIONS
ASSUME(GetMoveEffect(MOVE_SYNTHESIS) == EFFECT_SYNTHESIS);
}
SINGLE_BATTLE_TEST("Synthesis recovers 1/2 of the user's max HP")
SINGLE_BATTLE_TEST("Synthesis recovers 1/2 of the user's max HP (Gen3+)")
{
GIVEN {
WITH_CONFIG(GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES, GEN_3);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(200); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -18,9 +19,10 @@ SINGLE_BATTLE_TEST("Synthesis recovers 1/2 of the user's max HP")
}
}
SINGLE_BATTLE_TEST("Synthesis recovers 2/3 of the user's max HP in Sunlight")
SINGLE_BATTLE_TEST("Synthesis recovers 2/3 of the user's max HP in Sunlight (Gen3+)")
{
GIVEN {
WITH_CONFIG(GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES, GEN_3);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(300); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -30,7 +32,7 @@ SINGLE_BATTLE_TEST("Synthesis recovers 2/3 of the user's max HP in Sunlight")
}
}
SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in Rain, Sandstorm, Hail, and Snow")
SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in Rain, Sandstorm, Hail, and Snow (Gen3+)")
{
u32 move;
PARAMETRIZE { move = MOVE_RAIN_DANCE; }
@ -38,6 +40,7 @@ SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in Rain, Sandsto
PARAMETRIZE { move = MOVE_HAIL; }
PARAMETRIZE { move = MOVE_SNOWSCAPE; }
GIVEN {
WITH_CONFIG(GEN_CONFIG_TIME_OF_DAY_HEALING_MOVES, GEN_3);
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
@ -46,3 +49,15 @@ SINGLE_BATTLE_TEST("Synthesis recovers 1/4 of the user's max HP in Rain, Sandsto
HP_BAR(player, damage: -(400 / 4));
}
}
TO_DO_BATTLE_TEST("TODO: Synthesis recovers 1/4 of the user's max HP while it is not day (Gen2)")
TO_DO_BATTLE_TEST("TODO: Synthesis recovers 1/2 of the user's max HP in Sunlight while it is not day (Gen2)")
TO_DO_BATTLE_TEST("TODO: Synthesis recovers 1/8 of the user's max HP in Rain, Sandstorm, Hail, and Snow while it is not day (Gen2)")
TO_DO_BATTLE_TEST("TODO: Synthesis recovers 2/4 of the user's max HP while it is day (Gen2)")
TO_DO_BATTLE_TEST("TODO: Synthesis recovers 2/2 of the user's max HP in Sunlight while it is day (Gen2)")
TO_DO_BATTLE_TEST("TODO: Synthesis recovers 2/8 of the user's max HP in Rain, Sandstorm, Hail, and Snow while it is day (Gen2)")