Refactor move classes to implement respective interfaces for better structure
All checks were successful
Build / Build (push) Successful in 52s

This commit is contained in:
2025-06-28 12:02:24 +02:00
parent 2319160b52
commit b7bdf2b744
115 changed files with 407 additions and 348 deletions

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "frozen")]
public class Frozen : Script
public class Frozen : Script, IScriptPreventMove
{
private IPokemon? _pokemon;
@@ -16,7 +16,7 @@ public class Frozen : Script
}
/// <inheritdoc />
public override void PreventMove(IExecutingMove move, ref bool prevent)
public void PreventMove(IExecutingMove move, ref bool prevent)
{
if (move.UseMove.MoveType.Name == "fire" || move.UseMove.HasFlag("defrost"))
{

View File

@@ -1,16 +1,16 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "paralyzed")]
public class Paralyzed : Script
public class Paralyzed : Script, IScriptChangeSpeed, IScriptPreventMove
{
/// <inheritdoc />
public override void ChangeSpeed(ITurnChoice choice, ref uint speed)
public void ChangeSpeed(ITurnChoice choice, ref uint speed)
{
speed = (uint)(speed * 0.5f);
}
/// <inheritdoc />
public override void PreventMove(IExecutingMove move, ref bool prevent)
public void PreventMove(IExecutingMove move, ref bool prevent)
{
if (move.Battle.Random.GetInt(0, 100) >= 25)
return;

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Status;
[Script(ScriptCategory.Status, "sleep")]
public class Sleep : Script
public class Sleep : Script, IScriptPreventMove
{
private IPokemon? _pokemon;
public int Turns { get; set; }
@@ -27,7 +27,7 @@ public class Sleep : Script
}
/// <inheritdoc />
public override void PreventMove(IExecutingMove move, ref bool prevent)
public void PreventMove(IExecutingMove move, ref bool prevent)
{
Turns--;
if (Turns <= 0)