Support for changing turn choice when executing
All checks were successful
Build / Build (push) Successful in 50s

This commit is contained in:
2025-06-15 14:23:28 +02:00
parent b11203cb3a
commit e305cfaef6
23 changed files with 34 additions and 28 deletions

View File

@@ -77,6 +77,7 @@ public static class TurnRunner
/// </summary>
public static void ExecuteChoice(IBattle battle, ITurnChoice choice)
{
choice.RunScriptHook(x => x.ChangeTurnChoice(ref choice));
if (choice is IPassChoice)
return;
if (battle.HasEnded)

View File

@@ -296,7 +296,7 @@ public class BattleImpl : ScriptSource, IBattle
ITurnChoice? forcedChoice = null;
pokemon.RunScriptHook(script =>
script.ForceTurnSelection(battleData.SideIndex, battleData.Position, ref forcedChoice));
script.ForceTurnSelection(this, battleData.SideIndex, battleData.Position, ref forcedChoice));
choice = forcedChoice;
return choice != null;
}

View File

@@ -115,7 +115,7 @@ public abstract class Script : IDeepCloneable
/// 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.
/// </summary>
public virtual void ForceTurnSelection(byte sideIndex, byte position, ref ITurnChoice? choice)
public virtual void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
{
}
@@ -302,7 +302,7 @@ public abstract class Script : IDeepCloneable
/// This function allows a script to change the damage modifier of a Same Type Attack Bonus, which
/// occurs when the user has the move type as one of its own types.
/// </summary>
public virtual void ChangeStabModifier(IExecutingMove executingMove, IPokemon target, byte hitNumber,
public virtual void ChangeStabModifier(IExecutingMove executingMove, IPokemon target, byte hitNumber, bool isStab,
ref float modifier)
{
}
@@ -851,4 +851,8 @@ public abstract class Script : IDeepCloneable
public virtual void OnAfterMoveChoice(IMoveChoice moveChoice)
{
}
public virtual void ChangeTurnChoice(ref ITurnChoice choice)
{
}
}