Skip to content

Commit

Permalink
sphene fix attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
CarnifexOptimus committed Nov 17, 2024
1 parent 6f2eb18 commit ccc9aa4
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 51 deletions.
2 changes: 2 additions & 0 deletions BossMod/AI/AIManagementWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ public override void Draw()
_config.Modified.Fire();
}
}
ImGui.EndCombo();
}
ImGui.Separator();
ImGui.Text("Desired positional");
ImGui.SameLine();
ImGui.SetNextItemWidth(100);
Expand Down
29 changes: 27 additions & 2 deletions BossMod/BossModule/Shapes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public override List<WDir> Contour(WPos center)
{
var angleIncrement = 2 * HalfAngle.Rad / Edges;
var startAngle = CenterDir.Rad - HalfAngle.Rad;
var vertices = new List<WDir>(Edges);
var vertices = new List<WDir>(Edges + 1);

for (var i = 0; i < Edges + 1; ++i)
{
Expand All @@ -206,7 +206,7 @@ public override List<WDir> Contour(WPos center)
{
var angleIncrement = 2 * HalfAngle.Rad / Edges;
var startAngle = CenterDir.Rad - HalfAngle.Rad;
var contourVertices = new List<WDir>();
var contourVertices = new List<WDir>(2 * (Edges + 1));

for (var i = Edges; i >= 0; --i)
{
Expand All @@ -225,3 +225,28 @@ public override List<WDir> Contour(WPos center)

public override string ToString() => $"{nameof(DonutSegmentV)}:{Center.X},{Center.Z},{InnerRadius},{OuterRadius},{CenterDir},{HalfAngle},{Edges}";
}

public record class DonutV(WPos Center, float InnerRadius, float OuterRadius, int Edges) : Shape
{
public override List<WDir> Contour(WPos center)
{
var angleIncrement = Angle.DoublePI / Edges;
var contourVertices = new List<WDir>(2 * (Edges + 1));

for (var i = 0; i <= Edges; ++i)
{
var (sin, cos) = ((float, float))Math.SinCos(i * angleIncrement);
contourVertices.Add(new(Center.X + OuterRadius * cos - center.X, Center.Z + OuterRadius * sin - center.Z));
}

for (var i = Edges; i >= 0; --i)
{
var (sin, cos) = ((float, float))Math.SinCos(i * angleIncrement);
contourVertices.Add(new(Center.X + InnerRadius * cos - center.X, Center.Z + InnerRadius * sin - center.Z));
}

return contourVertices;
}

public override string ToString() => $"{nameof(DonutV)}:{Center.X},{Center.Z},{InnerRadius},{OuterRadius},{Edges}";
}
2 changes: 1 addition & 1 deletion BossMod/Data/Actor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public sealed class Actor(ulong instanceID, uint oid, int spawnIndex, string nam
public bool IsDeadOrDestroyed => IsDead || IsDestroyed;
public static readonly Actor FakeActor = new(0, 0, -1, "dummy", 0, ActorType.None, Class.None, 0, new(100, 0, 100, 0));

private static readonly HashSet<uint> ignoreNPC = [0x2EFE, 0x418F]; // friendly NPCs that should not count as party members
private static readonly HashSet<uint> ignoreNPC = [0x2EFE, 0x418F, 0x464E]; // friendly NPCs that should not count as party members
public bool IsFriendlyNPC => Type == ActorType.Enemy && IsAlly && IsTargetable && !ignoreNPC.Contains(OID);

public ActorStatus? FindStatus(uint sid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ public override void OnCastFinished(Actor caster, ActorCastInfo spell)
}
}

class PricklyRight(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.PricklyRight), new AOEShapeCone(36, 165.Degrees()));
class PricklyLeft(BossModule module) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(AID.PricklyLeft), new AOEShapeCone(36, 165.Degrees()));
abstract class Prickly(BossModule module, AID aid) : Components.SelfTargetedAOEs(module, ActionID.MakeSpell(aid), new AOEShapeCone(36, 165.Degrees()));
class PricklyRight(BossModule module) : Prickly(module, AID.PricklyRight);
class PricklyLeft(BossModule module) : Prickly(module, AID.PricklyLeft);

class SucculentStomp(BossModule module) : Components.StackWithCastTargets(module, ActionID.MakeSpell(AID.SucculentStomp), 6, 4, 4);
class BarrelBreaker(BossModule module) : Components.KnockbackFromCastTarget(module, ActionID.MakeSpell(AID.BarrelBreaker), 20)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,19 @@ public override void OnCastFinished(Actor caster, ActorCastInfo spell)
_ => null
};

private void UpdateAOE(ArenaBoundsCustom? platform)
private void UpdateAOE(ArenaBoundsComplex? platform)
{
var activation = WorldState.FutureTime(6);
var center = Arena.Bounds == Ex3QueenEternal.NormalBounds ? Ex3QueenEternal.ArenaCenter
: Arena.Bounds == Ex3QueenEternal.IceBridgeBounds ? Ex3QueenEternal.IceBridgeBounds.Center
: Arena.Bounds == Ex3QueenEternal.EarthBounds ? Ex3QueenEternal.EarthBounds.Center
: Arena.Bounds == Ex3QueenEternal.WindBounds ? Ex3QueenEternal.WindBounds.Center : Arena.Center;
if (platform == Ex3QueenEternal.WindBounds)
_aoe = new(windArena, Arena.Center, default, activation);
_aoe = new(windArena, center, default, activation);
else if (platform == Ex3QueenEternal.EarthBounds)
_aoe = new(earthArena, Arena.Center, default, activation);
_aoe = new(earthArena, center, default, activation);
else if (platform == Ex3QueenEternal.IceBridgeBounds)
_aoe = new(iceArena, Arena.Center, default, activation);
_aoe = new(iceArena, center, default, activation);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class AlphaAlligator(WorldState ws, Actor primary) : BossModule(ws, prima
new(406.44f, -129.39f), new(407.78f, -134.79f), new(408.15f, -135.35f), new(420.82f, -140.11f), new(423.33f, -140.59f)];
private static readonly ArenaBoundsComplex arena = new([new PolygonCustom(vertices)]);

protected override bool CheckPull() => WorldState.Actors.Any(x => x.InCombat);
protected override bool CheckPull() => WorldState.Actors.Any(x => x.InCombat && x.Position.AlmostEqual(Arena.Center, Bounds.Radius));

protected override void DrawEnemies(int pcSlot, Actor pc)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ public enum IconID : uint
Spreadmarker = 140 // WukLamat/Koana/player->self
}

public enum SID : uint
{
Rehabilitation = 279 // Boss->Boss, extra=0x0
}

class CandescentRayLineStack(BossModule module) : Components.LineStack(module, null, ActionID.MakeSpell(AID.CandescentRayLineStack), minStackSize: 3, maxStackSize: 3);
class CandescentRayTB(BossModule module) : Components.CastSharedTankbuster(module, ActionID.MakeSpell(AID.CandescentRayTB), new AOEShapeRect(50, 4))
{
Expand Down Expand Up @@ -90,10 +85,10 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme
class Ensnare(BossModule module) : Components.LocationTargetedAOEs(module, ActionID.MakeSpell(AID.Ensnare), 6);
class TriceraSnare(BossModule module) : Components.SpreadFromIcon(module, (uint)IconID.Spreadmarker, ActionID.MakeSpell(AID.TriceraSnare), 6, 4.7f)
{
public override void OnStatusLose(Actor actor, ActorStatus status)
public override void OnEventDirectorUpdate(uint updateID, uint param1, uint param2, uint param3, uint param4)
{
if ((SID)status.ID == SID.Rehabilitation) // on phase change all pending spreads get cancelled
Spreads.Clear();
// on phase change all pending spreads get cancelled
Spreads.Clear();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public override void OnEventEnvControl(byte index, uint state)

public override void OnCastFinished(Actor caster, ActorCastInfo spell)
{
if (_aoes.Count > 0 && (AID)spell.Action.ID is AID.CorrosiveVenom or AID.ToxinShower)
if (_aoes.Count != 0 && (AID)spell.Action.ID is AID.CorrosiveVenom or AID.ToxinShower)
_aoes.RemoveAt(0);
}
}
Expand Down
12 changes: 9 additions & 3 deletions BossMod/Modules/Endwalker/Trial/T08Asura/T08Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@ public enum OID : uint
Helper = 0x233C,
Helper2 = 0x40A9,
PhantomAsura = 0x40F8, //R=5.0
AsuraImage = 0x40A2, //R=45.0
AsuraImage = 0x40A2 //R=45.0
}

public enum AID : uint
{
AutoAttack = 870, // Boss->player, no cast, single-target

LowerRealm = 36001, // Boss->self, 5.0s cast, range 40 circle, raidwide
Teleport = 35966, // Boss->location, no cast, single-target, boss teleports mid

AsuriChakra = 35994, // Boss->self, 6.0s cast, range 5 circle
Chakra1 = 35995, // Helper->self, 6.0s cast, range 6-8 donut
Chakra2 = 35996, // Helper->self, 6.0s cast, range 9-11 donut
Chakra4 = 35997, // Helper->self, 6.0s cast, range 12-14 donut
Chakra3 = 35998, // Helper->self, 6.0s cast, range 15-17 donut
Chakra5 = 35999, // Helper->self, 6.0s cast, range 18-20 donut

CuttingJewel = 36000, // Boss->players, 5.0s cast, range 4 circle, tankbuster
Ephemerality = 35990, // Boss->self, 5.0s cast, range 20 circle, raidwide
Laceration = 35991, // PhantomAsura->self, 1.0s cast, range 9 circle
Expand All @@ -36,6 +39,7 @@ public enum AID : uint
IconographyBladewise = 35973, // Boss->self, 5.0s cast, range 50 width 6 rect
Bladewise = 35974, // AsuraImage->self, 4.0s cast, range 100 width 28 rect
RemoveStatus = 36010, // AsuraImage->self, no cast, single-target, removes status 2552 (unknown effect) from itself

KhadgaTelegraph1 = 36011, // Helper->self, 2.0s cast, range 20 180-degree cone
KhadgaTelegraph2 = 36013, // Helper->self, 2.0s cast, range 20 180-degree cone
KhadgaTelegraph3 = 36012, // Helper->self, 2.0s cast, range 20 180-degree cone
Expand All @@ -46,6 +50,7 @@ public enum AID : uint
Khadga4 = 35978, // Boss->self, no cast, range 20 180-degree cone
Khadga5 = 35982, // Boss->self, no cast, range 20 180-degree cone
Khadga6 = 35979, // Boss->self, no cast, range 20 180-degree cone

ManyFaces1 = 35983, // Boss->self, 4.0s cast, single-target
ManyFaces2 = 36014, // Boss->self, no cast, single-target
TheFaceOfWrathA = 35984, // Boss->self, 8.0s cast, single-target
Expand All @@ -58,13 +63,14 @@ public enum AID : uint
TheFaceOfDelight = 36023, // Helper->self, no cast, single-target
TheFaceOfDelightSnapshot = 36007, // Helper->self, no cast, range 20 180-degree cone
TheFaceOfWrathSnapshot = 36006, // Helper->self, no cast, range 20 180-degree cone

MyriadAspects = 36019, // Boss->self, 3.0s cast, single-target
MyriadAspects1 = 36020, // Helper->self, 4.0s cast, range 40 30-degree cone
MyriadAspects2 = 36021, // Helper->self, 6.0s cast, range 40 30-degree cone
Bladescatter = 35992, // Boss->self, 5.0s cast, single-target
Scattering = 35993, // Helper->self, 3.0s cast, range 20 width 6 rect
OrderedChaos = 36002, // Boss->self, no cast, single-target
OrderedChaos2 = 36003, // Helper->player, 5.0s cast, range 5 circle
OrderedChaos2 = 36003 // Helper->player, 5.0s cast, range 5 circle
}

public enum IconID : uint
Expand All @@ -76,5 +82,5 @@ public enum IconID : uint
Khadga4 = 457, // Helper, icon 4
Khadga5 = 458, // Helper, icon 5
Khadga6 = 459, // Helper, icon 6
Spreadmarker = 139, // player
Spreadmarker = 139 // player
}
36 changes: 8 additions & 28 deletions BossMod/Modules/Endwalker/Trial/T08Asura/T08MyriadAspects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,23 @@ namespace BossMod.Endwalker.Trial.T08Asura;
class MyriadAspects(BossModule module) : Components.GenericAOEs(module)
{
private static readonly AOEShapeCone cone = new(40, 15.Degrees());
private DateTime _activation1;
private DateTime _activation2;
private readonly List<ActorCastInfo> _spell1 = [];
private readonly List<ActorCastInfo> _spell2 = [];
private readonly List<AOEInstance> _aoes = [];

public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
if (NumCasts < 6 && _spell1.Count > 0)
foreach (var c in _spell1)
yield return new(cone, Module.Center, c.Rotation, _activation1);
if (NumCasts >= 6 && _spell2.Count > 0)
foreach (var c in _spell2)
yield return new(cone, Module.Center, c.Rotation, _activation2);
}
public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor) => _aoes.Take(6);

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
if ((AID)spell.Action.ID == AID.MyriadAspects1)
{
_activation1 = Module.CastFinishAt(spell);
_spell1.Add(spell);
}
if ((AID)spell.Action.ID == AID.MyriadAspects2)
if ((AID)spell.Action.ID is AID.MyriadAspects1 or AID.MyriadAspects2)
{
_activation2 = Module.CastFinishAt(spell);
_spell2.Add(spell);
_aoes.Add(new(cone, caster.Position, spell.Rotation, Module.CastFinishAt(spell)));
if (_aoes.Count == 12)
_aoes.SortBy(x => x.Activation);
}
}

public override void OnCastFinished(Actor caster, ActorCastInfo spell)
{
if ((AID)spell.Action.ID is AID.MyriadAspects1 or AID.MyriadAspects2)
if (++NumCasts == 12)
{
NumCasts = 0;
_spell1.Clear();
_spell2.Clear();
}
if (_aoes.Count != 0 && (AID)spell.Action.ID is AID.MyriadAspects1 or AID.MyriadAspects2)
_aoes.RemoveAt(0);
}
}
18 changes: 17 additions & 1 deletion BossMod/Replay/ReplayParserLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,23 @@ public override Angle ReadAngle()
public override long ReadLong() => _input.ReadInt64();
public override byte ReadByte(bool hex) => _input.ReadByte();
public override ushort ReadUShort(bool hex) => _input.ReadUInt16();
public override uint ReadUInt(bool hex) => _input.ReadUInt32();
public override uint ReadUInt(bool hex)
{
try
{
return _input.ReadUInt32();
}
catch (EndOfStreamException)
{
Service.Log("Reached the end of the file unexpectedly. Returning default value.");
return 0;
}
catch (Exception ex)
{
Service.Log($"An unexpected error occurred: {ex.Message}");
throw;
}
}
public override ulong ReadULong(bool hex) => _input.ReadUInt64();
public override byte[] ReadBytes() => _input.ReadBytes(_input.ReadInt32());
public override ActionID ReadAction() => new(_input.ReadUInt32());
Expand Down

0 comments on commit ccc9aa4

Please sign in to comment.