mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 04:23:12 +00:00
this is not that
clearer than before, yay
This commit is contained in:
parent
1854d172bd
commit
0303eada32
28 changed files with 37 additions and 37 deletions
|
@ -13,7 +13,7 @@ namespace PKHeX.Core
|
|||
/// <param name="max">Max record to set.</param>
|
||||
public static void SetRecordFlags(this PKM pk, bool value, int max = 100)
|
||||
{
|
||||
if (!(pk is PK8 pk8))
|
||||
if (pk is not PK8 pk8)
|
||||
return;
|
||||
for (int i = 0; i < max; i++)
|
||||
pk8.SetMoveRecordFlag(i, value);
|
||||
|
@ -32,7 +32,7 @@ namespace PKHeX.Core
|
|||
/// <param name="moves">Moves to set flags for. If a move is not a Technical Record, it is skipped.</param>
|
||||
public static void SetRecordFlags(this PKM pk, IEnumerable<int> moves)
|
||||
{
|
||||
if (!(pk is PK8 pk8))
|
||||
if (pk is not PK8 pk8)
|
||||
return;
|
||||
var permit = pk8.PersonalInfo.TMHM;
|
||||
foreach (var m in moves)
|
||||
|
@ -51,7 +51,7 @@ namespace PKHeX.Core
|
|||
/// <param name="pk">Pokémon to modify.</param>
|
||||
public static void SetRecordFlags(this PKM pk)
|
||||
{
|
||||
if (!(pk is PK8 pk8))
|
||||
if (pk is not PK8 pk8)
|
||||
return;
|
||||
var permit = pk8.PersonalInfo.TMHM;
|
||||
for (int i = 100; i < permit.Length; i++)
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace PKHeX.Core
|
|||
if (Previous != null)
|
||||
sub.NotifySlotOld(Previous);
|
||||
|
||||
if (!(slot is SlotInfoBox b) || sub.ViewIndex == b.Box)
|
||||
if (slot is not SlotInfoBox b || sub.ViewIndex == b.Box)
|
||||
sub.NotifySlotChanged(slot, type, pkm);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace PKHeX.Core
|
|||
|
||||
public override IEnumerable<EncounterSlot> GetMatchingSlots(PKM pkm, IReadOnlyList<EvoCriteria> chain)
|
||||
{
|
||||
if (!(pkm is ICaughtData2 pk2) || pk2.CaughtData == 0)
|
||||
if (pkm is not ICaughtData2 pk2 || pk2.CaughtData == 0)
|
||||
return GetSlotsFuzzy(chain);
|
||||
|
||||
if (pk2.Met_Location != Location)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
public override bool IsMatchDeferred(PKM pkm)
|
||||
{
|
||||
if (!(pkm is PK1 pk1))
|
||||
if (pkm is not PK1 pk1)
|
||||
return false;
|
||||
if (!pk1.Gen1_NotTradeback)
|
||||
return false;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace PKHeX.Core
|
|||
return base.IsMatchLocation(pkm);
|
||||
|
||||
// Met location is lost on transfer
|
||||
if (!(pkm is G4PKM pk4))
|
||||
if (pkm is not G4PKM pk4)
|
||||
return true;
|
||||
|
||||
var locs = GetRoamLocations(Species, pk4.EncounterType);
|
||||
|
|
|
@ -115,7 +115,7 @@ namespace PKHeX.Core
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!(pkm is PK1 pk1) || !pkm.Gen1_NotTradeback)
|
||||
if (pkm is not PK1 pk1 || !pkm.Gen1_NotTradeback)
|
||||
return true;
|
||||
|
||||
var req = GetInitialCatchRate();
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace PKHeX.Core
|
|||
if (gen < 0 && version > 0)
|
||||
gen = version.GetGeneration();
|
||||
|
||||
if (!(z is ILocation l))
|
||||
if (z is not ILocation l)
|
||||
return $"[Gen{gen}]\t";
|
||||
var loc = l.GetEncounterLocation(gen, (int)version);
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
var res = new CheckMoveResult[4];
|
||||
bool AllParsed() => res.All(z => z != null);
|
||||
var required = !(pkm is PK1 pk1) ? 1 : GBRestrictions.GetRequiredMoveCount(pk1, source.CurrentMoves, info, source.Base);
|
||||
var required = pkm is not PK1 pk1 ? 1 : GBRestrictions.GetRequiredMoveCount(pk1, source.CurrentMoves, info, source.Base);
|
||||
|
||||
// Special considerations!
|
||||
int reset = 0;
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace PKHeX.Core
|
|||
case LevelUpNatureLowKey when GetAmpLowKeyResult(pkm.Nature) != pkm.Form && !skipChecks:
|
||||
return false;
|
||||
|
||||
case LevelUpBeauty when !(pkm is IContestStats s) || s.CNT_Beauty < Argument:
|
||||
case LevelUpBeauty when pkm is not IContestStats s || s.CNT_Beauty < Argument:
|
||||
return skipChecks;
|
||||
case LevelUpMale when pkm.Gender != 0:
|
||||
return false;
|
||||
|
|
|
@ -437,7 +437,7 @@ namespace PKHeX
|
|||
|
||||
internal static bool IsTradedKadabraG1(PKM pkm)
|
||||
{
|
||||
if (!(pkm is PK1 pk1) || pk1.Species != (int)Species.Kadabra)
|
||||
if (pkm is not PK1 pk1 || pk1.Species != (int)Species.Kadabra)
|
||||
return false;
|
||||
if (pk1.TradebackStatus == TradebackType.WasTradeback)
|
||||
return true;
|
||||
|
|
|
@ -24,10 +24,10 @@ namespace PKHeX.Core
|
|||
pk.Language = info.Language;
|
||||
pk.Version = info.Game;
|
||||
|
||||
if (!(pk is IRegionOrigin tr))
|
||||
if (pk is not IRegionOrigin tr)
|
||||
return;
|
||||
|
||||
if (!(info is IRegionOrigin o))
|
||||
if (info is not IRegionOrigin o)
|
||||
return;
|
||||
tr.Country = o.Country;
|
||||
tr.Region = o.Region;
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace PKHeX.Core
|
|||
|
||||
public override void Verify(LegalityAnalysis data)
|
||||
{
|
||||
if (!(data.pkm is IRegionOrigin tr))
|
||||
if (data.pkm is not IRegionOrigin tr)
|
||||
return;
|
||||
var result = VerifyConsoleRegion(tr);
|
||||
data.AddLine(result);
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace PKHeX.Core
|
|||
case (int)Species.Spewpa:
|
||||
if (form > 17) // Fancy & Pokéball
|
||||
return GetInvalid(LFormVivillonEventPre);
|
||||
if (!(pkm is IRegionOrigin tr))
|
||||
if (pkm is not IRegionOrigin tr)
|
||||
break;
|
||||
if (!Vivillon3DS.IsPatternValid(form, (byte)tr.Country, (byte)tr.Region))
|
||||
data.AddLine(Get(LFormVivillonInvalid, Severity.Fishy));
|
||||
|
@ -129,7 +129,7 @@ namespace PKHeX.Core
|
|||
return GetInvalid(LFormVivillonInvalid);
|
||||
return GetValid(LFormVivillon);
|
||||
}
|
||||
if (!(pkm is IGeoTrack trv))
|
||||
if (pkm is not IGeoTrack trv)
|
||||
break;
|
||||
if (!Vivillon3DS.IsPatternValid(form, (byte)trv.Country, (byte)trv.Region))
|
||||
data.AddLine(Get(LFormVivillonInvalid, Severity.Fishy));
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace PKHeX.Core
|
|||
|
||||
private void VerifyOTAffection(LegalityAnalysis data, bool neverOT, int origin, PKM pkm)
|
||||
{
|
||||
if (!(pkm is IAffection a))
|
||||
if (pkm is not IAffection a)
|
||||
return;
|
||||
|
||||
if (origin < 6)
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace PKHeX.Core
|
|||
public override void Verify(LegalityAnalysis data)
|
||||
{
|
||||
var pkm = data.pkm;
|
||||
if (!(pkm is IHyperTrain t))
|
||||
if (pkm is not IHyperTrain t)
|
||||
return; // No Hyper Training before Gen7
|
||||
|
||||
if (!t.IsHyperTrained())
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace PKHeX.Core
|
|||
public override void Verify(LegalityAnalysis data)
|
||||
{
|
||||
var pkm = data.pkm;
|
||||
if (!(pkm is IRibbonIndex m))
|
||||
if (pkm is not IRibbonIndex m)
|
||||
return;
|
||||
|
||||
if (data.Info.Generation != 8)
|
||||
|
@ -108,7 +108,7 @@ namespace PKHeX.Core
|
|||
|
||||
private void VerifyAffixedRibbonMark(LegalityAnalysis data, IRibbonIndex m)
|
||||
{
|
||||
if (!(m is PK8 pk8))
|
||||
if (m is not PK8 pk8)
|
||||
return;
|
||||
|
||||
var affix = pk8.AffixedRibbon;
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace PKHeX.Core
|
|||
if (pkm.IsEgg)
|
||||
VerifyMiscEggCommon(data);
|
||||
|
||||
if (!(pkm is PK1 pk1))
|
||||
if (pkm is not PK1 pk1)
|
||||
return;
|
||||
|
||||
VerifyMiscG1Types(data, pk1);
|
||||
|
|
|
@ -413,7 +413,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static IEnumerable<RibbonResult> GetInvalidRibbonsEvent1(PKM pkm, IEncounterable enc)
|
||||
{
|
||||
if (!(pkm is IRibbonSetEvent3 set1))
|
||||
if (pkm is not IRibbonSetEvent3 set1)
|
||||
yield break;
|
||||
var names = set1.RibbonNames();
|
||||
var sb = set1.RibbonBits();
|
||||
|
@ -426,8 +426,8 @@ namespace PKHeX.Core
|
|||
{
|
||||
// only require national ribbon if no longer on origin game
|
||||
eb[1] = s.Version == GameVersion.XD
|
||||
? !(pkm is XK3 x) || x.RibbonNational
|
||||
: !(pkm is CK3 c) || c.RibbonNational;
|
||||
? pkm is not XK3 x || x.RibbonNational
|
||||
: pkm is not CK3 c || c.RibbonNational;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static IEnumerable<RibbonResult> GetInvalidRibbonsEvent2(PKM pkm, IEncounterable enc)
|
||||
{
|
||||
if (!(pkm is IRibbonSetEvent4 set2))
|
||||
if (pkm is not IRibbonSetEvent4 set2)
|
||||
yield break;
|
||||
var names = set2.RibbonNames();
|
||||
var sb = set2.RibbonBits();
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace PKHeX.Core
|
|||
|
||||
private void VerifyHOMETransfer(LegalityAnalysis data, PKM pkm)
|
||||
{
|
||||
if (!(pkm is IScaledSize s))
|
||||
if (pkm is not IScaledSize s)
|
||||
return;
|
||||
|
||||
if (pkm.LGPE || pkm.GO)
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace PKHeX.Core
|
|||
private static void AddLinesItem(MysteryGift gift, IBasicStrings strings, ICollection<string> result)
|
||||
{
|
||||
result.Add($"Item: {strings.Item[gift.ItemID]} (Quantity: {gift.Quantity})");
|
||||
if (!(gift is WC7 wc7))
|
||||
if (gift is not WC7 wc7)
|
||||
return;
|
||||
|
||||
for (var ind = 1; wc7.GetItem(ind) != 0; ind++)
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace PKHeX.Core
|
|||
/// <param name="IVs"><see cref="PKM.IVs"/> to use (if already known). Will fetch the current <see cref="PKM.IVs"/> if not provided.</param>
|
||||
public static void SetSuggestedHyperTrainingData(this PKM pkm, int[]? IVs = null)
|
||||
{
|
||||
if (!(pkm is IHyperTrain t))
|
||||
if (pkm is not IHyperTrain t)
|
||||
return;
|
||||
if (pkm.CurrentLevel < 100)
|
||||
{
|
||||
|
|
|
@ -304,7 +304,7 @@ namespace PKHeX.Core
|
|||
|
||||
protected override void SetPKM(PKM pkm)
|
||||
{
|
||||
if (!(pkm is CK3 pk))
|
||||
if (pkm is not CK3 pk)
|
||||
return;
|
||||
|
||||
if (pk.CurrentRegion == 0)
|
||||
|
|
|
@ -287,7 +287,7 @@ namespace PKHeX.Core
|
|||
|
||||
protected override void SetPKM(PKM pkm)
|
||||
{
|
||||
if (!(pkm is XK3 pk))
|
||||
if (pkm is not XK3 pk)
|
||||
return; // shouldn't ever hit
|
||||
|
||||
if (pk.CurrentRegion == 0)
|
||||
|
|
|
@ -455,7 +455,7 @@ namespace PKHeX.Core
|
|||
byte[] cardMatch = new byte[8];
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (!(value[i] is PGT pgt))
|
||||
if (value[i] is not PGT pgt)
|
||||
continue;
|
||||
|
||||
if (pgt.CardType == 0) // empty
|
||||
|
@ -467,7 +467,7 @@ namespace PKHeX.Core
|
|||
cardMatch[i] = pgt.Slot = 3;
|
||||
for (byte j = 0; j < 3; j++)
|
||||
{
|
||||
if (!(value[8 + j] is PCD pcd))
|
||||
if (value[8 + j] is not PCD pcd)
|
||||
continue;
|
||||
|
||||
// Check if data matches (except Slot @ 0x02)
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace PKHeX.Core
|
|||
|
||||
foreach (var pair in pz)
|
||||
{
|
||||
if (!(ReflectUtil.GetValue(this, pair) is FlagPairG1 p))
|
||||
if (ReflectUtil.GetValue(this, pair) is not FlagPairG1 p)
|
||||
continue;
|
||||
yield return new FlagPairG1Detail(p, pair, EventFlags, SpawnFlags);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace PKHeX.Core
|
|||
|
||||
if (wc6.CardID == 2048 && wc6.ItemID == 726) // Eon Ticket (OR/AS)
|
||||
{
|
||||
if (!(SAV is SAV6AO ao))
|
||||
if (SAV is not SAV6AO ao)
|
||||
return;
|
||||
// Set the special received data
|
||||
var info = ao.Blocks.Sango;
|
||||
|
|
|
@ -147,7 +147,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (!SaveUtil.GetSavesFromFolder(folder, true, out IEnumerable<string> files))
|
||||
{
|
||||
if (!(files is string[] msg)) // should always return string[]
|
||||
if (files is not string[] msg) // should always return string[]
|
||||
continue;
|
||||
if (msg.Length == 0) // folder doesn't exist
|
||||
continue;
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace PKHeX.Core
|
|||
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
|
||||
{
|
||||
if (!(value is string input))
|
||||
if (value is not string input)
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
if (input.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
|
||||
input = input.Substring(2);
|
||||
|
|
Loading…
Reference in a new issue