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

Commit

Permalink
fix: add delay for heal when nothing to do.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Aug 29, 2023
1 parent eb47ec6 commit 5b16e58
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 13 deletions.
5 changes: 5 additions & 0 deletions RotationSolver.Basic/Configuration/Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ public enum PluginConfigBool : byte
[Default(true)] ShowStateIcon,
[Default(true)] ShowBeneficialPositions,
[Default(false)] HideWarning,

[Default(true)] HealWhenNothingTodo,
}

public enum PluginConfigFloat : byte
Expand Down Expand Up @@ -383,6 +385,9 @@ public enum PluginConfigFloat : byte
[Default(0.1f, 0.05f, 0.25f)] ClickingDelayMin,
[Default(0.15f)] ClickingDelayMax,

[Default(0.5f, 0f, 5f)] HealWhenNothingTodoMin,
[Default(1)] HealWhenNothingTodoMax,

[Default(0.5f, 0f, 3f)] CountdownDelayMin,
[Default(1f)] CountdownDelayMax,
[Default(0.6f, 0f, 0.7f)] CountDownAhead,
Expand Down
23 changes: 20 additions & 3 deletions RotationSolver.Basic/Rotations/CustomRotation_GCD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ namespace RotationSolver.Basic.Rotations;

public abstract partial class CustomRotation
{
private static DateTime _nextTimeToHeal = DateTime.MinValue;
private IAction GCD(bool helpDefenseAOE, bool helpDefenseSingle)
{
IAction act = DataCenter.CommandNextAction;
Expand Down Expand Up @@ -46,10 +47,26 @@ private IAction GCD(bool helpDefenseAOE, bool helpDefenseSingle)
}

if (GeneralGCD(out var action)) return action;
if (DataCenter.PartyMembersMinHP < Service.Config.GetValue(PluginConfigFloat.HealWhenNothingTodoBelow) && DataCenter.InCombat)

if (Service.Config.GetValue(PluginConfigBool.HealWhenNothingTodo) && DataCenter.InCombat)
{
if (DataCenter.PartyMembersDifferHP < DataCenter.PartyMembersDifferHP && HealAreaGCD(out act)) return act;
if (HealSingleGCD(out act)) return act;
// Please don't tell me someone's fps is less than 1!!
if (DateTime.Now - _nextTimeToHeal > TimeSpan.FromSeconds(1))
{
var min = Service.Config.GetValue(PluginConfigFloat.HealWhenNothingTodoMin);
var max = Service.Config.GetValue(PluginConfigFloat.HealWhenNothingTodoMax);
_nextTimeToHeal = DateTime.Now + TimeSpan.FromSeconds(new Random().NextDouble() * (max - min) + min);
}
else if (_nextTimeToHeal < DateTime.Now)
{
_nextTimeToHeal = DateTime.Now;

if (DataCenter.PartyMembersMinHP < Service.Config.GetValue(PluginConfigFloat.HealWhenNothingTodoBelow))
{
if (DataCenter.PartyMembersDifferHP < DataCenter.PartyMembersDifferHP && HealAreaGCD(out act)) return act;
if (HealSingleGCD(out act)) return act;
}
}
}

if (Service.Config.GetValue(PluginConfigBool.RaisePlayerByCasting) && RaiseSpell(specialType, out act, true)) return act;
Expand Down
3 changes: 3 additions & 0 deletions RotationSolver/Localization/ConfigTranslation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ internal static class ConfigTranslation
PluginConfigBool.HealOutOfCombat => LocalizationManager.RightLang.ConfigWindow_Param_HealOutOfCombat,
PluginConfigBool.OnlyHotOnTanks => LocalizationManager.RightLang.ConfigWindow_Param_OnlyHotOnTanks,
PluginConfigBool.RecordCastingArea => "Record AOE actions",
PluginConfigBool.HealWhenNothingTodo => LocalizationManager.RightLang.ConfigWindow_Param_HealWhenNothingTodo,

// target
PluginConfigBool.AddEnemyListToHostile => LocalizationManager.RightLang.ConfigWindow_Param_AddEnemyListToHostile,
PluginConfigBool.ChooseAttackMark => LocalizationManager.RightLang.ConfigWindow_Param_ChooseAttackMark,
Expand Down Expand Up @@ -180,6 +182,7 @@ internal static class ConfigTranslation

// auto
PluginConfigFloat.HealWhenNothingTodoBelow => LocalizationManager.RightLang.ConfigWindow_Param_HealWhenNothingTodoBelow,
PluginConfigFloat.HealWhenNothingTodoMin => LocalizationManager.RightLang.ConfigWindow_Param_HealWhenNothingTodoDelay,
PluginConfigFloat.DistanceForMoving => LocalizationManager.RightLang.ConfigWindow_Param_DistanceForMoving,
PluginConfigFloat.MeleeRangeOffset => LocalizationManager.RightLang.ConfigWindow_Param_MeleeRangeOffset,
PluginConfigFloat.HealthDifference => LocalizationManager.RightLang.ConfigWindow_Param_HealthDifference,
Expand Down
4 changes: 3 additions & 1 deletion RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ internal partial class Strings
public string ConfigWindow_Param_HealthTankRatio { get; set; } = "Heal tank first if its HP%% is lower than this.";

public string ConfigWindow_Param_DistanceForMoving { get; set; } = "Use gapcloser as a damage ability if the distance to your target is less then this.";
public string ConfigWindow_Param_HealWhenNothingTodo { get; set; } = "Healing the members with GCD if there is nothing to do in combat.";

public string ConfigWindow_Param_HealWhenNothingTodoBelow { get; set; } = "Healing the members with GCD if there is nothing to do in combat and their min HP%% is lower than this.";
public string ConfigWindow_Param_HealWhenNothingTodoBelow { get; set; } = "When their min HP%% is lower than this.";
public string ConfigWindow_Param_HealWhenNothingTodoDelay { get; set; } = "The delay of this type of healing.";

public string ConfigWindow_Param_HealthForDyingTank { get; set; } = "Set the HP%% for tank to use invulnerability";

Expand Down
23 changes: 14 additions & 9 deletions RotationSolver/UI/RotationConfigWindow_Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,21 @@ private static void DrawAutoActionCondition()
new DragFloatSearchPlugin(PluginConfigFloat.AutoHealTimeToKill, 0.02f),
new DragFloatSearchPlugin(PluginConfigFloat.HealthDifference, 0.02f)),

new CheckBoxSearchPlugin(PluginConfigBool.OnlyHotOnTanks)
{
JobRoles = new JobRole[]
{
JobRole.Healer,
}
},

new CheckBoxSearchPlugin(PluginConfigBool.HealOutOfCombat),
new DragFloatSearchPlugin(PluginConfigFloat.HealWhenNothingTodoBelow, 0.002f),

new CheckBoxSearchPlugin(PluginConfigBool.HealWhenNothingTodo,
new DragFloatSearchPlugin(PluginConfigFloat.HealWhenNothingTodoBelow, 0.002f),
new DragFloatRangeSearchPlugin(PluginConfigFloat.HealWhenNothingTodoMin,
PluginConfigFloat.HealWhenNothingTodoMax, 0.05f)),

new DragFloatSearchPlugin(PluginConfigFloat.HealthHealerRatio, 0.02f)
{
JobRoles = new JobRole[]
Expand Down Expand Up @@ -672,14 +685,6 @@ private static void DrawAutoActionCondition()
}
},

new CheckBoxSearchPlugin(PluginConfigBool.OnlyHotOnTanks)
{
JobRoles = new JobRole[]
{
JobRole.Healer,
}
},

new CheckBoxSearchPlugin(PluginConfigBool.UseAbility, new ISearchable[]
{
new CheckBoxSearchPlugin(PluginConfigBool.UseDefenseAbility,
Expand Down

0 comments on commit 5b16e58

Please sign in to comment.