Implements move execution for battle
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
namespace PkmnLib.Dynamic.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Event triggered when a turn ends.
|
||||
/// </summary>
|
||||
public class EndTurnEvent : IEventData
|
||||
{
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace PkmnLib.Dynamic.Events;
|
||||
/// For example, when a Pokemon gets hurt by poison, we want to show the purple poison animation and the damage at the
|
||||
/// same time. This is done by batching the events together.
|
||||
/// </remarks>
|
||||
public record struct EventBatchId()
|
||||
public readonly record struct EventBatchId()
|
||||
{
|
||||
/// <summary>
|
||||
/// The unique identifier for this batch of events.
|
||||
|
||||
35
PkmnLib.Dynamic/Events/MoveHitEvent.cs
Normal file
35
PkmnLib.Dynamic/Events/MoveHitEvent.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using PkmnLib.Dynamic.Models;
|
||||
|
||||
namespace PkmnLib.Dynamic.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Event triggered when a move hits.
|
||||
/// </summary>
|
||||
public class MoveHitEvent : IEventData
|
||||
{
|
||||
/// <summary>
|
||||
/// The move that is being executed.
|
||||
/// </summary>
|
||||
public IExecutingMove ExecutingMove { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Data about the hit.
|
||||
/// </summary>
|
||||
public IHitData HitData { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The target of the move.
|
||||
/// </summary>
|
||||
public IPokemon Target { get; }
|
||||
|
||||
/// <inheritdoc cref="MoveHitEvent"/>
|
||||
public MoveHitEvent(IExecutingMove executingMove, IHitData hitData, IPokemon target)
|
||||
{
|
||||
ExecutingMove = executingMove;
|
||||
HitData = hitData;
|
||||
Target = target;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public EventBatchId BatchId { get; init; }
|
||||
}
|
||||
23
PkmnLib.Dynamic/Events/MoveMissEvent.cs
Normal file
23
PkmnLib.Dynamic/Events/MoveMissEvent.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using PkmnLib.Dynamic.Models;
|
||||
|
||||
namespace PkmnLib.Dynamic.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Triggered when a move misses.
|
||||
/// </summary>
|
||||
public class MoveMissEvent : IEventData
|
||||
{
|
||||
/// <inheritdoc cref="MoveMissEvent"/>
|
||||
public MoveMissEvent(IExecutingMove executingMove)
|
||||
{
|
||||
ExecutingMove = executingMove;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Data about the move that missed.
|
||||
/// </summary>
|
||||
public IExecutingMove ExecutingMove { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public EventBatchId BatchId { get; init; }
|
||||
}
|
||||
23
PkmnLib.Dynamic/Events/MoveUseEvent.cs
Normal file
23
PkmnLib.Dynamic/Events/MoveUseEvent.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using PkmnLib.Dynamic.Models;
|
||||
|
||||
namespace PkmnLib.Dynamic.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Runs when a move is used, before the move is executed.
|
||||
/// </summary>
|
||||
public class MoveUseEvent : IEventData
|
||||
{
|
||||
/// <summary>
|
||||
/// The move that is being executed.
|
||||
/// </summary>
|
||||
public IExecutingMove ExecutingMove { get; }
|
||||
|
||||
/// <inheritdoc cref="MoveUseEvent"/>
|
||||
public MoveUseEvent(IExecutingMove executingMove)
|
||||
{
|
||||
ExecutingMove = executingMove;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public EventBatchId BatchId { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user