Make Disable actually stop after a set number of turns

This commit is contained in:
Deukhoofd 2025-05-19 11:48:51 +02:00
parent 377c1a1c68
commit 015e5819f3
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F

View File

@ -5,6 +5,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "disable")] [Script(ScriptCategory.Pokemon, "disable")]
public class DisableEffect : Script public class DisableEffect : Script
{ {
private int _turnsLeft = 4;
private readonly StringKey _move; private readonly StringKey _move;
public DisableEffect(StringKey move) public DisableEffect(StringKey move)
@ -18,4 +19,14 @@ public class DisableEffect : Script
if (choice.ChosenMove.MoveData.Name == _move) if (choice.ChosenMove.MoveData.Name == _move)
prevent = true; prevent = true;
} }
/// <inheritdoc />
public override void OnEndTurn(IBattle battle)
{
_turnsLeft--;
if (_turnsLeft <= 0)
{
RemoveSelf();
}
}
} }