From 533e705faedc9857e07687ec47381047225effb7 Mon Sep 17 00:00:00 2001 From: Vick Scarlet Date: Wed, 12 Aug 2026 17:30:28 +0800 Subject: [PATCH] feature: multiple lock, pick min max --- apps/web/package.json | 2 +- apps/web/src/config.ts | 40 ++++++++--- apps/web/src/containers/Alloc.css | 21 ++++-- apps/web/src/containers/Alloc.tsx | 20 ++++-- apps/web/src/containers/Play.css | 63 +++++++++++++++-- apps/web/src/containers/Play.tsx | 65 +++++++++++++----- apps/web/src/containers/Summary.tsx | 94 +++++++++++++++----------- apps/web/src/containers/TalentPick.tsx | 11 +-- apps/web/src/hooks/judge.ts | 38 +++++++---- apps/web/src/storage.ts | 2 +- apps/web/src/styles/colors.css | 3 +- apps/web/vite.config.ts | 22 ++++++ package.json | 37 +++++----- packages/core/src/game.ts | 4 +- packages/core/src/state.ts | 6 +- packages/core/src/talent.ts | 11 +-- packages/hooks/src/config.ts | 12 +++- packages/hooks/src/play.ts | 38 ++++++++--- packages/hooks/src/talent.ts | 21 +++--- pnpm-lock.yaml | 8 --- 20 files changed, 358 insertions(+), 160 deletions(-) diff --git a/apps/web/package.json b/apps/web/package.json index 4b9abc7..2cec660 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -5,6 +5,7 @@ "author": "Vick Scarlet ", "scripts": { "dev": "bunx --bun vite", + "dev:prod": "bunx --bun vite --mode production", "build": "bunx --bun vite build", "preview": "bunx --bun vite preview", "lint": "bunx --bun eslint", @@ -14,7 +15,6 @@ "@remake/data": "workspace:*", "@remake/hooks": "workspace:*", "@remake/vitex": "workspace:*", - "classnames": "^2.5.1", "jotai": "^2.20.2", "react": "^19.2.8", "react-dom": "^19.2.8" diff --git a/apps/web/src/config.ts b/apps/web/src/config.ts index 215e829..6f7c815 100644 --- a/apps/web/src/config.ts +++ b/apps/web/src/config.ts @@ -1,20 +1,33 @@ import type { Config } from '@remake/hooks' +export const isDev = import.meta.env.MODE === 'development' +// 自动模式自动点击间隔 export const AutoInterval = 500 +// 可锁定的天赋数量 +export const LockLimit = isDev ? 10 : 1 +// 名人模式重开次数限制 export const ModeLimit = 10 -export const PickLimit = 3 +// 天赋选择数量限制 +export const PickMax = isDev ? 10 : 3 +// 天赋选择最少数量限制 +export const PickMin = 3 +// 基础属性点 export const BasePoints = 20 +// 单项属性点最大限制 export const AllocLimit = 10 +// 默认初始快乐 export const DefaultSpirit = 5 -export const PullCount = 10 +// 天赋抽取个数 +export const PullCount = isDev ? 20 : 10 +// 天赋抽取基础概率 export const PullRateBase: Config['pull']['rate']['base'] = new Map([ [0, 889], [1, 100], [2, 10], [3, 1], ]) - -export const JudgeMap = { +// 属性评级线 +export const JudgeLineMap = { age: [0, 1, 10, 18, 40, 60, 70, 80, 90, 95, 100, 500], summary: [0, 41, 50, 60, 80, 100, 110, 120], times: [0, 10, 30, 50, 70, 100], @@ -27,15 +40,17 @@ export const JudgeMap = { talent: [0, 0.3, 0.6, 0.9], event: [0, 0.2, 0.4, 0.6], } -export type Judges = keyof typeof JudgeMap +// 可评级属性 +export type Judges = keyof typeof JudgeLineMap +// 获取属性评级 export function judge(key: Judges, value: number) { - const arr = JudgeMap[key] + const arr = JudgeLineMap[key] for (let i = arr.length - 1; i >= 0; i--) { if (value >= arr[i]!) return i } return 0 } - +// 属性稀有度等级线 export const JudgeGradeMap = { age: [0, 5, 7, 9], summary: [0, 4, 5, 6], @@ -49,6 +64,7 @@ export const JudgeGradeMap = { talent: [0, 1, 2, 3], event: [0, 1, 2, 3], } +// 获取属性稀有度 export function judgeGrade(key: Judges, level: number) { const arr = JudgeGradeMap[key] for (let i = arr.length - 1; i >= 0; i--) { @@ -56,7 +72,13 @@ export function judgeGrade(key: Judges, level: number) { } return 0 } +// 根据属性值获取属性稀有度 +export function judgeGradeByValue(key: Judges, value: number) { + const level = judge(key, value) + return judgeGrade(key, level) +} +// 天赋抽取概率加成 export const PullRateAdditions: Config['pull']['rate']['additions'] = { times: value => { const level = judge('times', value) @@ -69,8 +91,10 @@ export const PullRateAdditions: Config['pull']['rate']['additions'] = { } export const config: Config = { + lock: LockLimit, mode: ModeLimit, - pick: PickLimit, + max: PickMax, + min: PickMin, points: BasePoints, allocate: AllocLimit, spirit: DefaultSpirit, diff --git a/apps/web/src/containers/Alloc.css b/apps/web/src/containers/Alloc.css index 220d63e..d7956df 100644 --- a/apps/web/src/containers/Alloc.css +++ b/apps/web/src/containers/Alloc.css @@ -9,10 +9,13 @@ display: flex; gap: 0; height: 2rem; - border: 0.0625rem solid var(--base-text-color); + border: 0.0625rem solid var(--grade-color); + color: var(--grade-color); box-sizing: border-box; width: 100%; + transition: all 0.2s ease-in-out; button { + --style-color: var(--grade-color); flex: 1 0; padding: 0; margin: 0; @@ -25,6 +28,8 @@ height: 100%; width: 2rem; font-weight: bold; + color: var(--grade-color); + transition: all 0.2s ease-in-out; } } .points-detail { @@ -73,23 +78,27 @@ > span { width: 100%; height: 2rem; - border: 0.0625rem solid var(--base-text-color); + color: var(--base-background-color); + background: var(--grade-color); + border: 0.0625rem solid var(--grade-color); border-bottom: none; display: flex; justify-content: center; align-items: center; box-sizing: border-box; font-weight: bold; + transition: all 0.2s ease-in-out; } } > li.left { + --left-color: var(--color-error); + &.left-0 { --left-color: var(--color-primary); } > span { - background: var(--color-primary); - color: var(--base-background-color); - border: 0.0625rem solid var(--color-primary); - border-bottom: none; + background: var(--left-color); + border: 0.0625rem solid var(--left-color); } > button { + --style-color: var(--left-color); flex: 1; font-size: 1rem; height: 2rem; diff --git a/apps/web/src/containers/Alloc.tsx b/apps/web/src/containers/Alloc.tsx index 0e02c63..a20c06a 100644 --- a/apps/web/src/containers/Alloc.tsx +++ b/apps/web/src/containers/Alloc.tsx @@ -4,7 +4,7 @@ import { usePicked, useReplaced, useStart } from '@remake/hooks' import type { AdditionalPoint } from '@remake/hooks' import { properties } from '@/display' import { keys } from '@remake/vitex' -import { BasePoints } from '@/config' +import { BasePoints, judgeGradeByValue } from '@/config' import { talents } from '@remake/data' import Replaced from '@/components/Replaced' import './Alloc.css' @@ -62,6 +62,10 @@ export function Alloc() { const start = useStart() const [showDetail, setShowDetail] = useState(false) const handleNext = () => { + if (left) { + // TODO: Show a warning that there are still points left + return + } const achievements = start() // TODO: Show achievements console.log('Achievements', achievements) @@ -76,10 +80,10 @@ export function Alloc() { ))}