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

Commit

Permalink
Merge branch 'main' into RDM
Browse files Browse the repository at this point in the history
  • Loading branch information
Taurenkey authored Jul 11, 2024
2 parents a52de31 + 63cbed4 commit 7b8f992
Show file tree
Hide file tree
Showing 18 changed files with 968 additions and 614 deletions.
378 changes: 225 additions & 153 deletions XIVSlothCombo/Combos/CustomComboPreset.cs

Large diffs are not rendered by default.

44 changes: 25 additions & 19 deletions XIVSlothCombo/Combos/JobHelpers/AST.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dalamud.Game.ClientState.JobGauge.Enums;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Plugin.Services;
using ECommons.DalamudServices;
using System.Collections.Generic;
using System.Linq;
using XIVSlothCombo.CustomComboNS.Functions;
Expand Down Expand Up @@ -50,6 +51,7 @@ public static void Invoke()
if (SelectedRandomMember is null || SelectedRandomMember.IsDead)
{
SetTarget();
Svc.Log.Debug($"Set card to {SelectedRandomMember.Name}");
}
}
else
Expand All @@ -68,21 +70,16 @@ private static bool SetTarget()
if (GetPartySlot(i) is not IBattleChara member) continue;
if (member is null) continue; //Skip nulls/disconnected people
if (member.IsDead) continue;
if (OutOfRange(Bole, member)) continue;
if (OutOfRange(Balance, member)) continue;

if (FindEffectOnMember(Buffs.BalanceDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.ArrowDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.BoleDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.EwerDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.SpireDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.SpearDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.BalanceBuff, member) is not null) continue;
if (FindEffectOnMember(Buffs.SpearBuff, member) is not null) continue;

if (Config.AST_QuickTarget_SkipDamageDown && TargetHasDamageDown(member)) continue;
if (Config.AST_QuickTarget_SkipRezWeakness && TargetHasRezWeakness(member)) continue;

PartyTargets.Add(member);
}

//The inevitable "0 targets found" because of debuffs
if (PartyTargets.Count == 0)
{
Expand All @@ -91,14 +88,10 @@ private static bool SetTarget()
if (GetPartySlot(i) is not IBattleChara member) continue;
if (member is null) continue; //Skip nulls/disconnected people
if (member.IsDead) continue;
if (OutOfRange(Bole, member)) continue;
if (OutOfRange(Balance, member)) continue;

if (FindEffectOnMember(Buffs.BalanceDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.ArrowDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.BoleDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.EwerDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.SpireDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.SpearDamage, member) is not null) continue;
if (FindEffectOnMember(Buffs.BalanceBuff, member) is not null) continue;
if (FindEffectOnMember(Buffs.SpearBuff, member) is not null) continue;

PartyTargets.Add(member);
}
Expand All @@ -121,22 +114,35 @@ private static bool SetTarget()
for (int i = 0; i <= PartyTargets.Count - 1; i++)
{
byte job = PartyTargets[i] is IBattleChara ? (byte)(PartyTargets[i] as IBattleChara).ClassJob.Id : (byte)0;
if (((cardDrawn is CardType.BALANCE or CardType.ARROW or CardType.SPEAR) && JobIDs.Melee.Contains(job)) ||
((cardDrawn is CardType.BOLE or CardType.EWER or CardType.SPIRE) && JobIDs.Ranged.Contains(job)))
if (((cardDrawn is CardType.BALANCE) && JobIDs.Melee.Contains(job)) ||
((cardDrawn is CardType.SPEAR) && JobIDs.Ranged.Contains(job)))
{
//TargetObject(PartyTargets[i]);
SelectedRandomMember = PartyTargets[i];
return true;
}
}
//Give card to unsuitable DPS next
for (int i = 0; i <= PartyTargets.Count - 1; i++)
{
byte job = PartyTargets[i] is IBattleChara ? (byte)(PartyTargets[i] as IBattleChara).ClassJob.Id : (byte)0;
if (((cardDrawn is CardType.BALANCE) && JobIDs.Ranged.Contains(job)) ||
((cardDrawn is CardType.SPEAR) && JobIDs.Melee.Contains(job)))
{
//TargetObject(PartyTargets[i]);
SelectedRandomMember = PartyTargets[i];
return true;
}
}

//Give cards to healers/tanks if backup is turned on
if (IsEnabled(CustomComboPreset.AST_Cards_QuickTargetCards_TargetExtra))
{
for (int i = 0; i <= PartyTargets.Count - 1; i++)
{
byte job = PartyTargets[i] is IBattleChara ? (byte)(PartyTargets[i] as IBattleChara).ClassJob.Id : (byte)0;
if ((cardDrawn is CardType.BALANCE or CardType.ARROW or CardType.SPEAR && JobIDs.Tank.Contains(job)) ||
(cardDrawn is CardType.BOLE or CardType.EWER or CardType.SPIRE && JobIDs.Healer.Contains(job)))
if ((cardDrawn is CardType.BALANCE && JobIDs.Tank.Contains(job)) ||
(cardDrawn is CardType.SPEAR && JobIDs.Healer.Contains(job)))
{
//TargetObject(PartyTargets[i]);
SelectedRandomMember = PartyTargets[i];
Expand Down
143 changes: 65 additions & 78 deletions XIVSlothCombo/Combos/PvE/AST.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Dalamud.Game.ClientState.JobGauge.Types;
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Game.ClientState.Statuses;
using System;
using ECommons.DalamudServices;
using System.Collections.Generic;
using System.Linq;
using XIVSlothCombo.Combos.PvE.Content;
Expand All @@ -26,22 +26,22 @@ internal const uint
FallMalefic = 25871,
Gravity = 3615,
Gravity2 = 25872,
Oracle = 37029,

//Cards
Draw = 3590,
Play = 17055,
Redraw = 3593,
//Obsolete? Left just incase it's needed
Balance = 4401,
Bole = 4404,
Arrow = 4402,
Spear = 4403,
Ewer = 4405,
Spire = 4406,
MinorArcana = 7443,
AstralDraw = 37017,
Play1 = 37019,
Play2 = 37020,
Play3 = 37021,
Arrow = 37024,
Balance = 37023,
Bole = 37027,
Ewer = 37028,
Spear = 37026,
Spire = 37025,
MinorArcana = 37022,
//LordOfCrowns = 7444,
//LadyOfCrown = 7445,
Astrodyne = 25870,

//Utility
Divination = 16552,
Expand Down Expand Up @@ -94,15 +94,16 @@ internal const ushort
EwerDrawn = 917,
SpireDrawn = 918,
//The actual buff that buffs players
BalanceDamage = 1882,
BoleDamage = 1883,
ArrowDamage = 1884,
SpearDamage = 1885,
EwerDamage = 1886,
SpireDamage = 1887,
BalanceBuff = 3887,
BoleBuff = 3890,
ArrowBuff = 3888,
SpearBuff = 3889,
EwerBuff = 3891,
SpireBuff = 3892,
Lightspeed = 841,
SelfSynastry = 845,
TargetSynastry = 846;
TargetSynastry = 846,
Divining = 3893;
}

internal static class Debuffs
Expand All @@ -128,9 +129,11 @@ internal static Dictionary<uint, ushort>
public static class Config
{
public static UserInt
AST_LucidDreaming = new("ASTLucidDreamingFeature"),
AST_EssentialDignity = new("ASTCustomEssentialDignity"),
AST_ST_SimpleHeals_Esuna = new("AST_ST_SimpleHeals_Esuna"),
AST_LucidDreaming = new("ASTLucidDreamingFeature", 8000),
AST_EssentialDignity = new("ASTCustomEssentialDignity", 50),
AST_Spire = new("AST_Spire", 80),
AST_Ewer = new("AST_Ewer", 80),
AST_ST_SimpleHeals_Esuna = new("AST_ST_SimpleHeals_Esuna", 100),
AST_DPS_AltMode = new("AST_DPS_AltMode"),
AST_DPS_DivinationOption = new("AST_DPS_DivinationOption"),
AST_DPS_LightSpeedOption = new("AST_DPS_LightSpeedOption"),
Expand All @@ -142,35 +145,14 @@ public static UserBool
AST_QuickTarget_SkipRezWeakness = new("AST_QuickTarget_SkipRezWeakness"),
AST_ST_SimpleHeals_Adv = new("AST_ST_SimpleHeals_Adv"),
AST_ST_SimpleHeals_UIMouseOver = new("AST_ST_SimpleHeals_UIMouseOver"),
AST_AoE_SimpleHeals_WeaveLady = new("AST_AoE_SimpleHeals_WeaveLady"),
AST_AoE_SimpleHeals_Opposition = new("AST_AoE_SimpleHeals_Opposition"),
AST_AoE_SimpleHeals_Horoscope = new("AST_AoE_SimpleHeals_Horoscope"),
AST_ST_DPS_CombustUptime_Adv = new("AST_ST_DPS_CombustUptime_Adv");
public static UserFloat
AST_ST_DPS_CombustUptime_Threshold = new("AST_ST_DPS_CombustUptime_Threshold");
}

internal class AST_Cards_DrawOnPlay : CustomCombo
{

protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.AST_Cards_DrawOnPlay;

protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level)
{
if (actionID is Play)
{
var haveCard = HasEffect(Buffs.BalanceDrawn) || HasEffect(Buffs.BoleDrawn) || HasEffect(Buffs.ArrowDrawn) || HasEffect(Buffs.SpearDrawn) || HasEffect(Buffs.EwerDrawn) || HasEffect(Buffs.SpireDrawn);
var cardDrawn = Gauge.DrawnCards[0];


if (haveCard)
{
return OriginalHook(Play);
}

return OriginalHook(Draw);
}

return actionID;
}
}

internal class AST_Benefic : CustomCombo
{
Expand All @@ -194,16 +176,15 @@ internal class AST_ST_DPS : CustomCombo

protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level)
{
int spellsSinceDraw = ActionWatching.CombatActions.Any(x => x == Draw) ? ActionWatching.HowManyTimesUsedAfterAnotherAction(OriginalHook(Malefic), Draw) +
ActionWatching.HowManyTimesUsedAfterAnotherAction(OriginalHook(Combust), Draw) +
ActionWatching.HowManyTimesUsedAfterAnotherAction(OriginalHook(Gravity), Draw) : Config.AST_ST_DPS_Play_SpeedSetting;
int spellsSinceDraw = ActionWatching.CombatActions.Any(x => x == OriginalHook(AstralDraw)) ? ActionWatching.HowManyTimesUsedAfterAnotherAction(OriginalHook(Malefic), OriginalHook(AstralDraw)) +
ActionWatching.HowManyTimesUsedAfterAnotherAction(OriginalHook(Combust), OriginalHook(AstralDraw)) +
ActionWatching.HowManyTimesUsedAfterAnotherAction(OriginalHook(Gravity), OriginalHook(AstralDraw)) : Config.AST_ST_DPS_Play_SpeedSetting;

if (spellsSinceDraw == 0 && DrawnCard != CardType.NONE)
{
spellsSinceDraw = 1;
}

//Dalamud.Logging.PluginLog.Debug($"{spellsSinceDraw}");
bool AlternateMode = GetIntOptionAsBool(Config.AST_DPS_AltMode); //(0 or 1 radio values)
if (((!AlternateMode && MaleficList.Contains(actionID)) ||
(AlternateMode && CombustList.ContainsKey(actionID)) ||
Expand Down Expand Up @@ -240,19 +221,18 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

//Play Card
if (IsEnabled(CustomComboPreset.AST_DPS_AutoPlay) &&
ActionReady(Play) &&
ActionReady(Play1) &&
Gauge.DrawnCards[0] is not CardType.NONE &&
CanSpellWeave(actionID) &&
spellsSinceDraw >= Config.AST_ST_DPS_Play_SpeedSetting &&
!WasLastAction(Redraw))
return OriginalHook(Play);
spellsSinceDraw >= Config.AST_ST_DPS_Play_SpeedSetting)
return OriginalHook(Play1);

//Card Draw
if (IsEnabled(CustomComboPreset.AST_DPS_AutoDraw) &&
ActionReady(Draw) &&
Gauge.DrawnCards[0] is CardType.NONE &&
ActionReady(OriginalHook(AstralDraw)) &&
Gauge.DrawnCards.All(x => x is CardType.NONE) &&
CanDelayedWeave(actionID))
return Draw;
return OriginalHook(AstralDraw);

//Divination
if (IsEnabled(CustomComboPreset.AST_DPS_Divination) &&
Expand All @@ -263,10 +243,15 @@ Gauge.DrawnCards[0] is CardType.NONE &&
ActionWatching.NumberOfGcdsUsed >= 3)
return Divination;

if (IsEnabled(CustomComboPreset.AST_DPS_Oracle) &&
HasEffect(Buffs.Divining) &&
CanSpellWeave(actionID))
return Oracle;

//Minor Arcana / Lord of Crowns
if (ActionReady(OriginalHook(MinorArcana)) &&
((IsEnabled(CustomComboPreset.AST_DPS_AutoCrownDraw) && Gauge.DrawnCrownCard is CardType.NONE) ||
(IsEnabled(CustomComboPreset.AST_DPS_LazyLord) && Gauge.DrawnCrownCard is CardType.LORD && HasBattleTarget())) &&
IsEnabled(CustomComboPreset.AST_DPS_LazyLord) && Gauge.DrawnCrownCard is CardType.LORD &&
HasBattleTarget() &&
CanDelayedWeave(actionID))
return OriginalHook(MinorArcana);

Expand Down Expand Up @@ -310,26 +295,30 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
{
if (actionID is AspectedHelios)
{
var canLady = (Config.AST_AoE_SimpleHeals_WeaveLady && CanSpellWeave(actionID)) || !Config.AST_AoE_SimpleHeals_WeaveLady;
var canHoroscope = (Config.AST_AoE_SimpleHeals_Horoscope && CanSpellWeave(actionID)) || !Config.AST_AoE_SimpleHeals_Horoscope;
var canOppose = (Config.AST_AoE_SimpleHeals_Opposition && CanSpellWeave(actionID)) || !Config.AST_AoE_SimpleHeals_Opposition;


//Level check to exit if we can't use
if (!LevelChecked(AspectedHelios))
return Helios;

if (IsEnabled(CustomComboPreset.AST_AoE_SimpleHeals_LazyLady) &&
ActionReady(MinorArcana) &&
InCombat() &&
Gauge.DrawnCrownCard is CardType.LADY
&& CanSpellWeave(actionID))
&& canLady)
return OriginalHook(MinorArcana);

if (IsEnabled(CustomComboPreset.AST_AoE_SimpleHeals_CelestialOpposition) &&
ActionReady(CelestialOpposition) &&
CanWeave(actionID))
canOppose)
return CelestialOpposition;

if (IsEnabled(CustomComboPreset.AST_AoE_SimpleHeals_Horoscope))
{
if (ActionReady(Horoscope) &&
CanSpellWeave(actionID))
canHoroscope)
return Horoscope;

if ((ActionReady(AspectedHelios) && !HasEffect(Buffs.AspectedHelios))
Expand All @@ -338,7 +327,7 @@ Gauge.DrawnCrownCard is CardType.LADY
return AspectedHelios;

if (HasEffect(Buffs.HoroscopeHelios) &&
CanSpellWeave(actionID))
canHoroscope)
return OriginalHook(Horoscope);
}

Expand All @@ -351,19 +340,6 @@ Gauge.DrawnCrownCard is CardType.LADY
}


internal class AST_Cards_RedrawStandalone : CustomCombo
{
protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.AST_Cards_RedrawStandalone;

protected override uint Invoke(uint actionID, uint lastComboActionID, float comboTime, byte level)
{
if (actionID is Draw && HasEffect(Buffs.ClarifyingDraw))
return Redraw;

return actionID;
}
}

internal class AST_ST_SimpleHeals : CustomCombo
{
protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.AST_ST_SimpleHeals;
Expand All @@ -389,6 +365,17 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim
return AspectedBenefic;
}

if ((IsEnabled(CustomComboPreset.AST_ST_SimpleHeals_Spire) &&
Gauge.DrawnCards[2] == CardType.SPIRE &&
GetTargetHPPercent(healTarget) <= Config.AST_Spire &&
CanSpellWeave(actionID))
||
(IsEnabled(CustomComboPreset.AST_ST_SimpleHeals_Ewer) &&
Gauge.DrawnCards[2] == CardType.EWER &&
GetTargetHPPercent(healTarget) <= Config.AST_Ewer &&
CanSpellWeave(actionID)))
return OriginalHook(Play3);

if (IsEnabled(CustomComboPreset.AST_ST_SimpleHeals_EssentialDignity) &&
ActionReady(EssentialDignity) &&
GetTargetHPPercent(healTarget) <= Config.AST_EssentialDignity &&
Expand Down
Loading

0 comments on commit 7b8f992

Please sign in to comment.