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

Config option to prevent gap closers that would go into a forbidden zone #587

Merged
merged 1 commit into from
Feb 7, 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: 14 additions & 0 deletions BossMod/ActionQueue/ActionDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@ public void Dispose()
public static Actor? FindEsunaTarget(WorldState ws) => ws.Party.WithoutSlot().FirstOrDefault(p => p.Statuses.Any(s => Utils.StatusIsRemovable(s.ID)));
public static Actor? SmartTargetEsunable(WorldState ws, Actor player, Actor? primaryTarget, AIHints hints) => SmartTargetFriendly(primaryTarget) ?? FindEsunaTarget(ws) ?? player;

// check if dashing to target will put the player inside a forbidden zone
// TODO should we check if dash trajectory will cross any zones with imminent activation?
public static bool PreventDashIfDangerous(WorldState _, Actor player, Actor? target, AIHints hints)
{
if (target == null || !Service.Config.Get<ActionTweaksConfig>().PreventDangerousDash)
return false;

var dist = player.DistanceToHitbox(target);
var dir = player.DirectionTo(target).Normalized();
var src = player.Position;
var proj = dist > 0 ? src + dir * MathF.Max(0, dist) : src;
return hints.ForbiddenZones.Any(d => d.shapeDistance(proj) < 0);
}

public BitMask SpellAllowedClasses(Lumina.Excel.Sheets.Action data)
{
BitMask res = default;
Expand Down
2 changes: 2 additions & 0 deletions BossMod/ActionQueue/Casters/RDM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,7 @@ private void Customize(ActionDefinitions d)
{
d.RegisterChargeIncreaseTrait(AID.Acceleration, TraitID.EnhancedAcceleration);
// *** add any properties that can't be autogenerated here ***

d.Spell(AID.CorpsACorps)!.ForbidExecute = ActionDefinitions.PreventDashIfDangerous;
}
}
2 changes: 2 additions & 0 deletions BossMod/ActionQueue/Casters/SMN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,7 @@ private void Customize(ActionDefinitions d)
{
d.RegisterChargeIncreaseTrait(AID.RadiantAegis, TraitID.EnhancedRadiantAegis);
// *** add any properties that can't be autogenerated here ***

d.Spell(AID.CrimsonCyclone)!.ForbidExecute = ActionDefinitions.PreventDashIfDangerous;
}
}
2 changes: 2 additions & 0 deletions BossMod/ActionQueue/Melee/DRG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,7 @@ private void Customize(ActionDefinitions d)
//d.Spell(AID.TrueThrust)!.TransformAction = d.Spell(AID.RaidenThrust)!.TransformAction = () => ActionID.MakeSpell(_state.BestTrueThrust);
//d.Spell(AID.DoomSpike)!.TransformAction = d.Spell(AID.DraconianFury)!.TransformAction = () => ActionID.MakeSpell(_state.BestDoomSpike);
//d.Spell(AID.Geirskogul)!.TransformAction = d.Spell(AID.Nastrond)!.TransformAction = () => ActionID.MakeSpell(_state.BestGeirskogul);

d.Spell(AID.Stardiver)!.ForbidExecute = d.Spell(AID.DragonfireDive)!.ForbidExecute = ActionDefinitions.PreventDashIfDangerous;
}
}
2 changes: 2 additions & 0 deletions BossMod/ActionQueue/Melee/NIN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ public void Dispose() { }
private void Customize(ActionDefinitions d)
{
d.RegisterChargeIncreaseTrait(AID.Shukuchi, TraitID.EnhancedShukuchiII);

d.Spell(AID.ForkedRaiju)!.ForbidExecute = ActionDefinitions.PreventDashIfDangerous;
}
}

2 changes: 2 additions & 0 deletions BossMod/ActionQueue/Melee/SAM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,7 @@ private void Customize(ActionDefinitions d)
// upgrades (TODO: don't think we actually care...)
//d.Spell(AID.Iaijutsu)!.TransformAction = () => ActionID.MakeSpell(_state.BestIai);
//d.Spell(AID.MeikyoShisui)!.Condition = _ => _state.MeikyoLeft == 0;

d.Spell(AID.HissatsuGyoten)!.ForbidExecute = ActionDefinitions.PreventDashIfDangerous;
}
}
2 changes: 2 additions & 0 deletions BossMod/ActionQueue/Tanks/PLD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,7 @@ private void Customize(ActionDefinitions d)
//d.Spell(AID.HallowedGround)!.EffectDuration = 10;
//d.Spell(AID.DivineVeil)!.EffectDuration = 30;
// TODO: Intervention effect duration?

d.Spell(AID.Intervene)!.ForbidExecute = ActionDefinitions.PreventDashIfDangerous;
}
}
2 changes: 2 additions & 0 deletions BossMod/ActionQueue/Tanks/WAR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,7 @@ private void Customize(ActionDefinitions d)
//d.Spell(AID.StormEye)!.TransformAction = config.STCombos ? () => ActionID.MakeSpell(Rotation.GetNextSTComboAction(ComboLastMove, AID.StormEye)) : null;
//d.Spell(AID.StormPath)!.TransformAction = config.STCombos ? () => ActionID.MakeSpell(Rotation.GetNextSTComboAction(ComboLastMove, AID.StormPath)) : null;
//d.Spell(AID.MythrilTempest)!.TransformAction = config.AOECombos ? () => ActionID.MakeSpell(Rotation.GetNextAOEComboAction(ComboLastMove)) : null;

d.Spell(AID.Onslaught)!.ForbidExecute = d.Spell(AID.PrimalRend)!.ForbidExecute = ActionDefinitions.PreventDashIfDangerous;
}
}
3 changes: 3 additions & 0 deletions BossMod/ActionTweaks/ActionTweaksConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,7 @@ public enum GroundTargetingMode
}
[PropertyDisplay("Automatic target selection for ground-targeted abilities")]
public GroundTargetingMode GTMode = GroundTargetingMode.Manual;

[PropertyDisplay("Try to prevent dashing into AOEs", tooltip: "Prevent automatic use of damaging gap closers (like WAR Onslaught) if they would move you into a dangerous area. May not work as expected in instances that do not have modules.")]
public bool PreventDangerousDash = false;
}