Skip to content

Commit

Permalink
fix maulskull
Browse files Browse the repository at this point in the history
  • Loading branch information
CarnifexOptimus committed Feb 10, 2025
1 parent a0fc3d3 commit a5f4e9b
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 52 deletions.
14 changes: 2 additions & 12 deletions BossMod/Modules/Dawntrail/Alliance/A10Trash/A10Despot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ class ScraplineStorm(BossModule module) : Components.KnockbackFromCastTarget(mod
public override bool DestinationUnsafe(int slot, Actor actor, WPos pos)
{
var aoes = _aoe.AOEs;
var aoe = aoes[0];
if (aoes.Count != 0 && aoe.Shape.Check(pos, aoe.Origin, aoe.Rotation))
return true;
else
return false;
return aoes.Count != 0 && aoes[0].Check(pos);
}

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
Expand All @@ -54,13 +50,7 @@ class ScraplineTyphoon(BossModule module) : Components.GenericAOEs(module)
private static readonly AOEShapeCircle circle = new(10f);
private static readonly AOEShapeDonut donut = new(8f, 40f);

public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
if (AOEs.Count != 0)
return [AOEs[0]];
else
return [];
}
public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor) => AOEs.Count != 0 ? [AOEs[0]] : [];

public override void OnCastStarted(Actor caster, ActorCastInfo spell)
{
Expand Down
75 changes: 38 additions & 37 deletions BossMod/Modules/Dawntrail/Dungeon/D03SkydeepCenote/D033Maulskull.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ public enum AID : uint

class Stonecarver(BossModule module) : Components.GenericAOEs(module)
{
private readonly List<AOEInstance> _aoes = new(2);
public readonly List<AOEInstance> AOEs = new(2);
private static readonly AOEShapeRect rect = new(40f, 10f);
private static readonly WDir offset = new(0f, 20f);

public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)
{
var count = _aoes.Count;
var count = AOEs.Count;
if (count == 0)
return [];
var aoes = new AOEInstance[count];
for (var i = 0; i < count; ++i)
{
var aoe = _aoes[i];
var aoe = AOEs[i];
if (i == 0)
aoes[i] = count != 1 ? aoe with { Color = Colors.Danger } : aoe;
else
Expand All @@ -98,32 +98,32 @@ public override void OnCastStarted(Actor caster, ActorCastInfo spell)
case (uint)AID.Stonecarver2:
case (uint)AID.Stonecarver3:
case (uint)AID.Stonecarver4:
_aoes.Add(new(rect, spell.LocXZ, spell.Rotation, Module.CastFinishAt(spell)));
if (_aoes.Count == 2)
_aoes.SortBy(x => x.Activation);
AOEs.Add(new(rect, spell.LocXZ, spell.Rotation, Module.CastFinishAt(spell)));
if (AOEs.Count == 2)
AOEs.SortBy(x => x.Activation);
break;
}
}

public override void OnCastFinished(Actor caster, ActorCastInfo spell)
{
if (_aoes.Count != 0)
if (AOEs.Count != 0)
switch (spell.Action.ID)
{
case (uint)AID.Stonecarver1:
case (uint)AID.Stonecarver2:
case (uint)AID.Stonecarver3:
case (uint)AID.Stonecarver4:
_aoes.RemoveAt(0);
AOEs.RemoveAt(0);
break;
}
}

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
base.AddAIHints(slot, actor, assignment, hints);
if (_aoes.Count != 0)
hints.AddForbiddenZone(ShapeDistance.InvertedRect(Arena.Center + offset, Arena.Center - offset, 2f), _aoes[0].Activation);
if (AOEs.Count != 0)
hints.AddForbiddenZone(ShapeDistance.InvertedRect(Arena.Center + offset, Arena.Center - offset, 2f), AOEs[0].Activation);
}
}

Expand All @@ -148,17 +148,17 @@ public override IEnumerable<AOEInstance> ActiveAOEs(int slot, Actor actor)

public override void OnCastFinished(Actor caster, ActorCastInfo spell)
{
var activation = Module.CastFinishAt(spell, 15.1f);
void AddAOE(AOEShape shape, WPos pos, Angle rot) => _aoes.Add(new(shape, WPos.ClampToGrid(pos), rot, Module.CastFinishAt(spell, 15.1f)));
switch (spell.Action.ID)
{
case (uint)AID.MaulworkFirstCenter:
case (uint)AID.MaulworkSecondCenter:
_aoes.Add(new(rectCenter, caster.Position, spell.Rotation, activation));
AddAOE(rectCenter, caster.Position, spell.Rotation);
break;
case (uint)AID.MaulworkFirstSides:
case (uint)AID.MaulworkSecondSides:
_aoes.Add(new(rectSides, new(91.564f, caster.Position.Z), -17.004f.Degrees(), activation));
_aoes.Add(new(rectSides, new(108.436f, caster.Position.Z), 16.999f.Degrees(), activation));
AddAOE(rectSides, new(91.564f, caster.Position.Z), -17.004f.Degrees());
AddAOE(rectSides, new(108.436f, caster.Position.Z), 16.999f.Degrees());
break;
case (uint)AID.ShatterCenter:
case (uint)AID.ShatterLR1:
Expand All @@ -169,43 +169,44 @@ public override void OnCastFinished(Actor caster, ActorCastInfo spell)
}
}

abstract class Impact(BossModule module, AID aid, int distance) : Components.KnockbackFromCastTarget(module, ActionID.MakeSpell(aid), distance, stopAfterWall: true);
abstract class Impact(BossModule module, AID aid, float distance) : Components.KnockbackFromCastTarget(module, ActionID.MakeSpell(aid), distance, stopAfterWall: true);

class Impact1(BossModule module) : Impact(module, AID.Impact1, 18)
class Impact1(BossModule module) : Impact(module, AID.Impact1, 18f)
{
private static readonly Angle halfAngle = 30.Degrees();
private static readonly Angle halfAngle = 30f.Degrees();

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
var source = Sources(slot, actor).FirstOrDefault();
if (source != default)
hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Origin, 10f, 12f, default, halfAngle), source.Activation);
var source = Casters.Count != 0 ? Casters[0] : null;
if (source != null)
hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Position, 10f, 12f, default, halfAngle), Module.CastFinishAt(source.CastInfo));
}
}

class Impact2(BossModule module) : Impact(module, AID.Impact2, 18)
class Impact2(BossModule module) : Impact(module, AID.Impact2, 18f)
{
private static readonly Angle halfAngle = 20.Degrees();
private static readonly Angle halfAngle = 20f.Degrees();
private readonly Stonecarver _aoe = module.FindComponent<Stonecarver>()!;

public override bool DestinationUnsafe(int slot, Actor actor, WPos pos) => (Module.FindComponent<Stonecarver>()?.ActiveAOEs(slot, actor).Any(z => z.Shape.Check(pos, z.Origin, z.Rotation) && z.Risky) ?? false) || !Arena.InBounds(pos);
public override bool DestinationUnsafe(int slot, Actor actor, WPos pos) => _aoe.AOEs.Count != 0 && _aoe.AOEs[0].Check(pos) || !Module.InBounds(pos);

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
var source = Sources(slot, actor).FirstOrDefault();
if (source != default)
hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Origin, 10f, 12f, default, halfAngle), source.Activation);
var source = Casters.Count != 0 ? Casters[0] : null;
if (source != null)
hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Position, 10f, 12f, default, halfAngle), Module.CastFinishAt(source.CastInfo));
}
}

class Impact3(BossModule module) : Impact(module, AID.Impact3, 20)
class Impact3(BossModule module) : Impact(module, AID.Impact3, 20f)
{
private static readonly Angle halfAngle = 10f.Degrees(), direction = 135f.Degrees();

public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignment assignment, AIHints hints)
{
var source = Sources(slot, actor).FirstOrDefault();
if (source != default)
hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Origin, 10f, 15f, (source.Origin.X == 90f ? 1f : -1f) * direction, halfAngle), source.Activation);
var source = Casters.Count != 0 ? Casters[0] : null;
if (source != null)
hints.AddForbiddenZone(ShapeDistance.InvertedDonutSector(source.Position, 10f, 15f, (source.Position.X == 90f ? 1f : -1f) * direction, halfAngle), Module.CastFinishAt(source.CastInfo));
}
}

Expand All @@ -225,16 +226,16 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme
{
if (Spreads.Count != 0)
{
var source1 = _kb1.Sources(slot, actor).FirstOrDefault();
var source2 = _kb2.Sources(slot, actor).FirstOrDefault();
var source3 = _kb3.Sources(slot, actor).FirstOrDefault();
var knockback = source1 != default || source2 != default || source3 != default;
var source1 = _kb1.Casters.Count != 0 ? _kb1.Casters[0] : null;
var source2 = _kb2.Casters.Count != 0 ? _kb2.Casters[0] : null;
var source3 = _kb3.Casters.Count != 0 ? _kb3.Casters[0] : null;
var knockback = source1 != null || source2 != null || source3 != null;
if (source1 != default)
origin = new(100f, -400f);
else if (source2 != default)
origin = source2.Origin;
origin = source2.Position;
else if (source3 != default)
origin = source3.Origin;
origin = source3.Position;
if (!knockback)
{
base.AddAIHints(slot, actor, assignment, hints);
Expand All @@ -246,7 +247,7 @@ public override void AddAIHints(int slot, Actor actor, PartyRolesConfig.Assignme
}
}

class Landing(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.Landing), 8);
class Landing(BossModule module) : Components.SimpleAOEs(module, ActionID.MakeSpell(AID.Landing), 8f);

abstract class DeepThunder(BossModule module, AID aid) : Components.CastTowers(module, ActionID.MakeSpell(aid), 6f, 4, 4);
class DeepThunder1(BossModule module) : DeepThunder(module, AID.DeepThunderTower1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public override bool DestinationUnsafe(int slot, Actor actor, WPos pos)
{
foreach (var aoe in _aoe.ActiveAOEs(slot, actor))
{
if (aoe.Shape.Check(pos, aoe.Origin, aoe.Rotation))
if (aoe.Check(pos))
return true;
}
return !Arena.InBounds(pos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public override bool DestinationUnsafe(int slot, Actor actor, WPos pos)
for (var i = 0; i < count; ++i)
{
var aoe = _aoe1.AOEs[i];
if (aoe.Shape.Check(pos, aoe.Origin, aoe.Rotation))
if (aoe.Check(pos))
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion BossMod/Modules/Endwalker/FATE/Daivadipa.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public override bool DestinationUnsafe(int slot, Actor actor, WPos pos)
for (var i = 0; i < count; ++i)
{
var aoe = _lit.AOEs[i];
if (aoe.Shape.Check(pos, aoe.Origin, aoe.Rotation))
if (aoe.Check(pos))
return true;
}
return false;
Expand Down

0 comments on commit a5f4e9b

Please sign in to comment.