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

Commit

Permalink
fix: fixed update actions in control window.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 29, 2023
1 parent 9609369 commit 227b7cd
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 36 deletions.
19 changes: 18 additions & 1 deletion Resources/AnimationLockTime.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@
"3574": 0.6,
"3576": 0.1,
"3577": 0.6,
"3590": 0.6,
"3593": 0.6,
"3595": 0.6,
"3596": 0.1,
"3606": 0.6,
"3608": 0.6,
"3610": 0.6,
"3612": 0.6,
"3614": 0.6,
"3615": 0.1,
"4401": 0.6,
"4402": 0.6,
"4403": 0.6,
"4404": 0.6,
"4406": 0.6,
"4868": 2.1,
"7386": 0.6,
"7387": 0.6,
Expand Down Expand Up @@ -57,10 +72,12 @@
"16524": 0.1,
"16525": 0.1,
"16527": 0.6,
"16552": 0.6,
"20243": 0.1,
"25751": 0.6,
"25752": 0.6,
"25753": 1.15,
"25796": 0.6,
"25797": 0.6
"25797": 0.6,
"25870": 0.6
}
87 changes: 53 additions & 34 deletions RotationSolver.Basic/Rotations/CustomRotation_Invoke.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,78 +13,97 @@ public bool TryInvoke(out IAction newAction, out IAction gcdAction)
{
return false;
}
var role = Job.GetJobRole();
UpdateActions(Job.GetJobRole());

ActionMoveForwardGCD = MoveForwardGCD(out var act) ? act : null;
UpdateInfo();

BaseAction.OtherOption = CanUseOption.IgnoreTarget | CanUseOption.EmptyOrSkipCombo | CanUseOption.IgnoreClippingCheck;
var movingTarget = MoveForwardAbility(out act);
BaseAction.OtherOption = CanUseOption.None;
try
{
newAction = Invoke(out gcdAction);
if (!IsValid) IsValid = true;
}
catch (Exception ex)
{
if(_lastException?.GetType() != ex.GetType())
{
PluginLog.Error(ex, $"Failed to invoke the next action in \"{GetType().FullName}\", please contact to the author.");
}
_lastException = ex;
IsValid = false;
}

ActionMoveForwardAbility = movingTarget ? act : null;
MoveTarget = (movingTarget && act is IBaseAction a) ? a.Target : null;
return newAction != null;
}

ActionMoveBackAbility = MoveBackAbility(out act) ? act : null;
private void UpdateActions(JobRole role)
{
BaseAction.OtherOption = CanUseOption.IgnoreTarget;

if(!DataCenter.HPNotFull && role == JobRole.Healer)
ActionMoveForwardGCD = MoveForwardGCD(out var act) ? act : null;

if (!DataCenter.HPNotFull && role == JobRole.Healer)
{
ActionHealAreaGCD = ActionHealAreaAbility = ActionHealSingleGCD = ActionHealSingleAbility = null;
}
else
{
ActionHealAreaGCD = HealAreaGCD(out act) ? act : null;
ActionHealAreaAbility = HealAreaAbility(out act) ? act : null;

ActionHealSingleGCD = HealSingleGCD(out act) ? act : null;

BaseAction.OtherOption |= CanUseOption.IgnoreClippingCheck;

ActionHealAreaAbility = HealAreaAbility(out act) ? act : null;
ActionHealSingleAbility = HealSingleAbility(out act) ? act : null;

BaseAction.OtherOption &= ~CanUseOption.IgnoreClippingCheck;
}

ActionDefenseAreaGCD = DefenseAreaGCD(out act) ? act : null;
ActionDefenseAreaAbility = DefenseAreaAbility(out act) ? act : null;

ActionDefenseSingleGCD = DefenseSingleGCD(out act) ? act : null;
ActionDefenseSingleAbility = DefenseSingleAbility(out act) ? act : null;

EsunaStanceNorthGCD = role switch
{
JobRole.Healer => DataCenter.WeakenPeople.Any() && Esuna.CanUse(out act, CanUseOption.MustUse) ? act : null,
_ => null,
};
EsunaStanceNorthAbility = role switch

RaiseShirkGCD = role switch
{
JobRole.Melee => TrueNorth.CanUse(out act) ? act : null,
JobRole.Tank => TankStance.CanUse(out act) ? act : null,
JobRole.Healer => DataCenter.DeathPeopleAll.Any() && Raise.CanUse(out act) ? act : null,
_ => null,
};
RaiseShirkGCD = role switch

BaseAction.OtherOption |= CanUseOption.IgnoreClippingCheck;

ActionDefenseAreaAbility = DefenseAreaAbility(out act) ? act : null;

ActionDefenseSingleAbility = DefenseSingleAbility(out act) ? act : null;


EsunaStanceNorthAbility = role switch
{
JobRole.Healer => DataCenter.DeathPeopleAll.Any() && Raise.CanUse(out act) ? act : null,
JobRole.Melee => TrueNorth.CanUse(out act) ? act : null,
JobRole.Tank => TankStance.CanUse(out act) ? act : null,
_ => null,
};

RaiseShirkAbility = role switch
{
JobRole.Tank => Shirk.CanUse(out act) ? act : null,
_ => null,
};
AntiKnockbackAbility = AntiKnockback(role, SpecialCommandType.AntiKnockback, out act) ? act : null;
UpdateInfo();

try
{
newAction = Invoke(out gcdAction);
if (!IsValid) IsValid = true;
}
catch (Exception ex)
{
if(_lastException?.GetType() != ex.GetType())
{
PluginLog.Error(ex, $"Failed to invoke the next action in \"{GetType().FullName}\", please contact to the author.");
}
_lastException = ex;
IsValid = false;
}
BaseAction.OtherOption |= CanUseOption.EmptyOrSkipCombo;

return newAction != null;
var movingTarget = MoveForwardAbility(out act);
ActionMoveForwardAbility = movingTarget ? act : null;
MoveTarget = (movingTarget && act is IBaseAction a) ? a.Target : null;

ActionMoveBackAbility = MoveBackAbility(out act) ? act : null;

BaseAction.OtherOption = CanUseOption.None;
}

private IAction Invoke(out IAction gcdAction)
Expand Down
2 changes: 1 addition & 1 deletion RotationSolver/Updaters/SocialUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static void DutyState_DutyStarted(object sender, ushort e)
if (!Service.Player.IsJobCategory(JobRole.Tank) && !Service.Player.IsJobCategory(JobRole.Healer)) return;

var territory = Service.GetSheet<TerritoryType>().GetRow(e);
//if (HighEndDuties.Any(t => t.RowId == territory.RowId))
if (HighEndDuties.Any(t => t.RowId == territory.RowId))
{
var str = territory.PlaceName?.Value?.Name.ToString() ?? "High-end Duty";
var message = string.Format(LocalizationManager.RightLang.HighEndWarning, str);
Expand Down

0 comments on commit 227b7cd

Please sign in to comment.