PKHeX/PKHeX.Core/Legality/Encounters/EncounterTrade/EncounterTrade4PID.cs

39 lines
1.1 KiB
C#
Raw Normal View History

2018-03-09 05:18:32 +00:00
namespace PKHeX.Core
{
public sealed class EncounterTrade4PID : EncounterTrade
2018-03-09 05:18:32 +00:00
{
/// <summary>
/// Fixed <see cref="PKM.PID"/> value the encounter must have.
/// </summary>
public readonly uint PID;
public EncounterTrade4PID(uint pid) => PID = pid;
public override Shiny Shiny { get; set; } = Shiny.FixedValue;
protected override void SetPINGA(PKM pk, EncounterCriteria criteria)
{
2020-06-21 23:16:34 +00:00
var pi = pk.PersonalInfo;
int gender = criteria.GetGender(PKX.GetGenderFromPID(Species, PID), pi);
int nature = (int)criteria.GetNature(Nature);
int ability = criteria.GetAbilityFromNumber(Ability, pi);
pk.PID = PID;
pk.Nature = nature;
pk.Gender = gender;
pk.RefreshAbility(ability);
SetIVs(pk);
}
2019-11-16 01:34:18 +00:00
protected override bool IsMatchNatureGenderShiny(PKM pkm)
{
return PID == pkm.EncryptionConstant;
2019-11-16 01:34:18 +00:00
}
2018-03-09 05:18:32 +00:00
}
public sealed class EncounterTrade4 : EncounterTrade
{
}
}