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

Commit

Permalink
fix: changed auto defense on tank lockon.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Nov 11, 2023
1 parent bd25676 commit bb6773a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
3 changes: 3 additions & 0 deletions Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@
"3615": 0.1,
"3625": 0.6,
"3629": 0.6,
"3634": 0.6,
"3636": 0.6,
"3639": 0.6,
"3640": 0.6,
"3643": 0.6,
Expand Down Expand Up @@ -522,6 +524,7 @@
"25751": 0.6,
"25752": 0.6,
"25753": 1.15,
"25754": 0.6,
"25755": 0.6,
"25757": 0.6,
"25758": 0.6,
Expand Down
2 changes: 1 addition & 1 deletion Resources/RotationSolverRecord.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ClickingCount": 58323,
"ClickingCount": 58414,
"SayingHelloCount": 2,
"SaidUsers": []
}
15 changes: 6 additions & 9 deletions RotationSolver.Basic/Actions/BaseAction_ActionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ public partial class BaseAction
/// </summary>
public float AutoHealRatio
{
get
{
return OtherConfiguration.ActionHealRatio.TryGetValue(ID, out var ratio)
get => OtherConfiguration.ActionHealRatio.TryGetValue(ID, out var ratio)
? ratio : 1;
}
set
{
OtherConfiguration.ActionHealRatio[ID] = value;
Expand Down Expand Up @@ -93,17 +90,17 @@ public unsafe virtual bool CanUse(out IAction act, CanUseOption option = CanUseO
{
act = this;

if (!IsOnSlot) return false;
if (!SkipDisable && !IsEnabled) return false;
var player = Player.Object;
if (player == null) return false;

option |= OtherOption;
var mustUse = option.HasFlag(CanUseOption.MustUse);

var player = Player.Object;
if (player == null) return false;
Target = player;
AffectedTargets = Array.Empty<BattleChara>();

if (!IsOnSlot) return false;
if (!SkipDisable && !IsEnabled) return false;

if (AutoHealCheck && IsFriendly)
{
if (IsSingleTarget)
Expand Down
4 changes: 2 additions & 2 deletions RotationSolver.Basic/Rotations/CustomRotation_Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private bool AutoDefense(JobRole role, bool helpDefenseAOE, bool helpDefenseSing
}

//Defense himself.
if (role == JobRole.Tank && HasTankStance)
if (role == JobRole.Tank)
{
var movingHere = (float)NumberOfHostilesInRange / NumberOfHostilesInMaxRange > 0.3f;

Expand All @@ -220,7 +220,7 @@ private bool AutoDefense(JobRole role, bool helpDefenseAOE, bool helpDefenseSing
}

//Big damage casting action.
if (tarOnMeCount == 1 && DataCenter.IsHostileCastingToTank)
if (DataCenter.IsHostileCastingToTank)
{
if (DefenseSingleAbility(out act)) return true;
}
Expand Down
15 changes: 11 additions & 4 deletions RotationSolver/Updaters/TargetUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,29 @@ private static unsafe uint[] GetEnemies()

private static bool IsCastingTankVfx()
{
return IsCastingVfx(s => s.StartsWith("vfx/lockon/eff/tank_lockon"));
return IsCastingVfx(s =>
{
if (!s.Path.StartsWith("vfx/lockon/eff/tank_lockon")) return false;
if (!Player.Available) return false;
if (Player.Object.IsJobCategory(JobRole.Tank) && s.ObjectId != Player.Object.ObjectId) return false;

return true;
});
}

private static bool IsCastingAreaVfx()
{
return IsCastingVfx(s => s.StartsWith("vfx/lockon/eff/com_share"));
return IsCastingVfx(s => s.Path.StartsWith("vfx/lockon/eff/com_share"));
}

private static bool IsCastingVfx(Func<string, bool> isVfx)
private static bool IsCastingVfx(Func<VfxNewData, bool> isVfx)
{
if (isVfx == null) return false;
foreach (var item in DataCenter.VfxNewData.Reverse())
{
if (item.TimeDuration.TotalSeconds is > 1 and < 5)
{
if (isVfx(item.Path)) return true;
if (isVfx(item)) return true;
}
}
return false;
Expand Down

0 comments on commit bb6773a

Please sign in to comment.