Remove IsNative property

Not something worth retaining if we can check directly.
This commit is contained in:
Kurt 2024-05-11 16:20:12 -05:00
parent 326e790e4b
commit a33884895f
16 changed files with 15 additions and 18 deletions

View file

@ -62,10 +62,12 @@ public static class EncounterSuggestion
public static int GetSuggestedEncounterEggMetLevel(PKM pk)
{
if (pk is { IsNative: false, Generation: < 5 })
var gen = pk.Generation;
var format = pk.Format;
if (gen < 5 && gen != format)
return pk.CurrentLevel; // be generous with transfer conditions
if (pk.Format < 5) // and native
return pk.Format == 2 && pk.MetLocation != 0 ? 1 : 0;
if (format < 5) // and native
return format == 2 && pk.MetLocation != 0 ? 1 : 0;
return 1; // Gen5+
}

View file

@ -260,7 +260,7 @@ public sealed class NicknameVerifier : Verifier
break;
}
if (format == 5 && !pk.IsNative) // transfer
if (format == 5 && enc.Generation != 5) // transfer
{
if (canHaveAnyLanguage)
return !SpeciesName.IsNicknamedAnyLanguage(species, nickname, 4);

View file

@ -163,7 +163,7 @@ public sealed class PCD(byte[] Data)
return false;
if (wc.CurrentLevel != pk.MetLevel)
return false;
if (pk is { IsEgg: true, IsNative: false })
if (pk is { IsEgg: true, Format: not 4 })
return false;
}

View file

@ -413,7 +413,7 @@ public sealed class PGF(byte[] Data) : DataMysteryGift(Data), IRibbonSetEvent3,
return false; // can't be traded away for un-shiny
}
if (pk is { IsEgg: true, IsNative: false })
if (pk is { IsEgg: true, Format: not 5 })
return false;
}

View file

@ -580,7 +580,7 @@ public sealed class WB7(byte[] Data)
return false; // can't be traded away for unshiny
}
if (pk is { IsEgg: true, IsNative: false })
if (pk is { IsEgg: true, Context: not EntityContext.Gen7b })
return false;
}
else

View file

@ -664,7 +664,7 @@ public sealed class WB8(byte[] Data) : DataMysteryGift(Data),
return false; // can't be traded away for unshiny
}
if (pk is { IsEgg: true, IsNative: false })
if (pk is { IsEgg: true, Context: not EntityContext.Gen8b })
return false;
}
else

View file

@ -278,7 +278,7 @@ public sealed class WC3(GameVersion Version, bool Fateful = false)
if (FatefulEncounter != pk.FatefulEncounter && !IsEgg)
return false;
if (pk.IsNative)
if (pk.Format == 3)
{
if (hatchedEgg)
return true; // defer egg specific checks to later.

View file

@ -553,7 +553,7 @@ public sealed class WC6(byte[] Data) : DataMysteryGift(Data), IRibbonSetEvent3,
return false; // can't be traded away for unshiny
}
if (pk is { IsEgg: true, IsNative: false })
if (pk is { IsEgg: true, Format: not 6 })
return false;
}
else

View file

@ -593,7 +593,7 @@ public sealed class WC7(byte[] Data) : DataMysteryGift(Data), IRibbonSetEvent3,
return false; // can't be traded away for un-shiny
}
if (pk is { IsEgg: true, IsNative: false })
if (pk is { IsEgg: true, Format: not 7 })
return false;
}
else

View file

@ -704,7 +704,7 @@ public sealed class WC8(byte[] Data) : DataMysteryGift(Data), ILangNick, INature
return false; // can't be traded away for unshiny
}
if (pk is { IsEgg: true, IsNative: false })
if (pk is { IsEgg: true, Context: EntityContext.Gen8 })
return false;
}
else

View file

@ -713,7 +713,7 @@ public sealed class WC9(byte[] Data) : DataMysteryGift(Data), ILangNick, INature
return false; // can't be traded away for unshiny
}
if (pk is { IsEgg: true, IsNative: false })
if (pk is { IsEgg: true, Context: not EntityContext.Gen9 })
return false;
}
else

View file

@ -33,7 +33,6 @@ public sealed class PA8 : PKM, ISanityChecksum,
public IPermitRecord Permit => PersonalInfo;
public override EntityContext Context => EntityContext.Gen8a;
public override bool IsNative => LA;
public PA8() : base(PokeCrypto.SIZE_8APARTY) => AffixedRibbon = -1; // 00 would make it show Kalos Champion :)
public PA8(byte[] data) : base(DecryptParty(data)) { }

View file

@ -27,7 +27,6 @@ public sealed class PB8 : G8PKM
public override PersonalInfo8BDSP PersonalInfo => PersonalTable.BDSP.GetFormEntry(Species, Form);
public override IPermitRecord Permit => PersonalInfo;
public override bool IsNative => BDSP;
public override EntityContext Context => EntityContext.Gen8b;
public PB8()

View file

@ -28,7 +28,6 @@ public sealed class PK8 : G8PKM, IHandlerUpdate
public override PersonalInfo8SWSH PersonalInfo => PersonalTable.SWSH.GetFormEntry(Species, Form);
public override IPermitRecord Permit => PersonalInfo;
public override bool IsNative => SWSH;
public override EntityContext Context => EntityContext.Gen8;
public PK8() => AffixedRibbon = -1; // 00 would make it show Kalos Champion :)

View file

@ -26,7 +26,6 @@ public sealed class PK9 : PKM, ISanityChecksum, ITeraType, ITechRecord, IObedien
public override PersonalInfo9SV PersonalInfo => PersonalTable.SV.GetFormEntry(Species, Form);
public IPermitRecord Permit => PersonalInfo;
public override bool IsNative => SV;
public override EntityContext Context => EntityContext.Gen9;
public PK9() : base(PokeCrypto.SIZE_9PARTY)

View file

@ -553,7 +553,6 @@ public abstract class PKM : ISpeciesForm, ITrainerID32, IGeneration, IShiny, ILa
private int GetTradedEggLocation() => Locations.TradedEggLocation(Generation, Version);
public virtual bool IsUntraded => false;
public virtual bool IsNative => Generation == Format;
public bool IsOriginValid => Species <= MaxSpeciesID;
/// <summary>