mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
weather forms fixes and config
This commit is contained in:
parent
6be8151981
commit
d0a2be9630
@ -1186,11 +1186,11 @@
|
||||
.byte 0xe5
|
||||
.endm
|
||||
|
||||
.macro docastformchangeanimation
|
||||
.macro doweatherformchangeanimation
|
||||
.byte 0xe6
|
||||
.endm
|
||||
|
||||
.macro trycastformdatachange
|
||||
.macro tryweatherformdatachange
|
||||
.byte 0xe7
|
||||
.endm
|
||||
|
||||
|
@ -796,7 +796,7 @@ gBattleAnims_StatusConditions::
|
||||
|
||||
.align 2
|
||||
gBattleAnims_General::
|
||||
.4byte General_CastformChange @ B_ANIM_CASTFORM_CHANGE
|
||||
.4byte General_WeatherFormChange @ B_ANIM_CASTFORM_CHANGE
|
||||
.4byte General_StatsChange @ B_ANIM_STATS_CHANGE
|
||||
.4byte General_SubstituteFade @ B_ANIM_SUBSTITUTE_FADE
|
||||
.4byte General_SubstituteAppear @ B_ANIM_SUBSTITUTE_APPEAR
|
||||
@ -24152,11 +24152,11 @@ Status_Nightmare:
|
||||
Status_Powder:
|
||||
end
|
||||
|
||||
General_CastformChange:
|
||||
General_WeatherFormChange:
|
||||
createvisualtask AnimTask_IsMonInvisible, 2
|
||||
jumpreteq TRUE, CastformChangeSkipAnim
|
||||
goto CastformChangeContinue
|
||||
CastformChangeContinue:
|
||||
jumpreteq TRUE, WeatherFormChangeSkipAnim
|
||||
goto WeatherFormChangeContinue
|
||||
WeatherFormChangeContinue:
|
||||
monbg ANIM_ATTACKER
|
||||
playsewithpan SE_M_TELEPORT, SOUND_PAN_ATTACKER
|
||||
waitplaysewithpan SE_M_MINIMIZE, SOUND_PAN_ATTACKER, 48
|
||||
@ -24164,7 +24164,7 @@ CastformChangeContinue:
|
||||
waitforvisualfinish
|
||||
clearmonbg ANIM_ATTACKER
|
||||
end
|
||||
CastformChangeSkipAnim:
|
||||
WeatherFormChangeSkipAnim:
|
||||
createvisualtask AnimTask_CastformGfxDataChange, 2, 1
|
||||
end
|
||||
|
||||
|
@ -6511,11 +6511,9 @@ BattleScript_LearnMoveReturn::
|
||||
BattleScript_RainContinuesOrEnds::
|
||||
printfromtable gRainContinuesStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_RAIN_STOPPED, BattleScript_RainEnds
|
||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_RAIN_STOPPED, BattleScript_RainContinuesOrEndsEnd
|
||||
playanimation BS_ATTACKER, B_ANIM_RAIN_CONTINUES
|
||||
end2
|
||||
BattleScript_RainEnds::
|
||||
call BattleScript_WeatherFormChanges
|
||||
BattleScript_RainContinuesOrEndsEnd::
|
||||
end2
|
||||
|
||||
BattleScript_DamagingWeatherContinues::
|
||||
@ -6554,7 +6552,6 @@ BattleScript_DamagingWeatherContinuesEnd::
|
||||
BattleScript_SandStormHailEnds::
|
||||
printfromtable gSandStormHailEndStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
call BattleScript_WeatherFormChanges
|
||||
end2
|
||||
|
||||
BattleScript_SunlightContinues::
|
||||
@ -6566,7 +6563,6 @@ BattleScript_SunlightContinues::
|
||||
BattleScript_SunlightFaded::
|
||||
printstring STRINGID_SUNLIGHTFADED
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
call BattleScript_WeatherFormChanges
|
||||
end2
|
||||
|
||||
BattleScript_OverworldWeatherStarts::
|
||||
@ -8167,19 +8163,28 @@ BattleScript_ShedSkinActivates::
|
||||
BattleScript_WeatherFormChanges::
|
||||
setbyte sBATTLER, 0
|
||||
BattleScript_WeatherFormChangesLoop::
|
||||
trycastformdatachange
|
||||
tryweatherformdatachange
|
||||
addbyte sBATTLER, 1
|
||||
jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_WeatherFormChangesLoop
|
||||
return
|
||||
|
||||
BattleScript_CastformChange::
|
||||
call BattleScript_DoCastformChange
|
||||
BattleScript_WeatherFormChange::
|
||||
call BattleScript_DoWeatherFormChange
|
||||
end3
|
||||
|
||||
BattleScript_DoCastformChange::
|
||||
BattleScript_DoWeatherFormChange::
|
||||
copybyte gBattlerAbility, sBATTLER
|
||||
jumpifspecies BS_SCRIPTING, SPECIES_CASTFORM, BattleScript_DoWeatherFormChange_ForecastCheck
|
||||
BattleScript_DoWeatherFormChange_FlowerGiftCheck:
|
||||
jumpifability BS_SCRIPTING, ABILITY_FLOWER_GIFT, BattleScript_DoWeatherFormChange_PopUp
|
||||
goto BattleScript_DoWeatherFormChange_AfterPopUp
|
||||
BattleScript_DoWeatherFormChange_ForecastCheck:
|
||||
jumpifability BS_SCRIPTING, ABILITY_FORECAST, BattleScript_DoWeatherFormChange_PopUp
|
||||
goto BattleScript_DoWeatherFormChange_AfterPopUp
|
||||
BattleScript_DoWeatherFormChange_PopUp:
|
||||
call BattleScript_AbilityPopUp
|
||||
docastformchangeanimation
|
||||
BattleScript_DoWeatherFormChange_AfterPopUp:
|
||||
doweatherformchangeanimation
|
||||
waitstate
|
||||
printstring STRINGID_PKMNTRANSFORMED
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
|
@ -151,7 +151,7 @@ extern const u8 BattleScript_SandstreamActivates[];
|
||||
extern const u8 BattleScript_ShedSkinActivates[];
|
||||
extern const u8 BattleScript_WeatherFormChanges[];
|
||||
extern const u8 BattleScript_WeatherFormChangesLoop[];
|
||||
extern const u8 BattleScript_CastformChange[];
|
||||
extern const u8 BattleScript_WeatherFormChange[];
|
||||
extern const u8 BattleScript_IntimidateActivatesEnd3[];
|
||||
extern const u8 BattleScript_IntimidateActivates[];
|
||||
extern const u8 BattleScript_DroughtActivates[];
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define ABILITYEFFECT_MOVE_END_ATTACKER 4
|
||||
#define ABILITYEFFECT_MOVE_END 5
|
||||
#define ABILITYEFFECT_IMMUNITY 6
|
||||
#define ABILITYEFFECT_FORECAST 7
|
||||
#define ABILITYEFFECT_WEATHER_FORM 7
|
||||
#define ABILITYEFFECT_SYNCHRONIZE 8
|
||||
#define ABILITYEFFECT_ATK_SYNCHRONIZE 9
|
||||
#define ABILITYEFFECT_INTIMIDATE1 10
|
||||
|
@ -190,6 +190,7 @@
|
||||
#define B_SYNCHRONIZE_TOXIC GEN_8 // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned.
|
||||
#define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. It also activates Rattled.
|
||||
#define B_OBLIVIOUS_TAUNT GEN_7 // In Gen6+, Pokémon with Oblivious can't be taunted.
|
||||
#define B_WEATHER_FORMS GEN_5 // In Gen5+, Castform and Cherrim revert to their base form upon losing their respective ability. Cherrim needs Flower Gift to swap forms.
|
||||
|
||||
// Item settings
|
||||
#define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.
|
||||
|
@ -310,8 +310,9 @@
|
||||
#define MOVEEND_PICKPOCKET 27
|
||||
#define MOVEEND_DANCER 28
|
||||
#define MOVEEND_EMERGENCY_EXIT 29
|
||||
#define MOVEEND_CLEAR_BITS 30
|
||||
#define MOVEEND_COUNT 31
|
||||
#define MOVEEND_WEATHER_FORM 30
|
||||
#define MOVEEND_CLEAR_BITS 31
|
||||
#define MOVEEND_COUNT 32
|
||||
|
||||
// switch cases
|
||||
#define B_SWITCH_NORMAL 0
|
||||
|
@ -537,8 +537,8 @@ static void Cmd_switchoutabilities(void);
|
||||
static void Cmd_jumpifhasnohp(void);
|
||||
static void Cmd_getsecretpowereffect(void);
|
||||
static void Cmd_pickup(void);
|
||||
static void Cmd_docastformchangeanimation(void);
|
||||
static void Cmd_trycastformdatachange(void);
|
||||
static void Cmd_doweatherformchangeanimation(void);
|
||||
static void Cmd_tryweatherformdatachange(void);
|
||||
static void Cmd_settypebasedhalvers(void);
|
||||
static void Cmd_jumpifsubstituteblocks(void);
|
||||
static void Cmd_tryrecycleitem(void);
|
||||
@ -796,8 +796,8 @@ void (* const gBattleScriptingCommandsTable[])(void) =
|
||||
Cmd_jumpifhasnohp, //0xE3
|
||||
Cmd_getsecretpowereffect, //0xE4
|
||||
Cmd_pickup, //0xE5
|
||||
Cmd_docastformchangeanimation, //0xE6
|
||||
Cmd_trycastformdatachange, //0xE7
|
||||
Cmd_doweatherformchangeanimation, //0xE6
|
||||
Cmd_tryweatherformdatachange, //0xE7
|
||||
Cmd_settypebasedhalvers, //0xE8
|
||||
Cmd_jumpifsubstituteblocks, //0xE9
|
||||
Cmd_tryrecycleitem, //0xEA
|
||||
@ -5601,6 +5601,30 @@ static void Cmd_moveend(void)
|
||||
}
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
case MOVEEND_WEATHER_FORM:
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
switch (gBattleMons[i].species)
|
||||
{
|
||||
case SPECIES_CASTFORM:
|
||||
case SPECIES_CHERRIM:
|
||||
#ifdef POKEMON_EXPANSION
|
||||
case SPECIES_CASTFORM_RAINY:
|
||||
case SPECIES_CASTFORM_SNOWY:
|
||||
case SPECIES_CASTFORM_SUNNY:
|
||||
case SPECIES_CHERRIM_SUNSHINE:
|
||||
#endif
|
||||
effect = TryWeatherFormChange(i);
|
||||
if (effect)
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
gBattleScripting.battler = i;
|
||||
gBattleStruct->formToChangeInto = effect - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
case MOVEEND_CLEAR_BITS: // Clear/Set bits for things like using a move for all targets and all hits.
|
||||
if (gSpecialStatuses[gBattlerAttacker].instructedChosenTarget)
|
||||
*(gBattleStruct->moveTarget + gBattlerAttacker) = gSpecialStatuses[gBattlerAttacker].instructedChosenTarget & 0x3;
|
||||
@ -6415,7 +6439,7 @@ static void Cmd_switchineffects(void)
|
||||
|| ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gActiveBattler, FALSE)
|
||||
|| AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE2, 0, 0, 0, 0)
|
||||
|| AbilityBattleEffects(ABILITYEFFECT_TRACE2, 0, 0, 0, 0)
|
||||
|| AbilityBattleEffects(ABILITYEFFECT_FORECAST, 0, 0, 0, 0))
|
||||
|| AbilityBattleEffects(ABILITYEFFECT_WEATHER_FORM, 0, 0, 0, 0))
|
||||
return;
|
||||
|
||||
gSideStatuses[GetBattlerSide(gActiveBattler)] &= ~(SIDE_STATUS_SPIKES_DAMAGED | SIDE_STATUS_TOXIC_SPIKES_DAMAGED | SIDE_STATUS_STEALTH_ROCK_DAMAGED | SIDE_STATUS_STICKY_WEB_DAMAGED);
|
||||
@ -13267,7 +13291,7 @@ static void Cmd_pickup(void)
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
static void Cmd_docastformchangeanimation(void)
|
||||
static void Cmd_doweatherformchangeanimation(void)
|
||||
{
|
||||
gActiveBattler = gBattleScripting.battler;
|
||||
|
||||
@ -13280,7 +13304,7 @@ static void Cmd_docastformchangeanimation(void)
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
static void Cmd_trycastformdatachange(void)
|
||||
static void Cmd_tryweatherformdatachange(void)
|
||||
{
|
||||
u8 form;
|
||||
|
||||
@ -13288,7 +13312,7 @@ static void Cmd_trycastformdatachange(void)
|
||||
form = TryWeatherFormChange(gBattleScripting.battler);
|
||||
if (form)
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_CastformChange);
|
||||
BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
*(&gBattleStruct->formToChangeInto) = form - 1;
|
||||
}
|
||||
}
|
||||
|
@ -2104,6 +2104,7 @@ enum
|
||||
ENDTURN_ION_DELUGE,
|
||||
ENDTURN_FAIRY_LOCK,
|
||||
ENDTURN_RETALIATE,
|
||||
ENDTURN_WEATHER_FORM,
|
||||
ENDTURN_FIELD_COUNT,
|
||||
};
|
||||
|
||||
@ -2551,6 +2552,10 @@ u8 DoFieldEndTurnEffects(void)
|
||||
gSideTimers[B_SIDE_OPPONENT].retaliateTimer--;
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_WEATHER_FORM:
|
||||
AbilityBattleEffects(ABILITYEFFECT_WEATHER_FORM, 0, 0, 0, 0);
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_FIELD_COUNT:
|
||||
effect++;
|
||||
break;
|
||||
@ -3902,21 +3907,49 @@ u8 TryWeatherFormChange(u8 battler)
|
||||
bool32 weatherEffect = WEATHER_HAS_EFFECT;
|
||||
u16 holdEffect = GetBattlerHoldEffect(battler, TRUE);
|
||||
|
||||
if (gBattleMons[battler].species == SPECIES_CASTFORM)
|
||||
switch (gBattleMons[battler].species)
|
||||
{
|
||||
case SPECIES_CASTFORM:
|
||||
#ifdef POKEMON_EXPANSION
|
||||
case SPECIES_CASTFORM_RAINY:
|
||||
case SPECIES_CASTFORM_SNOWY:
|
||||
case SPECIES_CASTFORM_SUNNY:
|
||||
#endif
|
||||
#if B_WEATHER_FORMS >= GEN_5
|
||||
if (gBattleMons[battler].hp == 0)
|
||||
{
|
||||
ret = 0; // No change
|
||||
}
|
||||
else if (GetBattlerAbility(battler) != ABILITY_FORECAST || !weatherEffect)
|
||||
{
|
||||
if (!IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))
|
||||
{
|
||||
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||
ret = CASTFORM_NORMAL + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = 0; // No change
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (GetBattlerAbility(battler) != ABILITY_FORECAST || gBattleMons[battler].hp == 0)
|
||||
{
|
||||
ret = 0; // No change
|
||||
}
|
||||
else if (!weatherEffect && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))
|
||||
{
|
||||
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||
ret = CASTFORM_NORMAL + 1;
|
||||
}
|
||||
else if (!weatherEffect)
|
||||
{
|
||||
ret = 0; // No change
|
||||
if (!IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL))
|
||||
{
|
||||
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||
ret = CASTFORM_NORMAL + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = 0; // No change
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (holdEffect == HOLD_EFFECT_UTILITY_UMBRELLA || (!(gBattleWeather & (B_WEATHER_RAIN | B_WEATHER_SUN | B_WEATHER_HAIL)) && !IS_BATTLER_OF_TYPE(battler, TYPE_NORMAL)))
|
||||
{
|
||||
SET_BATTLER_TYPE(battler, TYPE_NORMAL);
|
||||
@ -3937,15 +3970,25 @@ u8 TryWeatherFormChange(u8 battler)
|
||||
SET_BATTLER_TYPE(battler, TYPE_ICE);
|
||||
ret = CASTFORM_ICE + 1;
|
||||
}
|
||||
}
|
||||
else if (gBattleMons[battler].species == SPECIES_CHERRIM)
|
||||
{
|
||||
if (GetBattlerAbility(battler) != ABILITY_FLOWER_GIFT || gBattleMons[battler].hp == 0)
|
||||
break;
|
||||
case SPECIES_CHERRIM:
|
||||
#ifdef POKEMON_EXPANSION
|
||||
case SPECIES_CHERRIM_SUNSHINE:
|
||||
#endif
|
||||
if (gBattleMons[battler].hp == 0)
|
||||
ret = 0; // No change
|
||||
#if B_WEATHER_FORMS >= GEN_5
|
||||
if (GetBattlerAbility(battler) != ABILITY_FLOWER_GIFT)
|
||||
if (gBattleMonForms[battler] != 0)
|
||||
ret = CHERRIM_OVERCAST + 1;
|
||||
else
|
||||
ret = 0; // No change
|
||||
#endif
|
||||
else if (gBattleMonForms[battler] == 0 && weatherEffect && holdEffect != HOLD_EFFECT_UTILITY_UMBRELLA && gBattleWeather & B_WEATHER_SUN)
|
||||
ret = CHERRIM_SUNSHINE + 1;
|
||||
else if (gBattleMonForms[battler] != 0 && (!weatherEffect || holdEffect == HOLD_EFFECT_UTILITY_UMBRELLA || !(gBattleWeather & B_WEATHER_SUN)))
|
||||
ret = CHERRIM_OVERCAST + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -4543,11 +4586,15 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
}
|
||||
break;
|
||||
case ABILITY_FORECAST:
|
||||
#if B_WEATHER_FORMS >= GEN_5
|
||||
case ABILITY_FLOWER_GIFT:
|
||||
#else
|
||||
TRY_WEATHER_FORM:
|
||||
#endif
|
||||
effect = TryWeatherFormChange(battler);
|
||||
if (effect)
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_CastformChange);
|
||||
BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
*(&gBattleStruct->formToChangeInto) = effect - 1;
|
||||
}
|
||||
break;
|
||||
@ -4623,6 +4670,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
#if B_WEATHER_FORMS < GEN_5
|
||||
default:
|
||||
if (gBattleMons[battler].species == SPECIES_CHERRIM)
|
||||
goto TRY_WEATHER_FORM;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_ENDTURN: // 1
|
||||
@ -5627,20 +5680,28 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ABILITYEFFECT_FORECAST: // 6
|
||||
case ABILITYEFFECT_WEATHER_FORM: // 6
|
||||
for (battler = 0; battler < gBattlersCount; battler++)
|
||||
{
|
||||
u16 battlerAbility = GetBattlerAbility(battler);
|
||||
if (battlerAbility == ABILITY_FORECAST || battlerAbility == ABILITY_FLOWER_GIFT)
|
||||
switch (gBattleMons[battler].species)
|
||||
{
|
||||
case SPECIES_CASTFORM:
|
||||
case SPECIES_CHERRIM:
|
||||
#ifdef POKEMON_EXPANSION
|
||||
case SPECIES_CASTFORM_RAINY:
|
||||
case SPECIES_CASTFORM_SNOWY:
|
||||
case SPECIES_CASTFORM_SUNNY:
|
||||
case SPECIES_CHERRIM_SUNSHINE:
|
||||
#endif
|
||||
effect = TryWeatherFormChange(battler);
|
||||
if (effect)
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_CastformChange);
|
||||
BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
gBattleScripting.battler = battler;
|
||||
gBattleStruct->formToChangeInto = effect - 1;
|
||||
return effect;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user