mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
fixed Castform + Cherrim
This commit is contained in:
parent
dc44714c69
commit
2017bee3f8
@ -5156,7 +5156,7 @@ BattleScript_MoveWeatherChange::
|
||||
waitanimation
|
||||
printfromtable gMoveWeatherChangeStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectSunnyDay::
|
||||
@ -6860,7 +6860,7 @@ BattleScript_OverworldWeatherStarts::
|
||||
printfromtable gWeatherStartsStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
playanimation_var BS_ATTACKER, sB_ANIM_ARG1
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_OverworldTerrain::
|
||||
@ -8413,7 +8413,7 @@ BattleScript_DrizzleActivates::
|
||||
printstring STRINGID_PKMNMADEITRAIN
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_AbilityRaisesDefenderStat::
|
||||
@ -8575,7 +8575,7 @@ BattleScript_SandstreamActivates::
|
||||
printstring STRINGID_PKMNSXWHIPPEDUPSANDSTORM
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_SandSpitActivates::
|
||||
@ -8584,7 +8584,7 @@ BattleScript_SandSpitActivates::
|
||||
printstring STRINGID_ASANDSTORMKICKEDUP
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_SANDSTORM_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
return
|
||||
|
||||
BattleScript_ShedSkinActivates::
|
||||
@ -8594,37 +8594,15 @@ BattleScript_ShedSkinActivates::
|
||||
updatestatusicon BS_ATTACKER
|
||||
end3
|
||||
|
||||
BattleScript_WeatherFormChanges::
|
||||
setbyte sBATTLER, 0
|
||||
BattleScript_WeatherFormChangesLoop::
|
||||
tryweatherformdatachange
|
||||
activateweatherchangeabilities BS_SCRIPTING
|
||||
addbyte sBATTLER, 1
|
||||
jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_WeatherFormChangesLoop
|
||||
return
|
||||
|
||||
BattleScript_WeatherFormChange::
|
||||
call BattleScript_DoWeatherFormChange
|
||||
end3
|
||||
|
||||
BattleScript_DoWeatherFormChange::
|
||||
copybyte gBattlerAbility, sBATTLER
|
||||
.if B_WEATHER_FORMS >= GEN_5
|
||||
jumpifspecies BS_SCRIPTING, SPECIES_CASTFORM, BattleScript_DoWeatherFormChange_ForecastCheck
|
||||
BattleScript_DoWeatherFormChange_FlowerGiftCheck:
|
||||
jumpifability BS_SCRIPTING, ABILITY_FLOWER_GIFT, BattleScript_DoWeatherFormChange_PopUp
|
||||
goto BattleScript_DoWeatherFormChange_AfterPopUp
|
||||
.endif
|
||||
BattleScript_DoWeatherFormChange_ForecastCheck:
|
||||
jumpifability BS_SCRIPTING, ABILITY_FORECAST, BattleScript_DoWeatherFormChange_PopUp
|
||||
goto BattleScript_DoWeatherFormChange_AfterPopUp
|
||||
BattleScript_DoWeatherFormChange_PopUp:
|
||||
call BattleScript_AbilityPopUp
|
||||
BattleScript_DoWeatherFormChange_AfterPopUp:
|
||||
doweatherformchangeanimation
|
||||
waitstate
|
||||
printstring STRINGID_PKMNTRANSFORMED
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
BattleScript_ActivateWeatherAbilities:
|
||||
copybyte sBATTLER, gBattlerAttacker
|
||||
setbyte gBattlerAttacker, 0
|
||||
BattleScript_ActivateWeatherAbilities_Loop:
|
||||
activateweatherchangeabilities BS_ATTACKER
|
||||
BattleScript_ActivateWeatherAbilities_Increment:
|
||||
addbyte gBattlerAttacker, 1
|
||||
jumpifbytenotequal gBattlerAttacker, gBattlersCount, BattleScript_ActivateWeatherAbilities_Loop
|
||||
copybyte gBattlerAttacker, sBATTLER
|
||||
return
|
||||
|
||||
BattleScript_TryAdrenalineOrb:
|
||||
@ -8719,7 +8697,7 @@ BattleScript_DroughtActivates::
|
||||
printstring STRINGID_PKMNSXINTENSIFIEDSUN
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_DesolateLandActivates::
|
||||
@ -8728,7 +8706,7 @@ BattleScript_DesolateLandActivates::
|
||||
printstring STRINGID_EXTREMELYHARSHSUNLIGHT
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_SUN_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_DesolateLandEvaporatesWaterTypeMoves::
|
||||
@ -8748,7 +8726,7 @@ BattleScript_PrimordialSeaActivates::
|
||||
printstring STRINGID_HEAVYRAIN
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_RAIN_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_PrimordialSeaFizzlesOutFireTypeMoves::
|
||||
@ -8825,7 +8803,7 @@ BattleScript_SnowWarningActivates::
|
||||
printstring STRINGID_SNOWWARNINGHAIL
|
||||
waitstate
|
||||
playanimation BS_BATTLER_0, B_ANIM_HAIL_CONTINUES
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_TerrainSeedLoop:
|
||||
@ -10002,7 +9980,7 @@ BattleScript_AnnounceAirLockCloudNine::
|
||||
call BattleScript_AbilityPopUp
|
||||
printstring STRINGID_AIRLOCKACTIVATES
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
call BattleScript_WeatherFormChanges
|
||||
call BattleScript_ActivateWeatherAbilities
|
||||
end3
|
||||
|
||||
BattleScript_QuickClawActivation::
|
||||
|
@ -149,9 +149,6 @@ extern const u8 BattleScript_TraceActivatesEnd3[];
|
||||
extern const u8 BattleScript_RainDishActivates[];
|
||||
extern const u8 BattleScript_SandstreamActivates[];
|
||||
extern const u8 BattleScript_ShedSkinActivates[];
|
||||
extern const u8 BattleScript_WeatherFormChanges[];
|
||||
extern const u8 BattleScript_WeatherFormChangesLoop[];
|
||||
extern const u8 BattleScript_WeatherFormChange[];
|
||||
extern const u8 BattleScript_IntimidateActivates[];
|
||||
extern const u8 BattleScript_DroughtActivates[];
|
||||
extern const u8 BattleScript_TookAttack[];
|
||||
|
@ -99,6 +99,7 @@
|
||||
// Additionally, in gen8+ the Healing Wish's effect will be stored until the user switches into a statused or hurt mon.
|
||||
#define B_DEFOG_CLEARS_TERRAIN GEN_LATEST // In Gen8+, Defog also clears active Terrain.
|
||||
#define B_STOCKPILE_RAISES_DEFS GEN_LATEST // In Gen4+, Stockpile also raises Defense and Sp.Defense stats. Once Spit Up / Swallow is used, these stat changes are lost.
|
||||
#define B_TRANSFORM_FORM_CHANGES GEN_LATEST // In Gen5+, Transformed Pokemon cannot change forms.
|
||||
|
||||
// Ability settings
|
||||
#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters.
|
||||
|
@ -269,6 +269,7 @@
|
||||
#define MOVE_RESULT_NO_EFFECT (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED)
|
||||
|
||||
// Battle Weather flags
|
||||
#define B_WEATHER_NONE 0
|
||||
#define B_WEATHER_RAIN_TEMPORARY (1 << 0)
|
||||
#define B_WEATHER_RAIN_DOWNPOUR (1 << 1) // unused
|
||||
#define B_WEATHER_RAIN_PERMANENT (1 << 2)
|
||||
|
@ -332,10 +332,9 @@
|
||||
#define MOVEEND_PICKPOCKET 30
|
||||
#define MOVEEND_DANCER 31
|
||||
#define MOVEEND_EMERGENCY_EXIT 32
|
||||
#define MOVEEND_WEATHER_FORM 33
|
||||
#define MOVEEND_SYMBIOSIS 34
|
||||
#define MOVEEND_CLEAR_BITS 35
|
||||
#define MOVEEND_COUNT 36
|
||||
#define MOVEEND_SYMBIOSIS 33
|
||||
#define MOVEEND_CLEAR_BITS 34
|
||||
#define MOVEEND_COUNT 35
|
||||
|
||||
// switch cases
|
||||
#define B_SWITCH_NORMAL 0
|
||||
|
@ -87,8 +87,12 @@
|
||||
// param1: item to hold.
|
||||
#define FORM_CHANGE_BATTLE_PRIMAL_REVERSION 13
|
||||
|
||||
// Form change that activates when a specific weather is set during battle.
|
||||
// param1: weather to check
|
||||
#define FORM_CHANGE_BATTLE_WEATHER 14
|
||||
|
||||
// Form change that activates automatically when the turn ends.
|
||||
// param1: ability to check.
|
||||
#define FORM_CHANGE_BATTLE_TURN_END 14
|
||||
#define FORM_CHANGE_BATTLE_TURN_END 15
|
||||
|
||||
#endif // GUARD_CONSTANTS_FORM_CHANGE_TYPES_H
|
||||
|
@ -6216,28 +6216,6 @@ 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_CASTFORM_RAINY:
|
||||
case SPECIES_CASTFORM_SNOWY:
|
||||
case SPECIES_CASTFORM_SUNNY:
|
||||
case SPECIES_CHERRIM:
|
||||
case SPECIES_CHERRIM_SUNSHINE:
|
||||
effect = TryWeatherFormChange(i);
|
||||
if (effect)
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
gBattleScripting.battler = i;
|
||||
gBattleStruct->formToChangeInto = effect - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
case MOVEEND_SYMBIOSIS:
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
@ -15080,13 +15058,13 @@ static void Cmd_tryweatherformdatachange(void)
|
||||
|
||||
u8 form;
|
||||
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
form = TryWeatherFormChange(gBattleScripting.battler);
|
||||
if (form)
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
*(&gBattleStruct->formToChangeInto) = form - 1;
|
||||
}
|
||||
// gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
// form = TryWeatherFormChange(gBattleScripting.battler);
|
||||
// if (form)
|
||||
// {
|
||||
// BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
// *(&gBattleStruct->formToChangeInto) = form - 1;
|
||||
// }
|
||||
}
|
||||
|
||||
// Water and Mud Sport
|
||||
|
@ -2564,7 +2564,15 @@ u8 DoFieldEndTurnEffects(void)
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_WEATHER_FORM:
|
||||
AbilityBattleEffects(ABILITYEFFECT_ON_WEATHER, 0, 0, 0, 0);
|
||||
for (i = 0; i < gBattlersCount; ++i)
|
||||
{
|
||||
// This breaks Eiscue right now, because Eiscue doesn't use FORM_CHANGE_BATTLE_WEATHER.
|
||||
if(TryBattleFormChange(i, FORM_CHANGE_BATTLE_WEATHER))
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BattlerFormChangeWithStringEnd3);
|
||||
effect++;
|
||||
}
|
||||
}
|
||||
gBattleStruct->turnCountersTracker++;
|
||||
break;
|
||||
case ENDTURN_STATUS_HEAL:
|
||||
@ -6155,11 +6163,11 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||
#else
|
||||
TRY_WEATHER_FORM:
|
||||
#endif
|
||||
effect = TryWeatherFormChange(battler);
|
||||
if (effect != 0)
|
||||
if (IsBattlerWeatherAffected(battler, gBattleWeather)
|
||||
&& TryBattleFormChange(battler, FORM_CHANGE_BATTLE_WEATHER))
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
*(&gBattleStruct->formToChangeInto) = effect - 1;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_BattlerFormChangeWithStringEnd3);
|
||||
effect++;
|
||||
}
|
||||
break;
|
||||
case ABILITY_ICE_FACE:
|
||||
@ -10153,6 +10161,11 @@ u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FORM_CHANGE_BATTLE_WEATHER:
|
||||
if (gBattleWeather & formChanges[i].param1
|
||||
|| (gBattleWeather == B_WEATHER_NONE && formChanges[i].param1 == B_WEATHER_NONE))
|
||||
targetSpecies = formChanges[i].targetSpecies;
|
||||
break;
|
||||
case FORM_CHANGE_BATTLE_TURN_END:
|
||||
if (formChanges[i].param1 == GetBattlerAbility(battlerId))
|
||||
targetSpecies = formChanges[i].targetSpecies;
|
||||
@ -10168,7 +10181,8 @@ u16 GetBattleFormChangeTargetSpecies(u8 battlerId, u16 method)
|
||||
bool32 CanBattlerFormChange(u8 battlerId, u16 method)
|
||||
{
|
||||
// Can't change form if transformed.
|
||||
if (gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED)
|
||||
if (gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED
|
||||
&& B_TRANSFORM_FORM_CHANGES >= GEN_5)
|
||||
return FALSE;
|
||||
// Mega Evolved Pokémon should always revert to normal upon fainting or ending the battle.
|
||||
if (IsBattlerMegaEvolved(battlerId) && (method == FORM_CHANGE_FAINT || method == FORM_CHANGE_END_BATTLE))
|
||||
|
@ -64,6 +64,10 @@ const struct FormChange *const gFormChangeTablePointers[NUM_SPECIES] =
|
||||
[SPECIES_ALTARIA_MEGA] = sAltariaFormChangeTable,
|
||||
[SPECIES_ABSOL] = sAbsolFormChangeTable,
|
||||
[SPECIES_ABSOL_MEGA] = sAbsolFormChangeTable,
|
||||
[SPECIES_CASTFORM] = sCastformFormChangeTable,
|
||||
[SPECIES_CASTFORM_SUNNY] = sCastformFormChangeTable,
|
||||
[SPECIES_CASTFORM_RAINY] = sCastformFormChangeTable,
|
||||
[SPECIES_CASTFORM_SNOWY] = sCastformFormChangeTable,
|
||||
[SPECIES_BANETTE] = sBanetteFormChangeTable,
|
||||
[SPECIES_BANETTE_MEGA] = sBanetteFormChangeTable,
|
||||
[SPECIES_AGGRON] = sAggronFormChangeTable,
|
||||
|
@ -155,6 +155,18 @@ static const struct FormChange sAbsolFormChangeTable[] = {
|
||||
{FORM_CHANGE_TERMINATOR},
|
||||
};
|
||||
|
||||
static const struct FormChange sCastformFormChangeTable[] = {
|
||||
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_SUNNY, B_WEATHER_SUN},
|
||||
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_RAINY, B_WEATHER_RAIN},
|
||||
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM_SNOWY, B_WEATHER_HAIL},
|
||||
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM, ~(B_WEATHER_SUN | B_WEATHER_RAIN | B_WEATHER_HAIL)},
|
||||
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CASTFORM, B_WEATHER_NONE},
|
||||
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_CASTFORM},
|
||||
{FORM_CHANGE_FAINT, SPECIES_CASTFORM},
|
||||
{FORM_CHANGE_END_BATTLE, SPECIES_CASTFORM},
|
||||
{FORM_CHANGE_TERMINATOR},
|
||||
};
|
||||
|
||||
static const struct FormChange sBanetteFormChangeTable[] = {
|
||||
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM, SPECIES_BANETTE_MEGA, ITEM_BANETTITE},
|
||||
{FORM_CHANGE_TERMINATOR},
|
||||
@ -218,6 +230,16 @@ static const struct FormChange sBurmyFormChangeTable[] = {
|
||||
{FORM_CHANGE_TERMINATOR},
|
||||
};
|
||||
|
||||
static const struct FormChange sCherrimFormChangeTable[] = {
|
||||
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CHERRIM_SUNSHINE, B_WEATHER_SUN},
|
||||
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CHERRIM, ~B_WEATHER_SUN},
|
||||
{FORM_CHANGE_BATTLE_WEATHER, SPECIES_CHERRIM, B_WEATHER_NONE},
|
||||
{FORM_CHANGE_BATTLE_SWITCH, SPECIES_CHERRIM},
|
||||
{FORM_CHANGE_FAINT, SPECIES_CHERRIM},
|
||||
{FORM_CHANGE_END_BATTLE, SPECIES_CHERRIM},
|
||||
{FORM_CHANGE_TERMINATOR},
|
||||
};
|
||||
|
||||
static const struct FormChange sLopunnyFormChangeTable[] = {
|
||||
{FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM, SPECIES_LOPUNNY_MEGA, ITEM_LOPUNNITE},
|
||||
{FORM_CHANGE_TERMINATOR},
|
||||
|
Loading…
Reference in New Issue
Block a user