Skip to content

fix: prevent double-attack animation on counterattack reveal#342

Merged
mokn merged 4 commits intodevfrom
feat/creature-studio
Apr 9, 2026
Merged

fix: prevent double-attack animation on counterattack reveal#342
mokn merged 4 commits intodevfrom
feat/creature-studio

Conversation

@mokn
Copy link
Copy Markdown
Collaborator

@mokn mokn commented Apr 9, 2026

Summary

  • Both useBattleSceneSignals and useFloatingDamageSignals replayed the player attack when useCombatPacing revealed the counterattack after 600ms
  • Root cause: processedCountRef was reset to 0 on every visibleOutcomes change, including counterattack reveal
  • Fix: track signaled outcomes by unique key instead of array index — already-processed outcomes are never replayed

Test plan

  • Player attack fires first, counterattack fires 600ms later (no simultaneous double-hit)
  • Floating damage numbers appear once per attack, not duplicated
  • New encounter correctly resets and signals fresh outcomes
  • All 6 signal tests pass
  • All 12 combat pacing tests pass
  • Build passes

🤖 Generated with Claude Code

mokn and others added 4 commits April 9, 2026 08:08
Deploy UniRig+Blender animated spider GLB (7 clips: idle, walk, attack,
hit, death, block, dodge) to client. Replaces static canvas draw with
makeGLBDrawFn wrapper — canvas art remains as loading fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
GLB lighting boosted (key 2.2, fill 0.6, ambient 0.4), toon gradient
shadows lifted, ASCII renderer gamma/ambient/brightness cranked up.
Cave background doubled: 8-13 stalactites, 6-10 stalagmites, thicker
walls/ceiling/floor, boulder clusters, more interior scatter.
Creature lab: fix animation seek order, update dire rat GLB.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…e ASCII effect

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Both useBattleSceneSignals and useFloatingDamageSignals had a reset bug:
their processedCountRef was reset to 0 every time visibleOutcomes changed,
including when useCombatPacing revealed the counterattack after 600ms.
This caused the player attack to be replayed alongside the counterattack,
making it look like both sides attack simultaneously.

Fix: track signaled outcomes by unique key (encounterId + turn +
attackNumber + attackerId) instead of by array index. When the
counterattack is revealed and visibleOutcomes grows, already-signaled
outcomes are skipped.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@mokn mokn merged commit 7ae3d57 into dev Apr 9, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Apr 9, 2026 7:20pm
ud Error Error Apr 9, 2026 7:20pm
ud-api Ready Ready Preview, Comment Apr 9, 2026 7:20pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ud-api-beta Ignored Ignored Preview Apr 9, 2026 7:20pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant