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

Commit

Permalink
fix: add burst ratio for party check.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Apr 5, 2023
1 parent a26d63d commit 8139b49
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 27 deletions.
3 changes: 2 additions & 1 deletion RotationSolver.Basic/Actions/BaseAction_BasicInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public partial class BaseAction : IBaseAction
/// <summary>
/// EnoughLevel for using.
/// </summary>
public bool EnoughLevel => Service.Player.Level >= _action.ClassJobLevel;
public bool EnoughLevel => Service.Player.Level >= Level;
public byte Level => _action.ClassJobLevel;
public string Name => _action.Name;

public string Description => string.Empty;
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Actions/BaseItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public bool IsEnabled

public bool EnoughLevel => true;

public byte Level => 0;

public unsafe bool IsCoolingDown => ActionManager.Instance()->IsRecastTimerActive(ActionType.Item, ID);

public BaseItem(uint row, uint a4 = 65535)
Expand Down
2 changes: 2 additions & 0 deletions RotationSolver.Basic/Actions/IAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ public interface IAction : ITexture
/// Player's level is enough for this action's usage.
/// </summary>
bool EnoughLevel { get; }

internal byte Level { get; }
}
33 changes: 33 additions & 0 deletions RotationSolver.Basic/DataCenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,42 @@ public static void SetSpecialType(SpecialCommandType specialType)

public static bool HasPet { get; set; }


public static unsafe bool HasCompanion => (IntPtr)Service.RawPlayer == IntPtr.Zero ? false :
(IntPtr)CharacterManager.Instance()->LookupBuddyByOwnerObject(Service.RawPlayer) != IntPtr.Zero;

public static float RatioOfMembersIn2minsBurst
{
get
{
byte burst = 0, count = 0;

foreach (var member in PartyMembers)
{
foreach (var burstInfo in StatusHelper.Burst2Mins)
{
if (burstInfo.jobs.Contains((ClassJobID)member.ClassJob.Id))
{
if (member.Level >= burstInfo.level)
{
var tar = burstInfo.isOnHostile
&& Service.TargetManager.Target is BattleChara b ? b
: Service.Player;
if (tar.HasStatus(false, burstInfo.status)
&& !tar.WillStatusEndGCD(0, 0, false, burstInfo.status))
{
burst++;
}
count++;
}
break;
}
}
}
return (float)burst / count;
}
}

#region HP
public static IEnumerable<float> PartyMembersHP { get; set; }
public static float PartyMembersMinHP { get; set; }
Expand Down
31 changes: 15 additions & 16 deletions RotationSolver.Basic/Helpers/StatusHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,31 @@ public static class StatusHelper
StatusID.AspectedBenefic, StatusID.Regen1, StatusID.Regen2, StatusID.Regen3
};

public static StatusID[] TankStanceStatus { get; } = new StatusID[]
internal static StatusID[] TankStanceStatus { get; } = new StatusID[]
{
StatusID.Grit, StatusID.RoyalGuard, StatusID.IronWill, StatusID.Defiance
};

public static StatusID[] NoNeedHealingStatus { get; } = new StatusID[]
internal static StatusID[] NoNeedHealingStatus { get; } = new StatusID[]
{
StatusID.Holmgang, StatusID.WillDead, StatusID.WalkingDead,
};

public static StatusID[] Burst2minsBuff { get; } = new StatusID[]
{
//StatusID.Divination,
StatusID.Brotherhood,
StatusID.BattleLitany,
StatusID.ArcaneCircle,
StatusID.BattleVoice,
//StatusID.TechnicalStepFinished,
StatusID.SearingLight,
StatusID.Embolden,
};

public static StatusID[] Burst2minsDeBuff { get; } = new StatusID[]
internal record Burst2MinsInfo( StatusID status, bool isOnHostile, byte level, params ClassJobID[] jobs);

internal static Burst2MinsInfo[] Burst2Mins { get; } = new Burst2MinsInfo[]
{
StatusID.ChainStratagem,
//StatusID.Mug,
//new Burst2MinsInfo(StatusID.Divination, false, AST_Base.Divination.Level, ClassJobID.Astrologian),
new Burst2MinsInfo(StatusID.ChainStratagem, true, SCH_Base.ChainStratagem.Level, ClassJobID.Scholar),
new Burst2MinsInfo(StatusID.Brotherhood, false, MNK_Base.Brotherhood.Level, ClassJobID.Monk),
new Burst2MinsInfo(StatusID.BattleLitany, false, DRG_Base.BattleLitany.Level, ClassJobID.Dragoon),
new Burst2MinsInfo(StatusID.ArcaneCircle, false, RPR_Base.ArcaneCircle.Level, ClassJobID.Reaper),
new Burst2MinsInfo(StatusID.BattleVoice, false, BRD_Base.BattleVoice.Level, ClassJobID.Bard),
//new Burst2MinsInfo(StatusID.TechnicalStepFinished, false, DNC_Base.TechnicalStep.Level, ClassJobID.Dancer),
new Burst2MinsInfo(StatusID.SearingLight, false, SMN_Base.SearingLight.Level, ClassJobID.Summoner),
new Burst2MinsInfo(StatusID.Embolden, false, RDM_Base.Embolden.Level, ClassJobID.RedMage),
//new Burst2MinsInfo(StatusID.Mug, true, NIN_Base.Mug.Level, ClassJobID.Ninja, ClassJobID.Rogue),
};

public static bool NeedHealing(this BattleChara p) => p.WillStatusEndGCD(2, 0, false, NoNeedHealingStatus);
Expand Down
11 changes: 2 additions & 9 deletions RotationSolver.Basic/Rotations/CustomRotation_OtherInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,8 @@ public abstract partial class CustomRotation
protected static IEnumerable<BattleChara> WeakenPeople => DataCenter.WeakenPeople;
protected static IEnumerable<BattleChara> DyingPeople => DataCenter.DyingPeople;

protected static byte CountOfMembersIn2minsBurst => (byte)(StatusHelper.Burst2minsBuff.Count(s =>
{
if (!Player.HasStatus(false, s)) return false;
return !Player.WillStatusEndGCD(0, 0, false, s);
}) + StatusHelper.Burst2minsDeBuff.Count(s =>
{
if (!Target.HasStatus(false, s)) return false;
return !Target.WillStatusEndGCD(0, 0, false, s);
}));
protected static float RatioOfMembersIn2minsBurst => DataCenter.RatioOfMembersIn2minsBurst;


/// <summary>
/// Whether the number of party members is 8.
Expand Down
3 changes: 2 additions & 1 deletion RotationSolver/UI/RotationConfigWindow_Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ private unsafe void DrawStatus()
ImGui.Text("Have Companion: " + DataCenter.HasCompanion.ToString());
ImGui.Text("Targetable: " + Service.Player.IsTargetable().ToString());


foreach (var status in Service.Player.StatusList)
{
var source = status.SourceId == Service.Player.ObjectId ? "You" : Service.ObjectTable.SearchById(status.SourceId) == null ? "None" : "Others";
Expand All @@ -69,6 +68,8 @@ private unsafe void DrawParty()
// }
//}

ImGui.Text("Party Burst Ratio: " + DataCenter.RatioOfMembersIn2minsBurst.ToString());

ImGui.Text("Party: " + DataCenter.PartyMembers.Count().ToString());
ImGui.Text("CanHealSingleAbility: " + DataCenter.CanHealSingleAbility.ToString());
ImGui.Text("CanHealSingleSpell: " + DataCenter.CanHealSingleSpell.ToString());
Expand Down

0 comments on commit 8139b49

Please sign in to comment.