Further work on refactor to interface based scripts
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "beak_blast_effect")]
|
||||
public class BeakBlastEffect : Script
|
||||
public class BeakBlastEffect : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.GetHitData(target, hit).IsContact)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "bide")]
|
||||
public class BideEffect : Script, IScriptForceTurnSelection
|
||||
public class BideEffect : Script, IScriptForceTurnSelection, IScriptOnIncomingHit
|
||||
{
|
||||
private readonly IPokemon? _owner;
|
||||
public byte Turns;
|
||||
@@ -20,7 +20,7 @@ public class BideEffect : Script, IScriptForceTurnSelection
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
HitBy.Add(move.User);
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "counterhelper")]
|
||||
public class CounterHelperEffect : Script
|
||||
public class CounterHelperEffect : Script, IScriptOnIncomingHit
|
||||
{
|
||||
public IPokemon? LastHitBy { get; private set; }
|
||||
public uint LastDamage { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.UseMove.Category == MoveCategory.Physical)
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "focus_punch")]
|
||||
public class FocusPunchEffect : Script
|
||||
public class FocusPunchEffect : Script, IScriptOnIncomingHit
|
||||
{
|
||||
public bool WasHit { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
WasHit = true;
|
||||
target.BattleData?.Battle.EventHook.Invoke(new DialogEvent("focus_punch_lost_focus",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "grudge")]
|
||||
public class GrudgeEffect : Script
|
||||
public class GrudgeEffect : Script, IScriptOnIncomingHit
|
||||
{
|
||||
private ILearnedMove? _lastMove;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
_lastMove = move.ChosenMove;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
public class HelpingHandEffect : Script
|
||||
public class HelpingHandEffect : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) =>
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower) =>
|
||||
basePower = basePower.MultiplyOrMax(1.5f);
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -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, IScriptForceTurnSelection
|
||||
public class IceBallEffect : Script, IScriptForceTurnSelection, IScriptOnMoveMiss
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
private readonly StringKey _moveName;
|
||||
@@ -24,7 +24,7 @@ public class IceBallEffect : Script, IScriptForceTurnSelection
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMoveMiss(IExecutingMove move, IPokemon target)
|
||||
public void OnMoveMiss(IExecutingMove move, IPokemon target)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "increased_critical_stage")]
|
||||
public class IncreasedCriticalStage : Script
|
||||
public class IncreasedCriticalStage : Script, IScriptChangeCriticalStage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
|
||||
public void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
|
||||
{
|
||||
// Extreme edge case, should never happen
|
||||
if (stage == byte.MaxValue)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "ingrain")]
|
||||
public class IngrainEffect : Script
|
||||
public class IngrainEffect : Script, IScriptFailIncomingMove
|
||||
{
|
||||
private readonly IPokemon _owner;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class IngrainEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail)
|
||||
public void FailIncomingMove(IExecutingMove move, IPokemon target, ref bool fail)
|
||||
{
|
||||
if (move.UseMove.Name == "roar" || move.UseMove.Name == "whirlwind")
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "laser_focus")]
|
||||
public class LaserFocusEffect : Script
|
||||
public class LaserFocusEffect : Script, IScriptChangeCriticalStage
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
|
||||
public void ChangeCriticalStage(IExecutingMove move, IPokemon target, byte hit, ref byte stage)
|
||||
{
|
||||
stage = 100;
|
||||
RemoveSelf();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
public class LuckyChantEffect : Script
|
||||
public class LuckyChantEffect : Script, IScriptBlockCriticalHit
|
||||
{
|
||||
private int _turnsLeft = 5;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void BlockCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block)
|
||||
public void BlockCriticalHit(IExecutingMove move, IPokemon target, byte hit, ref bool block)
|
||||
{
|
||||
block = true;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "magnet_rise")]
|
||||
public class MagnetRiseEffect : Script
|
||||
public class MagnetRiseEffect : Script, IScriptChangeEffectiveness
|
||||
{
|
||||
private int _turnsRemaining = 5;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness)
|
||||
public void ChangeEffectiveness(IExecutingMove move, IPokemon target, byte hit, ref float effectiveness)
|
||||
{
|
||||
if (move.UseMove.MoveType.Name == "ground")
|
||||
{
|
||||
|
||||
@@ -40,10 +40,10 @@ public class PursuitEffect : Script
|
||||
}
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "pursuit_double_power")]
|
||||
private class PursuitDoublePowerEffect : Script
|
||||
private class PursuitDoublePowerEffect : Script, IScriptChangeBasePower
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
|
||||
{
|
||||
basePower = basePower.MultiplyOrMax(2);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "rage")]
|
||||
public class RageEffect : Script
|
||||
public class RageEffect : Script, IScriptOnIncomingHit
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
move.User.ChangeStatBoost(Statistic.Attack, 1, true, false);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@ using PkmnLib.Static.Moves;
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "shell_trap")]
|
||||
public class ShellTrapHelper : Script
|
||||
public class ShellTrapHelper : Script, IScriptOnIncomingHit
|
||||
{
|
||||
public bool HasHit { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
public void OnIncomingHit(IExecutingMove move, IPokemon target, byte hit)
|
||||
{
|
||||
if (move.UseMove.Category == MoveCategory.Physical)
|
||||
HasHit = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
||||
|
||||
[Script(ScriptCategory.Pokemon, "telekinesis")]
|
||||
public class TelekinesisEffect : Script
|
||||
public class TelekinesisEffect : Script, IScriptChangeIncomingEffectiveness
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
@@ -17,7 +17,7 @@ public class TelekinesisEffect : Script
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ChangeIncomingEffectiveness(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
public void ChangeIncomingEffectiveness(IExecutingMove executingMove, IPokemon target, byte hitIndex,
|
||||
ref float effectiveness)
|
||||
{
|
||||
if (executingMove.UseMove.MoveType.Name == "ground")
|
||||
|
||||
Reference in New Issue
Block a user