mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 04:04:17 +01:00
implemented toggelable cancellation / multi-evo
This commit is contained in:
parent
8a0a2a5a39
commit
54163240d8
@ -1940,11 +1940,14 @@
|
|||||||
special CreateEventLegalEnemyMon
|
special CreateEventLegalEnemyMon
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
@ Attempts to trigger a special evolution method.
|
@ Attempts to trigger a special evolution method in the overworld.
|
||||||
@ 'evoMethod' is the evolution you want to trigger.
|
|
||||||
@ There may be other conditions required which are coded for in GetEvolutionTargetSpecies.
|
@ There may be other conditions required which are coded for in GetEvolutionTargetSpecies.
|
||||||
@ EX: tryspecialevo EVO_WATER_SCROLL will trigger an evolution for Kubfu.
|
@ EX: tryspecialevo EVO_WATER_SCROLL, FALSE, FALSE triggers Kubfu's EVO_WATER_SCROLL evolution
|
||||||
.macro tryspecialevo evoMethod:req
|
@ method, cannot be cancelled in the evolution scene, and will only evolve one Kubfu if there
|
||||||
|
@ are multiple in the player's party.
|
||||||
|
.macro tryspecialevo evoMethod:req, canStopEvo=TRUE, tryMultiple=TRUE
|
||||||
setvar VAR_0x8000, \evoMethod
|
setvar VAR_0x8000, \evoMethod
|
||||||
|
setvar VAR_0x8001, \canStopEvo
|
||||||
|
setvar VAR_0x8002, \tryMultiple
|
||||||
special TrySpecialOverworldEvo
|
special TrySpecialOverworldEvo
|
||||||
.endm
|
.endm
|
||||||
|
@ -535,3 +535,4 @@ gSpecials::
|
|||||||
def_special RemoveRecordsWindow
|
def_special RemoveRecordsWindow
|
||||||
def_special CloseDeptStoreElevatorWindow
|
def_special CloseDeptStoreElevatorWindow
|
||||||
def_special TrySetBattleTowerLinkType
|
def_special TrySetBattleTowerLinkType
|
||||||
|
def_special TrySpecialOverworldEvo
|
||||||
|
@ -507,11 +507,7 @@ const struct Evolution gEvolutionTable[NUM_SPECIES][EVOS_PER_MON] =
|
|||||||
[SPECIES_PONYTA_GALARIAN] = {{EVO_LEVEL, 40, SPECIES_RAPIDASH_GALARIAN}},
|
[SPECIES_PONYTA_GALARIAN] = {{EVO_LEVEL, 40, SPECIES_RAPIDASH_GALARIAN}},
|
||||||
[SPECIES_SLOWPOKE_GALARIAN] = {{EVO_ITEM, ITEM_NONE, SPECIES_SLOWBRO_GALARIAN},
|
[SPECIES_SLOWPOKE_GALARIAN] = {{EVO_ITEM, ITEM_NONE, SPECIES_SLOWBRO_GALARIAN},
|
||||||
{EVO_ITEM, ITEM_NONE, SPECIES_SLOWKING_GALARIAN}},
|
{EVO_ITEM, ITEM_NONE, SPECIES_SLOWKING_GALARIAN}},
|
||||||
#ifdef BATTLE_ENGINE
|
[SPECIES_FARFETCHD_GALARIAN] = {{EVO_CRITICAL_HITS, 3, SPECIES_SIRFETCHD}},
|
||||||
[SPECIES_FARFETCHD_GALARIAN] = {{EVO_CRITICAL_HITS, 3, SPECIES_SIRFETCHD}},
|
|
||||||
#else
|
|
||||||
[SPECIES_FARFETCHD_GALARIAN] = {{EVO_LEVEL, 0, SPECIES_SIRFETCHD}},
|
|
||||||
#endif
|
|
||||||
[SPECIES_MR_MIME_GALARIAN] = {{EVO_LEVEL, 42, SPECIES_MR_RIME}},
|
[SPECIES_MR_MIME_GALARIAN] = {{EVO_LEVEL, 42, SPECIES_MR_RIME}},
|
||||||
[SPECIES_CORSOLA_GALARIAN] = {{EVO_LEVEL, 38, SPECIES_CURSOLA}},
|
[SPECIES_CORSOLA_GALARIAN] = {{EVO_LEVEL, 38, SPECIES_CURSOLA}},
|
||||||
[SPECIES_ZIGZAGOON_GALARIAN] = {{EVO_LEVEL, 20, SPECIES_LINOONE_GALARIAN}},
|
[SPECIES_ZIGZAGOON_GALARIAN] = {{EVO_LEVEL, 20, SPECIES_LINOONE_GALARIAN}},
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#define LEVEL_UP_MOVE(lvl, moveLearned) {.move = moveLearned, .level = lvl}
|
#define LEVEL_UP_MOVE(lvl, moveLearned) {.move = moveLearned, .level = lvl}
|
||||||
#define LEVEL_UP_END (0xffff)
|
|
||||||
|
|
||||||
static const struct LevelUpMove sBulbasaurLevelUpLearnset[] = {
|
static const struct LevelUpMove sBulbasaurLevelUpLearnset[] = {
|
||||||
LEVEL_UP_MOVE( 1, MOVE_TACKLE),
|
LEVEL_UP_MOVE( 1, MOVE_TACKLE),
|
||||||
|
@ -66,6 +66,7 @@ static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
|
|||||||
static bool8 ShouldSkipFriendshipChange(void);
|
static bool8 ShouldSkipFriendshipChange(void);
|
||||||
static u8 SendMonToPC(struct Pokemon* mon);
|
static u8 SendMonToPC(struct Pokemon* mon);
|
||||||
static void RemoveIVIndexFromList(u8 *ivs, u8 selectedIv);
|
static void RemoveIVIndexFromList(u8 *ivs, u8 selectedIv);
|
||||||
|
void TrySpecialOverworldEvo();
|
||||||
|
|
||||||
EWRAM_DATA static u8 sLearningMoveTableID = 0;
|
EWRAM_DATA static u8 sLearningMoveTableID = 0;
|
||||||
EWRAM_DATA u8 gPlayerPartyCount = 0;
|
EWRAM_DATA u8 gPlayerPartyCount = 0;
|
||||||
@ -74,6 +75,7 @@ EWRAM_DATA struct Pokemon gPlayerParty[PARTY_SIZE] = {0};
|
|||||||
EWRAM_DATA struct Pokemon gEnemyParty[PARTY_SIZE] = {0};
|
EWRAM_DATA struct Pokemon gEnemyParty[PARTY_SIZE] = {0};
|
||||||
EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0};
|
EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0};
|
||||||
EWRAM_DATA static struct MonSpritesGfxManager *sMonSpritesGfxManagers[MON_SPR_GFX_MANAGERS_COUNT] = {NULL};
|
EWRAM_DATA static struct MonSpritesGfxManager *sMonSpritesGfxManagers[MON_SPR_GFX_MANAGERS_COUNT] = {NULL};
|
||||||
|
EWRAM_DATA static u8 sTriedEvolving = 0;
|
||||||
|
|
||||||
#include "data/battle_moves.h"
|
#include "data/battle_moves.h"
|
||||||
|
|
||||||
@ -6777,10 +6779,14 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s
|
|||||||
switch (gEvolutionTable[species][i].method)
|
switch (gEvolutionTable[species][i].method)
|
||||||
{
|
{
|
||||||
case EVO_SCRIPT_TRIGGER_DMG:
|
case EVO_SCRIPT_TRIGGER_DMG:
|
||||||
|
{
|
||||||
|
u16 currentHp = GetMonData(mon, MON_DATA_HP, NULL);
|
||||||
if (evolutionItem == EVO_SCRIPT_TRIGGER_DMG
|
if (evolutionItem == EVO_SCRIPT_TRIGGER_DMG
|
||||||
&& (GetMonData(mon, MON_DATA_MAX_HP, NULL) - GetMonData(mon, MON_DATA_HP, NULL) >= gEvolutionTable[species][i].param))
|
&& currentHp != 0
|
||||||
|
&& (GetMonData(mon, MON_DATA_MAX_HP, NULL) - currentHp >= gEvolutionTable[species][i].param))
|
||||||
targetSpecies = gEvolutionTable[species][i].targetSpecies;
|
targetSpecies = gEvolutionTable[species][i].targetSpecies;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case EVO_DARK_SCROLL:
|
case EVO_DARK_SCROLL:
|
||||||
if (evolutionItem == EVO_DARK_SCROLL)
|
if (evolutionItem == EVO_DARK_SCROLL)
|
||||||
targetSpecies = gEvolutionTable[species][i].targetSpecies;
|
targetSpecies = gEvolutionTable[species][i].targetSpecies;
|
||||||
@ -8469,19 +8475,36 @@ static void RemoveIVIndexFromList(u8 *ivs, u8 selectedIv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CB2_DoSpecialOverworldEvo(void)
|
||||||
|
{
|
||||||
|
TrySpecialOverworldEvo();
|
||||||
|
}
|
||||||
|
|
||||||
// Attempts to perform non-level/item related overworld evolutions; called by tryspecialevo command.
|
// Attempts to perform non-level/item related overworld evolutions; called by tryspecialevo command.
|
||||||
void TrySpecialOverworldEvo(void)
|
void TrySpecialOverworldEvo(void)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
u8 evoMethod = gSpecialVar_0x8000;
|
u8 evoMethod = gSpecialVar_0x8000;
|
||||||
|
u16 canStopEvo = gSpecialVar_0x8001;
|
||||||
|
u16 tryMultiple = gSpecialVar_0x8002;
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
u16 targetSpecies = GetEvolutionTargetSpecies(&gPlayerParty[i], EVO_MODE_OVERWORLD_SPECIAL, evoMethod, SPECIES_NONE);
|
u16 targetSpecies = GetEvolutionTargetSpecies(&gPlayerParty[i], EVO_MODE_OVERWORLD_SPECIAL, evoMethod, SPECIES_NONE);
|
||||||
if (targetSpecies != SPECIES_NONE)
|
if (targetSpecies != SPECIES_NONE && !(sTriedEvolving & gBitTable[i]))
|
||||||
{
|
{
|
||||||
gCB2_AfterEvolution = CB2_ReturnToField;
|
if (tryMultiple)
|
||||||
BeginEvolutionScene(&gPlayerParty[i], targetSpecies, TRUE, i);
|
{
|
||||||
|
gCB2_AfterEvolution = CB2_DoSpecialOverworldEvo;
|
||||||
|
sTriedEvolving |= gBitTable[i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
gCB2_AfterEvolution = CB2_ReturnToField;
|
||||||
|
BeginEvolutionScene(&gPlayerParty[i], targetSpecies, canStopEvo, i);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sTriedEvolving = 0;
|
||||||
|
SetMainCallback2(CB2_ReturnToField);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user