~ruther/NosSmooth

cb9f2774a9ec260248a49e02d5b0c32388e900b3 — Rutherther 3 years ago 9dc5919
feat(core): add attack command
1 files changed, 34 insertions(+), 0 deletions(-)

A Core/NosSmooth.Core/Commands/Attack/AttackCommand.cs
A Core/NosSmooth.Core/Commands/Attack/AttackCommand.cs => Core/NosSmooth.Core/Commands/Attack/AttackCommand.cs +34 -0
@@ 0,0 1,34 @@
//
//  AttackCommand.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Threading;
using System.Threading.Tasks;
using NosSmooth.Core.Commands.Control;
using Remora.Results;

namespace NosSmooth.Core.Commands.Attack;

/// <summary>
/// A take control command used to take control of attacking at a given target.
/// </summary>
/// <param name="TargetId">The id of the target the bot will be attacking.</param>
/// <param name="HandleAttackCallback">The callback to be called when the control has been gained.</param>
/// <param name="CanBeCancelledByAnother">Whether the command may be cancelled by another task within the same group.</param>
/// <param name="WaitForCancellation">Whether to wait for finish of the previous task</param>
/// <param name="AllowUserCancel">Whether to allow the user to cancel by taking any walk/focus/unfollow action</param>
public record AttackCommand
(
    long? TargetId,
    Func<CancellationToken, Task<Result>> HandleAttackCallback,
    bool CanBeCancelledByAnother = true,
    bool WaitForCancellation = true,
    bool AllowUserCancel = true
) : ITakeControlCommand
{
    /// <inheritdoc />
    public bool CancelOnMapChange => true;
}
\ No newline at end of file

Do not follow this link