Rework gbc celebi detection

disallow outside jp games
This commit is contained in:
Kurt 2018-01-27 11:46:51 -08:00
parent 705098418b
commit ca2898d648
2 changed files with 18 additions and 12 deletions

View File

@ -207,7 +207,8 @@ private static EncounterArea[] GetSlots_C(EncounterArea[] f)
new EncounterStatic { Species = 249, Level = 60, Location = 031, Version = GameVersion.C }, // Lugia @ Whirl Islands
new EncounterStatic { Species = 250, Level = 60, Location = 023, Version = GameVersion.C }, // Ho-Oh @ Tin Tower
new EncounterStatic { Species = 251, Level = 30, Location = 014, Version = GameVersion.C }, // Celebi @ Ilex Forest
new EncounterStatic { Species = 251, Level = 30, Location = 014, Version = GameVersion.C }, // Celebi @ Ilex Forest (VC)
new EncounterStatic { Species = 251, Level = 30, Location = 014, Version = GameVersion.EventsGBGen2 }, // Celebi @ Ilex Forest (GBC)
new EncounterStatic { Species = 137, Level = 15, Location = 071, Version = GameVersion.C }, // Porygon @ Celadon Game Corner
new EncounterStatic { Species = 025, Level = 25, Location = 071, Version = GameVersion.C }, // Pikachu @ Celadon Game Corner

View File

@ -132,20 +132,25 @@ private static IEnumerable<GBEncounterData> GenerateRawEncounters12(PKM pkm, Gam
foreach (var s in GetValidStaticEncounter(pkm, game).Where(z => species.Contains(z.Species)))
{
// Valid stadium and non-stadium encounters, return only non-stadium encounters, they are less restrictive
if (s.Version == GameVersion.Stadium || s.Version == GameVersion.Stadium2)
switch (s.Version)
{
deferred.Add(s);
continue;
}
if (s.Version == GameVersion.EventsGBGen2)
{
// no Gen2 events outside of Japan besides Celebi
if (pkm.Japanese)
case GameVersion.Stadium:
case GameVersion.Stadium2:
deferred.Add(s);
continue;
continue;
case GameVersion.EventsGBGen2:
if (!s.EggEncounter && !pkm.HasOriginalMetLocation)
continue;
if (pkm.Japanese)
deferred.Add(s);
continue;
case GameVersion.C when gsc && pkm.Format == 2: // Crystal specific data needs to be present
if (!s.EggEncounter && !pkm.HasOriginalMetLocation)
continue;
if (s.Species == 251 && AllowGBCartEra) // no celebi, the GameVersion.EventsGBGen2 will pass thru
continue;
break;
}
if (gsc && pkm.Format == 2 && !s.EggEncounter && s.Version == GameVersion.C && !pkm.HasOriginalMetLocation)
continue;
yield return new GBEncounterData(pkm, gen, s, s.Version);
}
foreach (var e in GetValidWildEncounters(pkm, game).OfType<EncounterSlot1>())