Refactoring

Move fossils check to static encounter
apply small amount of inheritance to all encounter types (including
mystery gifts)
get actual evolution chain to ignore pre-evolution movepools (example
Surf Pikachu event gift cannot devolve to Pichu to get Nasty Plot). #694

A little bit of logic has been moved around, but my 5k pkmdb had no
change in legal/illegal counts. Hopefully no false positives from this
change 👍
This commit is contained in:
Kurt 2017-01-03 20:51:33 -08:00
parent bf2e3a9abb
commit ede8846162
11 changed files with 127 additions and 101 deletions

View file

@ -7,19 +7,13 @@ namespace PKHeX
public partial class LegalityAnalysis public partial class LegalityAnalysis
{ {
private PKM pkm; private PKM pkm;
private DexLevel[] EvoChain;
private readonly List<CheckResult> Parse = new List<CheckResult>(); private readonly List<CheckResult> Parse = new List<CheckResult>();
private enum Encounters
{
Unknown = -1,
Generic = 0,
Fossil = 1,
}
private object EncounterMatch; private object EncounterMatch;
private Type EncounterType; private Type EncounterType;
private bool EncounterIsMysteryGift => EncounterType.IsSubclassOf(typeof (MysteryGift)); private bool EncounterIsMysteryGift => EncounterType.IsSubclassOf(typeof (MysteryGift));
private string EncounterName => getEncounterTypeName(); private string EncounterName => Legal.getEncounterTypeName(pkm, EncounterMatch);
private List<MysteryGift> EventGiftMatch; private List<MysteryGift> EventGiftMatch;
private CheckResult Encounter, History; private CheckResult Encounter, History;
private int[] RelearnBase; private int[] RelearnBase;
@ -91,6 +85,7 @@ namespace PKHeX
{ AddLine(Severity.Invalid, "Species does not exist in origin game.", CheckIdentifier.None); return; } { AddLine(Severity.Invalid, "Species does not exist in origin game.", CheckIdentifier.None); return; }
updateRelearnLegality(); updateRelearnLegality();
updateEncounterChain();
updateMoveLegality(); updateMoveLegality();
updateChecks(); updateChecks();
} }
@ -101,6 +96,7 @@ namespace PKHeX
{ AddLine(Severity.Invalid, "Species does not exist in origin game.", CheckIdentifier.None); return; } { AddLine(Severity.Invalid, "Species does not exist in origin game.", CheckIdentifier.None); return; }
updateRelearnLegality(); updateRelearnLegality();
updateEncounterChain();
updateMoveLegality(); updateMoveLegality();
updateChecks(); updateChecks();
} }
@ -118,12 +114,17 @@ namespace PKHeX
// SecondaryChecked = false; // SecondaryChecked = false;
} }
private void updateEncounterChain()
{
if (EventGiftMatch?.Count > 1) // Multiple possible Mystery Gifts matched
EncounterMatch = EventGiftMatch.First(); // temporarily set one so that Encounter can be verified
Encounter = verifyEncounter();
EvoChain = Legal.getEvolutionChain(pkm, EncounterMatch);
}
private void updateChecks() private void updateChecks()
{ {
Encounter = verifyEncounter(); EncounterMatch = EncounterMatch ?? pkm.Species;
// If EncounterMatch is null, nullrefexception will prevent a lot of analysis from happening at all.
EncounterMatch = EncounterMatch ?? Encounters.Unknown;
EncounterType = EncounterMatch?.GetType(); EncounterType = EncounterMatch?.GetType();
if (EncounterType == typeof (MysteryGift)) if (EncounterType == typeof (MysteryGift))
@ -227,28 +228,7 @@ namespace PKHeX
{ {
if (pkm == null || pkm.GenNumber < 6 || !pkm.IsOriginValid()) if (pkm == null || pkm.GenNumber < 6 || !pkm.IsOriginValid())
return null; return null;
return Legal.getValidMoves(pkm, Tutor: tutor, Machine: tm, MoveReminder: reminder).Skip(1).ToArray(); // skip move 0 return Legal.getValidMoves(pkm, EvoChain, Tutor: tutor, Machine: tm, MoveReminder: reminder).Skip(1).ToArray(); // skip move 0
}
private string getEncounterTypeName()
{
var t = EncounterMatch;
if (t is EncounterSlot[] || t is EncounterSlot)
return "Wild Encounter";
if (t.GetType().IsSubclassOf(typeof(MysteryGift)))
return $"Event Gift ({t.GetType().Name})";
if (t is EncounterStatic)
return "Static Encounter";
if (t is EncounterTrade)
return "In-game Trade";
if (t is EncounterLink)
return "Pokémon Link Encounter";
if (pkm.WasEgg)
return "Egg";
if (t.Equals(Encounters.Fossil))
return "Fossil";
if (t.Equals(Encounters.Unknown))
return "Unknown";
return t.GetType().Name;
} }
public EncounterStatic getSuggestedMetInfo() public EncounterStatic getSuggestedMetInfo()

View file

@ -426,13 +426,6 @@ namespace PKHeX
return new CheckResult(Severity.Invalid, "Invalid location for hatched egg.", CheckIdentifier.Encounter); return new CheckResult(Severity.Invalid, "Invalid location for hatched egg.", CheckIdentifier.Encounter);
} }
if (Legal.getIsFossil(pkm))
{
EncounterMatch = Encounters.Fossil;
return pkm.AbilityNumber != 4
? new CheckResult(Severity.Valid, "Valid revived fossil.", CheckIdentifier.Encounter)
: new CheckResult(Severity.Invalid, "Hidden ability on revived fossil.", CheckIdentifier.Encounter);
}
EncounterMatch = Legal.getValidFriendSafari(pkm); EncounterMatch = Legal.getValidFriendSafari(pkm);
if (EncounterMatch != null) if (EncounterMatch != null)
{ {
@ -1657,7 +1650,7 @@ namespace PKHeX
if (pkm.GenNumber < 6) if (pkm.GenNumber < 6)
return res; return res;
var validMoves = Legal.getValidMoves(pkm).ToArray(); var validMoves = Legal.getValidMoves(pkm, EvoChain).ToArray();
if (pkm.Species == 235) // Smeargle if (pkm.Species == 235) // Smeargle
{ {
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)

View file

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace PKHeX namespace PKHeX
@ -166,12 +167,12 @@ namespace PKHeX
} }
// Moves // Moves
internal static IEnumerable<int> getValidMoves(PKM pkm, bool Tutor = true, bool Machine = true, bool MoveReminder = true) internal static IEnumerable<int> getValidMoves(PKM pkm, IEnumerable<DexLevel> evoChain, bool Tutor = true, bool Machine = true, bool MoveReminder = true)
{ {
GameVersion version = (GameVersion)pkm.Version; GameVersion version = (GameVersion)pkm.Version;
if (!pkm.IsUntraded) if (!pkm.IsUntraded)
version = GameVersion.Any; version = GameVersion.Any;
return getValidMoves(pkm, version, LVL: true, Relearn: false, Tutor: Tutor, Machine: Machine, MoveReminder: MoveReminder); return getValidMoves(pkm, version, evoChain, LVL: true, Relearn: false, Tutor: Tutor, Machine: Machine, MoveReminder: MoveReminder);
} }
internal static IEnumerable<int> getValidRelearn(PKM pkm, int skipOption) internal static IEnumerable<int> getValidRelearn(PKM pkm, int skipOption)
{ {
@ -518,28 +519,6 @@ namespace PKHeX
var lineage = table.getValidPreEvolutions(pkm, 100, skipChecks:true); var lineage = table.getValidPreEvolutions(pkm, 100, skipChecks:true);
return lineage.Any(evolution => EvolutionMethod.TradeMethods.Any(method => method == evolution.Flag)); // Trade Evolutions return lineage.Any(evolution => EvolutionMethod.TradeMethods.Any(method => method == evolution.Flag)); // Trade Evolutions
} }
internal static bool getIsFossil(PKM pkm)
{
if (pkm.Egg_Location != 0)
return false;
switch (pkm.GenNumber)
{
case 6:
if (pkm.Met_Level != 20)
return false;
if (pkm.XY && pkm.Met_Location == 44)
return Fossils.Contains(getBaseSpecies(pkm));
if (pkm.AO && pkm.Met_Location == 190)
return Fossils.Contains(getBaseSpecies(pkm));
return false;
case 7:
// TBD
return false;
}
return false;
}
internal static bool getEvolutionValid(PKM pkm) internal static bool getEvolutionValid(PKM pkm)
{ {
var curr = getValidPreEvolutions(pkm); var curr = getValidPreEvolutions(pkm);
@ -632,21 +611,21 @@ namespace PKHeX
internal static bool getCanLearnMachineMove(PKM pkm, int move, GameVersion version = GameVersion.Any) internal static bool getCanLearnMachineMove(PKM pkm, int move, GameVersion version = GameVersion.Any)
{ {
return getValidMoves(pkm, version, Machine: true).Contains(move); return getValidMoves(pkm, version, getValidPreEvolutions(pkm), Machine: true).Contains(move);
} }
internal static bool getCanRelearnMove(PKM pkm, int move, GameVersion version = GameVersion.Any) internal static bool getCanRelearnMove(PKM pkm, int move, GameVersion version = GameVersion.Any)
{ {
return getValidMoves(pkm, version, LVL: true, Relearn: true).Contains(move); return getValidMoves(pkm, version, getValidPreEvolutions(pkm), LVL: true, Relearn: true).Contains(move);
} }
internal static bool getCanLearnMove(PKM pkm, int move, GameVersion version = GameVersion.Any) internal static bool getCanLearnMove(PKM pkm, int move, GameVersion version = GameVersion.Any)
{ {
return getValidMoves(pkm, version, Tutor: true, Machine: true).Contains(move); return getValidMoves(pkm, version, getValidPreEvolutions(pkm), Tutor: true, Machine: true).Contains(move);
} }
internal static bool getCanKnowMove(PKM pkm, int move, GameVersion version = GameVersion.Any) internal static bool getCanKnowMove(PKM pkm, int move, GameVersion version = GameVersion.Any)
{ {
if (pkm.Species == 235 && !InvalidSketch.Contains(move)) if (pkm.Species == 235 && !InvalidSketch.Contains(move))
return true; return true;
return getValidMoves(pkm, Version: version, LVL: true, Relearn: true, Tutor: true, Machine: true).Contains(move); return getValidMoves(pkm, Version: version, vs: getValidPreEvolutions(pkm), LVL: true, Relearn: true, Tutor: true, Machine: true).Contains(move);
} }
internal static int getBaseSpecies(PKM pkm, int skipOption = 0) internal static int getBaseSpecies(PKM pkm, int skipOption = 0)
@ -666,6 +645,43 @@ namespace PKHeX
default: return evos.Length <= 0 ? pkm.Species : evos.Last().Species; default: return evos.Length <= 0 ? pkm.Species : evos.Last().Species;
} }
} }
internal static DexLevel[] getEvolutionChain(PKM pkm, object Encounter)
{
int minspec;
var vs = getValidPreEvolutions(pkm).ToArray();
// Evolution chain is in reverse order (devolution)
if (Encounter is int)
minspec = (int)Encounter;
else if (Encounter is EncounterGeneric[])
minspec = vs.Reverse().First(s => ((EncounterGeneric[]) Encounter).Any(slot => slot.Species == s.Species)).Species;
else if (Encounter is EncounterGeneric)
minspec = vs.Reverse().First(s => ((EncounterGeneric) Encounter).Species == s.Species).Species;
else
minspec = vs.Last().Species;
int index = Math.Max(0, Array.FindIndex(vs, p => p.Species == minspec));
Array.Resize(ref vs, index + 1);
return vs;
}
internal static string getEncounterTypeName(PKM pkm, object Encounter)
{
var t = Encounter;
if (pkm.WasEgg)
return "Egg";
if (t is EncounterGeneric)
return ((EncounterGeneric)t).Name;
if (t is EncounterGeneric[])
{
var arr = (EncounterGeneric[])t;
if (arr.Any())
return arr.First().Name;
}
if (t is int)
return "Unknown";
return t.GetType().Name;
}
private static IEnumerable<EncounterArea> getDexNavAreas(PKM pkm) private static IEnumerable<EncounterArea> getDexNavAreas(PKM pkm)
{ {
switch (pkm.Version) switch (pkm.Version)
@ -822,7 +838,7 @@ namespace PKHeX
IEnumerable<DexLevel> dl = getValidPreEvolutions(pkm, lvl); IEnumerable<DexLevel> dl = getValidPreEvolutions(pkm, lvl);
return table.Where(e => dl.Any(d => d.Species == e.Species)); return table.Where(e => dl.Any(d => d.Species == e.Species));
} }
private static IEnumerable<int> getValidMoves(PKM pkm, GameVersion Version, bool LVL = false, bool Relearn = false, bool Tutor = false, bool Machine = false, bool MoveReminder = true) private static IEnumerable<int> getValidMoves(PKM pkm, GameVersion Version, IEnumerable<DexLevel> vs, bool LVL = false, bool Relearn = false, bool Tutor = false, bool Machine = false, bool MoveReminder = true)
{ {
List<int> r = new List<int> { 0 }; List<int> r = new List<int> { 0 };
int species = pkm.Species; int species = pkm.Species;
@ -841,7 +857,6 @@ namespace PKHeX
} }
r.AddRange(getMoves(pkm, species, lvl, pkm.AltForm, moveTutor, Version, LVL, Tutor, Machine, MoveReminder)); r.AddRange(getMoves(pkm, species, lvl, pkm.AltForm, moveTutor, Version, LVL, Tutor, Machine, MoveReminder));
IEnumerable<DexLevel> vs = getValidPreEvolutions(pkm);
foreach (DexLevel evo in vs) foreach (DexLevel evo in vs)
r.AddRange(getMoves(pkm, evo.Species, evo.Level, pkm.AltForm, moveTutor, Version, LVL, Tutor, Machine, MoveReminder)); r.AddRange(getMoves(pkm, evo.Species, evo.Level, pkm.AltForm, moveTutor, Version, LVL, Tutor, Machine, MoveReminder));

View file

@ -0,0 +1,8 @@
namespace PKHeX
{
public abstract class EncounterGeneric
{
public virtual int Species { get; set; }
public abstract string Name { get; }
}
}

View file

@ -1,8 +1,7 @@
namespace PKHeX namespace PKHeX
{ {
public class EncounterLink public class EncounterLink : EncounterGeneric
{ {
public int Species;
public int Level; public int Level;
public int Location = 30011; public int Location = 30011;
public int Ability = 1; public int Ability = 1;
@ -19,5 +18,7 @@
public bool XY = false; public bool XY = false;
public bool ORAS = false; public bool ORAS = false;
public bool SM = false; public bool SM = false;
public override string Name => "Pokémon Link Gift";
} }
} }

View file

@ -1,8 +1,7 @@
namespace PKHeX namespace PKHeX
{ {
public class EncounterSlot public class EncounterSlot : EncounterGeneric
{ {
public int Species;
public int Form; public int Form;
public int LevelMin; public int LevelMin;
public int LevelMax; public int LevelMax;
@ -24,6 +23,8 @@
Type = template.Type; Type = template.Type;
Pressure = template.Pressure; Pressure = template.Pressure;
} }
public override string Name => "Wild Encounter";
} }
} }

View file

@ -1,8 +1,7 @@
namespace PKHeX namespace PKHeX
{ {
public class EncounterStatic public class EncounterStatic : EncounterGeneric
{ {
public int Species;
public int Level; public int Level;
public int Location = 0; public int Location = 0;
@ -24,5 +23,7 @@
public bool Fateful = false; public bool Fateful = false;
public bool RibbonWishing = false; public bool RibbonWishing = false;
public bool SkipFormCheck = false; public bool SkipFormCheck = false;
public override string Name => "Static Encounter";
} }
} }

View file

@ -1,8 +1,7 @@
namespace PKHeX namespace PKHeX
{ {
public class EncounterTrade public class EncounterTrade : EncounterGeneric
{ {
public int Species;
public int Level; public int Level;
public int Location = 30001; public int Location = 30001;
@ -16,5 +15,7 @@
public bool Shiny = false; public bool Shiny = false;
public int Gender = -1; public int Gender = -1;
public int OTGender = -1; public int OTGender = -1;
public override string Name => "In-game Trade";
} }
} }

View file

@ -369,13 +369,25 @@ namespace PKHeX
#region Static Encounter/Gift Tables #region Static Encounter/Gift Tables
private static readonly EncounterStatic[] Encounter_XY = private static readonly EncounterStatic[] Encounter_XY =
{ {
new EncounterStatic { Species = 650, Level = 5, Location = 10, Gift = true }, // Chespin new EncounterStatic { Gift = true, Species = 650, Level = 5, Location = 10, }, // Chespin
new EncounterStatic { Species = 653, Level = 5, Location = 10, Gift = true }, // Fennekin new EncounterStatic { Gift = true, Species = 653, Level = 5, Location = 10, }, // Fennekin
new EncounterStatic { Species = 656, Level = 5, Location = 10, Gift = true }, // Froakie new EncounterStatic { Gift = true, Species = 656, Level = 5, Location = 10, }, // Froakie
new EncounterStatic { Species = 1, Level = 10, Location = 22, Gift = true }, // Bulbasaur new EncounterStatic { Gift = true, Species = 1, Level = 10, Location = 22, }, // Bulbasaur
new EncounterStatic { Species = 4, Level = 10, Location = 22, Gift = true }, // Charmander new EncounterStatic { Gift = true, Species = 4, Level = 10, Location = 22, }, // Charmander
new EncounterStatic { Species = 7, Level = 10, Location = 22, Gift = true }, // Squirtle new EncounterStatic { Gift = true, Species = 7, Level = 10, Location = 22, }, // Squirtle
new EncounterStatic { Gift = true, Species = 138, Level = 20, Location = 44, }, // Omanyte
new EncounterStatic { Gift = true, Species = 140, Level = 20, Location = 44, }, // Kabuto
new EncounterStatic { Gift = true, Species = 142, Level = 20, Location = 44, }, // Aerodactyl
new EncounterStatic { Gift = true, Species = 345, Level = 20, Location = 44, }, // Lileep
new EncounterStatic { Gift = true, Species = 347, Level = 20, Location = 44, }, // Anorith
new EncounterStatic { Gift = true, Species = 408, Level = 20, Location = 44, }, // Cranidos
new EncounterStatic { Gift = true, Species = 410, Level = 20, Location = 44, }, // Shieldon
new EncounterStatic { Gift = true, Species = 564, Level = 20, Location = 44, }, // Tirtouga
new EncounterStatic { Gift = true, Species = 566, Level = 20, Location = 44, }, // Archen
new EncounterStatic { Gift = true, Species = 696, Level = 20, Location = 44, }, // Tyrunt
new EncounterStatic { Gift = true, Species = 698, Level = 20, Location = 44, }, // Amaura
new EncounterStatic { Species = 448, Level = 32, Location = 60, Ability = 1, Nature = Nature.Hasty, Gender = 0, IVs = new[] {6, 25, 16, 31, 25, 19}, Gift = true, Shiny = false }, // Lucario new EncounterStatic { Species = 448, Level = 32, Location = 60, Ability = 1, Nature = Nature.Hasty, Gender = 0, IVs = new[] {6, 25, 16, 31, 25, 19}, Gift = true, Shiny = false }, // Lucario
new EncounterStatic { Species = 131, Level = 30, Location = 62, Nature = Nature.Docile, IVs = new[] {31, 20, 20, 20, 20, 20}, Gift = true }, // Lapras new EncounterStatic { Species = 131, Level = 30, Location = 62, Nature = Nature.Docile, IVs = new[] {31, 20, 20, 20, 20, 20}, Gift = true }, // Lapras
@ -410,21 +422,34 @@ namespace PKHeX
}; };
private static readonly EncounterStatic[] Encounter_AO = private static readonly EncounterStatic[] Encounter_AO =
{ {
new EncounterStatic { Species = 252, Level = 5, Location = 204, Gift = true }, // Treeko new EncounterStatic { Gift = true, Species = 252, Level = 5, Location = 204, }, // Treeko
new EncounterStatic { Species = 255, Level = 5, Location = 204, Gift = true }, // Torchic new EncounterStatic { Gift = true, Species = 255, Level = 5, Location = 204, }, // Torchic
new EncounterStatic { Species = 258, Level = 5, Location = 204, Gift = true }, // Mudkip new EncounterStatic { Gift = true, Species = 258, Level = 5, Location = 204, }, // Mudkip
new EncounterStatic { Species = 152, Level = 5, Location = 204, Gift = true }, // Chikorita new EncounterStatic { Gift = true, Species = 152, Level = 5, Location = 204, }, // Chikorita
new EncounterStatic { Species = 155, Level = 5, Location = 204, Gift = true }, // Cyndaquil new EncounterStatic { Gift = true, Species = 155, Level = 5, Location = 204, }, // Cyndaquil
new EncounterStatic { Species = 158, Level = 5, Location = 204, Gift = true }, // Totodile new EncounterStatic { Gift = true, Species = 158, Level = 5, Location = 204, }, // Totodile
new EncounterStatic { Species = 387, Level = 5, Location = 204, Gift = true }, // Turtwig new EncounterStatic { Gift = true, Species = 387, Level = 5, Location = 204, }, // Turtwig
new EncounterStatic { Species = 390, Level = 5, Location = 204, Gift = true }, // Chimchar new EncounterStatic { Gift = true, Species = 390, Level = 5, Location = 204, }, // Chimchar
new EncounterStatic { Species = 393, Level = 5, Location = 204, Gift = true }, // Piplup new EncounterStatic { Gift = true, Species = 393, Level = 5, Location = 204, }, // Piplup
new EncounterStatic { Species = 495, Level = 5, Location = 204, Gift = true }, // Snivy new EncounterStatic { Gift = true, Species = 495, Level = 5, Location = 204, }, // Snivy
new EncounterStatic { Species = 498, Level = 5, Location = 204, Gift = true }, // Tepig new EncounterStatic { Gift = true, Species = 498, Level = 5, Location = 204, }, // Tepig
new EncounterStatic { Species = 501, Level = 5, Location = 204, Gift = true }, // Oshawott new EncounterStatic { Gift = true, Species = 501, Level = 5, Location = 204, }, // Oshawott
// Fossil
new EncounterStatic { Gift = true, Species = 138, Level = 20, Location = 190, }, // Omanyte
new EncounterStatic { Gift = true, Species = 140, Level = 20, Location = 190, }, // Kabuto
new EncounterStatic { Gift = true, Species = 142, Level = 20, Location = 190, }, // Aerodactyl
new EncounterStatic { Gift = true, Species = 345, Level = 20, Location = 190, }, // Lileep
new EncounterStatic { Gift = true, Species = 347, Level = 20, Location = 190, }, // Anorith
new EncounterStatic { Gift = true, Species = 408, Level = 20, Location = 190, }, // Cranidos
new EncounterStatic { Gift = true, Species = 410, Level = 20, Location = 190, }, // Shieldon
new EncounterStatic { Gift = true, Species = 564, Level = 20, Location = 190, }, // Tirtouga
new EncounterStatic { Gift = true, Species = 566, Level = 20, Location = 190, }, // Archen
new EncounterStatic { Gift = true, Species = 696, Level = 20, Location = 190, }, // Tyrunt
new EncounterStatic { Gift = true, Species = 698, Level = 20, Location = 190, }, // Amaura
new EncounterStatic { Species = 25, Level = 20, Location = 178, Gender = 1, Ability = 4, IVs = new[] {-1, -1, -1, 31, -1, -1}, Contest = new[] {70,70,70,70,70,0}, Gift = true, Shiny = false, SkipFormCheck = true }, // Pikachu new EncounterStatic { Species = 25, Level = 20, Location = 178, Gender = 1, Ability = 4, IVs = new[] {-1, -1, -1, 31, -1, -1}, Contest = new[] {70,70,70,70,70,0}, Gift = true, Shiny = false, SkipFormCheck = true }, // Pikachu
new EncounterStatic { Species = 25, Level = 20, Location = 180, Gender = 1, Ability = 4, IVs = new[] {-1, -1, -1, 31, -1, -1}, Contest = new[] {70,70,70,70,70,0}, Gift = true, Shiny = false, SkipFormCheck = true }, // Pikachu new EncounterStatic { Species = 25, Level = 20, Location = 180, Gender = 1, Ability = 4, IVs = new[] {-1, -1, -1, 31, -1, -1}, Contest = new[] {70,70,70,70,70,0}, Gift = true, Shiny = false, SkipFormCheck = true }, // Pikachu

View file

@ -3,7 +3,7 @@ using System.Linq;
namespace PKHeX namespace PKHeX
{ {
public abstract class MysteryGift public abstract class MysteryGift : EncounterGeneric
{ {
/// <summary> /// <summary>
@ -92,6 +92,7 @@ namespace PKHeX
return getMysteryGift(data); return getMysteryGift(data);
} }
public string Type => GetType().Name; public string Type => GetType().Name;
public override string Name => $"Event Gift ({Type})";
// Properties // Properties
public abstract bool GiftUsed { get; set; } public abstract bool GiftUsed { get; set; }
@ -108,7 +109,6 @@ namespace PKHeX
public string getCardHeader() => (CardID > 0 ? $"Card #: {CardID:0000}" : "N/A") + $" - {CardTitle.Replace('\u3000',' ').Trim()}"; public string getCardHeader() => (CardID > 0 ? $"Card #: {CardID:0000}" : "N/A") + $" - {CardTitle.Replace('\u3000',' ').Trim()}";
// Search Properties // Search Properties
public virtual int Species { get { return -1; } set { } }
public virtual int[] Moves => new int[4]; public virtual int[] Moves => new int[4];
public virtual int[] RelearnMoves { get { return new int[4]; } set { } } public virtual int[] RelearnMoves { get { return new int[4]; } set { } }
public virtual bool IsShiny => false; public virtual bool IsShiny => false;

View file

@ -105,6 +105,7 @@
<Compile Include="Legality\Structures\DexLevel.cs" /> <Compile Include="Legality\Structures\DexLevel.cs" />
<Compile Include="Legality\Structures\EggMoves.cs" /> <Compile Include="Legality\Structures\EggMoves.cs" />
<Compile Include="Legality\Structures\EncounterArea.cs" /> <Compile Include="Legality\Structures\EncounterArea.cs" />
<Compile Include="Legality\Structures\EncounterGeneric.cs" />
<Compile Include="Legality\Structures\EncounterLink.cs" /> <Compile Include="Legality\Structures\EncounterLink.cs" />
<Compile Include="Legality\Structures\EncounterSlot.cs" /> <Compile Include="Legality\Structures\EncounterSlot.cs" />
<Compile Include="Legality\Structures\EncounterStatic.cs" /> <Compile Include="Legality\Structures\EncounterStatic.cs" />