Document all undocumented methods and properties
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-05-16 13:59:36 +02:00
parent 810cdbb15a
commit fdfca99e71
27 changed files with 384 additions and 39 deletions

View File

@@ -3,11 +3,33 @@ using PkmnLib.Static;
namespace PkmnLib.Dynamic.ScriptHandling.Registry;
/// <summary>
/// Interface for plugins that can mutate data.
/// </summary>
public interface IPluginDataMutator
{
/// <summary>
/// Mutates move data after it has been loaded, before it is used to convert to a static library.
/// </summary>
void MutateMoveData(SerializedMoveDataWrapper data);
/// <summary>
/// Mutates item data after it has been loaded, before it is used to convert to a static library.
/// </summary>
void MutateItemData(List<SerializedItem> data);
/// <summary>
/// Mutates ability data after it has been loaded, before it is used to convert to a static library.
/// </summary>
void MutateAbilityData(Dictionary<string, SerializedAbility> data);
/// <summary>
/// Mutates growth rate data after it has been loaded, before it is used to convert to a static library.
/// </summary>
void MutateGrowthRateData(List<IGrowthRate> data);
/// <summary>
/// Mutates species data after it has been loaded, before it is used to convert to a static library.
/// </summary>
void MutateSpeciesData(Dictionary<string, SerializedSpecies> data);
}

View File

@@ -2,27 +2,64 @@ using PkmnLib.Static.Libraries;
namespace PkmnLib.Dynamic.ScriptHandling.Registry;
/// <summary>
/// Interface for plugins that provide resources.
/// </summary>
public interface IResourceProvider
{
/// <summary>
/// The settings for the library. This is used to configure the library and its resources.
/// </summary>
LibrarySettings? Settings { get; }
/// <summary>
/// Gets the resource for the given type. This is used to load resources from the plugin.
/// </summary>
Stream? GetResource(ResourceFileType request);
}
/// <summary>
/// Enum for the different types of resources that can be loaded.
/// </summary>
public enum ResourceFileType
{
/// <summary>
/// Unknown type. This is used for errors and should not be used in normal code.
/// </summary>
Unknown,
/// <summary>
/// The type for the types of Pokémon. This includes the type effectiveness chart and the type names.
/// </summary>
Types,
/// <summary>
/// The type for the natures of Pokémon. This includes the nature names and the nature effects.
/// </summary>
Natures,
/// <summary>
/// The type for the moves of Pokémon. This includes the move names and the move effects.
/// </summary>
Moves,
/// <summary>
/// The type for the items of Pokémon. This includes the item names and the item effects.
/// </summary>
Items,
/// <summary>
/// The type for the abilities of Pokémon. This includes the ability names and the ability effects.
/// </summary>
Abilities,
/// <summary>
/// The type for the growth rates of Pokémon. This includes the growth rate names and the growth rate effects.
/// </summary>
GrowthRates,
/// <summary>
/// The type for the species of Pokémon. This includes the species names and the species effects.
/// </summary>
Species,
}

View File

@@ -97,6 +97,9 @@ public abstract class Script : IDeepCloneable
{
}
/// <summary>
/// This function is ran when this script is added to a parent.
/// </summary>
public virtual void OnAddedToParent(IScriptSource source)
{
}
@@ -690,14 +693,26 @@ public abstract class Script : IDeepCloneable
{
}
/// <summary>
/// This function allows a script to prevent a Pokemon from being affected by a status condition.
/// </summary>
public virtual void PreventStatusChange(IPokemon pokemonImpl, StringKey status, ref bool preventStatus)
{
}
/// <summary>
/// This function allows a script to prevent a Pokémon from being affected by a volatile status condition.
/// </summary>
public virtual void PreventVolatileAdd(Script script, ref bool preventVolatileAdd)
{
}
/// <summary>
/// This function allows a script to make the Pokémon it is attached to float. This is used for moves
/// such as levitate, and allows for moves such as earthquake to not hit the Pokémon.
/// </summary>
/// <param name="pokemon"></param>
/// <param name="isFloating"></param>
public virtual void IsFloating(IPokemon pokemon, ref bool isFloating)
{
}

View File

@@ -1,5 +1,4 @@
using System.Collections;
using System.Diagnostics.CodeAnalysis;
using PkmnLib.Dynamic.ScriptHandling.Registry;
using PkmnLib.Static.Utils;
@@ -85,6 +84,7 @@ public class ScriptSet : IScriptSet
private readonly List<ScriptContainer> _scripts = [];
/// <inheritdoc cref="IScriptSet"/>
public ScriptSet(IScriptSource source)
{
_source = source;