Prepare a new card and randomize the first player
This commit is contained in:
parent
2e6f9fb845
commit
5d685d0eb0
5 changed files with 13 additions and 3 deletions
|
@ -5,7 +5,8 @@ import PlusCircleIcon from "virtual:icons/ph/plus-circle"
|
|||
import MinusCircleIcon from "virtual:icons/ph/minus-circle"
|
||||
import EyeSlashIcon from "virtual:icons/ph/eye-slash-bold"
|
||||
import FlagIcon from "virtual:icons/ph/flag-bold"
|
||||
import CaretCircleDoubleRightIcon from "virtual:icons/ph/caret-circle-double-right-bold"
|
||||
import CircleHalfFillIcon from "virtual:icons/ph/circle-half-fill"
|
||||
import FastForwardIcon from "virtual:icons/ph/fast-forward-bold"
|
||||
import NumberCircleOneIcon from "virtual:icons/ph/number-circle-one"
|
||||
import NumberCircleTwoIcon from "virtual:icons/ph/number-circle-two"
|
||||
import NumberCircleThreeIcon from "virtual:icons/ph/number-circle-three"
|
||||
|
@ -23,7 +24,8 @@ export const specialCardIcons: Record<SpecialCardId, Component> = {
|
|||
"decrease-target-by-2": MinusCircleIcon,
|
||||
"next-round-covert": EyeSlashIcon,
|
||||
"force-hit": FlagIcon,
|
||||
"double-draw": CaretCircleDoubleRightIcon
|
||||
"double-draw": CircleHalfFillIcon,
|
||||
"end-game": FastForwardIcon
|
||||
}
|
||||
|
||||
export const numberCircleIcons = {
|
||||
|
|
|
@ -124,6 +124,7 @@ export class Game extends EventEmitter<Events> {
|
|||
this.addAction({
|
||||
type: "start",
|
||||
targetSum: 21,
|
||||
startingPlayerId: players[Math.floor(Math.random() * players.length)].id,
|
||||
players
|
||||
})
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ type ServerAction = {
|
|||
| {
|
||||
type: "start"
|
||||
targetSum: number
|
||||
startingPlayerId: string
|
||||
}
|
||||
| {
|
||||
type: "deal-number"
|
||||
|
|
|
@ -6,6 +6,7 @@ interface SpecialCardMeta {
|
|||
|
||||
export type SpecialCardId =
|
||||
| "return-last-opponent" | "return-last-own" | "increase-target-by-2" | "decrease-target-by-2" | "next-round-covert" | "double-draw" | "force-hit"
|
||||
| "end-game"
|
||||
|
||||
export const specialCardsMeta: Record<SpecialCardId, SpecialCardMeta> = {
|
||||
"return-last-opponent": {
|
||||
|
@ -42,6 +43,11 @@ export const specialCardsMeta: Record<SpecialCardId, SpecialCardMeta> = {
|
|||
type: "permanent",
|
||||
description: "Your opponent is not allowed to stay",
|
||||
weight: 3
|
||||
},
|
||||
"end-game": {
|
||||
type: "permanent",
|
||||
description: "The game ends after everyone had another turn.",
|
||||
weight: 1000
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ export const produceNewState = (oldState: GameState, action: GameAction) => prod
|
|||
|
||||
case "start":
|
||||
state.phase = "running"
|
||||
state.activePlayerId = state.players[0].id
|
||||
state.activePlayerId = action.startingPlayerId
|
||||
state.targetSum = action.targetSum
|
||||
state.activeSpecialCards = []
|
||||
state.numberCardsStack = getFullNumbersCardStack()
|
||||
|
|
Loading…
Add table
Reference in a new issue