Further work on the script interface rework

This commit is contained in:
2025-07-05 11:30:18 +02:00
parent 1feb27e826
commit 4499927551
100 changed files with 418 additions and 352 deletions

View File

@@ -111,7 +111,8 @@ public static class TurnRunner
if (battleData == null)
return;
var preventSwitch = false;
fleeChoice.RunScriptHook(script => script.PreventSelfSwitch(fleeChoice, ref preventSwitch));
fleeChoice.RunScriptHookInterface<IScriptPreventSelfSwitch>(script =>
script.PreventSelfSwitch(fleeChoice, ref preventSwitch));
if (preventSwitch)
return;
foreach (var side in battle.Sides)
@@ -120,7 +121,8 @@ public static class TurnRunner
continue;
foreach (var pokemon in side.Pokemon.WhereNotNull())
{
pokemon.RunScriptHook(script => script.PreventOpponentSwitch(fleeChoice, ref preventSwitch));
pokemon.RunScriptHookInterface<IScriptPreventOpponentSwitch>(script =>
script.PreventOpponentSwitch(fleeChoice, ref preventSwitch));
if (preventSwitch)
return;
}
@@ -140,7 +142,8 @@ public static class TurnRunner
return;
var preventFlee = false;
fleeChoice.RunScriptHook(script => script.PreventSelfRunAway(fleeChoice, ref preventFlee));
fleeChoice.RunScriptHookInterface<IScriptPreventSelfRunAway>(script =>
script.PreventSelfRunAway(fleeChoice, ref preventFlee));
if (preventFlee)
return;
@@ -150,7 +153,8 @@ public static class TurnRunner
continue;
foreach (var pokemon in side.Pokemon.WhereNotNull())
{
pokemon.RunScriptHook(script => script.PreventOpponentRunAway(fleeChoice, ref preventFlee));
pokemon.RunScriptHookInterface<IScriptPreventOpponentRunAway>(script =>
script.PreventOpponentRunAway(fleeChoice, ref preventFlee));
if (preventFlee)
return;
}