PKHeX/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5N.cs
Kurt 88830e0d00
Update from .NET Framework 4.6 to .NET 7 (#3729)
Updates from net46->net7, dropping support for mono in favor of using the latest runtime (along with the performance/API improvements). Releases will be posted as 64bit only for now.

Refactors a good amount of internal API methods to be more performant and more customizable for future updates & fixes.

Adds functionality for Batch Editor commands to `>`, `<` and <=/>=

TID/SID properties renamed to TID16/SID16 for clarity; other properties exposed for Gen7 / display variants.

Main window has a new layout to account for DPI scaling (8 point grid)

Fixed: Tatsugiri and Paldean Tauros now output Showdown form names as Showdown expects
Changed: Gen9 species now interact based on the confirmed National Dex IDs (closes #3724)
Fixed: Pokedex set all no longer clears species with unavailable non-base forms (closes #3720)
Changed: Hyper Training suggestions now apply for level 50 in SV. (closes #3714)
Fixed: B2/W2 hatched egg met locations exclusive to specific versions are now explicitly checked (closes #3691)
Added: Properties for ribbon/mark count (closes #3659)
Fixed: Traded SV eggs are now checked correctly (closes #3692)
2023-01-21 20:02:33 -08:00

55 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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(EntityGender.GetFromPID(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 pk, EvoCriteria evo)
{
if (PID != pk.PID)
return false;
return base.IsMatchExact(pk, evo);
}
protected override void ApplyDetails(ITrainerInfo tr, EncounterCriteria criteria, PKM pk)
{
base.ApplyDetails(tr, 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.NSparkle = NSparkle;
pk5.OT_Name = GetOT(lang);
pk5.TID16 = 00002;
pk5.SID16 = 00000;
}
public static string GetOT(int lang) => lang == (int)LanguageID.Japanese ? "" : "N";
}