From 8b0490687ecfd8ad36d9350c8b8cf4e08787b878 Mon Sep 17 00:00:00 2001 From: dingo Date: Thu, 26 Mar 2026 15:01:36 -0400 Subject: [PATCH] Add boardShape to client rules editor + ability builder help docs - rules_editor_dialog.gd: add add_option helper, boardShape OptionButton in BOARD section (Default/Rectangle/Cross/Triangular/RadialStar/HexRing), and OptionButton branch in _on_confirm - lobby_room_screen.gd: add boardShape to both rules display dicts - AbilityBuilder.razor: add help docs for OnUnitSentToDiscard CausedBy field - GameDbContextModelSnapshot.cs: reflect AddBoardShapeOverride migration Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .../components/rules_editor_dialog.gd | 21 ++++++++++++++ .../scenes/free_play/lobby_room_screen.gd | 2 ++ .../Pages/Cards/AbilityBuilder.razor | 29 +++++++++++++++++++ .../Game/GameDbContextModelSnapshot.cs | 3 ++ 4 files changed, 55 insertions(+) diff --git a/Client/origin-client/scenes/free_play/components/rules_editor_dialog.gd b/Client/origin-client/scenes/free_play/components/rules_editor_dialog.gd index b5d9f57..8780d0d 100644 --- a/Client/origin-client/scenes/free_play/components/rules_editor_dialog.gd +++ b/Client/origin-client/scenes/free_play/components/rules_editor_dialog.gd @@ -40,6 +40,8 @@ func _build_fields(r: Dictionary) -> void: return int(r[k]) if r.has(k) else d var get_b := func(k: String, d: bool) -> bool: return bool(r[k]) if r.has(k) else d + var get_s := func(k: String, d: String) -> String: + return str(r[k]) if r.has(k) and r[k] != null else d var add_int := func(label: String, key: String, min_v: int, max_v: int, def_v: int, note: String) -> void: var hbox := HBoxContainer.new() @@ -70,6 +72,22 @@ func _build_fields(r: Dictionary) -> void: fields_box.add_child(hbox) _controls[key] = chk + var add_option := func(label: String, key: String, options: Array, def_v: String) -> void: + var hbox := HBoxContainer.new() + var lbl := Label.new() + lbl.text = label + lbl.size_flags_horizontal = Control.SIZE_EXPAND_FILL + hbox.add_child(lbl) + var opt := OptionButton.new() + for o in options: + opt.add_item(o) + var cur := get_s.call(key, def_v) + var idx := options.find(cur) + opt.selected = idx if idx >= 0 else 0 + hbox.add_child(opt) + fields_box.add_child(hbox) + _controls[key] = opt + # ── Hand & Cards ────────────────────────────────────────────────────────── _section("HAND & CARDS") add_int.call("Opening Hand Size", "openingHandSize", 1, 20, 6, "") @@ -94,6 +112,7 @@ func _build_fields(r: Dictionary) -> void: add_int.call("Board Width", "boardWidth", 3, 12, 6, "") add_int.call("Board Height", "boardHeight", 3, 12, 6, "") add_int.call("Starting Tile Affinity %","startingRandomTilePct",0, 100, 0, "% of tiles with a random basic affinity") + add_option.call("Board Shape", "boardShape", ["Default", "Rectangle", "Cross", "Triangular", "RadialStar", "HexRing"], "Default") # ── Deck ─────────────────────────────────────────────────────────────────── _section("DECK") @@ -124,5 +143,7 @@ func _on_confirm() -> void: overrides[key] = int(ctrl.value) elif ctrl is CheckBox: overrides[key] = ctrl.button_pressed + elif ctrl is OptionButton: + overrides[key] = ctrl.get_item_text(ctrl.selected) confirmed.emit(overrides) queue_free() diff --git a/Client/origin-client/scenes/free_play/lobby_room_screen.gd b/Client/origin-client/scenes/free_play/lobby_room_screen.gd index 05eb115..9f96cd7 100644 --- a/Client/origin-client/scenes/free_play/lobby_room_screen.gd +++ b/Client/origin-client/scenes/free_play/lobby_room_screen.gd @@ -293,6 +293,7 @@ func _update_rules_label() -> void: "boardWidth": "Board W", "boardHeight": "Board H", "startingRandomTilePct":"Starting Tile %", + "boardShape": "Board Shape", } for key in fields: if _current_rules.has(key): @@ -378,6 +379,7 @@ func _format_rules_summary(rules: Dictionary) -> String: "boardWidth": "Board W", "boardHeight": "Board H", "startingRandomTilePct":"Starting Tile %", + "boardShape": "Board Shape", "firstPlayerSkipsDraw": "1st Player Skips Draw", "minDeckSize": "Min Deck", "maxDeckSize": "Max Deck", diff --git a/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor b/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor index 6a156ca..11ba1ff 100644 --- a/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor +++ b/Server/src/SOR.Admin/Components/Pages/Cards/AbilityBuilder.razor @@ -932,6 +932,35 @@ +
Trigger-Specific Fields
+

Some trigger types expose extra filtering fields beyond Ownership and UnitType.

+ +

OnUnitSentToDiscard — CausedBy

+

Fires whenever a unit is sent to the discard pile from the battlefield. This includes:

+
    +
  • Combat — the attacker kills the target (or counterattack kills the attacker)
  • +
  • Ability — a KillUnit or SendToDiscard ability effect resolves
  • +
+

The optional CausedBy field narrows the trigger to units killed by a specific owner class:

+ + + + + + + + + +
CausedBy valueFires when the killer is…
(empty)Any killer — trigger fires regardless of who caused the discard
ExactSelfThis specific unit instance — the unit that owns this ability was the one that dealt the killing blow (Bloodlust pattern)
OwnerAny unit controlled by the same player as this unit
EnemyAny opponent-controlled unit caused the discard
AnySame as empty — any killer
+

Note: Ownership still filters the unit being discarded; CausedBy filters the killer. Use Ownership: Any, CausedBy: ExactSelf to react whenever this unit kills anything.

+ +

Bloodlust example — "When this spirit sends another spirit to the discard, gain +1 attack":

+
{"$type":"OnUnitSentToDiscard","UnitType":"Spirit","Ownership":"Any","CausedBy":"ExactSelf"}
+

Action: Scope Battlefield, Ownership ExactSelf, Effect ModifyStat — Stat Damage, Amt +1, Duration PermanentInMatch (or UntilEndOfTurn for temporary buff).

+ +

OnUnitDeath vs OnUnitSentToDiscard

+

Use OnUnitDeath to react to any unit being killed (e.g. opponent's unit dies anywhere). Use OnUnitSentToDiscard when you specifically want the killer identity via CausedBy, or when you need to distinguish combat-killed units from sacrificed/returned units (sacrificed units fire OnSpiritSacrificed, not OnUnitSentToDiscard).

+
diff --git a/Server/src/SOR.Database/Migrations/Game/GameDbContextModelSnapshot.cs b/Server/src/SOR.Database/Migrations/Game/GameDbContextModelSnapshot.cs index 1d77544..a87fd57 100644 --- a/Server/src/SOR.Database/Migrations/Game/GameDbContextModelSnapshot.cs +++ b/Server/src/SOR.Database/Migrations/Game/GameDbContextModelSnapshot.cs @@ -36,6 +36,9 @@ namespace SOR.Database.Migrations.Game b.Property("BoardHeightOverride") .HasColumnType("integer"); + b.Property("BoardShapeOverride") + .HasColumnType("text"); + b.Property("BoardWidthOverride") .HasColumnType("integer");