mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Use enum for species comparisons
slightly easier to read with named values
This commit is contained in:
parent
475dc02101
commit
8acb336d51
45 changed files with 92 additions and 93 deletions
|
@ -583,7 +583,7 @@ namespace PKHeX.Core
|
|||
// Gen 3 pokemon in gen 4 games: minimum level is one level after transfer to generation 4
|
||||
// VC pokemon: minimum level is one level after transfer to generation 7
|
||||
// Sylveon: always one level after met level, for gen 4 and 5 eevees in gen 6 games minimum for evolution is one level after transfer to generation 5
|
||||
if (pkm.HasOriginalMetLocation || (pkm.Format == 4 && pkm.Gen3) || pkm.VC || pkm.Species == 700)
|
||||
if (pkm.HasOriginalMetLocation || (pkm.Format == 4 && pkm.Gen3) || pkm.VC || pkm.Species == (int)Species.Sylveon)
|
||||
LearnLevel = Math.Max(pkm.Met_Level + 1, LearnLevel);
|
||||
|
||||
// Current level must be at least one the minimum learn level
|
||||
|
@ -612,7 +612,7 @@ namespace PKHeX.Core
|
|||
return true;
|
||||
if (IsEvolvedFormChange(pkm))
|
||||
return true;
|
||||
if (species == 718 && pkm.InhabitedGeneration(7) && pkm.AltForm > 1)
|
||||
if (species == (int)Species.Zygarde && pkm.InhabitedGeneration(7) && pkm.AltForm > 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -658,7 +658,7 @@ namespace PKHeX.Core
|
|||
|
||||
internal static bool GetCanKnowMove(PKM pkm, int move, int generation, GameVersion version = GameVersion.Any)
|
||||
{
|
||||
if (pkm.Species == 235)
|
||||
if (pkm.Species == (int)Species.Smeargle)
|
||||
return !InvalidSketch.Contains(move);
|
||||
return GetValidMoves(pkm, version, EvolutionChain.GetValidPreEvolutions(pkm), generation, LVL: true, Relearn: true, Tutor: true, Machine: true).Contains(move);
|
||||
}
|
||||
|
@ -719,7 +719,7 @@ namespace PKHeX.Core
|
|||
return pkm.CurrentLevel;
|
||||
}
|
||||
|
||||
if (pkm.Species == 700 && generation == 5)
|
||||
if (pkm.Species == (int)Species.Sylveon && generation == 5)
|
||||
return pkm.CurrentLevel - 1;
|
||||
|
||||
if (pkm.Gen3 && pkm.Format > 4 && pkm.Met_Level == pkm.CurrentLevel && FutureEvolutionsGen3_LevelUpGen4.Contains(pkm.Species))
|
||||
|
@ -778,7 +778,7 @@ namespace PKHeX.Core
|
|||
int formcount;
|
||||
|
||||
// In gen 3 deoxys has different forms depending on the current game, in the PersonalInfo there is no alternate form info
|
||||
if (pkm.Format == 3 && species == 386)
|
||||
if (pkm.Format == 3 && species == (int)Species.Deoxys)
|
||||
formcount = 4;
|
||||
else
|
||||
formcount = pkm.PersonalInfo.FormeCount;
|
||||
|
|
|
@ -101,12 +101,12 @@ namespace PKHeX.Core
|
|||
private static EncounterArea4DPPt[] GetFeebasArea(EncounterArea4DPPt template)
|
||||
{
|
||||
Debug.Assert(template.Location == 50); // Mt Coronet
|
||||
Debug.Assert(template.Slots.Last().Species == 340); // Whiscash
|
||||
Debug.Assert(template.Slots.Last().Species == (int)Species.Whiscash);
|
||||
var slots = template.Slots.Where(z => z.Type.IsFishingRodType()).Select(z => z.Clone()).ToArray();
|
||||
Debug.Assert(slots[0].Species == 129); // Magikarp
|
||||
Debug.Assert(slots[0].Species == (int)Species.Magikarp);
|
||||
foreach (var s in slots)
|
||||
{
|
||||
s.Species = 349; // Feebas
|
||||
s.Species = (int)Species.Feebas;
|
||||
s.TypeEncounter = EncounterType.Surfing_Fishing;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ namespace PKHeX.Core
|
|||
foreach (var swarmSlot in Area.Slots.Where(s => s.Type == SwarmSlot.Type).Take(slotsnum).Select(slot => slot.Clone()))
|
||||
{
|
||||
swarmSlot.Species = SwarmSlot.Species;
|
||||
if (swarmSlot.Species == 303) // edge case, mawile is only swarm subject to magnet pull (no other steel types in area)
|
||||
if (swarmSlot.Species == (int)Species.Mawile) // edge case, Mawile is only swarm subject to magnet pull (no other steel types in area)
|
||||
{
|
||||
swarmSlot.Permissions.MagnetPullIndex = swarmSlot.SlotNumber;
|
||||
swarmSlot.Permissions.MagnetPullCount = 2;
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (pk is PK1 pk1)
|
||||
{
|
||||
if (Species == 64 && Version == GameVersion.YW) // Kadabra
|
||||
if (Species == (int)Core.Species.Kadabra && Version == GameVersion.YW) // Kadabra
|
||||
pk1.Catch_Rate = 96;
|
||||
else if (Species == 148 && Version == GameVersion.YW) // Dragonair
|
||||
pk1.Catch_Rate = 27;
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static int[] GetNeededMoves(PKM pk, IEnumerable<int> moves, IReadOnlyList<EvoCriteria> dl)
|
||||
{
|
||||
if (pk.Species == 235) // Smeargle
|
||||
if (pk.Species == (int)Species.Smeargle)
|
||||
return moves.Intersect(Legal.InvalidSketch).ToArray(); // Can learn anything
|
||||
|
||||
var gens = VerifyCurrentMoves.GetGenMovesCheckOrder(pk);
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace PKHeX.Core
|
|||
|| slot.IsDeferredSport(IsSportBall);
|
||||
}
|
||||
|
||||
private static bool IsDeferredWurmple(this IEncounterable slot, int currentSpecies, PKM pkm) => slot.Species == 265 && currentSpecies != 265 && !WurmpleUtil.IsWurmpleEvoValid(pkm);
|
||||
private static bool IsDeferredWurmple(this IEncounterable slot, int currentSpecies, PKM pkm) => slot.Species == (int)Species.Wurmple && currentSpecies != (int)Species.Wurmple && !WurmpleUtil.IsWurmpleEvoValid(pkm);
|
||||
private static bool IsDeferredSafari(this EncounterSlot slot, bool IsSafariBall) => IsSafariBall != ((slot.Type & SlotType.Safari) != 0);
|
||||
private static bool IsDeferredSport(this EncounterSlot slot, bool IsSportBall) => IsSportBall != ((slot.Type & SlotType.BugContest) != 0);
|
||||
private static bool IsDeferredHiddenAbility(this EncounterSlot slot, bool IsHidden) => IsHidden != slot.IsHiddenAbilitySlot();
|
||||
|
|
|
@ -109,40 +109,41 @@ namespace PKHeX.Core
|
|||
|
||||
private static EncounterStatic GetRBYStaticTransfer(int species, int pkmMetLevel)
|
||||
{
|
||||
var enc = new EncounterStatic
|
||||
bool mew = species == (int)Species.Mew;
|
||||
return new EncounterStatic
|
||||
{
|
||||
Species = species,
|
||||
Gift = true, // Forces Poké Ball
|
||||
Ability = TransferSpeciesDefaultAbility_1.Contains(species) ? 1 : 4, // Hidden by default, else first
|
||||
Shiny = species == 151 ? Shiny.Never : Shiny.Random,
|
||||
Fateful = species == 151,
|
||||
Shiny = mew ? Shiny.Never : Shiny.Random,
|
||||
Fateful = mew,
|
||||
Location = Transfer1,
|
||||
EggLocation = 0,
|
||||
Level = pkmMetLevel,
|
||||
Generation = 7,
|
||||
Version = GameVersion.RBY
|
||||
Version = GameVersion.RBY,
|
||||
FlawlessIVCount = mew ? 5 : 3,
|
||||
};
|
||||
enc.FlawlessIVCount = enc.Fateful ? 5 : 3;
|
||||
return enc;
|
||||
}
|
||||
|
||||
private static EncounterStatic GetGSStaticTransfer(int species, int pkmMetLevel)
|
||||
{
|
||||
var enc = new EncounterStatic
|
||||
bool mew = species == (int) Species.Mew;
|
||||
bool fateful = mew || species == (int) Species.Celebi;
|
||||
return new EncounterStatic
|
||||
{
|
||||
Species = species,
|
||||
Gift = true, // Forces Poké Ball
|
||||
Ability = TransferSpeciesDefaultAbility_2.Contains(species) ? 1 : 4, // Hidden by default, else first
|
||||
Shiny = species == 151 ? Shiny.Never : Shiny.Random,
|
||||
Fateful = species == 151 || species == 251,
|
||||
Shiny = mew ? Shiny.Never : Shiny.Random,
|
||||
Fateful = fateful,
|
||||
Location = Transfer2,
|
||||
EggLocation = 0,
|
||||
Level = pkmMetLevel,
|
||||
Generation = 7,
|
||||
Version = GameVersion.GSC
|
||||
Version = GameVersion.GSC,
|
||||
FlawlessIVCount = fateful ? 5 : 3
|
||||
};
|
||||
enc.FlawlessIVCount = enc.Fateful ? 5 : 3;
|
||||
return enc;
|
||||
}
|
||||
|
||||
internal static EncounterStatic GetStaticLocation(PKM pkm, int species = -1)
|
||||
|
@ -168,7 +169,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
var catch_rate = pk1.Catch_Rate;
|
||||
// Pure gen 1, trades can be filter by catch rate
|
||||
if (pk1.Species == 25 || pk1.Species == 26)
|
||||
if (pk1.Species == (int)Species.Pikachu || pk1.Species == (int)Species.Raichu)
|
||||
{
|
||||
if (catch_rate == 190) // Red Blue Pikachu, is not a static encounter
|
||||
return false;
|
||||
|
@ -179,7 +180,7 @@ namespace PKHeX.Core
|
|||
if (e.Version == GameVersion.Stadium)
|
||||
{
|
||||
// Amnesia Psyduck has different catch rates depending on language
|
||||
if (e.Species == 054)
|
||||
if (e.Species == (int)Species.Psyduck)
|
||||
return catch_rate == (pk1.Japanese ? 167 : 168);
|
||||
return GBRestrictions.Stadium_CatchRate.Contains(catch_rate);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace PKHeX.Core
|
|||
int species = pkm.Species;
|
||||
if (info.EncounterMatch.Species == species)
|
||||
return true;
|
||||
if (info.EncounterMatch.EggEncounter && species == 350 && pkm.Format >= 5 && !pkm.IsUntraded) // Prism Scale
|
||||
if (info.EncounterMatch.EggEncounter && species == (int)Species.Milotic && pkm.Format >= 5 && !pkm.IsUntraded) // Prism Scale
|
||||
return true;
|
||||
|
||||
if (info.Generation > 0 && info.EvoChainsAllGens[info.Generation].All(z => z.Species != info.EncounterMatch.Species))
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static CheckMoveResult[] ParseMovesForEncounters(PKM pkm, LegalInfo info, int[] Moves)
|
||||
{
|
||||
if (pkm.Species == 235) // special handling for Smeargle
|
||||
if (pkm.Species == (int)Species.Smeargle) // special handling for Smeargle
|
||||
return ParseMovesForSmeargle(pkm, Moves, info); // Smeargle can have any moves except a few
|
||||
|
||||
// gather valid moves for encounter species
|
||||
|
@ -274,7 +274,7 @@ namespace PKHeX.Core
|
|||
return res;
|
||||
}
|
||||
|
||||
if (pkm.Species == 292 && info.Generation <= 4)
|
||||
if (pkm.Species == (int)Species.Shedinja && info.Generation <= 4)
|
||||
ParseShedinjaEvolveMoves(pkm, res, source.CurrentMoves);
|
||||
|
||||
for (int m = 0; m < 4; m++)
|
||||
|
|
|
@ -358,7 +358,7 @@ namespace PKHeX
|
|||
// Dragonite's Catch Rate is different than Dragonair's in Yellow, but there is no Dragonite encounter.
|
||||
bool IsCatchRateRBY(IEnumerable<int> ds) => ds.Any(s => catch_rate == PersonalTable.RB[s].CatchRate || (s != 149 && catch_rate == PersonalTable.Y[s].CatchRate));
|
||||
// Krabby encounter trade special catch rate
|
||||
bool IsCatchRateTrade() => (pkm.Species == 098 || pkm.Species == 099) && catch_rate == 204;
|
||||
bool IsCatchRateTrade() => catch_rate == 204 && (pkm.Species == (int)Species.Krabby || pkm.Species == (int)Species.Kingler);
|
||||
bool IsCatchRateStadium() => Stadium_GiftSpecies.Contains(pkm.Species) && Stadium_CatchRate.Contains(catch_rate);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static LearnVersion GetIsLevelUp3(int species, int move, int lvl, int form, GameVersion ver = Any)
|
||||
{
|
||||
if (species == 386)
|
||||
if (species == (int)Species.Deoxys)
|
||||
return GetIsLevelUp3Deoxys(form, move, lvl);
|
||||
|
||||
// Emerald level up tables are equal to R/S level up tables
|
||||
|
@ -360,7 +360,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static List<int> AddMovesLevelUp3(List<int> moves, GameVersion ver, int species, int max, int form)
|
||||
{
|
||||
if (species == 386)
|
||||
if (species == (int)Species.Deoxys)
|
||||
{
|
||||
var learn = GetDeoxysLearn3(form, ver);
|
||||
if (learn != null)
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace PKHeX.Core
|
|||
// Surf Pikachu via Stadium
|
||||
if (move != 57 || ParseSettings.AllowGBCartEra)
|
||||
return NONE;
|
||||
if (pkm.Format < 3 && (species == 25 || species == 26))
|
||||
if (pkm.Format < 3 && (species == (int)Species.Pikachu || species == (int)Species.Raichu))
|
||||
return GameVersion.Stadium;
|
||||
return NONE;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
// XD (Mew)
|
||||
if (species == 151 && Tutor_3Mew.Contains(move))
|
||||
if (species == (int)Species.Mew && Tutor_3Mew.Contains(move))
|
||||
return GameVersion.XD;
|
||||
|
||||
return NONE;
|
||||
|
@ -204,7 +204,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static void AddMovesTutor1(List<int> moves, int species, int format)
|
||||
{
|
||||
if (ParseSettings.AllowGBCartEra && format < 3 && (species == 25 || species == 26)) // Surf Pikachu via Stadium
|
||||
if (ParseSettings.AllowGBCartEra && format < 3 && (species == (int)Species.Pikachu || species == (int)Species.Raichu)) // Surf Pikachu via Stadium
|
||||
moves.Add(57);
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ namespace PKHeX.Core
|
|||
// XD
|
||||
moves.AddRange(SpecialTutors_XD_Exclusive.Where((_, i) => SpecialTutors_Compatibility_XD_Exclusive[i].Any(e => e == species)));
|
||||
// XD (Mew)
|
||||
if (species == 151)
|
||||
if (species == (int)Species.Mew)
|
||||
moves.AddRange(Tutor_3Mew);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace PKHeX.Core
|
|||
var info = new FrameGenerator(pk) {Nature = pk.EncryptionConstant % 25};
|
||||
|
||||
// gather possible nature determination seeds until a same-nature PID breaks the unrolling
|
||||
var seeds = pk.Species == 201 && pk.FRLG // reversed await case
|
||||
var seeds = pk.Species == (int)Species.Unown && pk.FRLG // reversed await case
|
||||
? SeedInfo.GetSeedsUntilUnownForm(pidiv, info, pk.AltForm)
|
||||
: SeedInfo.GetSeedsUntilNature(pidiv, info);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
// reverse the seed the bare minimum
|
||||
int rev = 2;
|
||||
if (species == 196)
|
||||
if (species == (int)Species.Espeon)
|
||||
rev += 7;
|
||||
|
||||
var rng = RNG.XDRNG;
|
||||
|
@ -57,7 +57,7 @@ namespace PKHeX.Core
|
|||
|
||||
// generate Umbreon
|
||||
var PIDIV = GenerateValidColoStarterPID(ref next, TID, SID);
|
||||
if (species == 196) // need espeon, which is immediately next
|
||||
if (species == (int)Species.Espeon) // need Espeon, which is immediately next
|
||||
PIDIV = GenerateValidColoStarterPID(ref next, TID, SID);
|
||||
|
||||
if (!PIDIV.Equals(pkPID, IV1, IV2))
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace PKHeX.Core
|
|||
|
||||
if (GetLCRNGMatch(top, bot, IVs, out PIDIV pidiv))
|
||||
return pidiv;
|
||||
if (pk.Species == 201 && GetLCRNGUnownMatch(top, bot, IVs, out pidiv)) // frlg only
|
||||
if (pk.Species == (int)Species.Unown && GetLCRNGUnownMatch(top, bot, IVs, out pidiv)) // frlg only
|
||||
return pidiv;
|
||||
if (GetColoStarterMatch(pk, top, bot, IVs, out pidiv))
|
||||
return pidiv;
|
||||
|
@ -840,7 +840,7 @@ namespace PKHeX.Core
|
|||
case EncounterSlot w:
|
||||
if (pkm.Version == 15)
|
||||
return val == PIDType.PokeSpot;
|
||||
return (w.Species == 201 ? MethodH_Unown : MethodH).Contains(val);
|
||||
return (w.Species == (int)Species.Unown ? MethodH_Unown : MethodH).Contains(val);
|
||||
default:
|
||||
return val == PIDType.None;
|
||||
}
|
||||
|
|
|
@ -346,7 +346,7 @@ namespace PKHeX.Core
|
|||
return specific;
|
||||
if (pk.Version == 15)
|
||||
return PIDType.CXD;
|
||||
if (pk.Gen3 && pk.Species == 201)
|
||||
if (pk.Gen3 && pk.Species == (int)Species.Unown)
|
||||
return PIDType.Method_1_Unown + Util.Rand.Next(3);
|
||||
|
||||
return PIDType.Method_1;
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace PKHeX.Core
|
|||
|
||||
private CheckResult VerifyBallMysteryGift(LegalityAnalysis data, MysteryGift g)
|
||||
{
|
||||
if (g.Generation == 4 && g.Species == 490 && g.Ball == 0) // there is no ball data in Manaphy Mystery Gift from Gen4
|
||||
if (g.Generation == 4 && g.Species == (int)Species.Manaphy && g.Ball == 0) // there is no ball data in Manaphy Mystery Gift from Gen4
|
||||
return VerifyBallEquals(data, (int)Poke); // Pokeball
|
||||
return VerifyBallEquals(data, g.Ball);
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (!Legal.Inherit_Sport.Contains(species))
|
||||
return GetInvalid(LBallSpecies);
|
||||
if (pkm.AbilityNumber == 4 && (species == 313 || species == 314)) // Volbeat/Illumise
|
||||
if (pkm.AbilityNumber == 4 && (species == (int)Species.Volbeat || species == (int)Species.Illumise)) // Volbeat/Illumise
|
||||
return GetInvalid(LBallAbility);
|
||||
return GetValid(LBallSpeciesPass);
|
||||
}
|
||||
|
@ -234,16 +234,16 @@ namespace PKHeX.Core
|
|||
|
||||
if (ball == Beast)
|
||||
{
|
||||
if (species == 669 && pkm.AltForm == 3 && pkm.AbilityNumber == 4)
|
||||
if (species == (int)Species.Mew && pkm.AltForm == 3 && pkm.AbilityNumber == 4)
|
||||
return GetInvalid(LBallAbility); // Can't obtain Flabébé-Blue with Hidden Ability in wild
|
||||
if ((species > 731 && species <= 785) || (Legal.AlolanCaptureOffspring.Contains(species) && !Legal.PastGenAlolanNativesUncapturable.Contains(species)))
|
||||
if (((int)Species.Pikipek <= species && species <= (int)Species.Kommoo) || (Legal.AlolanCaptureOffspring.Contains(species) && !Legal.PastGenAlolanNativesUncapturable.Contains(species)))
|
||||
return GetValid(LBallSpeciesPass);
|
||||
if (Legal.PastGenAlolanScans.Contains(species))
|
||||
return GetValid(LBallSpeciesPass);
|
||||
// next statement catches all new alolans
|
||||
}
|
||||
|
||||
if (species > 721)
|
||||
if (species > (int)Species.Volcanion)
|
||||
return VerifyBallEquals(data, Legal.WildPokeballs7);
|
||||
|
||||
if (ball > Beast)
|
||||
|
@ -254,10 +254,9 @@ namespace PKHeX.Core
|
|||
|
||||
private CheckResult VerifyBallEggGen8(LegalityAnalysis data)
|
||||
{
|
||||
// todo: pls gamefreak allow ball switching and remove ball inheritance
|
||||
var pkm = data.pkm;
|
||||
int species = data.EncounterMatch.Species;
|
||||
if (810 <= species && species <= 818) // G8 Starters
|
||||
if ((int)Species.Grookey <= species && species <= (int)Species.Inteleon) // G8 Starters
|
||||
return VerifyBallEquals(data, (int)Poke);
|
||||
|
||||
if (IsGalarCapture(species))
|
||||
|
@ -289,7 +288,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (!Legal.Inherit_Sport.Contains(species))
|
||||
return GetInvalid(LBallSpecies);
|
||||
if (pkm.AbilityNumber == 4 && (species == 313 || species == 314)) // Volbeat/Illumise
|
||||
if (pkm.AbilityNumber == 4 && (species == (int)Species.Volbeat || species == (int)Species.Illumise)) // Volbeat/Illumise
|
||||
return GetInvalid(LBallAbility);
|
||||
return GetValid(LBallSpeciesPass);
|
||||
}
|
||||
|
@ -314,9 +313,9 @@ namespace PKHeX.Core
|
|||
|
||||
if (ball == Beast)
|
||||
{
|
||||
if (species == 669 && pkm.AltForm == 3 && pkm.AbilityNumber == 4)
|
||||
if (species == (int)Species.Flabébé && pkm.AltForm == 3 && pkm.AbilityNumber == 4)
|
||||
return GetInvalid(LBallAbility); // Can't obtain Flabébé-Blue with Hidden Ability in wild
|
||||
if ((species > 731 && species <= 785) || (Legal.AlolanCaptureOffspring.Contains(species) && !Legal.PastGenAlolanNativesUncapturable.Contains(species)))
|
||||
if (((int)Species.Pikipek <= species && species <= (int)Species.Kommoo) || (Legal.AlolanCaptureOffspring.Contains(species) && !Legal.PastGenAlolanNativesUncapturable.Contains(species)))
|
||||
return GetValid(LBallSpeciesPass);
|
||||
if (Legal.PastGenAlolanScans.Contains(species))
|
||||
return GetValid(LBallSpeciesPass);
|
||||
|
@ -326,7 +325,7 @@ namespace PKHeX.Core
|
|||
if (species > Legal.MaxSpeciesID_7_USUM)
|
||||
return VerifyBallEquals(data, Legal.WildPokeballs8);
|
||||
|
||||
if (species > 721)
|
||||
if (species > (int)Species.Volcanion)
|
||||
return VerifyBallEquals(data, Legal.WildPokeballs7);
|
||||
|
||||
if (ball > Beast)
|
||||
|
@ -337,9 +336,9 @@ namespace PKHeX.Core
|
|||
|
||||
public static bool IsGalarCapture(int species)
|
||||
{
|
||||
if (810 <= species && species <= 818) // starter
|
||||
if ((int)Species.Grookey <= species && species <= (int)Species.Inteleon) // starter
|
||||
return false;
|
||||
if (880 <= species && species <= 883) // fossil
|
||||
if ((int)Species.Dracozolt <= species && species <= (int)Species.Arctovish) // fossil
|
||||
return false;
|
||||
var pt = PersonalTable.SWSH;
|
||||
if (((PersonalInfoSWSH) pt.GetFormeEntry(species, 0)).IsPresentInGame)
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace PKHeX.Core
|
|||
if (pi.Genderless != (pkm.Gender == 2))
|
||||
{
|
||||
// DP/HGSS shedinja glitch -- only generation 4 spawns
|
||||
bool ignore = pkm.Format == 4 && pkm.Species == 292 && pkm.Met_Level != pkm.CurrentLevel;
|
||||
bool ignore = pkm.Format == 4 && pkm.Species == (int)Species.Shedinja && pkm.Met_Level != pkm.CurrentLevel;
|
||||
if (!ignore)
|
||||
data.AddLine(GetInvalid(LGenderInvalidNone));
|
||||
return;
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace PKHeX.Core
|
|||
|
||||
// Korean Gen4 games can not trade with other Gen4 languages, but can use Pal Park with any Gen3 game/language.
|
||||
if (pkm.Format == 4 && pkm.Gen4 && !IsValidG4Korean(currentLanguage)
|
||||
&& !(data.EncounterMatch is EncounterTrade x && (x.Species == 25 || x.Species == 129)) // ger magikarp / eng pikachu
|
||||
&& !(data.EncounterMatch is EncounterTrade x && (x.Species == (int)Species.Pikachu || x.Species == (int)Species.Magikarp)) // ger magikarp / eng pikachu
|
||||
)
|
||||
{
|
||||
bool kor = currentLanguage == (int)LanguageID.Korean;
|
||||
|
|
|
@ -317,7 +317,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
private static readonly int[] tradeEvo7b = { 064, 067, 075, 093 };
|
||||
private static bool IsStarter(PKM pb7) => (pb7.Species == 25 && pb7.AltForm == 8) || (pb7.Species == 133 && pb7.AltForm == 1);
|
||||
private static bool IsStarter(PKM pb7) => (pb7.Species == (int)Species.Pikachu && pb7.AltForm == 8) || (pb7.Species == (int)Species.Eevee && pb7.AltForm == 1);
|
||||
|
||||
private void VerifySWSHStats(LegalityAnalysis data, PK8 pk8)
|
||||
{
|
||||
|
|
|
@ -222,7 +222,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
var pkm = data.pkm;
|
||||
int lang = pkm.Language;
|
||||
if (t.Species == 124) // FRLG Jynx
|
||||
if (t.Species == (int)Species.Jynx) // FRLG Jynx
|
||||
lang = DetectTradeLanguageG3DANTAEJynx(pkm, lang);
|
||||
VerifyTrade(data, t, lang);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace PKHeX.Core
|
|||
VerifyEC(data);
|
||||
|
||||
var EncounterMatch = data.EncounterMatch;
|
||||
if (EncounterMatch.Species == 265)
|
||||
if (EncounterMatch.Species == (int)Species.Wurmple)
|
||||
VerifyECPIDWurmple(data);
|
||||
|
||||
if (pkm.PID == 0)
|
||||
|
@ -85,7 +85,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
var pkm = data.pkm;
|
||||
|
||||
if (pkm.Species == 265)
|
||||
if (pkm.Species == (int)Species.Wurmple)
|
||||
{
|
||||
// Indicate what it will evolve into
|
||||
uint evoVal = WurmpleUtil.GetWurmpleEvoVal(pkm.EncryptionConstant);
|
||||
|
|
|
@ -420,7 +420,7 @@ namespace PKHeX.Core
|
|||
|
||||
private static bool IsAllowedBattleFrontier(int species, int form, int gen)
|
||||
{
|
||||
if (gen == 4 && species == 172 && form == 1) // spiky
|
||||
if (gen == 4 && species == (int)Species.Pichu && form == 1) // spiky
|
||||
return false;
|
||||
return IsAllowedBattleFrontier(species);
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ namespace PKHeX.Core
|
|||
if (data.EncounterOriginal is EncounterStatic s && (s.Version == GameVersion.Stadium || s.Version == GameVersion.Stadium2))
|
||||
data.AddLine(VerifyG1OTStadium(pkm, tr, s));
|
||||
|
||||
if (pkm.Species == 151)
|
||||
if (pkm.Species == (int)Species.Mew)
|
||||
{
|
||||
var OTMatch = (tr == Legal.GetG1OT_GFMew((int)LanguageID.Japanese))
|
||||
|| (tr == Legal.GetG1OT_GFMew((int)LanguageID.English));
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace PKHeX.Core
|
|||
if (encounter is EncounterStatic v && (GameVersion.GBCartEraOnly.Contains(v.Version) || v.Version == GameVersion.VCEvents))
|
||||
{
|
||||
bool exceptions = false;
|
||||
exceptions |= v.Version == GameVersion.VCEvents && encounter.Species == 151 && pkm.TID == 22796;
|
||||
exceptions |= v.Version == GameVersion.VCEvents && encounter.Species == (int)Species.Mew && pkm.TID == 22796;
|
||||
if (!exceptions)
|
||||
yield return GetInvalid(LG1GBEncounter);
|
||||
}
|
||||
|
|
|
@ -508,7 +508,7 @@ namespace PKHeX.Core
|
|||
|
||||
if (Form != pkm.AltForm && vs.All(dl => !Legal.IsFormChangeable(pkm, dl.Species)))
|
||||
{
|
||||
if (Species == 744 && Form == 1 && pkm.Species == 745 && pkm.AltForm == 2)
|
||||
if (Species == (int)Core.Species.Rockruff && Form == 1 && pkm.Species == 745 && pkm.AltForm == 2)
|
||||
{
|
||||
// Rockruff gift edge case; has altform 1 then evolves to altform 2
|
||||
}
|
||||
|
|
|
@ -367,7 +367,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
// Official code explicitly corrects for meowstic
|
||||
if (pk.Species == 678)
|
||||
if (pk.Species == (int)Core.Species.Meowstic)
|
||||
pk.AltForm = pk.Gender;
|
||||
|
||||
pk.MetDate = DateTime.Now;
|
||||
|
|
|
@ -358,7 +358,7 @@ namespace PKHeX.Core
|
|||
int nature = Nature;
|
||||
int friend = CurrentFriendship; // stats +10% depending on friendship!
|
||||
int scalar = (int)(((friend / 255.0f / 10.0f) + 1.0f) * 100.0f);
|
||||
ushort[] stats =
|
||||
return new[]
|
||||
{
|
||||
(ushort)(AV_HP + GetStat(p.HP, HT_HP ? 31 : IV_HP, level) + 10 + level),
|
||||
(ushort)(AV_ATK + (scalar * GetStat(p.ATK, HT_ATK ? 31 : IV_ATK, level, nature, 0) / 100)),
|
||||
|
@ -367,9 +367,6 @@ namespace PKHeX.Core
|
|||
(ushort)(AV_SPA + (scalar * GetStat(p.SPA, HT_SPA ? 31 : IV_SPA, level, nature, 2) / 100)),
|
||||
(ushort)(AV_SPD + (scalar * GetStat(p.SPD, HT_SPD ? 31 : IV_SPD, level, nature, 3) / 100)),
|
||||
};
|
||||
if (Species == 292)
|
||||
stats[0] = 1;
|
||||
return stats;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace PKHeX.Core
|
|||
|
||||
// IVs
|
||||
var new_ivs = new int[6];
|
||||
int flawless = Species == 151 ? 5 : 3;
|
||||
int flawless = Species == (int)Core.Species.Mew ? 5 : 3;
|
||||
for (var i = 0; i < new_ivs.Length; i++) new_ivs[i] = Util.Rand.Next(pk7.MaxIV + 1);
|
||||
for (var i = 0; i < flawless; i++) new_ivs[i] = 31;
|
||||
Util.Shuffle(new_ivs);
|
||||
|
@ -186,7 +186,7 @@ namespace PKHeX.Core
|
|||
abil = 0; // Reset
|
||||
pk7.RefreshAbility(abil); // 0/1/2 (not 1/2/4)
|
||||
|
||||
if (Species == 151) // Mew gets special treatment.
|
||||
if (Species == (int)Core.Species.Mew) // Mew gets special treatment.
|
||||
{
|
||||
pk7.FatefulEncounter = true;
|
||||
}
|
||||
|
|
|
@ -377,7 +377,7 @@ namespace PKHeX.Core
|
|||
};
|
||||
|
||||
// Arceus Type Changing -- Plate forcibly removed.
|
||||
if (pk5.Species == 493)
|
||||
if (pk5.Species == (int)Core.Species.Arceus)
|
||||
{
|
||||
pk5.AltForm = 0;
|
||||
pk5.HeldItem = 0;
|
||||
|
|
|
@ -1058,7 +1058,7 @@ namespace PKHeX.Core
|
|||
return 3;
|
||||
}
|
||||
if (VC)
|
||||
return Species == 151 || Species == 251 ? 5 : 3;
|
||||
return Species == (int)Core.Species.Mew || Species == (int)Core.Species.Celebi ? 5 : 3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
public override int Ability { get { var pi = (PersonalInfoG3)PersonalInfo; return AbilityBit && pi.Ability2 != 0 ? pi.Ability2 : pi.Ability1; } set { } }
|
||||
public override uint EncryptionConstant { get => PID; set { } }
|
||||
public override int Nature { get => (int)(PID % 25); set { } }
|
||||
public override int AltForm { get => Species == 201 ? PKX.GetUnownForm(PID) : 0; set { } }
|
||||
public override int AltForm { get => Species == (int)Core.Species.Unown ? PKX.GetUnownForm(PID) : 0; set { } }
|
||||
public override bool IsNicknamed { get => SpeciesName.IsNicknamedAnyLanguage(Species, Nickname, Format); set { } }
|
||||
public override int Gender { get => PKX.GetGenderFromPID(Species, PID); set { } }
|
||||
public override int Characteristic => -1;
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
// Legality Extensions
|
||||
public override bool WasEvent => (Met_Location >= 3000 && Met_Location <= 3076) || FatefulEncounter;
|
||||
public override bool WasEventEgg => WasEgg && Species == 490; // Manaphy was the only generation 4 released event egg
|
||||
public override bool WasEventEgg => WasEgg && Species == (int)Core.Species.Manaphy; // Manaphy was the only generation 4 released event egg
|
||||
|
||||
public abstract int ShinyLeaf { get; set; }
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ namespace PKHeX.Core
|
|||
if (origin >= 24)
|
||||
return Util.Rand32();
|
||||
|
||||
bool g3unown = origin <= 5 && species == 201;
|
||||
bool g3unown = origin <= 5 && species == (int)Species.Unown;
|
||||
while (true) // Loop until we find a suitable PID
|
||||
{
|
||||
uint pid = Util.Rand32();
|
||||
|
|
|
@ -90,7 +90,9 @@ namespace PKHeX.Core
|
|||
/// <returns>True if it does not match any language name, False if not nicknamed</returns>
|
||||
public static bool IsNicknamedAnyLanguage(int species, string nick, int generation = PKX.Generation)
|
||||
{
|
||||
if (species == 083 && string.Equals(nick, "Farfetch'd", StringComparison.OrdinalIgnoreCase)) // stupid ’
|
||||
if (species == (int)Species.Farfetchd && string.Equals(nick, "Farfetch'd", StringComparison.OrdinalIgnoreCase)) // stupid ’
|
||||
return false;
|
||||
if (species == (int)Species.Sirfetchd && string.Equals(nick, "Sirfetch'd", StringComparison.OrdinalIgnoreCase)) // stupid ’
|
||||
return false;
|
||||
|
||||
var langs = Language.GetAvailableGameLanguages(generation);
|
||||
|
|
|
@ -632,7 +632,7 @@ namespace PKHeX.Core
|
|||
public override void SetCaught(int species, bool caught)
|
||||
{
|
||||
SetDexFlag(Offsets.PokedexCaught, species, caught);
|
||||
if (caught && species == 201)
|
||||
if (caught && species == (int)Species.Unown)
|
||||
SetUnownFormFlags();
|
||||
}
|
||||
|
||||
|
|
|
@ -662,7 +662,7 @@ namespace PKHeX.Core
|
|||
var forms = GetForms(pkm.Species);
|
||||
if (forms.Length > 0)
|
||||
{
|
||||
if (pkm.Species == 201) // Unown
|
||||
if (pkm.Species == (int)Species.Unown) // Unown
|
||||
{
|
||||
for (int i = 0; i < 0x1C; i++)
|
||||
{
|
||||
|
@ -676,7 +676,7 @@ namespace PKHeX.Core
|
|||
break; // form now set
|
||||
}
|
||||
}
|
||||
else if (pkm.Species == 172 && HGSS) // Pichu (HGSS Only)
|
||||
else if (pkm.Species == (int)Species.Pichu && HGSS) // Pichu (HGSS Only)
|
||||
{
|
||||
int form = pkm.AltForm == 1 ? 2 : pkm.Gender;
|
||||
CheckInsertForm(ref forms, form);
|
||||
|
@ -740,7 +740,7 @@ namespace PKHeX.Core
|
|||
public int[] GetForms(int species)
|
||||
{
|
||||
const int brSize = 0x40;
|
||||
if (species == 386)
|
||||
if (species == (int)Species.Deoxys)
|
||||
{
|
||||
uint val = (uint) (General[PokeDex + 0x4 + (1 * brSize) - 1] | General[PokeDex + 0x4 + (2 * brSize) - 1] << 8);
|
||||
return GetDexFormValues(val, 4, 4);
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
int species = baseBit + 1;
|
||||
|
||||
if (species == 351) // castform
|
||||
if (species == (int)Species.Castform)
|
||||
isShiny = false;
|
||||
|
||||
// Starting with Gen7, form bits are stored in the same region as the species flags.
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace PKHeX.Core
|
|||
base.SetDex(species, bit, form, gender, shiny, lang);
|
||||
}
|
||||
|
||||
private static bool IsBuddy(int species, int form) => (species == 25 && form == 8) || (species == 133 && form == 1);
|
||||
private static bool IsBuddy(int species, int form) => (species == (int)Species.Pikachu && form == 8) || (species == (int)Species.Eevee && form == 1);
|
||||
|
||||
public const int DefaultEntryValue = 0x7F;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace PKHeX.Drawing
|
|||
protected virtual string GetSpriteAll(int species, int form, int gender, bool shiny, int generation) => SpriteName.GetResourceStringSprite(species, form, gender, generation, shiny);
|
||||
protected virtual string GetItemResourceName(int item) => $"item_{item}";
|
||||
protected virtual Image Unknown => Resources.unknown;
|
||||
protected virtual Image GetEggSprite(int species) => species == 490 ? Resources._490_e : Resources.egg;
|
||||
protected virtual Image GetEggSprite(int species) => species == (int)Species.Manaphy ? Resources._490_e : Resources.egg;
|
||||
|
||||
public void Initialize(SaveFile sav)
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ namespace PKHeX.Drawing
|
|||
if (species == 0)
|
||||
return Resources._0;
|
||||
|
||||
if (generation == 3 && species == 386) // Deoxys, special consideration for Gen3 save files
|
||||
if (generation == 3 && species == (int)Species.Deoxys) // Deoxys, special consideration for Gen3 save files
|
||||
form = GetDeoxysForm(Game);
|
||||
|
||||
var baseImage = GetBaseImage(species, form, gender, isShiny, generation);
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace PKHeX.Drawing
|
|||
|
||||
private static Image GetBaseImage(MysteryGift gift)
|
||||
{
|
||||
if (gift.IsEgg && gift.Species == 490) // Manaphy Egg
|
||||
if (gift.IsEgg && gift.Species == (int)Species.Manaphy) // Manaphy Egg
|
||||
return Resources._490_e;
|
||||
if (gift.IsPokémon)
|
||||
return GetSprite(gift.Species, gift.Form, gift.Gender, gift.HeldItem, gift.IsEgg, gift.IsShiny, gift.Format);
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace PKHeX.WinForms.Controls
|
|||
{
|
||||
case EncounterTradeCatchRate c:
|
||||
return (int)c.Catch_Rate;
|
||||
case EncounterStatic s when s.Version == GameVersion.Stadium && s.Species == 054:
|
||||
case EncounterStatic s when s.Version == GameVersion.Stadium && s.Species == (int)Species.Psyduck:
|
||||
return pk1.Japanese ? 167 : 168; // Amnesia Psyduck has different catch rates depending on language
|
||||
case IVersion v:
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace PKHeX.WinForms
|
|||
if (loading)
|
||||
return;
|
||||
|
||||
if (species == 446 && !MunchlaxTrees.Contains(CB_TreeList.SelectedIndex))
|
||||
if (species == (int)Species.Munchlax && !MunchlaxTrees.Contains(CB_TreeList.SelectedIndex))
|
||||
WinFormsUtil.Alert("Catching Munchlax in this tree will make it illegal for this savegame's TID/SID combination.");
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ namespace PKHeX.WinForms
|
|||
private static string[] GetFormNames4Dex(int species)
|
||||
{
|
||||
string[] formNames = FormConverter.GetFormList(species, GameInfo.Strings.types, GameInfo.Strings.forms, Main.GenderSymbols, 4);
|
||||
if (species == 172)
|
||||
if (species == (int)Species.Pichu)
|
||||
formNames = new[] { MALE, FEMALE, formNames[1] }; // Spiky
|
||||
return formNames;
|
||||
}
|
||||
|
|
|
@ -705,7 +705,7 @@ namespace PKHeX.WinForms
|
|||
|
||||
private void SetForms(EntreeSlot slot)
|
||||
{
|
||||
bool hasForms = PersonalTable.B2W2[slot.Species].HasFormes || slot.Species == 414;
|
||||
bool hasForms = PersonalTable.B2W2[slot.Species].HasFormes || slot.Species == (int)Species.Mothim;
|
||||
L_Form.Visible = CB_Form.Enabled = CB_Form.Visible = hasForms;
|
||||
|
||||
CB_Form.InitializeBinding();
|
||||
|
|
|
@ -303,7 +303,7 @@ namespace PKHeX.WinForms
|
|||
{
|
||||
// Fetch Current Species and set it as Nickname Text
|
||||
int species = WinFormsUtil.GetIndex(CB_Species);
|
||||
if (species == 0 || species > 721)
|
||||
if (species == 0 || species > (int)Species.Volcanion)
|
||||
{
|
||||
TB_Nickname.Text = string.Empty;
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ namespace PKHeX.WinForms
|
|||
CB_Form.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
if (species == 668)
|
||||
if (species == (int)Species.Pyroar)
|
||||
CB_Form.SelectedIndex = PKX.GetGenderFromString(Label_Gender.Text);
|
||||
|
||||
Write_Entry(null, EventArgs.Empty);
|
||||
|
|
Loading…
Reference in a new issue