diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs
index 2993e3832..9afd6bc65 100644
--- a/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs
+++ b/PKHeX.Core/Legality/Encounters/Data/Encounters1.cs
@@ -87,8 +87,6 @@ internal static class Encounters1
new EncounterStatic1(133, 25, Stadium), // Eevee
new EncounterStatic1(138, 20, Stadium), // Omanyte
new EncounterStatic1(140, 20, Stadium), // Kabuto
- new EncounterStatic1(054, 15, Stadium) { Moves = new [] { 133, 10 } }, // Stadium Psyduck (Amnesia)
- new EncounterStatic1(151, 5, VCEvents) { IVs = new [] {15,15,15,15,15,15} }, // Event Mew
};
internal static readonly EncounterTrade1[] TradeGift_RBY_Common =
@@ -152,5 +150,15 @@ internal static class Encounters1
new EncounterTrade1(051, 05, RBY), // Dugtrio - Trade Lickitung (GSC 5)
new EncounterTrade1(047, 05, RBY), // Parasect - Trade Tangela (GSC 5)
});
+
+ internal static readonly EncounterStatic1E[] StaticEventsVC =
+ {
+ new EncounterStatic1E(151, 5, VCEvents) {IVs = new[] {15, 15, 15, 15, 15, 15}, Language = EncounterGBLanguage.Any }, // Event Mew
+ };
+
+ internal static readonly EncounterStatic1E[] StaticEventsGB =
+ {
+ new EncounterStatic1E(054, 15, Stadium) {Moves = new[] {133, 10}, Language = EncounterGBLanguage.Any }, // Stadium Psyduck (Amnesia)
+ };
}
}
diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs
index 35476e617..5d8e67573 100644
--- a/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs
+++ b/PKHeX.Core/Legality/Encounters/Data/Encounters2.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using static PKHeX.Core.EncounterUtil;
+using static PKHeX.Core.GameVersion;
namespace PKHeX.Core
{
@@ -23,82 +24,56 @@ internal static class Encounters2
private static readonly EncounterStatic2[] Encounter_GSC_Common =
{
- new EncounterStatic2(152, 05) { Location = 001, Version = GameVersion.GSC }, // Chikorita @ New Bark Town
- new EncounterStatic2(155, 05) { Location = 001, Version = GameVersion.GSC }, // Cyndaquil @ New Bark Town
- new EncounterStatic2(158, 05) { Location = 001, Version = GameVersion.GSC }, // Totodile @ New Bark Town
+ new EncounterStatic2(152, 05, GSC) { Location = 001 }, // Chikorita @ New Bark Town
+ new EncounterStatic2(155, 05, GSC) { Location = 001 }, // Cyndaquil @ New Bark Town
+ new EncounterStatic2(158, 05, GSC) { Location = 001 }, // Totodile @ New Bark Town
- new EncounterStatic2(175, 05) { Version = GameVersion.GSC, EggLocation = 256 }, // Togepi
- new EncounterStatic2(131, 20) { Location = 010, Version = GameVersion.GSC }, // Lapras @ Union Cave
- new EncounterStatic2(133, 20) { Location = 016, Version = GameVersion.GSC }, // Eevee @ Goldenrod City
+ new EncounterStatic2(175, 05, GSC) { EggLocation = 256 }, // Togepi
+ new EncounterStatic2(131, 20, GSC) { Location = 010 }, // Lapras @ Union Cave
+ new EncounterStatic2(133, 20, GSC) { Location = 016 }, // Eevee @ Goldenrod City
- new EncounterStatic2(185, 20) { Location = 020, Version = GameVersion.GSC }, // Sudowoodo @ Route 36
- new EncounterStatic2(236, 10) { Location = 035, Version = GameVersion.GSC }, // Tyrogue @ Mt. Mortar
+ new EncounterStatic2(185, 20, GSC) { Location = 020 }, // Sudowoodo @ Route 36
+ new EncounterStatic2(236, 10, GSC) { Location = 035 }, // Tyrogue @ Mt. Mortar
- new EncounterStatic2(130, 30) { Location = 038, Version = GameVersion.GSC, Shiny = Shiny.Always, }, // Gyarados @ Lake of Rage
- new EncounterStatic2(074, 21) { Location = 036, Version = GameVersion.GSC }, // Geodude @ Rocket Hideout (Mahogany Town)
- new EncounterStatic2(109, 21) { Location = 036, Version = GameVersion.GSC }, // Koffing @ Rocket Hideout (Mahogany Town)
- new EncounterStatic2(100, 23) { Location = 036, Version = GameVersion.GSC }, // Voltorb @ Rocket Hideout (Mahogany Town)
- new EncounterStatic2(101, 23) { Location = 036, Version = GameVersion.GSC }, // Electrode @ Rocket Hideout (Mahogany Town)
- new EncounterStatic2(143, 50) { Location = 061, Version = GameVersion.GSC }, // Snorlax @ Vermillion City
+ new EncounterStatic2(130, 30, GSC) { Location = 038, Shiny = Shiny.Always, }, // Gyarados @ Lake of Rage
+ new EncounterStatic2(074, 21, GSC) { Location = 036 }, // Geodude @ Rocket Hideout (Mahogany Town)
+ new EncounterStatic2(109, 21, GSC) { Location = 036 }, // Koffing @ Rocket Hideout (Mahogany Town)
+ new EncounterStatic2(100, 23, GSC) { Location = 036 }, // Voltorb @ Rocket Hideout (Mahogany Town)
+ new EncounterStatic2(101, 23, GSC) { Location = 036 }, // Electrode @ Rocket Hideout (Mahogany Town)
+ new EncounterStatic2(143, 50, GSC) { Location = 061 }, // Snorlax @ Vermillion City
- new EncounterStatic2(211, 05) { Location = 008, Version = GameVersion.GSC }, // Qwilfish Swarm @ Route 32 (Old Rod)
- new EncounterStatic2(211, 20) { Location = 008, Version = GameVersion.GSC }, // Qwilfish Swarm @ Route 32 (Good Rod)
- new EncounterStatic2(211, 40) { Location = 008, Version = GameVersion.GSC }, // Qwilfish Swarm @ Route 32 (Super Rod)
-
- new EncounterStatic2(083, 05) { Moves = new [] { 226, 14, 97, 163 }, Version = GameVersion.Stadium2 }, // Stadium 2 Baton Pass Farfetch'd
- new EncounterStatic2(207, 05) { Moves = new [] { 89, 68, 17 }, Version = GameVersion.Stadium2 }, // Stadium 2 Earthquake Gligar
-
- // Gen2 Events
- // Pokémon Center Mystery Egg #1 (December 15, 2001 to January 14, 2002)
- new EncounterStatic2(152, 05) { Moves = new [] { 080 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Chikorita Petal Dance
- new EncounterStatic2(173, 05) { Moves = new [] { 129 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Cleffa Swift
- new EncounterStatic2(194, 05) { Moves = new [] { 187 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Wooper Belly Drum
- new EncounterStatic2(231, 05) { Moves = new [] { 227 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Phanpy Encore
- new EncounterStatic2(238, 05) { Moves = new [] { 118 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Smoochum Metronome
-
- // Pokémon Center Mystery Egg #2 (March 16 to April 7, 2002)
- new EncounterStatic2(047, 05) { Moves = new [] { 080 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Psyduck Petal Dance
- // new EncounterStatic(152, 05, Moves = new [] { 080 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Chikorita Petal Dance
- new EncounterStatic2(172, 05) { Moves = new [] { 080 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Pichu Petal Dance
- new EncounterStatic2(173, 05) { Moves = new [] { 080 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Cleffa Petal Dance
- new EncounterStatic2(174, 05) { Moves = new [] { 080 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Igglybuff Petal Dance
- new EncounterStatic2(238, 05) { Moves = new [] { 080 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Smoochum Petal Dance
-
- // Pokémon Center Mystery Egg #3 (April 27 to May 12, 2002)
- new EncounterStatic2(001, 05) { Moves = new [] { 246 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Bulbasaur Ancientpower
- new EncounterStatic2(004, 05) { Moves = new [] { 242 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Charmander Crunch
- new EncounterStatic2(158, 05) { Moves = new [] { 066 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Totodile Submission
- new EncounterStatic2(163, 05) { Moves = new [] { 101 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Hoot-Hoot Night Shade
- new EncounterStatic2(172, 05) { Moves = new [] { 047 }, Version = GameVersion.EventsGBGen2, EggLocation = 256 }, // Pichu Sing
+ new EncounterStatic2(211, 05, GSC) { Location = 008 }, // Qwilfish Swarm @ Route 32 (Old Rod)
+ new EncounterStatic2(211, 20, GSC) { Location = 008 }, // Qwilfish Swarm @ Route 32 (Good Rod)
+ new EncounterStatic2(211, 40, GSC) { Location = 008 }, // Qwilfish Swarm @ Route 32 (Super Rod)
};
private static readonly EncounterStatic2[] Encounter_GS_Exclusive =
{
- new EncounterStatic2(245, 40) { Version = GameVersion.GS }, // Suicune
+ new EncounterStatic2(245, 40, GS), // Suicune
- new EncounterStatic2(249, 70) { Version = GameVersion.GD }, // Lugia @ Whirl Islands
- new EncounterStatic2(249, 40) { Version = GameVersion.SV }, // Lugia @ Whirl Islands
+ new EncounterStatic2(249, 70, GD), // Lugia @ Whirl Islands
+ new EncounterStatic2(249, 40, SV), // Lugia @ Whirl Islands
- new EncounterStatic2(250, 40) { Version = GameVersion.GD }, // Ho-Oh @ Tin Tower
- new EncounterStatic2(250, 70) { Version = GameVersion.SV }, // Ho-Oh @ Tin Tower
+ new EncounterStatic2(250, 40, GD), // Ho-Oh @ Tin Tower
+ new EncounterStatic2(250, 70, SV), // Ho-Oh @ Tin Tower
- new EncounterStatic2(137, 15) { Version = GameVersion.GS }, // Porygon @ Celadon Game Corner
- new EncounterStatic2(133, 15) { Version = GameVersion.GS }, // Eevee @ Celadon Game Corner
- new EncounterStatic2(122, 15) { Version = GameVersion.GS }, // Mr. Mime @ Celadon Game Corner
+ new EncounterStatic2(137, 15, GS), // Porygon @ Celadon Game Corner
+ new EncounterStatic2(133, 15, GS), // Eevee @ Celadon Game Corner
+ new EncounterStatic2(122, 15, GS), // Mr. Mime @ Celadon Game Corner
- new EncounterStatic2(063, 10) { Version = GameVersion.GS }, // Abra @ Goldenrod City (Game Corner)
- new EncounterStatic2(147, 10) { Version = GameVersion.GS }, // Dratini @ Goldenrod City (Game Corner)
- new EncounterStatic2(023, 10) { Version = GameVersion.GS }, // Ekans @ Goldenrod City (Game Corner) (Gold)
- new EncounterStatic2(027, 10) { Version = GameVersion.GS }, // Sandshrew @ Goldenrod City (Game Corner) (Silver)
+ new EncounterStatic2(063, 10, GS), // Abra @ Goldenrod City (Game Corner)
+ new EncounterStatic2(147, 10, GS), // Dratini @ Goldenrod City (Game Corner)
+ new EncounterStatic2(023, 10, GS), // Ekans @ Goldenrod City (Game Corner) (Gold)
+ new EncounterStatic2(027, 10, GS), // Sandshrew @ Goldenrod City (Game Corner) (Silver)
- new EncounterStatic2(223, 05) { Version = GameVersion.GS }, // Remoraid Swarm @ Route 44 (Old Rod)
- new EncounterStatic2(223, 20) { Version = GameVersion.GS }, // Remoraid Swarm @ Route 44 (Good Rod)
- new EncounterStatic2(223, 40) { Version = GameVersion.GS }, // Remoraid Swarm @ Route 44 (Super Rod)
+ new EncounterStatic2(223, 05, GS), // Remoraid Swarm @ Route 44 (Old Rod)
+ new EncounterStatic2(223, 20, GS), // Remoraid Swarm @ Route 44 (Good Rod)
+ new EncounterStatic2(223, 40, GS), // Remoraid Swarm @ Route 44 (Super Rod)
};
private static readonly EncounterStatic2[] Encounter_C_Exclusive =
{
- new EncounterStatic2(245, 40) { Location = 023, Version = GameVersion.C }, // Suicune @ Tin Tower
+ new EncounterStatic2(245, 40, C) { Location = 023 }, // Suicune @ Tin Tower
new EncounterStatic2Odd(172), // Pichu Dizzy Punch
new EncounterStatic2Odd(173), // Cleffa Dizzy Punch
@@ -108,27 +83,25 @@ internal static class Encounters2
new EncounterStatic2Odd(239), // Elekid Dizzy Punch
new EncounterStatic2Odd(240), // Magby Dizzy Punch
- new EncounterStatic2(147, 15) { Location = 042, Version = GameVersion.C, Moves = new [] {245} }, // Dratini ExtremeSpeed
+ new EncounterStatic2(147, 15, C) { Location = 042, Moves = new [] {245} }, // Dratini ExtremeSpeed
- new EncounterStatic2(249, 60) { Location = 031, Version = GameVersion.C }, // Lugia @ Whirl Islands
- new EncounterStatic2(250, 60) { Location = 023, Version = GameVersion.C }, // Ho-Oh @ Tin Tower
- new EncounterStatic2(251, 30) { Location = 014, Version = GameVersion.C }, // Celebi @ Ilex Forest (VC)
- new EncounterStatic2(251, 30) { Location = 014, Version = GameVersion.EventsGBGen2 }, // Celebi @ Ilex Forest (GBC)
+ new EncounterStatic2(249, 60, C) { Location = 031 }, // Lugia @ Whirl Islands
+ new EncounterStatic2(250, 60, C) { Location = 023 }, // Ho-Oh @ Tin Tower
- new EncounterStatic2(137, 15) { Location = 071, Version = GameVersion.C }, // Porygon @ Celadon Game Corner
- new EncounterStatic2(025, 25) { Location = 071, Version = GameVersion.C }, // Pikachu @ Celadon Game Corner
- new EncounterStatic2(246, 40) { Location = 071, Version = GameVersion.C }, // Larvitar @ Celadon Game Corner
+ new EncounterStatic2(137, 15, C) { Location = 071 }, // Porygon @ Celadon Game Corner
+ new EncounterStatic2(025, 25, C) { Location = 071 }, // Pikachu @ Celadon Game Corner
+ new EncounterStatic2(246, 40, C) { Location = 071 }, // Larvitar @ Celadon Game Corner
- new EncounterStatic2(063, 05) { Location = 016, Version = GameVersion.C }, // Abra @ Goldenrod City (Game Corner)
- new EncounterStatic2(104, 15) { Location = 016, Version = GameVersion.C }, // Cubone @ Goldenrod City (Game Corner)
- new EncounterStatic2(202, 15) { Location = 016, Version = GameVersion.C }, // Wobbuffet @ Goldenrod City (Game Corner)
+ new EncounterStatic2(063, 05, C) { Location = 016 }, // Abra @ Goldenrod City (Game Corner)
+ new EncounterStatic2(104, 15, C) { Location = 016 }, // Cubone @ Goldenrod City (Game Corner)
+ new EncounterStatic2(202, 15, C) { Location = 016 }, // Wobbuffet @ Goldenrod City (Game Corner)
};
private static readonly EncounterStatic2[] Encounter_GSC_Roam =
{
- new EncounterStatic2Roam(243, 40) { Version = GameVersion.GSC }, // Raikou
- new EncounterStatic2Roam(244, 40) { Version = GameVersion.GSC }, // Entei
- new EncounterStatic2Roam(245, 40) { Version = GameVersion.GS }, // Suicune
+ new EncounterStatic2Roam(243, 40, GSC), // Raikou
+ new EncounterStatic2Roam(244, 40, GSC), // Entei
+ new EncounterStatic2Roam(245, 40, GS), // Suicune
};
private static readonly EncounterStatic2[] Encounter_GS = Encounter_GSC_Common.Concat(Encounter_GS_Exclusive).Concat(Encounter_GSC_Roam).ToArray();
@@ -169,5 +142,43 @@ internal static TreeEncounterAvailable GetGSCHeadbuttAvailability(EncounterSlot
internal static readonly EncounterStatic2[] StaticGSC = Encounter_GSC;
internal static readonly EncounterStatic2[] StaticGS = Encounter_GS;
internal static readonly EncounterStatic2[] StaticC = Encounter_C;
+
+ internal static readonly EncounterStatic2E[] StaticEventsVC =
+ {
+ new EncounterStatic2E(251, 30, C) { Location = 014, Language = EncounterGBLanguage.Any }, // Celebi @ Ilex Forest (VC)
+ };
+
+ 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
+
+ // Japanese Only (all below)
+ 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
+
+ // 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
+
+ // 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
+ };
}
}
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1.cs
index 2c5516c50..5aa69b3f6 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1.cs
@@ -1,6 +1,6 @@
namespace PKHeX.Core
{
- public sealed class EncounterStatic1 : EncounterStatic
+ public class EncounterStatic1 : EncounterStatic
{
public override int Generation => 1;
@@ -29,10 +29,13 @@ protected override bool IsMatchLocation(PKM pkm)
public override bool IsMatchDeferred(PKM pkm)
{
- if (pkm is PK1 pk1 && pk1.Gen1_NotTradeback && !IsCatchRateValid(pk1))
- return true;
-
- return !ParseSettings.AllowGBCartEra && GameVersion.GBCartEraOnly.Contains(Version);
+ if (!(pkm is PK1 pk1))
+ return false;
+ if (!pk1.Gen1_NotTradeback)
+ return false;
+ if (IsCatchRateValid(pk1))
+ return false;
+ return true;
}
private bool IsCatchRateValid(PK1 pk1)
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1E.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1E.cs
new file mode 100644
index 000000000..f839bfefe
--- /dev/null
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic1E.cs
@@ -0,0 +1,56 @@
+namespace PKHeX.Core
+{
+ ///
+ /// Event data for Generation 1
+ ///
+ public sealed class EncounterStatic1E : EncounterStatic1
+ {
+ public EncounterGBLanguage Language { get; set; } = EncounterGBLanguage.Japanese;
+
+ /// Trainer name for the event.
+ public string OT_Name { get; set; } = string.Empty;
+
+ /// Trainer ID for the event.
+ public int TID { get; set; } = -1;
+
+ ///
+ /// Indicates if the event was distributed to Japanese games or International games.
+ ///
+ public bool Japanese { get; set; }
+
+ public EncounterStatic1E(int species, int level, GameVersion ver) : base(species, level, ver)
+ {
+ }
+
+ public override bool IsMatch(PKM pkm, DexLevel evo)
+ {
+ if (!base.IsMatch(pkm, evo))
+ return false;
+
+ if (Language != EncounterGBLanguage.Any && pkm.Japanese != (Language == EncounterGBLanguage.Japanese))
+ return false;
+
+ if (OT_Name.Length != 0 && pkm.OT_Name != OT_Name)
+ return false;
+
+ if (TID != -1 && pkm.TID != TID)
+ return false;
+
+ return true;
+ }
+
+ public override bool IsMatchDeferred(PKM pkm)
+ {
+ if (base.IsMatchDeferred(pkm))
+ return true;
+ return !ParseSettings.AllowGBCartEra;
+ }
+ }
+
+ public enum EncounterGBLanguage
+ {
+ Japanese,
+ English,
+ Any,
+ }
+}
\ No newline at end of file
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs
index 5d7950c56..e07cbe227 100644
--- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2.cs
@@ -8,10 +8,11 @@ public class EncounterStatic2 : EncounterStatic
public sealed override int Generation => 2;
public sealed override int Level { get; set; }
- public EncounterStatic2(int species, int level)
+ public EncounterStatic2(int species, int level, GameVersion ver)
{
Species = species;
Level = level;
+ Version = ver;
}
protected override bool IsMatchEggLocation(PKM pkm)
@@ -84,9 +85,8 @@ public sealed class EncounterStatic2Odd : EncounterStatic2
private const int Dizzy = 146;
private static readonly int[] _dizzy = { Dizzy };
- public EncounterStatic2Odd(int species) : base(species, 5)
+ public EncounterStatic2Odd(int species) : base(species, 5, GameVersion.C)
{
- Version = GameVersion.C;
Moves = _dizzy;
EggLocation = 256;
EggCycles = 20;
@@ -116,7 +116,7 @@ public sealed class EncounterStatic2Roam : EncounterStatic2
public override int Location => Roaming_MetLocation_GSC_Grass[0];
- public EncounterStatic2Roam(int species, int level) : base(species, level) { }
+ public EncounterStatic2Roam(int species, int level, GameVersion ver) : base(species, level, ver) { }
protected override bool IsMatchLocation(PKM pkm)
{
diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs
new file mode 100644
index 000000000..ba8624947
--- /dev/null
+++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic2E.cs
@@ -0,0 +1,49 @@
+namespace PKHeX.Core
+{
+ ///
+ /// Event data for Generation 2
+ ///
+ public sealed class EncounterStatic2E : EncounterStatic2
+ {
+ public EncounterGBLanguage Language { get; set; } = EncounterGBLanguage.Japanese;
+
+ /// Trainer name for the event.
+ public string OT_Name { get; set; } = string.Empty;
+
+ /// Trainer ID for the event.
+ public int TID { get; set; } = -1;
+
+ ///
+ /// Indicates if the event was distributed to Japanese games or International games.
+ ///
+ public bool Japanese { get; set; }
+
+ public EncounterStatic2E(int species, int level, GameVersion ver) : base(species, level, ver)
+ {
+ }
+
+ public override bool IsMatch(PKM pkm, DexLevel evo)
+ {
+ if (!base.IsMatch(pkm, evo))
+ return false;
+
+ if (Language != EncounterGBLanguage.Any && pkm.Japanese != (Language == EncounterGBLanguage.Japanese))
+ return false;
+
+ if (OT_Name.Length != 0 && pkm.OT_Name != OT_Name)
+ return false;
+
+ if (TID != -1 && pkm.TID != TID)
+ return false;
+
+ return true;
+ }
+
+ public override bool IsMatchDeferred(PKM pkm)
+ {
+ if (base.IsMatchDeferred(pkm))
+ return true;
+ return !ParseSettings.AllowGBCartEra;
+ }
+ }
+}
diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs
index 885107502..180df9849 100644
--- a/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs
+++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterGenerator12.cs
@@ -42,26 +42,6 @@ private static IEnumerable GenerateRawEncounters12(PKM pkm, Game
}
foreach (var s in EncounterStaticGenerator.GetValidStaticEncounter(pkm, chain, game))
{
- // Valid stadium and non-stadium encounters, return only non-stadium encounters, they are less restrictive
- switch (s.Version)
- {
- case GameVersion.Stadium:
- case GameVersion.Stadium2:
- deferred.Add(s);
- continue;
- case GameVersion.EventsGBGen2:
- if (!s.EggEncounter && !pkm.HasOriginalMetLocation)
- continue;
- if (pkm.Japanese)
- deferred.Add(s);
- continue;
- case GameVersion.C when pkm.Format == 2: // Crystal specific data needs to be present
- if (!s.EggEncounter && !pkm.HasOriginalMetLocation)
- continue;
- if (s.Species == (int)Species.Celebi && ParseSettings.AllowGBCartEra) // no Celebi, the GameVersion.EventsGBGen2 will pass thru
- continue;
- break;
- }
yield return s;
}
foreach (var e in EncounterSlotGenerator.GetValidWildEncounters12(pkm, chain, game))
@@ -74,10 +54,27 @@ private static IEnumerable GenerateRawEncounters12(PKM pkm, Game
yield return e;
}
+ foreach (var s in GenerateGBEvents(pkm, chain, game))
+ {
+ yield return s;
+ }
+
foreach (var d in deferred)
yield return d;
}
+ private static IEnumerable GenerateGBEvents(PKM pkm, IReadOnlyList chain, GameVersion game)
+ {
+ foreach (var e in EncounterStaticGenerator.GetValidGBGifts(pkm, chain, game))
+ {
+ foreach (var evo in chain)
+ {
+ if (e.IsMatch(pkm, evo))
+ yield return e;
+ }
+ }
+ }
+
private static IEnumerable GenerateFilteredEncounters12(PKM pkm)
{
// If the current data indicates that it must have originated from Crystal, only yield encounter data from Crystal.
diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterMovesetGenerator.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterMovesetGenerator.cs
index 6d4de1686..45155a74b 100644
--- a/PKHeX.Core/Legality/Encounters/Generator/EncounterMovesetGenerator.cs
+++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterMovesetGenerator.cs
@@ -253,6 +253,23 @@ private static IEnumerable GetStatic(PKM pk, IReadOnlyCollectio
if (!needs.Except(em).Any())
yield return enc;
}
+
+ if (pk.GenNumber > 2)
+ yield break;
+
+ var gifts = EncounterStaticGenerator.GetPossibleGBGifts(pk, chain);
+ foreach (var enc in gifts)
+ {
+ if (needs.Count == 0)
+ {
+ yield return enc;
+ continue;
+ }
+
+ var em = enc.Moves;
+ if (!needs.Except(em).Any())
+ yield return enc;
+ }
}
///
diff --git a/PKHeX.Core/Legality/Encounters/Generator/EncounterStaticGenerator.cs b/PKHeX.Core/Legality/Encounters/Generator/EncounterStaticGenerator.cs
index 0f7a3830f..02e5318a3 100644
--- a/PKHeX.Core/Legality/Encounters/Generator/EncounterStaticGenerator.cs
+++ b/PKHeX.Core/Legality/Encounters/Generator/EncounterStaticGenerator.cs
@@ -23,10 +23,25 @@ public static IEnumerable GetPossible(PKM pkm, IReadOnlyList !GameVersion.GBCartEraOnly.Contains(e.Version));
+ var table = GetEncounterStaticTable(pkm, gameSource);
+ return table.Where(e => chain.Any(d => d.Species == e.Species));
+ }
+
+ public static IEnumerable GetPossibleGBGifts(PKM pkm, IReadOnlyList chain, GameVersion gameSource = GameVersion.Any)
+ {
+ if (gameSource == GameVersion.Any)
+ gameSource = (GameVersion)pkm.Version;
+
+ static IEnumerable GetEvents(GameVersion g)
+ {
+ if (g == GameVersion.RBY)
+ return !ParseSettings.AllowGBCartEra ? Encounters1.StaticEventsVC : Encounters1.StaticEventsGB;
+
+ return !ParseSettings.AllowGBCartEra ? Encounters2.StaticEventsVC : Encounters2.StaticEventsGB;
+ }
+
+ var table = GetEvents(gameSource);
+ return table.Where(e => chain.Any(d => d.Species == e.Species));
}
public static IEnumerable GetValidStaticEncounter(PKM pkm, IReadOnlyList chain, GameVersion gameSource = GameVersion.Any)
@@ -37,6 +52,26 @@ public static IEnumerable GetValidStaticEncounter(PKM pkm, IRea
return GetMatchingStaticEncounters(pkm, poss, chain);
}
+ public static IEnumerable GetValidGBGifts(PKM pkm, IReadOnlyList chain, GameVersion gameSource = GameVersion.Any)
+ {
+ if (gameSource == GameVersion.Any)
+ gameSource = (GameVersion)pkm.Version;
+
+ var poss = GetPossibleGBGifts(pkm, chain, gameSource: gameSource);
+ foreach (EncounterStatic e in poss)
+ {
+ foreach (var dl in chain)
+ {
+ if (dl.Species != e.Species)
+ continue;
+ if (!e.IsMatch(pkm, dl))
+ continue;
+
+ yield return e;
+ }
+ }
+ }
+
private static IEnumerable GetMatchingStaticEncounters(PKM pkm, IEnumerable poss, IReadOnlyList evos)
{
// check for petty rejection scenarios that will be flagged by other legality checks
@@ -61,15 +96,6 @@ private static IEnumerable GetMatchingStaticEncounters(PKM pkm,
yield return e;
}
- private static IEnumerable GetStaticEncounters(PKM pkm, IReadOnlyList dl, GameVersion gameSource = GameVersion.Any)
- {
- if (gameSource == GameVersion.Any)
- gameSource = (GameVersion)pkm.Version;
-
- var table = GetEncounterStaticTable(pkm, gameSource);
- return table.Where(e => dl.Any(d => d.Species == e.Species));
- }
-
internal static EncounterStatic7 GetVCStaticTransferEncounter(PKM pkm, IEncounterable enc)
{
var species = pkm.Species;