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:
parent
2319160b52
commit
b7bdf2b744
@ -19,7 +19,7 @@ public static class MoveTurnExecutor
|
||||
var useMove = chosenMove.MoveData;
|
||||
|
||||
var moveDataName = useMove.Name;
|
||||
moveChoice.RunScriptHook(x => x.ChangeMove(moveChoice, ref moveDataName));
|
||||
moveChoice.RunScriptHookInterface<IScriptChangeMove>(x => x.ChangeMove(moveChoice, ref moveDataName));
|
||||
if (useMove.Name != moveDataName)
|
||||
{
|
||||
if (!battle.Library.StaticLibrary.Moves.TryGet(moveDataName, out useMove))
|
||||
@ -51,17 +51,22 @@ public static class MoveTurnExecutor
|
||||
var targetType = useMove.Target;
|
||||
var targets =
|
||||
TargetResolver.ResolveTargets(battle, moveChoice.TargetSide, moveChoice.TargetPosition, targetType);
|
||||
moveChoice.RunScriptHook(x => x.ChangeTargets(moveChoice, ref targets));
|
||||
moveChoice.RunScriptHookInterface<IScriptChangeTargets>(x => x.ChangeTargets(moveChoice, ref targets));
|
||||
if (targets.Count == 0)
|
||||
{
|
||||
moveChoice.Fail();
|
||||
return;
|
||||
}
|
||||
|
||||
targets.WhereNotNull().RunScriptHook(x => x.ChangeIncomingTargets(moveChoice, ref targets));
|
||||
foreach (var target in targets.WhereNotNull())
|
||||
{
|
||||
target.RunScriptHookInterface<IScriptChangeIncomingTargets>(x =>
|
||||
x.ChangeIncomingTargets(moveChoice, ref targets));
|
||||
}
|
||||
|
||||
byte numberOfHits = 1;
|
||||
moveChoice.RunScriptHook(x => x.ChangeNumberOfHits(moveChoice, ref numberOfHits));
|
||||
moveChoice.RunScriptHookInterface<IScriptChangeNumberOfHits>(x =>
|
||||
x.ChangeNumberOfHits(moveChoice, ref numberOfHits));
|
||||
if (numberOfHits == 0)
|
||||
{
|
||||
return;
|
||||
@ -72,7 +77,7 @@ public static class MoveTurnExecutor
|
||||
battle.EventHook.Invoke(new MoveUseEvent(executingMove));
|
||||
|
||||
var prevented = false;
|
||||
executingMove.RunScriptHook(x => x.PreventMove(executingMove, ref prevented));
|
||||
executingMove.RunScriptHookInterface<IScriptPreventMove>(x => x.PreventMove(executingMove, ref prevented));
|
||||
if (prevented)
|
||||
return;
|
||||
|
||||
@ -83,7 +88,7 @@ public static class MoveTurnExecutor
|
||||
return;
|
||||
|
||||
var failed = false;
|
||||
executingMove.RunScriptHook(x => x.FailMove(executingMove, ref failed));
|
||||
executingMove.RunScriptHookInterface<IScriptFailMove>(x => x.FailMove(executingMove, ref failed));
|
||||
if (failed)
|
||||
{
|
||||
// TODO: fail handling
|
||||
@ -106,16 +111,16 @@ public static class MoveTurnExecutor
|
||||
public static void ExecuteMove(IExecutingMove executingMove)
|
||||
{
|
||||
var stopped = false;
|
||||
executingMove.RunScriptHook(x => x.StopBeforeMove(executingMove, ref stopped));
|
||||
executingMove.RunScriptHookInterface<IScriptStopBeforeMove>(x => x.StopBeforeMove(executingMove, ref stopped));
|
||||
if (stopped)
|
||||
return;
|
||||
|
||||
executingMove.RunScriptHook(x => x.OnBeforeMove(executingMove));
|
||||
executingMove.RunScriptHookInterface<IScriptOnBeforeMove>(x => x.OnBeforeMove(executingMove));
|
||||
foreach (var target in executingMove.Targets.WhereNotNull())
|
||||
{
|
||||
ExecuteMoveChoiceForTarget(executingMove.Battle, executingMove, target);
|
||||
}
|
||||
executingMove.RunScriptHook(x => x.OnAfterMove(executingMove));
|
||||
executingMove.RunScriptHookInterface<IScriptOnAfterMove>(x => x.OnAfterMove(executingMove));
|
||||
}
|
||||
|
||||
private static void ExecuteMoveChoiceForTarget(IBattle battle, IExecutingMove executingMove, IPokemon target)
|
||||
|
@ -31,7 +31,7 @@ public static class TurnRunner
|
||||
// they can then know this later on.)
|
||||
foreach (var choice in queue.GetChoices().WhereNotNull())
|
||||
{
|
||||
choice.RunScriptHook(script => script.OnBeforeTurnStart(choice));
|
||||
choice.RunScriptHookInterface<IScriptOnBeforeTurnStart>(script => script.OnBeforeTurnStart(choice));
|
||||
}
|
||||
|
||||
// Now we can properly begin executing choices.
|
||||
|
@ -309,7 +309,7 @@ public class BattleImpl : ScriptSource, IBattle
|
||||
}
|
||||
|
||||
ITurnChoice? forcedChoice = null;
|
||||
pokemon.RunScriptHook(script =>
|
||||
pokemon.RunScriptHookInterface<IScriptForceTurnSelection>(script =>
|
||||
script.ForceTurnSelection(this, battleData.SideIndex, battleData.Position, ref forcedChoice));
|
||||
choice = forcedChoice;
|
||||
return choice != null;
|
||||
@ -375,12 +375,13 @@ public class BattleImpl : ScriptSource, IBattle
|
||||
if (choice is IMoveChoice moveChoice)
|
||||
{
|
||||
var priority = moveChoice.ChosenMove.MoveData.Priority;
|
||||
choice.RunScriptHook(script => script.ChangePriority(moveChoice, ref priority));
|
||||
choice.RunScriptHookInterface<IScriptChangePriority>(script =>
|
||||
script.ChangePriority(moveChoice, ref priority));
|
||||
moveChoice.Priority = priority;
|
||||
}
|
||||
|
||||
var speed = choice.User.BoostedStats.Speed;
|
||||
choice.RunScriptHook(script => script.ChangeSpeed(choice, ref speed));
|
||||
choice.RunScriptHookInterface<IScriptChangeSpeed>(script => script.ChangeSpeed(choice, ref speed));
|
||||
choice.Speed = speed;
|
||||
|
||||
choice.RandomValue = (uint)Random.GetInt();
|
||||
|
@ -72,7 +72,7 @@ public class BattleChoiceQueue : IDeepCloneable
|
||||
continue;
|
||||
// Ensure that the speed is up to date
|
||||
var speed = choice.User.BoostedStats.Speed;
|
||||
choice.User.RunScriptHook(script => script.ChangeSpeed(choice, ref speed));
|
||||
choice.User.RunScriptHookInterface<IScriptChangeSpeed>(script => script.ChangeSpeed(choice, ref speed));
|
||||
choice.Speed = speed;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
@ -7,7 +7,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Battle_Bond_(Ability)">Bulbapedia - Battle Bond</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "battle_bond")]
|
||||
public class BattleBond : Script
|
||||
public class BattleBond : Script, IScriptChangeNumberOfHits
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnOpponentFaints(IExecutingMove move, IPokemon target, byte hit)
|
||||
@ -28,7 +28,7 @@ public class BattleBond : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
{
|
||||
if (choice.ChosenMove.MoveData.Name == "water_shuriken" && choice.User.Form.Name == "ash")
|
||||
{
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Gale_Wings_(Ability)">Bulbapedia - Gale Wings</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "gale_wings")]
|
||||
public class GaleWings : Script
|
||||
public class GaleWings : Script, IScriptChangePriority
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangePriority(IMoveChoice choice, ref sbyte priority)
|
||||
public void ChangePriority(IMoveChoice choice, ref sbyte priority)
|
||||
{
|
||||
if (choice.User.CurrentHealth != choice.User.MaxHealth)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Lightning_Rod_(Ability)">Bulbapedia - Lightning Rod</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "lightning_rod")]
|
||||
public class LightningRod : Script
|
||||
public class LightningRod : Script, IScriptChangeIncomingTargets
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
if (moveChoice.ChosenMove.MoveData.MoveType.Name == "electric" && targets.Count == 1)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magic_Bounce_(Ability)">Bulbapedia - Magic Bounce</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "magic_bounce")]
|
||||
public class MagicBounce : Script
|
||||
public class MagicBounce : Script, IScriptChangeIncomingTargets
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
if (moveChoice.ChosenMove.MoveData.HasFlag("reflectable"))
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Parental_Bond_(Ability)">Bulbapedia - Parental Bond</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "parental_bond")]
|
||||
public class ParentalBond : Script
|
||||
public class ParentalBond : Script, IScriptChangeNumberOfHits
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
{
|
||||
if (numberOfHits == 1)
|
||||
numberOfHits = 2;
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Prankster_(Ability)">Bulbapedia - Prankster</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "prankster")]
|
||||
public class Prankster : Script
|
||||
public class Prankster : Script, IScriptChangePriority
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangePriority(IMoveChoice choice, ref sbyte priority)
|
||||
public void ChangePriority(IMoveChoice choice, ref sbyte priority)
|
||||
{
|
||||
if (choice.ChosenMove.MoveData.Category == MoveCategory.Status && priority != sbyte.MaxValue)
|
||||
priority++;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Protean_(Ability)">Bulbapedia - Protean</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "protean")]
|
||||
public class Protean : Script
|
||||
public class Protean : Script, IScriptOnBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
if (move.User.Types.Count == 1 && move.User.Types[0] == move.UseMove.MoveType)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Quick_Feet_(Ability)">Bulbapedia - Quick Feet</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "quick_feet")]
|
||||
public class QuickFeet : Script
|
||||
public class QuickFeet : Script, IScriptChangeSpeed
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
if (choice.User.StatusScript.IsEmpty)
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Rush_(Ability)">Bulbapedia - Sand Rush</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "sand_rush")]
|
||||
public class SandRush : Script
|
||||
public class SandRush : Script, IScriptChangeSpeed
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
if (choice.User.BattleData?.Battle.WeatherName == ScriptUtils.ResolveName<Weather.Sandstorm>())
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Slush_Rush_(Ability)">Bulbapedia - Slush Rush</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "slush_rush")]
|
||||
public class SlushRush : Script
|
||||
public class SlushRush : Script, IScriptChangeSpeed
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
if (choice.User.BattleData?.Battle.WeatherName == ScriptUtils.ResolveName<Weather.Hail>())
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Sand_Rush_(Ability)">Bulbapedia - Sand Rush</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "speed_modifier_in_weather")]
|
||||
public class SpeedModifierInWeather : Script, IScriptOnInitialize
|
||||
public class SpeedModifierInWeather : Script, IScriptOnInitialize, IScriptChangeSpeed
|
||||
{
|
||||
private StringKey _weather;
|
||||
private float _modifier;
|
||||
@ -33,7 +33,7 @@ public class SpeedModifierInWeather : Script, IScriptOnInitialize
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
var battle = choice.User.BattleData?.Battle;
|
||||
if (battle is null)
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Stall_(Ability)">Bulbapedia - Stall</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "stall")]
|
||||
public class Stall : Script
|
||||
public class Stall : Script, IScriptChangeSpeed
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
speed = 0;
|
||||
}
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Stance_Change_(Ability)">Bulbapedia - Stance Change</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "stance_change")]
|
||||
public class StanceChange : Script
|
||||
public class StanceChange : Script, IScriptOnBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
if (move.User.Species.Name != "aegislash")
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Storm_Drain_(Ability)">Bulbapedia - Storm Drain</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "storm_drain")]
|
||||
public class StormDrain : Script
|
||||
public class StormDrain : Script, IScriptChangeIncomingTargets
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
if (moveChoice.ChosenMove.MoveData.MoveType.Name == "water" && targets.Count == 1)
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Surge_Surfer_(Ability)">Bulbapedia - Surge Surfer</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "surge_surfer")]
|
||||
public class SurgeSurfer : Script
|
||||
public class SurgeSurfer : Script, IScriptChangeSpeed
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
if (choice.User.BattleData?.Battle.TerrainName == ScriptUtils.ResolveName<Terrain.ElectricTerrain>())
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Swift_Swim_(Ability)">Bulbapedia - Swift Swim</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "swift_swim")]
|
||||
public class SwiftSwim : Script
|
||||
public class SwiftSwim : Script, IScriptChangeSpeed
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
if (choice.User.BattleData?.Battle.WeatherName == ScriptUtils.ResolveName<Weather.Rain>())
|
||||
{
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Triage_(Ability)">Bulbapedia - Triage</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "triage")]
|
||||
public class Triage : Script
|
||||
public class Triage : Script, IScriptChangePriority
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangePriority(IMoveChoice choice, ref sbyte priority)
|
||||
public void ChangePriority(IMoveChoice choice, ref sbyte priority)
|
||||
{
|
||||
if (!choice.ChosenMove.MoveData.HasFlag("heal"))
|
||||
return;
|
||||
|
@ -8,10 +8,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Truant_(Ability)">Bulbapedia - Truant</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "truant")]
|
||||
public class Truant : Script
|
||||
public class Truant : Script, IScriptOnAfterMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterMove(IExecutingMove move)
|
||||
public void OnAfterMove(IExecutingMove move)
|
||||
{
|
||||
move.User.Volatile.Add(new TruantEffect(move.User));
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
|
||||
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Unburden_(Ability)">Bulbapedia - Unburden</see>
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Ability, "unburden")]
|
||||
public class Unburden : Script
|
||||
public class Unburden : Script, IScriptChangeSpeed
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
if (choice.User.HasItemBeenRemovedForBattle)
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using PkmnLib.Dynamic.BattleFlow;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "snatch_effect")]
|
||||
public class SnatchEffect : Script
|
||||
public class SnatchEffect : Script, IScriptStopBeforeMove
|
||||
{
|
||||
private Queue<IPokemon> _snatchers = new();
|
||||
|
||||
@ -33,7 +33,7 @@ public class SnatchEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
if (move.UseMove.HasFlag("snatch") && TryGetSnatcher(out var snatcher))
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "trick_room")]
|
||||
public class TrickRoomEffect : Script
|
||||
public class TrickRoomEffect : Script, IScriptChangeSpeed
|
||||
{
|
||||
private int _turnsLeft = 5;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
speed = uint.MaxValue - speed;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
|
||||
[Script(ScriptCategory.Battle, "uproar_effect")]
|
||||
public class UproarEffect : Script
|
||||
public class UproarEffect : Script, IScriptOnBeforeTurnStart
|
||||
{
|
||||
private IPokemon? _placer;
|
||||
private bool _hasUsedUproar;
|
||||
@ -24,7 +24,7 @@ public class UproarEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
_hasUsedUproar = false;
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
|
||||
[Script(ScriptCategory.MoveVolatile, "fire_grass_pledge")]
|
||||
public class FireGrassPledgeMove : Script
|
||||
public class FireGrassPledgeMove : Script, IScriptChangeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
moveName = "fire_pledge";
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
|
||||
[Script(ScriptCategory.MoveVolatile, "fire_water_pledge")]
|
||||
public class FireWaterPledgeMove : Script
|
||||
public class FireWaterPledgeMove : Script, IScriptChangeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
moveName = "water_pledge";
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
|
||||
[Script(ScriptCategory.MoveVolatile, "grass_water_pledge")]
|
||||
public class GrassWaterPledgeMove : Script
|
||||
public class GrassWaterPledgeMove : Script, IScriptChangeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
moveName = "grass_pledge";
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
/// If the other Pokémon in the user's party do not know any eligible moves, Assist fails.
|
||||
/// </remarks>
|
||||
[Script(ScriptCategory.Move, "assist")]
|
||||
public class Assist : Script
|
||||
public class Assist : Script, IScriptChangeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
var user = choice.User;
|
||||
if (user.BattleData == null)
|
||||
|
@ -2,11 +2,12 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
public abstract class BaseChargeMove<TVolatile> : Script where TVolatile : RequireChargeEffect
|
||||
public abstract class BaseChargeMove<TVolatile> : Script, IScriptPreventMove, IScriptOnBeforeMove
|
||||
where TVolatile : RequireChargeEffect
|
||||
{
|
||||
public abstract TVolatile CreateVolatile(IPokemon user);
|
||||
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.Volatile.Contains<TVolatile>())
|
||||
return;
|
||||
@ -20,7 +21,7 @@ public abstract class BaseChargeMove<TVolatile> : Script where TVolatile : Requi
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
move.User.Volatile.Remove(ScriptUtils.ResolveName<TVolatile>());
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "beak_blast")]
|
||||
public class BeakBlast : Script
|
||||
public class BeakBlast : Script, IScriptOnBeforeTurnStart
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
var battleData = choice.User.BattleData;
|
||||
if (battleData == null)
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "beat_up")]
|
||||
public class BeatUp : Script
|
||||
public class BeatUp : Script, IScriptChangeNumberOfHits
|
||||
{
|
||||
private IPokemon[]? _relevantPartyMembers;
|
||||
|
||||
@ -16,7 +16,7 @@ public class BeatUp : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
{
|
||||
var relevantPartyMembers = _relevantPartyMembers ??= GetRelevantPartyMembers(choice.User).ToArray();
|
||||
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "bounce")]
|
||||
public class Bounce : Script
|
||||
public class Bounce : Script, IScriptPreventMove, IScriptOnBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.Volatile.Contains<ChargeBounceEffect>())
|
||||
return;
|
||||
@ -20,7 +20,7 @@ public class Bounce : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
move.User.Volatile.Remove(ScriptUtils.ResolveName<ChargeBounceEffect>());
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "brick_break")]
|
||||
public class BrickBreak : Script
|
||||
public class BrickBreak : Script, IScriptOnBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
var sides = move.User.BattleData?.Battle.Sides;
|
||||
if (sides == null)
|
||||
|
@ -3,9 +3,9 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "charge_move")]
|
||||
public class ChargeMove : Script
|
||||
public class ChargeMove : Script, IScriptPreventMove
|
||||
{
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
var args = new CustomTriggers.BypassChargeMoveArgs(move, false);
|
||||
move.RunScriptHook(script => script.CustomTrigger(CustomTriggers.BypassChargeMove, args));
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "copycat")]
|
||||
public class Copycat : Script
|
||||
public class Copycat : Script, IScriptChangeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
var lastMove = choice.User.BattleData?.Battle.PreviousTurnChoices.SelectMany(x => x).OfType<IMoveChoice>()
|
||||
.LastOrDefault();
|
||||
|
@ -3,16 +3,16 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "counter")]
|
||||
public class Counter : Script
|
||||
public class Counter : Script, IScriptOnBeforeTurnStart, IScriptChangeTargets
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
choice.User.Volatile.Add(new CounterHelperEffect());
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
public void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
var counterHelper = moveChoice.User.Volatile.Get<CounterHelperEffect>();
|
||||
var lastHitBy = counterHelper?.LastHitBy;
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "dig")]
|
||||
public class Dig : Script
|
||||
public class Dig : Script, IScriptPreventMove, IScriptOnBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.Volatile.Contains<DigEffect>())
|
||||
return;
|
||||
@ -20,7 +20,7 @@ public class Dig : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
move.User.Volatile.Remove(ScriptUtils.ResolveName<DigEffect>());
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "dive")]
|
||||
public class Dive : Script
|
||||
public class Dive : Script, IScriptPreventMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.Volatile.Contains<DiveEffect>())
|
||||
return;
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "2_hit_move")]
|
||||
public class DoubleHitMove : Script
|
||||
public class DoubleHitMove : Script, IScriptChangeNumberOfHits
|
||||
{
|
||||
public override void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
{
|
||||
numberOfHits = 2;
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "double_power_if_target_damaged_in_turn")]
|
||||
public class DoublePowerIfTargetDamagedInTurn : Script
|
||||
public class DoublePowerIfTargetDamagedInTurn : Script, IScriptOnBeforeTurnStart
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
if (choice is IMoveChoice moveChoice)
|
||||
{
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fake_out")]
|
||||
public class FakeOut : Script
|
||||
public class FakeOut : Script, IScriptStopBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fire_pledge")]
|
||||
public class FirePledge : Script
|
||||
public class FirePledge : Script, IScriptStopBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
if (move.MoveChoice.Volatile.Contains<FireWaterPledgeMove>() ||
|
||||
move.MoveChoice.Volatile.Contains<FireGrassPledgeMove>())
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "first_impression")]
|
||||
public class FirstImpression : Script
|
||||
public class FirstImpression : Script, IScriptStopBeforeMove
|
||||
{
|
||||
public override void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "fly")]
|
||||
public class Fly : Script
|
||||
public class Fly : Script, IScriptPreventMove, IScriptOnBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.Volatile.Contains<ChargeFlyEffect>())
|
||||
return;
|
||||
@ -20,7 +20,7 @@ public class Fly : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
move.User.Volatile.Remove(ScriptUtils.ResolveName<ChargeFlyEffect>());
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "focus_punch")]
|
||||
public class FocusPunch : Script
|
||||
public class FocusPunch : Script, IScriptOnBeforeTurnStart, IScriptPreventMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
choice.User.Volatile.Add(new FocusPunchEffect());
|
||||
choice.User.BattleData?.Battle.EventHook.Invoke(new DialogEvent("focus_punch_charge",
|
||||
@ -17,7 +17,7 @@ public class FocusPunch : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
var focusPunchEffect = move.User.Volatile.Get<FocusPunchEffect>();
|
||||
if (focusPunchEffect == null || focusPunchEffect.WasHit)
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "follow_me")]
|
||||
public class FollowMe : Script
|
||||
public class FollowMe : Script, IScriptChangeTargets
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
public void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
if (targets.Count != 1)
|
||||
return;
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Battle;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "future_sight")]
|
||||
public class FutureSight : Script
|
||||
public class FutureSight : Script, IScriptStopBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void StopBeforeMove(IExecutingMove move, ref bool prevent)
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
var battleData = move.User.BattleData;
|
||||
if (battleData == null)
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "grass_pledge")]
|
||||
public class GrassPledge : Script
|
||||
public class GrassPledge : Script, IScriptStopBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
if (move.MoveChoice.Volatile.Contains<GrassWaterPledgeMove>() ||
|
||||
move.MoveChoice.Volatile.Contains<FireGrassPledgeMove>())
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "me_first")]
|
||||
public class MeFirst : Script
|
||||
public class MeFirst : Script, IScriptChangeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
var battleData = choice.User.BattleData;
|
||||
if (battleData == null)
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "metal_burst")]
|
||||
public class MetalBurst : Script
|
||||
public class MetalBurst : Script, IScriptOnBeforeTurnStart
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
choice.User.Volatile.Add(new MetalBurstHelper());
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "metronome")]
|
||||
public class Metronome : Script
|
||||
public class Metronome : Script, IScriptChangeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
var battleData = choice.User.BattleData;
|
||||
if (battleData == null)
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "mirror_coat")]
|
||||
public class MirrorCoat : Script
|
||||
public class MirrorCoat : Script, IScriptOnBeforeTurnStart
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
choice.User.Volatile.Add(new MirrorCoatHelper());
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "mirror_move")]
|
||||
public class MirrorMove : Script
|
||||
public class MirrorMove : Script, IScriptChangeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
var battleData = choice.User.BattleData;
|
||||
if (battleData == null)
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "2_5_hit_move")]
|
||||
public class MultiHitMove : Script
|
||||
public class MultiHitMove : Script, IScriptChangeNumberOfHits
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
{
|
||||
var random = choice.User.BattleData?.Battle.Random;
|
||||
if (random == null)
|
||||
|
@ -4,10 +4,10 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "nature_power")]
|
||||
public class NaturePower : Script
|
||||
public class NaturePower : Script, IScriptChangeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
var battleData = choice.User.BattleData;
|
||||
if (battleData is null)
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "parabolic_charge")]
|
||||
public class ParabolicCharge : Script
|
||||
public class ParabolicCharge : Script, IScriptOnAfterMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterMove(IExecutingMove move)
|
||||
public void OnAfterMove(IExecutingMove move)
|
||||
{
|
||||
if (move.User.IsFainted)
|
||||
return;
|
||||
|
@ -7,10 +7,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
/// and attacks on the second turn.
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Move, "phantom_force")]
|
||||
public class PhantomForce : Script
|
||||
public class PhantomForce : Script, IScriptPreventMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.Volatile.Contains<PhantomForceCharge>())
|
||||
return;
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "pursuit")]
|
||||
public class Pursuit : Script
|
||||
public class Pursuit : Script, IScriptOnBeforeTurnStart, IScriptOnAfterMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
if (choice is IMoveChoice moveChoice)
|
||||
choice.User.Volatile.Add(new PursuitEffect(moveChoice));
|
||||
@ -17,5 +17,5 @@ public class Pursuit : Script
|
||||
move.User.Volatile.Remove<PursuitEffect>();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterMove(IExecutingMove move) => move.User.Volatile.Remove<PursuitEffect>();
|
||||
public void OnAfterMove(IExecutingMove move) => move.User.Volatile.Remove<PursuitEffect>();
|
||||
}
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "razor_wind")]
|
||||
public class RazorWind : Script
|
||||
public class RazorWind : Script, IScriptPreventMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
var chargeMoveEffect = move.User.Volatile.Get<ChargeMoveEffect>();
|
||||
if (chargeMoveEffect != null && chargeMoveEffect.MoveName == move.UseMove.Name)
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "round")]
|
||||
public class Round : Script
|
||||
public class Round : Script, IScriptOnAfterMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterMove(IExecutingMove move)
|
||||
public void OnAfterMove(IExecutingMove move)
|
||||
{
|
||||
var choiceQueue = move.Battle.ChoiceQueue;
|
||||
if (choiceQueue is null)
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "self_destruct")]
|
||||
public class SelfDestruct : Script
|
||||
public class SelfDestruct : Script, IScriptOnAfterMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnAfterMove(IExecutingMove move)
|
||||
public void OnAfterMove(IExecutingMove move)
|
||||
{
|
||||
if (move.User.IsFainted)
|
||||
return;
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "shadow_force")]
|
||||
public class ShadowForce : Script
|
||||
public class ShadowForce : Script, IScriptPreventMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.Volatile.Contains<ShadowForceCharge>())
|
||||
return;
|
||||
|
@ -3,16 +3,16 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "shell_trap")]
|
||||
public class ShellTrap : Script
|
||||
public class ShellTrap : Script, IScriptOnBeforeMove, IScriptFailMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
move.User.Volatile.Add(new ShellTrapHelper());
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void FailMove(IExecutingMove move, ref bool fail)
|
||||
public void FailMove(IExecutingMove move, ref bool fail)
|
||||
{
|
||||
var shellTrapHelper = move.User.Volatile.Get<ShellTrapHelper>();
|
||||
if (shellTrapHelper is not { HasHit: true })
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "skull_bash")]
|
||||
public class SkullBash : Script
|
||||
public class SkullBash : Script, IScriptPreventMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.Volatile.Contains<SkullBashEffect>())
|
||||
return;
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "sky_attack")]
|
||||
public class SkyAttack : Script
|
||||
public class SkyAttack : Script, IScriptPreventMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.Volatile.Contains<SkyAttackEffect>())
|
||||
return;
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "sky_drop")]
|
||||
public class SkyDrop : Script
|
||||
public class SkyDrop : Script, IScriptPreventMove, IScriptOnBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.Volatile.Contains<ChargeSkyDropEffect>())
|
||||
return;
|
||||
@ -20,7 +20,7 @@ public class SkyDrop : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
move.User.Volatile.Remove(ScriptUtils.ResolveName<ChargeSkyDropEffect>());
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "sleep_talk")]
|
||||
public class SleepTalk : Script
|
||||
public class SleepTalk : Script, IScriptChangeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
public void ChangeMove(IMoveChoice choice, ref StringKey moveName)
|
||||
{
|
||||
if (!choice.User.HasStatus(ScriptUtils.ResolveName<Status.Sleep>()))
|
||||
{
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "snore")]
|
||||
public class Snore : Script
|
||||
public class Snore : Script, IScriptFailMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void FailMove(IExecutingMove move, ref bool fail)
|
||||
public void FailMove(IExecutingMove move, ref bool fail)
|
||||
{
|
||||
if (!move.User.HasStatus(ScriptUtils.ResolveName<Status.Sleep>()))
|
||||
fail = true;
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "struggle")]
|
||||
public class Struggle : Script
|
||||
public class Struggle : Script, IScriptChangeNumberOfHits
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
{
|
||||
numberOfHits = 1;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "synchronoise")]
|
||||
public class Synchronoise : Script
|
||||
public class Synchronoise : Script, IScriptChangeTargets
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
public void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
var battleData = moveChoice.User.BattleData;
|
||||
if (battleData == null)
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "triple_kick")]
|
||||
public class TripleKick : Script
|
||||
public class TripleKick : Script, IScriptChangeNumberOfHits
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits)
|
||||
{
|
||||
numberOfHits = 3;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "twineedle")]
|
||||
public class Twineedle : Script
|
||||
public class Twineedle : Script, IScriptChangeNumberOfHits
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits) => numberOfHits = 2;
|
||||
public void ChangeNumberOfHits(IMoveChoice choice, ref byte numberOfHits) => numberOfHits = 2;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
||||
|
@ -3,10 +3,10 @@ using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
||||
|
||||
[Script(ScriptCategory.Move, "water_pledge")]
|
||||
public class WaterPledge : Script
|
||||
public class WaterPledge : Script, IScriptStopBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
if (move.MoveChoice.Volatile.Contains<GrassWaterPledgeMove>() ||
|
||||
move.MoveChoice.Volatile.Contains<FireWaterPledgeMove>())
|
||||
|
@ -2,7 +2,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
public abstract class BaseChargeEffect : Script
|
||||
public abstract class BaseChargeEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
private readonly StringKey _moveName;
|
||||
@ -14,7 +14,7 @@ public abstract class BaseChargeEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, _moveName, opposingSideIndex, position);
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "bide")]
|
||||
public class BideEffect : Script
|
||||
public class BideEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon? _owner;
|
||||
public byte Turns;
|
||||
@ -34,7 +34,7 @@ public class BideEffect : Script
|
||||
private ITurnChoice? _choice;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
if (_owner == null)
|
||||
return;
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "charge_bounce")]
|
||||
public class ChargeBounceEffect : Script
|
||||
public class ChargeBounceEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
@ -13,7 +13,7 @@ public class ChargeBounceEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "bounce", opposingSideIndex, position);
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "charge_fly")]
|
||||
public class ChargeFlyEffect : Script
|
||||
public class ChargeFlyEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
@ -13,7 +13,7 @@ public class ChargeFlyEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "fly", opposingSideIndex, position);
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "charge_move_effect")]
|
||||
public class ChargeMoveEffect : Script
|
||||
public class ChargeMoveEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
public readonly StringKey MoveName;
|
||||
private readonly IPokemon _user;
|
||||
@ -19,7 +19,7 @@ public class ChargeMoveEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_user, MoveName, _targetSide, _targetPosition);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "charge_sky_drop")]
|
||||
public class ChargeSkyDropEffect : Script
|
||||
public class ChargeSkyDropEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
@ -13,7 +13,7 @@ public class ChargeSkyDropEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "sky_drop", opposingSideIndex, position);
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "confusion")]
|
||||
public class Confusion : Script
|
||||
public class Confusion : Script, IScriptStopBeforeMove
|
||||
{
|
||||
private int _turnsConfused;
|
||||
|
||||
@ -19,7 +19,7 @@ public class Confusion : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
_turnsConfused--;
|
||||
move.Battle.EventHook.Invoke(new DialogEvent("pokemon_is_confused", new Dictionary<string, object>
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "destiny_bond")]
|
||||
public class DestinyBondEffect : Script
|
||||
public class DestinyBondEffect : Script, IScriptOnBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnFaint(IPokemon pokemon, DamageSource source)
|
||||
@ -15,7 +15,7 @@ public class DestinyBondEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "dig")]
|
||||
public class DigEffect : Script
|
||||
public class DigEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
@ -13,7 +13,7 @@ public class DigEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "dig", opposingSideIndex, position);
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "dive")]
|
||||
public class DiveEffect : Script
|
||||
public class DiveEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
@ -13,7 +13,7 @@ public class DiveEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "dive", opposingSideIndex, position);
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "encore")]
|
||||
public class EncoreEffect : Script
|
||||
public class EncoreEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
private readonly StringKey _move;
|
||||
@ -17,7 +17,7 @@ public class EncoreEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, _move, opposingSideIndex, position);
|
||||
|
@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "flinch_effect")]
|
||||
public class FlinchEffect : Script
|
||||
public class FlinchEffect : Script, IScriptPreventMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
prevent = true;
|
||||
var args = new CustomTriggers.OnFlinchArgs(move);
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "fury_cutter")]
|
||||
public class FuryCutterEffect : Script
|
||||
public class FuryCutterEffect : Script, IScriptOnBeforeMove
|
||||
{
|
||||
public int TurnCount { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeMove(IExecutingMove move)
|
||||
public void OnBeforeMove(IExecutingMove move)
|
||||
{
|
||||
if (move.UseMove.Name != "fury_cutter")
|
||||
RemoveSelf();
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "heal_block")]
|
||||
public class HealBlockEffect : Script, IScriptPreventMoveSelection
|
||||
public class HealBlockEffect : Script, IScriptPreventMoveSelection, IScriptPreventMove
|
||||
{
|
||||
private int _duration;
|
||||
|
||||
@ -26,7 +26,7 @@ public class HealBlockEffect : Script, IScriptPreventMoveSelection
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.ChosenMove.MoveData.HasFlag("heal"))
|
||||
prevent = true;
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "ice_ball")]
|
||||
public class IceBallEffect : Script
|
||||
public class IceBallEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
private readonly StringKey _moveName;
|
||||
@ -17,7 +17,7 @@ public class IceBallEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, _moveName, opposingSideIndex, position);
|
||||
|
@ -10,10 +10,10 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
/// gender that has Cute Charm as its Ability, and is caused to a Pokémon that infatuates a Pokémon holding a Destiny Knot.
|
||||
/// </remarks>
|
||||
[Script(ScriptCategory.Pokemon, "infatuated")]
|
||||
public class Infatuated : Script
|
||||
public class Infatuated : Script, IScriptPreventMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
public void PreventMove(IExecutingMove move, ref bool prevent)
|
||||
{
|
||||
if (move.User.BattleData?.Battle.Random.GetBool() == true)
|
||||
prevent = true;
|
||||
|
@ -2,7 +2,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
public abstract class OutrageLikeEffect : Script
|
||||
public abstract class OutrageLikeEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
private int _turns;
|
||||
@ -20,7 +20,7 @@ public abstract class OutrageLikeEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, _move, _targetSide, _targetPosition);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "phantom_force")]
|
||||
public class PhantomForceCharge : Script
|
||||
public class PhantomForceCharge : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
@ -13,7 +13,7 @@ public class PhantomForceCharge : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "phantom_force", opposingSideIndex, position);
|
||||
|
@ -5,13 +5,13 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
/// or protect-like moves.
|
||||
/// </summary>
|
||||
[Script(ScriptCategory.Pokemon, "protection_failure")]
|
||||
public class ProtectionFailureScript : Script
|
||||
public class ProtectionFailureScript : Script, IScriptOnBeforeTurnStart
|
||||
{
|
||||
public int ProtectTurns { get; set; }
|
||||
public bool UsedProtect { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
UsedProtect = false;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "requires_recharge")]
|
||||
public class RequiresRechargeEffect : Script
|
||||
public class RequiresRechargeEffect : Script, IScriptForceTurnSelection, IScriptOnBeforeTurnStart
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
@ -11,13 +11,13 @@ public class RequiresRechargeEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
choice = new PassChoice(_owner);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnBeforeTurnStart(ITurnChoice choice)
|
||||
public void OnBeforeTurnStart(ITurnChoice choice)
|
||||
{
|
||||
RemoveSelf();
|
||||
_owner.BattleData?.Battle.EventHook.Invoke(new DialogEvent("pokemon_must_recharge",
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "shadow_force")]
|
||||
public class ShadowForceCharge : Script
|
||||
public class ShadowForceCharge : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
@ -13,7 +13,7 @@ public class ShadowForceCharge : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
var opposingSideIndex = (byte)(_owner.BattleData?.SideIndex == 0 ? 1 : 0);
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "shadow_force", opposingSideIndex, position);
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "skull_bash")]
|
||||
public class SkullBashEffect : Script
|
||||
public class SkullBashEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
@ -13,7 +13,7 @@ public class SkullBashEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "skull_bash", sideIndex, position);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "sky_attack")]
|
||||
public class SkyAttackEffect : Script
|
||||
public class SkyAttackEffect : Script, IScriptForceTurnSelection
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
@ -13,7 +13,7 @@ public class SkyAttackEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
public void ForceTurnSelection(IBattle battle, byte sideIndex, byte position, ref ITurnChoice? choice)
|
||||
{
|
||||
choice = TurnChoiceHelper.CreateMoveChoice(_owner, "sky_attack", sideIndex, position);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "slow_start")]
|
||||
public class SlowStartEffect : Script
|
||||
public class SlowStartEffect : Script, IScriptChangeSpeed
|
||||
{
|
||||
private int _turnsRemaining = 5;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
speed /= 2;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user