More moves implemented

This commit is contained in:
2025-05-05 11:36:59 +02:00
parent 11ba3c73bb
commit 292c303fc0
39 changed files with 818 additions and 68 deletions

View File

@@ -7,7 +7,7 @@ using PkmnLib.Static.Utils;
namespace PkmnLib.Dynamic.Models.BattleFlow;
internal static class MoveTurnExecutor
public static class MoveTurnExecutor
{
internal static void ExecuteMoveChoice(IBattle battle, IMoveChoice moveChoice)
{
@@ -30,6 +30,7 @@ internal static class MoveTurnExecutor
secondaryEffect.Parameters, out var script))
{
moveChoice.Script.Set(script);
script.OnAddedToParent(moveChoice);
}
else
{
@@ -77,16 +78,20 @@ internal static class MoveTurnExecutor
// TODO: fail handling
return;
}
ExecuteMove(executingMove);
}
public static void ExecuteMove(IExecutingMove executingMove)
{
var stopped = false;
executingMove.RunScriptHook(x => x.StopBeforeMove(executingMove, ref stopped));
if (stopped)
return;
executingMove.RunScriptHook(x => x.OnBeforeMove(executingMove));
foreach (var target in targets.WhereNotNull())
foreach (var target in executingMove.Targets.WhereNotNull())
{
ExecuteMoveChoiceForTarget(battle, executingMove, target);
ExecuteMoveChoiceForTarget(executingMove.Battle, executingMove, target);
}
executingMove.RunScriptHook(x => x.OnAfterMove(executingMove));
}