diff --git a/PKHeX.Core/Legality/Areas/EncounterArea6AO.cs b/PKHeX.Core/Legality/Areas/EncounterArea6AO.cs index f8f7d1172..bb15eb611 100644 --- a/PKHeX.Core/Legality/Areas/EncounterArea6AO.cs +++ b/PKHeX.Core/Legality/Areas/EncounterArea6AO.cs @@ -17,7 +17,7 @@ protected override IEnumerable GetMatchFromEvoLevel(PKM pkm, IEnu var slots = Slots.Where(slot => vs.Any(evo => evo.Species == slot.Species && evo.Level >= (slot.LevelMin - FluteBoostMax))); int getMaxLevelBoost(EncounterSlot s) => s.Type == SlotType.Rock_Smash ? FluteBoostMax : DexNavBoost; - int fluteMinLevel = minLevel - FluteBoostMax; + int fluteMinLevel = minLevel + FluteBoostMax; // highest possible min-level of slot before flute decrease // Get slots where pokemon can exist with respect to level constraints return slots.Where(s => s.IsLevelWithinRange(fluteMinLevel, minLevel - getMaxLevelBoost(s))); } diff --git a/PKHeX.Core/Legality/Encounters/EncounterSlot.cs b/PKHeX.Core/Legality/Encounters/EncounterSlot.cs index 99d65a531..db17d52f0 100644 --- a/PKHeX.Core/Legality/Encounters/EncounterSlot.cs +++ b/PKHeX.Core/Legality/Encounters/EncounterSlot.cs @@ -12,7 +12,20 @@ public class EncounterSlot : IEncounterable, IGeneration, ILocation, IVersion public int LevelMin { get; set; } public int LevelMax { get; set; } + /// + /// Gets if the specified level inputs are within range of the and + /// + /// Single level + /// True if within slot's range, false if impossible. + /// Use if can have a range of values public bool IsLevelWithinRange(int lvl) => LevelMin <= lvl && lvl <= LevelMax; + + /// + /// Gets if the specified level inputs are within range of the and + /// + /// Highest value the low end of levels can be + /// Lowest value the high end of levels can be + /// True if within slot's range, false if impossible. public bool IsLevelWithinRange(int min, int max) => LevelMin <= min && max <= LevelMax; public SlotType Type { get; set; } = SlotType.Any;