Skip to content

Commit cbc8a92

Browse files
authored
Merge pull request #630 from FFXIV-CombatReborn/Frameworkstuff
Refactor Black Mage rotation logic and enemy name handling
2 parents be557ea + 1d0a808 commit cbc8a92

File tree

4 files changed

+36
-59
lines changed

4 files changed

+36
-59
lines changed

BasicRotations/Magical/BLM_Beta.cs

+15-15
Original file line numberDiff line numberDiff line change
@@ -144,28 +144,28 @@ protected override bool AttackAbility(IAction nextGCD, out IAction? act)
144144
{
145145
if (UseMedicine && UseBurstMedicine(out act)) return true;
146146

147-
if (ElementTime > 0 && ElementTimeEndAfter(1))
148-
{
149-
if (TransposePvE.CanUse(out act)) return true;
150-
}
147+
//if (ElementTime > 0 && ElementTimeEndAfter(1))
148+
//{
149+
// if (TransposePvE.CanUse(out act)) return true;
150+
//}
151151

152152
if (InCombat)
153153
{
154-
if (ThisManyInstantCasts > 6 && AstralSoulStacks < 6 && InAstralFire && ElementTime > 6 && Player.HasStatus(true, StatusID.Firestarter))
154+
if (ThisManyInstantCasts > 6 && AstralSoulStacks < 6 && InAstralFire && Player.HasStatus(true, StatusID.Firestarter))
155155
{
156156
if (ManafontPvE.CanUse(out act)) return true;
157157
}
158-
if (ThisManyInstantCasts > 6 && AstralSoulStacks < 6 && InAstralFire && ElementTime > 6 && Player.HasStatus(true, StatusID.Firestarter) && Player.CurrentMp > 9000)
158+
if (ThisManyInstantCasts > 6 && AstralSoulStacks < 6 && InAstralFire && Player.HasStatus(true, StatusID.Firestarter) && Player.CurrentMp > 9000)
159159
{
160160
if (InCombat && TriplecastPvE.CanUse(out act)) return true;
161161
}
162162

163-
if (ThisManyInstantCasts > 3 && AstralSoulStacks == 3 && InAstralFire && ElementTime > 6)
163+
if (ThisManyInstantCasts > 3 && AstralSoulStacks == 3 && InAstralFire)
164164
{
165165
if (InCombat && TriplecastPvE.CanUse(out act, usedUp: true)) return true;
166166
}
167167

168-
if (ThisManyInstantCasts == 1 && AstralSoulStacks == 6 && InAstralFire && ElementTime > 3)
168+
if (ThisManyInstantCasts == 1 && AstralSoulStacks == 6 && InAstralFire)
169169
{
170170
if (SwiftcastPvE.CanUse(out act)) return true;
171171
}
@@ -202,7 +202,7 @@ protected override bool GeneralGCD(out IAction? act)
202202
if (FlareStarPvE.EnoughLevel && Infinity)
203203
{
204204

205-
if (InAstralFire && ElementTime < 4 && Player.HasStatus(true, StatusID.Firestarter))
205+
if (InAstralFire && Player.HasStatus(true, StatusID.Firestarter))
206206
{
207207
if (FireIiiPvE.CanUse(out act)) return true;
208208
}
@@ -403,12 +403,12 @@ private bool MaintainFire(out IAction? act)
403403
break;
404404
}
405405

406-
if (ElementTimeEndAfterGCD(false ? 3u : 2u))
407-
{
408-
if (CurrentMp >= FirePvE.Info.MPNeed * 2 + 800 && FirePvE.CanUse(out act)) return true;
409-
if (FlarePvE.CanUse(out act)) return true;
410-
if (DespairPvE.CanUse(out act)) return true;
411-
}
406+
//if (ElementTimeEndAfterGCD(false ? 3u : 2u))
407+
//{
408+
// if (CurrentMp >= FirePvE.Info.MPNeed * 2 + 800 && FirePvE.CanUse(out act)) return true;
409+
// if (FlarePvE.CanUse(out act)) return true;
410+
// if (DespairPvE.CanUse(out act)) return true;
411+
//}
412412

413413
return false;
414414
}

BasicRotations/Magical/BLM_Default.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,12 @@ private bool MaintainFire(out IAction? act)
276276
break;
277277
}
278278

279-
if (ElementTimeEndAfterGCD(ExtendTimeSafely ? 3u : 2u))
280-
{
281-
if (CurrentMp >= FirePvE.Info.MPNeed * 2 + 800 && FirePvE.CanUse(out act)) return true;
282-
if (FlarePvE.CanUse(out act)) return true;
283-
if (DespairPvE.CanUse(out act)) return true;
284-
}
279+
//if (ElementTimeEndAfterGCD(ExtendTimeSafely ? 3u : 2u))
280+
//{
281+
// if (CurrentMp >= FirePvE.Info.MPNeed * 2 + 800 && FirePvE.CanUse(out act)) return true;
282+
// if (FlarePvE.CanUse(out act)) return true;
283+
// if (DespairPvE.CanUse(out act)) return true;
284+
//}
285285

286286
return false;
287287
}

RotationSolver.Basic/Helpers/ObjectHelper.cs

+9-9
Original file line numberDiff line numberDiff line change
@@ -221,18 +221,18 @@ internal static unsafe bool IsInEnemiesList(this IBattleChara battleChara)
221221
continue;
222222

223223
// Read the enemy's name
224-
//var enemyNameRaw = Marshal.PtrToStringUTF8((IntPtr)textNode->NodeText.StringPtr);
225-
//if (string.IsNullOrEmpty(enemyNameRaw))
226-
// continue;
224+
var enemyNameRaw = textNode->NodeText.StringPtr.ToString();
225+
if (string.IsNullOrEmpty(enemyNameRaw))
226+
continue;
227227

228-
//// Remove control characters from the enemy's name
229-
//var enemyName = RemoveControlCharacters(enemyNameRaw);
228+
// Remove control characters from the enemy's name
229+
var enemyName = RemoveControlCharacters(enemyNameRaw);
230230

231231
//// Compare with battleChara's name
232-
//if (string.Equals(enemyName, battleChara.Name.TextValue, StringComparison.OrdinalIgnoreCase))
233-
//{
234-
// return true;
235-
//}
232+
if (string.Equals(enemyName, battleChara.Name.TextValue, StringComparison.OrdinalIgnoreCase))
233+
{
234+
return true;
235+
}
236236
}
237237
}
238238
}

RotationSolver.Basic/Rotations/Basic/BlackMageRotation.cs

+6-29
Original file line numberDiff line numberDiff line change
@@ -81,29 +81,6 @@ partial class BlackMageRotation
8181
protected static bool EnochianEndAfterGCD(uint gcdCount = 0, float offset = 0)
8282
=> EnochianEndAfter(GCDTime(gcdCount, offset));
8383

84-
static float ElementTimeRaw => JobGauge.ElementTimeRemaining / 1000f;
85-
86-
/// <summary>
87-
///
88-
/// </summary>
89-
protected static float ElementTime => ElementTimeRaw - DataCenter.DefaultGCDRemain;
90-
91-
/// <summary>
92-
///
93-
/// </summary>
94-
/// <param name="time"></param>
95-
/// <returns></returns>
96-
protected static bool ElementTimeEndAfter(float time) => ElementTime <= time;
97-
98-
/// <summary>
99-
///
100-
/// </summary>
101-
/// <param name="gctCount"></param>
102-
/// <param name="offset"></param>
103-
/// <returns></returns>
104-
protected static bool ElementTimeEndAfterGCD(uint gctCount = 0, float offset = 0)
105-
=> ElementTimeEndAfter(GCDTime(gctCount, offset));
106-
10784
/// <summary>
10885
///
10986
/// </summary>
@@ -214,7 +191,7 @@ static partial void ModifyFirePvE(ref ActionSetting setting)
214191

215192
static partial void ModifyTransposePvE(ref ActionSetting setting)
216193
{
217-
setting.ActionCheck = () => DataCenter.DefaultGCDRemain <= ElementTimeRaw;
194+
//setting.ActionCheck = () => DataCenter.DefaultGCDRemain <= ElementTimeRaw;
218195
}
219196

220197
static partial void ModifyThunderPvE(ref ActionSetting setting)
@@ -282,7 +259,7 @@ static partial void ModifyUmbralSoulPvE(ref ActionSetting setting)
282259

283260
static partial void ModifyFreezePvE(ref ActionSetting setting)
284261
{
285-
setting.ActionCheck = () => InUmbralIce && !ElementTimeEndAfter(ActionID.FreezePvE.GetCastTime() - 0.1f) && UmbralHearts == 0;
262+
setting.ActionCheck = () => InUmbralIce && UmbralHearts == 0;
286263
setting.UnlockedByQuestID = 66611;
287264
setting.CreateConfig = () => new ActionConfig()
288265
{
@@ -304,7 +281,7 @@ static partial void ModifyAetherialManipulationPvE(ref ActionSetting setting)
304281

305282
static partial void ModifyFlarePvE(ref ActionSetting setting)
306283
{
307-
setting.ActionCheck = () => InAstralFire && AstralSoulStacks <= 3 && !ElementTimeEndAfter(ActionID.FlarePvE.GetCastTime() - 0.1f);
284+
setting.ActionCheck = () => InAstralFire && AstralSoulStacks <= 3;
308285
setting.UnlockedByQuestID = 66614;
309286
setting.CreateConfig = () => new ActionConfig()
310287
{
@@ -327,13 +304,13 @@ static partial void ModifyLeyLinesPvE(ref ActionSetting setting)
327304

328305
static partial void ModifyBlizzardIvPvE(ref ActionSetting setting)
329306
{
330-
setting.ActionCheck = () => InUmbralIce && !ElementTimeEndAfter(ActionID.BlizzardIvPvE.GetCastTime() - 0.1f);
307+
setting.ActionCheck = () => InUmbralIce;
331308
setting.UnlockedByQuestID = 67218;
332309
}
333310

334311
static partial void ModifyFireIvPvE(ref ActionSetting setting)
335312
{
336-
setting.ActionCheck = () => InAstralFire && AstralSoulStacks <= 5 && !ElementTimeEndAfter(ActionID.FireIvPvE.GetCastTime() - 0.1f);
313+
setting.ActionCheck = () => InAstralFire && AstralSoulStacks <= 5;
337314
setting.UnlockedByQuestID = 67219;
338315
}
339316

@@ -373,7 +350,7 @@ static partial void ModifyFoulPvE(ref ActionSetting setting)
373350

374351
static partial void ModifyDespairPvE(ref ActionSetting setting)
375352
{
376-
setting.ActionCheck = () => InAstralFire && !ElementTimeEndAfter(ActionID.DespairPvE.GetCastTime() - 0.1f);
353+
setting.ActionCheck = () => InAstralFire;
377354
}
378355

379356
static partial void ModifyXenoglossyPvE(ref ActionSetting setting)

0 commit comments

Comments
 (0)