2019-09-13 06:20:52 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <see cref="GameVersion.ORAS"/> encounter area
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class EncounterArea6AO : EncounterArea32
|
|
|
|
|
{
|
2020-02-04 02:40:31 +00:00
|
|
|
|
private const int FluteBoostMin = 4; // White Flute decreases levels.
|
|
|
|
|
private const int FluteBoostMax = 4; // Black Flute increases levels.
|
2019-09-20 05:54:53 +00:00
|
|
|
|
private const int DexNavBoost = 30; // Maximum DexNav chain
|
2019-09-13 06:20:52 +00:00
|
|
|
|
|
2020-08-21 23:35:49 +00:00
|
|
|
|
private const int RandomForm = 31;
|
2019-09-13 06:20:52 +00:00
|
|
|
|
|
2020-08-21 23:35:49 +00:00
|
|
|
|
public override IEnumerable<EncounterSlot> GetMatchingSlots(PKM pkm, IReadOnlyList<EvoCriteria> chain)
|
2019-09-13 06:20:52 +00:00
|
|
|
|
{
|
2020-08-21 23:35:49 +00:00
|
|
|
|
foreach (var slot in Slots)
|
2019-09-13 06:20:52 +00:00
|
|
|
|
{
|
2020-08-21 23:35:49 +00:00
|
|
|
|
foreach (var evo in chain)
|
2019-09-13 06:20:52 +00:00
|
|
|
|
{
|
2020-08-21 23:35:49 +00:00
|
|
|
|
if (slot.Species != evo.Species)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
var boostMax = slot.Type != SlotType.Rock_Smash ? DexNavBoost : FluteBoostMax;
|
|
|
|
|
const int boostMin = FluteBoostMin;
|
|
|
|
|
if (!slot.IsLevelWithinRange(pkm.Met_Level, boostMin, boostMax))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (slot.Form != evo.Form && slot.Form != RandomForm)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
var clone = (EncounterSlot6AO)slot.Clone();
|
|
|
|
|
MarkSlotDetails(pkm, clone, evo);
|
|
|
|
|
yield return clone;
|
|
|
|
|
break;
|
2019-09-13 06:20:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-21 23:35:49 +00:00
|
|
|
|
}
|
2019-09-13 06:20:52 +00:00
|
|
|
|
|
2020-08-21 23:35:49 +00:00
|
|
|
|
private static void MarkSlotDetails(PKM pkm, EncounterSlot6AO slot, EvoCriteria evo)
|
|
|
|
|
{
|
|
|
|
|
bool nav = slot.AllowDexNav && (pkm.RelearnMove1 != 0 || pkm.AbilityNumber == 4);
|
|
|
|
|
slot.DexNav = nav;
|
|
|
|
|
|
|
|
|
|
if (slot.LevelMin > evo.MinLevel)
|
|
|
|
|
slot.WhiteFlute = true;
|
|
|
|
|
if (slot.LevelMax + 1 <= evo.MinLevel && evo.MinLevel <= slot.LevelMax + FluteBoostMax)
|
|
|
|
|
slot.BlackFlute = true;
|
|
|
|
|
if (slot.LevelMax != evo.MinLevel && slot.AllowDexNav)
|
|
|
|
|
slot.DexNav = true;
|
2019-09-13 06:20:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-21 23:35:49 +00:00
|
|
|
|
}
|