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

Commit

Permalink
War Beta with Nascent config
Browse files Browse the repository at this point in the history
  • Loading branch information
Tykku committed Apr 25, 2024
1 parent e415ed5 commit 286ee12
Show file tree
Hide file tree
Showing 2 changed files with 387 additions and 0 deletions.
196 changes: 196 additions & 0 deletions BasicRotations/Ranged/MCH_Beta.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
namespace DefaultRotations.Ranged;

[Rotation("Beta", CombatType.PvE, GameVersion = "6.58", Description = "THIS WILL DOUBLEWEAVE INSIDE OVERHEATED, THIS IS FOR TESTING PURPOSES ONLY USE THE DEFAULT")]
[SourceCode(Path = "main/DefaultRotations/Ranged/MCH_Beta.cs")]
[Api(1)]
public sealed class MCH_Beta : MachinistRotation
{
#region Config Options
[RotationConfig(CombatType.PvE, Name = "Uses Rook Autoturret/Automaton Queen immediately whenever you get 50 battery")]
public bool UseQueenWhenever { get; set; } = true;
#endregion

#region Countdown logic
// Defines logic for actions to take during the countdown before combat starts.
protected override IAction? CountDownAction(float remainTime)
{
if (remainTime < 5)
{
if (ReassemblePvE.CanUse(out var act)) return act;
}
if (remainTime < 2)
{
if (UseBurstMedicine(out var act)) return act;
}
return base.CountDownAction(remainTime);
}
#endregion

#region oGCD Logic
// Determines emergency actions to take based on the next planned GCD action.
protected override bool EmergencyAbility(IAction nextGCD, out IAction? act)
{
// Reassemble Logic
// Check next GCD action and conditions for Reassemble.
bool isReassembleUsable =
//Reassemble current # of charges and double proc protection
ReassemblePvE.Cooldown.CurrentCharges > 0 && !Player.HasStatus(true, StatusID.Reassembled) &&
//Chainsaw Level Check and NextGCD Check
((ChainSawPvE.EnoughLevel && nextGCD.IsTheSameTo(true, ChainSawPvE)) ||
//AirAnchor Logic
(AirAnchorPvE.EnoughLevel && nextGCD.IsTheSameTo(true, AirAnchorPvE)) ||
//Drill Logic
(DrillPvE.EnoughLevel && !ChainSawPvE.EnoughLevel && nextGCD.IsTheSameTo(true, DrillPvE)) ||
//Cleanshot Logic
(!DrillPvE.EnoughLevel && CleanShotPvE.EnoughLevel && nextGCD.IsTheSameTo(true, CleanShotPvE)) ||
//HotShot Logic
(!CleanShotPvE.EnoughLevel && nextGCD.IsTheSameTo(true, HotShotPvE)));

// Keeps Ricochet and Gauss cannon Even
bool isRicochetMore = (GaussRoundPvE.Cooldown.CurrentCharges <= RicochetPvE.Cooldown.CurrentCharges);
bool isGaussMore = (!RicochetPvE.EnoughLevel /*Check to use Gauss below lvl50 */ ||
(GaussRoundPvE.Cooldown.CurrentCharges > RicochetPvE.Cooldown.CurrentCharges));

// Attempt to use Reassemble if it's ready
if (isReassembleUsable)
{
if (ReassemblePvE.CanUse(out act, onLastAbility: true, skipClippingCheck: true, skipComboCheck: true, usedUp: true)) return true;
}
// Use Ricochet
if (isRicochetMore && (/*(!IsLastAction(true, GaussRoundPvE) && !IsLastAction(true, RicochetPvE) && */Player.HasStatus(true, StatusID.Overheated)) || !Player.HasStatus(true, StatusID.Overheated))/*)*/

{
return RicochetPvE.CanUse(out act, skipAoeCheck: true, usedUp: true);
}
// Use Gause
if (isGaussMore && (/*(!IsLastAction(true, GaussRoundPvE) && !IsLastAction(true, RicochetPvE) && */Player.HasStatus(true, StatusID.Overheated)) || !Player.HasStatus(true, StatusID.Overheated))/*)*/
{
return GaussRoundPvE.CanUse(out act, usedUp: true);
}
return base.EmergencyAbility(nextGCD, out act);
}

// Logic for using attack abilities outside of GCD, focusing on burst windows and cooldown management.
protected override bool AttackAbility(IAction nextGCD, out IAction? act)
{
// Define conditions under which the Rook Autoturret/Queen can be used.
bool OpenerQueen = !CombatElapsedLess(20f) && CombatElapsedLess(25f);
bool CombatTimeQueen = CombatElapsedLess(60f) && !CombatElapsedLess(45f);
bool WildfireCooldownQueen = WildfirePvE.Cooldown.IsCoolingDown && WildfirePvE.Cooldown.ElapsedAfter(105f) && Battery == 100 &&
(nextGCD.IsTheSameTo(true, AirAnchorPvE) || nextGCD.IsTheSameTo(true, CleanShotPvE)) || nextGCD.IsTheSameTo(true, HeatedCleanShotPvE) || nextGCD.IsTheSameTo(true, ChainSawPvE);
bool BatteryCheckQueen = Battery >= 90 && !WildfirePvE.Cooldown.ElapsedAfter(70f);
bool LastGCDCheckQueen = Battery >= 80 && !WildfirePvE.Cooldown.ElapsedAfter(77.5f) && IsLastGCD(true, AirAnchorPvE);

// If Wildfire is active, use Hypercharge.....Period
if (Player.HasStatus(true, StatusID.Wildfire_1946))
{
return HyperchargePvE.CanUse(out act, skipClippingCheck: true);
}
// Burst
if (IsBurst)
{
if (UseBurstMedicine(out act)) return true;

{
if ((IsLastAbility(false, HyperchargePvE) || Heat >= 50) && !CombatElapsedLess(10) && CanUseHyperchargePvE(out _)
&& WildfirePvE.CanUse(out act, onLastAbility: true, skipComboCheck: true)) return true;
}
}
// Use Hypercharge if at least 12 seconds of combat and (if wildfire will not be up in 30 seconds or if you hit 100 heat)
if (!CombatElapsedLess(12) && !Player.HasStatus(true, StatusID.Reassembled) && (!WildfirePvE.Cooldown.WillHaveOneCharge(30) || (Heat == 100)))
{
if (CanUseHyperchargePvE(out act)) return true;
}
// Rook Autoturret/Queen Logic toggle on
if (UseQueenWhenever && (OpenerQueen || CombatTimeQueen || WildfireCooldownQueen || BatteryCheckQueen || LastGCDCheckQueen))
{
return RookAutoturretPvE.CanUse(out act, skipComboCheck: true);
}
// Rook Autoturret/Queen Logic toggle off
if (!UseQueenWhenever)
{
return RookAutoturretPvE.CanUse(out act, skipComboCheck: true);
}
// Use Barrel Stabilizer on CD if won't cap
if (BarrelStabilizerPvE.CanUse(out act)) return true;

return base.AttackAbility(nextGCD, out act);
}
#endregion

#region GCD Logic
// Defines the general logic for determining which global cooldown (GCD) action to take.
protected override bool GeneralGCD(out IAction? act)
{
// Checks and executes AutoCrossbow or HeatBlast if conditions are met (overheated state).
if (AutoCrossbowPvE.CanUse(out act)) return true;
if (HeatBlastPvE.CanUse(out act)) return true;

// Executes Bioblaster, and then checks for AirAnchor or HotShot, and Drill based on availability and conditions.
if (BioblasterPvE.CanUse(out act)) return true;
// Check if SpreadShot cannot be used
if (!SpreadShotPvE.CanUse(out _))
{
// Check if AirAnchor can be used
if (AirAnchorPvE.CanUse(out act)) return true;

// If not at the required level for AirAnchor and HotShot can be used
if (!AirAnchorPvE.EnoughLevel && HotShotPvE.CanUse(out act)) return true;

// Check if Drill can be used
if (DrillPvE.CanUse(out act)) return true;
}

// Special condition for using ChainSaw outside of AoE checks if no action is chosen within 4 GCDs.
if (!CombatElapsedLessGCD(4) && ChainSawPvE.CanUse(out act, skipAoeCheck: true)) return true;

// AoE actions: ChainSaw and SpreadShot based on their usability.
if (SpreadShotPvE.CanUse(out _))
{
if (ChainSawPvE.CanUse(out act)) return true;
}
if (SpreadShotPvE.CanUse(out act)) return true;

// Single target actions: CleanShot, SlugShot, and SplitShot based on their usability.
if (CleanShotPvE.CanUse(out act)) return true;
if (SlugShotPvE.CanUse(out act)) return true;
if (SplitShotPvE.CanUse(out act)) return true;

return base.GeneralGCD(out act);
}
#endregion

#region Extra Methods
// Extra private helper methods for determining the usability of specific abilities under certain conditions.
// These methods simplify the main logic by encapsulating specific checks related to abilities' cooldowns and prerequisites.
// Logic for Hypercharge
private bool CanUseHyperchargePvE(out IAction? act)
{
float REST_TIME = 6f;
if
//Cannot AOE
((!SpreadShotPvE.CanUse(out _))
&&
// AirAnchor Enough Level % AirAnchor
((AirAnchorPvE.EnoughLevel && AirAnchorPvE.Cooldown.WillHaveOneCharge(REST_TIME))
||
// HotShot Charge Detection
(!AirAnchorPvE.EnoughLevel && HotShotPvE.EnoughLevel && HotShotPvE.Cooldown.WillHaveOneCharge(REST_TIME))
||
// Drill Charge Detection
(DrillPvE.EnoughLevel && DrillPvE.Cooldown.WillHaveOneCharge(REST_TIME))
||
// Chainsaw Charge Detection
(ChainSawPvE.EnoughLevel && ChainSawPvE.Cooldown.WillHaveOneCharge(REST_TIME))))
{
act = null;
return false;
}
else
{
// Use Hypercharge
return HyperchargePvE.CanUse(out act);
}
}
#endregion
}
191 changes: 191 additions & 0 deletions BasicRotations/Tank/WAR_Beta.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
namespace DefaultRotations.Tank;

[Rotation("Default", CombatType.PvE, GameVersion = "6.58")]
[SourceCode(Path = "main/DefaultRotations/Tank/WAR_Beta.cs")]
[Api(1)]
public sealed class WAR_Beta : WarriorRotation
{
#region Config Options
[RotationConfig(CombatType.PvE, Name = "Only use Nascent Flash if Tank Stance is off")]
public bool NeverscentFlash { get; set; } = true;
#endregion

#region Countdown Logic
protected override IAction? CountDownAction(float remainTime)
{
if (remainTime <= CountDownAhead)
{
if (HasTankStance)
{
if (ProvokePvE.CanUse(out var act)) return act;
}
else
{
if (TomahawkPvE.CanUse(out var act)) return act;
}
}
return base.CountDownAction(remainTime);
}
#endregion

#region oGCD Logic
protected override bool AttackAbility(IAction nextGCD, out IAction? act)
{
// If Infuriate can be used, use it and return true.
if (InfuriatePvE.CanUse(out act, gcdCountForAbility: 3)) return true;

// If less than one global cooldown (GCD) has passed in combat, don't use any abilities.
if (CombatElapsedLessGCD(1)) return false;

// If a burst medicine can be used, use it and return true.
if (UseBurstMedicine(out act)) return true;

// If the player has the Surging Tempest status and it will not end in the next 6 GCDs, or if the player does not have a high enough level for Mythril Tempest, use Berserk.
if (Player.HasStatus(false, StatusID.SurgingTempest)
&& !Player.WillStatusEndGCD(6, 0, true, StatusID.SurgingTempest)
|| !MythrilTempestPvE.EnoughLevel)
{
if (BerserkPvE.CanUse(out act, onLastAbility: true)) return true;
}

// If the player is in a burst status, use Infuriate.
if (IsBurstStatus)
{
if (InfuriatePvE.CanUse(out act, usedUp: true)) return true;
}

// If less than four GCDs have passed in combat, don't use any abilities.
if (CombatElapsedLessGCD(4)) return false;

// If Orogeny can be used, use it and return true.
if (OrogenyPvE.CanUse(out act)) return true;

// If Upheaval can be used, use it and return true.
if (UpheavalPvE.CanUse(out act)) return true;

// If Onslaught can be used and the player is not moving, use it and return true.
if (OnslaughtPvE.CanUse(out act, usedUp: IsBurstStatus) && !IsMoving) return true;

// If the player's status includes moving forward and a move forward ability can be used, use it and return true.
if (MergedStatus.HasFlag(AutoStatus.MoveForward) && MoveForwardAbility(nextGCD, out act)) return true;
return base.AttackAbility(nextGCD, out act);
}


protected override bool GeneralAbility(IAction nextGCD, out IAction? act)
{
// Initialize the action to null.
act = null;

// If the player's health ratio is less than 0.6 (60%), consider using healing abilities.
if (Player.GetHealthRatio() < 0.6f)
{
// If Thrill of Battle can be used, use it and return true.
if (ThrillOfBattlePvE.CanUse(out act)) return true;

// If Equilibrium can be used, use it and return true.
if (EquilibriumPvE.CanUse(out act)) return true;
}
return base.GeneralAbility(nextGCD, out act);
}

[RotationDesc(ActionID.RawIntuitionPvE, ActionID.VengeancePvE, ActionID.RampartPvE, ActionID.RawIntuitionPvE, ActionID.ReprisalPvE)]
// This method is responsible for determining the defensive abilities to use in a single-target situation.
protected override bool DefenseSingleAbility(IAction nextGCD, out IAction? act)
{
act = null;

// If the player currently has the Holmgang status and their health ratio is less than 0.3 (30%), don't use any defensive abilities.
if (Player.HasStatus(true, StatusID.Holmgang_409) && Player.GetHealthRatio() < 0.3f) return false;

// If Raw Intuition can be used and there are more than 2 hostiles in range, use it.
if (RawIntuitionPvE.CanUse(out act, onLastAbility: true) && NumberOfHostilesInRange > 2) return true;

// If the player's Bloodwhetting or Raw Intuition status will not end in the next GCD, don't use any defensive abilities.
if (!Player.WillStatusEndGCD(0, 0, true, StatusID.Bloodwhetting, StatusID.RawIntuition)) return false;

// If Reprisal can be used, use it.
if (ReprisalPvE.CanUse(out act, skipAoeCheck: true, onLastAbility: true)) return true;

// If Rampart is not cooling down or has been cooling down for more than 60 seconds, and Vengeance can be used, use Vengeance.
if ((!RampartPvE.Cooldown.IsCoolingDown || RampartPvE.Cooldown.ElapsedAfter(60)) && VengeancePvE.CanUse(out act)) return true;

// If Vengeance is cooling down and has been cooling down for more than 60 seconds, or if Vengeance is not at a high enough level, and Rampart can be used, use Rampart.
if (((VengeancePvE.Cooldown.IsCoolingDown && VengeancePvE.Cooldown.ElapsedAfter(60)) || !VengeancePvE.EnoughLevel) && RampartPvE.CanUse(out act)) return true;


return base.DefenseAreaAbility(nextGCD, out act);
}

[RotationDesc(ActionID.ShakeItOffPvE, ActionID.ReprisalPvE)]
protected override bool DefenseAreaAbility(IAction nextGCD, out IAction? act)
{
// Initialize the action to null.
act = null;

// If Shake It Off is cooling down and won't have a charge in the next 60 seconds, or if Reprisal is cooling down and won't have a charge in the next 50 seconds, don't use any defensive abilities.
if (ShakeItOffPvE.Cooldown.IsCoolingDown && !ShakeItOffPvE.Cooldown.WillHaveOneCharge(60)
|| ReprisalPvE.Cooldown.IsCoolingDown && !ReprisalPvE.Cooldown.WillHaveOneCharge(50)) return false;

// If Shake It Off can be used, use it.
if (ShakeItOffPvE.CanUse(out act, skipAoeCheck: true)) return true;

return base.DefenseAreaAbility(nextGCD, out act);
}
#endregion

#region GCD Logic
protected override bool GeneralGCD(out IAction? act)
{
// If the player's Surging Tempest status will not end in the next 3 GCDs, consider using certain abilities.
if (!Player.WillStatusEndGCD(3, 0, true, StatusID.SurgingTempest))
{
// If the player is not moving, is in a burst status, and Primal Rend can be used on a target within a distance of 1, use Primal Rend.
if (!IsMoving && IsBurstStatus && PrimalRendPvE.CanUse(out act, skipAoeCheck: true))
{
if (PrimalRendPvE.Target.Target?.DistanceToPlayer() < 1) return true;
}
// If the player is in a burst status, does not have the Nascent Chaos status, or has a Beast Gauge greater than 80, consider using Steel Cyclone or Inner Beast.
if (IsBurstStatus || !Player.HasStatus(false, StatusID.NascentChaos) || BeastGauge > 80)
{
if (SteelCyclonePvE.CanUse(out act)) return true;
if (InnerBeastPvE.CanUse(out act)) return true;
}
}

// If any of the following abilities can be used, use them and return true.
if (MythrilTempestPvE.CanUse(out act)) return true;
if (OverpowerPvE.CanUse(out act)) return true;
if (StormsEyePvE.CanUse(out act)) return true;
if (StormsPathPvE.CanUse(out act)) return true;
if (MaimPvE.CanUse(out act)) return true;
if (HeavySwingPvE.CanUse(out act)) return true;

// If Tomahawk can be used, use it and return true.
if (TomahawkPvE.CanUse(out act)) return true;

return base.GeneralGCD(out act);
}

[RotationDesc(ActionID.NascentFlashPvE)]
protected override bool HealSingleGCD(out IAction? act)
{
// Initialize the action to null.
act = null;

// If Nascent Flash can be used and the player is in combat and the target's health ratio is less than 0.6, use Nascent Flash.
// This means Nascent Flash is used when the player is in combat and the target is at 60% health or less.
if (!NeverscentFlash && NascentFlashPvE.CanUse(out act)
&& (InCombat && NascentFlashPvE.Target.Target?.GetHealthRatio() < 0.6)) return true;

if (NeverscentFlash && NascentFlashPvE.CanUse(out act)
&& (InCombat && !Player.HasStatus(true, StatusID.Defiance) && NascentFlashPvE.Target.Target?.GetHealthRatio() < 0.6)) return true;

return base.HealSingleGCD(out act);
}
#endregion

#region Extra Methods
private static bool IsBurstStatus => !Player.WillStatusEndGCD(0, 0, false, StatusID.InnerStrength);
#endregion
}

0 comments on commit 286ee12

Please sign in to comment.