forked from MKhayle/XIVComboExpanded
-
Notifications
You must be signed in to change notification settings - Fork 8
/
RDM.cs
421 lines (319 loc) · 12.6 KB
/
RDM.cs
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.ClientState.JobGauge.Types;
namespace XIVComboVX.Combos {
internal static class RDM {
public const byte JobID = 35;
public const uint
Verraise = 7523,
Jolt = 7503,
Jolt2 = 7524,
Verthunder = 7505,
Verthunder2 = 16524,
Verfire = 7510,
Verflare = 7525,
Veraero = 7507,
Veraero2 = 16525,
Verstone = 7511,
Verholy = 7526,
Impact = 16526,
Scatter = 7509,
Redoublement = 7516,
EnchantedRedoublement = 7529,
Zwerchhau = 7512,
EnchantedZwerchhau = 7528,
Riposte = 7504,
EnchantedRiposte = 7527,
Moulinet = 7513,
EnchantedMoulinet = 7530,
Fleche = 7517,
ContreSixte = 7519,
Scorch = 16530,
Resolution = 25858;
public static class Buffs {
public const ushort
VerfireReady = 1234,
VerstoneReady = 1235,
Acceleration = 1238,
Dualcast = 1249,
LostChainspell = 2560;
}
public static class Debuffs {
// public const ushort placeholder = 0;
}
public static class Levels {
public const byte
Jolt = 2,
Verthunder = 4,
Veraero = 10,
Scatter = 15,
Verthunder2 = 18,
Veraero2 = 22,
Zwerchhau = 35,
Fleche = 45,
Redoublement = 50,
Vercure = 54,
ContreSixte = 56,
Jolt2 = 62,
Verraise = 64,
Impact = 66,
Verflare = 68,
Verholy = 70,
Scorch = 80,
Resolution = 90;
}
}
internal class RedMageSwiftcastRaiserFeature: CustomCombo {
protected internal override CustomComboPreset Preset => CustomComboPreset.RedMageSwiftcastRaiserFeature;
protected internal override uint[] ActionIDs { get; } = new[] { RDM.Verraise };
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
if (actionID is RDM.Verraise && CommonUtil.shouldSwiftcast)
return CommonSkills.Swiftcast;
return actionID;
}
}
internal class RedMageAoECombo: CustomCombo {
protected internal override CustomComboPreset Preset => CustomComboPreset.RedMageAoECombo;
protected internal override uint[] ActionIDs { get; } = new[] { RDM.Veraero2, RDM.Verthunder2 };
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
if (actionID is RDM.Veraero2 or RDM.Verthunder2) {
if (lastComboMove is RDM.Scorch && level >= RDM.Levels.Resolution)
return RDM.Resolution;
if (lastComboMove is RDM.Verflare or RDM.Verholy && level >= RDM.Levels.Scorch)
return RDM.Scorch;
if (level >= RDM.Levels.Scatter && CommonUtil.isFastcasting)
return OriginalHook(RDM.Scatter);
}
return actionID;
}
}
internal class RedMageMeleeCombo: CustomCombo {
protected internal override CustomComboPreset Preset => CustomComboPreset.RedMageMeleeCombo;
protected internal override uint[] ActionIDs { get; } = new[] { RDM.Redoublement, RDM.Moulinet };
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
const int
FINISHER_DELTA = 11,
IMBALANCE_DIFF_MAX = 30;
if (actionID is RDM.Redoublement or RDM.Moulinet) {
RDMGauge gauge = GetJobGauge<RDMGauge>();
int black = gauge.BlackMana;
int white = gauge.WhiteMana;
bool isFinishing1 = gauge.ManaStacks == 3;
bool isFinishing2 = comboTime > 0 && lastComboMove is RDM.Verholy or RDM.Verflare;
bool isFinishing3 = comboTime > 0 && lastComboMove is RDM.Scorch;
bool canFinishWhite = level >= RDM.Levels.Verholy;
bool canFinishBlack = level >= RDM.Levels.Verflare;
int blackThreshold = white + IMBALANCE_DIFF_MAX;
int whiteThreshold = black + IMBALANCE_DIFF_MAX;
bool verfireUp = SelfHasEffect(RDM.Buffs.VerfireReady);
bool verstoneUp = SelfHasEffect(RDM.Buffs.VerstoneReady);
if (IsEnabled(CustomComboPreset.RedMageMeleeComboPlus)) {
if (isFinishing3 && level >= RDM.Levels.Resolution)
return RDM.Resolution;
if (isFinishing2 && level >= RDM.Levels.Scorch)
return RDM.Scorch;
if (isFinishing1 && canFinishBlack) {
if (black >= white && canFinishWhite) {
if (verstoneUp && !verfireUp && (black + FINISHER_DELTA <= blackThreshold))
return RDM.Verflare;
return RDM.Verholy;
}
if (verfireUp && !verstoneUp && canFinishWhite && (white + FINISHER_DELTA <= whiteThreshold))
return RDM.Verholy;
return RDM.Verflare;
}
}
if (actionID is RDM.Redoublement) {
if (lastComboMove is RDM.Zwerchhau or RDM.EnchantedZwerchhau && level >= RDM.Levels.Redoublement)
return OriginalHook(RDM.Redoublement);
if (lastComboMove is RDM.Riposte or RDM.EnchantedRiposte && level >= RDM.Levels.Zwerchhau)
return OriginalHook(RDM.Zwerchhau);
return OriginalHook(RDM.Riposte);
}
}
return actionID;
}
}
internal class RedMageVerprocCombo: CustomCombo {
protected internal override CustomComboPreset Preset => CustomComboPreset.RedMageVerprocCombo;
protected internal override uint[] ActionIDs { get; } = new[] { RDM.Verstone, RDM.Verfire };
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
if (actionID is RDM.Verstone or RDM.Verfire) {
if (lastComboMove == RDM.Scorch && level >= RDM.Levels.Resolution)
return RDM.Resolution;
if (lastComboMove is RDM.Verflare or RDM.Verholy && level >= RDM.Levels.Scorch)
return RDM.Scorch;
RDMGauge gauge = GetJobGauge<RDMGauge>();
if (actionID is RDM.Verstone) {
if (gauge.ManaStacks == 3 && level >= RDM.Levels.Verholy)
return RDM.Verholy;
if (IsEnabled(CustomComboPreset.RedMageVerprocComboPlus)
&& level >= RDM.Levels.Veraero
&& (CommonUtil.isFastcasting || SelfHasEffect(RDM.Buffs.Acceleration))
)
return RDM.Veraero;
if (IsEnabled(CustomComboPreset.RedMageVeraeroOpenerFeature)
&& level >= RDM.Levels.Veraero
&& !HasCondition(ConditionFlag.InCombat)
&& !SelfHasEffect(RDM.Buffs.VerstoneReady)
)
return RDM.Veraero;
if (SelfHasEffect(RDM.Buffs.VerstoneReady))
return RDM.Verstone;
}
else if (actionID is RDM.Verfire) {
if (gauge.ManaStacks == 3 && level >= RDM.Levels.Verflare)
return RDM.Verflare;
if (IsEnabled(CustomComboPreset.RedMageVerprocComboPlus)
&& level >= RDM.Levels.Verthunder
&& (CommonUtil.isFastcasting || SelfHasEffect(RDM.Buffs.Acceleration))
)
return RDM.Verthunder;
if (IsEnabled(CustomComboPreset.RedMageVerthunderOpenerFeature)
&& level >= RDM.Levels.Verthunder
&& !HasCondition(ConditionFlag.InCombat)
&& !SelfHasEffect(RDM.Buffs.VerfireReady)
)
return RDM.Verthunder;
if (SelfHasEffect(RDM.Buffs.VerfireReady))
return RDM.Verfire;
}
return OriginalHook(RDM.Jolt2);
}
return actionID;
}
}
internal class RedMageContreFlecheFeature: CustomCombo {
protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.RedMageContreFlecheFeature;
protected internal override uint[] ActionIDs { get; } = new[] { RDM.Fleche, RDM.ContreSixte };
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
if (actionID is RDM.Fleche or RDM.ContreSixte) {
if (level >= RDM.Levels.ContreSixte)
return PickByCooldown(actionID, RDM.Fleche, RDM.ContreSixte);
if (level >= RDM.Levels.Fleche)
return RDM.Fleche;
}
return actionID;
}
}
internal class RedMageSmartcastAoECombo: CustomCombo {
protected internal override CustomComboPreset Preset => CustomComboPreset.RedMageSmartcastAoEFeature;
protected internal override uint[] ActionIDs { get; } = new[] { RDM.Veraero2, RDM.Verthunder2 };
protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level) {
if (actionID is RDM.Veraero2 or RDM.Verthunder2) {
if (CommonUtil.isFastcasting || SelfHasEffect(RDM.Buffs.Acceleration) || level < RDM.Levels.Verthunder2)
return OriginalHook(RDM.Impact);
if (level < RDM.Levels.Veraero2)
return RDM.Verthunder2;
RDMGauge gauge = GetJobGauge<RDMGauge>();
if (gauge.BlackMana > gauge.WhiteMana)
return RDM.Veraero2;
if (gauge.WhiteMana > gauge.BlackMana)
return RDM.Verthunder2;
}
return actionID;
}
}
internal class RedmageSmartcastSingleCombo: CustomCombo {
protected internal override CustomComboPreset Preset => CustomComboPreset.RedMageSmartcastSingleFeature;
protected internal override uint[] ActionIDs { get; } = new[] { RDM.Veraero, RDM.Verthunder, RDM.Verstone, RDM.Verfire };
protected override uint Invoke(uint actionID, uint lastComboActionId, float comboTime, byte level) {
const int
LONG_DELTA = 6,
PROC_DELTA = 5,
FINISHER_DELTA = 11,
IMBALANCE_DIFF_MAX = 30;
if (actionID is RDM.Veraero or RDM.Verthunder or RDM.Verstone or RDM.Verfire) {
bool verfireUp = SelfHasEffect(RDM.Buffs.VerfireReady);
bool verstoneUp = SelfHasEffect(RDM.Buffs.VerstoneReady);
RDMGauge gauge = GetJobGauge<RDMGauge>();
int black = gauge.BlackMana;
int white = gauge.WhiteMana;
if (actionID is RDM.Veraero or RDM.Verthunder) {
if (level < RDM.Levels.Verthunder)
return RDM.Jolt;
if (level is < RDM.Levels.Veraero and >= RDM.Levels.Verthunder)
return OriginalHook(RDM.Verthunder);
// This is for the long opener only, so we're not bothered about fast casting or finishers or anything like that
if (black < white)
return OriginalHook(RDM.Verthunder);
if (white < black)
return OriginalHook(RDM.Veraero);
return actionID;
}
if (actionID is RDM.Verstone or RDM.Verfire) {
bool fastCasting = CommonUtil.isFastcasting;
bool accelerated = SelfHasEffect(RDM.Buffs.Acceleration);
bool isFinishing1 = gauge.ManaStacks == 3;
bool isFinishing2 = comboTime > 0 && lastComboActionId is RDM.Verholy or RDM.Verflare;
bool isFinishing3 = comboTime > 0 && lastComboActionId is RDM.Scorch;
bool canFinishWhite = level >= RDM.Levels.Verholy;
bool canFinishBlack = level >= RDM.Levels.Verflare;
int blackThreshold = white + IMBALANCE_DIFF_MAX;
int whiteThreshold = black + IMBALANCE_DIFF_MAX;
// If we're ready to Scorch or Resolution, just do that. Nice and simple. Sadly, that's where the simple ends.
if (isFinishing3 && level >= RDM.Levels.Resolution)
return RDM.Resolution;
if (isFinishing2 && level >= RDM.Levels.Scorch)
return RDM.Scorch;
if (isFinishing1 && canFinishBlack) {
if (black >= white && canFinishWhite) {
// If we can already Verstone, but we can't Verfire, and Verflare WON'T imbalance us, use Verflare
if (verstoneUp && !verfireUp && (black + FINISHER_DELTA <= blackThreshold))
return RDM.Verflare;
return RDM.Verholy;
}
// If we can already Verfire, but we can't Verstone, and we can use Verholy, and it WON'T imbalance us, use Verholy
if (verfireUp && !verstoneUp && canFinishWhite && (white + FINISHER_DELTA <= whiteThreshold))
return RDM.Verholy;
return RDM.Verflare;
}
if (fastCasting || accelerated) {
if (level is < RDM.Levels.Veraero and >= RDM.Levels.Verthunder)
return RDM.Verthunder;
if (verfireUp == verstoneUp) {
// Either both procs are already up or neither is - use whatever gives us the mana we need
if (black < white)
return OriginalHook(RDM.Verthunder);
if (white < black)
return OriginalHook(RDM.Veraero);
// If mana levels are equal, prioritise the colour that the original button was
return actionID is RDM.Verstone
? OriginalHook(RDM.Veraero)
: OriginalHook(RDM.Verthunder);
}
if (verfireUp) {
// If Veraero is feasible, use it
if (white + LONG_DELTA <= whiteThreshold)
return OriginalHook(RDM.Veraero);
return OriginalHook(RDM.Verthunder);
}
if (verstoneUp) {
// If Verthunder is feasible, use it
if (black + LONG_DELTA <= blackThreshold)
return OriginalHook(RDM.Verthunder);
return OriginalHook(RDM.Veraero);
}
}
if (verfireUp && verstoneUp) {
// Decide by mana levels
if (black < white)
return RDM.Verfire;
if (white < black)
return RDM.Verstone;
// If mana levels are equal, prioritise the original button
return actionID;
}
// Only use Verfire if it won't imbalance us
if (verfireUp && black + PROC_DELTA <= blackThreshold)
return RDM.Verfire;
// Only use Verstone if it won't imbalance us
if (verstoneUp && white + PROC_DELTA <= whiteThreshold)
return RDM.Verstone;
// If neither's up or the one that is would imbalance us, just use Jolt
return OriginalHook(RDM.Jolt2);
}
}
return actionID;
}
}
}