// // ICombatOperation.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 NosSmooth.Core.Contracts; using NosSmooth.Extensions.Combat.Techniques; using Remora.Results; namespace NosSmooth.Extensions.Combat.Operations; /// /// A combat operation used in that can be used as one step. /// public interface ICombatOperation : IDisposable { /// /// Gets the queue type the operation belongs to. /// /// /// Used for distinguishing what operations may run simultaneously. /// For example items may be used simultaneous to attacking. Attacking /// may not be simultaneous to walking. /// public OperationQueueType QueueType { get; } /// /// Gets whether the operation may currently be cancelled (disposed). /// public bool MayBeCancelled { get; } /// /// Begin the execution without waiting for the finished state. /// /// The combat state. /// The cancellation token used for cancelling the operation. /// A result that may or may not have succeeded. public Task BeginExecution(ICombatState combatState, CancellationToken ct = default); /// /// Asynchronously wait for finished state. /// /// The combat state. /// The cancellation token used for cancelling the operation. /// A representing the asynchronous operation. public Task WaitForFinishedAsync(ICombatState combatState, CancellationToken ct = default); /// /// Checks whether the operation is currently being executed. /// /// Whether the operation is being executed. public bool IsExecuting(); /// /// Checks whether the operation is done. /// /// Whether the operation is finished. public bool IsFinished(); /// /// Checks whether the operation can currently be used. /// /// /// Ie. if the operation is to use a skill, it will return true only if the skill is not on a cooldown, /// the character has enough mana and is not stunned. /// /// The combat state. /// Whether the operation can be used right away. public Result CanBeUsed(ICombatState combatState); /// /// Cancel the current operation. /// public void Cancel(); }