Better approach of WasEgg functions

Private variable _WasEgg is only needed for pokemon from gen 2 and 3, for gen 4 return WasEgg if EggLocation > 0
A gen4 Legal.EggLocations array should be created in the future
This commit is contained in:
javierhimura 2017-03-27 01:36:08 +02:00
parent c93acf4767
commit 4bb9e01ff9
4 changed files with 13 additions and 8 deletions

View file

@ -383,7 +383,9 @@ namespace PKHeX.Core
return pm6stat * 5 + maxIV % 5;
}
}
// Legality Extensions
public override bool WasEgg => GenNumber < 4 ? base.WasEgg : Egg_Location > 0;
// Methods
public override byte[] Encrypt()
{

View file

@ -299,7 +299,10 @@ namespace PKHeX.Core
return pm6stat * 5 + maxIV % 5;
}
}
// Legality Extensions
public override bool WasEgg => GenNumber < 4 ? base.WasEgg : GenNumber == 4 ? Egg_Location > 0 : Legal.EggLocations.Contains(Egg_Location);
// Methods
public override byte[] Encrypt()
{

View file

@ -584,11 +584,11 @@ namespace PKHeX.Core
// Legality Properties
public override bool WasLink => Met_Location == 30011;
public override bool WasEgg => GenNumber < 5 ? base.WasEgg : Legal.EggLocations.Contains(Egg_Location);
public override bool WasEgg => GenNumber < 4 ? base.WasEgg : GenNumber == 4 ? Egg_Location > 0 : Legal.EggLocations.Contains(Egg_Location);
public override bool WasEvent => Met_Location > 40000 && Met_Location < 50000 || FatefulEncounter && Species != 386;
public override bool WasEventEgg => ((Egg_Location > 40000 && Egg_Location < 50000) || (FatefulEncounter && Egg_Location == 30002)) && Met_Level == 1;
public override bool WasTradedEgg => GenNumber < 5 ? base.WasEgg : Egg_Location == 30002;
public override bool WasIngameTrade => GenNumber < 5 ? base.WasEgg : Met_Location == 30001;
public override bool WasTradedEgg => Egg_Location == 30002 || GenNumber == 4 && Egg_Location == 2002;
public override bool WasIngameTrade => Met_Location == 30001 || GenNumber == 4 && Egg_Location == 2001;
public PK7 convertToPK7()
{

View file

@ -621,10 +621,10 @@ namespace PKHeX.Core
// Legality Properties
public override bool WasLink => Met_Location == 30011;
public override bool WasEgg => GenNumber < 5 ? base.WasEgg : Legal.EggLocations.Contains(Egg_Location);
public override bool WasEgg => GenNumber < 4 ? base.WasEgg : GenNumber == 4 ? Egg_Location > 0 : Legal.EggLocations.Contains(Egg_Location);
public override bool WasEvent => Met_Location > 40000 && Met_Location < 50000 || FatefulEncounter && Species != 386;
public override bool WasEventEgg => ((Egg_Location > 40000 && Egg_Location < 50000) || (FatefulEncounter && Egg_Location == 30002)) && Met_Level == 1;
public override bool WasTradedEgg => GenNumber < 5 ? base.WasEgg : Egg_Location == 30002;
public override bool WasIngameTrade => GenNumber < 5 ? base.WasEgg : Met_Location == 30001;
public override bool WasTradedEgg => Egg_Location == 30002 || GenNumber == 4 && Egg_Location == 2002;
public override bool WasIngameTrade => Met_Location == 30001 || GenNumber == 4 && Egg_Location == 2001;
}
}