diff --git a/PkmnLib.Dynamic/Models/Battle.cs b/PkmnLib.Dynamic/Models/Battle.cs index fa245b2..11b36ec 100644 --- a/PkmnLib.Dynamic/Models/Battle.cs +++ b/PkmnLib.Dynamic/Models/Battle.cs @@ -331,7 +331,8 @@ public class BattleImpl : ScriptSource, IBattle moveChoice.ChosenMove.MoveData.Target, moveChoice.User)) return false; var preventMove = false; - choice.RunScriptHook(script => script.PreventMoveSelection(moveChoice, ref preventMove)); + choice.RunScriptHookInterface(script => + script.PreventMoveSelection(moveChoice, ref preventMove)); if (preventMove) return false; } diff --git a/PkmnLib.Dynamic/ScriptHandling/Script.cs b/PkmnLib.Dynamic/ScriptHandling/Script.cs index 8ee81e1..1093968 100644 --- a/PkmnLib.Dynamic/ScriptHandling/Script.cs +++ b/PkmnLib.Dynamic/ScriptHandling/Script.cs @@ -61,13 +61,6 @@ public abstract class Script : IDeepCloneable { } - /// - /// Override to customize whether the move can be selected at all. - /// - public virtual void PreventMoveSelection(IMoveChoice choice, ref bool prevent) - { - } - /// /// Force a certain move choice to be selected. If the choice is set, the Pokemon will be forced /// to use it, and will not be able to select any other choice. @@ -854,4 +847,15 @@ public interface IScriptOnInitialize /// with parameters that are passed to it. /// void OnInitialize(IReadOnlyDictionary? parameters); +} + +/// +/// This interface is used to allow scripts to prevent a move from being selected. +/// +public interface IScriptPreventMoveSelection +{ + /// + /// Override to customize whether the move can be selected at all. + /// + void PreventMoveSelection(IMoveChoice choice, ref bool prevent); } \ No newline at end of file diff --git a/PkmnLib.Dynamic/ScriptHandling/ScriptExecution.cs b/PkmnLib.Dynamic/ScriptHandling/ScriptExecution.cs index 4497063..85ff24f 100644 --- a/PkmnLib.Dynamic/ScriptHandling/ScriptExecution.cs +++ b/PkmnLib.Dynamic/ScriptHandling/ScriptExecution.cs @@ -13,7 +13,6 @@ public static class ScriptExecution /// /// Executes a hook on all scripts in a source. /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void RunScriptHook(this IScriptSource source, Action