Refactor move classes to implement respective interfaces for better structure
All checks were successful
Build / Build (push) Successful in 52s
All checks were successful
Build / Build (push) Successful in 52s
This commit is contained in:
@@ -61,109 +61,6 @@ public abstract class Script : IDeepCloneable
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function is ran just before the start of the turn. Everyone has made its choices here,
|
||||
/// and the turn is about to start. This is a great place to initialize data if you need to know
|
||||
/// something has happened during a turn.
|
||||
/// </summary>
|
||||
public virtual void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows you to modify the effective speed of the Pokemon. This is run before
|
||||
/// turn ordering, so overriding here will allow you to put certain Pokemon before others.
|
||||
/// </summary>
|
||||
public virtual void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows you to modify the effective priority of the Pokemon. This is run before
|
||||
/// turn ordering, so overriding here will allow you to put certain Pokemon before others. Note
|
||||
/// that this is only relevant on move choices, as other turn choice types do not have a priority.
|
||||
/// </summary>
|
||||
public virtual void ChangePriority(IMoveChoice choice, ref sbyte priority)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows you to change the move that is used during execution. This is useful for
|
||||
/// moves such as metronome, where the move chosen actually differs from the move used.
|
||||
/// </summary>
|
||||
public virtual void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the targets of a move choice. This allows for changing the targets of a move before the move starts.
|
||||
/// </summary>
|
||||
public virtual void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows you to change the targets of a move choice before the move starts.
|
||||
/// </summary>
|
||||
public virtual void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows you to change a move into a multi-hit move. The number of hits set here
|
||||
/// gets used as the number of hits. If set to 0, this will behave as if the move missed on its
|
||||
/// first hit.
|
||||
/// </summary>
|
||||
public virtual void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows you to prevent a move from running. If this gets set to true, the move
|
||||
/// ends execution here. No PP will be decreased in this case.
|
||||
/// </summary>
|
||||
public virtual void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function makes the move fail. If the fail field gets set to true, the move ends execution,
|
||||
/// and fail events get triggered.
|
||||
/// </summary>
|
||||
public virtual void FailMove(IExecutingMove move, ref bool fail)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Similar to <see cref="PreventMove"/>. This function will also stop execution of the move, but
|
||||
/// PP will still be decreased.
|
||||
/// </summary>
|
||||
public virtual void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function runs just before the move starts its execution.
|
||||
/// </summary>
|
||||
public virtual void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function runs immediately after all targets have had their hits executed.
|
||||
/// </summary>
|
||||
public virtual void OnAfterMove(IExecutingMove move)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This function allows a script to prevent a move that is targeted at its owner. If set to true
|
||||
/// the move fails, and fail events get triggered.
|
||||
@@ -858,4 +755,159 @@ public interface IScriptPreventMoveSelection
|
||||
/// Override to customize whether the move can be selected at all.
|
||||
/// </summary>
|
||||
void PreventMoveSelection(IMoveChoice choice, ref bool prevent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface is used to allow scripts to force a certain turn choice to be selected.
|
||||
/// </summary>
|
||||
public interface IScriptForceTurnSelection
|
||||
{
|
||||
/// <summary>
|
||||
/// 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>
|
||||
void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface is used to allow scripts to run before the start of a turn.
|
||||
/// </summary>
|
||||
public interface IScriptOnBeforeTurnStart
|
||||
{
|
||||
/// <summary>
|
||||
/// This function is ran just before the start of the turn. Everyone has made its choices here,
|
||||
/// and the turn is about to start. This is a great place to initialize data if you need to know
|
||||
/// something has happened during a turn.
|
||||
/// </summary>
|
||||
void OnBeforeTurnStart(ITurnChoice choice);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to modify the effective speed of the Pokemon.
|
||||
/// </summary>
|
||||
public interface IScriptChangeSpeed
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows you to modify the effective speed of the Pokemon. This is run before
|
||||
/// turn ordering, so overriding here will allow you to put certain Pokemon before others.
|
||||
/// </summary>
|
||||
void ChangeSpeed(ITurnChoice choice, ref uint speed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to modify the effective priority of the Pokemon.
|
||||
/// </summary>
|
||||
public interface IScriptChangePriority
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows you to modify the effective priority of the Pokemon. This is run before
|
||||
/// turn ordering, so overriding here will allow you to put certain Pokemon before others. Note
|
||||
/// that this is only relevant on move choices, as other turn choice types do not have a priority.
|
||||
/// </summary>
|
||||
void ChangePriority(IMoveChoice choice, ref sbyte priority);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to change the move that is used during execution.
|
||||
/// </summary>
|
||||
public interface IScriptChangeMove
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows you to change the move that is used during execution. This is useful for
|
||||
/// moves such as metronome, where the move chosen actually differs from the move used.
|
||||
/// </summary>
|
||||
void ChangeMove(IMoveChoice choice, ref StringKey moveName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to change the targets of a move choice.
|
||||
/// </summary>
|
||||
public interface IScriptChangeTargets
|
||||
{
|
||||
/// <summary>
|
||||
/// Changes the targets of a move choice. This allows for changing the targets of a move before the move starts.
|
||||
/// </summary>
|
||||
void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to change the incoming targets of a move choice.
|
||||
/// </summary>
|
||||
public interface IScriptChangeIncomingTargets
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows you to change the targets of a move choice before the move starts.
|
||||
/// </summary>
|
||||
void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to change a move into a multi-hit move.
|
||||
/// </summary>
|
||||
public interface IScriptChangeNumberOfHits
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows you to change a move into a multi-hit move. The number of hits set here
|
||||
/// gets used as the number of hits. If set to 0, this will behave as if the move missed on its
|
||||
/// first hit.
|
||||
/// </summary>
|
||||
void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to prevent a move from running.
|
||||
/// </summary>
|
||||
public interface IScriptPreventMove
|
||||
{
|
||||
/// <summary>
|
||||
/// This function allows you to prevent a move from running. If this gets set to true, the move
|
||||
/// ends execution here. No PP will be decreased in this case.
|
||||
/// </summary>
|
||||
void PreventMove(IExecutingMove move, ref bool prevent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to make the move fail.
|
||||
/// </summary>
|
||||
public interface IScriptFailMove
|
||||
{
|
||||
/// <summary>
|
||||
/// This function makes the move fail. If the fail field gets set to true, the move ends execution,
|
||||
/// and fail events get triggered.
|
||||
/// </summary>
|
||||
void FailMove(IExecutingMove move, ref bool fail);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to stop execution of the move before it starts.
|
||||
/// </summary>
|
||||
public interface IScriptStopBeforeMove
|
||||
{
|
||||
/// <summary>
|
||||
/// Similar to <see cref="IScriptPreventMove"/>. This function will also stop execution of the move, but
|
||||
/// PP will still be decreased.
|
||||
/// </summary>
|
||||
void StopBeforeMove(IExecutingMove move, ref bool stop);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to run just before the move starts its execution.
|
||||
/// </summary>
|
||||
public interface IScriptOnBeforeMove
|
||||
{
|
||||
/// <summary>
|
||||
/// This function runs just before the move starts its execution.
|
||||
/// </summary>
|
||||
void OnBeforeMove(IExecutingMove move);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This interface allows scripts to run immediately after all targets have had their hits executed.
|
||||
/// </summary>
|
||||
public interface IScriptOnAfterMove
|
||||
{
|
||||
/// <summary>
|
||||
/// This function runs immediately after all targets have had their hits executed.
|
||||
/// </summary>
|
||||
void OnAfterMove(IExecutingMove move);
|
||||
}
|
||||
Reference in New Issue
Block a user