Extract fog boost location check

This commit is contained in:
Kurt 2021-08-06 14:54:32 -07:00
parent e3c28156bf
commit 70e10478dd
4 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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