Clean out some gb era version flagging

This commit is contained in:
Kurt
2020-10-06 20:05:38 -07:00
parent 6e1cbfcfe5
commit fe7a4df17e
13 changed files with 61 additions and 142 deletions

View File

@@ -439,47 +439,20 @@ public enum GameVersion
/// <see cref="SWSH"/>
Gen8,
/// <summary>
/// Generation 1/2 Game Boy Cartridge Era Only
/// </summary>
/// <remarks>
/// Since the original run of <see cref="RBY"/> and <see cref="GSC"/> could not transfer to future games,
/// any special encounters (event data) can only be allowed if the savedata originated from that era.
/// </remarks>
GBCartEraOnly,
/// <summary>
/// Pocket Monsters Stadium data origin identifier
/// </summary>
/// <see cref="GBCartEraOnly"/>
StadiumJ,
/// <summary>
/// Pokémon Stadium data origin identifier
/// </summary>
/// <see cref="GBCartEraOnly"/>
Stadium,
/// <summary>
/// Pokémon Stadium 2 data origin identifier
/// </summary>
/// <see cref="GBCartEraOnly"/>
Stadium2,
/// <summary>
/// Generation 1 Game Boy Cartridge Era Only data origin identifier
/// </summary>
EventsGBGen1,
/// <summary>
/// Generation 2 Game Boy Cartridge Era Only data origin identifier
/// </summary>
EventsGBGen2,
/// <summary>
/// Generation 1/2 3DS Virtual Console data origin identifier
/// </summary>
VCEvents,
#endregion
}
}

View File

@@ -181,22 +181,17 @@ public static bool Contains(this GameVersion g1, GameVersion g2)
case RB:
return g2 == RD || g2 == BU || g2 == GN;
case Stadium:
case EventsGBGen1:
case VCEvents:
case RBY:
return RB.Contains(g2) || g2 == YW;
case Gen1:
return RBY.Contains(g2) || g2 == Stadium || g2 == EventsGBGen1 || g2 == VCEvents;
return RBY.Contains(g2) || g2 == Stadium;
case GS: return g2 == GD || g2 == SV;
case Stadium2:
case EventsGBGen2:
case GSC:
return GS.Contains(g2) || g2 == C;
case Gen2:
return GSC.Contains(g2) || g2 == Stadium2 || g2 == EventsGBGen2;
case GBCartEraOnly:
return g2 == Stadium || g2 == Stadium2 || g2 == EventsGBGen1 || g2 == EventsGBGen2;
return GSC.Contains(g2) || g2 == Stadium2;
case RS: return g2 == R || g2 == S;
case RSE:

View File

@@ -342,16 +342,8 @@ public static bool IsValidMissingLanguage(PKM pkm)
return pkm.Format == 5 && pkm.BW;
}
public static string GetG1OT_GFMew(int lang) => lang == (int)LanguageID.Japanese ? "ゲーフリ" : "GF";
public static string GetG5OT_NSparkle(int lang) => lang == (int)LanguageID.Japanese ? "" : "N";
public const string Stadium1JP = "スタジアム";
public static int GetGBStadiumOTID_JPN(GameVersion s)
{
return s == GameVersion.Stadium2 ? 2000 : 1999;
}
public static int GetMaxLengthOT(int gen, LanguageID lang)
{
switch (lang)

View File

@@ -151,14 +151,23 @@ internal static class Encounters1
new EncounterTrade1(047, 05, RBY), // Parasect - Trade Tangela (GSC 5)
});
private static readonly int[] Flawless15 = {15, 15, 15, 15, 15, 15};
internal static readonly EncounterStatic1E[] StaticEventsVC =
{
new EncounterStatic1E(151, 5, VCEvents) {IVs = new[] {15, 15, 15, 15, 15, 15}, Language = EncounterGBLanguage.Any }, // Event Mew
// Event Mew
new EncounterStatic1E(151, 5, RBY) { IVs = Flawless15, TID = 22796, OT_Name = "GF", Language = EncounterGBLanguage.International },
new EncounterStatic1E(151, 5, RBY) { IVs = Flawless15, TID = 22796, OT_Name = "ゲーフリ" },
};
internal static readonly EncounterStatic1E[] StaticEventsGB =
{
new EncounterStatic1E(054, 15, Stadium) {Moves = new[] {133, 10}, Language = EncounterGBLanguage.Any }, // Stadium Psyduck (Amnesia)
// Stadium 1: Psyduck
new EncounterStatic1E(054, 15, Stadium) {Moves = new[] {133, 10}, TID = 1999, OT_Name = "スタジアム" }, // Stadium Psyduck (Amnesia)
new EncounterStatic1E(054, 15, Stadium) {Moves = new[] {133, 10}, TID = 2000, OT_Name = "STADIUM", Language = EncounterGBLanguage.International }, // Stadium Psyduck (Amnesia)
new EncounterStatic1E(054, 15, Stadium) {Moves = new[] {133, 10}, TID = 2000, OT_Name = "STADE", Language = EncounterGBLanguage.International }, // Stadium Psyduck (Amnesia)
new EncounterStatic1E(054, 15, Stadium) {Moves = new[] {133, 10}, TID = 2000, OT_Name = "STADIO", Language = EncounterGBLanguage.International }, // Stadium Psyduck (Amnesia)
new EncounterStatic1E(054, 15, Stadium) {Moves = new[] {133, 10}, TID = 2000, OT_Name = "ESTADIO", Language = EncounterGBLanguage.International }, // Stadium Psyduck (Amnesia)
};
}
}

View File

@@ -148,37 +148,52 @@ internal static TreeEncounterAvailable GetGSCHeadbuttAvailability(EncounterSlot
new EncounterStatic2E(251, 30, C) { Location = 014, Language = EncounterGBLanguage.Any }, // Celebi @ Ilex Forest (VC)
};
private static readonly int[] Farfetchd = {226, 14, 97, 163};
private static readonly int[] Gligar = {89, 68, 17};
internal static readonly EncounterStatic2E[] StaticEventsGB =
{
// Any Language
new EncounterStatic2E(083, 05, Stadium2) { Moves = new [] { 226, 14, 97, 163 }, Language = EncounterGBLanguage.Any }, // Stadium 2 Baton Pass Farfetch'd
new EncounterStatic2E(207, 05, Stadium2) { Moves = new [] { 89, 68, 17 }, Language = EncounterGBLanguage.Any }, // Stadium 2 Earthquake Gligar
// Stadium 2 Baton Pass Farfetch'd
new EncounterStatic2E(083, 05, GS) {Moves = Farfetchd, TID = 2000, OT_Name = "スタジアム"},
new EncounterStatic2E(083, 05, GS) {Moves = Farfetchd, TID = 2000, OT_Name = "Stadium", Language = EncounterGBLanguage.Any},
new EncounterStatic2E(083, 05, GS) {Moves = Farfetchd, TID = 2001, OT_Name = "Stade", Language = EncounterGBLanguage.Any},
new EncounterStatic2E(083, 05, GS) {Moves = Farfetchd, TID = 2001, OT_Name = "Stadion", Language = EncounterGBLanguage.Any},
new EncounterStatic2E(083, 05, GS) {Moves = Farfetchd, TID = 2001, OT_Name = "Stadio", Language = EncounterGBLanguage.Any},
new EncounterStatic2E(083, 05, GS) {Moves = Farfetchd, TID = 2001, OT_Name = "Estadio", Language = EncounterGBLanguage.Any},
// Stadium 2 Earthquake Gligar
new EncounterStatic2E(207, 05, GS) {Moves = Gligar, TID = 2000, OT_Name = "スタジアム"},
new EncounterStatic2E(207, 05, GS) {Moves = Gligar, TID = 2000, OT_Name = "Stadium", Language = EncounterGBLanguage.Any},
new EncounterStatic2E(207, 05, GS) {Moves = Gligar, TID = 2001, OT_Name = "Stade", Language = EncounterGBLanguage.Any},
new EncounterStatic2E(207, 05, GS) {Moves = Gligar, TID = 2001, OT_Name = "Stadion", Language = EncounterGBLanguage.Any},
new EncounterStatic2E(207, 05, GS) {Moves = Gligar, TID = 2001, OT_Name = "Stadio", Language = EncounterGBLanguage.Any},
new EncounterStatic2E(207, 05, GS) {Moves = Gligar, TID = 2001, OT_Name = "Estadio", Language = EncounterGBLanguage.Any},
// Japanese Only (all below)
new EncounterStatic2E(251, 30, GSC) { Location = 014 }, // Celebi @ Ilex Forest (GBC)
new EncounterStatic2E(251, 30, GSC) {Location = 014}, // Celebi @ Ilex Forest (GBC)
// Gen2 Events
// Pokémon Center Mystery Egg #1 (December 15, 2001 to January 14, 2002)
new EncounterStatic2E(152, 05, GS) { Moves = new [] { 080 }, EggLocation = 256 }, // Chikorita Petal Dance
new EncounterStatic2E(173, 05, GS) { Moves = new [] { 129 }, EggLocation = 256 }, // Cleffa Swift
new EncounterStatic2E(194, 05, GS) { Moves = new [] { 187 }, EggLocation = 256 }, // Wooper Belly Drum
new EncounterStatic2E(231, 05, GS) { Moves = new [] { 227 }, EggLocation = 256 }, // Phanpy Encore
new EncounterStatic2E(238, 05, GS) { Moves = new [] { 118 }, EggLocation = 256 }, // Smoochum Metronome
new EncounterStatic2E(152, 05, GS) {Moves = new[] {080}, EggLocation = 256}, // Chikorita Petal Dance
new EncounterStatic2E(173, 05, GS) {Moves = new[] {129}, EggLocation = 256}, // Cleffa Swift
new EncounterStatic2E(194, 05, GS) {Moves = new[] {187}, EggLocation = 256}, // Wooper Belly Drum
new EncounterStatic2E(231, 05, GS) {Moves = new[] {227}, EggLocation = 256}, // Phanpy Encore
new EncounterStatic2E(238, 05, GS) {Moves = new[] {118}, EggLocation = 256}, // Smoochum Metronome
// Pokémon Center Mystery Egg #2 (March 16 to April 7, 2002)
new EncounterStatic2E(047, 05, GS) { Moves = new [] { 080 }, EggLocation = 256 }, // Psyduck Petal Dance
new EncounterStatic2E(152, 05, GS) { Moves = new [] { 080 }, EggLocation = 256 }, // Chikorita Petal Dance
new EncounterStatic2E(172, 05, GS) { Moves = new [] { 080 }, EggLocation = 256 }, // Pichu Petal Dance
new EncounterStatic2E(173, 05, GS) { Moves = new [] { 080 }, EggLocation = 256 }, // Cleffa Petal Dance
new EncounterStatic2E(174, 05, GS) { Moves = new [] { 080 }, EggLocation = 256 }, // Igglybuff Petal Dance
new EncounterStatic2E(238, 05, GS) { Moves = new [] { 080 }, EggLocation = 256 }, // Smoochum Petal Dance
new EncounterStatic2E(047, 05, GS) {Moves = new[] {080}, EggLocation = 256}, // Psyduck Petal Dance
new EncounterStatic2E(152, 05, GS) {Moves = new[] {080}, EggLocation = 256}, // Chikorita Petal Dance
new EncounterStatic2E(172, 05, GS) {Moves = new[] {080}, EggLocation = 256}, // Pichu Petal Dance
new EncounterStatic2E(173, 05, GS) {Moves = new[] {080}, EggLocation = 256}, // Cleffa Petal Dance
new EncounterStatic2E(174, 05, GS) {Moves = new[] {080}, EggLocation = 256}, // Igglybuff Petal Dance
new EncounterStatic2E(238, 05, GS) {Moves = new[] {080}, EggLocation = 256}, // Smoochum Petal Dance
// Pokémon Center Mystery Egg #3 (April 27 to May 12, 2002)
new EncounterStatic2E(001, 05, GS) { Moves = new [] { 246 }, EggLocation = 256 }, // Bulbasaur Ancientpower
new EncounterStatic2E(004, 05, GS) { Moves = new [] { 242 }, EggLocation = 256 }, // Charmander Crunch
new EncounterStatic2E(158, 05, GS) { Moves = new [] { 066 }, EggLocation = 256 }, // Totodile Submission
new EncounterStatic2E(163, 05, GS) { Moves = new [] { 101 }, EggLocation = 256 }, // Hoot-Hoot Night Shade
new EncounterStatic2E(172, 05, GS) { Moves = new [] { 047 }, EggLocation = 256 }, // Pichu Sing
new EncounterStatic2E(001, 05, GS) {Moves = new[] {246}, EggLocation = 256}, // Bulbasaur Ancientpower
new EncounterStatic2E(004, 05, GS) {Moves = new[] {242}, EggLocation = 256}, // Charmander Crunch
new EncounterStatic2E(158, 05, GS) {Moves = new[] {066}, EggLocation = 256}, // Totodile Submission
new EncounterStatic2E(163, 05, GS) {Moves = new[] {101}, EggLocation = 256}, // Hoot-Hoot Night Shade
new EncounterStatic2E(172, 05, GS) {Moves = new[] {047}, EggLocation = 256}, // Pichu Sing
};
}
}

View File

@@ -175,12 +175,11 @@ private int GetEdgeCaseLanguage(PKM pk, int lang)
{
switch (pk.Format)
{
case 1 when Species == (int)Core.Species.Mew && Version == GameVersion.VCEvents: // VC Mew
pk.TID = 22796;
pk.OT_Name = Legal.GetG1OT_GFMew(lang);
return lang;
case 1 when Version == GameVersion.EventsGBGen1:
case 2 when Version == GameVersion.EventsGBGen2:
case 1 when this is EncounterStatic1E e1:
return e1.Language == EncounterGBLanguage.Japanese ? 1 : 2;
case 1 when this is EncounterStatic2E e2:
return e2.Language == EncounterGBLanguage.Japanese ? 1 : 2;
case 3 when this is EncounterStaticShadow s && s.EReader:
case 3 when Species == (int)Core.Species.Mew:
pk.OT_Name = "ゲーフリ";

View File

@@ -13,11 +13,6 @@ public sealed class EncounterStatic1E : EncounterStatic1
/// <summary> Trainer ID for the event. </summary>
public int TID { get; set; } = -1;
/// <summary>
/// Indicates if the event was distributed to Japanese games or International games.
/// </summary>
public bool Japanese { get; set; }
public EncounterStatic1E(int species, int level, GameVersion ver) : base(species, level, ver)
{
}
@@ -47,10 +42,13 @@ public override bool IsMatchDeferred(PKM pkm)
}
}
/// <summary>
/// Generations 1 &amp; 2 cannot communicate between Japanese &amp; International versions.
/// </summary>
public enum EncounterGBLanguage
{
Japanese,
English,
International,
Any,
}
}
}

View File

@@ -73,11 +73,6 @@ protected override bool IsMatchLocation(PKM pkm)
return Location == pkm.Met_Location;
return true;
}
public override bool IsMatchDeferred(PKM pkm)
{
return !ParseSettings.AllowGBCartEra && GameVersion.GBCartEraOnly.Contains(Version);
}
}
public sealed class EncounterStatic2Odd : EncounterStatic2

View File

@@ -13,11 +13,6 @@ public sealed class EncounterStatic2E : EncounterStatic2
/// <summary> Trainer ID for the event. </summary>
public int TID { get; set; } = -1;
/// <summary>
/// Indicates if the event was distributed to Japanese games or International games.
/// </summary>
public bool Japanese { get; set; }
public EncounterStatic2E(int species, int level, GameVersion ver) : base(species, level, ver)
{
}

View File

@@ -65,6 +65,9 @@ private static IEnumerable<IEncounterable> GenerateRawEncounters12(PKM pkm, Game
private static IEnumerable<EncounterStatic> GenerateGBEvents(PKM pkm, IReadOnlyList<EvoCriteria> chain, GameVersion game)
{
if (pkm.Korean) // only GS; no events
yield break;
foreach (var e in EncounterStaticGenerator.GetValidGBGifts(pkm, chain, game))
{
foreach (var evo in chain)

View File

@@ -82,12 +82,9 @@ public static class GameData
{ GameVersion.Gen7, Legal.LevelUpSM },
{ GameVersion.Gen7b, Legal.LevelUpGG },
{ GameVersion.Gen8, Legal.LevelUpSWSH },
{ GameVersion.VCEvents, Legal.LevelUpY },
{ GameVersion.Stadium, Legal.LevelUpY },
{ GameVersion.EventsGBGen1, Legal.LevelUpY },
{ GameVersion.Stadium2, Legal.LevelUpGS },
{ GameVersion.EventsGBGen2, Legal.LevelUpGS },
};
private static readonly Dictionary<GameVersion, PersonalTable> Personal = new Dictionary<GameVersion, PersonalTable>
@@ -165,12 +162,9 @@ public static class GameData
{ GameVersion.Gen7, PersonalTable.USUM },
{ GameVersion.Gen7b, PersonalTable.GG },
{ GameVersion.Gen8, PersonalTable.SWSH },
{ GameVersion.VCEvents, PersonalTable.Y },
{ GameVersion.Stadium, PersonalTable.Y },
{ GameVersion.EventsGBGen1, PersonalTable.Y },
{ GameVersion.Stadium2, PersonalTable.GS },
{ GameVersion.EventsGBGen2, PersonalTable.GS },
};
}
}

View File

@@ -119,16 +119,6 @@ public void VerifyOTG1(LegalityAnalysis data)
}
VerifyG1OTWithinBounds(data, tr);
if (data.EncounterOriginal is EncounterStatic s && (s.Version == GameVersion.Stadium || s.Version == GameVersion.Stadium2))
data.AddLine(VerifyG1OTStadium(pkm, tr, s));
if (pkm.Species == (int)Species.Mew)
{
var OTMatch = (tr == Legal.GetG1OT_GFMew((int)LanguageID.Japanese))
|| (tr == Legal.GetG1OT_GFMew((int)LanguageID.English));
if (!OTMatch || pkm.TID != 22796)
data.AddLine(GetInvalid(LG1OTEvent));
}
if (pkm.OT_Gender == 1 && ((pkm.Format == 2 && pkm.Met_Location == 0) || (pkm.Format > 2 && pkm.VC1)))
data.AddLine(GetInvalid(LG1OTGender));
@@ -157,36 +147,6 @@ private void VerifyG1OTWithinBounds(LegalityAnalysis data, string str)
}
}
private CheckResult VerifyG1OTStadium(PKM pkm, string tr, IVersion s)
{
if (pkm.OT_Gender != 0)
return GetInvalid(LG1OTGender);
int tid = pkm.TID;
if (pkm.Japanese)
{
if (tid == Legal.GetGBStadiumOTID_JPN(s.Version) && Legal.Stadium1JP == tr)
return GetValid(LG1StadiumJapanese);
}
else
{
if (s.Version == GameVersion.Stadium && tid == 2000)
{
if (tr == "STADIUM" || tr == "STADE" || tr == "STADIO" || tr == "ESTADIO")
return GetValid(LG1StadiumInternational);
}
else // Stadium2
{
if (tid == 2000 && tr == "Stadium")
return GetValid(LG1StadiumInternational);
if (tid == 2001 && (tr == "Stade" || tr == "Stadion" || tr == "Stadio" || tr == "Estadio"))
return GetValid(LG1StadiumInternational);
}
}
return GetInvalid(LG1Stadium);
}
private static bool IsOTNameSuspicious(string name)
{
return SuspiciousOTNames.Any(name.StartsWith);

View File

@@ -152,15 +152,6 @@ public void VerifyTransferLegalityG8(LegalityAnalysis data)
public IEnumerable<CheckResult> VerifyVCEncounter(PKM pkm, IEncounterable encounter, ILocation transfer, IList<CheckMoveResult> Moves)
{
// Check existing EncounterMatch
if (encounter is EncounterStatic v && (GameVersion.GBCartEraOnly.Contains(v.Version) || v.Version == GameVersion.VCEvents))
{
bool exceptions = false;
exceptions |= v.Version == GameVersion.VCEvents && encounter.Species == (int)Species.Mew && pkm.TID == 22796;
if (!exceptions)
yield return GetInvalid(LG1GBEncounter);
}
if (pkm.Met_Location != transfer.Location)
yield return GetInvalid(LTransferMetLocation);
if (pkm.Egg_Location != transfer.EggLocation)