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

Commit

Permalink
fix: moving forward actions' target.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Mar 21, 2024
1 parent 3fc7fa9 commit baad8e5
Show file tree
Hide file tree
Showing 16 changed files with 92 additions and 26 deletions.
4 changes: 4 additions & 0 deletions Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@
"7489": 0.1,
"7490": 0.6,
"7491": 0.6,
"7492": 0.6,
"7495": 0.6,
"7496": 0.6,
"7498": 0.6,
"7499": 0.6,
"7503": 0.1,
"7505": 0.6,
Expand Down Expand Up @@ -558,6 +561,7 @@
"25773": 0.6,
"25774": 0.6,
"25778": 0.6,
"25779": 0.6,
"25780": 0.6,
"25784": 0.6,
"25785": 0.6,
Expand Down
4 changes: 2 additions & 2 deletions Resources/RotationSolverRecord.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ClickingCount": 105963,
"SayingHelloCount": 175,
"ClickingCount": 107756,
"SayingHelloCount": 176,
"SaidUsers": []
}
9 changes: 8 additions & 1 deletion RotationSolver.Basic/Actions/ActionSetting.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
namespace RotationSolver.Basic.Actions;

internal enum SpecialActionType : byte
{
None,
MeleeRange,
MovingForward,
}

/// <summary>
/// Setting from the developer.
/// </summary>
Expand All @@ -18,7 +25,7 @@ public class ActionSetting()
/// <summary>
/// Is this action in the melee range.
/// </summary>
public bool IsMeleeRange { get; set; } = false;
internal SpecialActionType SpecialType { get; set; }

/// <summary>
/// Is this status is added by the plyer.
Expand Down
32 changes: 19 additions & 13 deletions RotationSolver.Basic/Actions/ActionTargetInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private readonly bool CheckTimeToKill(GameObject gameObject)
{
type = TargetType.Big;
}
var target = FindTargetByType(targets, type, action.Config.AutoHealRatio, action.Setting.IsMeleeRange);
var target = FindTargetByType(targets, type, action.Config.AutoHealRatio, action.Setting.SpecialType);
if (target == null) return null;

return new(target, [.. GetAffects(target, canAffects)], target.Position);
Expand Down Expand Up @@ -322,7 +322,7 @@ private readonly bool CheckTimeToKill(GameObject gameObject)
{
var availableCharas = DataCenter.AllTargets.Where(b => b.ObjectId != Player.Object.ObjectId);
var target = FindTargetByType(TargetFilter.GetObjectInRadius(availableCharas, range),
TargetType.Move, action.Config.AutoHealRatio, action.Setting.IsMeleeRange);
TargetType.Move, action.Config.AutoHealRatio, action.Setting.SpecialType);
if (target == null) return null;
return new(target, [], target.Position);
}
Expand Down Expand Up @@ -384,7 +384,7 @@ private readonly bool CheckTimeToKill(GameObject gameObject)
{
var effectRange = EffectRange;
var attackT = FindTargetByType(DataCenter.AllianceMembers.GetObjectInRadius(range + effectRange),
TargetType.BeAttacked, action.Config.AutoHealRatio, action.Setting.IsMeleeRange);
TargetType.BeAttacked, action.Config.AutoHealRatio, action.Setting.SpecialType);

if (attackT == null)
{
Expand Down Expand Up @@ -512,13 +512,26 @@ private readonly bool CanGetTarget(GameObject target, GameObject subTarget)
#endregion

#region TargetFind
private static BattleChara? FindTargetByType(IEnumerable<BattleChara> gameObjects, TargetType type, float healRatio, bool isMeleeRange)
private static BattleChara? FindTargetByType(IEnumerable<BattleChara> gameObjects, TargetType type, float healRatio, SpecialActionType actionType)
{
if (type == TargetType.Self) return Player.Object;

if (isMeleeRange)
switch (actionType)
{
gameObjects = gameObjects.Where(t => t.DistanceToPlayer() >= 3 + Service.Config.MeleeRangeOffset);
case SpecialActionType.MeleeRange:
gameObjects = gameObjects.Where(t => t.DistanceToPlayer() >= 3 + Service.Config.MeleeRangeOffset);
break;

case SpecialActionType.MovingForward:
if (DataCenter.MergedStatus.HasFlag(AutoStatus.MoveForward))
{
type = TargetType.Move;
}
else
{
gameObjects = gameObjects.Where(t => t.DistanceToPlayer() < 1);
}
break;
}

switch (type) // Filter the objects.
Expand Down Expand Up @@ -568,13 +581,6 @@ private readonly bool CanGetTarget(GameObject target, GameObject subTarget)

BattleChara? FindTargetForMoving()
{
//if (!IBaseAction.ActionPreview && !DataCenter.MergedStatus.HasFlag(AutoStatus.MoveForward))
//{
// var o = gameObjects.MinBy(b => b.DistanceToPlayer());
// if (o.DistanceToPlayer() < 1) return o;
// return null;
//}

const float DISTANCE_TO_MOVE = 3;

if (Service.Config.MoveTowardsScreenCenter)
Expand Down
4 changes: 3 additions & 1 deletion RotationSolver.Basic/Actions/BaseAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ public bool CanUse(out IAction act, bool skipStatusProvideCheck = false, bool sk
if (!Cooldown.CooldownCheck(usedUp, onLastAbility, skipClippingCheck, gcdCountForAbility)) return false;


if (Setting.IsMeleeRange && IActionHelper.IsLastAction(IActionHelper.MovingActions)) return false; //No range actions after moving.
if (Setting.SpecialType is SpecialActionType.MeleeRange
&& IActionHelper.IsLastAction(IActionHelper.MovingActions)) return false; //No range actions after moving.

if (DataCenter.AverageTimeToKill < Config.TimeToKill) return false;
if (DataCenter.TimeToUntargetable < Config.TimeToUntargetable) return false;

Expand Down
7 changes: 6 additions & 1 deletion RotationSolver.Basic/Rotations/Basic/DarkKnightRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static partial void ModifyBloodspillerPvE(ref ActionSetting setting)

static partial void ModifyUnmendPvE(ref ActionSetting setting)
{
setting.IsMeleeRange = true;
setting.SpecialType = SpecialActionType.MeleeRange;
}

static partial void ModifyLivingShadowPvE(ref ActionSetting setting)
Expand Down Expand Up @@ -147,6 +147,11 @@ static partial void ModifyUnleashPvE(ref ActionSetting setting)
};
}

static partial void ModifyPlungePvE(ref ActionSetting setting)
{
setting.SpecialType = SpecialActionType.MovingForward;
}

/// <inheritdoc/>
protected override bool EmergencyAbility(IAction nextGCD, out IAction? act)
{
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver.Basic/Rotations/Basic/DragoonRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static partial void ModifyWheelingThrustPvE(ref ActionSetting setting)

static partial void ModifyPiercingTalonPvE(ref ActionSetting setting)
{
setting.IsMeleeRange = true;
setting.SpecialType = SpecialActionType.MeleeRange;
}

static partial void ModifyJumpPvE(ref ActionSetting setting)
Expand Down
7 changes: 6 additions & 1 deletion RotationSolver.Basic/Rotations/Basic/GunbreakerRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static partial void ModifyHypervelocityPvE(ref ActionSetting setting)

static partial void ModifyLightningShotPvE(ref ActionSetting setting)
{
setting.IsMeleeRange = true;
setting.SpecialType = SpecialActionType.MeleeRange;
}

static partial void ModifyFatedCirclePvE(ref ActionSetting setting)
Expand Down Expand Up @@ -135,6 +135,11 @@ static partial void ModifyDemonSlaughterPvE(ref ActionSetting setting)
};
}

static partial void ModifyRoughDividePvE(ref ActionSetting setting)
{
setting.SpecialType = SpecialActionType.MovingForward;
}

/// <inheritdoc/>
protected override bool EmergencyAbility(IAction nextGCD, out IAction? act)
{
Expand Down
5 changes: 5 additions & 0 deletions RotationSolver.Basic/Rotations/Basic/MonkRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ static partial void ModifyRiddleOfFirePvE(ref ActionSetting setting)
};
}

static partial void ModifyThunderclapPvE(ref ActionSetting setting)
{
setting.SpecialType = SpecialActionType.MovingForward;
}

/// <inheritdoc/>
[RotationDesc(ActionID.ThunderclapPvE)]
protected sealed override bool MoveForwardAbility(out IAction? act)
Expand Down
7 changes: 6 additions & 1 deletion RotationSolver.Basic/Rotations/Basic/NinjaRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static partial void ModifyPhantomKamaitachiPvE(ref ActionSetting setting)

static partial void ModifyThrowingDaggerPvE(ref ActionSetting setting)
{
setting.IsMeleeRange = true;
setting.SpecialType = SpecialActionType.MeleeRange;
}

static partial void ModifyBhavacakraPvE(ref ActionSetting setting)
Expand Down Expand Up @@ -115,6 +115,11 @@ static partial void ModifyDotonPvE(ref ActionSetting setting)
setting.StatusProvide = [StatusID.Doton];
}

static partial void ModifyShukuchiPvE(ref ActionSetting setting)
{
setting.SpecialType = SpecialActionType.MovingForward;
}

/// <summary>
///
/// </summary>
Expand Down
6 changes: 5 additions & 1 deletion RotationSolver.Basic/Rotations/Basic/PaladinRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static partial void ModifyShieldBashPvE(ref ActionSetting setting)

static partial void ModifyShieldLobPvE(ref ActionSetting setting)
{
setting.IsMeleeRange = true;
setting.SpecialType = SpecialActionType.MeleeRange;
}

private protected sealed override IBaseAction TankStance => IronWillPvE;
Expand Down Expand Up @@ -102,6 +102,10 @@ static partial void ModifyHolySheltronPvE(ref ActionSetting setting)
setting.ActionCheck = () => OathGauge >= 50 && Player.IsTargetOnSelf();
}

static partial void ModifyIntervenePvP(ref ActionSetting setting)
{
setting.SpecialType = SpecialActionType.MovingForward;
}

/// <inheritdoc/>
protected override bool EmergencyAbility(IAction nextGCD, out IAction? act)
Expand Down
7 changes: 6 additions & 1 deletion RotationSolver.Basic/Rotations/Basic/ReaperRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static partial void ModifyGrimReapingPvE(ref ActionSetting setting)

static partial void ModifyHarpePvE(ref ActionSetting setting)
{
setting.IsMeleeRange = true;
setting.SpecialType = SpecialActionType.MeleeRange;
}

static partial void ModifyHellsIngressPvE(ref ActionSetting setting)
Expand All @@ -201,6 +201,11 @@ static partial void ModifyHarvestMoonPvE(ref ActionSetting setting)
setting.StatusNeed = [StatusID.Soulsow];
}

static partial void ModifyHellsIngressPvP(ref ActionSetting setting)
{
setting.SpecialType = SpecialActionType.MovingForward;
}

/// <inheritdoc/>
[RotationDesc(ActionID.HellsIngressPvE)]
protected sealed override bool MoveForwardAbility(out IAction? act)
Expand Down
5 changes: 5 additions & 0 deletions RotationSolver.Basic/Rotations/Basic/RedMageRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ static partial void ModifyManaficationPvE(ref ActionSetting setting)
};
}

static partial void ModifyCorpsacorpsPvE(ref ActionSetting setting)
{
setting.SpecialType = SpecialActionType.MovingForward;
}

/// <inheritdoc/>
[RotationDesc(ActionID.VercurePvE)]
protected sealed override bool HealSingleGCD(out IAction? act)
Expand Down
5 changes: 5 additions & 0 deletions RotationSolver.Basic/Rotations/Basic/SageRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ static partial void ModifyPepsisPvE(ref ActionSetting setting)
};
}

static partial void ModifyIcarusPvE(ref ActionSetting setting)
{
setting.SpecialType = SpecialActionType.MovingForward;
}

/// <inheritdoc/>
[RotationDesc(ActionID.IcarusPvE)]
protected sealed override bool MoveForwardAbility(out IAction? act)
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver.Basic/Rotations/Basic/SamuraiRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static partial void ModifyKaeshiSetsugekkaPvE(ref ActionSetting setting)

static partial void ModifyEnpiPvE(ref ActionSetting setting)
{
setting.IsMeleeRange = true;
setting.SpecialType = SpecialActionType.MeleeRange;
}

static partial void ModifyMeikyoShisuiPvE(ref ActionSetting setting)
Expand Down Expand Up @@ -148,6 +148,7 @@ static partial void ModifyHissatsuShintenPvE(ref ActionSetting setting)

static partial void ModifyHissatsuGyotenPvE(ref ActionSetting setting)
{
setting.SpecialType = SpecialActionType.MovingForward;
setting.ActionCheck = () => Kenki >= 10;
}

Expand Down
11 changes: 9 additions & 2 deletions RotationSolver.Basic/Rotations/Basic/WarriorRotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ partial class WarriorRotation
/// </summary>
public static byte BeastGauge => JobGauge.BeastGauge;

private sealed protected override IBaseAction TankStance => DefiancePvE;

static partial void ModifyStormsEyePvE(ref ActionSetting setting)
{
setting.CreateConfig = () => new()
Expand All @@ -27,7 +29,7 @@ static partial void ModifyInnerBeastPvE(ref ActionSetting setting)

static partial void ModifyTomahawkPvE(ref ActionSetting setting)
{
setting.IsMeleeRange = true;
setting.SpecialType = SpecialActionType.MeleeRange;
}

static partial void ModifyUpheavalPvE(ref ActionSetting setting)
Expand All @@ -48,8 +50,8 @@ static partial void ModifySteelCyclonePvE(ref ActionSetting setting)
static partial void ModifyPrimalRendPvE(ref ActionSetting setting)
{
setting.StatusNeed = [StatusID.PrimalRendReady];
setting.SpecialType = SpecialActionType.MovingForward;
}
private sealed protected override IBaseAction TankStance => DefiancePvE;

static partial void ModifyInfuriatePvE(ref ActionSetting setting)
{
Expand Down Expand Up @@ -120,6 +122,11 @@ static partial void ModifyChaoticCyclonePvP(ref ActionSetting setting)
setting.StatusNeed = [StatusID.NascentChaos_1992];
}

static partial void ModifyOnslaughtPvE(ref ActionSetting setting)
{
setting.SpecialType = SpecialActionType.MovingForward;
}

/// <inheritdoc/>
protected override bool EmergencyAbility(IAction nextGCD, out IAction? act)
{
Expand Down

0 comments on commit baad8e5

Please sign in to comment.