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

Commit

Permalink
fix: add a custom config about AOE Count.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Sep 7, 2023
1 parent 6df70b1 commit 414dd40
Show file tree
Hide file tree
Showing 19 changed files with 90 additions and 74 deletions.
2 changes: 0 additions & 2 deletions RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ public BaseAction(ActionID actionID, ActionOption option = ActionOption.None)
_option = option;

CoolDownGroup = _action.GetCoolDownGroup();

if (IsFriendly) AOECount = 1;
}

/// <summary>
Expand Down
23 changes: 17 additions & 6 deletions RotationSolver.Basic/Actions/BaseAction_Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using ECommons.GameHelpers;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
using FFXIVClientStructs.FFXIV.Common.Component.BGCollision;
using RotationSolver.Basic.Configuration;

namespace RotationSolver.Basic.Actions;
Expand All @@ -16,7 +15,19 @@ public partial class BaseAction
/// <summary>
/// If it is aoe. How many targets this action needs.
/// </summary>
public byte AOECount { private get; init; } = 3;
public byte AOECount
{
get
{
return OtherConfiguration.ActionAOECounts.TryGetValue(ID, out var count)
? count : IsFriendly ? (byte)1 :(byte)3;
}
internal set
{
OtherConfiguration.ActionAOECounts[ID] = value;
OtherConfiguration.SaveActionAOECounts();
}
}

/// <summary>
/// How many time does this action need the target keep in live.
Expand Down Expand Up @@ -300,7 +311,7 @@ private bool TargetParty(float range, int aoeCount, bool mustUse, out BattleChar
return false;
}

if (_action.CastType > 1 && (ActionID)ID != ActionID.DeploymentTactics)
if (!IsSingleTarget && (ActionID)ID != ActionID.DeploymentTactics)
{
target = ChoiceTarget(GetMostObjects(availableCharas, aoeCount), mustUse);
}
Expand Down Expand Up @@ -341,7 +352,7 @@ private bool TargetHostile(float range, bool mustUse, int aoeCount, out BattleCh
return false;
}

if (_action.CastType > 1 && NoAOE)
if (!IsSingleTarget && NoAOE)
{
target = null;
return false;
Expand All @@ -368,7 +379,7 @@ private bool TargetHostileManual(BattleChara b, bool mustUse, int aoeCount, out
if (!CanUseTo(b)) return false;
if (ChoiceTarget(TargetFilterFuncEot(new BattleChara[] { b }, mustUse), mustUse) == null) return false;

if (_action.CastType == 1)
if (IsSingleTarget)
{
if (!mustUse)
{
Expand Down Expand Up @@ -433,7 +444,7 @@ private IEnumerable<BattleChara> GetMostObjects(IEnumerable<BattleChara> targets
var canAttack = TargetFilter.GetObjectInRadius(targets, range + EffectRange);
var canGetObj = TargetFilter.GetObjectInRadius(canAttack, range).Where(CanUseTo);

if (_action.CastType == 1) return canGetObj;
if (IsSingleTarget) return canGetObj;

List<BattleChara> objectMax = new(canGetObj.Count());

Expand Down
5 changes: 5 additions & 0 deletions RotationSolver.Basic/Actions/IBaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,10 @@ public interface IBaseAction : IAction
/// Is this action's target type is target only one.
/// </summary>
bool IsSingleTarget { get; }

/// <summary>
/// How many targets are needed to use this action.
/// </summary>
byte AOECount { get; set; }
#endregion
}
36 changes: 36 additions & 0 deletions RotationSolver.Basic/Configuration/OtherConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,34 @@ public class OtherConfiguration

public static HashSet<uint> InvincibleStatus = new();

public static Dictionary<uint, byte> ActionAOECounts = new()
{
{ (uint) ActionID.Gravity, 2},
{ (uint) ActionID.FeatherRain, 1},
{ (uint) ActionID.Eruption, 1},
{ (uint) ActionID.QuickNock, 2},
{ (uint) ActionID.ShadowBite, 2},
{ (uint) ActionID.RainOfDeath, 2},
{ (uint) ActionID.BladeShower, 2},
{ (uint) ActionID.RisingWindmill, 2},
{ (uint) ActionID.BloodShower, 2},
{ (uint) ActionID.FanDance2, 2},
{ (uint) ActionID.Unleash, 2},
{ (uint) ActionID.StalwartSoul, 2},
{ (uint) ActionID.DemonSlice, 2},
{ (uint) ActionID.DemonSlaughter, 2},
{ (uint) ActionID.SpreadShot, 2},
{ (uint) ActionID.AutoCrossbow, 2},
{ (uint) ActionID.Katon, 2},
{ (uint) ActionID.Scatter, 2},
{ (uint) ActionID.WhorlOfDeath, 2},
{ (uint) ActionID.ArtOfWar, 2},
{ (uint) ActionID.Dyskrasia, 2},
{ (uint) ActionID.Overpower, 2},
{ (uint) ActionID.MythrilTempest, 2},
{ (uint) ActionID.SteelCyclone, 2},
};

public static RotationSolverRecord RotationSolverRecord = new ();

public static void Init()
Expand All @@ -45,6 +73,8 @@ public static void Init()

Task.Run(() => InitOne(ref BeneficialPositions, nameof(BeneficialPositions)));

Task.Run(() => InitOne(ref ActionAOECounts, nameof(ActionAOECounts)));

Task.Run(() => InitOne(ref RotationSolverRecord, nameof(RotationSolverRecord), false));
}

Expand All @@ -59,6 +89,12 @@ public static void Save()
SaveBeneficialPositions();
SaveRotationSolverRecord();
SaveNoProvokeNames();
SaveActionAOECounts();
}

public static void SaveActionAOECounts()
{
Task.Run(() => Save(ActionAOECounts, nameof(ActionAOECounts)));
}
public static void SaveRotationSolverRecord()
{
Expand Down
5 changes: 1 addition & 4 deletions RotationSolver.Basic/Rotations/Basic/AST_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ public abstract class AST_Base : CustomRotation
/// <summary>
///
/// </summary>
public static IBaseAction Gravity { get; } = new BaseAction(ActionID.Gravity)
{
AOECount = 2,
};
public static IBaseAction Gravity { get; } = new BaseAction(ActionID.Gravity);
#endregion

#region Heal Single
Expand Down
10 changes: 2 additions & 8 deletions RotationSolver.Basic/Rotations/Basic/BLU_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,18 +310,12 @@ public override bool CanUse(out IAction act, CanUseOption option = CanUseOption.
/// <summary>
///
/// </summary>
public static IBLUAction FeatherRain { get; } = new BLUAction(ActionID.FeatherRain)
{
AOECount = 1,
};
public static IBLUAction FeatherRain { get; } = new BLUAction(ActionID.FeatherRain);

/// <summary>
///
/// </summary>
public static IBLUAction Eruption { get; } = new BLUAction(ActionID.Eruption)
{
AOECount = 1,
};
public static IBLUAction Eruption { get; } = new BLUAction(ActionID.Eruption);

/// <summary>
///
Expand Down
7 changes: 1 addition & 6 deletions RotationSolver.Basic/Rotations/Basic/BRD_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ protected static bool SongEndAfterGCD(uint gctCount = 0, float offset = 0)
public static IBaseAction QuickNock { get; } = new BaseAction(ActionID.QuickNock)
{
StatusProvide = new[] { StatusID.ShadowBiteReady },
AOECount = 2,
};

/// <summary>
Expand All @@ -150,7 +149,6 @@ protected static bool SongEndAfterGCD(uint gctCount = 0, float offset = 0)
public static IBaseAction ShadowBite { get; } = new BaseAction(ActionID.ShadowBite)
{
StatusNeed = new[] { StatusID.ShadowBiteReady },
AOECount = 2,
};

/// <summary>
Expand All @@ -172,10 +170,7 @@ protected static bool SongEndAfterGCD(uint gctCount = 0, float offset = 0)
/// <summary>
///
/// </summary>
public static IBaseAction RainOfDeath { get; } = new BaseAction(ActionID.RainOfDeath)
{
AOECount = 2,
};
public static IBaseAction RainOfDeath { get; } = new BaseAction(ActionID.RainOfDeath);
#endregion

#region Support
Expand Down
4 changes: 0 additions & 4 deletions RotationSolver.Basic/Rotations/Basic/DNC_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ public abstract class DNC_Base : CustomRotation
public static IBaseAction BladeShower { get; } = new BaseAction(ActionID.BladeShower)
{
StatusProvide = Fountain.StatusProvide,
AOECount = 2,
};

/// <summary>
Expand All @@ -110,15 +109,13 @@ public abstract class DNC_Base : CustomRotation
public static IBaseAction RisingWindmill { get; } = new BaseAction(ActionID.RisingWindmill)
{
StatusNeed = ReverseCascade.StatusNeed,
AOECount = 2,
};

/// <summary>
/// 4
/// </summary>
public static IBaseAction BloodShower { get; } = new BaseAction(ActionID.BloodShower)
{
AOECount = 2,
StatusNeed = FountainFall.StatusNeed,
};

Expand All @@ -128,7 +125,6 @@ public abstract class DNC_Base : CustomRotation
public static IBaseAction FanDance2 { get; } = new BaseAction(ActionID.FanDance2)
{
ActionCheck = (b, m) => Feathers > 0,
AOECount = 2,
StatusProvide = new[] { StatusID.ThreefoldFanDance },
};

Expand Down
10 changes: 2 additions & 8 deletions RotationSolver.Basic/Rotations/Basic/DRK_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,12 @@ protected static bool ShadowTimeEndAfterGCD(uint gctCount = 0, float offset = 0)
/// <summary>
/// 1
/// </summary>
public static IBaseAction Unleash { get; } = new BaseAction(ActionID.Unleash)
{
AOECount = 2,
};
public static IBaseAction Unleash { get; } = new BaseAction(ActionID.Unleash);

/// <summary>
/// 2
/// </summary>
public static IBaseAction StalwartSoul { get; } = new BaseAction(ActionID.StalwartSoul)
{
AOECount = 2,
};
public static IBaseAction StalwartSoul { get; } = new BaseAction(ActionID.StalwartSoul);

/// <summary>
///
Expand Down
10 changes: 2 additions & 8 deletions RotationSolver.Basic/Rotations/Basic/GNB_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,12 @@ public abstract class GNB_Base : CustomRotation
/// <summary>
/// 1
/// </summary>
public static IBaseAction DemonSlice { get; } = new BaseAction(ActionID.DemonSlice)
{
AOECount = 2,
};
public static IBaseAction DemonSlice { get; } = new BaseAction(ActionID.DemonSlice);

/// <summary>
/// 2
/// </summary>
public static IBaseAction DemonSlaughter { get; } = new BaseAction(ActionID.DemonSlaughter)
{
AOECount = 2,
};
public static IBaseAction DemonSlaughter { get; } = new BaseAction(ActionID.DemonSlaughter);

/// <summary>
///
Expand Down
6 changes: 1 addition & 5 deletions RotationSolver.Basic/Rotations/Basic/MCH_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,14 @@ protected static bool OverheatedEndAfterGCD(uint gctCount = 0, float offset = 0)
/// <summary>
/// 1
/// </summary>
public static IBaseAction SpreadShot { get; } = new BaseAction(ActionID.SpreadShot)
{
AOECount = 2,
};
public static IBaseAction SpreadShot { get; } = new BaseAction(ActionID.SpreadShot);

/// <summary>
/// 2
/// </summary>
public static IBaseAction AutoCrossbow { get; } = new BaseAction(ActionID.AutoCrossbow)
{
ActionCheck = HeatBlast.ActionCheck,
AOECount = 2,
};

/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions RotationSolver.Basic/Rotations/Basic/NIN_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,7 @@ internal NinAction(ActionID actionID, params IBaseAction[] ninjutsu)
/// <summary>
///
/// </summary>
public static INinAction Katon { get; } = new NinAction(ActionID.Katon, Chi, Ten)
{
AOECount = 2,
};
public static INinAction Katon { get; } = new NinAction(ActionID.Katon, Chi, Ten);

/// <summary>
///
Expand Down
1 change: 0 additions & 1 deletion RotationSolver.Basic/Rotations/Basic/RDM_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ public abstract class RDM_Base : CustomRotation
public static IBaseAction Scatter { get; } = new BaseAction(ActionID.Scatter)
{
StatusNeed = Jolt.StatusProvide,
AOECount = 2,
};

/// <summary>
Expand Down
1 change: 0 additions & 1 deletion RotationSolver.Basic/Rotations/Basic/RPR_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ public abstract class RPR_Base : CustomRotation
{
TargetStatus = new[] { StatusID.DeathsDesign },
ActionCheck = ShadowOfDeath.ActionCheck,
AOECount = 2,
};

/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions RotationSolver.Basic/Rotations/Basic/SCH_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,7 @@ public abstract class SCH_Base : CustomRotation
/// <summary>
///
/// </summary>
public static IBaseAction ArtOfWar { get; } = new BaseAction(ActionID.ArtOfWar)
{
AOECount = 2
};
public static IBaseAction ArtOfWar { get; } = new BaseAction(ActionID.ArtOfWar);
#endregion

#region Seraph
Expand Down
5 changes: 1 addition & 4 deletions RotationSolver.Basic/Rotations/Basic/SGE_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ protected static bool AddersgallEndAfterGCD(uint gctCount = 0, float offset = 0)
/// <summary>
///
/// </summary>
public static IBaseAction Dyskrasia { get; } = new BaseAction(ActionID.Dyskrasia)
{
AOECount = 2
};
public static IBaseAction Dyskrasia { get; } = new BaseAction(ActionID.Dyskrasia);

/// <summary>
///
Expand Down
11 changes: 2 additions & 9 deletions RotationSolver.Basic/Rotations/Basic/WAR_Base.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,19 @@ public abstract class WAR_Base : CustomRotation
/// <summary>
/// 1
/// </summary>
public static IBaseAction Overpower { get; } = new BaseAction(ActionID.Overpower)
{
AOECount = 2,
};
public static IBaseAction Overpower { get; } = new BaseAction(ActionID.Overpower);

/// <summary>
/// 2
/// </summary>
public static IBaseAction MythrilTempest { get; } = new BaseAction(ActionID.MythrilTempest)
{
AOECount = 2,
};
public static IBaseAction MythrilTempest { get; } = new BaseAction(ActionID.MythrilTempest);

/// <summary>
///
/// </summary>
public static IBaseAction SteelCyclone { get; } = new BaseAction(ActionID.SteelCyclone)
{
ActionCheck = InnerBeast.ActionCheck,
AOECount = 2,
};

/// <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 @@ -733,4 +733,6 @@ internal partial class Strings

public string ConfigWindow_UI_TTKTextColor { get; set; } = "The text color of TTK.";
public string ConfigWindow_Basic_MinUpdatingTime { get; set; } = "The min time between updating information in second.";

public string ConfigWindow_Actions_AOECount { get; set; } = "How many targets are needed to use this action.";
}
Loading

0 comments on commit 414dd40

Please sign in to comment.