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 <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -40,6 +40,8 @@ func _build_fields(r: Dictionary) -> void:
|
|||||||
return int(r[k]) if r.has(k) else d
|
return int(r[k]) if r.has(k) else d
|
||||||
var get_b := func(k: String, d: bool) -> bool:
|
var get_b := func(k: String, d: bool) -> bool:
|
||||||
return bool(r[k]) if r.has(k) else d
|
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 add_int := func(label: String, key: String, min_v: int, max_v: int, def_v: int, note: String) -> void:
|
||||||
var hbox := HBoxContainer.new()
|
var hbox := HBoxContainer.new()
|
||||||
@@ -70,6 +72,22 @@ func _build_fields(r: Dictionary) -> void:
|
|||||||
fields_box.add_child(hbox)
|
fields_box.add_child(hbox)
|
||||||
_controls[key] = chk
|
_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 ──────────────────────────────────────────────────────────
|
# ── Hand & Cards ──────────────────────────────────────────────────────────
|
||||||
_section("HAND & CARDS")
|
_section("HAND & CARDS")
|
||||||
add_int.call("Opening Hand Size", "openingHandSize", 1, 20, 6, "")
|
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 Width", "boardWidth", 3, 12, 6, "")
|
||||||
add_int.call("Board Height", "boardHeight", 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_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 ───────────────────────────────────────────────────────────────────
|
# ── Deck ───────────────────────────────────────────────────────────────────
|
||||||
_section("DECK")
|
_section("DECK")
|
||||||
@@ -124,5 +143,7 @@ func _on_confirm() -> void:
|
|||||||
overrides[key] = int(ctrl.value)
|
overrides[key] = int(ctrl.value)
|
||||||
elif ctrl is CheckBox:
|
elif ctrl is CheckBox:
|
||||||
overrides[key] = ctrl.button_pressed
|
overrides[key] = ctrl.button_pressed
|
||||||
|
elif ctrl is OptionButton:
|
||||||
|
overrides[key] = ctrl.get_item_text(ctrl.selected)
|
||||||
confirmed.emit(overrides)
|
confirmed.emit(overrides)
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|||||||
@@ -293,6 +293,7 @@ func _update_rules_label() -> void:
|
|||||||
"boardWidth": "Board W",
|
"boardWidth": "Board W",
|
||||||
"boardHeight": "Board H",
|
"boardHeight": "Board H",
|
||||||
"startingRandomTilePct":"Starting Tile %",
|
"startingRandomTilePct":"Starting Tile %",
|
||||||
|
"boardShape": "Board Shape",
|
||||||
}
|
}
|
||||||
for key in fields:
|
for key in fields:
|
||||||
if _current_rules.has(key):
|
if _current_rules.has(key):
|
||||||
@@ -378,6 +379,7 @@ func _format_rules_summary(rules: Dictionary) -> String:
|
|||||||
"boardWidth": "Board W",
|
"boardWidth": "Board W",
|
||||||
"boardHeight": "Board H",
|
"boardHeight": "Board H",
|
||||||
"startingRandomTilePct":"Starting Tile %",
|
"startingRandomTilePct":"Starting Tile %",
|
||||||
|
"boardShape": "Board Shape",
|
||||||
"firstPlayerSkipsDraw": "1st Player Skips Draw",
|
"firstPlayerSkipsDraw": "1st Player Skips Draw",
|
||||||
"minDeckSize": "Min Deck",
|
"minDeckSize": "Min Deck",
|
||||||
"maxDeckSize": "Max Deck",
|
"maxDeckSize": "Max Deck",
|
||||||
|
|||||||
@@ -932,6 +932,35 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<h6 class="fw-semibold text-primary">Trigger-Specific Fields</h6>
|
||||||
|
<p class="mb-1">Some trigger types expose extra filtering fields beyond <code>Ownership</code> and <code>UnitType</code>.</p>
|
||||||
|
|
||||||
|
<p class="mb-1"><strong>OnUnitSentToDiscard — <code>CausedBy</code></strong></p>
|
||||||
|
<p class="mb-1">Fires whenever a unit is sent to the discard pile from the battlefield. This includes:</p>
|
||||||
|
<ul class="mb-2">
|
||||||
|
<li>Combat — the attacker kills the target (or counterattack kills the attacker)</li>
|
||||||
|
<li>Ability — a <em>KillUnit</em> or <em>SendToDiscard</em> ability effect resolves</li>
|
||||||
|
</ul>
|
||||||
|
<p class="mb-1">The optional <code>CausedBy</code> field narrows the trigger to units killed by a specific owner class:</p>
|
||||||
|
<table class="table table-sm table-bordered mb-2">
|
||||||
|
<thead class="table-dark"><tr><th>CausedBy value</th><th>Fires when the killer is…</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>(empty)</td><td>Any killer — trigger fires regardless of who caused the discard</td></tr>
|
||||||
|
<tr><td><code>ExactSelf</code></td><td><strong>This specific unit instance</strong> — the unit that owns this ability was the one that dealt the killing blow (Bloodlust pattern)</td></tr>
|
||||||
|
<tr><td><code>Owner</code></td><td>Any unit controlled by the same player as this unit</td></tr>
|
||||||
|
<tr><td><code>Enemy</code></td><td>Any opponent-controlled unit caused the discard</td></tr>
|
||||||
|
<tr><td><code>Any</code></td><td>Same as empty — any killer</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p class="mb-1 text-muted fst-italic">Note: <code>Ownership</code> still filters the <em>unit being discarded</em>; <code>CausedBy</code> filters the <em>killer</em>. Use <code>Ownership: Any, CausedBy: ExactSelf</code> to react whenever this unit kills anything.</p>
|
||||||
|
|
||||||
|
<p class="mb-1 mt-2"><strong>Bloodlust example</strong> — "When this spirit sends another spirit to the discard, gain +1 attack":</p>
|
||||||
|
<pre class="bg-light border rounded p-2 small mb-1">{"$type":"OnUnitSentToDiscard","UnitType":"Spirit","Ownership":"Any","CausedBy":"ExactSelf"}</pre>
|
||||||
|
<p class="mb-1">Action: Scope <code>Battlefield</code>, Ownership <code>ExactSelf</code>, Effect <code>ModifyStat</code> — Stat <code>Damage</code>, Amt +1, Duration <code>PermanentInMatch</code> (or <code>UntilEndOfTurn</code> for temporary buff).</p>
|
||||||
|
|
||||||
|
<p class="mb-1 mt-2"><strong>OnUnitDeath vs OnUnitSentToDiscard</strong></p>
|
||||||
|
<p class="mb-3 text-muted">Use <code>OnUnitDeath</code> to react to any unit being killed (e.g. opponent's unit dies anywhere). Use <code>OnUnitSentToDiscard</code> when you specifically want the <em>killer identity</em> via <code>CausedBy</code>, or when you need to distinguish combat-killed units from sacrificed/returned units (sacrificed units fire <code>OnSpiritSacrificed</code>, not <code>OnUnitSentToDiscard</code>).</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="offcanvas-backdrop fade show" @onclick="() => _showHelp = false" style="z-index:1040"></div>
|
<div class="offcanvas-backdrop fade show" @onclick="() => _showHelp = false" style="z-index:1040"></div>
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ namespace SOR.Database.Migrations.Game
|
|||||||
b.Property<int?>("BoardHeightOverride")
|
b.Property<int?>("BoardHeightOverride")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("BoardShapeOverride")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<int?>("BoardWidthOverride")
|
b.Property<int?>("BoardWidthOverride")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user