~ruther/NosSmooth

ref: 99aaa9b108e0e125d0c7795f4d35bcc3ba8e0b90 NosSmooth/Extensions/NosSmooth.Extensions.Combat/ICombatState.cs -rw-r--r-- 3.7 KiB
99aaa9b1 — Rutherther Merge pull request #71 from plsfixrito/PtctlPacket- 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//
//  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;

/// <summary>
/// The combat technique state used for queuing operations and storing information.
/// </summary>
public interface ICombatState
{
    /// <summary>
    /// Gets the combat manager.
    /// </summary>
    public CombatManager CombatManager { get; }

    /// <summary>
    /// Gets the game.
    /// </summary>
    public Game.Game Game { get; }

    /// <summary>
    /// Gets the NosTale client.
    /// </summary>
    public ManagedNostaleClient Client { get; }

    /// <summary>
    /// Gets whether there is an operation that cannot be used
    /// and we must wait for it to be usable.
    /// </summary>
    public bool IsWaitingOnOperation { get; }

    /// <summary>
    /// Get the operations the state is waiting for to to be usable.
    /// </summary>
    /// <returns>The operations needed to wait for.</returns>
    public IReadOnlyList<ICombatOperation> GetWaitingForOperations();

    /// <summary>
    /// Remove the current operation for the given queue.
    /// </summary>
    /// <param name="queueType">The queue type to get the current operation of.</param>
    /// <param name="emptyQueue">Whether to empty the rest of the queue.</param>
    /// <returns>The operation of the given queue, if any.</returns>
    public ICombatOperation? RemoveCurrentOperation(OperationQueueType queueType, bool emptyQueue = false);

    /// <summary>
    /// Gets the current operation of the given queue type.
    /// </summary>
    /// <param name="queueType">The queue type to get the current operation of.</param>
    /// <returns>The operation of the given queue, if any.</returns>
    public ICombatOperation? GetCurrentOperation(OperationQueueType queueType);

    /// <summary>
    /// Checks whether an operation is being executed in the given queue.
    /// </summary>
    /// <remarks>
    /// If not, either waiting for the operation or there is no operation enqueued.
    /// </remarks>
    /// <param name="queueType">The type of queue to look at.</param>
    /// <param name="operation">The operation currently being executed.</param>
    /// <returns>Whether an operation is being executed.</returns>
    public bool IsExecutingOperation(OperationQueueType queueType, [NotNullWhen(true)] out ICombatOperation? operation);

    /// <summary>
    /// Cancel the combat technique, quit the combat state.
    /// </summary>
    public void QuitCombat();

    /// <summary>
    /// Replace the current operation with this one.
    /// </summary>
    /// <param name="operation">The operation to use.</param>
    /// <param name="emptyQueue">Whether to empty the queue of the operations.</param>
    /// <param name="prependCurrentOperationToQueue">Whether to still use the current operation (true) after this one or discard it (false).</param>
    public void SetCurrentOperation
        (ICombatOperation operation, bool emptyQueue = false, bool prependCurrentOperationToQueue = false);

    /// <summary>
    /// Enqueue the operation at the end of the queue.
    /// </summary>
    /// <param name="operation">The operation to enqueue.</param>
    public void EnqueueOperation(ICombatOperation operation);

    /// <summary>
    /// Remove the operations by the given filter.
    /// </summary>
    /// <param name="filter">Called for each operation, should return true if it should be removed.</param>
    public void RemoveOperations(Func<ICombatOperation, bool> filter);
}
Do not follow this link