Further work on the script interface rework
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user