Skip to content

Commit d581075

Browse files
committed
completely redesign combo data caching system and format codebase
1 parent 23260c6 commit d581075

File tree

17 files changed

+401
-500
lines changed

17 files changed

+401
-500
lines changed

XIVComboVX/Combos/BLM.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ internal class BlackFireToIce3: CustomCombo {
304304
protected override uint Invoke(uint actionID, uint lastComboActionId, float comboTime, byte level) {
305305
BLMGauge gauge = GetJobGauge<BLMGauge>();
306306
307-
if (gauge.InAstralFire && LocalPlayer.CurrentMp >= 1600 && level >= BLM.Blizzard3)
307+
if (gauge.InAstralFire && LocalPlayer.CurrentMp >= 1600 && level >= BLM.Blizzard3)
308308
return BLM.Blizzard;
309-
309+
310310
return BLM.Blizzard3;
311-
311+
312312
}
313313
}
314314

XIVComboVX/Combos/Common.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,6 @@ public const uint
3333
LucidDreaming = 14,
3434
Swiftcast = 18;
3535
}
36-
37-
internal static bool CheckLucidWeave(CustomComboPreset preset, byte level, uint manaThreshold, uint baseAction) {
38-
39-
if (CustomCombo.IsEnabled(preset)) {
40-
if (level >= Levels.LucidDreaming) {
41-
if (CustomCombo.LocalPlayer.CurrentMp < manaThreshold) {
42-
if (CustomCombo.CanWeave(baseAction)) {
43-
if (CustomCombo.CanUse(LucidDreaming))
44-
return true;
45-
}
46-
}
47-
}
48-
}
49-
50-
return false;
51-
}
5236
}
5337

5438
internal abstract class SwiftRaiseCombo: CustomCombo {

XIVComboVX/Combos/DNC.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ internal class DancerDanceStepCombo: CustomCombo {
147147
public override uint[] ActionIDs { get; } = [DNC.StandardStep, DNC.TechnicalStep];
148148

149149
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
150-
if (level >= DNC.Levels.StandardStep && Service.DataCache.DancerSmartDancing(out uint danceStep))
150+
if (level >= DNC.Levels.StandardStep && DancerSmartDancing(out uint danceStep))
151151
return danceStep;
152152

153153
if (level >= DNC.Levels.TechnicalStep) {
@@ -189,7 +189,7 @@ internal class DancerSingleTargetMultibutton: CustomCombo {
189189

190190
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
191191
if (IsEnabled(CustomComboPreset.DancerSmartDanceFeature)) {
192-
if (level >= DNC.Levels.StandardStep && Service.DataCache.DancerSmartDancing(out uint danceStep))
192+
if (level >= DNC.Levels.StandardStep && DancerSmartDancing(out uint danceStep))
193193
return danceStep;
194194
}
195195

@@ -265,7 +265,7 @@ internal class DancerAoeMultibutton: CustomCombo {
265265

266266
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
267267
if (IsEnabled(CustomComboPreset.DancerSmartDanceFeature)) {
268-
if (level >= DNC.Levels.StandardStep && Service.DataCache.DancerSmartDancing(out uint danceStep))
268+
if (level >= DNC.Levels.StandardStep && DancerSmartDancing(out uint danceStep))
269269
return danceStep;
270270
}
271271

XIVComboVX/Combos/PCT.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Dalamud.Game.ClientState.JobGauge.Types;
22

33
namespace VariableVixen.XIVComboVX.Combos;
4+
45
internal class PCT {
56
public const byte JobID = 42;
67

XIVComboVX/Combos/RDM.cs

Lines changed: 15 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -101,176 +101,6 @@ public const byte
101101
GrandImpact = 96,
102102
Prefulgence = 100;
103103
}
104-
105-
#pragma warning disable IDE0045 // Convert to conditional expression - helper function readability
106-
public static byte ManaForMeleeChain(byte level) {
107-
byte mana = ManaCostMelee1;
108-
if (level >= Levels.Zwerchhau) {
109-
mana += ManaCostMelee2;
110-
if (level >= Levels.Redoublement)
111-
mana += ManaCostMelee3;
112-
}
113-
return mana;
114-
}
115-
116-
public static bool CheckFinishers(ref uint actionID, uint lastComboMove, byte level) {
117-
const int
118-
finisherDelta = 11,
119-
imbalanceDiffMax = 30;
120-
121-
if (lastComboMove is Verflare or Verholy && level >= Levels.Scorch) {
122-
actionID = Scorch;
123-
return true;
124-
}
125-
126-
if (lastComboMove is Scorch && level >= Levels.Resolution) {
127-
actionID = Resolution;
128-
return true;
129-
}
130-
131-
RDMGauge gauge = CustomCombo.GetJobGauge<RDMGauge>();
132-
133-
if (gauge.ManaStacks == 3 && level >= Levels.Verflare) {
134-
int black = gauge.BlackMana;
135-
int white = gauge.WhiteMana;
136-
bool canFinishWhite = level >= Levels.Verholy;
137-
int blackThreshold = white + imbalanceDiffMax;
138-
int whiteThreshold = black + imbalanceDiffMax;
139-
bool verfireUp = level >= Levels.Verfire && CustomCombo.SelfHasEffect(Buffs.VerfireReady);
140-
bool verstoneUp = level >= Levels.Verstone && CustomCombo.SelfHasEffect(Buffs.VerstoneReady);
141-
142-
if (black >= white && canFinishWhite) {
143-
// If we can already Verstone, but we can't Verfire, and Verflare WON'T imbalance us, use Verflare
144-
if (verstoneUp && !verfireUp && black + finisherDelta <= blackThreshold)
145-
actionID = Verflare;
146-
else
147-
actionID = Verholy;
148-
}
149-
// If we can already Verfire, but we can't Verstone, and we can use Verholy, and it WON'T imbalance us, use Verholy
150-
else if (verfireUp && !verstoneUp && canFinishWhite && white + finisherDelta <= whiteThreshold) {
151-
actionID = Verholy;
152-
}
153-
else {
154-
actionID = Verflare;
155-
}
156-
157-
return true;
158-
}
159-
160-
return false;
161-
}
162-
163-
public static bool CheckMeleeST(ref uint actionID, uint lastComboMove, byte level, bool checkComboStart) {
164-
RDMGauge gauge = CustomCombo.GetJobGauge<RDMGauge>();
165-
byte black = gauge.BlackMana;
166-
byte white = gauge.WhiteMana;
167-
byte mana = black != white || black == 100
168-
? Math.Min(black, white)
169-
: (byte)0;
170-
bool buff = level >= Levels.Manafication && CustomCombo.SelfHasEffect(Buffs.MagickedSwordplay);
171-
172-
if (lastComboMove is Zwerchhau or EnchantedZwerchhau && level >= Levels.Redoublement && (buff || mana >= ManaCostMelee3)) {
173-
actionID = EnchantedRedoublement;
174-
return true;
175-
}
176-
177-
if (lastComboMove is Riposte or EnchantedRiposte && level >= Levels.Zwerchhau && (buff || mana >= ManaCostMelee2)) {
178-
actionID = EnchantedZwerchhau;
179-
return true;
180-
}
181-
182-
if (checkComboStart && (buff || mana >= ManaForMeleeChain(level))) {
183-
actionID = EnchantedRiposte;
184-
return true;
185-
}
186-
187-
return false;
188-
}
189-
190-
public static bool CheckMeleeAOE(ref uint actionID, uint lastComboMove, byte level, bool checkComboStart) {
191-
if (level < Levels.EnchantedMoulinets)
192-
return false;
193-
194-
RDMGauge gauge = CustomCombo.GetJobGauge<RDMGauge>();
195-
byte mana = Math.Min(gauge.BlackMana, gauge.WhiteMana);
196-
bool buff = level >= Levels.Manafication && CustomCombo.SelfHasEffect(Buffs.MagickedSwordplay);
197-
198-
if (lastComboMove is EnchantedMoulinetDeux && (buff || mana >= ManaCostMelee3)) {
199-
actionID = EnchantedMoulinetTrois;
200-
return true;
201-
}
202-
203-
if (lastComboMove is Moulinet or EnchantedMoulinet && (buff || mana >= ManaCostMelee2)) {
204-
actionID = EnchantedMoulinetDeux;
205-
return true;
206-
}
207-
208-
if (checkComboStart && (buff || mana >= ManaCostMelee1)) {
209-
actionID = EnchantedMoulinet;
210-
return true;
211-
}
212-
213-
return false;
214-
}
215-
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
222-
return false;
223-
224-
float prefulgenceTimeLeft = allowPrefulgence && level >= Levels.Prefulgence
225-
? CustomCombo.SelfEffectDuration(Buffs.PrefulgenceReady)
226-
: 0f;
227-
float thornsTimeLeft = allowThorns && level >= Levels.ViceOfThorns
228-
? CustomCombo.SelfEffectDuration(Buffs.ThornedFlourish)
229-
: 0f;
230-
231-
if (prefulgenceTimeLeft > 0) {
232-
233-
// If we're almost out of time to use VoT but Prefulgence has enough time left to use VoT and also itself, use VoT first to save it from being lost
234-
if (thornsTimeLeft is > 0 and < 3 && prefulgenceTimeLeft >= 3)
235-
actionID = ViceOfThorns;
236-
else
237-
actionID = Prefulgence;
238-
239-
return true;
240-
}
241-
242-
if (thornsTimeLeft > 0) {
243-
actionID = ViceOfThorns;
244-
return true;
245-
}
246-
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-
260-
if (level >= Levels.ContreSixte) {
261-
actionID = CustomCombo.PickByCooldown(actionID, Fleche, ContreSixte);
262-
return true;
263-
}
264-
265-
if (level >= Levels.Fleche) {
266-
actionID = Fleche;
267-
return true;
268-
}
269-
270-
return false;
271-
}
272-
273-
#pragma warning restore IDE0045 // Convert to conditional expression
274104
}
275105

276106
internal class RedMageSwiftcastRaiserFeature: SwiftRaiseCombo {
@@ -283,7 +113,7 @@ internal class RedMageAoECombo: CustomCombo {
283113

284114
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
285115

286-
if (RDM.CheckFinishers(ref actionID, lastComboMove, level))
116+
if (RedmageCheckFinishers(ref actionID, lastComboMove, level))
287117
return actionID;
288118

289119
if (level >= RDM.Levels.Scatter && (IsFastcasting || SelfHasEffect(RDM.Buffs.Acceleration) || SelfHasEffect(RDM.Buffs.GrandImpactReady)))
@@ -300,7 +130,7 @@ internal class RedMageMeleeCombo: CustomCombo {
300130
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
301131

302132
if (IsEnabled(CustomComboPreset.RedMageMeleeComboPlus)) {
303-
if (RDM.CheckFinishers(ref actionID, lastComboMove, level))
133+
if (RedmageCheckFinishers(ref actionID, lastComboMove, level))
304134
return actionID;
305135
}
306136

@@ -311,10 +141,10 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
311141
return RDM.Corpsacorps;
312142
}
313143

314-
RDM.CheckMeleeST(ref actionID, lastComboMove, level, true); // actionID will be untouched (Riposte), Enchanted Riposte, Enchanted Zwerchhau, or Enchanted Redoublement
144+
RedmageCheckMeleeST(ref actionID, lastComboMove, level, true); // actionID will be untouched (Riposte), Enchanted Riposte, Enchanted Zwerchhau, or Enchanted Redoublement
315145
}
316146
else {
317-
RDM.CheckMeleeAOE(ref actionID, lastComboMove, level, true); // actionID will be untouched (Moulinet), Enchanted Moulinet, Enchanted Moulinet Deux, or Enchanted Moulinet Trois
147+
RedmageCheckMeleeAOE(ref actionID, lastComboMove, level, true); // actionID will be untouched (Moulinet), Enchanted Moulinet, Enchanted Moulinet Deux, or Enchanted Moulinet Trois
318148
}
319149

320150
return OriginalHook(actionID);
@@ -326,7 +156,7 @@ internal class RedMageContreFlecheFeature: CustomCombo {
326156
public override uint[] ActionIDs { get; } = [RDM.Fleche, RDM.ContreSixte];
327157

328158
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
329-
RDM.CheckAbilityAttacks(ref actionID, level, CustomComboPreset.RedMageContreFlechePrefulgence, CustomComboPreset.RedMageContreFlecheThorns);
159+
RedmageCheckAbilityAttacks(ref actionID, level, CustomComboPreset.RedMageContreFlechePrefulgence, CustomComboPreset.RedMageContreFlecheThorns);
330160

331161
return actionID;
332162
}
@@ -344,11 +174,11 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
344174
int white = gauge.WhiteMana;
345175
bool weaving = CanWeave(actionID);
346176

347-
if (Common.CheckLucidWeave(CustomComboPreset.RedMageSmartcastAoEWeaveLucid, level, Service.Configuration.RedMageSmartcastAoEWeaveLucidManaThreshold, actionID))
177+
if (CheckLucidWeave(CustomComboPreset.RedMageSmartcastAoEWeaveLucid, level, Service.Configuration.RedMageSmartcastAoEWeaveLucidManaThreshold, actionID))
348178
return Common.LucidDreaming;
349179

350180
// There is never a reason to NOT use the finishers when you have them.
351-
if (RDM.CheckFinishers(ref actionID, lastComboMove, level))
181+
if (RedmageCheckFinishers(ref actionID, lastComboMove, level))
352182
return actionID;
353183

354184
bool fastCast = IsFastcasting
@@ -359,7 +189,7 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
359189
// However, that's available on the ST smartcast option, which means it's still available while the AoE one here will show your GCD.
360190
// More importantly, I don't want to duplicate the whole block above the finishers, so deal with it.
361191
if ((IsEnabled(CustomComboPreset.RedMageSmartcastAoEWeaveAttack) && weaving) || (IsEnabled(CustomComboPreset.RedMageSmartcastAoEMovement) && !fastCast && IsMoving)) {
362-
if (RDM.CheckAbilityAttacks(ref actionID, level, CustomComboPreset.RedMageContreFlechePrefulgence, CustomComboPreset.RedMageContreFlecheThorns)) {
192+
if (RedmageCheckAbilityAttacks(ref actionID, level, CustomComboPreset.RedMageContreFlechePrefulgence, CustomComboPreset.RedMageContreFlecheThorns)) {
363193
return actionID;
364194
}
365195
else if (level >= RDM.Levels.ContreSixte) {
@@ -439,7 +269,7 @@ private static uint noCastingSubCheck(byte level, bool engageCheck, bool holdOne
439269
if (shouldEngage && engageEarly)
440270
return RDM.Engagement;
441271

442-
if (RDM.CheckPrefulgenceThorns(0, out uint replacement, level))
272+
if (RedmageCheckPrefulgenceThorns(0, out uint replacement, level))
443273
return replacement;
444274

445275
// Grand Impact is SPECIFICALLY excluded because it's a spell, not an ability, which makes it a GCD.
@@ -448,7 +278,7 @@ private static uint noCastingSubCheck(byte level, bool engageCheck, bool holdOne
448278
if (level >= RDM.Levels.Fleche) {
449279
uint actionID = RDM.Fleche;
450280
// 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);
281+
RedmageCheckAbilityAttacks(ref actionID, level, CustomComboPreset.None, CustomComboPreset.None);
452282
if (IsOffCooldown(actionID))
453283
return actionID;
454284
}
@@ -490,11 +320,11 @@ const int
490320
&& SelfEffectDuration(RDM.Buffs.VerfireReady) >= 2.7; // if the buff goes away before you finish casting, you lose the cast and drift
491321
bool verstoneUp = level >= RDM.Levels.Verstone
492322
&& SelfEffectDuration(RDM.Buffs.VerstoneReady) >= 2.7; // likewise
493-
bool isFinishingAny = RDM.CheckFinishers(ref actionID, lastComboActionId, level);
323+
bool isFinishingAny = RedmageCheckFinishers(ref actionID, lastComboActionId, level);
494324

495325
bool meleeCombo = IsEnabled(CustomComboPreset.RedMageSmartcastSingleTargetMeleeCombo)
496326
&& !isFinishingAny && targeting
497-
&& RDM.CheckMeleeST(ref actionID, lastComboActionId, level, IsEnabled(CustomComboPreset.RedMageSmartcastSingleTargetMeleeComboStarter));
327+
&& RedmageCheckMeleeST(ref actionID, lastComboActionId, level, IsEnabled(CustomComboPreset.RedMageSmartcastSingleTargetMeleeComboStarter));
498328
bool shouldCloseGap = meleeCombo && !isClose
499329
&& (
500330
actionID is RDM.EnchantedZwerchhau or RDM.EnchantedRedoublement
@@ -522,7 +352,7 @@ actionID is RDM.EnchantedZwerchhau or RDM.EnchantedRedoublement
522352
&& level >= RDM.Levels.GrandImpact
523353
&& SelfHasEffect(RDM.Buffs.GrandImpactReady);
524354

525-
if (Common.CheckLucidWeave(CustomComboPreset.RedMageSmartcastSingleTargetWeaveLucid, level, Service.Configuration.RedMageSmartcastSingleWeaveLucidManaThreshold, actionID))
355+
if (CheckLucidWeave(CustomComboPreset.RedMageSmartcastSingleTargetWeaveLucid, level, Service.Configuration.RedMageSmartcastSingleWeaveLucidManaThreshold, actionID))
526356
return Common.LucidDreaming;
527357

528358
if (smartWeave) {
@@ -689,7 +519,7 @@ protected override uint Invoke(uint actionID, uint lastComboActionId, float comb
689519
RDMGauge gauge = GetJobGauge<RDMGauge>();
690520
byte black = gauge.BlackMana;
691521
byte white = gauge.WhiteMana;
692-
byte threshold = RDM.ManaForMeleeChain(level);
522+
byte threshold = RedmageManaForMeleeChain(level);
693523
if (black >= threshold && white >= threshold && (black != white || black == 100))
694524
melee = true;
695525
}
@@ -707,7 +537,7 @@ protected override uint Invoke(uint actionID, uint lastComboActionId, float comb
707537
}
708538

709539
if (IsEnabled(CustomComboPreset.RedMageManaficationIntoMeleeFinisherFollowup))
710-
RDM.CheckFinishers(ref actionID, lastComboActionId, level);
540+
RedmageCheckFinishers(ref actionID, lastComboActionId, level);
711541

712542
return actionID;
713543
}

XIVComboVX/Combos/SAM.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,4 +299,3 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
299299
return actionID;
300300
}
301301
}
302-

0 commit comments

Comments
 (0)