Skip to content

implemented basic turns + priority system#7

Open
ericsonoferik wants to merge 4 commits into
kenwuuu:masterfrom
ericsonoferik:eric/turn-system
Open

implemented basic turns + priority system#7
ericsonoferik wants to merge 4 commits into
kenwuuu:masterfrom
ericsonoferik:eric/turn-system

Conversation

@ericsonoferik
Copy link
Copy Markdown
Contributor

Turn and Priority System

How It Works

Turn Structure: Only one player is active at a time. When a turn starts, the active player's tapped cards untap and they draw a card. Clicking "PASS THE TURN" moves to the next player clockwise.

Priority System: Inactive players can tap/untap cards, add counters, and move cards from battlefield to zones. They cannot move cards from dock to battlefield unless they click "TAKE PRIORITY". Priority allows playing cards while the active player remains active. Priority clears when the turn passes.

State: Turn state (active player, player order, priority) is stored in Yjs and syncs across all peers.

File Changes

New Files:

  • src/services/turnManager/TurnManager.ts - Core turn and priority management logic
  • src/services/turnManager/index.ts - Export file
  • src/components/TurnSystem.tsx - React UI component for turn controls
  • src/components/TurnSystem.module.css - Styles for turn system UI
  • src/vite-env.d.ts - TypeScript declarations for CSS modules

Modified Files:

  • src/index.ts - Integrated TurnManager, added turn state observer and event handlers
  • src/services/eventHandlers/WhiteboardEventHandlers.ts - Added turn/priority checks for card play
  • src/modules/whiteboard/KeyboardHandler.ts - Removed ownership restrictions for battlefield interactions
  • src/modules/gameResourcesDock/GameResourcesDock.ts - Added playCard event dispatch for keyboard shortcuts

Recent Changes

Refactored all inline styles to TurnSystem.module.css CSS module for better maintainability and consistency with other components.

Copy link
Copy Markdown
Owner

@kenwuuu kenwuuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opt for less automation and more user choice. If something happens, it should usually be the user triggering something with known consequences. Also, try to have Claude work in smaller chunks. It vomits if you give it too much freedom and writes a lot of useless code, or just code that could be more concise

Comment thread src/components/TurnSystem.tsx Outdated
Comment thread src/index.ts Outdated
Comment thread src/index.ts Outdated
Comment thread src/index.ts
Comment thread src/index.ts Outdated
Comment thread src/services/eventHandlers/WhiteboardEventHandlers.ts Outdated
Comment thread src/index.ts Outdated
Comment thread src/services/turnManager/TurnManager.ts
Comment thread src/services/turnManager/TurnManager.ts
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.

2 participants