mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-19 08:53:28 +00:00
ef3cb34387
* Make EvolutionCriteria struct 8 bytes per object instead of 26 Unify LevelMin/LevelMax to match EncounterTemplate bubble up precise array type for better iteration * Inline queue operations, less allocation * Inline some logic * Update EvolutionChain.cs * Improve clarity on duplicate move check * Search reverse For a dual stage chain, finds it first iteration rather than second.
56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
namespace PKHeX.Core
|
||
{
|
||
/// <summary>
|
||
/// Generation 5 Static Encounter from N
|
||
/// </summary>
|
||
/// <inheritdoc cref="EncounterStatic"/>
|
||
internal sealed record EncounterStatic5N : EncounterStatic5
|
||
{
|
||
public readonly uint PID;
|
||
public const bool NSparkle = true;
|
||
|
||
internal EncounterStatic5N(uint pid) : base(GameVersion.B2W2)
|
||
{
|
||
Shiny = Shiny.FixedValue;
|
||
PID = pid;
|
||
}
|
||
|
||
protected override void SetPINGA(PKM pk, EncounterCriteria criteria)
|
||
{
|
||
int gender = criteria.GetGender(PKX.GetGenderFromPID(Species, PID), pk.PersonalInfo);
|
||
int nature = (int)Nature;
|
||
int ability = Ability.IsSingleValue(out var index) ? index : 0;
|
||
|
||
pk.PID = PID;
|
||
pk.Gender = gender;
|
||
SetIVs(pk);
|
||
|
||
pk.Nature = nature;
|
||
pk.RefreshAbility(ability);
|
||
}
|
||
|
||
public override bool IsMatchExact(PKM pkm, IDexLevel evo)
|
||
{
|
||
if (PID != pkm.PID)
|
||
return false;
|
||
return base.IsMatchExact(pkm, evo);
|
||
}
|
||
|
||
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
|
||
{
|
||
base.ApplyDetails(sav, criteria, pk);
|
||
SetNPokemonData((PK5)pk, pk.Language);
|
||
}
|
||
|
||
private static void SetNPokemonData(PK5 pk5, int lang)
|
||
{
|
||
pk5.IV_HP = pk5.IV_ATK = pk5.IV_DEF = pk5.IV_SPA = pk5.IV_SPD = pk5.IV_SPE = 30;
|
||
pk5.NPokémon = NSparkle;
|
||
pk5.OT_Name = GetOT(lang);
|
||
pk5.TID = 00002;
|
||
pk5.SID = 00000;
|
||
}
|
||
|
||
public static string GetOT(int lang) => lang == (int)LanguageID.Japanese ? "N" : "N";
|
||
}
|
||
}
|