Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some cleanups #619

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BossMod/Modules/Dawntrail/Hunt/RankA/Heshuala.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public override void OnCastStarted(Actor caster, ActorCastInfo spell)
AddSequence(-90f.Degrees());
break;
}
void AddSequence(Angle angle) => Sequences.Add(new(cone, WPos.ClampToGrid(caster.Position), spell.Rotation, angle, Module.CastFinishAt(spell), 2.7f, Spins));
void AddSequence(Angle increment) => Sequences.Add(new(cone, WPos.ClampToGrid(caster.Position), spell.Rotation, increment, Module.CastFinishAt(spell), 2.7f, Spins));
}

public override void OnCastFinished(Actor caster, ActorCastInfo spell)
Expand Down
13 changes: 12 additions & 1 deletion BossMod/Modules/Dawntrail/Quest/Job/Viper/VengeanceOfTheViper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,21 @@ public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
if (spell.Action.ID == (uint)AID.SwoopingFrenzy2 || spell.Action.ID == (uint)AID.SwoopingFrenzyTelegraph && !_aoes.Any(x => x.Origin.AlmostEqual(spell.LocXZ, 1f)))
if (spell.Action.ID == (uint)AID.SwoopingFrenzy2 || spell.Action.ID == (uint)AID.SwoopingFrenzyTelegraph && !HasMatchingAOE(spell.LocXZ))
_aoes.Add(new(circle, spell.LocXZ, default, Module.CastFinishAt(spell, 1.5f)));
}

private bool HasMatchingAOE(WPos location)
{
var count = _aoes.Count;
for (var i = 0; i < count; ++i)
{
if (_aoes[i].Origin.AlmostEqual(location, 1f))
return true;
}
return false;
}

public override void OnEventCast(Actor caster, ActorCastEvent spell)
{
if (_aoes.Count != 0 && spell.Action.ID is (uint)AID.SwoopingFrenzy2 or (uint)AID.SwoopingFrenzy3)
Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Dawntrail/Raid/M03NBruteBomber/Firespin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public override void OnCastStarted(Actor caster, ActorCastInfo spell)
AddSequence(-45f.Degrees());
break;
}
void AddSequence(Angle angle) => Sequences.Add(new(cone, spell.LocXZ, spell.Rotation, angle, Module.CastFinishAt(spell, 0.5f), 1f, 8));
void AddSequence(Angle increment) => Sequences.Add(new(cone, spell.LocXZ, spell.Rotation, increment, Module.CastFinishAt(spell, 0.5f), 1f, 8));
}

public override void OnCastFinished(Actor caster, ActorCastInfo spell)
Expand Down
24 changes: 12 additions & 12 deletions BossMod/Modules/Dawntrail/Savage/M03SBruteBomber/FuseOrFoe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,46 @@

class InfernalSpin(BossModule module) : Components.GenericRotatingAOE(module)
{
private static readonly AOEShapeCone _shape = new(40, 30.Degrees());
private static readonly AOEShapeCone _shape = new(40f, 30f.Degrees());

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
var increment = (AID)spell.Action.ID switch
var increment = spell.Action.ID switch
{
AID.InfernalSpinFirstCW => -45.Degrees(),
AID.InfernalSpinFirstCCW => 45.Degrees(),
(uint)AID.InfernalSpinFirstCW => -45f.Degrees(),
(uint)AID.InfernalSpinFirstCCW => 45f.Degrees(),
_ => default
};
if (increment != default)
{
Sequences.Add(new(_shape, caster.Position, spell.Rotation, increment, Module.CastFinishAt(spell, 0.5f), 1.1f, 8));
Sequences.Add(new(_shape, spell.LocXZ, spell.Rotation, increment, Module.CastFinishAt(spell, 0.5f), 1.1f, 8));
}
}

public override void OnCastFinished(Actor caster, ActorCastInfo spell)
{
if ((AID)spell.Action.ID is AID.InfernalSpinFirstAOE or AID.InfernalSpinRestAOE)
if (spell.Action.ID is (uint)AID.InfernalSpinFirstAOE or (uint)AID.InfernalSpinRestAOE)
AdvanceSequence(0, WorldState.CurrentTime);
}
}

class ExplosiveRain(BossModule module) : Components.ConcentricAOEs(module, _shapes)
{
private static readonly AOEShape[] _shapes = [new AOEShapeCircle(8), new AOEShapeDonut(8, 16), new AOEShapeDonut(16, 24)];
private static readonly AOEShape[] _shapes = [new AOEShapeCircle(8f), new AOEShapeDonut(8f, 16f), new AOEShapeDonut(16f, 24f)];

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
if ((AID)spell.Action.ID is AID.ExplosiveRain11 or AID.ExplosiveRain21)
if (spell.Action.ID is (uint)AID.ExplosiveRain11 or (uint)AID.ExplosiveRain21)
AddSequence(spell.LocXZ, Module.CastFinishAt(spell));
}

public override void OnCastFinished(Actor caster, ActorCastInfo spell)
{
var order = (AID)spell.Action.ID switch
var order = spell.Action.ID switch
{
AID.ExplosiveRain11 or AID.ExplosiveRain21 => 0,
AID.ExplosiveRain12 or AID.ExplosiveRain22 => 1,
AID.ExplosiveRain13 or AID.ExplosiveRain23 => 2,
(uint)AID.ExplosiveRain11 or (uint)AID.ExplosiveRain21 => 0,
(uint)AID.ExplosiveRain12 or (uint)AID.ExplosiveRain22 => 1,
(uint)AID.ExplosiveRain13 or (uint)AID.ExplosiveRain23 => 2,
_ => -1
};
if (!AdvanceSequence(order, spell.LocXZ, WorldState.FutureTime(4)))
Expand Down
7 changes: 4 additions & 3 deletions BossMod/Modules/Endwalker/Hunt/RankA/Gurangatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,22 @@ class Slammer(BossModule module) : Components.GenericRotatingAOE(module)

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
void AddSequence(Angle increment, int casts = 8, int max = 2) => Sequences.Add(new(_shape, spell.LocXZ, spell.Rotation, increment, Module.CastFinishAt(spell), 3.6f, casts, max));
switch (spell.Action.ID)
{
case (uint)AID.OctupleSlammerLCW:
case (uint)AID.OctupleSlammerRCW:
Sequences.Add(new(_shape, caster.Position, spell.Rotation, 90f.Degrees(), Module.CastFinishAt(spell), 3.7f, 8));
AddSequence(90f.Degrees());
ImminentColor = Colors.Danger;
break;
case (uint)AID.OctupleSlammerLCCW:
case (uint)AID.OctupleSlammerRCCW:
Sequences.Add(new(_shape, caster.Position, spell.Rotation, -90f.Degrees(), Module.CastFinishAt(spell), 3.7f, 8));
AddSequence(-90f.Degrees());
ImminentColor = Colors.Danger;
break;
case (uint)AID.LeftHammerSlammer:
case (uint)AID.RightHammerSlammer:
Sequences.Add(new(_shape, caster.Position, spell.Rotation, 180f.Degrees(), Module.CastFinishAt(spell), 3.6f, 2, 1));
AddSequence(180f.Degrees());
ImminentColor = 0;
break;
}
Expand Down
28 changes: 14 additions & 14 deletions BossMod/Modules/Endwalker/Hunt/RankS/Armstrong.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,45 +27,45 @@ class MagitekCompressor(BossModule module) : Components.GenericRotatingAOE(modul

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
if ((AID)spell.Action.ID is AID.MagitekCompressorFirst)
if (spell.Action.ID == (uint)AID.MagitekCompressorFirst)
{
NumCasts = 0;
Sequences.Add(new(_shape, caster.Position, spell.Rotation, _increment, Module.CastFinishAt(spell), 2.1f, 10));
Sequences.Add(new(_shape, spell.LocXZ, spell.Rotation, _increment, Module.CastFinishAt(spell), 2.1f, 10));
}
}

public override void OnEventCast(Actor caster, ActorCastEvent spell)
{
switch ((AID)spell.Action.ID)
switch (spell.Action.ID)
{
case AID.RotateCW:
_increment = -30.Degrees();
case (uint)AID.RotateCW:
_increment = -30f.Degrees();
break;
case AID.RotateCCW:
_increment = 30.Degrees();
case (uint)AID.RotateCCW:
_increment = 30f.Degrees();
break;
case AID.MagitekCompressorFirst:
case AID.MagitekCompressorReverse:
case AID.MagitekCompressorNext:
if (Sequences.Count > 0)
case (uint)AID.MagitekCompressorFirst:
case (uint)AID.MagitekCompressorReverse:
case (uint)AID.MagitekCompressorNext:
if (Sequences.Count != 0)
{
AdvanceSequence(0, WorldState.CurrentTime);
if (NumCasts == 5)
{
ref var s = ref Sequences.Ref(0);
s.Increment = -s.Increment;
s.NextActivation = WorldState.FutureTime(3.6f);
s.NextActivation = WorldState.FutureTime(3.6d);
}
}
break;
}
}
}

class AcceleratedLanding(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.AcceleratedLanding), 6);
class AcceleratedLanding(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.AcceleratedLanding), 6f);
class CalculatedCombustion(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSpell(AID.CalculatedCombustion));
class Pummel(BossModule module) : Components.SingleTargetCast(module, ActionID.MakeSpell(AID.Pummel));
class SoporificGas(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.SoporificGas), 12);
class SoporificGas(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.SoporificGas), 12f);

class ArmstrongStates : StateMachineBuilder
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class LevinblossomLance(BossModule module) : Components.GenericRotatingAOE(modul

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
void AddSequence(Angle angle) => Sequences.Add(new(rect, spell.LocXZ, spell.Rotation, angle, Module.CastFinishAt(spell, 0.8f), 1, 5, 2));
void AddSequence(Angle increment) => Sequences.Add(new(rect, spell.LocXZ, spell.Rotation, increment, Module.CastFinishAt(spell, 0.8f), 1, 5, 2));
switch (spell.Action.ID)
{
case (uint)AID.LevinblossomLanceCCW:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,56 @@ namespace BossMod.Endwalker.VariantCriterion.V02MR.V023Gorai;

class FlameAndSulphur(BossModule module) : Components.GenericAOEs(module)
{
private readonly List<AOEInstance> _aoes = [];

private static readonly AOEShapeRect _shapeFlameExpand = new(46, 5);
private static readonly AOEShapeRect _shapeFlameSplit = new(46, 2.5f);
private static readonly AOEShapeCircle _shapeRockExpand = new(11);
private static readonly AOEShapeDonut _shapeRockSplit = new(5, 16);
private readonly List<AOEInstance> _aoes = new(4);
private static readonly AOEShapeRect _shapeFlameExpand = new(46f, 5f);
private static readonly AOEShapeRect _shapeFlameSplit = new(46f, 2.5f);
private static readonly AOEShapeCircle _shapeRockExpand = new(11f);
private static readonly AOEShapeDonut _shapeRockSplit = new(5f, 16f);

public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor) => _aoes;

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
var activation = Module.CastFinishAt(spell, 3.1f);
switch ((AID)spell.Action.ID)
switch (spell.Action.ID)
{
case AID.BrazenBalladSplitting:
foreach (var a in Module.Enemies(OID.FlameAndSulphurFlame))
_aoes.Add(new(_shapeFlameExpand, a.Position, a.Rotation, activation));
foreach (var a in Module.Enemies(OID.FlameAndSulphurRock))
_aoes.Add(new(_shapeRockExpand, a.Position, a.Rotation, activation));
case (uint)AID.BrazenBalladSplitting:
AddAOEs(_shapeFlameExpand, (uint)OID.FlameAndSulphurFlame);
AddAOEs(_shapeRockExpand, (uint)OID.FlameAndSulphurRock);
break;
case (uint)AID.BrazenBalladExpanding:
AddAOEs(_shapeFlameSplit, (uint)OID.FlameAndSulphurFlame, true);
AddAOEs(_shapeRockSplit, (uint)OID.FlameAndSulphurRock);
break;
case AID.BrazenBalladExpanding:
foreach (var a in Module.Enemies(OID.FlameAndSulphurFlame))

void AddAOEs(AOEShape shape, uint actors, bool twice = false)
{
var offset = a.Rotation.ToDirection().OrthoL() * 7.5f;
_aoes.Add(new(_shapeFlameSplit, a.Position + offset, a.Rotation, activation));
_aoes.Add(new(_shapeFlameSplit, a.Position - offset, a.Rotation, activation));
var enemies = Module.Enemies(actors);
var count = enemies.Count;

if (!twice)
for (var i = 0; i < count; ++i)
{
var enemy = enemies[i];
AddAOE(shape, enemy.Position, enemy.Rotation);
}
else
for (var i = 0; i < count; ++i)
{
var enemy = enemies[i];
var rot = enemy.Rotation;
var offset = rot.ToDirection().OrthoL() * 7.5f;
AddAOE(shape, enemy.Position + offset, rot);
AddAOE(shape, enemy.Position - offset, rot);
}
void AddAOE(AOEShape shape, WPos origin, Angle rotation) => _aoes.Add(new(shape, WPos.ClampToGrid(origin), rotation, activation));
}
foreach (var a in Module.Enemies(OID.FlameAndSulphurRock))
_aoes.Add(new(_shapeRockSplit, a.Position, a.Rotation, activation));
break;
}
}

public override void OnEventCast(Actor caster, ActorCastEvent spell)
{
if ((AID)spell.Action.ID is AID.FireSpreadExpand or AID.FireSpreadSplit or AID.FallingRockExpand or AID.FallingRockSplit)
if (spell.Action.ID is (uint)AID.FireSpreadExpand or (uint)AID.FireSpreadSplit or (uint)AID.FallingRockExpand or (uint)AID.FallingRockSplit)
_aoes.Clear();
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
namespace BossMod.Endwalker.VariantCriterion.V02MR.V023Gorai;

class ImpurePurgation(BossModule module) : Components.GenericAOEs(module, ActionID.MakeSpell(AID.ImpurePurgation))
class ImpurePurgation(BossModule module) : Components.GenericAOEs(module)
{
private readonly List<Actor> _castersPurgationFirst = [];
private readonly List<Actor> _castersPurgationNext = [];

private static readonly AOEShapeCone cone = new(60, 22.5f.Degrees());
private static readonly AOEShapeCone cone = new(60f, 22.5f.Degrees());
public readonly List<AOEInstance> AOEs = new(8);

public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
return _castersPurgationFirst.Count > 0
? _castersPurgationFirst.Select(c => new AOEInstance(cone, c.Position, c.CastInfo!.Rotation, Module.CastFinishAt(c.CastInfo)))
: _castersPurgationNext.Select(c => new AOEInstance(cone, c.Position, c.CastInfo!.Rotation, Module.CastFinishAt(c.CastInfo)));
var count = AOEs.Count;
if (count == 0)
return [];
var max = count > 4 ? 4 : count;
var aoes = new AOEInstance[max];
for (var i = 0; i < max; ++i)
aoes[i] = AOEs[i];
return aoes;
}

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
CastersForSpell(spell.Action)?.Add(caster);
if (spell.Action.ID is (uint)AID.ImpurePurgationFirst or (uint)AID.ImpurePurgationSecond)
{
AOEs.Add(new(cone, spell.LocXZ, spell.Rotation, Module.CastFinishAt(spell)));
if (AOEs.Count == 8)
AOEs.SortBy(x => x.Activation);
}
}

public override void OnCastFinished(Actor caster, ActorCastInfo spell)
{
CastersForSpell(spell.Action)?.Remove(caster);
if (AOEs.Count != 0 && spell.Action.ID is (uint)AID.ImpurePurgationFirst or (uint)AID.ImpurePurgationFirst)
AOEs.RemoveAt(0);
}

private List<Actor>? CastersForSpell(ActionID spell) => (AID)spell.ID switch
{
AID.ImpurePurgationFirst => _castersPurgationFirst,
AID.ImpurePurgationSecond => _castersPurgationNext,
_ => null
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,50 @@ class MalformedPrayer(BossModule module) : Components.GenericTowers(module)
{
private readonly ImpurePurgation _aoe = module.FindComponent<ImpurePurgation>()!;

private static readonly Dictionary<byte, WPos> towerSources = new()
{
{0x1F, new(741, -201)}, {0x23, new(741, -179)}, {0x25, new(730, -190)},
{0x21, new(752, -190)}, {0x24, new(733.222f, -182.222f)},
{0x26, new(733.222f, -197.778f)}, {0x20, new(748.778f, -197.778f)},
{0x22, new(748.778f, -182.222f)}};

public override void OnEventEnvControl(byte index, uint state)
{
if (state == 0x00020001 && towerSources.TryGetValue(index, out var source))
Towers.Add(new(source, 4, activation: WorldState.FutureTime(9)));
if (state != 0x00020001)
return;
WPos? pos = index switch
{
0x1F => new(741f, -201f),
0x20 => new(748.778f, -197.778f),
0x21 => new(752f, -190f),
0x22 => new(748.778f, -182.222f),
0x23 => new(741f, -179f),
0x24 => new(733.222f, -182.222f),
0x25 => new(730f, -190f),
0x26 => new(733.222f, -197.778f),
_ => null
};
if (pos is WPos origin)
Towers.Add(new(WPos.ClampToGrid(origin), 4f, activation: WorldState.FutureTime(9d)));
}

public override void OnEventCast(Actor caster, ActorCastEvent spell)
{
if (Towers.Count > 0 && (AID)spell.Action.ID == AID.Burst)
if (Towers.Count != 0 && spell.Action.ID == (uint)AID.Burst)
Towers.RemoveAt(0);
}

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
if (_aoe.ActiveAOEs(slot, actor).Any() && !Towers.Any(x => x.IsInside(actor)))
hints.AddForbiddenZone(ShapeDistance.InvertedCircle(Module.PrimaryActor.Position, 1));
if (_aoe.AOEs.Count != 0 && Towers.Count != 0 && !Towers[0].IsInside(actor))
{
hints.AddForbiddenZone(ShapeDistance.InvertedCircle(Arena.Center, 3f));
}
else
base.AddAIHints(slot, actor, assignment, hints);
}

public override void Update()
{
if (Towers.Count == 0)
var count = Towers.Count;
if (count == 0)
return;
for (var i = 0; i < Towers.Count; ++i)
Towers[i] = new(Towers[i].Position, Towers[i].Radius, i > 0 ? 0 : 1, i > 0 ? 0 : 4, default, Towers[i].Activation);
for (var i = 0; i < count; ++i)
{
Towers[i] = Towers[i] with { MinSoakers = i > 0 ? 0 : 1, MaxSoakers = i > 0 ? 0 : 4 };
}
}
}
Loading