Skip to content

Commit

Permalink
Merge branch 'awgil:master' into lab
Browse files Browse the repository at this point in the history
  • Loading branch information
Akechi-kun authored Feb 2, 2025
2 parents 2a1d69e + c6a8eef commit 6ebb246
Show file tree
Hide file tree
Showing 33 changed files with 420 additions and 395 deletions.
5 changes: 3 additions & 2 deletions BossMod/ActionQueue/Casters/BLM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ public enum TraitID : uint
public enum SID : uint
{
None = 0,
LucidDreaming = 1204, // applied by Lucid Dreaming to self
Swiftcast = 167, // applied by Swiftcast to self
Manaward = 168, // applied by Manaward to self
Thunder = 161, // applied by Thunder to target
ThunderII = 162, // applied by Thunder II to target
Expand All @@ -101,6 +99,9 @@ public enum SID : uint

//Shared
Addle = ClassShared.SID.Addle, // applied by Addle to target
Surecast = ClassShared.SID.Surecast, // applied by Surecast to self
LucidDreaming = ClassShared.SID.LucidDreaming, // applied by Lucid Dreaming to self
Swiftcast = ClassShared.SID.Swiftcast, // applied by Swiftcast to self
}

public sealed class Definitions : IDisposable
Expand Down
5 changes: 4 additions & 1 deletion BossMod/ActionQueue/Casters/PCT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public enum SID : uint
Aetherhues = 3675, // applied by Fire in Red, Fire II in Red, Blizzard II in Cyan, Blizzard in Cyan to self
AetherhuesII = 3676, // applied by Aero in Green, Aero II in Green, Stone in Yellow to self
TemperaCoat = 3686, // applied by Tempera Coat to self
Swiftcast = 167, // applied by Swiftcast to self
TemperaGrassa = 3687, // applied by Tempera Grassa to self
Smudge = 3684, // applied by Smudge to self
HammerTime = 3680, // applied by Striking Muse to self
SubtractivePalette = 3674, // applied by Subtractive Palette to self
Expand All @@ -103,6 +103,9 @@ public enum SID : uint

//Shared
Addle = ClassShared.SID.Addle, // applied by Addle to target
Surecast = ClassShared.SID.Surecast, // applied by Surecast to self
LucidDreaming = ClassShared.SID.LucidDreaming, // applied by Lucid Dreaming to self
Swiftcast = ClassShared.SID.Swiftcast, // applied by Swiftcast to self
}

public sealed class Definitions : IDisposable
Expand Down
5 changes: 3 additions & 2 deletions BossMod/ActionQueue/Casters/RDM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ public enum TraitID : uint
public enum SID : uint
{
None = 0,
LucidDreaming = 1204, // applied by Lucid Dreaming to self
Swiftcast = 167, // applied by Swiftcast to self
VerfireReady = 1234,
VerstoneReady = 1235,
Acceleration = 1238,
Expand All @@ -101,6 +99,9 @@ public enum SID : uint

//Shared
Addle = ClassShared.SID.Addle, // applied by Addle to target
Surecast = ClassShared.SID.Surecast, // applied by Surecast to self
LucidDreaming = ClassShared.SID.LucidDreaming, // applied by Lucid Dreaming to self
Swiftcast = ClassShared.SID.Swiftcast, // applied by Swiftcast to self
}

public sealed class Definitions : IDisposable
Expand Down
4 changes: 2 additions & 2 deletions BossMod/ActionQueue/Casters/SMN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ public enum SID : uint
None = 0,
Sleep = 3, // applied by Sleep to target
FurtherRuin = 2701, // applied by Energy Drain, Energy Siphon to self
LucidDreaming = 1204, // applied by Lucid Dreaming to self
SearingLight = 2703, // applied by Searing Light to self/target
TitansFavor = 2853, // applied by Topaz Rite, Topaz Catastrophe to self
Rekindle = 2704, // applied by Rekindle to self
Expand All @@ -140,8 +139,9 @@ public enum SID : uint

//Shared
Addle = ClassShared.SID.Addle, // applied by Addle to target
Surecast = ClassShared.SID.Surecast, // applied by Surecast to self
LucidDreaming = ClassShared.SID.LucidDreaming, // applied by Lucid Dreaming to self
Swiftcast = ClassShared.SID.Swiftcast, // applied by Swiftcast to self

}

public sealed class Definitions : IDisposable
Expand Down
6 changes: 5 additions & 1 deletion BossMod/ActionQueue/ClassShared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@ public enum SID : uint
// PhysRanged
Peloton = 1199, // applied by Peloton to self/party

// Caster/Healer
// Caster
Addle = 1203, // applied by Addle to target

// Magical
LucidDreaming = 1204, // applied by Lucid Dreaming to self
Surecast = 160, // applied by Surecast to self
Swiftcast = 167, // applied by Swiftcast to self
Raise = 148, // applied by Raise to target

Expand Down
39 changes: 32 additions & 7 deletions BossMod/ActionQueue/Healers/AST.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,46 @@ public enum TraitID : uint
public enum SID : uint
{
None = 0,
LucidDreaming = 1204, // applied by Lucid Dreaming to self
Surecast = 160, // applied by Surecast to self
Combust = 838,
AspectedHelios = 836,
AspectedBenefic = 835,
HeliosConjunction = 3894,
Lightspeed = 841,
CombustII = 843,
CombustIII = 1881,
AspectedBenefic = 835,
AspectedHelios = 836,
HeliosConjunction = 3894,
Horoscope = 1890,
HoroscopeHelios = 1891,
NeutralSect = 1892,
NeutralSectShield = 1921,
Divination = 1878,
GiantDominance = 1248,
ClarifyingDraw = 2713,
Macrocosmos = 2718,
Lightspeed = 841,
SelfSynastry = 845,
TargetSynastry = 846,
Divining = 3893,

//Cards
TheBalance = 3887,
TheSpear = 3889,
Divining = 3893,
LordOfCrownsDrawn = 2054,
LadyOfCrownsDrawn = 2055,
BalanceDrawn = 913,
BoleDrawn = 914,
ArrowDrawn = 915,
SpearDrawn = 916,
EwerDrawn = 917,
SpireDrawn = 918,
BalanceBuff = 3887,
BoleBuff = 3890,
ArrowBuff = 3888,
SpearBuff = 3889,
EwerBuff = 3891,
SpireBuff = 3892,

//Shared
Surecast = ClassShared.SID.Surecast, // applied by Surecast to self
LucidDreaming = ClassShared.SID.LucidDreaming, // applied by Lucid Dreaming to self
Swiftcast = ClassShared.SID.Swiftcast, // applied by Swiftcast to self
}

Expand Down
5 changes: 3 additions & 2 deletions BossMod/ActionQueue/Healers/SCH.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,16 @@ public enum SID : uint
Bio2 = 189, // applied by Bio2 to target, dot
Biolysis = 1895,
Galvanize = 297, // applied by Adloquium to target, shield
LucidDreaming = 1204, // applied by Lucid Dreaming to self
Sleep = 3, // applied by Repose to target
BanefulImpaction = 3883, // applied by Baneful Impaction to target
ImpactImminent = 3882, // applied by Chain Stratagem to self
ChainStratagem = 1221, // applied by Chain Stratagem to target
FeyUnion = 1222, // applied by Aetherpact to target
FeyUnion = 1223, // applied by Aetherpact to target
Seraphism = 3884, // applied by Seraphism to self

//Shared
Surecast = ClassShared.SID.Surecast, // applied by Surecast to self
LucidDreaming = ClassShared.SID.LucidDreaming, // applied by Lucid Dreaming to self
Swiftcast = ClassShared.SID.Swiftcast, // applied by Swiftcast to self
}

Expand Down
4 changes: 2 additions & 2 deletions BossMod/ActionQueue/Healers/SGE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ public enum SID : uint
{
None = 0,
Sprint = 50, // applied by Sprint to self
Surecast = 160, // applied by Surecast to self
Eukrasia = 2606,
Kardion = 2605, // applied by Kardia to self
Kardia = 2604, // applied by Kardia to self
LucidDreaming = 1204, // applied by Lucid Dreaming to self
Haima = 2612, // applied by Haima to self
Haimatinon = 2642, // applied by Haima to self
Panhaima = 2613, // applied by Panhaima to self
Expand All @@ -114,6 +112,8 @@ public enum SID : uint
EukrasianDyskrasia = 3897, // applied by Eukrasian Dyskrasia to target

//Shared
Surecast = ClassShared.SID.Surecast, // applied by Surecast to self
LucidDreaming = ClassShared.SID.LucidDreaming, // applied by Lucid Dreaming to self
Swiftcast = ClassShared.SID.Swiftcast, // applied by Swiftcast to self
}

Expand Down
4 changes: 2 additions & 2 deletions BossMod/ActionQueue/Healers/WHM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ public enum SID : uint
Medica2 = 150, // applied by Medica2 to targets, hot
Freecure = 155, // applied by Cure1 to self, next cure2 is free
ThinAir = 1217, // applied by Thin Air to self, next gcd costs no mp
LucidDreaming = 1204, // applied by Lucid Dreaming to self, mp regen
DivineBenison = 1218, // applied by Divine Benison to target, shield
Confession = 1219, // applied by Plenary Indulgence to self, heal buff
Temperance = 1872, // applied by Temperance to self, heal and mitigate buff
Surecast = 160, // applied by Surecast to self, knockback immune
PresenceOfMind = 157, // applied by Presence of Mind to self, damage buff
Regen = 158, // applied by Regen to target, hp regen
Asylum = 1911, // applied by Asylum to target, hp regen
Expand All @@ -109,6 +107,8 @@ public enum SID : uint
DivineCaress = 3903, // applied by Divine Caress to self/target

//Shared
Surecast = ClassShared.SID.Surecast, // applied by Surecast to self
LucidDreaming = ClassShared.SID.LucidDreaming, // applied by Lucid Dreaming to self
Swiftcast = ClassShared.SID.Swiftcast, // applied by Swiftcast to self
}

Expand Down
2 changes: 1 addition & 1 deletion BossMod/ActionQueue/Ranged/MCH.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public enum SID : uint
Flamethrower = 1205, // applied by Flamethrower to self
ExcavatorReady = 3865, // applied by Chain Saw to self
FullMetalMachinist = 3866, // applied by Hypercharge to self

Tactician = 1951, // applied by Tactician to self
//Shared
Peloton = ClassShared.SID.Peloton, // applied by Peloton to self/party
}
Expand Down
117 changes: 32 additions & 85 deletions BossMod/Autorotation/PlanPresetConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,101 +2,48 @@

namespace BossMod.Autorotation;

// TODO: waiting for .net9 to complete implementation, since it adds proper API for renaming keys, it's a pita to maintain order otherwise
public static class PlanPresetConverter
{
// note: we always apply renames _after_ changes - this allows converting old modules to new ones without affecting plans/presets that already use new ones
private record class TrackChanges(Dictionary<string, string> OptionRenames);
private record class ModuleChanges(Dictionary<string, TrackChanges> TrackChanges, Dictionary<string, string> TrackRenames);
private record class ModuleConverter(Dictionary<string, ModuleChanges> ModuleChanges, Dictionary<string, string> ModuleRenames);

public static readonly VersionedJSONSchema PlanSchema = BuildSchema(true);
public static readonly VersionedJSONSchema PresetSchema = BuildSchema(false);

private static VersionedJSONSchema BuildSchema(bool plan)
{
var res = new VersionedJSONSchema();
//AddModuleConverter(res, plan, BuildModuleConverterV1()); // v1: StandardWAR -> VeynVAR rename
res.Converters.Add((j, _, _) => // v1: StandardWAR -> VeynVAR rename
{
Dictionary<string, string> moduleRenames = new() { ["BossMod.Autorotation.StandardWAR"] = "BossMod.Autorotation.VeynWAR" };
foreach (var m in EnumerateEntriesModules(j, plan))
RenameKeys(m, moduleRenames);
return j;
});
return res;
}

//private static void AddModuleConverter(VersionedJSONSchema schema, bool plan, ModuleConverter cvt)
//{
// schema.Converters.Add((j, _, _) =>
// {
// if (plan)
// {
// var modules = j!["Modules"]!.AsObject();
// foreach (var (moduleName, moduleData) in modules)
// {
// if (cvt.ModuleChanges.TryGetValue(moduleName, out var moduleChanges))
// {
// var tracks = moduleData!.AsObject();
// foreach (var (trackName, trackData) in tracks)
// {
// if (moduleChanges.TrackChanges.TryGetValue(trackName, out var trackChanges))
// {
// foreach (var entry in trackData!.AsArray())
// {
// var optionName = entry!["Option"]!.GetValue<string>();
// if (trackChanges.OptionRenames.TryGetValue(optionName, out var optionNewName))
// entry["Option"] = optionNewName;
// }
// }
// }
// ApplyRenames(tracks, moduleChanges.TrackRenames);
// }
// }
// ApplyRenames(modules, cvt.ModuleRenames);
// }
// else
// {
// foreach (var preset in j.AsArray())
// {
// var modules = preset!["Modules"]!.AsObject();
// foreach (var (moduleName, moduleData) in modules)
// {
// if (cvt.ModuleChanges.TryGetValue(moduleName, out var moduleChanges))
// {
// foreach (var entry in moduleData!.AsArray())
// {
// var trackName = entry!["Track"]!.GetValue<string>();
// if (moduleChanges.TrackChanges.TryGetValue(trackName, out var trackChanges))
// {
// var optionName = entry!["Option"]!.GetValue<string>();
// if (trackChanges.OptionRenames.TryGetValue(optionName, out var optionNewName))
// entry["Option"] = optionNewName;
// }

// if (moduleChanges.TrackRenames.TryGetValue(trackName, out var trackNewName))
// entry["Track"] = trackNewName;
// }
// }
// }
// ApplyRenames(modules, cvt.ModuleRenames);
// }
// }
// return j;
// });
//}

//private static void ApplyRenames(JsonObject j, Dictionary<string, string> renames)
//{
// if (renames.Count == 0)
// return;

// for (int i = 0; i < j.Count; ++i)
// {
// // TODO: implement...
// }
//}
// returns always 1 element for plans, or multiple (1 per preset) for preset database
private static IEnumerable<JsonObject> EnumerateEntriesModules(JsonNode root, bool plan)
{
if (plan)
{
yield return root!["Modules"]!.AsObject();
}
else
{
foreach (var preset in root.AsArray())
{
yield return preset!["Modules"]!.AsObject();
}
}
}

//private static ModuleConverter BuildModuleConverterV1()
//{
// Dictionary<string, string> moduleRenames = new()
// {
// ["BossMod.Autorotation.StandardWAR"] = "BossMod.Autorotation.VeynWAR",
// };
// return new([], moduleRenames);
//}
private static void RenameKeys(JsonObject j, Dictionary<string, string> renames)
{
// TODO: net9 - use indexed access to simplify & speed up implementation
for (int i = 0, cnt = j.Count; i < cnt; ++i)
{
var (k, v) = j.First();
j.Remove(k);
j.Add(renames.TryGetValue(k, out var renamed) ? renamed : k, v);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace BossMod.Autorotation;

public sealed class StandardWAR(RotationModuleManager manager, Actor player) : RotationModule(manager, player)
public sealed class VeynWAR(RotationModuleManager manager, Actor player) : RotationModule(manager, player)
{
public enum Track { AOE, Burst, Potion, PrimalRend, Tomahawk, InnerRelease, Infuriate, Upheaval, Wrath, Onslaught, Bozja }
public enum AOEStrategy { SingleTarget, ForceAOE, Auto, AutoFinishCombo }
Expand Down
6 changes: 2 additions & 4 deletions BossMod/Autorotation/Utility/ClassASTUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ public enum StarOption { None, Use, End }
public enum HoroscopeOption { None, Use, End }
public enum MacrocosmosOption { None, Use, End }
public enum HeliosOption { None, Use, UseEx }
public float GetStatusDetail(Actor target, AST.SID sid) => StatusDetails(target, sid, Player.InstanceID).Left; //Checks if Status effect is on target
public bool HasEffect(Actor target, AST.SID sid, float duration) => GetStatusDetail(target, sid) < duration; //Checks if anyone has a status effect
public Actor? TargetChoice(StrategyValues.OptionRef strategy) => ResolveTargetOverride(strategy.Value);

public static readonly ActionID IDLimitBreak3 = ActionID.MakeSpell(AST.AID.AstralStasis);
Expand All @@ -19,7 +17,7 @@ public static RotationModuleDefinition Definition()
DefineShared(res, IDLimitBreak3);

DefineSimpleConfig(res, Track.Helios, "Helios", "", 140, AST.AID.Helios);
DefineSimpleConfig(res, Track.Lightspeed, "Lightspeed", "L.Speed", 140, AST.AID.Lightspeed, 15); //Self oGCD, 60s CD (120s total), 2 charges, 15s effect duration
DefineSimpleConfig(res, Track.Lightspeed, "Lightspeed", "L.speed", 140, AST.AID.Lightspeed, 15); //Self oGCD, 60s CD (120s total), 2 charges, 15s effect duration
DefineSimpleConfig(res, Track.BeneficII, "BeneficII", "Bene2", 100, AST.AID.BeneficII); //ST GCD heal
DefineSimpleConfig(res, Track.EssentialDignity, "EssentialDignity", "E.Dig", 140, AST.AID.EssentialDignity); //ST oGCD heal, 40s CD (120s Total), 3 charges
DefineSimpleConfig(res, Track.AspectedBenefic, "AspectedBenefic", "A.Benefic", 100, AST.AID.AspectedBenefic, 15); //ST GCD regen, 15s effect duration
Expand Down Expand Up @@ -88,7 +86,7 @@ public override void Execute(StrategyValues strategy, ref Actor? primaryTarget,
QueueOGCD(starAction, TargetChoice(star) ?? primaryTarget ?? Player);

//Aspected Helios full execution
var heliosUp = HasEffect(Player, AST.SID.AspectedHelios, 15) || HasEffect(Player, AST.SID.HeliosConjunction, 15);
var heliosUp = StatusDetails(Player, AST.SID.AspectedHelios, Player.InstanceID).Left > 0.1f || StatusDetails(Player, AST.SID.HeliosConjunction, Player.InstanceID).Left > 0.1f;
var helios = strategy.Option(Track.AspectedHelios);
var heliosAction = helios.As<HeliosOption>() switch
{
Expand Down
Loading

0 comments on commit 6ebb246

Please sign in to comment.