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

26 lines
635 B
C#

using PkmnLib.Plugin.Gen7.Scripts.Status;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "nightmare")]
public class NightmareEffect : Script, IScriptOnEndTurn
{
private readonly IPokemon _owner;
public NightmareEffect(IPokemon owner)
{
_owner = owner;
}
/// <inheritdoc />
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
if (!_owner.HasStatus(ScriptUtils.ResolveName<Sleep>()))
{
RemoveSelf();
return;
}
var maxHp = _owner.MaxHealth;
_owner.Damage(maxHp / 4, DamageSource.Misc);
}
}