Tweaks for setting weather
This commit is contained in:
6
PkmnLib.Dynamic/ScriptHandling/IWeatherScript.cs
Normal file
6
PkmnLib.Dynamic/ScriptHandling/IWeatherScript.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace PkmnLib.Dynamic.ScriptHandling;
|
||||
|
||||
public interface IWeatherScript
|
||||
{
|
||||
public void SetTurns(int turns);
|
||||
}
|
||||
@@ -559,4 +559,8 @@ public abstract class Script : IDeepCloneable
|
||||
ref int modifiedAccuracy)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void ChangeWeatherDuration(StringKey weatherName, ref int duration)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -4,11 +4,24 @@ using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Dynamic.ScriptHandling;
|
||||
|
||||
public interface IReadOnlyScriptContainer : IEnumerable<ScriptContainer>, IDeepCloneable
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether this container is empty.
|
||||
/// </summary>
|
||||
public bool IsEmpty { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The script in this container.
|
||||
/// </summary>
|
||||
public Script? Script { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A holder class for a script. This is used so we can cache a list of these, and iterate over them, even when
|
||||
/// the underlying script changes.
|
||||
/// </summary>
|
||||
public class ScriptContainer : IEnumerable<ScriptContainer>, IDeepCloneable
|
||||
public class ScriptContainer : IReadOnlyScriptContainer
|
||||
{
|
||||
/// <inheritdoc cref="ScriptContainer"/>
|
||||
public ScriptContainer()
|
||||
@@ -21,15 +34,11 @@ public class ScriptContainer : IEnumerable<ScriptContainer>, IDeepCloneable
|
||||
Script = script;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether this container is empty.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
[MemberNotNullWhen(false, nameof(ScriptHandling.Script))]
|
||||
public bool IsEmpty => Script is null;
|
||||
|
||||
/// <summary>
|
||||
/// The script in this container.
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public Script? Script { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user