Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: changed alliance check to action check.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jun 30, 2023
1 parent dc39880 commit 04923a3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Resources/HostileCastingArea.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@
13462,
14119,
14120,
14135,
14139,
14177,
14191,
14195,
14206,
14439,
14470,
15042,
15813,
Expand Down
13 changes: 12 additions & 1 deletion RotationSolver.Basic/Helpers/ObjectHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using Dalamud.Game.ClientState.Objects.Enums;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Logging;
using ECommons.GameFunctions;
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.Game.Event;
using Lumina.Excel.GeneratedSheets;

Expand Down Expand Up @@ -38,7 +41,15 @@ public static unsafe bool IsOthersPlayers(this GameObject obj)

public static unsafe bool IsNPCEnemy(this GameObject obj)
=> obj != null && obj.GetObjectKind() == ObjectKind.BattleNpc
&& obj.IsHostile();
&& ActionManager.CanUseActionOnTarget((uint)ActionID.Blizzard, obj.Struct());

//public static unsafe bool IsNPCEnemy(this GameObject obj)
// => obj != null && obj.GetObjectKind() == ObjectKind.BattleNpc
// && obj.IsHostile();

public static unsafe bool IsAlliance(this GameObject obj)
=> obj != null && (obj is PlayerCharacter
|| ActionManager.CanUseActionOnTarget((uint)ActionID.Cure, obj.Struct()));

public static unsafe ObjectKind GetObjectKind(this GameObject obj) => (ObjectKind)obj.Struct()->ObjectKind;

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ private static bool IsHostileCastingBase(BattleChara h, Func<Action, bool> check
private unsafe static void UpdateFriends(IEnumerable<BattleChara> allTargets)
{
DataCenter.PartyMembers = GetPartyMembers(allTargets);
DataCenter.AllianceMembers = allTargets.OfType<PlayerCharacter>();
DataCenter.AllianceMembers = allTargets.Where(ObjectHelper.IsAlliance);

var mayPet = allTargets.OfType<BattleNpc>().Where(npc => npc.OwnerId == Player.Object.ObjectId);
DataCenter.HasPet = mayPet.Any(npc => npc.BattleNpcKind == BattleNpcSubKind.Pet);
Expand Down

0 comments on commit 04923a3

Please sign in to comment.