mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 04:23:12 +00:00
More switch expressions
This commit is contained in:
parent
4d0108331a
commit
95e3337f2c
10 changed files with 143 additions and 240 deletions
|
@ -2,6 +2,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using static PKHeX.Core.GameVersion;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -53,19 +55,13 @@ namespace PKHeX.Core
|
|||
|
||||
public static int GetSuggestedEncounterEggLocationEgg(int generation, bool traded = false)
|
||||
{
|
||||
switch (generation)
|
||||
return generation switch
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
return 0;
|
||||
case 4:
|
||||
return traded ? Locations.LinkTrade4 : Locations.Daycare4;
|
||||
case 5:
|
||||
return traded ? Locations.LinkTrade5 : Locations.Daycare5;
|
||||
default:
|
||||
return traded ? Locations.LinkTrade6 : Locations.Daycare5;
|
||||
}
|
||||
1 or 2 or 3 => 0,
|
||||
4 => traded ? Locations.LinkTrade4 : Locations.Daycare4,
|
||||
5 => traded ? Locations.LinkTrade5 : Locations.Daycare5,
|
||||
_ => traded ? Locations.LinkTrade6 : Locations.Daycare5,
|
||||
};
|
||||
}
|
||||
|
||||
private static EncounterSuggestionData GetSuggestedEncounterWild(PKM pkm, EncounterSlot first, int loc = -1)
|
||||
|
@ -87,59 +83,31 @@ namespace PKHeX.Core
|
|||
public static int GetSuggestedEggMetLocation(PKM pkm)
|
||||
{
|
||||
// Return one of legal hatch locations for game
|
||||
switch ((GameVersion)pkm.Version)
|
||||
return ((GameVersion)pkm.Version) switch
|
||||
{
|
||||
case GameVersion.R:
|
||||
case GameVersion.S:
|
||||
case GameVersion.E:
|
||||
case GameVersion.FR:
|
||||
case GameVersion.LG:
|
||||
return pkm.Format switch
|
||||
{
|
||||
3 => (pkm.FRLG ? Locations.HatchLocationFRLG : Locations.HatchLocationRSE),
|
||||
4 => Locations.Transfer3, // Pal Park
|
||||
_ => Locations.Transfer4,
|
||||
};
|
||||
R or S or E or FR or LG => pkm.Format switch
|
||||
{
|
||||
3 => (pkm.FRLG ? Locations.HatchLocationFRLG : Locations.HatchLocationRSE),
|
||||
4 => Locations.Transfer3, // Pal Park
|
||||
_ => Locations.Transfer4,
|
||||
},
|
||||
|
||||
case GameVersion.D:
|
||||
case GameVersion.P:
|
||||
case GameVersion.Pt:
|
||||
return pkm.Format > 4 ? Locations.Transfer4 /* Transporter */ : Locations.HatchLocationDPPt;
|
||||
case GameVersion.HG:
|
||||
case GameVersion.SS:
|
||||
return pkm.Format > 4 ? Locations.Transfer4 /* Transporter */ : Locations.HatchLocationHGSS;
|
||||
D or P or Pt => pkm.Format > 4 ? Locations.Transfer4 : Locations.HatchLocationDPPt,
|
||||
HG or SS => pkm.Format > 4 ? Locations.Transfer4 : Locations.HatchLocationHGSS,
|
||||
|
||||
case GameVersion.B:
|
||||
case GameVersion.W:
|
||||
case GameVersion.B2:
|
||||
case GameVersion.W2:
|
||||
return Locations.HatchLocation5;
|
||||
B or W or B2 or W2 => Locations.HatchLocation5,
|
||||
|
||||
case GameVersion.X:
|
||||
case GameVersion.Y:
|
||||
return Locations.HatchLocation6XY;
|
||||
case GameVersion.AS:
|
||||
case GameVersion.OR:
|
||||
return Locations.HatchLocation6AO;
|
||||
X or Y => Locations.HatchLocation6XY,
|
||||
AS or OR => Locations.HatchLocation6AO,
|
||||
|
||||
case GameVersion.SN:
|
||||
case GameVersion.MN:
|
||||
case GameVersion.US:
|
||||
case GameVersion.UM:
|
||||
return Locations.HatchLocation7;
|
||||
SN or MN or US or UM => Locations.HatchLocation7,
|
||||
RD or BU or GN or Y => Locations.Transfer1,
|
||||
GD or SV or C => Locations.Transfer2,
|
||||
GSC or RBY => pkm.Met_Level == 0 ? 0 : Locations.HatchLocationC,
|
||||
|
||||
case GameVersion.SW:
|
||||
case GameVersion.SH:
|
||||
return Locations.HatchLocation8;
|
||||
|
||||
case GameVersion.GD:
|
||||
case GameVersion.SV:
|
||||
case GameVersion.C:
|
||||
case GameVersion.GSC:
|
||||
case GameVersion.RBY:
|
||||
return pkm.Format > 2 ? Locations.Transfer2 : pkm.Met_Level == 0 ? 0 : Locations.HatchLocationC;
|
||||
}
|
||||
return -1;
|
||||
SW or SH => Locations.HatchLocation8,
|
||||
_ => -1,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -151,7 +119,7 @@ namespace PKHeX.Core
|
|||
/// </remarks>
|
||||
public static int GetSuggestedTransferLocation(PKM pkm)
|
||||
{
|
||||
if (pkm.Version == (int)GameVersion.GO)
|
||||
if (pkm.Version == (int)GO)
|
||||
return Locations.GO8;
|
||||
if (pkm.HasOriginalMetLocation)
|
||||
return -1;
|
||||
|
|
|
@ -282,18 +282,12 @@ namespace PKHeX.Core
|
|||
|
||||
private int GetAbilityIndex(EncounterCriteria criteria, PersonalInfo pi)
|
||||
{
|
||||
switch (AbilityType)
|
||||
return AbilityType switch
|
||||
{
|
||||
case 00: // 0 - 0
|
||||
case 01: // 1 - 1
|
||||
case 02: // 2 - H
|
||||
return AbilityType;
|
||||
case 03: // 0/1
|
||||
case 04: // 0/1/H
|
||||
return criteria.GetAbilityFromType(AbilityType, pi); // 3 or 2
|
||||
default:
|
||||
throw new ArgumentException(nameof(AbilityType));
|
||||
}
|
||||
00 or 01 or 02 => AbilityType, // Fixed 0/1/2
|
||||
03 or 04 => criteria.GetAbilityFromType(AbilityType, pi),// 0/1 or 0/1/H
|
||||
_ => throw new ArgumentException(nameof(AbilityType)),
|
||||
};
|
||||
}
|
||||
|
||||
private void SetPID(PKM pk, int av)
|
||||
|
|
|
@ -399,18 +399,12 @@ namespace PKHeX.Core
|
|||
|
||||
private int GetAbilityIndex(EncounterCriteria criteria, PersonalInfo pi)
|
||||
{
|
||||
switch (AbilityType)
|
||||
return AbilityType switch
|
||||
{
|
||||
case 00: // 0 - 0
|
||||
case 01: // 1 - 1
|
||||
case 02: // 2 - H
|
||||
return AbilityType;
|
||||
case 03: // 0/1
|
||||
case 04: // 0/1/H
|
||||
return criteria.GetAbilityFromType(AbilityType, pi); // 3 or 2
|
||||
default:
|
||||
throw new ArgumentException(nameof(AbilityType));
|
||||
}
|
||||
00 or 01 or 02 => AbilityType, // Fixed 0/1/2
|
||||
03 or 04 => criteria.GetAbilityFromType(AbilityType, pi),// 0/1 or 0/1/H
|
||||
_ => throw new ArgumentException(nameof(AbilityType)),
|
||||
};
|
||||
}
|
||||
|
||||
private void SetPID(PKM pk)
|
||||
|
|
|
@ -410,18 +410,12 @@ namespace PKHeX.Core
|
|||
|
||||
private int GetAbilityIndex(EncounterCriteria criteria, PersonalInfo pi)
|
||||
{
|
||||
switch (AbilityType)
|
||||
return AbilityType switch
|
||||
{
|
||||
case 00: // 0 - 0
|
||||
case 01: // 1 - 1
|
||||
case 02: // 2 - H
|
||||
return AbilityType;
|
||||
case 03: // 0/1
|
||||
case 04: // 0/1/H
|
||||
return criteria.GetAbilityFromType(AbilityType, pi); // 3 or 2
|
||||
default:
|
||||
throw new ArgumentException(nameof(AbilityType));
|
||||
}
|
||||
00 or 01 or 02 => AbilityType, // Fixed 0/1/2
|
||||
03 or 04 => criteria.GetAbilityFromType(AbilityType, pi),// 0/1 or 0/1/H
|
||||
_ => throw new ArgumentException(nameof(AbilityType)),
|
||||
};
|
||||
}
|
||||
|
||||
private void SetPID(PKM pk)
|
||||
|
|
|
@ -441,18 +441,12 @@ namespace PKHeX.Core
|
|||
|
||||
private int GetAbilityIndex(EncounterCriteria criteria, PersonalInfo pi)
|
||||
{
|
||||
switch (AbilityType)
|
||||
return AbilityType switch
|
||||
{
|
||||
case 00: // 0 - 0
|
||||
case 01: // 1 - 1
|
||||
case 02: // 2 - H
|
||||
return AbilityType;
|
||||
case 03: // 0/1
|
||||
case 04: // 0/1/H
|
||||
return criteria.GetAbilityFromType(AbilityType, pi); // 3 or 2
|
||||
default:
|
||||
throw new ArgumentException(nameof(AbilityType));
|
||||
}
|
||||
00 or 01 or 02 => AbilityType, // Fixed 0/1/2
|
||||
03 or 04 => criteria.GetAbilityFromType(AbilityType, pi),// 0/1 or 0/1/H
|
||||
_ => throw new ArgumentException(nameof(AbilityType)),
|
||||
};
|
||||
}
|
||||
|
||||
private void SetPID(PKM pk)
|
||||
|
|
|
@ -455,39 +455,32 @@ namespace PKHeX.Core
|
|||
|
||||
private int GetAbilityIndex(EncounterCriteria criteria, PersonalInfo pi)
|
||||
{
|
||||
switch (AbilityType)
|
||||
return AbilityType switch
|
||||
{
|
||||
case 00: // 0 - 0
|
||||
case 01: // 1 - 1
|
||||
case 02: // 2 - H
|
||||
return AbilityType;
|
||||
case 03: // 0/1
|
||||
case 04: // 0/1/H
|
||||
return criteria.GetAbilityFromType(AbilityType, pi); // 3 or 2
|
||||
default:
|
||||
throw new ArgumentException(nameof(AbilityType));
|
||||
}
|
||||
00 or 01 or 02 => AbilityType, // Fixed 0/1/2
|
||||
03 or 04 => criteria.GetAbilityFromType(AbilityType, pi),// 0/1 or 0/1/H
|
||||
_ => throw new ArgumentException(nameof(AbilityType)),
|
||||
};
|
||||
}
|
||||
|
||||
private uint GetPID(ITrainerID tr, byte type)
|
||||
{
|
||||
switch (type)
|
||||
return type switch
|
||||
{
|
||||
case 0: // Random, Never Shiny
|
||||
var pid = Util.Rand32();
|
||||
if (tr.IsShiny(pid, 8))
|
||||
return pid ^ 0x1000_0000;
|
||||
return pid;
|
||||
case 1: // Random, Any
|
||||
return Util.Rand32();
|
||||
case 2: // Fixed, Force Star
|
||||
return (uint) (((tr.TID ^ tr.SID ^ (PID & 0xFFFF) ^ 1) << 16) | (PID & 0xFFFF));
|
||||
case 3: // Fixed, Force Square
|
||||
return (uint) (((tr.TID ^ tr.SID ^ (PID & 0xFFFF) ^ 0) << 16) | (PID & 0xFFFF));
|
||||
case 4: // Fixed, Force Value
|
||||
return PID;
|
||||
default:
|
||||
throw new ArgumentException();
|
||||
0 => GetAntishiny(tr), // Random, Never Shiny
|
||||
1 => Util.Rand32(), // Random, Any
|
||||
2 => (uint) (((tr.TID ^ tr.SID ^ (PID & 0xFFFF) ^ 1) << 16) | (PID & 0xFFFF)), // Fixed, Force Star
|
||||
3 => (uint) (((tr.TID ^ tr.SID ^ (PID & 0xFFFF) ^ 0) << 16) | (PID & 0xFFFF)), // Fixed, Force Square
|
||||
4 => PID, // Fixed, Force Value
|
||||
_ => throw new ArgumentException()
|
||||
};
|
||||
|
||||
static uint GetAntishiny(ITrainerID tr)
|
||||
{
|
||||
var pid = Util.Rand32();
|
||||
if (tr.IsShiny(pid, 8))
|
||||
return pid ^ 0x1000_0000;
|
||||
return pid;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,16 +24,15 @@ namespace PKHeX.Core
|
|||
if (isBigEndian)
|
||||
return generation == 3 ? StringConverter3.GetBEString3(data, offset, count) : StringConverter4.GetBEString4(data, offset, count);
|
||||
|
||||
switch (generation)
|
||||
return generation switch
|
||||
{
|
||||
case 1:
|
||||
case 2: return StringConverter12.GetString1(data, offset, count, jp);
|
||||
case 3: return StringConverter3.GetString3(data, offset, count, jp);
|
||||
case 4: return StringConverter4.GetString4(data, offset, count);
|
||||
case 5: return GetString5(data, offset, count);
|
||||
case 6: return GetString6(data, offset, count);
|
||||
default: return GetString7(data, offset, count);
|
||||
}
|
||||
1 or 2 => StringConverter12.GetString1(data, offset, count, jp),
|
||||
3 => StringConverter3.GetString3(data, offset, count, jp),
|
||||
4 => StringConverter4.GetString4(data, offset, count),
|
||||
5 => GetString5(data, offset, count),
|
||||
6 => GetString6(data, offset, count),
|
||||
_ => GetString7(data, offset, count),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -53,16 +52,15 @@ namespace PKHeX.Core
|
|||
if (isBigEndian)
|
||||
return generation == 3 ? StringConverter3.SetBEString3(value, maxLength, padTo, padWith) : StringConverter4.SetBEString4(value, maxLength, padTo, padWith);
|
||||
|
||||
switch (generation)
|
||||
return generation switch
|
||||
{
|
||||
case 1:
|
||||
case 2: return StringConverter12.SetString1(value, maxLength, jp, padTo, padWith);
|
||||
case 3: return StringConverter3.SetString3(value, maxLength, jp, padTo, padWith);
|
||||
case 4: return StringConverter4.SetString4(value, maxLength, padTo, padWith);
|
||||
case 5: return SetString5(value, maxLength, padTo, padWith);
|
||||
case 6: return SetString6(value, maxLength, padTo, padWith);
|
||||
default: return SetString7(value, maxLength, language, padTo, padWith);
|
||||
}
|
||||
1 or 2 => StringConverter12.SetString1(value, maxLength, jp, padTo, padWith),
|
||||
3 => StringConverter3.SetString3(value, maxLength, jp, padTo, padWith),
|
||||
4 => StringConverter4.SetString4(value, maxLength, padTo, padWith),
|
||||
5 => SetString5(value, maxLength, padTo, padWith),
|
||||
6 => SetString6(value, maxLength, padTo, padWith),
|
||||
_ => SetString7(value, maxLength, language, padTo, padWith),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Converts Generation 5 encoded data to decoded string.</summary>
|
||||
|
|
|
@ -136,29 +136,18 @@ namespace PKHeX.Core
|
|||
/// </summary>
|
||||
/// <param name="value">Gen1 Item ID</param>
|
||||
/// <returns>Gen2 Item ID</returns>
|
||||
/// <remarks>https://github.com/pret/pokecrystal/blob/edb624c20ceb50eef9d73a5df0ac041cc156dd32/engine/link/link.asm#L1093-L1115</remarks>
|
||||
private static int GetTeruSamaItem(int value)
|
||||
/// <remarks>
|
||||
/// <br>https://github.com/pret/pokecrystal/blob/edb624c20ceb50eef9d73a5df0ac041cc156dd32/engine/link/link.asm#L1093-L1115</br>
|
||||
/// <br>https://github.com/pret/pokecrystal/blob/edb624c20ceb50eef9d73a5df0ac041cc156dd32/data/items/catch_rate_items.asm#L5-L17</br>
|
||||
/// </remarks>
|
||||
private static int GetTeruSamaItem(int value) => value switch
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0x19: return 0x92; // Leftovers
|
||||
case 0x2D: return 0x53; // Bitter Berry
|
||||
case 0x32: return 0xAE; // Leftovers
|
||||
|
||||
case 0x5A:
|
||||
case 0x64:
|
||||
case 0x78:
|
||||
case 0x87:
|
||||
case 0xBE:
|
||||
case 0xC3:
|
||||
case 0xDC:
|
||||
case 0xFA:
|
||||
case 0xFF:
|
||||
return 0xAD; // Berry
|
||||
|
||||
default: return value;
|
||||
}
|
||||
}
|
||||
0x19 => 0x92, // Leftovers
|
||||
0x2D => 0x53, // Bitter Berry
|
||||
0x32 => 0xAE, // Leftovers
|
||||
0x5A or 0x64 or 0x78 or 0x87 or 0xBE or 0xC3 or 0xDC or 0xFA or 0xFF => 0xAD, // Berry
|
||||
_ => value,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Converts a Gen1 Item to Gen2 Item.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static PKHeX.Core.LanguageID;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
|
@ -10,71 +11,49 @@ namespace PKHeX.Core
|
|||
{
|
||||
private static readonly int[] Languages_3 =
|
||||
{
|
||||
(int)LanguageID.Japanese,
|
||||
(int)LanguageID.English,
|
||||
(int)LanguageID.French,
|
||||
(int)LanguageID.German,
|
||||
(int)LanguageID.Spanish,
|
||||
(int)LanguageID.Italian,
|
||||
(int)Japanese,
|
||||
(int)English,
|
||||
(int)French,
|
||||
(int)German,
|
||||
(int)Spanish,
|
||||
(int)Italian,
|
||||
};
|
||||
|
||||
// check Korean for the VC case, never possible to match string outside of this case
|
||||
private static readonly int[] Languages_GB = Languages_3.Concat(new[] {(int)LanguageID.Korean}).ToArray();
|
||||
private static readonly int[] Languages_GB = Languages_3.Concat(new[] {(int)Korean}).ToArray();
|
||||
private static readonly int[] Languages_46 = Languages_GB;
|
||||
private static readonly int[] Languages_7 = Languages_46.Concat(new[] {(int)LanguageID.ChineseS, (int)LanguageID.ChineseT}).ToArray();
|
||||
private static readonly int[] Languages_7 = Languages_46.Concat(new[] {(int)ChineseS, (int)ChineseT}).ToArray();
|
||||
private const LanguageID SafeLanguage = English;
|
||||
|
||||
public static IReadOnlyList<int> GetAvailableGameLanguages(int generation = PKX.Generation)
|
||||
public static IReadOnlyList<int> GetAvailableGameLanguages(int generation = PKX.Generation) => generation switch
|
||||
{
|
||||
if (generation < 3)
|
||||
return Languages_GB;
|
||||
if (generation < 4)
|
||||
return Languages_3;
|
||||
if (generation < 7)
|
||||
return Languages_46;
|
||||
return Languages_7;
|
||||
}
|
||||
< 3 => Languages_GB,
|
||||
< 4 => Languages_3,
|
||||
< 7 => Languages_46,
|
||||
_ => Languages_7,
|
||||
};
|
||||
|
||||
public static LanguageID GetSafeLanguage(int generation, LanguageID prefer, GameVersion game = GameVersion.Any)
|
||||
public static LanguageID GetSafeLanguage(int generation, LanguageID prefer, GameVersion game = GameVersion.Any) => generation switch
|
||||
{
|
||||
switch (generation)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
if (Languages_GB.Contains((int)prefer) && (prefer != LanguageID.Korean || game == GameVersion.C))
|
||||
return prefer;
|
||||
return LanguageID.English;
|
||||
case 3:
|
||||
if (Languages_3.Contains((int)prefer))
|
||||
return prefer;
|
||||
return LanguageID.English;
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
if (Languages_46.Contains((int)prefer))
|
||||
return prefer;
|
||||
return LanguageID.English;
|
||||
default:
|
||||
if (Languages_7.Contains((int)prefer))
|
||||
return prefer;
|
||||
return LanguageID.English;
|
||||
}
|
||||
}
|
||||
1 or 2 => Languages_GB.Contains((int)prefer) && (prefer != Korean || game == GameVersion.C) ? prefer : SafeLanguage,
|
||||
3 => Languages_3 .Contains((int)prefer) ? prefer : SafeLanguage,
|
||||
4 or 5 or 6 => Languages_46.Contains((int)prefer) ? prefer : SafeLanguage,
|
||||
_ => Languages_7 .Contains((int)prefer) ? prefer : SafeLanguage,
|
||||
};
|
||||
|
||||
public static string GetLanguage2CharName(this LanguageID lang)
|
||||
{
|
||||
switch (lang)
|
||||
return lang switch
|
||||
{
|
||||
default: return GameLanguage.DefaultLanguage;
|
||||
|
||||
case LanguageID.Japanese: return "ja";
|
||||
case LanguageID.French: return "fr";
|
||||
case LanguageID.Italian: return "it";
|
||||
case LanguageID.German: return "de";
|
||||
case LanguageID.Spanish: return "es";
|
||||
case LanguageID.Korean: return "ko";
|
||||
case LanguageID.ChineseS:
|
||||
case LanguageID.ChineseT: return "zh";
|
||||
}
|
||||
Japanese => "ja",
|
||||
French => "fr",
|
||||
Italian => "it",
|
||||
German => "de",
|
||||
Spanish => "es",
|
||||
Korean => "ko",
|
||||
ChineseS or ChineseT => "zh",
|
||||
_ => GameLanguage.DefaultLanguage,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -103,20 +82,20 @@ namespace PKHeX.Core
|
|||
|
||||
private static readonly Dictionary<LanguageID, LanguageGC> MainSeriesToGC = new()
|
||||
{
|
||||
{LanguageID.German, LanguageGC.German},
|
||||
{LanguageID.French, LanguageGC.French},
|
||||
{LanguageID.Italian, LanguageGC.Italian},
|
||||
{LanguageID.Spanish, LanguageGC.Spanish},
|
||||
{LanguageID.UNUSED_6, LanguageGC.UNUSED_6},
|
||||
{German, LanguageGC.German},
|
||||
{French, LanguageGC.French},
|
||||
{Italian, LanguageGC.Italian},
|
||||
{Spanish, LanguageGC.Spanish},
|
||||
{UNUSED_6, LanguageGC.UNUSED_6},
|
||||
};
|
||||
|
||||
private static readonly Dictionary<LanguageGC, LanguageID> GCtoMainSeries = new()
|
||||
{
|
||||
{LanguageGC.German, LanguageID.German},
|
||||
{LanguageGC.French, LanguageID.French},
|
||||
{LanguageGC.Italian, LanguageID.Italian},
|
||||
{LanguageGC.Spanish, LanguageID.Spanish},
|
||||
{LanguageGC.UNUSED_6, LanguageID.UNUSED_6},
|
||||
{LanguageGC.German, German},
|
||||
{LanguageGC.French, French},
|
||||
{LanguageGC.Italian, Italian},
|
||||
{LanguageGC.Spanish, Spanish},
|
||||
{LanguageGC.UNUSED_6, UNUSED_6},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,12 +69,12 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (s.Length != 1)
|
||||
return 2;
|
||||
switch (s[0])
|
||||
return (s[0]) switch
|
||||
{
|
||||
case '♂': case 'M': return 0;
|
||||
case '♀': case 'F': return 1;
|
||||
default: return 2;
|
||||
}
|
||||
'♂' or 'M' => 0,
|
||||
'♀' or 'F' => 1,
|
||||
_ => 2,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in a new issue