Skip to content

Commit

Permalink
Fixed targeting track.
Browse files Browse the repository at this point in the history
  • Loading branch information
awgil committed Jul 26, 2024
1 parent c9c9c71 commit 6c56aec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions BossMod/Autorotation/UIStrategyValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static bool DrawEditor(ref StrategyValue value, StrategyConfig cfg, Modul
modified |= DrawEditorOption(ref value, cfg, level);
modified |= ImGui.InputText("Comment", ref value.Comment, 512);
modified |= DrawEditorPriority(ref value);
modified |= DrawEditorTarget(ref value, cfg.Options[value.Option].SupportedTargets, moduleInfo);
modified |= DrawEditorTarget(ref value, cfg.Options[value.Option].SupportedTargets, true, moduleInfo);
return modified;
}

Expand Down Expand Up @@ -133,7 +133,7 @@ public static bool DrawEditorPriority(ref StrategyValue value)
return modified;
}

public static bool DrawEditorTarget(ref StrategyValue value, ActionTargets supportedTargets, ModuleRegistry.Info? moduleInfo)
public static bool DrawEditorTarget(ref StrategyValue value, ActionTargets supportedTargets, bool allowAuto, ModuleRegistry.Info? moduleInfo)
{
var modified = false;
using (var combo = ImRaii.Combo("Target", value.Target.ToString()))
Expand All @@ -142,7 +142,7 @@ public static bool DrawEditorTarget(ref StrategyValue value, ActionTargets suppo
{
for (var i = StrategyTarget.Automatic; i < StrategyTarget.Count; ++i)
{
if (AllowTarget(i, supportedTargets, moduleInfo) && ImGui.Selectable(i.ToString(), i == value.Target))
if (AllowTarget(i, supportedTargets, allowAuto, moduleInfo) && ImGui.Selectable(i.ToString(), i == value.Target))
{
value.Target = i;
value.TargetParam = 0;
Expand Down Expand Up @@ -189,8 +189,9 @@ public static bool DrawEditorTarget(ref StrategyValue value, ActionTargets suppo
return modified;
}

public static bool AllowTarget(StrategyTarget t, ActionTargets supported, ModuleRegistry.Info? moduleInfo) => t switch
public static bool AllowTarget(StrategyTarget t, ActionTargets supported, bool allowAuto, ModuleRegistry.Info? moduleInfo) => t switch
{
StrategyTarget.Automatic => allowAuto,
StrategyTarget.Self => supported.HasFlag(ActionTargets.Self),
StrategyTarget.PartyByAssignment => supported.HasFlag(ActionTargets.Party),
StrategyTarget.PartyWithLowestHP => supported.HasFlag(ActionTargets.Party),
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Timeline/ColumnPlannerTrackTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override List<string> DescribeElement(Element e)
protected override void EditElement(Element e)
{
var cast = (OverrideElement)e;
if (UIStrategyValue.DrawEditorTarget(ref cast.Value, ActionTargets.All, moduleInfo))
if (UIStrategyValue.DrawEditorTarget(ref cast.Value, ActionTargets.All, false, moduleInfo))
NotifyModified();
if (ImGui.InputText("Comment", ref cast.Value.Comment, 256))
NotifyModified();
Expand Down

0 comments on commit 6c56aec

Please sign in to comment.