40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
|
|
|
|
[Script(ScriptCategory.Pokemon, "heal_block")]
|
|
public class HealBlockEffect : Script, IScriptPreventMoveSelection, IScriptPreventMove, IScriptOnEndTurn
|
|
{
|
|
private int _duration;
|
|
|
|
public HealBlockEffect(int duration = 5)
|
|
{
|
|
_duration = duration;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void OnEndTurn(IScriptSource owner, IBattle battle)
|
|
{
|
|
_duration--;
|
|
if (_duration <= 0)
|
|
RemoveSelf();
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void PreventMoveSelection(IMoveChoice choice, ref bool prevent)
|
|
{
|
|
if (choice.ChosenMove.MoveData.HasFlag("heal"))
|
|
prevent = true;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void PreventMove(IExecutingMove move, ref bool prevent)
|
|
{
|
|
if (move.ChosenMove.MoveData.HasFlag("heal"))
|
|
prevent = true;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void PreventHeal(IPokemon pokemon, uint heal, bool allowRevive, ref bool prevented)
|
|
{
|
|
prevented = true;
|
|
}
|
|
} |