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:
@@ -3,10 +3,10 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "crafty_shield")]
|
||||
public class CraftyShieldEffect : Script
|
||||
public class CraftyShieldEffect : Script, IScriptStopBeforeMove
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
public void StopBeforeMove(IExecutingMove move, ref bool stop)
|
||||
{
|
||||
if (move.UseMove.Category == MoveCategory.Status)
|
||||
stop = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "rage_powder")]
|
||||
public class RagePowderEffect : Script
|
||||
public class RagePowderEffect : Script, IScriptChangeIncomingTargets
|
||||
{
|
||||
public IPokemon User { get; set; }
|
||||
|
||||
@@ -11,7 +11,7 @@ public class RagePowderEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
// Ignore multi-hit moves
|
||||
if (targets.Count != 1)
|
||||
|
||||
@@ -2,7 +2,7 @@ using PkmnLib.Dynamic.BattleFlow;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
public class SpotlightEffect : Script
|
||||
public class SpotlightEffect : Script, IScriptChangeIncomingTargets
|
||||
{
|
||||
private readonly byte _position;
|
||||
private readonly IBattleSide _side;
|
||||
@@ -14,7 +14,7 @@ public class SpotlightEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
if (!TargetResolver.IsValidTarget(_side.Index, _position, moveChoice.ChosenMove.MoveData.Target,
|
||||
moveChoice.User))
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "swamp_effect")]
|
||||
public class SwampEffect : Script
|
||||
public class SwampEffect : Script, IScriptChangeSpeed
|
||||
{
|
||||
private int _turns = 5;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
speed /= 4;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "tailwind")]
|
||||
public class TailwindEffect : Script
|
||||
public class TailwindEffect : Script, IScriptChangeSpeed
|
||||
{
|
||||
private int _duration = 3;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
|
||||
{
|
||||
speed *= 2;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
[Script(ScriptCategory.Side, "wide_guard")]
|
||||
public class WideGuardEffect : Script
|
||||
public class WideGuardEffect : Script, IScriptChangeTargets
|
||||
{
|
||||
private IBattleSide? _side;
|
||||
|
||||
@@ -19,7 +19,7 @@ public class WideGuardEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
public void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
|
||||
{
|
||||
if (_side == null)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user