@@ -21,13 +21,15 @@ public sealed class FleeGoal : GoapGoal, IRouteProvider
21
21
private readonly PlayerReader playerReader ;
22
22
private readonly Navigation navigation ;
23
23
private readonly AddonBits bits ;
24
+ private readonly CastingHandler castingHandler ;
24
25
25
26
private readonly SafeSpotCollector safeSpotCollector ;
26
27
27
28
private Vector3 [ ] MapPoints = [ ] ;
28
29
29
30
public FleeGoal ( ILogger < CombatGoal > logger , ConfigurableInput input ,
30
31
Wait wait , PlayerReader playerReader , AddonBits bits ,
32
+ CastingHandler castingHandler ,
31
33
ClassConfiguration classConfiguration , Navigation playerNavigation ,
32
34
ClassConfiguration classConfig ,
33
35
SafeSpotCollector safeSpotCollector )
@@ -40,6 +42,7 @@ public FleeGoal(ILogger<CombatGoal> logger, ConfigurableInput input,
40
42
this . playerReader = playerReader ;
41
43
this . navigation = playerNavigation ;
42
44
this . bits = bits ;
45
+ this . castingHandler = castingHandler ;
43
46
44
47
this . classConfig = classConfig ;
45
48
@@ -105,16 +108,37 @@ public override void OnExit()
105
108
106
109
navigation . Stop ( ) ;
107
110
navigation . StopMovement ( ) ;
108
- }
109
111
110
- public override void Update ( )
111
- {
112
112
if ( bits . Target ( ) )
113
113
{
114
114
input . PressClearTarget ( ) ;
115
115
}
116
+ }
116
117
118
+ public override void Update ( )
119
+ {
117
120
wait . Update ( ) ;
118
121
navigation . Update ( ) ;
122
+
123
+ // first element is skipped
124
+ // its part of the Goal Custom Condition
125
+ ReadOnlySpan < KeyAction > span = Keys ;
126
+ for ( int i = 1 ; i < span . Length ; i ++ )
127
+ {
128
+ KeyAction keyAction = span [ i ] ;
129
+
130
+ if ( castingHandler . SpellInQueue ( ) && ! keyAction . BaseAction )
131
+ {
132
+ continue ;
133
+ }
134
+
135
+ if ( castingHandler . CastIfReady ( keyAction ,
136
+ keyAction . Interrupts . Count > 0
137
+ ? keyAction . CanBeInterrupted
138
+ : bits . Combat ) )
139
+ {
140
+ break ;
141
+ }
142
+ }
119
143
}
120
144
}
0 commit comments