24 lines
700 B
C#
24 lines
700 B
C#
using PkmnLib.Plugin.Gen7.Scripts.Status;
|
|
|
|
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
|
|
|
|
[Script(ScriptCategory.Move, "rest")]
|
|
public class Rest : Script
|
|
{
|
|
/// <inheritdoc />
|
|
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
|
|
{
|
|
if (move.User.HasStatus(ScriptUtils.ResolveName<Sleep>()))
|
|
{
|
|
move.GetHitData(target, hit).Fail();
|
|
return;
|
|
}
|
|
if (!move.User.Heal(move.User.MaxHealth))
|
|
{
|
|
move.GetHitData(target, hit).Fail();
|
|
return;
|
|
}
|
|
move.User.SetStatus(ScriptUtils.ResolveName<Sleep>());
|
|
((Sleep)move.User.StatusScript.Script!).Turns = 2;
|
|
}
|
|
} |