diff --git a/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor b/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor index c9dd2aa..136b9fe 100644 --- a/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor +++ b/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor @@ -51,7 +51,7 @@ @if (ab.TypeStr == "Active") { -
+
-
+
+
+ + +
+
+ + +
+
+
+
+
@@ -408,8 +424,8 @@ ["RemoveAbility"] = """{"AbilityRef":"AbilityName"}""", ["EnableAbility"] = """{"AbilityRef":"AbilityName"}""", ["DisableAbility"] = """{"AbilityRef":"AbilityName"}""", - ["PushUnit"] = """{"Tiles":1}""", - ["PullUnit"] = """{"Tiles":1}""", + ["PushUnit"] = """{"Tiles":1,"BlockedDamage":0}""", + ["PullUnit"] = """{"Tiles":1,"BlockedDamage":0}""", ["DisplaceUnit"] = """{"Tiles":1,"Direction":"North"}""", ["TakeControl"] = """{"Duration":{"Type":"UntilEndOfTurn"}}""", ["GrantMovementControl"] = """{"N":1}""", @@ -489,8 +505,10 @@ Name = node["Name"]?.GetValue() ?? "", Description = node["Description"]?.GetValue() ?? "", UsesPerTurn = node["UsesPerTurn"]?.GetValue() ?? 1, - RangeMin = node["Range"]?["Min"]?.GetValue(), - RangeMax = node["Range"]?["Max"]?.GetValue(), + RangeMin = node["Range"]?["Min"]?.GetValue(), + RangeMax = node["Range"]?["Max"]?.GetValue(), + RangeRequiresLos = node["Range"]?["RequiresLos"]?.GetValue() ?? false, + RangeLinearOnly = node["Range"]?["LinearOnly"]?.GetValue() ?? false, AuraRangeMin = node["AuraRange"]?["Min"]?.GetValue(), AuraRangeMax = node["AuraRange"]?["Max"]?.GetValue(), CostJson = node["Cost"] is JsonNode cost ? cost.ToJsonString() : "", @@ -572,11 +590,16 @@ if (ab.TypeStr == "Active") { if (ab.RangeMin.HasValue || ab.RangeMax.HasValue) - node["Range"] = new JsonObject + { + var rangeNode = new JsonObject { ["Min"] = ab.RangeMin ?? 1, ["Max"] = ab.RangeMax ?? 1, }; + if (ab.RangeRequiresLos) rangeNode["RequiresLos"] = true; + if (ab.RangeLinearOnly) rangeNode["LinearOnly"] = true; + node["Range"] = rangeNode; + } node["UsesPerTurn"] = ab.UsesPerTurn; if (!string.IsNullOrWhiteSpace(ab.CostJson)) try { node["Cost"] = JsonNode.Parse(ab.CostJson); } catch { } @@ -700,18 +723,20 @@ private sealed class AbilityDraft { - public string TypeStr { get; set; } = "Active"; - public string Name { get; set; } = ""; - public string Description { get; set; } = ""; - public int? RangeMin { get; set; } - public int? RangeMax { get; set; } - public int UsesPerTurn { get; set; } = 1; - public string CostJson { get; set; } = ""; - public int? AuraRangeMin { get; set; } - public int? AuraRangeMax { get; set; } - public string TriggerType { get; set; } = ""; - public string TriggerJson { get; set; } = ""; - public string ConditionsJson { get; set; } = ""; + public string TypeStr { get; set; } = "Active"; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + public int? RangeMin { get; set; } + public int? RangeMax { get; set; } + public bool RangeRequiresLos { get; set; } = false; + public bool RangeLinearOnly { get; set; } = false; + public int UsesPerTurn { get; set; } = 1; + public string CostJson { get; set; } = ""; + public int? AuraRangeMin { get; set; } + public int? AuraRangeMax { get; set; } + public string TriggerType { get; set; } = ""; + public string TriggerJson { get; set; } = ""; + public string ConditionsJson { get; set; } = ""; public List Actions { get; set; } = new(); } diff --git a/Server/src/SOR.Game/Abilities/Models/Action.cs b/Server/src/SOR.Game/Abilities/Models/Action.cs index fc45a60..311e541 100644 --- a/Server/src/SOR.Game/Abilities/Models/Action.cs +++ b/Server/src/SOR.Game/Abilities/Models/Action.cs @@ -121,6 +121,16 @@ public sealed class CostEntry public sealed class AbilityRange { - public int Min { get; set; } = 1; - public int Max { get; set; } = 1; + public int Min { get; set; } = 1; + public int Max { get; set; } = 1; + /// + /// When true, the engine validates that a clear line of sight exists between the + /// caster and the target tile/unit before allowing the ability to be used. + /// + public bool RequiresLos { get; set; } = false; + /// + /// When true, only targets that lie on a straight cardinal or diagonal line from + /// the caster are valid (e.g. Push, Pull, beam-style abilities). + /// + public bool LinearOnly { get; set; } = false; } diff --git a/Server/src/SOR.Game/Abilities/Models/Effects.cs b/Server/src/SOR.Game/Abilities/Models/Effects.cs index f2c32c5..f3c0b9f 100644 --- a/Server/src/SOR.Game/Abilities/Models/Effects.cs +++ b/Server/src/SOR.Game/Abilities/Models/Effects.cs @@ -196,8 +196,25 @@ public sealed class HOTEffect : Effect { public ValueExpr Amount { // ── §5.9 Displacement ───────────────────────────────────────────────────────── -public sealed class PushUnitEffect : Effect { public int Tiles { get; set; } = 1; } -public sealed class PullUnitEffect : Effect { public int Tiles { get; set; } = 1; } +public sealed class PushUnitEffect : Effect +{ + public int Tiles { get; set; } = 1; + /// + /// Direct HP damage dealt to the pushed unit if it cannot complete the full push + /// (blocked by a boundary or another unit). 0 = no knockback damage. + /// + public int BlockedDamage { get; set; } = 0; +} + +public sealed class PullUnitEffect : Effect +{ + public int Tiles { get; set; } = 1; + /// + /// Direct HP damage dealt to the pulled unit if it cannot complete the full pull + /// (blocked by a boundary or another unit). 0 = no knockback damage. + /// + public int BlockedDamage { get; set; } = 0; +} public sealed class DisplaceUnitEffect : Effect { public int Tiles { get; set; } = 1; public string Direction { get; set; } = "North"; } // ── §5.10 Control effects ─────────────────────────────────────────────────────