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

Commit

Permalink
fix: Added option for tanks to heal first
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 3, 2023
1 parent 18a6bd5 commit f36cc11
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public class PluginConfiguration : IPluginConfiguration

public Dictionary<ClassJobID, float> HealthForDyingTanks { get; set; } = new Dictionary<ClassJobID, float>();

public float HealthTankRatio = 0.4f;

public bool InterruptibleMoreCheck = true;
public float SpecialDuration = 3;
public float AbilitiesInterval = 0.67f;
Expand Down
16 changes: 9 additions & 7 deletions RotationSolver.Basic/Helpers/TargetFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,23 @@ public static class TargetFilter
#region Find one target
internal static IEnumerable<BattleChara> MeleeRangeTargetFilter(IEnumerable<BattleChara> availableCharas)
=> availableCharas.Where(t => t.DistanceToPlayer() >= 3 + Service.Config.MeleeRangeOffset);

internal static BattleChara DefaultChooseFriend(IEnumerable<BattleChara> availableCharas, bool mustUse)
{
if (availableCharas == null || !availableCharas.Any()) return null;

//根据默认设置排序怪且没有大招
availableCharas = DefaultTargetingType(availableCharas).Where(StatusHelper.NeedHealing);
availableCharas = availableCharas.Where(StatusHelper.NeedHealing);

var tar = availableCharas.OrderBy(ObjectHelper.GetHealingRatio).FirstOrDefault();
var tankTars = availableCharas.GetJobCategory(JobRole.Tank);

if (tar.GetHealingRatio() < 1) return tar;
var tankTar = tankTars.OrderBy(ObjectHelper.GetHealingRatio).FirstOrDefault();
if (tankTar.GetHealingRatio() < Service.Config.HealthTankRatio) return tankTar;

availableCharas = availableCharas.GetJobCategory(JobRole.Tank);
var tar = availableCharas.OrderBy(ObjectHelper.GetHealingRatio).FirstOrDefault();
if (tar.GetHealingRatio() < 1) return tar;

return availableCharas.FirstOrDefault(t => t.HasStatus(false, StatusHelper.TankStanceStatus))
?? availableCharas.FirstOrDefault();
return tankTars.FirstOrDefault(t => t.HasStatus(false, StatusHelper.TankStanceStatus))
?? tankTars.FirstOrDefault();
}

internal static BattleChara DefaultFindHostile(IEnumerable<BattleChara> availableCharas, bool mustUse)
Expand Down
9 changes: 1 addition & 8 deletions RotationSolver.Basic/Rotations/Basic/MCH_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ protected static bool OverheatedEndAfter(float time)
return EndAfter(JobGauge.OverheatTimeRemaining / 1000f, time);
}

/// <summary>
/// 过热在这么久后,还有吗
/// </summary>
/// <param name="abilityCount"></param>
/// <param name="gctCount"></param>
/// <returns></returns>
protected static bool OverheatedEndAfterGCD(uint gctCount = 0, uint abilityCount = 0)
{
return EndAfterGCD(JobGauge.OverheatTimeRemaining / 1000f, gctCount, abilityCount);
Expand Down Expand Up @@ -78,8 +72,7 @@ protected static bool OverheatedEndAfterGCD(uint gctCount = 0, uint abilityCount
/// </summary>
public static IBaseAction HeatBlast { get; } = new BaseAction(ActionID.HeatBlast)
{
ActionCheck = b => JobGauge.IsOverheated
&& !OverheatedEndAfterGCD(),
ActionCheck = b => IsOverheated && !OverheatedEndAfterGCD(),
};

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ internal partial class Strings
public string ConfigWindow_Param_HealthSingleAbility { get; set; } = "Set the HP threshold for using single healing ability";
public string ConfigWindow_Param_HealthSingleSpell { get; set; } = "Set the HP threshold for using single healing spell";

public string ConfigWindow_Param_HealthTankRatio { get; set; } = "Heal tank first it tank's HP threshold is lower than this.";


public string ConfigWindow_Param_HealingOfTimeSubtractSingle { get; set; } = "Set the HP threshold reduce with hot effect(single)";
public string ConfigWindow_Param_HealthForDyingTank { get; set; } = "Set the HP threshold for tank to use invincibility";
Expand Down
3 changes: 3 additions & 0 deletions RotationSolver/UI/RotationConfigWindow_Param.cs
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ private void DrawParamCondition()

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_HealthSingleSpell,
ref Service.Config.HealthSingleSpell, speed);

DrawFloatNumber(LocalizationManager.RightLang.ConfigWindow_Param_HealthTankRatio,
ref Service.Config.HealthTankRatio, speed);
}

private void DrawParamTarget()
Expand Down

0 comments on commit f36cc11

Please sign in to comment.