Add Leader's Crest evolution method (#4768)

* Add Leader's Crest evolution method

* Fix typo in in HGSS dex

* Update src/pokedex_plus_hgss.c

Co-authored-by: sneed <56992013+Sneed69@users.noreply.github.com>

* Update src/battle_script_commands.c

---------

Co-authored-by: sneed <56992013+Sneed69@users.noreply.github.com>
Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
Bassoonian 2024-06-12 09:31:59 +02:00 committed by GitHub
parent 5fe0aee063
commit dffaaeaaa6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 30 additions and 1 deletions

View File

@ -1641,6 +1641,10 @@
callnative BS_TryUpdateRecoilTracker
.endm
.macro tryupdateleaderscresttracker
callnative BS_TryUpdateLeadersCrestTracker
.endm
.macro trytidyup clear:req, jumpInstr:req
callnative BS_TryTidyUp
.byte \clear

View File

@ -5477,6 +5477,7 @@ BattleScript_FaintAttacker::
BattleScript_FaintTarget::
tryillusionoff BS_TARGET
tryactivategulpmissile
tryupdateleaderscresttracker
playfaintcry BS_TARGET
pause B_WAIT_TIME_LONG
dofaintanimation BS_TARGET

View File

@ -296,6 +296,7 @@
#define EVO_RECOIL_DAMAGE_MALE 48 // Pokémon levels up after having suffered specified amount of non-fainting recoil damage as a male
#define EVO_RECOIL_DAMAGE_FEMALE 49 // Pokémon levels up after having suffered specified amount of non-fainting recoil damage as a female
#define EVO_ITEM_COUNT_999 50 // Pokémon levels up after trainer has collected 999 of a specific item
#define EVO_DEFEAT_WITH_ITEM 51 // Pokémon levels up after having defeat 3 Pokémon of the same species holding the specified item
// Evolution 'modes,' for GetEvolutionTargetSpecies
#define EVO_MODE_NORMAL 0

View File

@ -16914,6 +16914,11 @@ static void TryUpdateEvolutionTracker(u32 evolutionMethod, u32 upAmount, u16 use
val = 0;
SetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]], MON_DATA_EVOLUTION_TRACKER, &val);
break;
case EVO_DEFEAT_WITH_ITEM:
if (GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]], MON_DATA_SPECIES) == GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]], MON_DATA_SPECIES)
&& GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattlerTarget]], MON_DATA_HELD_ITEM) == evolutions[i].param)
SetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]], MON_DATA_EVOLUTION_TRACKER, &val);
break;
}
return;
}
@ -16939,6 +16944,13 @@ void BS_TryUpdateRecoilTracker(void)
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_TryUpdateLeadersCrestTracker(void)
{
NATIVE_ARGS();
TryUpdateEvolutionTracker(EVO_DEFEAT_WITH_ITEM, 1, MOVE_NONE);
gBattlescriptCurrInstr = cmd->nextInstr;
}
void BS_TryTidyUp(void)
{
NATIVE_ARGS(u8 clear, const u8 *jumpInstr);

View File

@ -9814,7 +9814,7 @@ const struct SpeciesInfo gSpeciesInfoGen5[] =
)
.levelUpLearnset = sBisharpLevelUpLearnset,
.teachableLearnset = sBisharpTeachableLearnset,
.evolutions = EVOLUTION({EVO_NONE, 0, SPECIES_KINGAMBIT}),
.evolutions = EVOLUTION({EVO_DEFEAT_WITH_ITEM, ITEM_LEADERS_CREST, SPECIES_KINGAMBIT}),
},
#if P_GEN_9_CROSS_EVOS

View File

@ -249,6 +249,7 @@ static const u8 sText_EVO_USE_MOVE_TWENTY_TIMES[] = _("{LV}{UP_ARROW} after 20x
static const u8 sText_EVO_RECOIL_DAMAGE_MALE[] = _("{LV}{UP_ARROW} with {STR_VAR_2} recoil, male");
static const u8 sText_EVO_RECOIL_DAMAGE_FEMALE[] = _("{LV}{UP_ARROW} with {STR_VAR_2} recoil, female");
static const u8 sText_EVO_ITEM_COUNT_999[] = _("{LV}{UP_ARROW} with 999 {STR_VAR_2} in bag");
static const u8 sText_EVO_DEFEAT_WITH_ITEM[] = _("{LV}{UP_ARROW} defeating {STR_VAR_3} holding {STR_VAR_2}");
static const u8 sText_EVO_UNKNOWN[] = _("Method unknown");
static const u8 sText_EVO_NONE[] = _("{STR_VAR_1} has no evolution.");
@ -6627,6 +6628,12 @@ static void PrintEvolutionTargetSpeciesAndMethod(u8 taskId, u16 species, u8 dept
CopyItemName(item, gStringVar2);
StringExpandPlaceholders(gStringVar4, sText_EVO_ITEM_COUNT_999);
break;
case EVO_DEFEAT_WITH_ITEM:
item = evolutions[i].param;
CopyItemName(item, gStringVar2);
StringCopy(gStringVar3, GetSpeciesName(species));
StringExpandPlaceholders(gStringVar4, sText_EVO_DEFEAT_WITH_ITEM);
break;
default:
StringExpandPlaceholders(gStringVar4, sText_EVO_UNKNOWN);
break;

View File

@ -4684,6 +4684,10 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem, s
if (evolutionTracker >= evolutions[i].param && GetMonGender(mon) == MON_FEMALE)
targetSpecies = evolutions[i].targetSpecies;
break;
case EVO_DEFEAT_WITH_ITEM:
if (evolutionTracker >= 3)
targetSpecies = evolutions[i].targetSpecies;
break;
}
}
break;