-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expanded Pokémon Follower transformation functionality #5048
Changes from 5 commits
cb6cf16
1c5ece1
acc7355
93e4a1f
92b02ea
f2d69eb
dc8fc59
eb19443
140c491
79fdcbc
83697f2
519acc8
1bed0f5
1412fa5
f4f24d1
373ecd5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
#include "metatile_behavior.h" | ||
#include "overworld.h" | ||
#include "palette.h" | ||
#include "party_menu.h" | ||
#include "pokemon.h" | ||
#include "pokeball.h" | ||
#include "random.h" | ||
|
@@ -2018,21 +2019,24 @@ static void RefreshFollowerGraphics(struct ObjectEvent *objEvent) | |
} | ||
} | ||
|
||
static u16 GetOverworldCastformSpecies(void) | ||
u16 GetOverworldWeatherSpecies(u16 species) | ||
{ | ||
switch (GetCurrentWeather()) | ||
u32 i; | ||
u32 weather = GetCurrentWeather(); | ||
const struct FormChange *formChanges = GetSpeciesFormChanges(species); | ||
|
||
for (i = 0; formChanges != NULL && formChanges[i].method != FORM_CHANGE_TERMINATOR; i++) | ||
{ | ||
case WEATHER_SUNNY_CLOUDS: | ||
case WEATHER_DROUGHT: | ||
return SPECIES_CASTFORM_SUNNY; | ||
case WEATHER_RAIN: | ||
case WEATHER_RAIN_THUNDERSTORM: | ||
case WEATHER_DOWNPOUR: | ||
return SPECIES_CASTFORM_RAINY; | ||
case WEATHER_SNOW: | ||
return SPECIES_CASTFORM_SNOWY; | ||
// Unlike other form change checks, we don't do the "species != formChanges[i].targetSpecies" check | ||
if (formChanges[i].method == FORM_CHANGE_OVERWORLD_WEATHER) | ||
{ | ||
if (formChanges[i].param1 == weather) | ||
return formChanges[i].targetSpecies; | ||
else if (formChanges[i].param1 == WEATHER_NONE) // Set the default form for weather not defined in form change table | ||
species = formChanges[i].targetSpecies; | ||
} | ||
} | ||
return SPECIES_CASTFORM_NORMAL; | ||
return species; | ||
} | ||
|
||
static bool8 GetMonInfo(struct Pokemon *mon, u16 *species, u8 *form, u8 *shiny) | ||
|
@@ -2052,8 +2056,8 @@ static bool8 GetMonInfo(struct Pokemon *mon, u16 *species, u8 *form, u8 *shiny) | |
case SPECIES_UNOWN: | ||
*form = GET_UNOWN_LETTER(mon->box.personality); | ||
break; | ||
case SPECIES_CASTFORM: // form is based on overworld weather | ||
*species = GetOverworldCastformSpecies(); | ||
default: | ||
*species = GetOverworldWeatherSpecies(*species); | ||
break; | ||
} | ||
return TRUE; | ||
|
@@ -5207,14 +5211,21 @@ static bool32 EndFollowerTransformEffect(struct ObjectEvent *objectEvent, struct | |
static bool32 TryStartFollowerTransformEffect(struct ObjectEvent *objectEvent, struct Sprite *sprite) | ||
{ | ||
u32 multi; | ||
if (GET_BASE_SPECIES_ID(OW_SPECIES(objectEvent)) == SPECIES_CASTFORM | ||
&& OW_SPECIES(objectEvent) != (multi = GetOverworldCastformSpecies())) | ||
struct Pokemon *mon; | ||
u32 ability; | ||
if (OW_FOLLOWERS_WEATHER_FORMS | ||
&& DoesSpeciesHaveFormChangeMethod(OW_SPECIES(objectEvent), FORM_CHANGE_BATTLE_WEATHER) | ||
&& OW_SPECIES(objectEvent) != (multi = GetOverworldWeatherSpecies(OW_SPECIES(objectEvent)))) | ||
{ | ||
sprite->data[7] = TRANSFORM_TYPE_WEATHER << 8; | ||
PlaySE(SE_M_MINIMIZE); | ||
return TRUE; | ||
} | ||
else if ((Random() & 0xFFFF) < 18 && GetLocalWildMon(FALSE) | ||
&& (OW_SPECIES(objectEvent) == SPECIES_MEW || OW_SPECIES(objectEvent) == SPECIES_DITTO)) | ||
|
||
if (OW_FOLLOWERS_COPY_WILD_PKMN | ||
&& (MonKnowsMove(mon = GetFirstLiveMon(), MOVE_TRANSFORM) | ||
|| (ability = GetMonAbility(mon)) == ABILITY_IMPOSTER || ability == ABILITY_ILLUSION) | ||
Comment on lines
+5355
to
+5356
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this sort of syntax exists outside of merrp's code, so I don't think we should use it even more There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pretty sure we have lots of those that look a bit scuffed.
|
||
&& (Random() & 0xFFFF) < 18 && GetLocalWildMon(FALSE)) | ||
{ | ||
sprite->data[7] = TRANSFORM_TYPE_RANDOM_WILD << 8; | ||
PlaySE(SE_M_MINIMIZE); | ||
|
@@ -5248,7 +5259,7 @@ static bool8 UpdateFollowerTransformEffect(struct ObjectEvent *objectEvent, stru | |
break; | ||
case TRANSFORM_TYPE_WEATHER: | ||
multi = objectEvent->graphicsId; | ||
objectEvent->graphicsId = GetOverworldCastformSpecies(); | ||
objectEvent->graphicsId = GetOverworldWeatherSpecies(OW_SPECIES(objectEvent)); | ||
if (!objectEvent->graphicsId) | ||
{ | ||
objectEvent->graphicsId = multi; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forms still change in the party, even with this config disabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we may need a config to differentiate between them only changing appearance in the overworld (which is purely cosmetic, like
OW_FOLLOWERS_COPY_WILD_PKMN
) and one that actually changes the form (since this causes non-vanilla interactions when it enters a battle with starting entry hazards)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't even have to be starting hazards. Actually the first mon won't be affected by it but the transformed mons in the bag will which would be solved by: