@@ -213,14 +213,18 @@ public static bool CheckMeleeAOE(ref uint actionID, uint lastComboMove, byte lev
213213 return false ;
214214 }
215215
216- public static bool CheckAbilityAttacks ( ref uint actionID , byte level ) {
217- if ( ! CustomCombo . IsEnabled ( CustomComboPreset . RedMageContreFleche ) )
216+ public static bool CheckPrefulgenceThorns ( uint actionID , out uint replacementID , byte level , bool allowPrefulgence = true , bool allowThorns = true ) {
217+ replacementID = actionID ;
218+ return CheckPrefulgenceThorns ( ref replacementID , level , allowPrefulgence , allowThorns ) ;
219+ }
220+ public static bool CheckPrefulgenceThorns ( ref uint actionID , byte level , bool allowPrefulgence = true , bool allowThorns = true ) {
221+ if ( ! allowPrefulgence && ! allowThorns ) // nothing to do
218222 return false ;
219223
220- float prefulgenceTimeLeft = CustomCombo . IsEnabled ( CustomComboPreset . RedMageContreFlechePrefulgence ) && level >= Levels . Prefulgence
224+ float prefulgenceTimeLeft = allowPrefulgence && level >= Levels . Prefulgence
221225 ? CustomCombo . SelfEffectDuration ( Buffs . PrefulgenceReady )
222226 : 0f ;
223- float thornsTimeLeft = CustomCombo . IsEnabled ( CustomComboPreset . RedMageContreFlecheThorns ) && level >= Levels . ViceOfThorns
227+ float thornsTimeLeft = allowThorns && level >= Levels . ViceOfThorns
224228 ? CustomCombo . SelfEffectDuration ( Buffs . ThornedFlourish )
225229 : 0f ;
226230
@@ -240,6 +244,19 @@ public static bool CheckAbilityAttacks(ref uint actionID, byte level) {
240244 return true ;
241245 }
242246
247+ return false ;
248+ }
249+
250+ public static bool CheckAbilityAttacks ( ref uint actionID , byte level , CustomComboPreset checkPrefulgence , CustomComboPreset checkThorns ) {
251+ if ( ! CustomCombo . IsEnabled ( CustomComboPreset . RedMageContreFleche ) )
252+ return false ;
253+
254+ bool
255+ allowPrefulgence = CustomCombo . IsEnabled ( checkPrefulgence ) ,
256+ allowThorns = CustomCombo . IsEnabled ( checkThorns ) ;
257+ if ( CheckPrefulgenceThorns ( ref actionID , level , allowPrefulgence , allowThorns ) )
258+ return true ;
259+
243260 if ( level >= Levels . ContreSixte ) {
244261 actionID = CustomCombo . PickByCooldown ( actionID , Fleche , ContreSixte ) ;
245262 return true ;
@@ -309,7 +326,7 @@ internal class RedMageContreFlecheFeature: CustomCombo {
309326 public override uint [ ] ActionIDs { get ; } = [ RDM . Fleche , RDM . ContreSixte ] ;
310327
311328 protected override uint Invoke ( uint actionID , uint lastComboMove , float comboTime , byte level ) {
312- RDM . CheckAbilityAttacks ( ref actionID , level ) ;
329+ RDM . CheckAbilityAttacks ( ref actionID , level , CustomComboPreset . RedMageContreFlechePrefulgence , CustomComboPreset . RedMageContreFlecheThorns ) ;
313330
314331 return actionID ;
315332 }
@@ -342,7 +359,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
342359 // However, that's available on the ST smartcast option, which means it's still available while the AoE one here will show your GCD.
343360 // More importantly, I don't want to duplicate the whole block above the finishers, so deal with it.
344361 if ( ( IsEnabled ( CustomComboPreset . RedMageSmartcastAoEWeaveAttack ) && weaving ) || ( IsEnabled ( CustomComboPreset . RedMageSmartcastAoEMovement ) && ! fastCast && IsMoving ) ) {
345- if ( RDM . CheckAbilityAttacks ( ref actionID , level ) ) {
362+ if ( RDM . CheckAbilityAttacks ( ref actionID , level , CustomComboPreset . RedMageContreFlechePrefulgence , CustomComboPreset . RedMageContreFlecheThorns ) ) {
346363 return actionID ;
347364 }
348365 else if ( level >= RDM . Levels . ContreSixte ) {
@@ -422,19 +439,16 @@ private static uint noCastingSubCheck(byte level, bool engageCheck, bool holdOne
422439 if ( shouldEngage && engageEarly )
423440 return RDM . Engagement ;
424441
425- // TODO check the times on Prefulgence Ready and Thorned Flourish to prioritise one over the other if it's about to run out
426- if ( level >= RDM . Levels . Prefulgence && SelfHasEffect ( RDM . Buffs . PrefulgenceReady ) )
427- return RDM . Prefulgence ;
428-
429- if ( level >= RDM . Levels . ViceOfThorns && SelfHasEffect ( RDM . Buffs . ThornedFlourish ) )
430- return RDM . ViceOfThorns ;
442+ if ( RDM . CheckPrefulgenceThorns ( 0 , out uint replacement , level ) )
443+ return replacement ;
431444
432445 // Grand Impact is SPECIFICALLY excluded because it's a spell, not an ability, which makes it a GCD.
433446 // Therefore, since this helper can be used for moving OR for weaving, it should be handled by the caller instead.
434447
435448 if ( level >= RDM . Levels . Fleche ) {
436449 uint actionID = RDM . Fleche ;
437- RDM . CheckAbilityAttacks ( ref actionID , level ) ;
450+ // Prefulgence and Vice of Thorns are already checked above, so we don't want to duplicate the check here
451+ RDM . CheckAbilityAttacks ( ref actionID , level , CustomComboPreset . None , CustomComboPreset . None ) ;
438452 if ( IsOffCooldown ( actionID ) )
439453 return actionID ;
440454 }
@@ -472,8 +486,10 @@ const int
472486 int blackThreshold = white + imbalanceDiffMax ;
473487 int whiteThreshold = black + imbalanceDiffMax ;
474488
475- bool verfireUp = level >= RDM . Levels . Verfire && SelfHasEffect ( RDM . Buffs . VerfireReady ) ;
476- bool verstoneUp = level >= RDM . Levels . Verstone && SelfHasEffect ( RDM . Buffs . VerstoneReady ) ;
489+ bool verfireUp = level >= RDM . Levels . Verfire
490+ && SelfEffectDuration ( RDM . Buffs . VerfireReady ) >= 2.7 ; // if the buff goes away before you finish casting, you lose the cast and drift
491+ bool verstoneUp = level >= RDM . Levels . Verstone
492+ && SelfEffectDuration ( RDM . Buffs . VerstoneReady ) >= 2.7 ; // likewise
477493 bool isFinishingAny = RDM . CheckFinishers ( ref actionID , lastComboActionId , level ) ;
478494
479495 bool meleeCombo = IsEnabled ( CustomComboPreset . RedMageSmartcastSingleTargetMeleeCombo )
@@ -502,7 +518,9 @@ actionID is RDM.EnchantedZwerchhau or RDM.EnchantedRedoublement
502518 bool accelWeave = allowAccel && IsEnabled ( CustomComboPreset . RedMageSmartcastSingleTargetAccelerationWeave ) ;
503519 bool accelMove = allowAccel && IsEnabled ( CustomComboPreset . RedMageSmartcastSingleTargetAccelerationMoving ) ;
504520 bool accelNoNormal = IsEnabled ( CustomComboPreset . RedMageSmartcastSingleTargetAccelerationNoOverride ) ;
505- bool useGrandImpact = IsEnabled ( CustomComboPreset . RedMageSmartcastSingleTargetGrandImpact ) && level >= RDM . Levels . GrandImpact && SelfHasEffect ( RDM . Buffs . GrandImpactReady ) ;
521+ bool useGrandImpact = IsEnabled ( CustomComboPreset . RedMageSmartcastSingleTargetGrandImpact )
522+ && level >= RDM . Levels . GrandImpact
523+ && SelfHasEffect ( RDM . Buffs . GrandImpactReady ) ;
506524
507525 if ( Common . CheckLucidWeave ( CustomComboPreset . RedMageSmartcastSingleTargetWeaveLucid , level , Service . Configuration . RedMageSmartcastSingleWeaveLucidManaThreshold , actionID ) )
508526 return Common . LucidDreaming ;
@@ -600,7 +618,6 @@ actionID is RDM.EnchantedZwerchhau or RDM.EnchantedRedoublement
600618 // Stand fast, slow cast!
601619
602620 if ( verfireUp && verstoneUp ) {
603- // TODO should probably check at the VERY least that the effect for the chosen action has at least ~3 seconds left, or you won't finish the cast before it interrupts you and you'll drift
604621
605622 // Decide by mana levels
606623 if ( black < white || Math . Min ( 100 , white + procDelta ) == black )
0 commit comments