Skip to content

Commit

Permalink
converted stage 28, 29 to refactored code
Browse files Browse the repository at this point in the history
  • Loading branch information
CarnifexOptimus committed Apr 13, 2024
1 parent 73b0030 commit 54826d7
Show file tree
Hide file tree
Showing 12 changed files with 447 additions and 25 deletions.
4 changes: 2 additions & 2 deletions BossMod/Components/PersistentVoidzone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public class PersistentVoidzoneAtCastTarget(BossModule module, float radius, Act
public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
foreach (var p in _predictedByEvent)
yield return new(Shape, p.pos, Activation: p.time);
yield return new(Shape, p.pos, default, p.time);
foreach (var p in _predictedByCast)
yield return new(Shape, WorldState.Actors.Find(p.caster.CastInfo!.TargetID)?.Position ?? p.caster.CastInfo.LocXZ, Activation: p.time);
yield return new(Shape, WorldState.Actors.Find(p.caster.CastInfo!.TargetID)?.Position ?? p.caster.CastInfo.LocXZ, default, p.time);
foreach (var z in Sources(Module))
yield return new(Shape, z.Position);
}
Expand Down
6 changes: 3 additions & 3 deletions BossMod/Modules/Endwalker/Alliance/A13Azeyma/SolarFans.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class RadiantFlourish(BossModule module) : Components.GenericAOEs(module)
public override void OnCastFinished(Actor caster, ActorCastInfo spell)
{
if ((AID)spell.Action.ID == AID.SolarFansAOE)
_aoes.Add(new(circle, spell.LocXZ, Activation: WorldState.FutureTime(16.6f)));
_aoes.Add(new(circle, spell.LocXZ, default, WorldState.FutureTime(16.6f)));
if ((AID)spell.Action.ID == AID.RadiantFlourish)
{
_aoes.Clear();
Expand All @@ -83,8 +83,8 @@ public override void OnEventCast(Actor caster, ActorCastEvent spell)
if (++teleportcounter > 8)
{
teleportcounter = 0;
_aoes.Add(new(circle, Helpers.RotateAroundOrigin(90, Module.Bounds.Center, _aoes[0].Origin), Activation: _aoes[0].Activation.AddSeconds(1.4f)));
_aoes.Add(new(circle, Helpers.RotateAroundOrigin(90, Module.Bounds.Center, _aoes[1].Origin), Activation: _aoes[1].Activation.AddSeconds(1.4f)));
_aoes.Add(new(circle, Helpers.RotateAroundOrigin(90, Module.Bounds.Center, _aoes[0].Origin), default, _aoes[0].Activation.AddSeconds(1.4f)));
_aoes.Add(new(circle, Helpers.RotateAroundOrigin(90, Module.Bounds.Center, _aoes[1].Origin), default, _aoes[1].Activation.AddSeconds(1.4f)));
_aoes.RemoveAt(0);
_aoes.RemoveAt(0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
var _blueFlowers = Module.Enemies(OID.BlueSafeZone).FirstOrDefault();
var _goldFlowers = Module.Enemies(OID.GoldSafeZone).FirstOrDefault();
if (_flowers.Count > 0)
yield return new(_shape, _flowers[0].actor.OID == (uint)OID.BlueFlowers ? _blueFlowers!.Position : _goldFlowers!.Position, Activation: _flowers[0].activation);
yield return new(_shape, _flowers[0].actor.OID == (uint)OID.BlueFlowers ? _blueFlowers!.Position : _goldFlowers!.Position, default, _flowers[0].activation);
}

public override void OnActorCreated(Actor actor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ public override void OnEventIcon(Actor actor, uint iconID)
{
if (currentIndex == 0x17)
foreach (var r in StartingCoords)
_aoes.Add(new(rect, Helpers.RotateAroundOrigin(0, origin, r), Activation: _activation));
_aoes.Add(new(rect, Helpers.RotateAroundOrigin(0, origin, r), default, _activation));
if (currentIndex == 0x4A)
foreach (var r in StartingCoords)
_aoes.Add(new(rect, Helpers.RotateAroundOrigin(-90, origin, r), Activation: _activation));
_aoes.Add(new(rect, Helpers.RotateAroundOrigin(-90, origin, r), default, _activation));
}
if (iconID == (uint)IconID.CounterClockwiseHieroglyphika)
{
if (currentIndex == 0x4A)
foreach (var r in StartingCoords)
_aoes.Add(new(rect, Helpers.RotateAroundOrigin(90, origin, r), Activation: _activation));
_aoes.Add(new(rect, Helpers.RotateAroundOrigin(90, origin, r), default, _activation));
if (currentIndex == 0x17)
foreach (var r in StartingCoords)
_aoes.Add(new(rect, Helpers.RotateAroundOrigin(180, origin, r), Activation: _activation));
_aoes.Add(new(rect, Helpers.RotateAroundOrigin(180, origin, r), default, _activation));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public override void OnEventEnvControl(byte index, uint state)
if (index == 0x48)
{
if (state == 0x00200010)
_aoe = new(circle, new WPos(-0.015f, 759.975f), Activation: _activation);
_aoe = new(circle, new WPos(-0.015f, 759.975f), default, _activation);
if (state == 0x00020001)
_aoe = new(circle, new WPos(-0.015f, 739.986f), Activation: _activation);
_aoe = new(circle, new WPos(-0.015f, 739.986f), default, _activation);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public override void OnEventIcon(Actor actor, uint iconID)
_aoes.Add(new(rect, Helpers.RotateAroundOrigin(0, origin, r), 180.Degrees(), _activation));
if (iconID == (uint)IconID.CounterClockwiseHieroglyphika)
foreach (var r in StartingCoords)
_aoes.Add(new(rect, Helpers.RotateAroundOrigin(180, origin, r), Activation: _activation));
_aoes.Add(new(rect, Helpers.RotateAroundOrigin(180, origin, r), default, _activation));
}

public override void OnEventCast(Actor caster, ActorCastEvent spell)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public override void OnCastStarted(Actor caster, ActorCastInfo spell)
// 3rd form: 0x53, 0x54, 0x55, 0x57, 0x56, 0x51, 0x50
// but since we don't need a direction for donuts, we dont need to check it
if ((AID)spell.Action.ID is AID.FirstFormDonut or AID.SecondFormDonut or AID.ThirdFormDonut)
_aoes.Add(new(donut, position, Activation: _activation));
_aoes.Add(new(donut, position, default, _activation));
if ((AID)spell.Action.ID is AID.SecondFormRight or AID.ThirdFormRight)
{
if (_index == 0x52)
Expand Down
20 changes: 10 additions & 10 deletions BossMod/Modules/Endwalker/Trial/T02Hydaelyn/ParhelicCircle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
if (hex != null && tri != null)
{
var c = Module.Bounds.Center;
yield return new(_circle, c, Activation: _activation);
yield return new(_circle, c + _triRadius * (tri.Rotation + 60.Degrees()).ToDirection(), Activation: _activation);
yield return new(_circle, c + _triRadius * (tri.Rotation + 180.Degrees()).ToDirection(), Activation: _activation);
yield return new(_circle, c + _triRadius * (tri.Rotation - 60.Degrees()).ToDirection(), Activation: _activation);
yield return new(_circle, c + _hexRadius * hex.Rotation.ToDirection(), Activation: _activation);
yield return new(_circle, c + _hexRadius * (hex.Rotation + 60.Degrees()).ToDirection(), Activation: _activation);
yield return new(_circle, c + _hexRadius * (hex.Rotation + 120.Degrees()).ToDirection(), Activation: _activation);
yield return new(_circle, c + _hexRadius * (hex.Rotation + 180.Degrees()).ToDirection(), Activation: _activation);
yield return new(_circle, c + _hexRadius * (hex.Rotation - 120.Degrees()).ToDirection(), Activation: _activation);
yield return new(_circle, c + _hexRadius * (hex.Rotation - 60.Degrees()).ToDirection(), Activation: _activation);
yield return new(_circle, c, default, _activation);
yield return new(_circle, c + _triRadius * (tri.Rotation + 60.Degrees()).ToDirection(), default, _activation);
yield return new(_circle, c + _triRadius * (tri.Rotation + 180.Degrees()).ToDirection(), default, _activation);
yield return new(_circle, c + _triRadius * (tri.Rotation - 60.Degrees()).ToDirection(), default, _activation);
yield return new(_circle, c + _hexRadius * hex.Rotation.ToDirection(), default, _activation);
yield return new(_circle, c + _hexRadius * (hex.Rotation + 60.Degrees()).ToDirection(), default, _activation);
yield return new(_circle, c + _hexRadius * (hex.Rotation + 120.Degrees()).ToDirection(), default, _activation);
yield return new(_circle, c + _hexRadius * (hex.Rotation + 180.Degrees()).ToDirection(), default, _activation);
yield return new(_circle, c + _hexRadius * (hex.Rotation - 120.Degrees()).ToDirection(), default, _activation);
yield return new(_circle, c + _hexRadius * (hex.Rotation - 60.Degrees()).ToDirection(), default, _activation);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
yield return new(circle, c.Position, default, _activation);
if (_casters.Count > 0 && _snortingeffectends > WorldState.CurrentTime)
foreach (var c in _casters)
yield return new(circle, c.Position + Math.Min(15, Module.Bounds.IntersectRay(c.Position, (c.Position - Module.PrimaryActor.Position).Normalized()) - c.HitboxRadius / 2) * (c.Position - Module.PrimaryActor.Position).Normalized(), Activation: _activation);
yield return new(circle, c.Position + Math.Min(15, Module.Bounds.IntersectRay(c.Position, (c.Position - Module.PrimaryActor.Position).Normalized()) - c.HitboxRadius / 2) * (c.Position - Module.PrimaryActor.Position).Normalized(), default, _activation);
}

public override void Update()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
namespace BossMod.Global.MaskedCarnivale.Stage28;

public enum OID : uint
{
Boss = 0x2CD2, //R=2.6
UndeadSerf = 0x2CD4, // R=0.5
UndeadSerf2 = 0x2CD3, // R=0.5
UndeadSoldier = 0x2CD5, // R=0.5
UndeadWarrior = 0x2CD6, // R=1.9
UndeadGravekeeper = 0x2CD7, // R=0.75
NecrobaneVoidzone = 0x1EA9FA,
MagitekExplosive = 0x2CEC, //R=0.8
Helper = 0x233C,
}

public enum AID : uint
{
AutoAttack = 19052, // Boss->player, no cast, single-target
AutoAttack2 = 6499, // 2CD4/2CD6/2CD7->player, no cast, single-target
AutoAttack3 = 19068, // 2CD5->player, no cast, single-target
DoomImpending = 19051, // Boss->self, 8,0s cast, range 80 circle, heal to full before cast ends
MarchOfTheDraugar = 19057, // Boss->self, 3,0s cast, single-target, summons 4 different sets of adds
DeathThroes = 19061, // 2CD3->player, no cast, single-target, pull 20 between hitboxes, player becomes unable to move
DeathThroesRecover = 19062, // 2CD3->self, no cast, range 100 circle
Necrobane = 19059, // Boss->location, 4,0s cast, range 6 circle
MegaDeath = 19055, // Boss->self, 6,0s cast, range 80 circle, deadly if not in voidzone
HelblarShriek = 19084, // Boss->self, 4,0s cast, range 50 circle, high dmg if in Necrobane voidzone
FireIII = 19069, // 2CD5->player, 5,0s cast, single-target
FuneralPyre = 19056, // Boss->self, 6,0s cast, range 40 circle, deadly if in Necrobane voidzone
ButterflyFloat = 19065, // 2CD6->player, 3,0s cast, single-target
GlassPunch = 19063, // 2CD6->self, no cast, range 6+R 90-degree cone
Brainstorm = 19054, // Boss->self, 4,0s cast, range 60 circle, forced march debuffs
BilrostSquallVisual = 19081, // Boss->self, 9,0s cast, single-target
BilrostSquall = 19082, // Helper->location, 9,0s cast, range 10 circle
NailInTheCoffin = 19066, // 2CD7->player, no cast, single-target
VengefulSoul = 19067, // 2CD7->location, 3,0s cast, range 6 circle
Cackle = 19053, // Boss->player, 4,0s cast, single-target, high dmg, interruptible
Catapult = 19064, // 2CD6->location, 3,0s cast, range 6 circle
}

public enum SID : uint
{
Doom = 1769, // Boss->player, extra=0x0
Incurable = 1488, // Boss->player, extra=0x0
DeathThroes = 608, // 2CD3->player, extra=0x0
DeathBecomesYou = 2197, // none->player, extra=0x0
Bleeding = 320, // none->player, extra=0x0
RightFace = 1961, // Boss->player, extra=0x0
LeftFace = 1960, // Boss->player, extra=0x0
ForwardMarch = 1958, // Boss->player, extra=0x0
AboutFace = 1959, // Boss->player, extra=0x0
ForcedMarch = 1257, // Boss->player, extra=0x8/0x4/0x2/0x1
}

class DoomImpending(BossModule module) : Components.CastHint(module, ActionID.MakeSpell(AID.DoomImpending), "Heal to full before cast ends!");
class MarchOfTheDraugar(BossModule module) : Components.CastHint(module, ActionID.MakeSpell(AID.MarchOfTheDraugar), "Summons adds! (Kill with fire!)");
class NecrobaneVoidzone(BossModule module) : Components.PersistentInvertibleVoidzoneByCast(module, 6, m => m.Enemies(OID.NecrobaneVoidzone).Where(z => z.EventState != 7), ActionID.MakeSpell(AID.MegaDeath));
class Necrobane(BossModule module) : Components.LocationTargetedAOEs(module, ActionID.MakeSpell(AID.Necrobane), 6);
class HelblarShriek(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSpell(AID.HelblarShriek));
class FuneralPyre(BossModule module) : Components.RaidwideCast(module, ActionID.MakeSpell(AID.FuneralPyre));
class Catapult(BossModule module) : Components.LocationTargetedAOEs(module, ActionID.MakeSpell(AID.Catapult), 6);
class VengefulSoul(BossModule module) : Components.LocationTargetedAOEs(module, ActionID.MakeSpell(AID.VengefulSoul), 6);
class BilrostSquall(BossModule module) : Components.LocationTargetedAOEs(module, ActionID.MakeSpell(AID.BilrostSquall), 10);
class Cackle(BossModule module) : Components.CastInterruptHint(module, ActionID.MakeSpell(AID.Cackle));

class Brainstorm(BossModule module) : Components.StatusDrivenForcedMarch(module, 2, (uint)SID.ForwardMarch, (uint)SID.AboutFace, (uint)SID.LeftFace, (uint)SID.RightFace)
{
public override bool DestinationUnsafe(int slot, Actor actor, WPos pos) => Module.FindComponent<BilrostSquall>()?.ActiveAOEs(slot, actor).Any(z => z.Shape.Check(pos, z.Origin, z.Rotation)) ?? false || !Module.Bounds.Contains(pos);
}

class Hints(BossModule module) : BossComponent(module)
{
public override void AddGlobalHints(GlobalHints hints)
{
hints.Add($"{Module.PrimaryActor.Name} will spawn upto 4 waves of adds which are weak to fire.\nA way to quickly heal yourself to full is mandatory and a ranged fire\nability such as Mustard Bomb and Flying Sardine for interrupts\nare highly recommended.");
}
}

class Stage28States : StateMachineBuilder
{
public Stage28States(BossModule module) : base(module)
{
TrivialPhase()
.ActivateOnEnter<Brainstorm>()
.ActivateOnEnter<Cackle>()
.ActivateOnEnter<BilrostSquall>()
.ActivateOnEnter<VengefulSoul>()
.ActivateOnEnter<Catapult>()
.ActivateOnEnter<FuneralPyre>()
.ActivateOnEnter<HelblarShriek>()
.ActivateOnEnter<Necrobane>()
.ActivateOnEnter<NecrobaneVoidzone>()
.ActivateOnEnter<MarchOfTheDraugar>()
.ActivateOnEnter<DoomImpending>()
.DeactivateOnEnter<Hints>();
}
}

[ModuleInfo(BossModuleInfo.Maturity.Contributed, Contributors = "Malediktus", GroupType = BossModuleInfo.GroupType.MaskedCarnivale, GroupID = 697, NameID = 9233)]
public class Stage28 : BossModule
{
public Stage28(WorldState ws, Actor primary) : base(ws, primary, new ArenaBoundsCircle(new(100, 100), 16))
{
ActivateComponent<Hints>();
}

protected override void DrawEnemies(int pcSlot, Actor pc)
{
Arena.Actor(PrimaryActor, ArenaColor.Enemy);
foreach (var s in Enemies(OID.UndeadSerf))
Arena.Actor(s, ArenaColor.Enemy);
foreach (var s in Enemies(OID.UndeadSerf2))
Arena.Actor(s, ArenaColor.Enemy);
foreach (var s in Enemies(OID.UndeadGravekeeper))
Arena.Actor(s, ArenaColor.Enemy);
foreach (var s in Enemies(OID.UndeadSoldier))
Arena.Actor(s, ArenaColor.Enemy);
foreach (var s in Enemies(OID.UndeadWarrior))
Arena.Actor(s, ArenaColor.Enemy);
}

public override void CalculateAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
base.CalculateAIHints(slot, actor, assignment, hints);
foreach (var e in hints.PotentialTargets)
{
e.Priority = (OID)e.Actor.OID switch
{
OID.UndeadSerf or OID.UndeadSerf2 or OID.UndeadSoldier or OID.UndeadGravekeeper or OID.UndeadWarrior => 2,
OID.Boss => 1,
_ => 0
};
}
}
}
Loading

0 comments on commit 54826d7

Please sign in to comment.