From baf0f52f069ddef3340f9a9116cac875e79b0630 Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 26 Dec 2019 12:59:16 -0800 Subject: [PATCH] Handle downleveled raids Closes #2573 - self-hosted raids can be downleveled too (see cufant), probably only by 1 rank - min-rank check now checks for downleveled cases - Add extra gyarados/ferrothorn locations --- PKHeX.Core/Legality/Encounters/Data/Encounters8.cs | 4 ++-- PKHeX.Core/Legality/Encounters/EncounterStatic8N.cs | 9 ++++++++- .../Encounters/Information/ValidEncounterMoves.cs | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs b/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs index 267220b55..74223a2f6 100644 --- a/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs +++ b/PKHeX.Core/Legality/Encounters/Data/Encounters8.cs @@ -141,7 +141,7 @@ namespace PKHeX.Core new EncounterStatic8S{ Species = 091, Level = 46, Locations = new[] {128, 130}, }, // Cloyster at East/West Lake Axewell (in a Wild Area) new EncounterStatic8S{ Species = 131, Level = 56, Locations = new[] {128, 130, 134, 138, 154 }, }, // Lapras at North/East/South/West Lake Miloch/Axwell, the Lake of Outrage (in a Wild Area) new EncounterStatic8S{ Species = 119, Level = 46, Locations = new[] {128, 130, 134, 138, 142, 154 }, }, // Seaking in Bridge Field, at North/East/South/West Lake Miloch/Axwell, at the Lake of Outrage (in a Wild Area) - new EncounterStatic8 { Species = 130, Level = 56, Location = 146, }, // Gyarados in Dusty Bowl (in a Wild Area) + new EncounterStatic8S{ Species = 130, Level = 56, Locations = new[] {128, 146}, }, // Gyarados in East Lake Axewell, Dusty Bowl (in a Wild Area) new EncounterStatic8 { Species = 279, Level = 46, Location = 142, }, // Pelipper in Bridge Field (in a Wild Area) new EncounterStatic8 { Species = 853, Level = 56, Location = 130, }, // Grapploct at West Lake Axewell (in a Wild Area) new EncounterStatic8S{ Species = 593, Level = 46, Locations = new[] {128, 130, 134, 138, 154 }, }, // Jellicent at North/East/South/West Lake Miloch/Axwell, the Lake of Outrage (in a Wild Area) @@ -166,7 +166,7 @@ namespace PKHeX.Core new EncounterStatic8 { Species = 768, Level = 50, Location = 142, }, // Golisopod in Bridge Field (in a Wild Area) new EncounterStatic8 { Species = 760, Level = 42, Location = 142, }, // Bewear in Bridge Field (in a Wild Area) new EncounterStatic8 { Species = 820, Level = 42, Location = 142, }, // Greedent in Bridge Field (in a Wild Area) - new EncounterStatic8 { Species = 598, Level = 40, Location = 142, }, // Ferrothorn in Bridge Field (in a Wild Area) + new EncounterStatic8S{ Species = 598, Level = 40, Locations = new[] {142, 144}, }, // Ferrothorn in Bridge Field (in a Wild Area) new EncounterStatic8 { Species = 344, Level = 42, Location = 144, }, // Claydol in the Stony Wilderness (in a Wild Area) new EncounterStatic8 { Species = 477, Level = 60, Location = 144, }, // Dusknoir in the Stony Wilderness (in a Wild Area) new EncounterStatic8 { Species = 623, Level = 43, Location = 144, }, // Golurk in the Stony Wilderness (in a Wild Area) diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic8N.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic8N.cs index c01edf6b8..14c7686ad 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic8N.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic8N.cs @@ -51,8 +51,15 @@ namespace PKHeX.Core var rank = (uint)(metLevel / 10); if (rank > 4) return false; - if (rank < MinRank || MaxRank < rank) + if (rank > MaxRank) return false; + if (rank < MinRank) // downleveled + { + if (pkm.Met_Location == SharedNest) + { } // shared nests can be downleveled to any + else if (MinRank - rank > 1) // native downlevels: only allow 1 rank down (?) + return false; + } return metLevel % 10 <= 5; } diff --git a/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs b/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs index c61dc0950..687a6fcf9 100644 --- a/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs +++ b/PKHeX.Core/Legality/Encounters/Information/ValidEncounterMoves.cs @@ -33,7 +33,7 @@ namespace PKHeX.Core { switch (encounter) { - case EncounterStatic8N r when pkm.Met_Location == Encounters8Nest.SharedNest && !EncounterStatic8N.IsHighestLevelTier(pkm.Met_Level): + case EncounterStatic8N r when !EncounterStatic8N.IsHighestLevelTier(pkm.Met_Level): // Downleveled Raid can happen for shared raids and self-hosted raids. moves.AddRange(MoveLevelUp.GetMovesLevelUp(pkm, r.Species, -1, -1, 60, r.Form, GameVersion.SW, false, 8)); break; }