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 MinusCircleIcon from "virtual:icons/ph/minus-circle"
|
||||||
import EyeSlashIcon from "virtual:icons/ph/eye-slash-bold"
|
import EyeSlashIcon from "virtual:icons/ph/eye-slash-bold"
|
||||||
import FlagIcon from "virtual:icons/ph/flag-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 NumberCircleOneIcon from "virtual:icons/ph/number-circle-one"
|
||||||
import NumberCircleTwoIcon from "virtual:icons/ph/number-circle-two"
|
import NumberCircleTwoIcon from "virtual:icons/ph/number-circle-two"
|
||||||
import NumberCircleThreeIcon from "virtual:icons/ph/number-circle-three"
|
import NumberCircleThreeIcon from "virtual:icons/ph/number-circle-three"
|
||||||
|
@ -23,7 +24,8 @@ export const specialCardIcons: Record<SpecialCardId, Component> = {
|
||||||
"decrease-target-by-2": MinusCircleIcon,
|
"decrease-target-by-2": MinusCircleIcon,
|
||||||
"next-round-covert": EyeSlashIcon,
|
"next-round-covert": EyeSlashIcon,
|
||||||
"force-hit": FlagIcon,
|
"force-hit": FlagIcon,
|
||||||
"double-draw": CaretCircleDoubleRightIcon
|
"double-draw": CircleHalfFillIcon,
|
||||||
|
"end-game": FastForwardIcon
|
||||||
}
|
}
|
||||||
|
|
||||||
export const numberCircleIcons = {
|
export const numberCircleIcons = {
|
||||||
|
|
|
@ -124,6 +124,7 @@ export class Game extends EventEmitter<Events> {
|
||||||
this.addAction({
|
this.addAction({
|
||||||
type: "start",
|
type: "start",
|
||||||
targetSum: 21,
|
targetSum: 21,
|
||||||
|
startingPlayerId: players[Math.floor(Math.random() * players.length)].id,
|
||||||
players
|
players
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ type ServerAction = {
|
||||||
| {
|
| {
|
||||||
type: "start"
|
type: "start"
|
||||||
targetSum: number
|
targetSum: number
|
||||||
|
startingPlayerId: string
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: "deal-number"
|
type: "deal-number"
|
||||||
|
|
|
@ -6,6 +6,7 @@ interface SpecialCardMeta {
|
||||||
|
|
||||||
export type SpecialCardId =
|
export type SpecialCardId =
|
||||||
| "return-last-opponent" | "return-last-own" | "increase-target-by-2" | "decrease-target-by-2" | "next-round-covert" | "double-draw" | "force-hit"
|
| "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> = {
|
export const specialCardsMeta: Record<SpecialCardId, SpecialCardMeta> = {
|
||||||
"return-last-opponent": {
|
"return-last-opponent": {
|
||||||
|
@ -42,6 +43,11 @@ export const specialCardsMeta: Record<SpecialCardId, SpecialCardMeta> = {
|
||||||
type: "permanent",
|
type: "permanent",
|
||||||
description: "Your opponent is not allowed to stay",
|
description: "Your opponent is not allowed to stay",
|
||||||
weight: 3
|
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":
|
case "start":
|
||||||
state.phase = "running"
|
state.phase = "running"
|
||||||
state.activePlayerId = state.players[0].id
|
state.activePlayerId = action.startingPlayerId
|
||||||
state.targetSum = action.targetSum
|
state.targetSum = action.targetSum
|
||||||
state.activeSpecialCards = []
|
state.activeSpecialCards = []
|
||||||
state.numberCardsStack = getFullNumbersCardStack()
|
state.numberCardsStack = getFullNumbersCardStack()
|
||||||
|
|
Loading…
Add table
Reference in a new issue