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

Commit

Permalink
fix: add a warning on target in target condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Nov 4, 2023
1 parent 16ad53e commit bcc1433
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Resources/RotationSolverRecord.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ClickingCount": 51182,
"ClickingCount": 51481,
"SaidUsers": []
}
11 changes: 6 additions & 5 deletions RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public override bool CanUse(out IAction act, CanUseOption option = CanUseOption.
ActionOption.DutyAction | ActionOption.Friendly)
{
StatusProvide = new StatusID[] { StatusID.LostSpellforge },
ActionCheck = (b, m) => Target?.HasStatus(false, StatusID.MagicalAversion) ?? false,
ActionCheck = (b, m) => LostSpellforge.Target?.HasStatus(false, StatusID.MagicalAversion) ?? false,
ChoiceTarget = (targets, mustUse) => targets.FirstOrDefault(t => (Job)t.ClassJob.Id switch
{
Job.WAR
Expand Down Expand Up @@ -326,7 +326,7 @@ or Job.RDM
ActionOption.DutyAction | ActionOption.Friendly)
{
StatusProvide = new StatusID[] { StatusID.LostSteelsting },
ActionCheck = (b, m) => Target?.HasStatus(false, StatusID.PhysicalAversion) ?? false,
ActionCheck = (b, m) => LostSteelsting.Target?.HasStatus(false, StatusID.PhysicalAversion) ?? false,
ChoiceTarget = (targets, mustUse) => targets.FirstOrDefault(t => (Job)t.ClassJob.Id switch
{
Job.WHM
Expand Down Expand Up @@ -354,7 +354,7 @@ or Job.RDM
ActionOption.DutyAction | ActionOption.Friendly)
{
StatusProvide = new StatusID[] { StatusID.LostRampage },
ActionCheck = (b, m) => Target?.HasStatus(false, StatusID.PhysicalAversion) ?? false,
ActionCheck = (b, m) => LostRampage.Target?.HasStatus(false, StatusID.PhysicalAversion) ?? false,
};

/// <summary>
Expand All @@ -364,7 +364,7 @@ or Job.RDM
ActionOption.DutyAction | ActionOption.Friendly)
{
StatusProvide = new StatusID[] { StatusID.LostBurst },
ActionCheck = (b, m) => Target?.HasStatus(false, StatusID.MagicalAversion) ?? false,
ActionCheck = (b, m) => LostBurst.Target?.HasStatus(false, StatusID.MagicalAversion) ?? false,
};

/// <summary>
Expand Down Expand Up @@ -466,7 +466,8 @@ or Job.RDM
public static IBaseAction PvP_StandardIssueElixir { get; } = new BaseAction(ActionID.PvP_StandardIssueElixir, ActionOption.Heal)
{
ActionCheck = (t, m) => !HasHostilesInMaxRange
&& (t.CurrentMp <= t.MaxMp / 3 || t.CurrentHp <= t.MaxHp / 3),
&& (t.CurrentMp <= t.MaxMp / 3 || t.CurrentHp <= t.MaxHp / 3)
&& !IsLastAction(ActionID.PvP_StandardIssueElixir),
};

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Rotations/CustomRotation_Medicine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ protected bool UseBurstMedicine(out IAction act, bool clippingCheck = true)
{
act = null;

#pragma warning disable CS0618 // Type or member is obsolete
if (!(Target?.IsDummy() ?? false) && !DataCenter.IsInHighEndDuty) return false;
#pragma warning restore CS0618 // Type or member is obsolete

return MedicineType switch
{
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ public abstract partial class CustomRotation
#region Target
/// <summary>
/// The player's target.
/// <br>WARNING: You'd better not use it. Because this target isn't the action's target. Try to use <see cref="IBaseAction.Target"/> instead after using <seealso cref="IBaseAction.CanUse(out IAction, CanUseOption, byte, byte)"/></br>
/// </summary>
[Obsolete("You'd better not use it. More information in summary.")]
protected static BattleChara Target => Svc.Targets.Target is BattleChara b ? b : Player;

/// <summary>
Expand Down
5 changes: 3 additions & 2 deletions RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@
"ConfigWindow_Condition_RotationNullWarning": "Rotation is null, please login or switch the job!",
"ConfigWindow_Condition_NoItemsWarning": "There are no items!",
"ConfigWindow_Condition_ConditionName": "Condition Name",
"ConfigWindow_Condition_TeritoryName": "Teritory Name",
"ConfigWindow_Condition_DutyName": "Duty Name"
"ConfigWindow_Condition_TerritoryName": "Territory Name",
"ConfigWindow_Condition_DutyName": "Duty Name",
"ConfigWindow_Condition_TargetWarning": "You'd better not use it. Because this target isn't the action's target. Try to pick it from action."
}
3 changes: 2 additions & 1 deletion RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,8 @@ internal class Strings

public string ConfigWindow_Condition_ConditionName { get; set; } = "Condition Name";

public string ConfigWindow_Condition_TeritoryName { get; set; } = "Teritory Name";
public string ConfigWindow_Condition_TerritoryName { get; set; } = "Territory Name";

public string ConfigWindow_Condition_DutyName { get; set; } = "Duty Name";
public string ConfigWindow_Condition_TargetWarning { get; set; } = "You'd better not use it. Because this target isn't the action's target. Try to pick it from action.";
}
8 changes: 7 additions & 1 deletion RotationSolver/UI/ConditionDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,12 @@ void DrawStatusIcon()
}
break;
}

if (targetCondition._action == null && targetCondition.IsTarget)
{
using var style = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_Condition_TargetWarning);
}
}

private static string[] _territoryNames = null;
Expand Down Expand Up @@ -1062,7 +1068,7 @@ private static void DrawAfter(this TerritoryCondition territoryCondition, ICusto
TerritoryNames, i => i.ToString(), i =>
{
territoryCondition.Name = i;
}, LocalizationManager.RightLang.ConfigWindow_Condition_TeritoryName);
}, LocalizationManager.RightLang.ConfigWindow_Condition_TerritoryName);
break;

case TerritoryConditionType.DutyName:
Expand Down

0 comments on commit bcc1433

Please sign in to comment.