Skip to content

Commit

Permalink
Stylistic fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
awgil committed Jan 25, 2024
1 parent f7dd747 commit 72e1292
Show file tree
Hide file tree
Showing 39 changed files with 1,117 additions and 734 deletions.
3 changes: 1 addition & 2 deletions BossMod/BossModule/StateMachineBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public Phase OnExit(Action action, bool condition = true)

// note: usually components are deactivated automatically on phase change - manual deactivate is needed only for components that opt out of this (useful for components that need to maintain state across multiple phases)
public Phase ActivateOnEnter<C>(bool condition = true) where C : BossComponent, new() => OnEnter(_module.ActivateComponent<C>, condition);
public Phase DeactivateOnEnter<C>(bool condition = true) where C : BossComponent, new() => OnEnter(_module.DeactivateComponent<C>, condition);
public Phase DeactivateOnEnter<C>(bool condition = true) where C : BossComponent, new() => OnEnter(_module.DeactivateComponent<C>, condition); // TODO: reconsider...
public Phase DeactivateOnExit<C>(bool condition = true) where C : BossComponent => OnExit(_module.DeactivateComponent<C>, condition);
}

Expand Down Expand Up @@ -73,7 +73,6 @@ public State OnExit(Action action, bool condition = true)
}

public State ActivateOnEnter<C>(bool condition = true) where C : BossComponent, new() => OnEnter(_module.ActivateComponent<C>, condition);
public State DeactivateOnEnter<C>(bool condition = true) where C : BossComponent, new() => OnEnter(_module.DeactivateComponent<C>, condition);
public State DeactivateOnExit<C>(bool condition = true) where C : BossComponent => OnExit(_module.DeactivateComponent<C>, condition);
public State ExecOnEnter<C>(Action<C> fn, bool condition = true) where C : BossComponent => OnEnter(() => { var c = _module.FindComponent<C>(); if (c != null) fn(c); }, condition);
public State ExecOnExit<C>(Action<C> fn, bool condition = true) where C : BossComponent => OnExit(() => { var c = _module.FindComponent<C>(); if (c != null) fn(c); }, condition);
Expand Down
67 changes: 35 additions & 32 deletions BossMod/Modules/MaskedCarnivale/ObstacleLayouts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,48 @@ namespace BossMod.MaskedCarnivale
public class Layout2Corners : BossComponent
{
public static IEnumerable<WPos> Wall1()
{
yield return new WPos(85,95);
yield return new WPos(95,95);
yield return new WPos(95,89);
yield return new WPos(94.5f,89);
yield return new WPos(94.5f,94.5f);
yield return new WPos(85,94.5f);
}
public static IEnumerable<WPos> Wall2()
{
yield return new WPos(105,95);
yield return new WPos(115,95);
yield return new WPos(115,94.5f);
yield return new WPos(105.5f,94.5f);
yield return new WPos(105.5f,89);
yield return new WPos(105,89);
}
public override void DrawArenaForeground(BossModule module, int pcSlot, Actor pc, MiniArena arena)
{
arena.AddPolygon(Wall1(),ArenaColor.Border);
arena.AddPolygon(Wall2(),ArenaColor.Border);
}
{
yield return new WPos(85,95);
yield return new WPos(95,95);
yield return new WPos(95,89);
yield return new WPos(94.5f,89);
yield return new WPos(94.5f,94.5f);
yield return new WPos(85,94.5f);
}

public static IEnumerable<WPos> Wall2()
{
yield return new WPos(105,95);
yield return new WPos(115,95);
yield return new WPos(115,94.5f);
yield return new WPos(105.5f,94.5f);
yield return new WPos(105.5f,89);
yield return new WPos(105,89);
}

public override void DrawArenaForeground(BossModule module, int pcSlot, Actor pc, MiniArena arena)
{
arena.AddPolygon(Wall1(),ArenaColor.Border);
arena.AddPolygon(Wall2(),ArenaColor.Border);
}
}

public class Layout4Quads : BossComponent
{
public override void DrawArenaForeground(BossModule module, int pcSlot, Actor pc, MiniArena arena)
{
arena.AddQuad(new(107,110),new(110,113),new(113,110),new(110,107), ArenaColor.Border, 2);
arena.AddQuad(new(93,110),new(90,107),new(87,110),new(90,113), ArenaColor.Border, 2);
arena.AddQuad(new(90,93),new(93,90),new(90,87),new(87,90), ArenaColor.Border, 2);
arena.AddQuad(new(110,93),new(113,90),new(110,87),new(107,90), ArenaColor.Border, 2);
}
{
arena.AddQuad(new(107,110),new(110,113),new(113,110),new(110,107), ArenaColor.Border, 2);
arena.AddQuad(new(93,110),new(90,107),new(87,110),new(90,113), ArenaColor.Border, 2);
arena.AddQuad(new(90,93),new(93,90),new(90,87),new(87,90), ArenaColor.Border, 2);
arena.AddQuad(new(110,93),new(113,90),new(110,87),new(107,90), ArenaColor.Border, 2);
}
}

public class LayoutBigQuad : BossComponent
{
public override void DrawArenaForeground(BossModule module, int pcSlot, Actor pc, MiniArena arena)
{
arena.AddQuad(new(100,107),new(107,100),new(100,93),new(93,100), ArenaColor.Border, 2);
}
{
arena.AddQuad(new(100,107),new(107,100),new(100,93),new(93,100), ArenaColor.Border, 2);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;

// CONTRIB: made by malediktus, not checked
namespace BossMod.MaskedCarnivale.Stage01
{
public enum OID : uint
Expand All @@ -15,35 +16,41 @@ public enum AID : uint
AutoAttack2 = 6497, // 25BE->player, no cast, single-target
IronJustice = 14199, // 25BE->self, 2,5s cast, range 8+R 120-degree cone
};

class IronJustice : Components.SelfTargetedAOEs
{
public IronJustice() : base(ActionID.MakeSpell(AID.IronJustice), new AOEShapeCone(9.5f,60.Degrees())) { }
public IronJustice() : base(ActionID.MakeSpell(AID.IronJustice), new AOEShapeCone(9.5f, 60.Degrees())) { }
}

class Hints : BossComponent
{
public override void AddGlobalHints(BossModule module, GlobalHints hints)
{
hints.Add("This stage is trivial.\nUse whatever skills you have to defeat these opponents.");
}
}
}
}

class Stage01States : StateMachineBuilder
{
public Stage01States(BossModule module) : base(module)
{
TrivialPhase()
.ActivateOnEnter<IronJustice>()
.DeactivateOnEnter<Hints>()
.Raw.Update = () => module.Enemies(OID.Boss).All(e => e.IsDead) && module.Enemies(OID.Slime).All(e => e.IsDead);
.ActivateOnEnter<IronJustice>()
.DeactivateOnEnter<Hints>()
.Raw.Update = () => module.Enemies(OID.Boss).All(e => e.IsDead) && module.Enemies(OID.Slime).All(e => e.IsDead);
}
}

[ModuleInfo(CFCID = 611, NameID = 8077)]
public class Stage01 : BossModule
{
public Stage01(WorldState ws, Actor primary) : base(ws, primary, new ArenaBoundsCircle(new(100, 100), 25))
{
ActivateComponent<Hints>();
}

protected override bool CheckPull() { return PrimaryActor.IsTargetable && PrimaryActor.InCombat || Enemies(OID.Slime).Any(e => e.InCombat); }

protected override void DrawEnemies(int pcSlot, Actor pc)
{
foreach (var s in Enemies(OID.Boss))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;

// CONTRIB: made by malediktus, not checked
namespace BossMod.MaskedCarnivale.Stage02.Act1
{
public enum OID : uint
Expand All @@ -21,47 +22,53 @@ class GoldenTongue : Components.CastHint
{
public GoldenTongue() : base(ActionID.MakeSpell(AID.GoldenTongue), "Can be interrupted, increase its magic damage") { }
}

class Hints : BossComponent
{
public override void AddGlobalHints(BossModule module, GlobalHints hints)
{
hints.Add("To beat this stage in a timely manner,\nyou should have at least one spell of each element.\n(Water, Fire, Ice, Lightning, Earth and Wind)");
}
}
}

class Hints2 : BossComponent
{
public override void AddGlobalHints(BossModule module, GlobalHints hints)
{
hints.Add("Pudding is weak to wind spells.\nMarshmallow is weak to ice spells.\nBavarois is weak to earth spells.");
}
}
}
}

class Stage02Act1States : StateMachineBuilder
{
public Stage02Act1States(BossModule module) : base(module)
{
public Stage02Act1States(BossModule module) : base(module)
{
TrivialPhase()
TrivialPhase()
.ActivateOnEnter<GoldenTongue>()
.ActivateOnEnter<Hints2>()
.ActivateOnEnter<Hints2>()
.DeactivateOnEnter<Hints>()
.Raw.Update = () => module.Enemies(OID.Boss).All(e => e.IsDead) && module.Enemies(OID.Marshmallow).All(e => e.IsDead) && module.Enemies(OID.Bavarois).All(e => e.IsDead);
}
}
}

[ModuleInfo(CFCID = 612, NameID = 8078)]
public class Stage02Act1 : BossModule
{
public Stage02Act1(WorldState ws, Actor primary) : base(ws, primary, new ArenaBoundsCircle(new(100, 100), 25))
{
public Stage02Act1(WorldState ws, Actor primary) : base(ws, primary, new ArenaBoundsCircle(new(100, 100), 25))
{
ActivateComponent<Hints>();
}
protected override bool CheckPull() { return PrimaryActor.IsTargetable && PrimaryActor.InCombat || Enemies(OID.Marshmallow).Any(e => e.InCombat) || Enemies(OID.Bavarois).Any(e => e.InCombat); }
protected override void DrawEnemies(int pcSlot, Actor pc)
{
foreach (var s in Enemies(OID.Boss))
Arena.Actor(s, ArenaColor.Enemy, false);
foreach (var s in Enemies(OID.Marshmallow))
Arena.Actor(s, ArenaColor.Enemy, false);
foreach (var s in Enemies(OID.Bavarois))
Arena.Actor(s, ArenaColor.Enemy, false);
}
ActivateComponent<Hints>();
}

protected override bool CheckPull() { return PrimaryActor.IsTargetable && PrimaryActor.InCombat || Enemies(OID.Marshmallow).Any(e => e.InCombat) || Enemies(OID.Bavarois).Any(e => e.InCombat); }

protected override void DrawEnemies(int pcSlot, Actor pc)
{
foreach (var s in Enemies(OID.Boss))
Arena.Actor(s, ArenaColor.Enemy, false);
foreach (var s in Enemies(OID.Marshmallow))
Arena.Actor(s, ArenaColor.Enemy, false);
foreach (var s in Enemies(OID.Bavarois))
Arena.Actor(s, ArenaColor.Enemy, false);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Linq;

// CONTRIB: made by malediktus, not checked
namespace BossMod.MaskedCarnivale.Stage02.Act2
{
public enum OID : uint
Expand All @@ -22,28 +23,31 @@ class GoldenTongue : Components.CastHint
{
public GoldenTongue() : base(ActionID.MakeSpell(AID.GoldenTongue), "Can be interrupted, increases its magic damage.") { }
}

class Hints : BossComponent
{
public override void AddGlobalHints(BossModule module, GlobalHints hints)
{
hints.Add("Gelato is weak to fire spells.\nFlan is weak to lightning spells.\nLicorice is weak to water spells.");
}
}
}
}

class Stage02Act2States : StateMachineBuilder
{
public Stage02Act2States(BossModule module) : base(module)
{
TrivialPhase()
.ActivateOnEnter<GoldenTongue>()
.ActivateOnEnter<Hints>()
.Raw.Update = () => module.Enemies(OID.Boss).All(e => e.IsDead) && module.Enemies(OID.Flan).All(e => e.IsDead) && module.Enemies(OID.Licorice).All(e => e.IsDead);
.ActivateOnEnter<GoldenTongue>()
.ActivateOnEnter<Hints>()
.Raw.Update = () => module.Enemies(OID.Boss).All(e => e.IsDead) && module.Enemies(OID.Flan).All(e => e.IsDead) && module.Enemies(OID.Licorice).All(e => e.IsDead);
}
}

[ModuleInfo(CFCID = 612, NameID = 8079)]
public class Stage02Act2(WorldState ws, Actor primary) : BossModule(ws, primary, new ArenaBoundsCircle(new(100, 100), 25))
{
protected override bool CheckPull() { return PrimaryActor.IsTargetable && PrimaryActor.InCombat || Enemies(OID.Flan).Any(e => e.InCombat) || Enemies(OID.Licorice).Any(e => e.InCombat); }

protected override void DrawEnemies(int pcSlot, Actor pc)
{
foreach (var s in Enemies(OID.Boss))
Expand All @@ -54,4 +58,4 @@ protected override void DrawEnemies(int pcSlot, Actor pc)
Arena.Actor(s, ArenaColor.Enemy, false);
}
}
}
}
23 changes: 14 additions & 9 deletions BossMod/Modules/MaskedCarnivale/Stage03WaitingForGolem/Stage03.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using BossMod.Components;

// CONTRIB: made by malediktus, not checked
namespace BossMod.MaskedCarnivale.Stage03
{
public enum OID : uint
Expand All @@ -18,44 +19,48 @@ public enum AID : uint

class BoulderClap : SelfTargetedAOEs
{
public BoulderClap() : base(ActionID.MakeSpell(AID.BoulderClap), new AOEShapeCone(14,60.Degrees())) { }
public BoulderClap() : base(ActionID.MakeSpell(AID.BoulderClap), new AOEShapeCone(14, 60.Degrees())) { }
}

class Dreadstorm : PersistentVoidzoneAtCastTarget
{
public Dreadstorm() : base(6, ActionID.MakeSpell(AID.EarthenHeart), m => m.Enemies(OID.voidzone), 0) { }
}

class Obliterate : RaidwideCast
{
public Obliterate() : base(ActionID.MakeSpell(AID.Obliterate), "Interruptible raidwide") { }
}

class Hints : BossComponent
{
public override void AddGlobalHints(BossModule module, GlobalHints hints)
{
hints.Add("Zipacna is weak against water based spells.\nFlying Sardine is recommended to interrupt raidwide.");
}
}
}

class Hints2 : BossComponent
{
public override void AddGlobalHints(BossModule module, GlobalHints hints)
{
hints.Add("Zipacna is weak against water based spells.\nEarth based spells are useless against Zipacna.");
}
}
}
}

class Stage03States : StateMachineBuilder
{
public Stage03States(BossModule module) : base(module)
{
TrivialPhase()
.ActivateOnEnter<BoulderClap>()
.ActivateOnEnter<Dreadstorm>()
.ActivateOnEnter<Obliterate>()
.ActivateOnEnter<Hints2>()
.DeactivateOnEnter<Hints>();
.ActivateOnEnter<BoulderClap>()
.ActivateOnEnter<Dreadstorm>()
.ActivateOnEnter<Obliterate>()
.ActivateOnEnter<Hints2>()
.DeactivateOnEnter<Hints>();
}
}

[ModuleInfo(CFCID = 613, NameID = 8084)]
public class Stage03 : BossModule
{
Expand Down
Loading

0 comments on commit 72e1292

Please sign in to comment.