mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Merge pull request #2150 from Sneed69/weather_forms_fixes
Weather forms fixes and config
This commit is contained in:
commit
0d4455f951
@ -1186,11 +1186,11 @@
|
||||
.byte 0xe5
|
||||
.endm
|
||||
|
||||
.macro docastformchangeanimation
|
||||
.macro doweatherformchangeanimation
|
||||
.byte 0xe6
|
||||
.endm
|
||||
|
||||
.macro trycastformdatachange
|
||||
.macro tryweatherformdatachange
|
||||
.byte 0xe7
|
||||
.endm
|
||||
|
||||
|
@ -859,7 +859,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
|
||||
@ -24247,11 +24247,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
|
||||
@ -24259,7 +24259,7 @@ CastformChangeContinue:
|
||||
waitforvisualfinish
|
||||
clearmonbg ANIM_ATTACKER
|
||||
end
|
||||
CastformChangeSkipAnim:
|
||||
WeatherFormChangeSkipAnim:
|
||||
createvisualtask AnimTask_CastformGfxDataChange, 2, 1
|
||||
end
|
||||
|
||||
|
@ -6567,11 +6567,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::
|
||||
@ -6610,7 +6608,6 @@ BattleScript_DamagingWeatherContinuesEnd::
|
||||
BattleScript_SandStormHailEnds::
|
||||
printfromtable gSandStormHailEndStringIds
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
call BattleScript_WeatherFormChanges
|
||||
end2
|
||||
|
||||
BattleScript_SunlightContinues::
|
||||
@ -6622,7 +6619,6 @@ BattleScript_SunlightContinues::
|
||||
BattleScript_SunlightFaded::
|
||||
printstring STRINGID_SUNLIGHTFADED
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
call BattleScript_WeatherFormChanges
|
||||
end2
|
||||
|
||||
BattleScript_OverworldWeatherStarts::
|
||||
@ -8228,19 +8224,30 @@ 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
|
||||
.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
|
||||
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[];
|
||||
|
@ -26,7 +26,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
|
||||
|
@ -101,6 +101,7 @@
|
||||
#define B_OBLIVIOUS_TAUNT GEN_LATEST // In Gen6+, Pokémon with Oblivious can't be taunted.
|
||||
#define B_STURDY GEN_LATEST // In Gen5+, Sturdy causes the Pokémon to have 1 HP remaining if another Pokémon's attack or confusion damage would have brought it from full health to 0 HP.
|
||||
#define B_PLUS_MINUS_INTERACTION GEN_LATEST // In Gen5+, Plus and Minus can be activated with themselves and the opposite ability. Before, only the opposing ability could activate it.
|
||||
#define B_WEATHER_FORMS GEN_LATEST // 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_LATEST // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.
|
||||
|
@ -311,8 +311,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
|
||||
|
@ -548,8 +548,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);
|
||||
@ -807,8 +807,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
|
||||
@ -5742,6 +5742,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;
|
||||
@ -6571,7 +6595,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);
|
||||
@ -13466,7 +13490,7 @@ static void Cmd_pickup(void)
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
static void Cmd_docastformchangeanimation(void)
|
||||
static void Cmd_doweatherformchangeanimation(void)
|
||||
{
|
||||
gActiveBattler = gBattleScripting.battler;
|
||||
|
||||
@ -13479,7 +13503,7 @@ static void Cmd_docastformchangeanimation(void)
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
static void Cmd_trycastformdatachange(void)
|
||||
static void Cmd_tryweatherformdatachange(void)
|
||||
{
|
||||
u8 form;
|
||||
|
||||
@ -13487,7 +13511,7 @@ static void Cmd_trycastformdatachange(void)
|
||||
form = TryWeatherFormChange(gBattleScripting.battler);
|
||||
if (form)
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_CastformChange);
|
||||
BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
*(&gBattleStruct->formToChangeInto) = form - 1;
|
||||
}
|
||||
}
|
||||
|
@ -2153,6 +2153,7 @@ enum
|
||||
ENDTURN_ION_DELUGE,
|
||||
ENDTURN_FAIRY_LOCK,
|
||||
ENDTURN_RETALIATE,
|
||||
ENDTURN_WEATHER_FORM,
|
||||
ENDTURN_STATUS_HEAL,
|
||||
ENDTURN_FIELD_COUNT,
|
||||
};
|
||||
@ -2601,6 +2602,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_STATUS_HEAL:
|
||||
for (gBattlerAttacker = 0; gBattlerAttacker < gBattlersCount; gBattlerAttacker++)
|
||||
{
|
||||
@ -4020,21 +4025,48 @@ 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:
|
||||
/* Placeholder
|
||||
case SPECIES_CASTFORM_RAINY:
|
||||
case SPECIES_CASTFORM_SNOWY:
|
||||
case SPECIES_CASTFORM_SUNNY:*/
|
||||
#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);
|
||||
@ -4055,15 +4087,23 @@ 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:
|
||||
// case SPECIES_CHERRIM_SUNSHINE:
|
||||
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;
|
||||
@ -4665,11 +4705,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 != 0)
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_CastformChange);
|
||||
BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
*(&gBattleStruct->formToChangeInto) = effect - 1;
|
||||
}
|
||||
break;
|
||||
@ -4745,6 +4789,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
|
||||
@ -5757,20 +5807,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 != 0)
|
||||
{
|
||||
BattleScriptPushCursorAndCallback(BattleScript_CastformChange);
|
||||
BattleScriptPushCursorAndCallback(BattleScript_WeatherFormChange);
|
||||
gBattleScripting.battler = battler;
|
||||
gBattleStruct->formToChangeInto = effect - 1;
|
||||
return effect;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -119,7 +119,7 @@ static const u8 sHoneyGatherDescription[] = _("May gather Honey.");
|
||||
static const u8 sFriskDescription[] = _("Checks a foe's item.");
|
||||
static const u8 sRecklessDescription[] = _("Boosts moves with recoil.");
|
||||
static const u8 sMultitypeDescription[] = _("Changes type to its Plate.");
|
||||
static const u8 sFlowerGiftDescription[] = _("Transforms in sunshine.");
|
||||
static const u8 sFlowerGiftDescription[] = _("Allies power up in sunshine.");
|
||||
static const u8 sBadDreamsDescription[] = _("Damages sleeping Pokémon.");
|
||||
static const u8 sPickpocketDescription[] = _("Steals the foe's held item.");
|
||||
static const u8 sSheerForceDescription[] = _("Trades effects for power.");
|
||||
|
Loading…
Reference in New Issue
Block a user