Commit Graph
571 Commits
Author SHA1 Message Date
2d02567baa chore(phase0): delete AbilityBuilderR2-Draft and AbilityBuilderR3 draft pages
No router or NavMenu references found. Safe removal.

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>
2026-04-19 12:01:16 -04:00
ad98116973 docs(plan): incorporate Ruin bug fixes as Phase 6
From Ruin-IssueResolution.md -- four fixes in priority order:

6-D (highest): stop double OnRuinActivation execution -- source Ruin's abilities
  fire once via FireRuinAbilities; FireTrigger must skip source unit to prevent
  the same abilities re-firing through the general trigger pipeline.
  Note: new ActivateRuinAbilityEffect (Phase 1.8/5.7) must use the same guard.

6-C: server enforce tile.RuinId == null in candidate set + NO_VALID_RUIN_TILE error code

6-B: client preflight -- compute valid no-ruin tiles before showing confirm dialog;
  block and show message if none available

6-A: client confirm dialog before channeling a Ruin card

Delivery note: Phase 6-D must land before Phase 5.7 so the source-skip guard
is in place before ActivateRuinAbilityEffect can trigger through the pipeline.

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>
2026-04-19 11:58:42 -04:00
0f4593ac7c docs(plan): add ActionGroup model -- AND/OR/XOR action grouping at ability level
Introduces ActionGroup { LogicOp, ChooserRole, Actions[], Groups[] } to
replace the flat Action[] on AbilityDefinition. Mirrors CostGroup pattern.

- Axiom A updated: ActionGroup is the ability-level grouping; ChooseOne is
  the within-action effect-branching mechanism -- distinct and complementary
- Axiom B: adds PendingActionGroupPick to the Pending* prompt table
- Axiom C renamed to cover ActionGroup + ChooseOne + CostGroup all having ChooserRole
- Phase 1.3 (new): ActionGroup model, execution semantics (AND/OR/XOR), and
  clear distinction from ChooseOne with concrete examples
- Phase 1.10: AbilityDefinition gains ActionGroup, marks Actions [Obsolete]
  with backwards-compat read rule (wrap Actions in And group if ActionGroup null)
- Phase 4: ActionGroup node type added to palette, canvas layouts show the
  ActionGroup container with AND/OR/XOR header and nested Action children;
  ActionGroup property inspector section added
- Phase 5: 5.1a -- ActionGroup recursive descent in the engine

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>
2026-04-19 11:53:51 -04:00
3b37b15ff0 docs(plan): fix all review gaps -- active fields, trigger coverage, chooser semantics, animation
- Explicit Active ability field list: Range.Min/Max/RequiresLos/LinearOnly, UsesPerTurn
  (verify-and-expose pattern; fields already exist in model, must be wired in builder)
- Enumerate all 40 trigger types with explicit exists/new status table -- no more
  "most already exist" hand-waving
- Split TargetOwnership (whose entities qualify) from TargetChooser (who makes the
  pick); add TargetChooser enum + TargetSelector.Chooser field; map to PendingTargetPick
- Repentance/Instinct: exactly ONE ability per card, Name locked = card Name, no
  additional abilities permitted -- not just "first ability"
- Animation/sound: AbilityAnimationDefinition already on AbilityDefinition; builder
  must expose track name + cast/impact sound URLs in Meta node inspector
- Document CostEntry existing fields (PickMode, Filters) -- confirms no changes needed
- Rewrite entire file in ASCII-safe characters (no mojibake em-dash, arrows, box-drawing)

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>
2026-04-19 11:41:48 -04:00
8795794865 docs(plan): incorporate design decisions and interactive protocol spec
- Lock RecursiveAbility + FullClientPrompt as axioms (Axiom A/B/C)
- Resolve all 6 open questions: SpiritToken constraints, hard EffectsJson
  cutover (migration tool for ~100 cards, column drop), RequiresLOS via
  ArchSpirit as LOS origin, ChooseOne.ChooserRole confirmed, custom drag
- Expand Phase 5 with PendingBranchPick/TilePick/PlayerPick/RevealChoice,
  LOS engine rule, ChooserRole resolution paths

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>
2026-04-19 11:30:17 -04:00
f31aa1f477 docs(plan): add NewCard + Ability System revamp implementation plan
Phase breakdown covering: ability model expansion (cost groups, 12 new
conditions, 15 new effects, trigger enrichments, filter additions),
DB migration, mobile-first card editor revamp, visual node-canvas
ability builder, and engine update work items.

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>
2026-04-19 11:05:56 -04:00
8f3911e881 feat(ability): implement AbilityBuilderR3 + engine additions
Engine:
- AbilityDefinition: add SourceZoneGate (zone-restricted triggers) and TriggerLimitPerGame
- Effects: add StatModOperator (Add/Subtract/Multiply/Divide/Percent) on all stat mod effects; reversal stored as delta
- Action/CostEntry: add CostPickMode enum (Random/SelfPick/EnemySeePick/EnemyRandomPick/EnemyPick)
- PendingCostPick: new model for interactive cost pause/resume (mirrors PendingTriggeredTarget)
- GameState: PendingCostPick field
- GameMessages: CostPickRequestPush, GameCostPickRequest, GameCostPickResponse records
- AbilitySystem: FireTrigger scans Hand/Discard/Deck when SourceZoneGate set; per-game trigger limit tracking; ApplyStatOperator helper; PayCosts/ResumeCostPick for interactive cost flow
- GameCostPickHandler + ServiceRegistration wiring

Admin:
- AbilityBuilderR3.razor: full ability builder at /cards/ability-builder-r3 (39 triggers, 69 effects, 32 conditions, form/canvas/mermaid modes, compiles to engine-native $type JSON)
- AbilityBuilderR2-Draft.razor: fix switch expression no-best-type error

Docs:
- BuilderR3.md: master plan document

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>
2026-04-18 20:15:13 -04:00
Shard 26fa4c810d docs(builder): expand BuilderR2 with exhaustive spec coverage checklist 2026-04-16 16:10:10 +00:00
Shard 9598db0582 docs(ability): add AbilitySystem R2 implementation blueprint 2026-04-16 15:54:28 +00:00
Shard d147a3a469 docs(ability): add trigger source-zone support (hand/discard/deck) 2026-04-16 15:53:05 +00:00
Shard 5ec62b9d42 docs(ability): normalize trigger matrix and reusable schema blocks 2026-04-16 15:39:21 +00:00
Shard 6d1c01cdb2 docs(ability): add v2 builder/card-flow product direction recap 2026-04-16 15:38:36 +00:00
Shard 796fe0b4d1 docs: add ability builder gaps and solutions 2026-04-16 00:55:19 +00:00
Shard ebf864b65d docs: add Ruin issue resolution plan 2026-04-16 00:43:52 +00:00
dingo f966643e31 Spectator fix 2026-04-15 13:35:15 -04:00
dingo 7a987e4347 Merge branch 'main' of https://git.aeternalisgames.com/dingo/SOR 2026-04-15 12:51:28 -04:00
dingo abf2c1d96c AI Match fix 2026-04-15 12:51:14 -04:00
Shard d4113a99be docs: add combined markdown report 2026-04-15 14:03:39 +00:00
afa9e73489 fix(hand): scroll throttle, deselect on spin/click-outside for all card modes
- Throttle hand scroll to one step per 150 ms so each wheel tick advances exactly one card
- Deselect selected card when clicking outside the hand area (deferred flag pattern so board clicks still play the card)
- Extend spin and click-outside deselect to cover TERRAMORPHA_SELECT and card-triggered ABILITY_TARGET (Repentance/Instinct), not just CARD_FROM_HAND
- Show Repentance/Instinct cards as visually selected in hand when in ABILITY_TARGET mode
- Drop stale spectator state_update pushes from wrong sessions
- Auto-create missing audio buses on Settings._ready to avoid bus-not-found errors

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>
2026-04-15 09:31:30 -04:00
573d8cf727 fix(spectate): move Game signal connections to top of _ready, null-safe IIDs
- Game.state_updated (and other game signals) now connected before any UI
  setup that could error. Previously they were at line ~340, after hand spin
  button setup — if anything between _configure_hand_spin_buttons and those
  connects threw, spectators would never receive live state pushes (no player
  actions to trigger ACK-based updates as fallback)
- _rebuild_hand now uses str(raw) if raw != null else "" for IID extraction;
  card.get("instanceId", "") returns null (not the default) when the key
  exists with a null value, which would error on append to Array[String]

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>
2026-04-14 23:42:28 -04:00
8649384997 fix(spectate): restore _rebuild_hand for spectators, fix typed Array filter
- Removed the outer _is_spectating guard on _rebuild_hand; blocking it
  entirely left _cached_hand_iids stale and skipped other bookkeeping
- Spectator early-exit now inside _rebuild_hand after updating the cache,
  clearing the display hand cleanly
- Replaced Array[Dictionary].filter() (returns untyped Array, silent type
  mismatch on reassignment) with explicit loops into typed Array[Dictionary]
- Same fix for the display_hand build: explicit typed loop instead of
  hand.filter() with Variant cast

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>
2026-04-14 23:30:37 -04:00
cdbcf5e2d1 feat(admin): end AI matches from admin portal
AiMatchService:
- GetActiveMatchesAsync: queries CustomLobbies joined to GameSessions
  to return all running AI vs AI sessions with display names.
- ForceEndMatchAsync: marks session Abandoned + lobby Completed; the AI
  polling loops detect the status change within ~1 s and exit cleanly.
- ActiveAiMatch DTO returned by both methods.

AiMatchPage:
- Active AI Matches section loads on page init and has a Refresh button;
  each row has an End button that calls ForceEndMatchAsync and refreshes.
- Created This Session table also gets an End button per row.
- Spinner shown on the End button while the request is in flight.

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>
2026-04-14 23:27:46 -04:00
286ccf26c7 fix(spectate): skip hand rebuild and clear draw popups when spectating
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>
2026-04-14 23:24:28 -04:00
cbf1ff2ad5 fix(ui): move InGameSettings to CanvasLayer 15 so it renders above all HUD
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>
2026-04-14 23:13:17 -04:00
611f4bbb66 fix(hand): use add_theme_*_override instead of dictionary accessors for dynamic nodes
theme_override_* dict syntax requires the node to already be in the tree.
Use add_theme_constant_override / add_theme_font_size_override instead.

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>
2026-04-14 23:08:18 -04:00
7023004046 feat(hand): draw card popup — show drawn card centre-screen, click to add
- New Settings.draw_card_popup bool (default true, persisted)
- Toggle in InGameSettings under Gameplay: "Show drawn card popup"
- _rebuild_hand detects brand-new cards and queues them in
  _pending_popup_cards instead of adding to hand immediately
- _show_next_card_popup builds a CanvasLayer overlay (layer 20) with a
  dimmed background + full-size card widget; click card or background to
  dismiss
- _dismiss_card_popup pops the queue, adds the card to hand via
  _apply_display_hand in server order, then shows the next queued popup

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>
2026-04-14 23:05:51 -04:00
01ca65e121 fix(hand): incremental add/remove cards, no jitter on draw or play
- _rebuild_hand now diffs existing widgets against new hand: only removes
  cards that left, only creates widgets for cards that arrived; everything
  else stays in place with no rebuild flash
- New card widgets snap to their fan position on first layout instead of
  tweening from (0,0), eliminating the slide-from-corner jitter on draw

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>
2026-04-14 22:58:51 -04:00
8f37dd7e9b feat(hand): cache hand by IID, fix click precision, double arrow button size
- Skip widget rebuild when hand IIDs are unchanged; only refresh selection
- Store _fan_slot metadata so _restack_hand_cards can reorder children by
  z-index (for correct GUI input routing) without corrupting fan positions
- Double spin arrow hit targets from 22x22 to 44x44

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>
2026-04-14 22:54:01 -04:00
5290847651 fix(hand): remove _restack_hand_cards to stop fan position shuffling
move_child was changing child indices which _layout_hand_cards uses to
compute fan positions, causing the whole hand to shuffle on every spin
or selection. z_index alone handles draw order correctly.

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>
2026-04-14 22:42:53 -04:00
aef635d495 fix(hand): remove hover effect that was shifting card positions on mouse move
Hover lift/scale/z_index boosts and mouse_entered/exited callbacks were
causing cards to jump around whenever the cursor passed over them.

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>
2026-04-14 22:18:08 -04:00
750a0e5934 fix(hand): set mouse_filter=IGNORE on Panel/Panel2 in HandArea
These full-size Panel nodes were overlapping HandCards and swallowing
all click events before cards could receive them.

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>
2026-04-14 22:13:29 -04:00
9c75c86b95 feat(hand): fan layout with bring-to-front selection, no focus shift on click
Clicking a card now selects it and brings it visually to the front (via
z_index + lift boost) without re-centering the fan. Scroll arrows deselect
the active card before spinning. Hover lift and tween-based fan layout added.

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>
2026-04-14 22:10:39 -04:00
affd251b10 feat(admin): add hex grid controls and block same-AI match creation
AiMatchPage:
- Add Grid Type dropdown (Square / Hexagon) and HexSides input (shown
  only when Hexagon selected) to the Board section, wired to GridType
  and HexSides in GameRules.
- Add SameAi computed property: true when both players share the same
  difficulty + strategy (i.e. resolve to the same account GUID).
- Show a warning banner and disable the Create button when SameAi,
  preventing the broken game state that occurs when a player is matched
  against itself.

AiMatchService:
- Server-side guard: throw ArgumentException if id1 == id2 so the
  broken state is impossible even if the UI check is bypassed.

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>
2026-04-14 20:39:31 -04:00
a814d2bdb9 fix(ai): respect TeamIndex for ally/enemy distinction
AiTurnContext.OpponentIds was everyone-except-self, so in team games the
AI would attack its own allies and score them as enemy material. The game
model already has TeamIndex on PlayerState and GameState.GetEnemyIds() /
AreAllies() helpers — the AI just never used them.

- AiTurnContext: use state.GetEnemyIds() so OpponentIds excludes allies
  (fixes attack targeting, threat detection, positional advance)
- MaterialScore: use state.AreAllies() so allied units/ArchSpirit score
  positively instead of as enemy material
- PositionalScore: skip allied players when collecting enemy positions

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>
2026-04-14 20:32:03 -04:00
dingo ad031a8e30 UI improvements ++ 2026-04-14 16:02:24 -04:00
dingo 7a88fd96b9 Highlighter issue 2026-04-14 13:16:47 -04:00
f76814a03b feat: collapsible scrollable active effects sub-section in tile drawer
Each entity type (Spirit, SpiritToken, ArchSpirit, Ruin) now gets its own
"Active Effects (N)" section immediately below its stats section.  The section:
 - starts collapsed to keep the drawer compact
 - shows a count badge in the header ("Active Effects (3)")
 - scrolls when the effect list is longer than the visible area (~90 px)
 - hides entirely when the entity has no active effects

Effects are no longer appended inline to the stat labels list; they live in
dedicated scrollable sections built by _create_scrollable_section /
_set_effects_section helpers.

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>
2026-04-14 12:22:31 -04:00
b4062d8179 feat: add active effects inspector to tile drawer
- Track active effects with human-readable labels in AbilitySystem
  (LabelFromReversal/LabelFromTick for stat mods, status flags, DOT/HOT)
- Add ActiveEffectDto to GameStateDto and GameStateDelta; delta now
  always includes the full effects list so clients are never stale
- Add ResolveLabelFromEffectJson fallback for effects stored before the
  Label field was introduced (old game sessions show correct labels)
- Client _append_active_effect_lines helper filters activeEffects by
  targetRef and appends formatted lines to the tile drawer for spirits,
  archspirits, spirit tokens, and ruins

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>
2026-04-14 11:52:37 -04:00
dingo 144ad84cac minor bug fixes 2026-04-14 11:07:56 -04:00
dingo ad6ae689ed Add collapsible tile detail drawer UI 2026-04-14 11:06:58 -04:00
dingo a219b2fb31 Fix tile highlights for channeling spirit 2026-04-14 10:14:43 -04:00
dingo d1a78e672a update 2026-04-14 09:41:52 -04:00
470d7c38fc chore: stop tracking .claude/ directory
.claude/ was already in .gitignore but had been committed previously.
Remove it from the index so it is no longer tracked.

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>
2026-04-14 09:30:00 -04:00
dingo 5136a16fc0 Decrease logging 2026-04-14 09:18:15 -04:00
e204cdf74e fix: correct default modelFacingDirection to south for Blender GLB units
Units were facing 180° away from the nearest enemy because
modelFacingDirection defaulted to "north" (base=0) when the asset
field was absent. Blender-exported GLBs natively face +Z (south,
base=π), so the rotation formula was inverted for all models without
an explicit facing override.

Also improves _idle_rotation diagnostics: push_warning on fallback
with body/ownership counts, and tightens the XZ direction guard to
check (x != 0 or z != 0) instead of 3D length_squared which could
pass spuriously when only the Y component was non-zero.

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>
2026-04-14 09:17:52 -04:00
fa180a1673 fix(ai): score ArchSpirit stat buffs so ability activations are considered
MaterialScore only tracked the ArchSpirit's HP ratio. Permanent stat-buff
abilities (attack, defence, movement) produced no score gain after the
simulation, so they always lost to their ST cost (-8 ResourceScore) and
were never chosen.

Add per-point weights for Damage (×10), MaxDefense (×8), and MaxMp (×6)
on the ArchSpirit. Each weight exceeds the ResourceScore cost of 1 ST (8
pts), so a 1-ST buff ability now registers as a net positive and the
greedy engine will choose it when no stronger action is available.

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>
2026-04-14 08:53:11 -04:00
babf5f9821 fix(ai): prevent greedy engine from freezing after a high-value ability activation
When an ability activation raised the score baseline significantly (e.g.
bouncing a unit, dealing damage, healing), no subsequent move or attack
could beat that new baseline, so the AI ended its turn after just one
action leaving all other units idle.

Two-part fix:
1. Relax the selection threshold by NoRegressTolerance (1.0 pts) so that
   moves/attacks that are near-neutral still qualify as candidates.
2. Track serialised-state hashes for every state seen during the turn;
   candidates that would revisit a prior state are skipped, preventing
   the tolerance from enabling intra-turn cycles.

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>
2026-04-14 06:22:59 -04:00
e3df26ae07 fix(ai): use real ST return formula in SacrificeOpportunityScore
Previously assumed each sacrifice always yields +1 ST regardless of the
unit's costs or the player's running ST total. Now calls
SacrificeSystem.GetSacrificeValue / GetSTReturn exactly as the engine
does, and respects FixedSacrificeReturn overrides. The projected ST
total is accumulated unit-by-unit so the diminishing-return curve is
correctly applied.

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>
2026-04-13 17:58:25 -04:00
e26987e563 fix: send full state_update to spectators instead of state_delta
Spectators were receiving game.state_delta in the normal delta path,
but the client only handles game.state_update for spectator views.
Always push a full game.state_update to spectators so they see every
turn change without needing to reconnect.

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>
2026-04-13 17:22:21 -04:00
16521b47b9 fix: add proximity gradient to positional score to prevent AI stalemate
The old scoring only gave +15 when a unit was already adjacent to the enemy
ArchSpirit — no reward for closing distance from further away. This caused
both AIs to settle into a static local optimum far from each other and never
advance (observed at turn 171 with armies on opposite sides of the board).

Adds a continuous gradient: +20×(1-dist/maxDist) per unit toward enemy
ArchSpirit and +8×(1-dist/maxDist) toward nearest enemy unit. Each step
forward now gives a small positive score improvement, so the greedy engine
always has a reason to advance when no better action exists.

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>
2026-04-13 17:07:34 -04:00