This commit is contained in:
@@ -8,16 +8,10 @@ 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 readonly record struct EventBatchId
|
||||
public readonly record struct EventBatchId()
|
||||
{
|
||||
/// <inheritdoc cref="EventBatchId"/>
|
||||
public EventBatchId()
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The unique identifier for this batch of events.
|
||||
/// </summary>
|
||||
public Guid Id { get; init; }
|
||||
public Guid Id { get; init; } = Guid.NewGuid();
|
||||
}
|
||||
36
PkmnLib.Dynamic/Events/StatusChangeEvent.cs
Normal file
36
PkmnLib.Dynamic/Events/StatusChangeEvent.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using PkmnLib.Dynamic.Models;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Dynamic.Events;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an event that occurs when a Pokémon's status changes.
|
||||
/// </summary>
|
||||
public record StatusChangeEvent : IEventData
|
||||
{
|
||||
/// <inheritdoc cref="StatusChangeEvent"/>
|
||||
public StatusChangeEvent(IPokemon pokemon, StringKey? previousStatus, StringKey? newStatus)
|
||||
{
|
||||
Pokemon = pokemon;
|
||||
PreviousStatus = previousStatus;
|
||||
NewStatus = newStatus;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Pokémon whose status has changed.
|
||||
/// </summary>
|
||||
public IPokemon Pokemon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The new status of the Pokémon after the change.
|
||||
/// </summary>
|
||||
public StringKey? NewStatus { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The previous status of the Pokémon before the change.
|
||||
/// </summary>
|
||||
public StringKey? PreviousStatus { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public EventBatchId BatchId { get; init; }
|
||||
}
|
||||
18
PkmnLib.Dynamic/Events/TerrainChangeEvent.cs
Normal file
18
PkmnLib.Dynamic/Events/TerrainChangeEvent.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Dynamic.Events;
|
||||
|
||||
public class TerrainChangeEvent : IEventData
|
||||
{
|
||||
public StringKey? OldTerrain { get; }
|
||||
public StringKey? NewTerrain { get; }
|
||||
|
||||
public TerrainChangeEvent(StringKey? oldTerrain, StringKey? newTerrain)
|
||||
{
|
||||
OldTerrain = oldTerrain;
|
||||
NewTerrain = newTerrain;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public EventBatchId BatchId { get; init; }
|
||||
}
|
||||
18
PkmnLib.Dynamic/Events/WeatherChangeEvent.cs
Normal file
18
PkmnLib.Dynamic/Events/WeatherChangeEvent.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Dynamic.Events;
|
||||
|
||||
public class WeatherChangeEvent : IEventData
|
||||
{
|
||||
public StringKey? OldWeather { get; }
|
||||
public StringKey? NewWeather { get; }
|
||||
|
||||
public WeatherChangeEvent(StringKey? oldWeather, StringKey? newWeather)
|
||||
{
|
||||
OldWeather = oldWeather;
|
||||
NewWeather = newWeather;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public EventBatchId BatchId { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user