Deukhoofd 1feb27e826
All checks were successful
Build / Build (push) Successful in 50s
More work on refactor to interfaces
2025-06-29 12:03:51 +02:00

27 lines
744 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
/// <summary>
/// Attached script for <see cref="ProtectionEffectScript"/> to keep track of the consecutive turns of using Protect,
/// or protect-like moves.
/// </summary>
[Script(ScriptCategory.Pokemon, "protection_failure")]
public class ProtectionFailureScript : Script, IScriptOnBeforeTurnStart, IScriptOnEndTurn
{
public int ProtectTurns { get; set; }
public bool UsedProtect { get; set; }
/// <inheritdoc />
public void OnBeforeTurnStart(ITurnChoice choice)
{
UsedProtect = false;
}
/// <inheritdoc />
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (!UsedProtect)
{
RemoveSelf();
}
}
}