// // ICombatTechnique.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.Extensions.Combat.Operations; using Remora.Results; namespace NosSmooth.Extensions.Combat.Techniques; /// /// A combat technique that allows to handle the whole combat situations using step callbacks. /// /// /// The callback methods decide the next steps, used in . /// public interface ICombatTechnique { /// /// Gets the types this technique may handle. /// /// /// will be called only for queue types /// from this collection. /// public IReadOnlyList HandlingQueueTypes { get; } /// /// Should check whether the technique should process more steps or quit the combat. /// /// The combat state. /// Whether to continue with steps. public bool ShouldContinue(ICombatState state); /// /// Handle one step that should enqueue an operation. /// Enqueue only operation of the given queue type. /// /// /// If error is returned, the combat will be cancelled. /// /// The type of the operation to enqueue. /// The combat state. /// An id of the current target entity or an error. public Result HandleNextCombatStep(OperationQueueType queueType, ICombatState state); /// /// Handle waiting for an operation. /// /// The type of the operation. /// The combat state. /// The operation that needs waiting. /// The error received from the operation. /// A result that may or may not have succeeded. In case of an error, will be called with the error. public Result HandleWaiting(OperationQueueType queueType, ICombatState state, ICombatOperation operation, CannotBeUsedError error); /// /// Handles an arbitrary error. /// /// /// If an error is returned, the combat will be cancelled. /// /// The combat state. /// The errorful result. /// A result that may or may not succeed. public Result HandleError(ICombatState state, Result result); }