Surprisingly, more moves

This commit is contained in:
2025-04-17 17:51:42 +02:00
parent d02c05874b
commit c22ad1a793
17 changed files with 298 additions and 43 deletions

View File

@@ -119,6 +119,8 @@ internal static class MoveTurnExecutor
break;
var hitIndex = i;
executingMove.RunScriptHook(x => x.OnBeforeHit(executingMove, target, hitIndex));
var useMove = executingMove.UseMove;
var hitType = useMove.MoveType;
executingMove.RunScriptHook(x => x.ChangeMoveType(executingMove, target, hitIndex, ref hitType));

View File

@@ -312,7 +312,7 @@ public abstract class Script : IDeepCloneable
/// This function allows a script to change the actual offensive stat values used when calculating damage
/// </summary>
public virtual void ChangeOffensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint defensiveStat,
ref uint value)
ImmutableStatisticSet<uint> targetStats, ref uint value)
{
}
@@ -320,7 +320,7 @@ public abstract class Script : IDeepCloneable
/// This function allows a script to change the actual defensive stat values used when calculating damage.
/// </summary>
public virtual void ChangeDefensiveStatValue(IExecutingMove move, IPokemon target, byte hit, uint offensiveStat,
ref uint value)
ImmutableStatisticSet<uint> targetStats, ref uint value)
{
}
@@ -610,4 +610,8 @@ public abstract class Script : IDeepCloneable
public virtual void ChangeCategory(IExecutingMove move, IPokemon target, byte hitIndex, ref MoveCategory category)
{
}
public virtual void OnBeforeHit(IExecutingMove move, IPokemon target, byte hitIndex)
{
}
}

View File

@@ -62,13 +62,15 @@ public class ScriptContainer : IReadOnlyScriptContainer
/// <summary>
/// Removes the script from this container.
/// </summary>
public void Clear()
public Script? Clear()
{
if (Script is not null)
{
Script.OnRemove();
}
var script = Script;
Script = null;
return script;
}
public void ClearWithoutRemoving()