PKHeX/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5N.cs
Kurt fc754b346b
File scoped namespaces (#3529)
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces)

Updates all the files, one less level of indentation.

Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
2022-06-18 11:04:24 -07: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.TID = 00002;
pk5.SID = 00000;
}
public static string GetOT(int lang) => lang == (int)LanguageID.Japanese ? "" : "N";
}