Skip to content

Commit 1a024b0

Browse files
authored
Merge pull request #12 from AsparagusEduardo/PR-TradeSpecificEvo
Added Karrablast/Shelmet evolution method.
2 parents f66b34b + be2c56c commit 1a024b0

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

include/constants/pokemon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@
301301
#define EVO_LEVEL_RAIN 28 // Pokémon reaches the specified level while it's raining
302302
#define EVO_SPECIFIC_MON_IN_PARTY 29 // Pokémon levels up with a specified Pokémon in party
303303
#define EVO_LEVEL_DARK_TYPE_MON_IN_PARTY 30 // Pokémon reaches the specified level with a Dark Type Pokémon in party
304+
#define EVO_TRADE_SPECIFIC_MON 31 // Pokémon is traded for a specified Pokémon
304305

305306
#define EVOS_PER_MON 8
306307

include/pokemon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit);
347347
u8 *UseStatIncreaseItem(u16 itemId);
348348
u8 GetNature(struct Pokemon *mon);
349349
u8 GetNatureFromPersonality(u32 personality);
350-
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem);
350+
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem, u16 tradePartnerSpecies);
351351
u16 HoennPokedexNumToSpecies(u16 hoennNum);
352352
u16 NationalPokedexNumToSpecies(u16 nationalNum);
353353
u16 NationalToHoennOrder(u16 nationalNum);

src/battle_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5102,7 +5102,7 @@ static void TryEvolvePokemon(void)
51025102
levelUpBits &= ~(gBitTable[i]);
51035103
gLeveledUpInBattle = levelUpBits;
51045104

5105-
species = GetEvolutionTargetSpecies(&gPlayerParty[i], 0, levelUpBits);
5105+
species = GetEvolutionTargetSpecies(&gPlayerParty[i], 0, levelUpBits, SPECIES_NONE);
51065106
if (species != SPECIES_NONE)
51075107
{
51085108
FreeAllWindowBuffers();

src/data/pokemon/evolution.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] =
354354
[SPECIES_VANILLITE] = {{EVO_LEVEL, 35, SPECIES_VANILLISH}},
355355
[SPECIES_VANILLISH] = {{EVO_LEVEL, 47, SPECIES_VANILLUXE}},
356356
[SPECIES_DEERLING] = {{EVO_LEVEL, 34, SPECIES_SAWSBUCK}},
357-
[SPECIES_KARRABLAST] = {{EVO_LEVEL, SPECIES_SHELMET, SPECIES_ESCAVALIER}},
357+
[SPECIES_KARRABLAST] = {{EVO_TRADE_SPECIFIC_MON, SPECIES_SHELMET, SPECIES_ESCAVALIER}},
358358
[SPECIES_FOONGUS] = {{EVO_LEVEL, 39, SPECIES_AMOONGUSS}},
359359
[SPECIES_FRILLISH] = {{EVO_LEVEL, 40, SPECIES_JELLICENT}},
360360
[SPECIES_JOLTIK] = {{EVO_LEVEL, 36, SPECIES_GALVANTULA}},
@@ -369,7 +369,7 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] =
369369
[SPECIES_AXEW] = {{EVO_LEVEL, 38, SPECIES_FRAXURE}},
370370
[SPECIES_FRAXURE] = {{EVO_LEVEL, 48, SPECIES_HAXORUS}},
371371
[SPECIES_CUBCHOO] = {{EVO_LEVEL, 37, SPECIES_BEARTIC}},
372-
[SPECIES_SHELMET] = {{EVO_LEVEL, SPECIES_KARRABLAST, SPECIES_ACCELGOR}},
372+
[SPECIES_SHELMET] = {{EVO_TRADE_SPECIFIC_MON, SPECIES_KARRABLAST, SPECIES_ACCELGOR}},
373373
[SPECIES_MIENFOO] = {{EVO_LEVEL, 50, SPECIES_MIENSHAO}},
374374
[SPECIES_GOLETT] = {{EVO_LEVEL, 43, SPECIES_GOLURK}},
375375
[SPECIES_PAWNIARD] = {{EVO_LEVEL, 52, SPECIES_BISHARP}},

src/party_menu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ static bool8 DisplayPartyPokemonDataForMoveTutorOrEvolutionItem(u8 slot)
915915
DisplayPartyPokemonDataToTeachMove(slot, item, 0);
916916
break;
917917
case 2: // Evolution stone
918-
if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, 3, item) != SPECIES_NONE)
918+
if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, 3, item, SPECIES_NONE) != SPECIES_NONE)
919919
return FALSE;
920920
DisplayPartyPokemonDescriptionData(slot, PARTYBOX_DESC_NO_USE);
921921
break;
@@ -5017,7 +5017,7 @@ static void Task_TryLearningNextMove(u8 taskId)
50175017
static void PartyMenuTryEvolution(u8 taskId)
50185018
{
50195019
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
5020-
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 0, 0);
5020+
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 0, ITEM_NONE, SPECIES_NONE);
50215021

50225022
if (targetSpecies != SPECIES_NONE)
50235023
{

src/pokemon.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5304,7 +5304,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
53045304
// Evolution stone
53055305
case 7:
53065306
{
5307-
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 2, item);
5307+
u16 targetSpecies = GetEvolutionTargetSpecies(mon, 2, item, SPECIES_NONE);
53085308

53095309
if (targetSpecies != SPECIES_NONE)
53105310
{
@@ -5669,7 +5669,7 @@ u8 GetNatureFromPersonality(u32 personality)
56695669
return personality % NUM_NATURES;
56705670
}
56715671

5672-
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
5672+
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem, u16 tradePartnerSpecies)
56735673
{
56745674
int i, j;
56755675
u16 targetSpecies = 0;
@@ -5857,6 +5857,10 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
58575857
targetSpecies = gEvolutionTable[species][i].targetSpecies;
58585858
}
58595859
break;
5860+
case EVO_TRADE_SPECIFIC_MON:
5861+
if (gEvolutionTable[species][i].param == tradePartnerSpecies)
5862+
targetSpecies = gEvolutionTable[species][i].targetSpecies;
5863+
break;
58605864
}
58615865
}
58625866
break;

src/trade.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3735,7 +3735,7 @@ static bool8 AnimateTradeSequenceCable(void)
37353735
case 72: // Only if in-game trade
37363736
TradeMons(gSpecialVar_0x8005, 0);
37373737
gCB2_AfterEvolution = CB2_UpdateInGameTrade;
3738-
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE);
3738+
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE, GetMonData(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PARTNER]], MON_DATA_SPECIES));
37393739
if (evoTarget != SPECIES_NONE)
37403740
{
37413741
TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], evoTarget, sTradeData->pokePicSpriteIdxs[TRADE_PARTNER], gSelectedTradeMonPositions[TRADE_PLAYER]);
@@ -4250,7 +4250,7 @@ static bool8 AnimateTradeSequenceWireless(void)
42504250
case 72: // Only if in-game trade
42514251
TradeMons(gSpecialVar_0x8005, 0);
42524252
gCB2_AfterEvolution = CB2_UpdateInGameTrade;
4253-
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE);
4253+
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE, GetMonData(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PARTNER]], MON_DATA_SPECIES));
42544254
if (evoTarget != SPECIES_NONE)
42554255
{
42564256
TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], evoTarget, sTradeData->pokePicSpriteIdxs[TRADE_PARTNER], gSelectedTradeMonPositions[TRADE_PLAYER]);
@@ -4293,7 +4293,7 @@ static void CB2_TryTradeEvolution(void)
42934293
break;
42944294
case 4:
42954295
gCB2_AfterEvolution = CB2_SaveAndEndTrade;
4296-
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE);
4296+
evoTarget = GetEvolutionTargetSpecies(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], TRUE, ITEM_NONE, GetMonData(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PARTNER]], MON_DATA_SPECIES));
42974297
if (evoTarget != SPECIES_NONE)
42984298
TradeEvolutionScene(&gPlayerParty[gSelectedTradeMonPositions[TRADE_PLAYER]], evoTarget, sTradeData->pokePicSpriteIdxs[TRADE_PARTNER], gSelectedTradeMonPositions[TRADE_PLAYER]);
42994299
else if (IsWirelessTrade())

0 commit comments

Comments
 (0)