Skip to content

Commit

Permalink
Merge pull request #425 from hte32/main
Browse files Browse the repository at this point in the history
Various bug fixes/improvements
  • Loading branch information
LTS-FFXIV authored Oct 5, 2024
2 parents 6d24a19 + a99a1d2 commit ced10a8
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 31 deletions.
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Actions/ActionBasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ internal readonly bool BasicCheck(bool skipStatusProvideCheck, bool skipComboChe

private bool IsActionEnabled() => _action.Config.IsEnabled;

private bool IsActionDisabled() => DataCenter.DisabledActionSequencer?.Contains(ID) ?? false;
private bool IsActionDisabled() => !IBaseAction.ForceEnable && (DataCenter.DisabledActionSequencer?.Contains(ID) ?? false);

private bool HasEnoughMP() => DataCenter.CurrentMp >= MPNeed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ protected override bool IsTrueInside(ICustomRotation rotation)
return _action.Cooldown.MaxCharges == Param1;
}
break;
case ActionConditionType.CanUse:
return _action.CanUse(out var act);
break;

Check warning on line 70 in RotationSolver.Basic/Configuration/Conditions/ActionCondition.cs

View workflow job for this annotation

GitHub Actions / Build

Unreachable code detected

Check warning on line 70 in RotationSolver.Basic/Configuration/Conditions/ActionCondition.cs

View workflow job for this annotation

GitHub Actions / Build

Unreachable code detected

}
return false;
}
Expand Down
19 changes: 17 additions & 2 deletions RotationSolver.Basic/Configuration/Conditions/TargetCondition.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ECommons.DalamudServices;
using ECommons.GameFunctions;
using ECommons.GameHelpers;
using Lumina.Excel.GeneratedSheets;

Expand All @@ -24,6 +25,8 @@ internal class TargetCondition : DelayCondition

public string CastingActionName = string.Empty;

public string CombatRole = string.Empty;

/// <summary>
/// Checks if the condition is true inside the rotation.
/// </summary>
Expand Down Expand Up @@ -63,7 +66,8 @@ protected override bool IsTrueInside(ICustomRotation rotation)
TargetConditionType.HPRatio => CheckHPRatio(tar),
TargetConditionType.MP => CheckMP(tar),
TargetConditionType.TargetName => CheckTargetName(tar),
_ => false,
TargetConditionType.TargetRole => CheckTargetRole(tar),
_ => false,
};
}

Expand Down Expand Up @@ -158,6 +162,14 @@ private bool CheckTargetName(IBattleChara tar)
}
return tar.Name.TextValue == CastingActionName;
}
private bool CheckTargetRole(IBattleChara tar)
{
if (string.IsNullOrEmpty(CombatRole))
{
return false;
}
return tar.GetRole().ToString() == CombatRole;
}
}

internal enum TargetType : byte
Expand Down Expand Up @@ -221,4 +233,7 @@ internal enum TargetConditionType : byte

[Description("Target Name")]
TargetName,
}

[Description("Target Role")]
TargetRole,
}
11 changes: 5 additions & 6 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ public const string
[ConditionBool, UI("Automatically use MP Potions", Description = "Experimental.",
Filter = AutoActionUsage)]
private static readonly bool _useMpPotions = false;


[JobConfig, UI("MP threshold under which to use Lucid Dreaming", Filter = AutoActionUsage)]
[Range(0, 10000, ConfigUnitType.None)]
public int LucidDreamingMpThreshold { get; set; } = 6000;

[ConditionBool, UI("Prioritize mob/object targets with attack markers",
Filter = TargetConfig)]
private static readonly bool _chooseAttackMark = true;
Expand Down Expand Up @@ -493,11 +497,6 @@ public const string
[Range(0, 5, ConfigUnitType.Seconds, 0.05f)]
public Vector2 HealWhenNothingTodoDelay { get; set; } = new(0.5f, 1);

[UI("Auto Heal delay range",
Parent = nameof(AutoHeal))]
[Range(0, 3, ConfigUnitType.Seconds, 0.002f)]
public Vector2 HealDelay { get; set; } = new(0.5f, 1);

[UI("How soon before countdown is finished to start casting or attacking.",
Filter = BasicTimer, Section = 1, PvPFilter = JobFilterType.NoJob)]
[Range(0, 0.7f, ConfigUnitType.Seconds, 0.002f)]
Expand Down
8 changes: 4 additions & 4 deletions RotationSolver.Basic/Rotations/Basic/PictomancerRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@ public partial class PictomancerRotation
/// <summary>
/// Is Pom Motif ready
/// </summary>
public static bool isPomMotifReady => ((byte)JobGauge.CreatureFlags & 32) == 32 || ((byte)JobGauge.CreatureFlags & 0) == 0;
public static bool isPomMotifReady => ((byte)JobGauge.CreatureFlags) == 32 || ((byte)JobGauge.CreatureFlags) == 0;

/// <summary>
/// Is Wing Motif ready
/// </summary>
public static bool isWingMotifReady => ((byte)JobGauge.CreatureFlags & 33) == 33 || ((byte)JobGauge.CreatureFlags & 1) == 1;
public static bool isWingMotifReady => ((byte)JobGauge.CreatureFlags) == 33 || ((byte)JobGauge.CreatureFlags) == 1;

/// <summary>
/// Is Claw Motif ready
/// </summary>
public static bool isClawMotifReady => ((byte)JobGauge.CreatureFlags & 19) == 19 || ((byte)JobGauge.CreatureFlags & 3) == 3;
public static bool isClawMotifReady => ((byte)JobGauge.CreatureFlags) == 19 || ((byte)JobGauge.CreatureFlags) == 3;

/// <summary>
/// Indicates that the player is not in a Dread Combo.
/// </summary>
public static bool isMawMotifReady => ((byte)JobGauge.CreatureFlags & 23) == 23 || ((byte)JobGauge.CreatureFlags & 7) == 7;
public static bool isMawMotifReady => ((byte)JobGauge.CreatureFlags) == 23 || ((byte)JobGauge.CreatureFlags) == 7;


/// <summary>
Expand Down
61 changes: 58 additions & 3 deletions RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,39 +44,59 @@ private bool Ability(IAction nextGCD, out IAction? act)
}

IBaseAction.TargetOverride = TargetType.Tank;
IBaseAction.ShouldEndSpecial = true;
if (DataCenter.CommandStatus.HasFlag(AutoStatus.Shirk))
{
IBaseAction.ShouldEndSpecial = true;
}
if (DataCenter.MergedStatus.HasFlag(AutoStatus.Shirk) && ShirkPvE.CanUse(out act))
{
return true;
}
IBaseAction.ShouldEndSpecial = false;

IBaseAction.TargetOverride = null;
if (DataCenter.CommandStatus.HasFlag(AutoStatus.TankStance))
{
IBaseAction.ShouldEndSpecial = true;
}
if (DataCenter.MergedStatus.HasFlag(AutoStatus.TankStance) && (TankStance?.CanUse(out act) ?? false))
{
return true;
}
IBaseAction.ShouldEndSpecial = false;

if (DataCenter.CommandStatus.HasFlag(AutoStatus.AntiKnockback))
{
IBaseAction.ShouldEndSpecial = true;
}
if (DataCenter.MergedStatus.HasFlag(AutoStatus.AntiKnockback) && AntiKnockback(role, nextGCD, out act))
{
return true;
}
IBaseAction.ShouldEndSpecial = false;

if (DataCenter.CommandStatus.HasFlag(AutoStatus.Positional))
{
IBaseAction.ShouldEndSpecial = true;
}
if (DataCenter.MergedStatus.HasFlag(AutoStatus.Positional) && TrueNorthPvE.Cooldown.CurrentCharges > 0 && !IsLastAbility(true, TrueNorthPvE) && TrueNorthPvE.CanUse(out act, skipComboCheck: true, usedUp: true))
{
return true;
}
IBaseAction.ShouldEndSpecial = false;

IBaseAction.TargetOverride = TargetType.Heal;
IBaseAction.ShouldEndSpecial = false;

if (DataCenter.CommandStatus.HasFlag(AutoStatus.HealAreaAbility))
{
IBaseAction.AllEmpty = true;
IBaseAction.ShouldEndSpecial = true;
if (HealAreaAbility(nextGCD, out act))
{
return true;
}
IBaseAction.AllEmpty = false;
IBaseAction.ShouldEndSpecial = false;
}

if (DataCenter.AutoStatus.HasFlag(AutoStatus.HealAreaAbility) && CanHealAreaAbility)
Expand All @@ -92,11 +112,13 @@ private bool Ability(IAction nextGCD, out IAction? act)
if (DataCenter.CommandStatus.HasFlag(AutoStatus.HealSingleAbility))
{
IBaseAction.AllEmpty = true;
IBaseAction.ShouldEndSpecial = true;
if (HealSingleAbility(nextGCD, out act))
{
return true;
}
IBaseAction.AllEmpty = false;
IBaseAction.ShouldEndSpecial = false;
}

if (DataCenter.AutoStatus.HasFlag(AutoStatus.HealSingleAbility) && CanHealSingleAbility)
Expand All @@ -110,13 +132,21 @@ private bool Ability(IAction nextGCD, out IAction? act)
}

IBaseAction.TargetOverride = null;
IBaseAction.ShouldEndSpecial = true;

if (DataCenter.CommandStatus.HasFlag(AutoStatus.Speed))
{
IBaseAction.ShouldEndSpecial = true;
}
if (DataCenter.CommandStatus.HasFlag(AutoStatus.Speed) && SpeedAbility(nextGCD, out act))
{
return true;
}
IBaseAction.ShouldEndSpecial = false;

if (DataCenter.CommandStatus.HasFlag(AutoStatus.Provoke))
{
IBaseAction.ShouldEndSpecial = true;
}
if (DataCenter.MergedStatus.HasFlag(AutoStatus.Provoke))
{
if (!HasTankStance && (TankStance?.CanUse(out act) ?? false))
Expand All @@ -130,39 +160,64 @@ private bool Ability(IAction nextGCD, out IAction? act)
return true;
}
}
IBaseAction.ShouldEndSpecial = false;

IBaseAction.TargetOverride = TargetType.BeAttacked;

if (DataCenter.CommandStatus.HasFlag(AutoStatus.DefenseArea))
{
IBaseAction.ShouldEndSpecial = true;
}
if (DataCenter.MergedStatus.HasFlag(AutoStatus.DefenseArea))
{
if (DefenseAreaAbility(nextGCD, out act) || (role is JobRole.Melee or JobRole.RangedPhysical or JobRole.RangedMagical && DefenseSingleAbility(nextGCD, out act)))
{
return true;
}
}
IBaseAction.ShouldEndSpecial = false;

if (DataCenter.CommandStatus.HasFlag(AutoStatus.DefenseSingle))
{
IBaseAction.ShouldEndSpecial = true;
}
if (DataCenter.MergedStatus.HasFlag(AutoStatus.DefenseSingle))
{
if (DefenseSingleAbility(nextGCD, out act) || (!DataCenter.IsHostileCastingToTank && ArmsLengthPvE.CanUse(out act)))
{
return true;
}
}
IBaseAction.ShouldEndSpecial = false;

IBaseAction.TargetOverride = null;

if (DataCenter.CommandStatus.HasFlag(AutoStatus.MoveForward))
{
IBaseAction.ShouldEndSpecial = true;
}
IBaseAction.AllEmpty = true;
if (DataCenter.MergedStatus.HasFlag(AutoStatus.MoveForward) && Player != null && !Player.HasStatus(true, StatusID.Bind) && MoveForwardAbility(nextGCD, out act))
{
return true;
}
IBaseAction.ShouldEndSpecial = false;

if (DataCenter.CommandStatus.HasFlag(AutoStatus.MoveBack))
{
IBaseAction.ShouldEndSpecial = true;
}
if (DataCenter.MergedStatus.HasFlag(AutoStatus.MoveBack) && MoveBackAbility(nextGCD, out act))
{
return true;
}
IBaseAction.ShouldEndSpecial = false;
IBaseAction.AllEmpty = false;

if (DataCenter.CommandStatus.HasFlag(AutoStatus.HealSingleAbility))
{
IBaseAction.ShouldEndSpecial = true;
}
if (DataCenter.MergedStatus.HasFlag(AutoStatus.HealSingleAbility) && UseHpPotion(nextGCD, out act))
{
return true;
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static partial void ModifyEsunaPvE(ref ActionSetting setting)

static partial void ModifyLucidDreamingPvE(ref ActionSetting setting)
{
setting.ActionCheck = () => Player.CurrentMp < 6000 && InCombat;
setting.ActionCheck = () => Player.CurrentMp < Service.Config.LucidDreamingMpThreshold && InCombat;
}

static partial void ModifySecondWindPvE(ref ActionSetting setting)
Expand Down
Loading

0 comments on commit ced10a8

Please sign in to comment.