// // ICombatState.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.Diagnostics.CodeAnalysis; using NosSmooth.Core.Client; using NosSmooth.Extensions.Combat.Operations; using NosSmooth.Game.Data.Entities; namespace NosSmooth.Extensions.Combat; /// /// The combat technique state used for queuing operations and storing information. /// public interface ICombatState { /// /// Gets the combat manager. /// public CombatManager CombatManager { get; } /// /// Gets the game. /// public Game.Game Game { get; } /// /// Gets the NosTale client. /// public ManagedNostaleClient Client { get; } /// /// Gets whether there is an operation that cannot be used /// and we must wait for it to be usable. /// public bool IsWaitingOnOperation { get; } /// /// Get the operations the state is waiting for to to be usable. /// /// The operations needed to wait for. public IReadOnlyList GetWaitingForOperations(); /// /// Remove the current operation for the given queue. /// /// The queue type to get the current operation of. /// Whether to empty the rest of the queue. /// The operation of the given queue, if any. public ICombatOperation? RemoveCurrentOperation(OperationQueueType queueType, bool emptyQueue = false); /// /// Gets the current operation of the given queue type. /// /// The queue type to get the current operation of. /// The operation of the given queue, if any. public ICombatOperation? GetCurrentOperation(OperationQueueType queueType); /// /// Checks whether an operation is being executed in the given queue. /// /// /// If not, either waiting for the operation or there is no operation enqueued. /// /// The type of queue to look at. /// The operation currently being executed. /// Whether an operation is being executed. public bool IsExecutingOperation(OperationQueueType queueType, [NotNullWhen(true)] out ICombatOperation? operation); /// /// Cancel the combat technique, quit the combat state. /// public void QuitCombat(); /// /// Replace the current operation with this one. /// /// The operation to use. /// Whether to empty the queue of the operations. /// Whether to still use the current operation (true) after this one or discard it (false). public void SetCurrentOperation (ICombatOperation operation, bool emptyQueue = false, bool prependCurrentOperationToQueue = false); /// /// Enqueue the operation at the end of the queue. /// /// The operation to enqueue. public void EnqueueOperation(ICombatOperation operation); /// /// Remove the operations by the given filter. /// /// Called for each operation, should return true if it should be removed. public void RemoveOperations(Func filter); }