Merge pull request #12 from AsparagusEduardo/PR-TradeSpecificEvo

Added Karrablast/Shelmet evolution method.
This commit is contained in:
ExpoSeed 2020-10-16 20:55:15 -05:00 committed by GitHub
commit 1a024b0826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 11 deletions

View File

@ -301,6 +301,7 @@
#define EVO_LEVEL_RAIN 28 // Pokémon reaches the specified level while it's raining
#define EVO_SPECIFIC_MON_IN_PARTY 29 // Pokémon levels up with a specified Pokémon in party
#define EVO_LEVEL_DARK_TYPE_MON_IN_PARTY 30 // Pokémon reaches the specified level with a Dark Type Pokémon in party
#define EVO_TRADE_SPECIFIC_MON 31 // Pokémon is traded for a specified Pokémon
#define EVOS_PER_MON 8

View File

@ -347,7 +347,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit);
u8 *UseStatIncreaseItem(u16 itemId);
u8 GetNature(struct Pokemon *mon);
u8 GetNatureFromPersonality(u32 personality);
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem);
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem, u16 tradePartnerSpecies);
u16 HoennPokedexNumToSpecies(u16 hoennNum);
u16 NationalPokedexNumToSpecies(u16 nationalNum);
u16 NationalToHoennOrder(u16 nationalNum);

View File

@ -5102,7 +5102,7 @@ static void TryEvolvePokemon(void)
levelUpBits &= ~(gBitTable[i]);
gLeveledUpInBattle = levelUpBits;
species = GetEvolutionTargetSpecies(&gPlayerParty[i], 0, levelUpBits);
species = GetEvolutionTargetSpecies(&gPlayerParty[i], 0, levelUpBits, SPECIES_NONE);
if (species != SPECIES_NONE)
{
FreeAllWindowBuffers();

View File

@ -354,7 +354,7 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] =
[SPECIES_VANILLITE] = {{EVO_LEVEL, 35, SPECIES_VANILLISH}},
[SPECIES_VANILLISH] = {{EVO_LEVEL, 47, SPECIES_VANILLUXE}},
[SPECIES_DEERLING] = {{EVO_LEVEL, 34, SPECIES_SAWSBUCK}},
[SPECIES_KARRABLAST] = {{EVO_LEVEL, SPECIES_SHELMET, SPECIES_ESCAVALIER}},
[SPECIES_KARRABLAST] = {{EVO_TRADE_SPECIFIC_MON, SPECIES_SHELMET, SPECIES_ESCAVALIER}},
[SPECIES_FOONGUS] = {{EVO_LEVEL, 39, SPECIES_AMOONGUSS}},
[SPECIES_FRILLISH] = {{EVO_LEVEL, 40, SPECIES_JELLICENT}},
[SPECIES_JOLTIK] = {{EVO_LEVEL, 36, SPECIES_GALVANTULA}},
@ -369,7 +369,7 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] =
[SPECIES_AXEW] = {{EVO_LEVEL, 38, SPECIES_FRAXURE}},
[SPECIES_FRAXURE] = {{EVO_LEVEL, 48, SPECIES_HAXORUS}},
[SPECIES_CUBCHOO] = {{EVO_LEVEL, 37, SPECIES_BEARTIC}},
[SPECIES_SHELMET] = {{EVO_LEVEL, SPECIES_KARRABLAST, SPECIES_ACCELGOR}},
[SPECIES_SHELMET] = {{EVO_TRADE_SPECIFIC_MON, SPECIES_KARRABLAST, SPECIES_ACCELGOR}},
[SPECIES_MIENFOO] = {{EVO_LEVEL, 50, SPECIES_MIENSHAO}},
[SPECIES_GOLETT] = {{EVO_LEVEL, 43, SPECIES_GOLURK}},
[SPECIES_PAWNIARD] = {{EVO_LEVEL, 52, SPECIES_BISHARP}},

View File

@ -915,7 +915,7 @@ static bool8 DisplayPartyPokemonDataForMoveTutorOrEvolutionItem(u8 slot)
DisplayPartyPokemonDataToTeachMove(slot, item, 0);
break;
case 2: // Evolution stone
if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, 3, item) != SPECIES_NONE)
if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, 3, item, SPECIES_NONE) != SPECIES_NONE)
return FALSE;
DisplayPartyPokemonDescriptionData(slot, PARTYBOX_DESC_NO_USE);
break;
@ -5017,7 +5017,7 @@ static void Task_TryLearningNextMove(u8 taskId)
static void PartyMenuTryEvolution(u8 taskId)
{
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 0, 0);
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 0, ITEM_NONE, SPECIES_NONE);
if (targetSpecies != SPECIES_NONE)
{

View File

@ -5304,7 +5304,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
// Evolution stone
case 7:
{
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 2, item);
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 2, item, SPECIES_NONE);
if (targetSpecies != SPECIES_NONE)
{
@ -5669,7 +5669,7 @@ u8 GetNatureFromPersonality(u32 personality)
return personality % NUM_NATURES;
}
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem, u16 tradePartnerSpecies)
{
int i, j;
u16 targetSpecies = 0;
@ -5857,6 +5857,10 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
}
break;
case EVO_TRADE_SPECIFIC_MON:
if (gEvolutionTable[species][i].param == tradePartnerSpecies)
targetSpecies = gEvolutionTable[species][i].targetSpecies;
break;
}
}
break;

View File

@ -3735,7 +3735,7 @@ static bool8 AnimateTradeSequenceCable(void)
case 72: // Only if in-game trade
TradeMons(gSpecialVar_0x8005, 0);
gCB2_AfterEvolution = CB2_UpdateInGameTrade;
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE);
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE, GetMonData(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PARTNER]], MON_DATA_SPECIES));
if (evoTarget != SPECIES_NONE)
{
TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], evoTarget, sTradeData->pokePicSpriteIdxs[TRADE_PARTNER], gSelectedTradeMonPositions[TRADE_PLAYER]);
@ -4250,7 +4250,7 @@ static bool8 AnimateTradeSequenceWireless(void)
case 72: // Only if in-game trade
TradeMons(gSpecialVar_0x8005, 0);
gCB2_AfterEvolution = CB2_UpdateInGameTrade;
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE);
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE, GetMonData(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PARTNER]], MON_DATA_SPECIES));
if (evoTarget != SPECIES_NONE)
{
TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], evoTarget, sTradeData->pokePicSpriteIdxs[TRADE_PARTNER], gSelectedTradeMonPositions[TRADE_PLAYER]);
@ -4293,7 +4293,7 @@ static void CB2_TryTradeEvolution(void)
break;
case 4:
gCB2_AfterEvolution = CB2_SaveAndEndTrade;
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE);
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE, GetMonData(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PARTNER]], MON_DATA_SPECIES));
if (evoTarget != SPECIES_NONE)
TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], evoTarget, sTradeData->pokePicSpriteIdxs[TRADE_PARTNER], gSelectedTradeMonPositions[TRADE_PLAYER]);
else if (IsWirelessTrade())