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

Commit

Permalink
fix: add speed ability.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jun 25, 2023
1 parent 50a502f commit ec31f83
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 13 deletions.
6 changes: 6 additions & 0 deletions Resources/HostileCastingArea.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@
25386,
25524,
25654,
25916,
25922,
25931,
25936,
25946,
25950,
26437,
26450,
26451,
Expand Down
18 changes: 8 additions & 10 deletions RotationSolver.Basic/Attributes/RotationDescAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,17 @@ public class RotationDescAttribute : Attribute
{
DescType.BurstActions => 62583,

DescType.HealAreaGCD => 62582,
DescType.HealAreaAbility => 62582,
DescType.HealSingleGCD => 62582,
DescType.HealSingleAbility => 62582,
DescType.HealAreaGCD or DescType.HealAreaAbility or
DescType.HealSingleGCD or DescType.HealSingleAbility => 62582,

DescType.DefenseAreaGCD => 62581,
DescType.DefenseAreaAbility => 62581,
DescType.DefenseSingleGCD => 62581,
DescType.DefenseSingleAbility => 62581,
DescType.DefenseAreaGCD or DescType.DefenseAreaAbility or
DescType.DefenseSingleGCD or DescType.DefenseSingleAbility => 62581,

DescType.MoveForwardGCD => 104,
DescType.MoveForwardAbility => 104,
DescType.MoveForwardGCD or DescType.MoveForwardAbility or
DescType.MoveBackAbility => 104,

DescType.SpeedAbility => 844,

_ => 62144,
};

Expand All @@ -41,6 +38,7 @@ public bool IsOnCommand
DescType.DefenseSingleGCD or DescType.DefenseSingleAbility => command == SpecialCommandType.DefenseSingle,
DescType.MoveForwardGCD or DescType.MoveForwardAbility => command == SpecialCommandType.MoveForward,
DescType.MoveBackAbility => command == SpecialCommandType.MoveBack,
DescType.SpeedAbility => command == SpecialCommandType.Speed,
_ => false,
};
}
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Data/ActionID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1407,5 +1407,7 @@ public enum ActionID : uint
TrueNorth = 7546,

Peloton = 7557,

Sprint = 3,
#endregion
}
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Data/DescType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ public enum DescType : byte
MoveForwardGCD,
MoveForwardAbility,
MoveBackAbility,

SpeedAbility,
}
3 changes: 3 additions & 0 deletions RotationSolver.Basic/Data/RSCommandType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum SpecialCommandType : byte
MoveBack,
AntiKnockback,
Burst,
Speed,

None,
}
Expand Down Expand Up @@ -49,6 +50,7 @@ public enum SettingsCommand : byte
PreventActions,
PreventActionsDuty,
AutoLoadCustomRotations,
AutoSpeedOutOfCombat,
}

public static class SettingsCommandExtension
Expand All @@ -67,6 +69,7 @@ public static class SettingsCommandExtension
SettingsCommand.UseAOEWhenManual => false,
SettingsCommand.PreventActions => false,
SettingsCommand.PreventActionsDuty => false,
SettingsCommand.AutoSpeedOutOfCombat => true,
_ => false,
};
}
6 changes: 6 additions & 0 deletions RotationSolver.Basic/Rotations/Basic/SCH_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,10 @@ public abstract class SCH_Base : CustomRotation
protected static IBaseTrait EnhancedHealingMagic { get; } = new BaseTrait(493);
protected static IBaseTrait EnhancedDeploymentTactics { get; } = new BaseTrait(494);
#endregion

protected override bool SpeedAbility(out IAction act)
{
if(Expedient.CanUse(out act, CanUseOption.MustUse)) return true;
return base.SpeedAbility(out act);
}
}
15 changes: 13 additions & 2 deletions RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using RotationSolver.Basic.Configuration;

namespace RotationSolver.Basic.Rotations;

public abstract partial class CustomRotation
Expand Down Expand Up @@ -33,6 +35,7 @@ private bool Ability(IAction nextGCD, out IAction act, bool helpDefenseAOE, bool
}

if (GeneralHealAbility(specialType, out act)) return true;
if(specialType == SpecialCommandType.Speed && SpeedAbility(out act)) return true;

if (AutoDefense(role, helpDefenseAOE, helpDefenseSingle, out act)) return true;

Expand All @@ -54,8 +57,8 @@ private bool Ability(IAction nextGCD, out IAction act, bool helpDefenseAOE, bool
if (GeneralAbility(out act)) return true;

//Run!
if (!InCombat && IsMoving && role == JobRole.RangedPhysical
&& Peloton.CanUse(out act, CanUseOption.MustUse | CanUseOption.IgnoreClippingCheck)) return true;
if (IsMoving && NotInCombatDelay && PluginConfiguration.GetValue(SettingsCommand.AutoSpeedOutOfCombat)
&& SpeedAbility(out act)) return true;

return false;
}
Expand Down Expand Up @@ -324,6 +327,14 @@ protected virtual bool DefenseAreaAbility(out IAction act)
act = null; return false;
}

[RotationDesc(DescType.SpeedAbility)]
protected virtual bool SpeedAbility(out IAction act)
{
if (Sprint.CanUse(out act, CanUseOption.MustUse)) return true;
if (Peloton.CanUse(out act, CanUseOption.MustUse)) return true;
return false;
}

protected virtual bool GeneralAbility(out IAction act)
{
act = null; return false;
Expand Down
4 changes: 3 additions & 1 deletion RotationSolver.Basic/Rotations/CustomRotation_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,14 @@ internal RoleAction(ActionID actionID, JobRole[] roles, ActionOption option = Ac
StatusProvide = new StatusID[] { StatusID.TrueNorth, StatusID.RightEye },
};

public static IBaseAction Peloton { get; } = new RoleAction(ActionID.Peloton, new JobRole[] { JobRole.RangedPhysical }, ActionOption.Buff)
public static IBaseAction Peloton { get; } = new RoleAction(ActionID.Peloton, new JobRole[] { JobRole.RangedPhysical }, ActionOption.Friendly)
{
ActionCheck = (b, m) => NotInCombatDelay && PartyMembers.GetObjectInRadius(20)
.Any(p => p.WillStatusEnd(3, false, StatusID.Peloton) && !p.StatusFlags.HasFlag(Dalamud.Game.ClientState.Objects.Enums.StatusFlags.InCombat)),
};

public static IBaseAction Sprint { get; } = new BaseAction(ActionID.Sprint, ActionOption.Friendly);

private protected virtual IBaseAction Raise => null;
private protected virtual IBaseAction TankStance => null;

Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/Localization/EnumTranslations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ internal static class EnumTranslations
SpecialCommandType.AntiKnockback => LocalizationManager.RightLang.SpecialCommandType_AntiKnockback,
SpecialCommandType.Burst => LocalizationManager.RightLang.SpecialCommandType_Burst,
SpecialCommandType.EndSpecial => LocalizationManager.RightLang.SpecialCommandType_EndSpecial,
SpecialCommandType.Speed => LocalizationManager.RightLang.SpecialCommandType_Speed,
_ => string.Empty,
};

Expand All @@ -165,6 +166,7 @@ internal static class EnumTranslations
SpecialCommandType.AntiKnockback => LocalizationManager.RightLang.ConfigWindow_HelpItem_AntiKnockback,
SpecialCommandType.Burst => LocalizationManager.RightLang.ConfigWindow_HelpItem_Burst,
SpecialCommandType.EndSpecial => LocalizationManager.RightLang.ConfigWindow_HelpItem_EndSpecial,
SpecialCommandType.Speed => LocalizationManager.RightLang.ConfigWindow_HelpItem_Speed,
_ => string.Empty,
};

Expand Down
4 changes: 4 additions & 0 deletions RotationSolver/Localization/Strings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ internal partial class Strings

public string ConfigWindow_HelpItem_MoveBack { get; set; }
= "Open a window to move back.";
public string ConfigWindow_HelpItem_Speed { get; set; }
= "Open a window to speed up.";

public string ConfigWindow_HelpItem_EndSpecial { get; set; }
= "To end this special duration before the set time.";
Expand Down Expand Up @@ -180,6 +182,7 @@ internal partial class Strings
public string ConfigWindow_Param_AutoUseTrueNorth { get; set; } = "Auto TrueNorth (Melee)";
public string ConfigWindow_Param_RaisePlayerBySwift { get; set; } = "Raise player by swift";
public string ConfigWindow_Param_UseGroundBeneficialAbility { get; set; } = "Use beneficial ground-targeted actions";
public string ConfigWindow_Param_AutoSpeedOutOfCombat { get; set; } = "Use speed actions when out of combat.";
public string ConfigWindow_Param_RaisePlayerByCasting { get; set; } = "Raise player by casting when swift is in cooldown";
public string ConfigWindow_Param_UseHealWhenNotAHealer { get; set; } = "Use heal when not-healer";
public string ConfigWindow_Param_LessMPNoRaise { get; set; } = "Never raise player if MP is less than the set value";
Expand Down Expand Up @@ -365,6 +368,7 @@ internal partial class Strings
public string SpecialCommandType_AntiKnockback { get; set; } = "Anti-Knockback";
public string SpecialCommandType_Burst { get; set; } = "Burst";
public string SpecialCommandType_EndSpecial { get; set; } = "End Special";
public string SpecialCommandType_Speed { get; set; } = "Speed";
public string SpecialCommandType_Smart { get; set; } = "Auto Target ";
public string SpecialCommandType_Manual { get; set; } = "Manual Target";
public string SpecialCommandType_Cancel { get; set; } = "Cancel";
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver/UI/RotationConfigWindow_Help.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ private static void DrawHelpTab()

SpecialCommandType.MoveBack.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp);

SpecialCommandType.Speed.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp);

SpecialCommandType.EsunaStanceNorth.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp);

SpecialCommandType.RaiseShirk.DisplayCommandHelp(getHelp: EnumTranslations.ToHelp);
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 @@ -336,6 +336,9 @@ private void DrawParamAction()
DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_RaisePlayerBySwift,
SettingsCommand.RaisePlayerBySwift);

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_AutoSpeedOutOfCombat,
SettingsCommand.AutoSpeedOutOfCombat);

DrawCheckBox(LocalizationManager.RightLang.ConfigWindow_Param_UseGroundBeneficialAbility,
SettingsCommand.UseGroundBeneficialAbility);

Expand Down

0 comments on commit ec31f83

Please sign in to comment.