From 70e10478ddbee95f4a96ce2e4eca8140aec3cc94 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 6 Aug 2021 14:54:32 -0700 Subject: [PATCH] Extract fog boost location check --- PKHeX.Core/Legality/Areas/EncounterArea8.cs | 1 + .../Legality/Encounters/EncounterSlot/EncounterSlot8.cs | 2 +- .../Legality/Encounters/EncounterStatic/EncounterStatic8.cs | 4 ++-- PKHeX.Core/Legality/Verifiers/MarkVerifier.cs | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/PKHeX.Core/Legality/Areas/EncounterArea8.cs b/PKHeX.Core/Legality/Areas/EncounterArea8.cs index 306343bff..c330d548f 100644 --- a/PKHeX.Core/Legality/Areas/EncounterArea8.cs +++ b/PKHeX.Core/Legality/Areas/EncounterArea8.cs @@ -113,6 +113,7 @@ private static bool CanCrossoverTo(int fromLocation, int toLocation, AreaSlotTyp public static bool IsWildArea(int location) => IsWildArea8(location) || IsWildArea8Armor(location) || IsWildArea8Crown(location); public static bool IsBoostedArea60(int location) => IsWildArea(location); + public static bool IsBoostedArea60Fog(int location) => IsWildArea8(location); // IoA doesn't have fog restriction by badges, and all Crown stuff is above 60. public static bool IsWildArea8(int location) => location is >= 122 and <= 154; // Rolling Fields -> Lake of Outrage public static bool IsWildArea8Armor(int location) => location is >= 164 and <= 194; // Fields of Honor -> Honeycalm Island diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs index ffb35a4b0..40a3067c8 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot8.cs @@ -27,7 +27,7 @@ protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteri ((PK8)pk).RibbonMarkCurry = true; base.ApplyDetails(sav, c, pk); - if (Weather is AreaWeather8.Heavy_Fog && EncounterArea8.IsBoostedArea60(Location)) + if (Weather is AreaWeather8.Heavy_Fog && EncounterArea8.IsBoostedArea60Fog(Location)) pk.CurrentLevel = pk.Met_Level = EncounterArea8.BoostLevel; var req = GetRequirement(pk); diff --git a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs index 14270b43f..a27c2e275 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterStatic/EncounterStatic8.cs @@ -35,7 +35,7 @@ public override bool IsMatchExact(PKM pkm, DexLevel evo) { if (pkm is IDynamaxLevel d && d.DynamaxLevel < DynamaxLevel) return false; - if (pkm.Met_Level < EncounterArea8.BoostLevel && Weather is AreaWeather8.Heavy_Fog && EncounterArea8.IsBoostedArea60(Location)) + if (pkm.Met_Level < EncounterArea8.BoostLevel && Weather is AreaWeather8.Heavy_Fog && EncounterArea8.IsBoostedArea60Fog(Location)) return false; return base.IsMatchExact(pkm, evo); } @@ -43,7 +43,7 @@ public override bool IsMatchExact(PKM pkm, DexLevel evo) protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk) { base.ApplyDetails(sav, criteria, pk); - if (Weather is AreaWeather8.Heavy_Fog && EncounterArea8.IsBoostedArea60(Location)) + if (Weather is AreaWeather8.Heavy_Fog && EncounterArea8.IsBoostedArea60Fog(Location)) pk.CurrentLevel = pk.Met_Level = EncounterArea8.BoostLevel; var req = GetRequirement(pk); diff --git a/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs b/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs index 97dc93c9f..e7c89611f 100644 --- a/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs +++ b/PKHeX.Core/Legality/Verifiers/MarkVerifier.cs @@ -68,7 +68,7 @@ public static bool IsMarkValid(RibbonIndex mark, PKM pk, IEncounterTemplate enc) { RibbonIndex.MarkCurry when !IsMarkAllowedCurry(pk, x) => false, RibbonIndex.MarkFishing when !IsMarkAllowedFishing(x) => false, - RibbonIndex.MarkMisty when pk.Met_Level < EncounterArea8.BoostLevel && EncounterArea8.IsBoostedArea60(pk.Met_Location) => false, + RibbonIndex.MarkMisty when pk.Met_Level < EncounterArea8.BoostLevel && EncounterArea8.IsBoostedArea60Fog(pk.Met_Location) => false, RibbonIndex.MarkDestiny => false, >= RibbonIndex.MarkCloudy and <= RibbonIndex.MarkMisty => IsWeatherPermitted(mark, x), _ => true