using System;
using System.Diagnostics.CodeAnalysis;
namespace PKHeX.Core;
///
/// Exposes information about how moves are learned in game.
///
public interface ILearnSource
{
///
/// Yields an iterable list of all potential moves that an can learn from this .
///
/// Result storage for flags
/// Entity reference
/// Details about the state of the entity
/// Types of move sources to iterate
public void GetAllMoves(Span result, PKM pk, EvoCriteria evo, MoveSourceType types = MoveSourceType.All);
///
/// Gets the learnset for the given and .
///
/// Entity species
/// Entity form
public Learnset GetLearnset(ushort species, byte form);
public void SetEncounterMoves(ushort species, byte form, byte level, Span init)
{
var start = (init.LastIndexOfAnyExcept(0) + 1) & 3;
var learn = GetLearnset(species, form);
learn.SetEncounterMoves(level, init, start);
}
public ReadOnlySpan GetEggMoves(ushort species, byte form) => [];
public ReadOnlySpan GetInheritMoves(ushort species, byte form)
{
if (!Breeding.GetCanInheritMoves(species))
return default;
return GetLearnset(species, form).GetAllMoves();
}
///
/// Indication of what environment this source is for.
///
public LearnEnvironment Environment { get; }
}
///
/// Exposes information about how moves are learned in game based on the game's .
///
public interface ILearnSource : ILearnSource where T : PersonalInfo
{
///
/// Checks if the can learn the requested while existing as .
///
/// Entity reference
/// Entity game stats
/// Details about the state of the entity
/// Move ID to check
/// Types of move sources to iterate
/// Option to check if it can be currently known, or previously known.
/// Details about how the move can be learned. Will be equivalent to default if it cannot learn.
public MoveLearnInfo GetCanLearn(PKM pk, T pi, EvoCriteria evo, ushort move, MoveSourceType types = MoveSourceType.All, LearnOption option = LearnOption.Current);
///
/// Gets the for the given and .
///
/// Entity species
/// Entity form
/// Result value
/// True if the reference is a valid entity reference.
public bool TryGetPersonal(ushort species, byte form, [NotNullWhen(true)] out T? pi);
}
///
/// Interface for learnsets with paired learn behavior.
///
public interface ILearnSourceBonus
{
///
/// Gets the levelup learnset and other learnset for the given and .
///
/// Entity species
/// Entity form
(Learnset Learn, Learnset Other) GetLearnsetAndOther(ushort species, byte form);
}