From 3c16fcfce57cc1d89c44076fac0b20fdd1cb81b7 Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 8 Mar 2026 17:05:46 -0400 Subject: [PATCH] =?UTF-8?q?Fix:=20admin=20ability=20builder=20=E2=80=94=20?= =?UTF-8?q?ExactSelf=20ownership=20+=20target=20filter=20dropdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TargetOwnerships: add "ExactSelf" so action target selectors can restrict to the specific unit instance that owns the ability (rather than any allied unit). Target Filter dropdown (new): exposes the TargetSelector.Filters[] field that previously had no UI. Supports no-param filter types: • (none) • IsSelf — any unit with the same card definition • IsExactSelf — only this specific instance (InstanceId match) • IsAdjacentToSource Filter compiles to Target.Filters[0] in the JSON and round-trips correctly when loading existing ability JSON back into the builder. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .../Pages/Cards/AbilityBuilder.razor | 46 +++++++++++++------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor b/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor index 5ce69eb..ed8cf0d 100644 --- a/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor +++ b/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor @@ -257,6 +257,18 @@ + +
+
+ + +
+
@@ -409,7 +421,7 @@ private static readonly string[] AbilityTypes = ["Active", "Passive", "Aura", "Triggered"]; private static readonly string[] TargetScopes = ["Hand", "Deck", "Discard", "Battlefield", "Player", "AnyZone"]; private static readonly string[] TargetTypes = ["Unit", "ArchSpirit", "Spirit", "SpiritToken", "Ruin", "Tile", "Card", "Player"]; - private static readonly string[] TargetOwnerships= ["Self", "Owner", "Ally", "Enemy", "Any", "Random", "Target"]; + private static readonly string[] TargetOwnerships= ["Self", "ExactSelf", "Owner", "Ally", "Enemy", "Any", "Random", "Target"]; private static readonly string[] AffinityValues = [ "Void", "Aether", "Lake", "Hill", "Forest", "Field", @@ -612,7 +624,8 @@ if (node["Actions"] is JsonArray actions) foreach (var actionNode in actions.OfType()) { - var target = actionNode["Target"] as JsonObject; + var target = actionNode["Target"] as JsonObject; + var firstFilter= (target?["Filters"] as JsonArray)?.OfType().FirstOrDefault(); var act = new ActionDraft { Scope = target?["Scope"]?.GetValue() ?? "Battlefield", @@ -620,6 +633,7 @@ Ownership = target?["Ownership"]?.GetValue() ?? "Enemy", Count = target?["Count"]?["N"]?.GetValue() ?? 1, All = target?["Count"]?["All"]?.GetValue() ?? false, + FilterType = firstFilter?["$type"]?.GetValue() ?? "", }; if (actionNode["Conditions"] is JsonArray actionConds) @@ -854,21 +868,22 @@ var actionsArr = new JsonArray(); foreach (var action in ab.Actions) { - var actionNode = new JsonObject + var targetNode = new JsonObject { - ["Target"] = new JsonObject + ["Scope"] = action.Scope, + ["Type"] = action.TargetType, + ["Ownership"] = action.Ownership, + ["Count"] = new JsonObject { - ["Scope"] = action.Scope, - ["Type"] = action.TargetType, - ["Ownership"] = action.Ownership, - ["Count"] = new JsonObject - { - ["N"] = action.All ? 1 : action.Count, - ["UpTo"] = false, - ["All"] = action.All, - }, + ["N"] = action.All ? 1 : action.Count, + ["UpTo"] = false, + ["All"] = action.All, }, }; + if (!string.IsNullOrEmpty(action.FilterType)) + targetNode["Filters"] = new JsonArray( + new JsonObject { ["$type"] = action.FilterType }); + var actionNode = new JsonObject { ["Target"] = targetNode }; if (action.Conditions.Count > 0) { @@ -1468,6 +1483,11 @@ public string Ownership { get; set; } = "Enemy"; public int Count { get; set; } = 1; public bool All { get; set; } + /// + /// Optional filter type applied to the target pool (single filter, no-param variant). + /// "" = no filter. Maps to Target.Filters[0] in the compiled JSON. + /// + public string FilterType { get; set; } = ""; public List Conditions { get; set; } = new(); public List Effects { get; set; } = new(); }