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

refactored chi module #555

Merged
merged 1 commit into from
Jan 14, 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
14 changes: 7 additions & 7 deletions BossMod/Components/GenericAOEs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override void DrawArenaBackground(int pcSlot, Actor pc)
}
}

// For simple AOEs, formerly known as SelfTargetedAOEs andLocationTargetedAOEs, that happens at the end of the cast
// For simple AOEs, formerly known as SelfTargetedAOEs and LocationTargetedAOEs, that happens at the end of the cast
public class SimpleAOEs(BossModule module, ActionID aid, AOEShape shape, int maxCasts = int.MaxValue, float riskyWithSecondsLeft = 0) : GenericAOEs(module, aid)
{
public SimpleAOEs(BossModule module, ActionID aid, float radius, int maxCasts = int.MaxValue, float riskyWithSecondsLeft = 0) : this(module, aid, new AOEShapeCircle(radius), maxCasts, riskyWithSecondsLeft) { }
Expand All @@ -59,12 +59,12 @@ public List<AOEInstance> ActiveCasters
{
var count = Casters.Count;
var max = count > MaxCasts ? MaxCasts : count;
List<AOEInstance> result = new(max);
List<AOEInstance> aoes = new(max);
for (var i = 0; i < max; ++i)
{
result.Add(Casters[i]);
aoes.Add(Casters[i]);
}
return result;
return aoes;
}
}

Expand All @@ -75,16 +75,16 @@ public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
return [];
var time = WorldState.CurrentTime;
var max = count > MaxCasts ? MaxCasts : count;
List<AOEInstance> result = new(max);
List<AOEInstance> aoes = new(max);
for (var i = 0; i < max; ++i)
{
var caster = Casters[i];
var color = i < MaxDangerColor && count > MaxDangerColor ? Colors.Danger : 0;
var risky = Risky && (MaxRisky == null || i < MaxRisky);
result.Add(RiskyWithSecondsLeft == 0 ? caster with { Color = color, Risky = risky }
aoes.Add(RiskyWithSecondsLeft == 0 ? caster with { Color = color, Risky = risky }
: caster with { Color = color, Risky = risky && caster.Activation.AddSeconds(-RiskyWithSecondsLeft) <= time });
}
return result;
return aoes;
}

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class ActivePivotParticleBeam(BossModule module) : Components.GenericRotatingAOE(module)
{
private static readonly AOEShapeRect _shape = new(80, 9);
private static readonly AOEShapeRect _shape = new(40, 9, 40);

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ class Phase2InnerCells(BossModule module) : Components.GenericAOEs(module)
public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
if (!_config.ShowOccupiedTiles)
yield break;
return [];
var cell = CellIndex(actor.Position - Arena.Center) - 3;
List<AOEInstance> tiles = new(16); // 3 * 4 + 4 margin for error
for (var i = 0; i < 28; ++i)
{
if (_breakTime[i] != default)
{
if (i == cell)
{
if (Math.Max(0, (_breakTime[i] - WorldState.CurrentTime).TotalSeconds) < 6)
yield return new(square, CellCenter(i));
if ((_breakTime[i] - WorldState.CurrentTime).TotalSeconds < 6)
tiles.Add(new(square, CellCenter(i)));
}
else
yield return new(square, CellCenter(i), Color: Colors.FutureVulnerable);
tiles.Add(new(square, CellCenter(i), Color: Colors.FutureVulnerable));
}
}
return tiles;
}

public override void AddHints(int slot, Actor actor, TextHints hints)
Expand Down
4 changes: 2 additions & 2 deletions BossMod/Modules/Dawntrail/Trial/T02ZoraalJa/ChasmOfVollok.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class ChasmOfVollok(BossModule module) : Components.GenericAOEs(module)
{
public readonly List<AOEInstance> AOEs = new(16);
private static readonly float platformOffset = 30 / MathF.Sqrt(2);
private static readonly AOEShapeRect rect = new(2.5f, 2.5f, 2.5f);
private static readonly AOEShapeRect rect = new(5, 2.5f);

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

Expand All @@ -13,7 +13,7 @@ public override void OnCastStarted(Actor caster, ActorCastInfo spell)
if ((AID)spell.Action.ID == AID.ChasmOfVollok1)
{
if (Arena.InBounds(caster.Position))
AOEs.Add(new(rect, caster.Position, spell.Rotation, Module.CastFinishAt(spell)));
AOEs.Add(new(rect, spell.LocXZ, spell.Rotation, Module.CastFinishAt(spell)));
else
{
var pos = spell.LocXZ;
Expand Down
12 changes: 7 additions & 5 deletions BossMod/Modules/Dawntrail/Trial/T02ZoraalJa/DoubleEdgedSwords.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@ public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
var count = _aoes.Count;
if (count == 0)
yield break;
return [];
List<AOEInstance> aoes = new(count);
for (var i = 0; i < count; ++i)
{
var aoe = _aoes[i];
if (i == 0)
yield return count != 1 ? aoe with { Color = Colors.Danger } : aoe;
else if (i == 1)
yield return aoe with { Risky = false };
aoes.Add(count > 1 ? aoe with { Color = Colors.Danger } : aoe);
else
aoes.Add(aoe with { Risky = false });
}
return aoes;
}

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
if ((AID)spell.Action.ID == AID.DoubleEdgedSwords)
_aoes.Add(new(cone, caster.Position, spell.Rotation, Module.CastFinishAt(spell)));
_aoes.Add(new(cone, spell.LocXZ, spell.Rotation, Module.CastFinishAt(spell)));
}

public override void OnCastFinished(Actor caster, ActorCastInfo spell)
Expand Down
9 changes: 6 additions & 3 deletions BossMod/Modules/Dawntrail/Trial/T02ZoraalJa/ForgedTrack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
var count = _aoes.Count;
if (count == 0)
yield break;
for (var i = 0; i < (count > 4 ? 4 : count); ++i)
yield return _aoes[i];
return [];
var max = count > 4 ? 4 : count;
List<AOEInstance> aoes = new(max);
for (var i = 0; i < max; ++i)
aoes.Add(_aoes[i]);
return aoes;
}

public override void OnTethered(Actor source, ActorTetherInfo tether)
Expand Down
10 changes: 6 additions & 4 deletions BossMod/Modules/Dawntrail/Trial/T02ZoraalJa/T02ZoraalJaP2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ class HalfCircuitCircle(BossModule module) : Circles(module, AID.HalfCircuitCirc
class DawnOfAnAge(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSpell(AID.DawnOfAnAge));
class BitterReaping(BossModule module) : Components.SingleTargetCast(module, ActionID.MakeSpell(AID.BitterReaping));
class Actualize(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSpell(AID.Actualize));
class HalfFull(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.HalfFull), new AOEShapeRect(60, 30))

abstract class HalfRect(BossModule module, AID aid) : Components.SimpleAOEs(module, ActionID.MakeSpell(aid), new AOEShapeRect(60, 30));
class HalfFull(BossModule module) : HalfRect(module, AID.HalfFull)
{
private readonly ChasmOfVollok _aoe = module.FindComponent<ChasmOfVollok>()!;
public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
if (_aoe.AOEs.Count == 0)
yield return Casters[0];
return Casters.Count != 0 && _aoe.AOEs.Count != 0 ? [Casters[0]] : [];
}
}

class HalfCircuitRect(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.HalfCircuitRect), new AOEShapeRect(60, 30));
class HalfCircuitRect(BossModule module) : HalfRect(module, AID.HalfCircuitRect);

class FireIII(BossModule module) : Components.SpreadFromIcon(module, (uint)IconID.Spreadmarker, ActionID.MakeSpell(AID.FireIII), 6, 5.1f);
class DutysEdge(BossModule module) : Components.LineStack(module, ActionID.MakeSpell(AID.DutysEdgeMarker), ActionID.MakeSpell(AID.DutysEdge), 5.4f, 100, minStackSize: 8, maxStackSize: 8, maxCasts: 4, markerIsFinalTarget: false);

Expand Down
Loading