namespace PkmnLib.Plugin.Gen7.Scripts.Moves;

[Script(ScriptCategory.Move, "return")]
public class Return : Script, IScriptChangeBasePower
{
    /// <inheritdoc />
    public void ChangeBasePower(IExecutingMove move, IPokemon target, byte hit, ref ushort basePower)
    {
        var friendship = move.User.Happiness;
        var power = friendship * 2 / 5;
        // The power is capped at 102, but as friendship is a byte, and thus max 255, this is already heuristically
        // capped (255 * 2 / 5 = 102).
        if (power < 1)
            power = 1;
        basePower = (byte)power;
    }
}