Implements move execution for battle
This commit is contained in:
@@ -105,7 +105,7 @@ public abstract class Script
|
||||
/// This function allows you to change the move that is used during execution. This is useful for
|
||||
/// moves such as metronome, where the move chosen actually differs from the move used.
|
||||
/// </summary>
|
||||
public virtual void ChangeMove(IMoveChoice choice, ref string moveName)
|
||||
public virtual void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -189,14 +189,14 @@ public abstract class Script
|
||||
/// <summary>
|
||||
/// This function allows a script to block an outgoing move from being critical.
|
||||
/// </summary>
|
||||
public virtual void BlockCriticalHit(IExecutingMove move, IPokemon target, ref bool block)
|
||||
public virtual void BlockCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to block an incoming move from being critical.
|
||||
/// </summary>
|
||||
public virtual void BlockIncomingCriticalHit(IExecutingMove move, IPokemon target, ref bool block)
|
||||
public virtual void BlockIncomingCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using PkmnLib.Static.Utils;
|
||||
|
||||
namespace PkmnLib.Dynamic.ScriptHandling;
|
||||
|
||||
@@ -44,6 +43,10 @@ public class ScriptContainer : IEnumerable<ScriptContainer>
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assigns a new script to this container. If there was a script already, it is removed.
|
||||
/// </summary>
|
||||
/// <param name="script"></param>
|
||||
public void Set(Script script)
|
||||
{
|
||||
if (Script is not null)
|
||||
|
||||
@@ -25,6 +25,10 @@ public static class ScriptExecution
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes a hook on all scripts in a list of sources. Note that this does not walk through the parents of the
|
||||
/// sources, but only the sources themselves.
|
||||
/// </summary>
|
||||
public static void RunScriptHook(this IReadOnlyList<IEnumerable<ScriptContainer>> source, Action<Script> hook)
|
||||
{
|
||||
foreach (var container in source.SelectMany(x => x))
|
||||
|
||||
Reference in New Issue
Block a user