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

Commit

Permalink
fix: moving target choice.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 19, 2023
1 parent a0dce2e commit 57ac999
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public bool IsEnabled

public IRotationConfigSet Configs { get; }

public BattleChara MoveTarget { get; private set; }
public static BattleChara MoveTarget { get; private set; }

public virtual string Description { get; } = string.Empty;

Expand Down
5 changes: 3 additions & 2 deletions RotationSolver.Basic/Rotations/CustomRotation_Invoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ public bool TryInvoke(out IAction newAction, out IAction gcdAction)
var role = Job.GetJobRole();

ActionMoveForwardGCD = MoveForwardGCD(out var act) ? act : null;
ActionMoveForwardAbility = MoveForwardAbility(1, out act, recordTarget: false) ? act : null;
MoveTarget = act is IBaseAction a ? a.Target : null;
var movingTarget = MoveForwardAbility(1, out act, recordTarget: false);
ActionMoveForwardAbility = movingTarget ? act : null;
MoveTarget = (movingTarget && act is IBaseAction a) ? a.Target : null;

ActionMoveBackAbility = MoveBackAbility(DataCenter.AbilityRemainCount, out act) ? act : null;

Expand Down
1 change: 0 additions & 1 deletion RotationSolver.Basic/Rotations/ICustomRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public interface ICustomRotation : ITexture
string RotationName { get; }
IRotationConfigSet Configs { get; }
MedicineType MedicineType { get; }
BattleChara MoveTarget { get; }

IBaseAction[] AllBaseActions { get; }
IAction[] AllActions { get; }
Expand Down
5 changes: 2 additions & 3 deletions RotationSolver.Default/Tank/GNB_Default.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ protected override bool DefenseSingleAbility(byte abilitiesRemaining, out IActio
{
if (abilitiesRemaining == 2)
{
//10
if (HeartofStone.CanUse(out act)) return true;

//30
if (Nebula.CanUse(out act)) return true;

Expand All @@ -112,6 +109,8 @@ protected override bool DefenseSingleAbility(byte abilitiesRemaining, out IActio
//10
if (Camouflage.CanUse(out act)) return true;
}
//10
if (HeartofStone.CanUse(out act)) return true;

if (Reprisal.CanUse(out act)) return true;

Expand Down
6 changes: 2 additions & 4 deletions RotationSolver/RotationSolverPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ public unsafe RotationSolverPlugin(DalamudPluginInterface pluginInterface)
ChangeUITranslation();

RotationUpdater.GetAllCustomRotations();
OpenControlWindow();
}


Expand Down Expand Up @@ -102,9 +101,8 @@ internal static void OpenConfigWindow()
_comboConfigWindow.Toggle();
}

internal static void OpenControlWindow()
internal static void UpdateControlWindow()
{
_controlWindow.IsOpen = Service.Config.ShowControlWindow;
_controlWindow.IsOpen = MajorUpdater.IsValid && Service.Config.ShowControlWindow;
}

}
9 changes: 7 additions & 2 deletions RotationSolver/UI/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ private static void DrawActionCooldown(IAction act)
DrawIAction(act, width);
ImGuiHelper.HoveredString(act.Name);

if (act.IsCoolingDown)
if (!act.EnoughLevel)
{
ImGui.GetWindowDrawList().AddRectFilled(new Vector2(pos.X, pos.Y) + winPos,
new Vector2(pos.X + width, pos.Y + width) + winPos, progressCol);
}
else if (act.IsCoolingDown)
{
var ratio = recast == 0 ? 0 : elapsed % recast / recast;
ImGui.GetWindowDrawList().AddRectFilled(new Vector2(pos.X + width * ratio, pos.Y) + winPos,
Expand All @@ -146,7 +151,7 @@ private static void DrawActionCooldown(IAction act)
TextShade(fontPos, time, 1.5f, white, black);
}

if(act is IBaseAction bAct && bAct.MaxCharges > 1)
if(act.EnoughLevel && act is IBaseAction bAct && bAct.MaxCharges > 1)
{
for (int i = 0; i < bAct.CurrentCharges; i++)
{
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/UI/OverlayWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using RotationSolver.Basic;
using RotationSolver.Basic.Data;
using RotationSolver.Basic.Helpers;
using RotationSolver.Rotations.CustomRotation;
using RotationSolver.Updaters;
using System.Numerics;

Expand Down Expand Up @@ -98,7 +99,7 @@ private unsafe static void DrawMoveTarget()
var c = Service.Config.MovingTargetColor;
var color = ImGui.GetColorU32(new Vector4(c.X, c.Y, c.Z, 1));

var tar = RotationUpdater.RightNowRotation?.MoveTarget;
var tar = CustomRotation.MoveTarget;
if (tar == null || tar == Service.Player) return;

DrawTarget(tar, color, 8, out var scrPos);
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/UI/RotationConfigWindow_Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal partial class RotationConfigWindow
private void DrawControlTab()
{
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Control_ShowControlWindow,
ref Service.Config.ShowControlWindow, otherThing: RotationSolverPlugin.OpenControlWindow);
ref Service.Config.ShowControlWindow);

if (!Service.Config.ShowControlWindow) return;

Expand Down
2 changes: 0 additions & 2 deletions RotationSolver/Updaters/ActionUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ internal static class ActionUpdater

static RandomDelay _GCDDelay = new RandomDelay(() => (Service.Config.WeaponDelayMin, Service.Config.WeaponDelayMax));


internal static IAction NextAction { get; private set; }
internal static IBaseAction NextGCDAction { get; private set; }

Expand All @@ -26,7 +25,6 @@ internal static class ActionUpdater

internal static void UpdateNextAction()
{

PlayerCharacter localPlayer = Service.Player;
if (localPlayer == null) return;

Expand Down
1 change: 1 addition & 0 deletions RotationSolver/Updaters/MajorUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal static class MajorUpdater

private static void FrameworkUpdate(Framework framework)
{
RotationSolverPlugin.UpdateControlWindow();
if (!IsValid) return;

//#if DEBUG
Expand Down

0 comments on commit 57ac999

Please sign in to comment.