Skip to content

Commit

Permalink
Merge pull request #475 from kaedys/feature/sam-auto-aoe
Browse files Browse the repository at this point in the history
[SAM] Auto-AoE
  • Loading branch information
MKhayle authored Dec 5, 2024
2 parents 9e73c47 + bc2178c commit 0a28acc
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 40 deletions.
97 changes: 63 additions & 34 deletions XIVComboExpanded/Combos/SAM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,23 @@ public const uint
Fuko = 25780,
// Iaijutsu and Tsubame
Iaijutsu = 7867,
TsubameGaeshi = 16483,
MidareSetsugekka = 7487,
TenkaGoken = 7488,
Higanbana = 7489,
TsubameGaeshi = 16483,
KaeshiGoken = 16485,
KaeshiSetsugekka = 16486,
TendoGoken = 36965,
TendoSetsugekka = 36966,
TendoKaeshiGoken = 36967,
TendoKaeshiSetsugekka = 36968,
Shoha = 16487,
// Misc
HissatsuShinten = 7490,
HissatsuKyuten = 7491,
HissatsuSenei = 16481,
HissatsuGuren = 7496,
Ikishoten = 16482,
// Shoha2 = 25779,
Shoha = 16487,
OgiNamikiri = 25781,
KaeshiNamikiri = 25782,
Zanshin = 36964;
Expand All @@ -47,8 +50,8 @@ public static class Buffs
public const ushort
MeikyoShisui = 1233,
EyesOpen = 1252,
Jinpu = 1298,
Shifu = 1299,
Fugetsu = 1298, // From Jinpu and Mangetsu
Fuka = 1299, // From Shifu and Oka
OgiNamikiriReady = 2959,
ZanshinReady = 3855;
}
Expand All @@ -63,23 +66,32 @@ public static class Levels
{
public const byte
Jinpu = 4,
Enpi = 15,
Shifu = 18,
Fuga = 26,
Gekko = 30,
Higanbana = 30,
Mangetsu = 35,
Kasha = 40,
TenkaGoken = 40,
Oka = 45,
Yukikaze = 50,
MeikyoShisui = 50,
MidareSetsugekka = 50,
HissatsuShinten = 52,
HissatsuGyoten = 54,
HissatsuYaten = 56,
HissatsuKyuten = 64,
Ikishoten = 68,
HissatsuGuren = 70,
HissatsuSenei = 72,
TsubameGaeshi = 74,
Shoha = 80,
// Shoha2 = 82,
Hyosetsu = 86,
Fuko = 86,
OgiNamikiri = 90,
Zanshin = 96;
Zanshin = 96,
Tendo = 100;
}
}

Expand Down Expand Up @@ -160,42 +172,59 @@ protected override uint Invoke(uint actionID, uint lastComboMove, float comboTim

internal class SamuraiMangetsu : CustomCombo
{
protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.SamuraiMangetsuCombo;
protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.SamuraiAoECombo;

protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level)
{
if (actionID == SAM.Mangetsu)
if (actionID == SAM.Mangetsu || actionID == SAM.Oka)
{
if (level >= SAM.Levels.Mangetsu && level < SAM.Levels.Oka)
return SAM.Mangetsu;

if (level > SAM.Levels.Fuga && level < SAM.Levels.Mangetsu)
return SAM.Fuga;

var iaijutsu = OriginalHook(SAM.Iaijutsu);
var tsubame = OriginalHook(SAM.TsubameGaeshi);

if (level >= SAM.Levels.TsubameGaeshi && IsEnabled(CustomComboPreset.SamuraiAutoAoEFinaleFeature) &&
IsEnabled(CustomComboPreset.SamuraiIaijutsuTsubameGaeshiFeature) &&
(tsubame == SAM.KaeshiGoken || tsubame == SAM.TendoKaeshiGoken))
return tsubame;

if (level >= SAM.Levels.TenkaGoken && IsEnabled(CustomComboPreset.SamuraiAutoAoEFinaleFeature) &&
(iaijutsu == SAM.TenkaGoken || iaijutsu == SAM.TendoGoken))
return iaijutsu;

var gauge = GetJobGauge<SAMGauge>();
var fuka = FindEffect(SAM.Buffs.Fuka);
var fukaTime = fuka != null ? fuka.RemainingTime : 0;
var fugetsu = FindEffect(SAM.Buffs.Fugetsu);
var fugetsuTime = fugetsu != null ? fugetsu.RemainingTime : 0;

if ((level >= SAM.Levels.Oka && (lastComboMove == SAM.Fuga || lastComboMove == SAM.Fuko)) ||
(level >= SAM.Levels.MeikyoShisui && HasEffect(SAM.Buffs.MeikyoShisui)))
{
if (level >= SAM.Levels.MeikyoShisui && HasEffect(SAM.Buffs.MeikyoShisui))
return SAM.Mangetsu;
if (IsEnabled(CustomComboPreset.SamuraiAutoAoEFeature) && actionID == SAM.Mangetsu &&
gauge.HasGetsu && !gauge.HasKa)
return SAM.Oka;

if ((lastComboMove == SAM.Fuga || lastComboMove == SAM.Fuko) && level >= SAM.Levels.Mangetsu)
if (IsEnabled(CustomComboPreset.SamuraiAutoAoEFeature) && actionID == SAM.Oka &&
!gauge.HasGetsu && gauge.HasKa)
return SAM.Mangetsu;

// Fuko
return OriginalHook(SAM.Fuga);
}

return actionID;
}
}

internal class SamuraiOka : CustomCombo
{
protected internal override CustomComboPreset Preset { get; } = CustomComboPreset.SamuraiOkaCombo;
if (IsEnabled(CustomComboPreset.SamuraiAutoAoEBuffFeature) && actionID == SAM.Mangetsu &&
(gauge.HasGetsu == gauge.HasKa) && fukaTime < fugetsuTime)
return SAM.Oka;

protected override uint Invoke(uint actionID, uint lastComboMove, float comboTime, byte level)
{
if (actionID == SAM.Oka)
{
if (level >= SAM.Levels.MeikyoShisui && HasEffect(SAM.Buffs.MeikyoShisui))
return SAM.Oka;

if ((lastComboMove == SAM.Fuga || lastComboMove == SAM.Fuko) && level >= SAM.Levels.Oka)
return SAM.Oka;
if (IsEnabled(CustomComboPreset.SamuraiAutoAoEBuffFeature) && actionID == SAM.Oka &&
(gauge.HasGetsu == gauge.HasKa) && fugetsuTime < fukaTime)
return SAM.Mangetsu;

// Fuko
return OriginalHook(SAM.Fuga);
return actionID;
}

return OriginalHook(SAM.Fuga);
}

return actionID;
Expand Down
27 changes: 21 additions & 6 deletions XIVComboExpanded/CustomComboPreset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2077,15 +2077,30 @@ public enum CustomComboPreset
[CustomComboInfo("Kasha Combo Option", "Start the Kasha combo chain with Shifu instead of Hakaze.", SAM.JobID)]
SamuraiKashaOption = 3417,

[IconsCombo([SAM.Mangetsu, UTL.ArrowLeft, SAM.Fuga])]
[IconsCombo([SAM.Mangetsu, SAM.Oka, UTL.ArrowLeft, SAM.Fuga, SAM.Fuko])]
[SectionCombo("Area of Effect")]
[CustomComboInfo("Mangetsu Combo", "Replace Mangetsu with its combo chain.", SAM.JobID)]
SamuraiMangetsuCombo = 3404,
[CustomComboInfo("Oka/Mangetsu Combo", "Replace Oka and Mangetsu with their combo chain.", SAM.JobID)]
SamuraiAoECombo = 3404,

[IconsCombo([SAM.Oka, UTL.ArrowLeft, SAM.Fuga])]
[IconsCombo([SAM.Oka, SAM.Mangetsu, UTL.Blank, UTL.Blank2, UTL.Idea])]
[SectionCombo("Area of Effect")]
[CustomComboInfo("Oka Combo", "Replace Oka with its combo chain.", SAM.JobID)]
SamuraiOkaCombo = 3405,
[AccessibilityCustomCombo]
[CustomComboInfo("Auto-AoE", "Replace Oka and Mangetsu with whichever one you don't have the Sen for yet. If you have both or neither Sen, neither one will be replaced.", SAM.JobID)]
SamuraiAutoAoEFeature = 3423,

[IconsCombo([SAM.Oka, SAM.Mangetsu, UTL.Blank, SAM.Buffs.Fugetsu, SAM.Buffs.Fuka])]
[SectionCombo("Area of Effect")]
[AccessibilityCustomCombo]
[ParentCombo(SamuraiAutoAoEFeature)]
[CustomComboInfo("Auto-AoE Buff Upkeep", "Also replace Oka and Mangetsu with each other in order to upkeep the buffs they apply, provided you either have neither of the two Sen, or already have both. When you have neither or both of the Sen, both Oka and Mangetsu will be replaced with whichever one grants the buff that currently has the shortest duration on you (or is currently absent). If both buffs are absent, neither ability will be replaced", SAM.JobID)]
SamuraiAutoAoEBuffFeature = 3424,

[IconsCombo([SAM.Oka, SAM.Mangetsu, UTL.ArrowLeft, SAM.TenkaGoken, SAM.TendoGoken])]
[SectionCombo("Area of Effect")]
[AccessibilityCustomCombo]
[ParentCombo(SamuraiAutoAoEFeature)]
[CustomComboInfo("Auto-AoE Goken Finale", "Also replace Oka and Mangetsu with Iaijutsu (Tenka Goken) when you have both Sen. Obeys the 'Iaijutsu to Tsubame-gaeshi' feature as well: if that feature is enabled, this will also include the follow-up Kaeshi: Goken when available.", SAM.JobID)]
SamuraiAutoAoEFinaleFeature = 3425,

[IconsCombo([SAM.Iaijutsu, UTL.ArrowLeft, SAM.TsubameGaeshi])]
[SectionCombo("Iaijutsu")]
Expand Down

0 comments on commit 0a28acc

Please sign in to comment.