Update egg location -> encounter generating checks

WasEgg only checks for EncounterEgg valid locations; check for any value
instead.
This commit is contained in:
Kurt 2018-07-26 14:55:45 -07:00
parent 1c05001fb7
commit 75801e22e0
7 changed files with 5 additions and 5 deletions

View File

@ -121,7 +121,7 @@ private static bool IsDeferred(this EncounterSlot slot, int currentSpecies, PKM
public static IEnumerable<EncounterSlot> GetValidFriendSafari(PKM pkm)
{
if (!pkm.XY || pkm.Met_Location != 148 || pkm.Met_Level != 30) // Friend Safari
if (!pkm.XY || pkm.Met_Location != 148 || pkm.Met_Level != 30 || pkm.Egg_Location != 0) // Friend Safari
return Enumerable.Empty<EncounterSlot>();
var vs = EvolutionChain.GetValidPreEvolutions(pkm).Where(d => d.Level >= 30);
return vs.SelectMany(z => Encounters6.FriendSafari[z.Species]);
@ -129,7 +129,7 @@ public static IEnumerable<EncounterSlot> GetValidFriendSafari(PKM pkm)
private static IEnumerable<EncounterSlot> GetValidEncounterSlots(PKM pkm, EncounterArea loc, IEnumerable<DexLevel> vs, bool DexNav = false, int lvl = -1, bool ignoreLevel = false)
{
if (pkm.WasEgg)
if (pkm.Egg_Location != 0)
return Enumerable.Empty<EncounterSlot>();
if (lvl < 0)
lvl = GetMinLevelEncounter(pkm);

View File

@ -13,7 +13,7 @@ public override void Verify(LegalityAnalysis data)
var pkm = data.pkm;
if (data.EncounterMatch is EncounterStatic)
VerifyCXDStarterCorrelation(data);
else if (pkm.WasEgg) // can't obtain eggs in CXD
else if (pkm.Egg_Location != 0) // can't obtain eggs in CXD
data.AddLine(GetInvalid(V80, CheckIdentifier.Encounter)); // invalid encounter
if (pkm.OT_Gender == 1)

View File

@ -20,7 +20,7 @@ private static EncounterType GetEncounterTypeValue(PKM pkm, IEncounterable enc)
{
// Encounter type data is only stored for gen 4 encounters
// All eggs have encounter type none, even if they are from static encounters
if (!pkm.Gen4 || pkm.WasEgg)
if (!pkm.Gen4 || pkm.Egg_Location != 0)
return EncounterType.None;
if (enc is EncounterSlot w)

View File

@ -24,7 +24,7 @@ public static uint GetHexValue(string s)
}
private static bool IsHex(char c) => (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
private static string TitleCase(string word) => word[0].ToString().ToUpper() + word.Substring(1, word.Length - 1).ToLower();
private static string TitleCase(string word) => char.ToUpper(word[0]) + word.Substring(1, word.Length - 1).ToLower();
/// <summary>
/// Filters the string down to only valid hex characters, returning a new string.