PkmnLib.NET/PkmnLib.Dynamic/Models/ExecutingMove.cs

104 lines
2.7 KiB
C#

using PkmnLib.Dynamic.ScriptHandling;
using PkmnLib.Static;
using PkmnLib.Static.Moves;
namespace PkmnLib.Dynamic.Models;
/// <summary>
/// A hit data is the data for a single hit, on a single target.
/// </summary>
public record HitData
{
/// <summary>
/// Whether the hit is critical.
/// </summary>
public bool IsCritical { get; internal set; }
/// <summary>
/// The base power of the hit.
/// </summary>
public byte BasePower { get; internal set; }
/// <summary>
/// The effectiveness of the hit.
/// </summary>
public float Effectiveness { get; internal set; }
/// <summary>
/// The damage done by the hit.
/// </summary>
public uint Damage { get; internal set; }
/// <summary>
/// The type of the hit.
/// </summary>
public TypeIdentifier Type { get; internal set; }
/// <summary>
/// Whether the hit has failed.
/// </summary>
public bool HasFailed { get; private set; }
/// <summary>
/// Fails the hit.
/// </summary>
public void Fail() => HasFailed = true;
}
/// <summary>
/// An executing move is the data of the move for while it is executing.
/// </summary>
public interface IExecutingMove : IScriptSource
{
/// <summary>
/// The number of targets this move has.
/// </summary>
int TargetCount { get; }
/// <summary>
/// The number of hits this move has per target.
/// </summary>
byte NumberOfHits { get; }
/// <summary>
/// The user of the move.
/// </summary>
IPokemon User { get; }
/// <summary>
/// The move the user has actually chosen to do.
/// </summary>
ILearnedMove ChosenMove { get; }
/// <summary>
/// The move that the user is actually going to do. This can be different from the chosen move, for example
/// when metronome is used, in which case the chosen move will be metronome, and the movedata will be the
/// move that metronome has chosen.
/// </summary>
IMoveData UseMove { get; }
/// <summary>
/// The script of the move.
/// </summary>
ScriptContainer Script { get; }
/// <summary>
/// Gets a hit data for a target, with a specific index.
/// </summary>
HitData GetHitData(IPokemon target, byte hit);
/// <summary>
/// Checks whether a Pokémon is a target for this move.
/// </summary>
bool IsPokemonTarget(IPokemon target);
/// <summary>
/// Gets the index of the hits in this move where the hits for a specific target start.
/// </summary>
int GetTargetIndex(IPokemon target);
/// <summary>
/// Gets a hit based on its raw index.
/// </summary>
HitData GetDataFromRawIndex(int index);
}