mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Simplify more expressions
This commit is contained in:
parent
ad48f4e909
commit
cc43550357
25 changed files with 102 additions and 116 deletions
|
@ -106,7 +106,7 @@ namespace PKHeX.Core
|
|||
return false;
|
||||
if (species == (int)Pichu)
|
||||
return false; // can't get Spiky Ear Pichu eggs
|
||||
if (species == (int)Sinistea || species == (int)Polteageist) // Antique = impossible
|
||||
if (species is (int)Sinistea or (int)Polteageist)
|
||||
return false; // can't get Antique eggs
|
||||
|
||||
return true;
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace PKHeX.Core
|
|||
return false;
|
||||
if (IVs.Count != 0 && !Legal.GetIsFixedIVSequenceValidNoRand(IVs, pkm))
|
||||
return false;
|
||||
if (pkm.Format == 2 && pkm.Met_Location is not 0 and not 126)
|
||||
if (pkm.Format == 2 && pkm.Met_Location is not (0 or 126))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -179,10 +179,12 @@ namespace PKHeX.Core
|
|||
// Leveling up Nincada in Gen3/4 levels up, evolves to Ninjask, applies moves for Ninjask, then spawns Shedinja with the current moveset.
|
||||
// Future games spawn the Shedinja before doing Ninjask moves, so this is a special case.
|
||||
// Can't get more than the evolved-at level move; >=2 special moves will get caught by the legality checker later.
|
||||
if (generation == 3)
|
||||
return moves.Concat(Legal.LevelUpE[(int)Species.Ninjask].GetMoves(100, 20));
|
||||
if (generation == 4)
|
||||
return moves.Concat(Legal.LevelUpPt[(int)Species.Ninjask].GetMoves(100, 20));
|
||||
return generation switch
|
||||
{
|
||||
3 => moves.Concat(Legal.LevelUpE [(int)Species.Ninjask].GetMoves(100, 20)),
|
||||
4 => moves.Concat(Legal.LevelUpPt[(int)Species.Ninjask].GetMoves(100, 20)),
|
||||
_ => moves
|
||||
};
|
||||
}
|
||||
return moves;
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ namespace PKHeX.Core
|
|||
private static bool GetChannelMatch(uint top, uint bot, uint[] IVs, out PIDIV pidiv, PKM pk)
|
||||
{
|
||||
var ver = pk.Version;
|
||||
if (ver is not (int) GameVersion.R and not (int) GameVersion.S)
|
||||
if (ver is not ((int)GameVersion.R or (int)GameVersion.S))
|
||||
return GetNonMatch(out pidiv);
|
||||
|
||||
var undo = top ^ 0x8000;
|
||||
|
@ -512,7 +512,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
// check for Azurill evolution edge case... 75% F-M is now 50% F-M; was this a F->M bend?
|
||||
int species = pk.Species;
|
||||
if (species is not (int)Species.Marill and not (int)Species.Azumarill)
|
||||
if (species is not ((int)Species.Marill or (int)Species.Azumarill))
|
||||
return false;
|
||||
|
||||
const int AzurillGenderRatio = 0xBF;
|
||||
|
@ -526,7 +526,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static bool GetColoStarterMatch(PKM pk, uint top, uint bot, uint[] IVs, out PIDIV pidiv)
|
||||
{
|
||||
if (pk.Version != (int)GameVersion.CXD || pk.Species is not (int)Species.Espeon and not (int)Species.Umbreon)
|
||||
if (pk.Version != (int)GameVersion.CXD || pk.Species is not ((int)Species.Espeon or (int)Species.Umbreon))
|
||||
return GetNonMatch(out pidiv);
|
||||
|
||||
var iv1 = GetIVChunk(IVs, 0);
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace PKHeX.Core
|
|||
private static void VerifyCXDStarterCorrelation(LegalityAnalysis data)
|
||||
{
|
||||
var pidiv = data.Info.PIDIV;
|
||||
if (pidiv.Type is not PIDType.CXD and not PIDType.CXDAnti)
|
||||
if (pidiv.Type is not (PIDType.CXD or PIDType.CXDAnti))
|
||||
return; // already flagged as invalid
|
||||
|
||||
var pkm = data.pkm;
|
||||
|
|
|
@ -122,11 +122,11 @@ namespace PKHeX.Core
|
|||
switch (pkm.Species)
|
||||
{
|
||||
case (int)Species.Celebi:
|
||||
if (loc is not Locations.Transfer4_CelebiUnused and not Locations.Transfer4_CelebiUsed)
|
||||
if (loc is not (Locations.Transfer4_CelebiUnused or Locations.Transfer4_CelebiUsed))
|
||||
data.AddLine(GetInvalid(LTransferMet));
|
||||
break;
|
||||
case (int)Species.Raikou or (int)Species.Entei or (int)Species.Suicune:
|
||||
if (loc is not Locations.Transfer4_CrownUnused and not Locations.Transfer4_CrownUsed)
|
||||
if (loc is not (Locations.Transfer4_CrownUnused or Locations.Transfer4_CrownUsed))
|
||||
data.AddLine(GetInvalid(LTransferMet));
|
||||
break;
|
||||
default:
|
||||
|
@ -214,7 +214,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
else if (pkm.Species == (int)Species.Unown)
|
||||
{
|
||||
if (pkm.Form is not 8 and not 21 && pkm.IsShiny) // impossibly form-shiny (not I or V)
|
||||
if (pkm.Form is not (8 or 21) && pkm.IsShiny) // impossibly form-shiny (not I or V)
|
||||
yield return GetInvalid(LEncStaticPIDShiny, CheckIdentifier.PID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static bool CanHaveDynamaxLevel(int species)
|
||||
{
|
||||
if (species == (int)Zacian)
|
||||
return false;
|
||||
if (species == (int)Zamazenta)
|
||||
return false;
|
||||
if (species == (int)Eternatus)
|
||||
return false;
|
||||
return true;
|
||||
return species is not ((int)Zacian or (int)Zamazenta or (int)Eternatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ namespace PKHeX.Core
|
|||
|
||||
var context = str.Except(FullToHalf);
|
||||
bool fullwidth = context.Select(c => c >> 12) // select the group the char belongs to
|
||||
.Any(c => c is not 0 and not 0xE /* Latin, Special Symbols */);
|
||||
.Any(c => c is not (0 or 0xE) /* Latin, Special Symbols */);
|
||||
|
||||
if (fullwidth) // jp/ko/zh strings
|
||||
return s; // keep as full width
|
||||
|
|
|
@ -27,21 +27,17 @@ namespace PKHeX.Core
|
|||
if (generation == 7 && Legal.Totem_USUM.Contains(species))
|
||||
return GetFormsTotem(species, types, forms);
|
||||
|
||||
if (species <= Legal.MaxSpeciesID_1)
|
||||
return GetFormsGen1(species, types, forms, generation);
|
||||
if (species <= Legal.MaxSpeciesID_2)
|
||||
return GetFormsGen2(species, types, forms, generation);
|
||||
if (species <= Legal.MaxSpeciesID_3)
|
||||
return GetFormsGen3(species, types, forms, generation);
|
||||
if (species <= Legal.MaxSpeciesID_4)
|
||||
return GetFormsGen4(species, types, forms, generation);
|
||||
if (species <= Legal.MaxSpeciesID_5)
|
||||
return GetFormsGen5(species, types, forms, generation);
|
||||
if (species <= Legal.MaxSpeciesID_6)
|
||||
return GetFormsGen6(species, types, forms, genders);
|
||||
if (species <= Legal.MaxSpeciesID_7_USUM)
|
||||
return GetFormsGen7(species, types, forms);
|
||||
return GetFormsGen8(species, types, forms, genders);
|
||||
return species switch
|
||||
{
|
||||
<= Legal.MaxSpeciesID_1 => GetFormsGen1(species, types, forms, generation),
|
||||
<= Legal.MaxSpeciesID_2 => GetFormsGen2(species, types, forms, generation),
|
||||
<= Legal.MaxSpeciesID_3 => GetFormsGen3(species, types, forms, generation),
|
||||
<= Legal.MaxSpeciesID_4 => GetFormsGen4(species, types, forms, generation),
|
||||
<= Legal.MaxSpeciesID_5 => GetFormsGen5(species, types, forms, generation),
|
||||
<= Legal.MaxSpeciesID_6 => GetFormsGen6(species, types, forms, genders),
|
||||
<= Legal.MaxSpeciesID_7_USUM => GetFormsGen7(species, types, forms),
|
||||
_ => GetFormsGen8(species, types, forms, genders)
|
||||
};
|
||||
}
|
||||
|
||||
// this is a hack; depends on currently loaded SaveFile's Game ID
|
||||
|
|
|
@ -235,7 +235,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
296 or 297 => metLevel != 30, // Makuhita 30 Colo 18 XD
|
||||
175 or 176 => metLevel != 20, // Togepi 20 Colo 25 XD, also 20 as Togetic in Colo
|
||||
179 or 180 or 181 => metLevel is not 37 and not 30, // Mareep: 37 Colo 17 XD, Flaafy: 30 Colo
|
||||
179 or 180 or 181 => metLevel is not (37 or 30), // Mareep: 37 Colo 17 XD, Flaafy: 30 Colo
|
||||
219 => metLevel != 30, // Magcargo 30 Colo 38 XD (Slugma in Colo)
|
||||
195 => metLevel != 30, // Quagsire 30 Colo // ** Wooper XD
|
||||
334 => metLevel != 33, // Altaria 33 Colo // 36 XD (Swablu in Colo)
|
||||
|
|
|
@ -141,7 +141,7 @@ namespace PKHeX.Core
|
|||
/// <returns>The resigned save data. Invalid input returns null.</returns>
|
||||
public static byte[] Resign7(byte[] sav7)
|
||||
{
|
||||
if (sav7.Length is not SaveUtil.SIZE_G7SM and not SaveUtil.SIZE_G7USUM)
|
||||
if (sav7.Length is not (SaveUtil.SIZE_G7SM or SaveUtil.SIZE_G7USUM))
|
||||
throw new ArgumentException("Should not be using this for unsupported saves.");
|
||||
|
||||
// Save Chunks are 0x200 bytes each; Memecrypto signature is 0x100 bytes into the 2nd to last chunk.
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
|
||||
public int GetBoxWallpaper(int box)
|
||||
{
|
||||
if ((uint)box > SAV.BoxCount)
|
||||
if ((uint)box >= SAV.BoxCount)
|
||||
return 0;
|
||||
return Data[GetBoxWallpaperOffset(box)];
|
||||
}
|
||||
|
||||
public void SetBoxWallpaper(int box, int value)
|
||||
{
|
||||
if ((uint)box > SAV.BoxCount)
|
||||
if ((uint)box >= SAV.BoxCount)
|
||||
return;
|
||||
Data[GetBoxWallpaperOffset(box)] = (byte)value;
|
||||
}
|
||||
|
|
|
@ -51,15 +51,12 @@ namespace PKHeX.Core
|
|||
public override int AppearPKM { get => BitConverter.ToUInt16(Data, 0x1E); set => BitConverter.GetBytes((ushort)(value == 0 ? 1 : value)).CopyTo(Data, 0x1E); }
|
||||
public override int MailType { get => BitConverter.ToUInt16(Data, 0x20); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x20); }
|
||||
|
||||
public override bool? IsEmpty
|
||||
public override bool? IsEmpty => MailType switch
|
||||
{
|
||||
get
|
||||
{
|
||||
if (MailType == 0) return true;
|
||||
else if (MailType >= 0x79 && MailType <= 0x84) return false;
|
||||
else return null;
|
||||
}
|
||||
}
|
||||
0 => true,
|
||||
>= 0x79 and <= 0x84 => false,
|
||||
_ => null
|
||||
};
|
||||
|
||||
public override void SetBlank() => (new Mail3()).Data.CopyTo(Data, 0);
|
||||
}
|
||||
|
|
|
@ -48,15 +48,12 @@ namespace PKHeX.Core
|
|||
public override ushort GetMessage(int index1, int index2) => BitConverter.ToUInt16(Data, 0x20 + (((index1 * 4) + index2) * 2));
|
||||
public override void SetMessage(int index1, int index2, ushort value) => BitConverter.GetBytes(value).CopyTo(Data, 0x20 + (((index1 * 4) + index2) * 2));
|
||||
|
||||
public override bool? IsEmpty
|
||||
public override bool? IsEmpty => MailType switch
|
||||
{
|
||||
get
|
||||
{
|
||||
if (MailType == 0xFF) return true;
|
||||
if (MailType <= 11) return false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
0xFF => true,
|
||||
<= 11 => false,
|
||||
_ => null
|
||||
};
|
||||
|
||||
public override void SetBlank() => SetBlank(0, 0);
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ namespace PKHeX.Core
|
|||
/// <returns>Version Identifier or Invalid if type cannot be determined.</returns>
|
||||
internal static GameVersion GetIsG1SAV(byte[] data)
|
||||
{
|
||||
if (data.Length is not SIZE_G1RAW and not SIZE_G1BAT)
|
||||
if (data.Length is not (SIZE_G1RAW or SIZE_G1BAT))
|
||||
return Invalid;
|
||||
|
||||
// Check if it's not an american save or a japanese save
|
||||
|
@ -251,7 +251,7 @@ namespace PKHeX.Core
|
|||
/// <returns>Version Identifier or Invalid if type cannot be determined.</returns>
|
||||
internal static GameVersion GetIsG3SAV(byte[] data)
|
||||
{
|
||||
if (data.Length is not SIZE_G3RAW and not SIZE_G3RAWHALF)
|
||||
if (data.Length is not (SIZE_G3RAW or SIZE_G3RAWHALF))
|
||||
return Invalid;
|
||||
|
||||
// check the save file(s)
|
||||
|
@ -287,7 +287,7 @@ namespace PKHeX.Core
|
|||
/// <returns>Version Identifier or Invalid if type cannot be determined.</returns>
|
||||
internal static GameVersion GetIsG3BOXSAV(byte[] data)
|
||||
{
|
||||
if (data.Length is not SIZE_G3BOX and not SIZE_G3BOXGCI)
|
||||
if (data.Length is not (SIZE_G3BOX or SIZE_G3BOXGCI))
|
||||
return Invalid;
|
||||
|
||||
byte[] sav = data;
|
||||
|
@ -312,7 +312,7 @@ namespace PKHeX.Core
|
|||
/// <returns>Version Identifier or Invalid if type cannot be determined.</returns>
|
||||
internal static GameVersion GetIsG3COLOSAV(byte[] data)
|
||||
{
|
||||
if (data.Length is not SIZE_G3COLO and not SIZE_G3COLOGCI)
|
||||
if (data.Length is not (SIZE_G3COLO or SIZE_G3COLOGCI))
|
||||
return Invalid;
|
||||
|
||||
// Check the intro bytes for each save slot
|
||||
|
@ -331,7 +331,7 @@ namespace PKHeX.Core
|
|||
/// <returns>Version Identifier or Invalid if type cannot be determined.</returns>
|
||||
internal static GameVersion GetIsG3XDSAV(byte[] data)
|
||||
{
|
||||
if (data.Length is not SIZE_G3XD and not SIZE_G3XDGCI)
|
||||
if (data.Length is not (SIZE_G3XD or SIZE_G3XDGCI))
|
||||
return Invalid;
|
||||
|
||||
// Check the intro bytes for each save slot
|
||||
|
@ -416,17 +416,18 @@ namespace PKHeX.Core
|
|||
/// <returns>Version Identifier or Invalid if type cannot be determined.</returns>
|
||||
private static GameVersion GetIsG6SAV(byte[] data)
|
||||
{
|
||||
if (data.Length is not SIZE_G6XY and not SIZE_G6ORAS and not SIZE_G6ORASDEMO)
|
||||
if (data.Length is not (SIZE_G6XY or SIZE_G6ORAS or SIZE_G6ORASDEMO))
|
||||
return Invalid;
|
||||
|
||||
if (BitConverter.ToUInt32(data, data.Length - 0x1F0) != BEEF)
|
||||
return Invalid;
|
||||
|
||||
if (data.Length == SIZE_G6XY)
|
||||
return XY;
|
||||
if (data.Length == SIZE_G6ORAS)
|
||||
return ORAS;
|
||||
return ORASDEMO; // least likely
|
||||
return data.Length switch
|
||||
{
|
||||
SIZE_G6XY => XY,
|
||||
SIZE_G6ORAS => ORAS,
|
||||
_ => ORASDEMO // least likely
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Checks to see if the data belongs to a Gen7 save</summary>
|
||||
|
@ -434,7 +435,7 @@ namespace PKHeX.Core
|
|||
/// <returns>Version Identifier or Invalid if type cannot be determined.</returns>
|
||||
private static GameVersion GetIsG7SAV(byte[] data)
|
||||
{
|
||||
if (data.Length is not SIZE_G7SM and not SIZE_G7USUM)
|
||||
if (data.Length is not (SIZE_G7SM or SIZE_G7USUM))
|
||||
return Invalid;
|
||||
|
||||
if (BitConverter.ToUInt32(data, data.Length - 0x1F0) != BEEF)
|
||||
|
|
|
@ -315,16 +315,13 @@ namespace PKHeX.WinForms.Controls
|
|||
EVTip.SetToolTip(TB_EVTotal, $"Remaining: {510 - evtotal}");
|
||||
}
|
||||
|
||||
private Color GetEVTotalColor(int evtotal, Color defaultColor)
|
||||
private Color GetEVTotalColor(int evtotal, Color defaultColor) => evtotal switch
|
||||
{
|
||||
if (evtotal > 510) // Background turns Red
|
||||
return EVsInvalid;
|
||||
if (evtotal == 510) // Maximum EVs
|
||||
return EVsMaxed;
|
||||
if (evtotal == 508) // Fishy EVs
|
||||
return EVsFishy;
|
||||
return defaultColor;
|
||||
}
|
||||
> 510 => EVsInvalid, // Background turns Red
|
||||
510 => EVsMaxed, // Maximum EVs
|
||||
508 => EVsFishy, // Fishy EVs
|
||||
_ => defaultColor
|
||||
};
|
||||
|
||||
public void UpdateStats()
|
||||
{
|
||||
|
|
|
@ -102,14 +102,12 @@ namespace PKHeX.WinForms.Controls
|
|||
Format = format;
|
||||
}
|
||||
|
||||
private IEnumerable<Control> GetControlsForFormat(int format)
|
||||
private IEnumerable<Control> GetControlsForFormat(int format) => format switch
|
||||
{
|
||||
if (format >= 7)
|
||||
return new Control[] { Label_SID, TB_SID7, Label_TID, TB_TID7 };
|
||||
if (format >= 3)
|
||||
return new Control[] { Label_TID, TB_TID, Label_SID, TB_SID };
|
||||
return new Control[] { Label_TID, TB_TID };
|
||||
}
|
||||
>= 7 => new Control[] {Label_SID, TB_SID7, Label_TID, TB_TID7},
|
||||
>= 3 => new Control[] {Label_TID, TB_TID, Label_SID, TB_SID },
|
||||
_ => new Control[] {Label_TID, TB_TID} // Gen1/2
|
||||
};
|
||||
|
||||
private void UpdateTSV(object sender, EventArgs e) => UpdateTSV();
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ namespace PKHeX.WinForms
|
|||
int gt = SAV.Personal[index].Gender;
|
||||
|
||||
CHK_P2.Checked = CHK_P4.Checked = gt != 254 && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not 0 and not 255 && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not (0 or 255) && ModifierKeys != Keys.Control;
|
||||
|
||||
if (ModifierKeys == Keys.Control)
|
||||
{
|
||||
|
@ -305,7 +305,7 @@ namespace PKHeX.WinForms
|
|||
if (mnuComplete == sender)
|
||||
{
|
||||
CHK_P2.Checked = CHK_P4.Checked = gt != 254; // not female only
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not 0 and not 255; // not male only or genderless
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not (0 or 255); // not male only or genderless
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -383,12 +383,12 @@ namespace PKHeX.WinForms
|
|||
|
||||
private void SetGenderLabel(int gender)
|
||||
{
|
||||
if (gender == 0)
|
||||
Label_Gender.Text = gendersymbols[0]; // Male
|
||||
else if (gender == 1)
|
||||
Label_Gender.Text = gendersymbols[1]; // Female
|
||||
else
|
||||
Label_Gender.Text = gendersymbols[2]; // Genderless
|
||||
Label_Gender.Text = gender switch
|
||||
{
|
||||
0 => gendersymbols[0], // M
|
||||
1 => gendersymbols[1], // F
|
||||
_ => gendersymbols[2] // -
|
||||
};
|
||||
|
||||
Write_Entry(this, EventArgs.Empty);
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ namespace PKHeX.WinForms
|
|||
int gt = SAV.Personal[index].Gender;
|
||||
|
||||
CHK_P2.Checked = CHK_P4.Checked = gt != 254 && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not 0 and not 255 && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not (0 or 255) && ModifierKeys != Keys.Control;
|
||||
|
||||
if (ModifierKeys == Keys.Control)
|
||||
{
|
||||
|
@ -318,7 +318,7 @@ namespace PKHeX.WinForms
|
|||
if (mnuComplete == sender)
|
||||
{
|
||||
CHK_P2.Checked = CHK_P4.Checked = gt != 254; // not female only
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not 0 and not 255; // not male only or genderless
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not (0 or 255); // not male only or genderless
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -232,7 +232,7 @@ namespace PKHeX.WinForms
|
|||
int gt = SAV.Personal[index].Gender;
|
||||
|
||||
CHK_P2.Checked = CHK_P4.Checked = gt != 254 && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not 0 and not 255 && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not (0 or 255) && ModifierKeys != Keys.Control;
|
||||
|
||||
if (ModifierKeys == Keys.Control)
|
||||
{
|
||||
|
@ -310,7 +310,7 @@ namespace PKHeX.WinForms
|
|||
if (mnuComplete == sender)
|
||||
{
|
||||
CHK_P2.Checked = CHK_P4.Checked = gt != 254; // not female only
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not 0 and not 255; // not male only or genderless
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not (0 or 255); // not male only or genderless
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -195,15 +195,19 @@ namespace PKHeX.WinForms
|
|||
|
||||
private int TypeIndexToType(int typeIndex)
|
||||
{
|
||||
if ((uint)typeIndex > typeMAX + 1) return -1;
|
||||
if (typeIndex < 0x0F) return 0;
|
||||
if (typeIndex < 0x1E) return 1;
|
||||
if (typeIndex < 0x2F) return 2;
|
||||
if (typeIndex < 0x41) return 3;
|
||||
if (typeIndex < 0x50) return 4;
|
||||
if (typeIndex < 0x65) return 5;
|
||||
if (typeIndex < 0x7D) return 6;
|
||||
return 7;
|
||||
if ((uint)typeIndex > typeMAX + 1)
|
||||
return -1;
|
||||
return typeIndex switch
|
||||
{
|
||||
< 0x0F => 0,
|
||||
< 0x1E => 1,
|
||||
< 0x2F => 2,
|
||||
< 0x41 => 3,
|
||||
< 0x50 => 4,
|
||||
< 0x65 => 5,
|
||||
< 0x7D => 6,
|
||||
_ => 7
|
||||
};
|
||||
}
|
||||
|
||||
private int GetColorCount(int i) =>
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace PKHeX.WinForms
|
|||
int gt = Dex.GetBaseSpeciesGenderValue(LB_Species.SelectedIndex);
|
||||
|
||||
CHK_P2.Enabled = CHK_P4.Enabled = CHK_P6.Enabled = CHK_P8.Enabled = gt != 254; // Not Female-Only
|
||||
CHK_P3.Enabled = CHK_P5.Enabled = CHK_P7.Enabled = CHK_P9.Enabled = gt is not 0 and not 255; // Not Male-Only and Not Genderless
|
||||
CHK_P3.Enabled = CHK_P5.Enabled = CHK_P7.Enabled = CHK_P9.Enabled = gt is not (0 or 255); // Not Male-Only and Not Genderless
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
CP[i + 1].Checked = Dex.GetSeen(currentSpecies, i);
|
||||
|
@ -339,7 +339,7 @@ namespace PKHeX.WinForms
|
|||
int gt = Dex.GetBaseSpeciesGenderValue(LB_Species.SelectedIndex);
|
||||
|
||||
CHK_P2.Checked = CHK_P4.Checked = gt != 254 && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not 0 and not 255 && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not (0 or 255) && ModifierKeys != Keys.Control;
|
||||
|
||||
if (ModifierKeys == Keys.Control)
|
||||
{
|
||||
|
|
|
@ -206,7 +206,7 @@ namespace PKHeX.WinForms
|
|||
int gt = Dex.GetBaseSpeciesGenderValue(LB_Species.SelectedIndex);
|
||||
|
||||
CHK_P2.Enabled = CHK_P4.Enabled = CHK_P6.Enabled = CHK_P8.Enabled = gt != 254; // Not Female-Only
|
||||
CHK_P3.Enabled = CHK_P5.Enabled = CHK_P7.Enabled = CHK_P9.Enabled = gt is not 0 and not 255; // Not Male-Only and Not Genderless
|
||||
CHK_P3.Enabled = CHK_P5.Enabled = CHK_P7.Enabled = CHK_P9.Enabled = gt is not (0 or 255); // Not Male-Only and Not Genderless
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
CP[i + 1].Checked = Dex.GetSeen(currentSpecies, i);
|
||||
|
@ -277,7 +277,7 @@ namespace PKHeX.WinForms
|
|||
int gt = Dex.GetBaseSpeciesGenderValue(LB_Species.SelectedIndex);
|
||||
|
||||
CHK_P2.Checked = CHK_P4.Checked = gt != 254 && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not 0 and not 255 && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = gt is not (0 or 255) && ModifierKeys != Keys.Control;
|
||||
|
||||
if (ModifierKeys == Keys.Control)
|
||||
{
|
||||
|
|
|
@ -270,13 +270,13 @@ namespace PKHeX.WinForms
|
|||
if (HaX)
|
||||
return pouch.MaxCount;
|
||||
|
||||
// Cap at absolute maximum
|
||||
if (sav.Generation <= 2)
|
||||
return byte.MaxValue;
|
||||
if (sav.Generation >= 7)
|
||||
return pouch.MaxCount;
|
||||
// if (SAV.Generation >= 3)
|
||||
return ushort.MaxValue;
|
||||
return sav.Generation switch
|
||||
{
|
||||
// Cap at absolute maximum
|
||||
<= 2 => byte.MaxValue,
|
||||
>= 7 => pouch.MaxCount,
|
||||
_ => ushort.MaxValue
|
||||
};
|
||||
}
|
||||
|
||||
// Initialize String Tables
|
||||
|
|
Loading…
Reference in a new issue