Skip to content
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

Add evolution method for Gimmighoul, EVO_LEVEL_ITEM_COUNT_999 #4261

Merged
merged 9 commits into from
Mar 17, 2024
12 changes: 7 additions & 5 deletions include/constants/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,16 @@
#define EVO_LEVEL_MOVE_TWENTY_TIMES 47 // Pokémon levels up after having used a move for at least 20 times
#define EVO_LEVEL_RECOIL_DAMAGE_MALE 48 // Pokémon levels up after having suffered specified amount of non-fainting recoil damage as a male
#define EVO_LEVEL_RECOIL_DAMAGE_FEMALE 49 // Pokémon levels up after having suffered specified amount of non-fainting recoil damage as a female
#define EVO_LEVEL_COLLECT_999 50 // Pokémon levels up after trainer has collected 999 of a specific item

// Evolution 'modes,' for GetEvolutionTargetSpecies
#define EVO_MODE_NORMAL 0
#define EVO_MODE_TRADE 1
#define EVO_MODE_ITEM_USE 2
#define EVO_MODE_ITEM_CHECK 3 // If an Everstone is being held, still want to show that the stone *could* be used on that Pokémon to evolve
#define EVO_MODE_BATTLE_SPECIAL 4
#define EVO_MODE_OVERWORLD_SPECIAL 5
#define EVO_MODE_CANT_STOP 1
#define EVO_MODE_TRADE 2
#define EVO_MODE_ITEM_USE 3
#define EVO_MODE_ITEM_CHECK 4 // If an Everstone is being held, still want to show that the stone *could* be used on that Pokémon to evolve
#define EVO_MODE_BATTLE_SPECIAL 5
#define EVO_MODE_OVERWORLD_SPECIAL 6

#define MON_PIC_WIDTH 64
#define MON_PIC_HEIGHT 64
Expand Down
12 changes: 12 additions & 0 deletions src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5577,6 +5577,18 @@ static void TryEvolvePokemon(void)
EvolutionScene(&gPlayerParty[i], species, TRUE, i);
return;
}
else
{
species = GetEvolutionTargetSpecies(&gPlayerParty[i], EVO_MODE_CANT_STOP, levelUpBits, NULL);

if (species != SPECIES_NONE)
{
FreeAllWindowBuffers();
gBattleMainFunc = WaitForEvoSceneToFinish;
EvolutionScene(&gPlayerParty[i], species, FALSE, i);
return;
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/data/pokemon/species_info/gen_9.h
Original file line number Diff line number Diff line change
Expand Up @@ -4480,7 +4480,7 @@ const struct SpeciesInfo gSpeciesInfoGen9[] =
.frontAnimFrames = sAnims_Gimmighoul, \
LEARNSETS(Gimmighoul), \
.formSpeciesIdTable = sGimmighoulFormSpeciesIdTable, \
.evolutions = EVOLUTION({EVO_NONE, 0, SPECIES_GHOLDENGO})
.evolutions = EVOLUTION({EVO_LEVEL_COLLECT_999, ITEM_GIMMIGHOUL_COIN, SPECIES_GHOLDENGO})
//.frontAnimId = ANIM_V_SQUISH_AND_BOUNCE,
//.backAnimId = BACK_ANIM_NONE,
//FOOTPRINT(Gimmighoul)
Expand Down
43 changes: 36 additions & 7 deletions src/party_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5566,10 +5566,24 @@ void ItemUseCB_RareCandy(u8 taskId, TaskFunc task)
}
else
{
gPartyMenuUseExitCallback = FALSE;
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task;
if (holdEffectParam == 0)
targetSpecies = GetEvolutionTargetSpecies(mon, EVO_MODE_CANT_STOP, ITEM_NONE, NULL);

if (targetSpecies != SPECIES_NONE)
{
RemoveBagItem(gSpecialVar_ItemId, 1);
FreePartyPointers();
gCB2_AfterEvolution = gPartyMenu.exitCallback;
BeginEvolutionScene(mon, targetSpecies, FALSE, gPartyMenu.slotId);
DestroyTask(taskId);
}
else
{
gPartyMenuUseExitCallback = FALSE;
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task;
}
}
}
else
Expand Down Expand Up @@ -5753,10 +5767,25 @@ static void PartyMenuTryEvolution(u8 taskId)
}
else
{
if (gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1))
gTasks[taskId].func = Task_ReturnToChooseMonAfterText;
targetSpecies = GetEvolutionTargetSpecies(mon, EVO_MODE_CANT_STOP, ITEM_NONE, NULL);

if (targetSpecies != SPECIES_NONE)
{
FreePartyPointers();
if (ItemId_GetFieldFunc(gSpecialVar_ItemId) == ItemUseOutOfBattle_RareCandy && gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1))
gCB2_AfterEvolution = CB2_ReturnToPartyMenuUsingRareCandy;
else
gCB2_AfterEvolution = gPartyMenu.exitCallback;
BeginEvolutionScene(mon, targetSpecies, FALSE, gPartyMenu.slotId);
DestroyTask(taskId);
}
else
gTasks[taskId].func = Task_ClosePartyMenuAfterText;
{
if (gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1))
gTasks[taskId].func = Task_ReturnToChooseMonAfterText;
else
gTasks[taskId].func = Task_ClosePartyMenuAfterText;
}
kittenchilly marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/pokedex_plus_hgss.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ static const u8 sText_EVO_ITEM_HOLD[] = _("{LV}{UP_ARROW}, holds {STR_VAR_2}");
static const u8 sText_EVO_LEVEL_MOVE_TWENTY_TIMES[] = _("{LV}{UP_ARROW} after 20x {STR_VAR_2}");
static const u8 sText_EVO_LEVEL_RECOIL_DAMAGE_MALE[] = _("{LV}{UP_ARROW} with {STR_VAR_2} recoil, male");
static const u8 sText_EVO_LEVEL_RECOIL_DAMAGE_FEMALE[] = _("{LV}{UP_ARROW} with {STR_VAR_2} recoil, female");
static const u8 sText_EVO_LEVEL_COLLECT_999[] = _("{LV}{UP_ARROW} with 999 {STR_VAR_2} in bag");
static const u8 sText_EVO_UNKNOWN[] = _("Method unknown");
static const u8 sText_EVO_NONE[] = _("{STR_VAR_1} has no evolution.");

Expand Down Expand Up @@ -6673,6 +6674,11 @@ static u8 PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 depth,
ConvertIntToDecimalStringN(gStringVar2, evolutions[i].param, STR_CONV_MODE_LEADING_ZEROS, 3);
StringExpandPlaceholders(gStringVar4, sText_EVO_LEVEL_RECOIL_DAMAGE_FEMALE);
break;
case EVO_LEVEL_COLLECT_999:
item = evolutions[i].param; //item
CopyItemName(item, gStringVar2); //item
kittenchilly marked this conversation as resolved.
Show resolved Hide resolved
StringExpandPlaceholders(gStringVar4, sText_EVO_LEVEL_COLLECT_999);
break;
default:
StringExpandPlaceholders(gStringVar4, sText_EVO_UNKNOWN );
break;
Expand Down
21 changes: 21 additions & 0 deletions src/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -4388,6 +4388,27 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s
}
}
break;
case EVO_MODE_CANT_STOP:
kittenchilly marked this conversation as resolved.
Show resolved Hide resolved
level = GetMonData(mon, MON_DATA_LEVEL, 0);
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, 0);

for (i = 0; evolutions[i].method != EVOLUTIONS_END; i++)
{
if (SanitizeSpeciesId(evolutions[i].targetSpecies) == SPECIES_NONE)
continue;

switch (evolutions[i].method)
{
case EVO_LEVEL_COLLECT_999:
if (CheckBagHasItem(evolutions[i].param, 999))
{
targetSpecies = evolutions[i].targetSpecies;
RemoveBagItem(evolutions[i].param, 999);
}
break;
}
}
break;
case EVO_MODE_TRADE:
for (i = 0; evolutions[i].method != EVOLUTIONS_END; i++)
{
Expand Down
Loading