Defer Gift ball check

Now returns invalid ball instead of invalid encounter
This commit is contained in:
Kaphotics 2016-04-20 20:46:18 -07:00
parent 4d1c621eb5
commit a733b99b31
3 changed files with 13 additions and 2 deletions

View File

@ -451,9 +451,17 @@ private LegalityCheck verifyBall()
return new LegalityCheck(Severity.Valid, "Standard Poké Ball.");
if (EncounterType == typeof(EncounterStatic))
{
EncounterStatic enc = EncounterMatch as EncounterStatic;
if (enc.Gift)
return enc.Ball != pk6.Ball // Pokéball by default
? new LegalityCheck(Severity.Invalid, "Incorrect ball on ingame gift.")
: new LegalityCheck(Severity.Valid, "Correct ball on ingame gift.");
return !Legal.WildPokeballs.Contains(pk6.Ball)
? new LegalityCheck(Severity.Invalid, "Incorrect ball on ingame static encounter.")
: new LegalityCheck(Severity.Valid, "Correct ball on ingame static encounter.");
}
if (EncounterType == typeof(EncounterSlot[]))
return !Legal.WildPokeballs.Contains(pk6.Ball)
? new LegalityCheck(Severity.Invalid, "Incorrect ball on ingame encounter.")

View File

@ -231,8 +231,10 @@ internal static EncounterStatic getValidStaticEncounter(PK6 pk6)
continue;
if (e.Shiny != null && e.Shiny != pk6.IsShiny)
continue;
if (e.Gift && pk6.Ball != 4) // PokéBall
continue;
// Defer ball check to later
// if (e.Gift && pk6.Ball != 4) // PokéBall
// continue;
// Passes all checks, valid encounter
return e;

View File

@ -184,6 +184,7 @@ public class EncounterStatic
public int EggLocation = 0;
public Nature Nature = Nature.Random;
public bool Gift = false;
public int Ball = 4; // Gift Only
public GameVersion Version = GameVersion.Any;
public int[] IVs = {-1, -1, -1, -1, -1, -1};
public int[] Contest = {0, 0, 0, 0, 0, 0};