Skip to content

Commit 3104a49

Browse files
authored
Merge pull request #819 from FFXIV-CombatReborn/vprhotfix
Hotfix for Viper Rework
2 parents 57d60e3 + 2489239 commit 3104a49

File tree

3 files changed

+58
-10
lines changed

3 files changed

+58
-10
lines changed

BasicRotations/Melee/VPR_Default.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,12 @@ protected override bool GeneralGCD(out IAction? act)
392392
return true;
393393
}
394394

395-
var Htarget = HuntersCoilPvE.Target.Target;
396-
if (Htarget != null && CanHitPositional(EnemyPositional.Flank, HuntersCoilPvE.Target.Target) &&
397-
HuntersCoilPvE.CanUse(out act, skipComboCheck: true))
395+
if (HuntersCoilPvE.CanUse(out act, skipComboCheck: true) && HuntersCoilPvE.Target.Target != null && CanHitPositional(EnemyPositional.Flank, HuntersCoilPvE.Target.Target))
398396
{
399397
return true;
400398
}
401399

402-
var Starget = SwiftskinsCoilPvE.Target.Target;
403-
if (Starget != null && CanHitPositional(EnemyPositional.Rear, SwiftskinsCoilPvE.Target.Target) &&
404-
SwiftskinsCoilPvE.CanUse(out act, skipComboCheck: true))
400+
if (SwiftskinsCoilPvE.CanUse(out act, skipComboCheck: true) && SwiftskinsCoilPvE.Target.Target != null && CanHitPositional(EnemyPositional.Rear, SwiftskinsCoilPvE.Target.Target))
405401
{
406402
return true;
407403
}

RotationSolver.Basic/Helpers/ObjectHelper.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,16 @@ internal static bool HasPositional(this IBattleChara battleChara)
8181
return false;
8282
}
8383

84-
if (battleChara.StatusList == null)
84+
try
8585
{
86+
if (battleChara.StatusList == null)
87+
{
88+
return false;
89+
}
90+
}
91+
catch
92+
{
93+
// StatusList threw, treat as unavailable
8694
return false;
8795
}
8896

RotationSolver.Basic/Helpers/StatusHelper.cs

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,19 @@ private static IEnumerable<byte> StatusStacks(this IBattleChara battleChara, boo
336336
/// <returns></returns>
337337
public static bool HasStatus(this IBattleChara battleChara, bool isFromSelf, params StatusID[] statusIDs)
338338
{
339+
try
340+
{
341+
if (battleChara.StatusList == null)
342+
{
343+
return false;
344+
}
345+
}
346+
catch
347+
{
348+
// StatusList threw, treat as unavailable
349+
return false;
350+
}
351+
339352
if (HasApplyStatus(battleChara, statusIDs))
340353
{
341354
return true;
@@ -417,9 +430,27 @@ internal static string GetStatusName(StatusID id)
417430
/// <param name="isFromSelf">Whether the statuses are from self.</param>
418431
/// <param name="statusIDs">The status IDs to look for.</param>
419432
/// <returns>An enumerable of statuses.</returns>
420-
private static IEnumerable<Status> GetStatus(this IBattleChara battleChara, bool isFromSelf, params StatusID[] statusIDs)
433+
private static List<Status> GetStatus(this IBattleChara battleChara, bool isFromSelf, params StatusID[] statusIDs)
421434
{
422-
IEnumerable<Status> allStatuses = battleChara.GetAllStatus(isFromSelf);
435+
if (battleChara == null)
436+
{
437+
return [];
438+
}
439+
440+
try
441+
{
442+
if (battleChara.StatusList == null)
443+
{
444+
return [];
445+
}
446+
}
447+
catch
448+
{
449+
// StatusList threw, treat as unavailable
450+
return [];
451+
}
452+
453+
List<Status> allStatuses = battleChara.GetAllStatus(isFromSelf);
423454
if (allStatuses == null)
424455
{
425456
return [];
@@ -458,13 +489,26 @@ private static IEnumerable<Status> GetStatus(this IBattleChara battleChara, bool
458489
/// <param name="battleChara">The object to get the statuses from.</param>
459490
/// <param name="isFromSelf">Whether the statuses are from self.</param>
460491
/// <returns>An enumerable of all statuses.</returns>
461-
private static IEnumerable<Status> GetAllStatus(this IBattleChara battleChara, bool isFromSelf)
492+
private static List<Status> GetAllStatus(this IBattleChara battleChara, bool isFromSelf)
462493
{
463494
if (battleChara == null)
464495
{
465496
return [];
466497
}
467498

499+
try
500+
{
501+
if (battleChara.StatusList == null)
502+
{
503+
return [];
504+
}
505+
}
506+
catch
507+
{
508+
// StatusList threw, treat as unavailable
509+
return [];
510+
}
511+
468512
ulong playerId = Player.Object.GameObjectId;
469513
List<Status> result = [];
470514

0 commit comments

Comments
 (0)