PKHeX/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic5N.cs
Kurt 1524093099 Revise g5 pid bit check for forced PID statics
Closes #3027

Roamers: Get PID generated externally
NPokemon: Get PID from a fixed value
Forced (Anti)Shiny: Get PID altered

Thanks @LegoFigure11 && Princess Emily (discord 4650) !
2020-10-12 11:04:29 -07:00

52 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
{
internal sealed class EncounterStatic5N : EncounterStatic5
{
public readonly uint PID;
public const bool NSparkle = true;
internal EncounterStatic5N(uint pid)
{
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;
pk.PID = PID;
pk.Gender = gender;
SetIVs(pk);
pk.Nature = nature;
pk.RefreshAbility(ability >> 1);
}
public override bool IsMatch(PKM pkm, DexLevel evo)
{
if (PID != pkm.PID)
return false;
return base.IsMatch(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";
}
}