Add all missing docs

This commit is contained in:
2025-05-03 14:18:12 +02:00
parent 4d5dfd0342
commit 441f5dddaf
40 changed files with 400 additions and 21 deletions

View File

@@ -3,15 +3,26 @@ using PkmnLib.Dynamic.Models;
namespace PkmnLib.Dynamic.Events;
/// <summary>
/// Represents an event that occurs when a Pokémon capture attempt is made.
/// </summary>
public class CaptureAttemptEvent : IEventData
{
/// <inheritdoc cref="CaptureAttemptEvent"/>
public CaptureAttemptEvent(IPokemon target, CaptureResult result)
{
Target = target;
Result = result;
}
/// <summary>
/// The Pokémon that is being captured.
/// </summary>
public IPokemon Target { get; init; }
/// <summary>
/// The result of the capture attempt.
/// </summary>
public CaptureResult Result { get; init; }
/// <inheritdoc />

View File

@@ -1,17 +1,27 @@
namespace PkmnLib.Dynamic.Events;
/// <summary>
/// Represents an event that occurs when a dialog is displayed.
/// </summary>
public class DialogEvent : IEventData
{
/// <inheritdoc />
public EventBatchId BatchId { get; init; } = new();
/// <inheritdoc cref="DialogEvent"/>
public DialogEvent(string message, Dictionary<string, object>? parameters = null)
{
Message = message;
Parameters = parameters;
}
/// <summary>
/// The message to be displayed in the dialog. This is generally a key that needs to be localized.
/// </summary>
public string Message { get; set; }
/// <summary>
/// Optional parameters that can be used to format the message in a localized string.
/// </summary>
public Dictionary<string, object>? Parameters { get; set; }
}

View File

@@ -2,8 +2,12 @@ using PkmnLib.Dynamic.Models;
namespace PkmnLib.Dynamic.Events;
/// <summary>
/// Represents an event that occurs when a Pokémon gains experience.
/// </summary>
public class ExperienceGainEvent : IEventData
{
/// <inheritdoc cref="ExperienceGainEvent"/>
public ExperienceGainEvent(IPokemon pokemon, uint previousExperience, uint newExperience)
{
Pokemon = pokemon;
@@ -11,8 +15,19 @@ public class ExperienceGainEvent : IEventData
NewExperience = newExperience;
}
/// <summary>
/// The Pokémon that gained experience.
/// </summary>
public IPokemon Pokemon { get; set; }
/// <summary>
/// The amount of experience the Pokémon had before the gain.
/// </summary>
public uint PreviousExperience { get; }
/// <summary>
/// The amount of experience the Pokémon has after the gain.
/// </summary>
public uint NewExperience { get; }
/// <inheritdoc />

View File

@@ -3,11 +3,22 @@ using PkmnLib.Static.Species;
namespace PkmnLib.Dynamic.Events;
/// <summary>
/// Represents an event that occurs when a Pokémon changes its form.
/// </summary>
public class FormChangeEvent : IEventData
{
/// <summary>
/// The Pokémon that changed its form.
/// </summary>
public IPokemon Pokemon { get; }
/// <summary>
/// The new form of the Pokémon.
/// </summary>
public IForm Form { get; }
/// <inheritdoc cref="FormChangeEvent"/>
public FormChangeEvent(IPokemon pokemon, IForm form)
{
Pokemon = pokemon;

View File

@@ -10,6 +10,7 @@ namespace PkmnLib.Dynamic.Events;
/// </remarks>
public readonly record struct EventBatchId
{
/// <inheritdoc cref="EventBatchId"/>
public EventBatchId()
{
Id = Guid.NewGuid();

View File

@@ -1,3 +1,5 @@
using JetBrains.Annotations;
namespace PkmnLib.Dynamic.Events;
/// <summary>
@@ -5,6 +7,7 @@ namespace PkmnLib.Dynamic.Events;
/// display information about the battle to the user. This is the only way for the front-end to
/// know what is happening in the battle.
/// </summary>
[PublicAPI]
public interface IEventData
{
/// <summary>

View File

@@ -2,8 +2,12 @@ using PkmnLib.Dynamic.Models;
namespace PkmnLib.Dynamic.Events;
/// <summary>
/// Represents an event that occurs when a Pokémon gains enough experience points to level up.
/// </summary>
public class LevelUpEvent : IEventData
{
/// <inheritdoc cref="LevelUpEvent"/>
public LevelUpEvent(IPokemon pokemon, int previousLevel, int newLevel)
{
Pokemon = pokemon;
@@ -11,10 +15,19 @@ public class LevelUpEvent : IEventData
NewLevel = newLevel;
}
/// <summary>
/// The new level of the Pokémon after leveling up.
/// </summary>
public int NewLevel { get; set; }
/// <summary>
/// The previous level of the Pokémon before leveling up.
/// </summary>
public int PreviousLevel { get; set; }
/// <summary>
/// The Pokémon that leveled up.
/// </summary>
public IPokemon Pokemon { get; set; }
/// <inheritdoc />

View File

@@ -3,12 +3,27 @@ using PkmnLib.Static.Species;
namespace PkmnLib.Dynamic.Events;
/// <summary>
/// Represents an event that occurs when a Pokémon changes to a different species.
/// </summary>
public class SpeciesChangeEvent : IEventData
{
/// <summary>
/// The Pokémon that changed species.
/// </summary>
public IPokemon Pokemon { get; }
/// <summary>
/// The new species of the Pokémon.
/// </summary>
public ISpecies Species { get; }
/// <summary>
/// The new form of the Pokémon, if applicable.
/// </summary>
public IForm Form { get; }
/// <inheritdoc cref="SpeciesChangeEvent"/>
public SpeciesChangeEvent(IPokemon pokemon, ISpecies species, IForm form)
{
Pokemon = pokemon;