Skip to content

Commit

Permalink
Version 0.10.0: Add common actions with support for cards like counci…
Browse files Browse the repository at this point in the history
…l room which add cards now for other players and remove them on their turns
  • Loading branch information
JessicaMulein committed Nov 7, 2024
1 parent 1bdb136 commit ad540a3
Show file tree
Hide file tree
Showing 74 changed files with 3,386 additions and 589 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ Join our community of developers.

## Changelog

### Wed Nev 06 17:05:00 2024

- Version 0.10.0
- Add common actions with support for cards like council room which add cards now for other players and remove them on their turns

### Mon Nov 04 12:44:00 2024

- Version 0.9.10
Expand Down
235 changes: 139 additions & 96 deletions USER_MANUAL.md
Original file line number Diff line number Diff line change
@@ -1,109 +1,152 @@
# Unofficial Dominion Assistant Manual
# Unofficial Dominion Assistant User Manual

## Overview

This tool is designed to enhance your Dominion game experience by assisting with player setup, resource management, and score tracking. The assistant complements the physical Dominion game and offers additional tracking and automation features for smoother gameplay.

---

## Game Setup Phase

### 1. Player Setup
- Add 2-6 players
- Enter names in input field
- Click "Add Player" for each
- Optional: Click color box to customize player colors
- Use "Remove" button if needed
- Click "Next" when complete

### 2. First Player Selection
- Choose starting player from list
- Use "Random Selection" option if desired
- Click "Next" to continue

### 3. Game Options
- Configure game settings:
- Curses (on by default)
- Favors (optional)
- Debts (optional)
- Coffers/Villagers (for Prosperity/Renaissance)
- Click "Start Game" to begin
### Step 1: Player Setup

1. Add 2-6 players:
- Enter each player's name in the input field.
- Click **Add Player** for each entry.
2. Customize player colors (optional):
- Click the color box next to each player’s name to select a color.
3. Remove players as needed by clicking **Remove**.
4. Click **Next** when you’re ready to proceed.

### Step 2: First Player Selection

1. Select the starting player from the player list.
2. (Optional) Click **Random Selection** to pick a starting player at random.
3. Click **Next** to move to game options.

### Step 3: Configure Game Options

1. Set your desired game settings:

- **Curses**: Enabled by default.

- **Track Card Counts** and **Track Card Gains**: Optional settings to monitor the supply and acquisitions of cards.

- Expansions and Mats

:

- **Prosperity**: Adds Colonies and Platinum cards.
- **Renaissance**: Enables Coffers and Villagers.
- **Rising Sun**: Enables Prophecy tokens.

2. Click **Start Game** to begin the game.

---

## Gameplay Phase

### Interface Tabs

1. **Player Tab**:
The main control panel for each player’s actions and resources.
2. **Adjustments Tab**:
Review and manage resource modifications, track turn-by-turn changes, and view linked actions.
3. **Supply Tab**:
Monitor the availability of cards in the supply, including kingdom cards and other game cards.

### Resource Management
1. **Basic Resources**
- Actions (for playing action cards)
- Buys (for purchasing cards)
- Coins (for purchasing power)
- Victory Points (for scoring)

2. **Special Resources**
- Villagers (stores actions for later)
- Coffers (stores coins for later)
- Favors (expansion mechanic)
- Debts (tracks owed coins)

### Turn Structure
1. **Action Phase**
- Track available actions
- Use villagers if needed (+1 action)
- Automatic linking of villager->action

2. **Buy Phase**
- Track remaining buys
- Use coffers if needed (+1 coin)
- Automatic linking of coffer->coin

3. **End Turn**
- Click "Next Turn"
- Resets phase counters
- Advances to next player

### Making Corrections
- Toggle "Correction Mode" checkbox
- Disables automatic resource linking
- Changes marked with ✏️ in log
- Use for manual adjustments

### Game Log Features
- Timestamps for all actions
- Player color coding
- Turn numbers
- Linked actions marked with 🔗
- Corrections marked with ✏️

### Undo System
- Can undo most recent action
- Linked actions undo together
- Available for resource changes
- Not available for game state changes

## Game Progress Features

### Time Tracking
- Total game duration
- Current turn time
- Player average turn times

### Save/Load
- Automatic saves after actions
- Manual save option
- Multiple save slots
- Full game state preservation

## End Game
1. **Basic Resources**:
- **Actions**: Needed to play action cards.
- **Buys**: Used to buy additional cards each turn.
- **Coins**: Represents purchasing power.
- **Victory Points**: Tracks each player’s score.
2. **Special Resources**:
- **Villagers**: Stores additional actions for future turns.
- **Coffers**: Stores extra coins for future use.
- **Prophecy Tokens**: Available with the Rising Sun expansion.
- **Victory Tokens**: Tracks special point values that don’t require physical VP cards.

### Game Controls

1. **Action Buttons**:
- **Next Turn**: Ends the current player's turn and advances to the next.
- **End Game**: Ends the game and displays final scores.
- **Undo**: Reverts the last action taken.
- **Pause/Unpause**: Pauses or resumes the game.
2. **Correction Mode**:
- Activate this mode by checking the **Correction** box. It allows you to adjust resources manually without automatic linking.
- Marked with a ✏️ icon in the game log to indicate corrections.
3. **Linking Actions**:
- Enable the **Link Actions** checkbox to group related resource changes together.
- Linked actions can be undone as a single unit, making it useful for multi-step card effects.

---

### Finishing Up
1. Click "End Game"
2. Confirm end game dialog
3. View final scores
4. Option to start new game
## Advanced Tracking Features

## Visual Indicators
### Next Turn Effects

### Active Player
- Standard border
- Normal shadow
- Black border on player pip
To manage effects that trigger on your next turn:

1. Click the ⚙️ (gear) icon in your player panel.
2. In the "Next Turn" popover:
- **Barracks**: Add +1 to "Actions".
- **Flag Bearer**: Add +1 to "Cards".
3. These adjustments will automatically apply at the start of your next turn.

### Victory Point Tracking

To track victory points that vary based on conditions:

1. Use the **Other** field in the Victory section.

2. For cards like

Demesne

(worth 1 VP per Gold card):

- Count your Gold cards.
- Use the +/- buttons to add or remove that many victory points.
- Example: If you have 3 Gold cards, press + three times.

3. These points persist between turns, accurately tracking conditional VPs.

### Manual Tracking Tips

- Use **Correction Mode** (pencil icon) to make adjustments for any mistakes.
- Use the **Link Actions** option (chain icon) for grouping related actions, such as effects from complex card plays.
- The **Game Log** will display all actions and adjustments for easy review.
- Use the 🗑️ icon to track points from cards that are trashed.

---

## Game Statistics

The tool automatically tracks and displays statistics, including:

- **Total Game Duration**: The entire duration of the game.
- **Current Turn Time**: How long the current turn has lasted.
- **Average Turn Duration**: An average of all player turn times.
- **Player-Specific Averages**: Average time taken per player.
- **Victory Point Tracking**: Comprehensive victory point tally per player.
- **Supply Count Tracking**: Keeps track of remaining cards in the supply.

### Auto-Save Feature

- The tool saves the game state automatically after each action.
- Supports multiple save slots and allows importing and exporting game data.
- Includes version compatibility checks to ensure seamless use across updates.

---

## End Game

### Inactive Players
- Thicker colored border
- Enhanced color shadow
- Standard player pip
1. Click the **End Game** button when the game concludes.
2. Confirm your choice in the dialog prompt.
3. View the final scores and game statistics.
4. Optionally, start a new game by returning to the setup phase.

Note: This assistant complements physical Dominion game components. Not all expansions are directly supported, but manual adjustments can accommodate most scenarios.
**Note**: This tool is an unofficial companion to the physical Dominion game. While it supports many expansions, not all are directly implemented; manual adjustments can be used to account for unsupported features.
34 changes: 24 additions & 10 deletions src/__fixtures__/dominion-lib-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
DefaultTurnDetails,
DefaultPlayerColors,
VERSION_NUMBER,
DefaultRenaissanceFeatures,
} from '@/game/constants';
import { calculateInitialSupply, distributeInitialSupply } from '@/game/dominion-lib';
import { GameLogAction } from '@/game/enumerations/game-log-action';
Expand All @@ -20,6 +21,8 @@ import { deepClone } from '@/game/utils';
import { IGameRaw } from '@/game/interfaces/game-raw';

export function createMockGame(playerCount: number, overrides?: Partial<IGame>): IGame {
const firstPlayerIndex =
overrides?.firstPlayerIndex ?? faker.number.int({ min: 0, max: playerCount - 1 });
const options: IGameOptions = {
curses: true,
expansions: { prosperity: false, renaissance: false, risingSun: false } as IExpansionsEnabled,
Expand All @@ -38,22 +41,25 @@ export function createMockGame(playerCount: number, overrides?: Partial<IGame>):
.map((value, index) => createMockPlayer(index, overrides?.players?.[index])),
supply,
options,
risingSun: {
prophecy: {
suns: NOT_PRESENT,
expansions: {
renaissance: DefaultRenaissanceFeatures(),
risingSun: {
prophecy: {
suns: NOT_PRESENT,
},
greatLeaderProphecy: false,
},
greatLeaderProphecy: false,
},
currentTurn: 1,
currentPlayerIndex: 0,
firstPlayerIndex: 0,
selectedPlayerIndex: 0,
currentPlayerIndex: firstPlayerIndex,
firstPlayerIndex: firstPlayerIndex,
selectedPlayerIndex: firstPlayerIndex,
log: [
{
id: faker.string.uuid(),
timestamp: new Date(),
playerIndex: 0,
currentPlayerIndex: 0,
playerIndex: firstPlayerIndex,
currentPlayerIndex: firstPlayerIndex,
turn: 1,
action: GameLogAction.START_GAME,
},
Expand All @@ -63,6 +69,7 @@ export function createMockGame(playerCount: number, overrides?: Partial<IGame>):
currentStep: CurrentStep.Game,
setsRequired: 1,
gameVersion: VERSION_NUMBER,
pendingGroupedActions: [],
...(overrides ? deepClone<Partial<IGame>>(overrides) : {}),
};
return distributeInitialSupply(game);
Expand Down Expand Up @@ -94,7 +101,10 @@ export function createMockLog(log?: Partial<ILogEntry>): ILogEntry {
count: faker.number.int({ min: 1, max: 5 }),
correction: false,
// linkedActionId: faker.string.uuid(),
prevPlayerIndex: faker.number.int({ min: 0, max: 3 }),
prevPlayerIndex:
log?.action && log.action === GameLogAction.START_GAME
? -1
: faker.number.int({ min: 0, max: 3 }),
...(log ? deepClone<Partial<ILogEntry>>(log) : {}),
};
}
Expand All @@ -120,6 +130,10 @@ export function createMockGameRaw(numPlayers: number, overrides?: Partial<IGameR
start: turnStatistics.start.toISOString(),
end: turnStatistics.end.toISOString(),
})),
pendingGroupedActions: mockGame.pendingGroupedActions.map((logEntry) => ({
...logEntry,
timestamp: logEntry.timestamp?.toISOString(),
})),
};

// Apply overrides if provided
Expand Down
6 changes: 3 additions & 3 deletions src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef } from 'react';
import React, { useRef, ReactElement, ReactNode } from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { BrowserRouter as Router, useRoutes } from 'react-router-dom';
import AboutScreen from '@/components/screens/AboutScreen';
Expand All @@ -20,8 +20,8 @@ import StatisticsScreen from '@/components/screens/StatisticsScreen';

interface ITab {
label: string;
icon: React.ReactElement;
content: React.ReactNode;
icon: ReactElement;
content: ReactNode;
path: string;
index?: boolean;
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/AddPlayerNames.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { FC, MouseEvent, useEffect, useState } from 'react';
import {
Box,
TextField,
Expand Down Expand Up @@ -31,7 +31,7 @@ const StyledPlayerNumber = styled(Typography)(() => ({
fontFamily: 'TrajanProBold',
}));

const AddPlayerNames: React.FC<AddPlayerNamesProps> = ({ nextStep }) => {
const AddPlayerNames: FC<AddPlayerNamesProps> = ({ nextStep }) => {
const { gameState, setGameState } = useGameContext();
const [playerName, setPlayerName] = useState('');
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
Expand Down Expand Up @@ -67,7 +67,7 @@ const AddPlayerNames: React.FC<AddPlayerNamesProps> = ({ nextStep }) => {
});
};

const handleColorClick = (event: React.MouseEvent<HTMLElement>, playerIndex: number) => {
const handleColorClick = (event: MouseEvent<HTMLElement>, playerIndex: number) => {
setCurrentPlayerIndex(playerIndex);
setAnchorEl(event.currentTarget);
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/AlertContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { createContext, useContext, useState, ReactNode } from 'react';
import React, { createContext, useContext, useState, ReactNode, FC } from 'react';

interface AlertContextProps {
showAlert: (title: string, message: string) => void;
Expand All @@ -8,7 +8,7 @@ interface AlertContextProps {

const AlertContext = createContext<AlertContextProps | undefined>(undefined);

export const AlertProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
export const AlertProvider: FC<{ children: ReactNode }> = ({ children }) => {
const [alert, setAlert] = useState<{ title: string; message: string } | null>(null);

const showAlert = (title: string, message: string) => {
Expand Down
Loading

0 comments on commit ad540a3

Please sign in to comment.