2016-11-08 08:43:57 -08:00
|
|
|
|
using System;
|
2017-02-26 18:23:29 -08:00
|
|
|
|
using System.Collections.Generic;
|
2016-11-08 08:43:57 -08:00
|
|
|
|
|
2017-01-07 23:54:09 -08:00
|
|
|
|
namespace PKHeX.Core
|
2016-11-08 08:43:57 -08:00
|
|
|
|
{
|
2019-09-11 22:06:24 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents an Area where <see cref="PKM"/> can be encountered, which contains a Location ID and <see cref="EncounterSlot"/> data.
|
|
|
|
|
/// </summary>
|
2021-01-01 10:55:33 -08:00
|
|
|
|
public abstract record EncounterArea : IVersion
|
2019-09-11 22:06:24 -07:00
|
|
|
|
{
|
2020-08-30 11:08:21 -07:00
|
|
|
|
public GameVersion Version { get; }
|
2020-12-21 17:05:05 -08:00
|
|
|
|
public int Location { get; protected init; }
|
|
|
|
|
public SlotType Type { get; protected init; } = SlotType.Any;
|
2021-01-01 10:55:33 -08:00
|
|
|
|
public EncounterSlot[] Slots { get; internal set; } = Array.Empty<EncounterSlot>();
|
2017-03-19 13:19:45 +01:00
|
|
|
|
|
2020-08-30 11:08:21 -07:00
|
|
|
|
protected EncounterArea(GameVersion game) => Version = game;
|
|
|
|
|
|
2019-09-12 23:20:52 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the slots contained in the area that match the provided data.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pkm">Pokémon Data</param>
|
2020-06-27 22:18:29 -05:00
|
|
|
|
/// <param name="chain">Evolution lineage</param>
|
2019-09-12 23:20:52 -07:00
|
|
|
|
/// <returns>Enumerable list of encounters</returns>
|
2020-08-30 10:23:22 -07:00
|
|
|
|
public abstract IEnumerable<EncounterSlot> GetMatchingSlots(PKM pkm, IReadOnlyList<EvoCriteria> chain);
|
2019-11-19 08:38:18 -08:00
|
|
|
|
|
2019-11-20 17:01:34 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Checks if the provided met location ID matches the parameters for the area.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="location">Met Location ID</param>
|
|
|
|
|
/// <returns>True if possibly originated from this area, false otherwise.</returns>
|
2019-11-19 08:38:18 -08:00
|
|
|
|
public virtual bool IsMatchLocation(int location) => Location == location;
|
2017-12-03 12:20:49 -08:00
|
|
|
|
}
|
2016-11-08 08:43:57 -08:00
|
|
|
|
}
|