Author SHA1 Message Date
github-actions[bot] 40df5b7ac7 Prepare manifest for v2.0.2.3-rc.11 2026-11-24 06:10:45 +00:00
Diuse d61b4b2526 fixed # 新增缩放倍率适配 2026-11-24 14:10:04 +08:00
Diuse 98116bef7b fixed # 修复部分样式BUG 2026-11-24 12:08:04 +08:00
Diuse 2d7bd0fbdc fixed # 更改更新方式 2026-11-24 10:17:49 +08:00
Diuse 884d694d22 fixed # 更新文档内容 2026-11-24 00:47:30 +08:00
Diuse 676977c12a Merge branch 'main' of https://github.com/Shu-Ying/noname-shuying 2026-11-23 23:51:51 +08:00
Diuse 0eeba640ae fixed # 新增药水机制 2026-11-23 23:45:37 +08:00
Diuse 1bf3067bdb fixed # 优化角色选择界面 2026-11-23 17:45:50 +08:00
Diuse f955716c97 fixed # 修复大量BUG 2026-11-22 17:36:42 +08:00
Diuse 9c3687fe7f fixed # 更改休息处和商店的样式 2026-11-19 18:32:47 +08:00
Diuse 8848f6524c fixed # 不想写了 2026-10-30 00:55:36 +08:00
Diuse d5715c9f5a fixed # 修复状态列表异常的bug 2026-10-29 15:21:11 +08:00
Diuse 4036041819 fixed # 更新工作流 2026-10-29 14:45:51 +08:00
Diuse b9664de9bd fixed # 修正样式BUG 2026-10-29 14:28:19 +08:00
Diuse 59e62d22c9 fixed # 偷偷更新GM菜单内容 2026-10-29 12:07:48 +08:00
112 changed files with 8840 additions and 1766 deletions
+4 -2
View File
@@ -20,7 +20,7 @@ The entire Skill invocation must remain read-only:
- Do not fix findings, advance phase, or update tasks, state, verification reports, or review records.
- Do not call this review a Verify pass or treat “no findings” as proof that tests passed.
Only run commands needed to read files, query state, and inspect Git diffs. Checks that might execute project code, install dependencies, or produce files are outside this entry's scope.
Only run commands needed to read files, query state, and inspect Git diffs, plus the focused browser check in the [battle UI review checklist](../../../docs/reviews/mengsan-battle-ui.md). Run that check without screenshot output unless a temporary directory outside the repository has been designated for review evidence. All other checks that execute project code, install dependencies, or produce files are outside this entry's scope.
## 1. Locate the project and current change
@@ -80,6 +80,8 @@ If the available evidence still cannot establish a reliable, verifiable baseline
## 4. Perform the review
Apply the battle UI review checklist and record the results by scenario name in the evidence status. Reuse evidence bound to the current changes when available.
Review the requirements, tasks, and current diff, focusing only on:
- Implementation correctness and clear logic errors.
@@ -110,7 +112,7 @@ Evidence: The specific relationship to the diff, task, spec, or verification rec
Then include:
- `Review scope`: workflow, change, phase, baseline, included diffs, and any scope limitations.
- `Evidence status`: the test, build, and verification records inspected and whether they still apply to the current changes. Do not rerun tests.
- `Evidence status`: report each battle UI scenario by its name in the checklist, together with the other test, build, and verification records inspected and whether they still apply to the current changes.
- `Open questions`: only questions that actually prevent a judgment.
- `Conclusion`: the finding count, or an explicit “No concrete findings.”
+15 -2
View File
@@ -58,7 +58,7 @@ jobs:
throw "extension.js 的版本号必须为 $version"
}
# The updater reads raw tag paths, not release attachments.
# The updater reads manifests from raw tag paths.
# Never generate new manifests after the release tag already exists.
python (Join-Path $stage 'tools/verify_manifest.py') `
--root $stage `
@@ -109,6 +109,11 @@ jobs:
'@ | python - $stage $package
if ($LASTEXITCODE -ne 0) { throw '打包失败' }
$partsDir = Join-Path $env:RUNNER_TEMP "mengsan-parts-$tag"
python (Join-Path $stage 'tools/build_mengsan_archives.py') `
--root $stage --out-dir $partsDir --tag $tag
if ($LASTEXITCODE -ne 0) { throw '梦三分包失败' }
Write-Host "版本:$version"
Write-Host "文件数:$($manifest.file_count)"
Write-Host "安装包:$package"
@@ -152,10 +157,18 @@ jobs:
$releaseFiles = @($manifestPath)
$releaseFiles += $moduleManifests
$releaseFiles += $package
$partsDir = Join-Path $env:RUNNER_TEMP "mengsan-parts-$tag"
$releaseFiles += @(Get-ChildItem -LiteralPath $partsDir `
-Filter '*.zip' -File | Sort-Object Name | ForEach-Object { $_.FullName })
foreach ($file in $releaseFiles) {
$attachment = if ($file -like '*.zip') {
"attachment=@$file;type=application/zip"
} else {
"attachment=@$file"
}
curl.exe --fail --silent --show-error `
-H "Authorization: token $env:GITEA_TOKEN" `
-F "attachment=@$file" `
-F $attachment `
$assetApi | Out-Null
if ($LASTEXITCODE -ne 0) {
throw "上传附件失败:$file"
+28 -8
View File
@@ -1,12 +1,12 @@
name: Release extension
on:
push:
branches:
- "**"
paths:
- "extension.js"
workflow_dispatch:
inputs:
version:
description: "版本号,例如 2.0.1.2 或 2.0.1.2-rc.1"
required: true
type: string
permissions:
contents: write
@@ -17,23 +17,33 @@ concurrency:
jobs:
release:
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
runs-on: windows-latest
defaults:
run:
shell: pwsh
env:
RELEASE_VERSION: ${{ inputs.version }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
BEFORE_SHA: ${{ github.event.before }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out source
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
ref: ${{ github.sha }}
fetch-depth: 0
- name: Read current version and detect change
id: version
run: |
./tools/resolve_release_version.ps1 `
-Root $env:GITHUB_WORKSPACE `
-EventName $env:GITHUB_EVENT_NAME `
-PreviousRef $env:BEFORE_SHA
- name: Generate manifest and create tag
if: steps.version.outputs.should_release == 'true'
run: |
$ErrorActionPreference = 'Stop'
$version = $env:RELEASE_VERSION
@@ -118,6 +128,7 @@ jobs:
Write-Host "已创建包含清单的标签:$tag"
- name: Build ZIP from tag
if: steps.version.outputs.should_release == 'true'
run: |
$ErrorActionPreference = 'Stop'
$version = $env:RELEASE_VERSION
@@ -174,11 +185,17 @@ jobs:
'@ | python - $stage $package
if ($LASTEXITCODE -ne 0) { throw '打包失败' }
$partsDir = Join-Path $env:RUNNER_TEMP "mengsan-parts-$tag"
python (Join-Path $stage 'tools/build_mengsan_archives.py') `
--root $stage --out-dir $partsDir --tag $tag
if ($LASTEXITCODE -ne 0) { throw '梦三分包失败' }
Write-Host "版本:$version"
Write-Host "文件数:$($manifest.file_count)"
Write-Host "安装包:$package"
- name: Publish GitHub Release
if: steps.version.outputs.should_release == 'true'
run: |
$ErrorActionPreference = 'Stop'
if (!$env:GITHUB_TOKEN) {
@@ -210,7 +227,10 @@ jobs:
-ContentType 'application/json' `
-Body $body
foreach ($file in @($manifestPath, $package)) {
$partsDir = Join-Path $env:RUNNER_TEMP "mengsan-parts-$tag"
$partFiles = @(Get-ChildItem -LiteralPath $partsDir `
-Filter '*.zip' -File | Sort-Object Name | ForEach-Object { $_.FullName })
foreach ($file in (@($manifestPath, $package) + $partFiles)) {
$name = [uri]::EscapeDataString([IO.Path]::GetFileName($file))
$uploadUri = $release.upload_url.Split('{')[0] + "?name=$name"
$contentType = if ($file -like '*.zip') {
+5
View File
@@ -11,13 +11,16 @@ tools/*.mjs
/mengsan/.planning/
/mengsan/verification
/mengsan/assets/sts2/
/mengsan/tools/.sts2-source
/Slay the Spire 2
*.mjs
*.cjs
!/tools/test_mengsan_zip_install.mjs
!/mengsan/tools/test-hud-status.cjs
!/mengsan/tools/test-battle-hud.cjs
!/mengsan/tools/test-journey-ui-zoom.cjs
!/mengsan/tools/import-status-icons.cjs
/.update_tmp/
@@ -49,3 +52,5 @@ Desktop.ini
/.comet/*
!/.comet/config.yaml
# <<< Comet managed project state <<<
# Added by code-review-graph
.code-review-graph/
+50
View File
@@ -17,3 +17,53 @@ In this repository, before starting work that may need code changes or investiga
- If configuration or state is invalid and `nextCommand` is absent, stop and report the reason; do not guess another workflow.
- Never attach unrelated work merely because an active change exists. The Native entry inspects uncommitted work; the probe does not attribute it automatically.
</comet-ambient-resume>
<!-- code-review-graph MCP tools -->
## MCP Tools: code-review-graph
**This project has a knowledge graph. Start with the code-review-graph
MCP tools to narrow scope, then read the source.** The graph is cheaper than scanning files and
gives you structural context (callers, dependents, test coverage) that file search cannot.
### When to use graph tools FIRST
- **Exploring code**: `semantic_search_nodes_tool` or `query_graph_tool` instead of Grep
- **Understanding impact**: `get_impact_radius_tool` instead of manually tracing imports
- **Code review**: `detect_changes_tool` + `get_review_context_tool` instead of reading entire files
- **Finding relationships**: `query_graph_tool` with callers_of/callees_of/imports_of/tests_for
- **Architecture questions**: `get_architecture_overview_tool` + `list_communities_tool`
### Verify in the source
- Narrow scope with the graph, then read the source. Do not change code from graph output alone.
- For any non-trivial change, read the implementation and the relevant tests before concluding.
- Verify the exact source when touching behavior, database logic, migrations, retries, fallbacks,
recovery, or compatibility code.
- When the graph and the source disagree, the source wins. The graph may be stale or may not
model that relationship.
- An empty graph result can mean "not indexed" or "not statically visible", not "does not exist".
### Key Tools
| Tool | Use when |
| ------ | ---------- |
| `detect_changes_tool` | Reviewing code changes — gives risk-scored analysis |
| `get_review_context_tool` | Need source snippets for review — token-efficient |
| `get_impact_radius_tool` | Understanding blast radius of a change |
| `get_affected_flows_tool` | Finding which execution paths are impacted |
| `query_graph_tool` | Tracing callers, callees, imports, tests, dependencies |
| `semantic_search_nodes_tool` | Finding functions/classes by name or keyword |
| `get_architecture_overview_tool` | Understanding high-level codebase structure |
| `refactor_tool` | Planning renames, finding dead code |
### Workflow
1. The graph auto-updates on file changes (via hooks).
2. Use `detect_changes_tool` for code review.
3. Use `get_affected_flows_tool` to understand impact.
4. Use `query_graph_tool` pattern="tests_for" to check coverage.
<!-- /code-review-graph MCP tools -->
## 梦三战斗 UI 审查
每次 review 都按 [梦三战斗 UI 回归清单](docs/reviews/mengsan-battle-ui.md) 逐项核验,并记录结果和验证环境。涉及战斗 UI 的改动须附本轮渲染截图,并单独记录 Android 实机验证状态。
+497 -392
View File
File diff suppressed because it is too large Load Diff
+1548 -698
View File
File diff suppressed because it is too large Load Diff
+84 -1
View File
@@ -1,5 +1,5 @@
{
"version": "2.0.2.3-rc.3",
"version": "2.0.2.3-rc.11",
"module_id": "mengsan",
"snapshot": "legacy",
"files": [
@@ -249,6 +249,7 @@
"mengsan/assets/portraits/bygone-effigy-original.png",
"mengsan/assets/portraits/byrdonis-forest-portrait.png",
"mengsan/assets/portraits/byrdonis-original.png",
"mengsan/assets/portraits/caocao-portrait.jpg",
"mengsan/assets/portraits/ceremonial-beast-forest-portrait.png",
"mengsan/assets/portraits/ceremonial-beast-original.png",
"mengsan/assets/portraits/cubex-construct-forest-portrait.png",
@@ -290,6 +291,7 @@
"mengsan/assets/portraits/slithering-strangler-original.png",
"mengsan/assets/portraits/snapping-jaxfruit-forest-portrait.png",
"mengsan/assets/portraits/snapping-jaxfruit-original.png",
"mengsan/assets/portraits/sunquan-portrait.jpg",
"mengsan/assets/portraits/sushuang-zhangshiping.png",
"mengsan/assets/portraits/twig-slime-m-forest-portrait.png",
"mengsan/assets/portraits/twig-slime-m-original.png",
@@ -601,6 +603,68 @@
"mengsan/assets/relics/wongo_customer_appreciation_badge.png",
"mengsan/assets/relics/wongos_mystery_ticket.png",
"mengsan/assets/relics/yummy_cookie.png",
"mengsan/assets/scenes/pinefire-camp.webp",
"mengsan/assets/status/aggression_power.png",
"mengsan/assets/status/artifact_power.png",
"mengsan/assets/status/automation_power.png",
"mengsan/assets/status/barricade_power.png",
"mengsan/assets/status/beacon_of_hope_power.png",
"mengsan/assets/status/block_next_turn_power.png",
"mengsan/assets/status/calamity_power.png",
"mengsan/assets/status/colossus_power.png",
"mengsan/assets/status/constrict_power.png",
"mengsan/assets/status/corruption_power.png",
"mengsan/assets/status/crimson_mantle_power.png",
"mengsan/assets/status/curious_power.png",
"mengsan/assets/status/dark_embrace_power.png",
"mengsan/assets/status/demesne_power.png",
"mengsan/assets/status/demon_form_power.png",
"mengsan/assets/status/dexterity_power.png",
"mengsan/assets/status/draw_cards_next_turn_power.png",
"mengsan/assets/status/energy_next_turn_power.png",
"mengsan/assets/status/entropy_power.png",
"mengsan/assets/status/fasten_power.png",
"mengsan/assets/status/feel_no_pain_power.png",
"mengsan/assets/status/flame_barrier_power.png",
"mengsan/assets/status/frail_power.png",
"mengsan/assets/status/free_attack_power.png",
"mengsan/assets/status/hellraiser_power.png",
"mengsan/assets/status/inferno_power.png",
"mengsan/assets/status/infested_power.png",
"mengsan/assets/status/intangible_power.png",
"mengsan/assets/status/juggernaut_power.png",
"mengsan/assets/status/juggling_power.png",
"mengsan/assets/status/manifest.json",
"mengsan/assets/status/mayhem_power.png",
"mengsan/assets/status/no_block_power.png",
"mengsan/assets/status/no_draw_power.png",
"mengsan/assets/status/no_energy_gain_power.png",
"mengsan/assets/status/nostalgia_power.png",
"mengsan/assets/status/one_two_punch_power.png",
"mengsan/assets/status/panache_power.png",
"mengsan/assets/status/plating_power.png",
"mengsan/assets/status/plow_power.png",
"mengsan/assets/status/prep_time_power.png",
"mengsan/assets/status/rage_power.png",
"mengsan/assets/status/retain_hand_power.png",
"mengsan/assets/status/ringing_power.png",
"mengsan/assets/status/rolling_boulder_power.png",
"mengsan/assets/status/rupture_power.png",
"mengsan/assets/status/shrink_power.png",
"mengsan/assets/status/slippery_power.png",
"mengsan/assets/status/slow_power.png",
"mengsan/assets/status/stampede_power.png",
"mengsan/assets/status/strength_power.png",
"mengsan/assets/status/tangled_power.png",
"mengsan/assets/status/tank_power.png",
"mengsan/assets/status/territorial_power.png",
"mengsan/assets/status/the_bomb_power.png",
"mengsan/assets/status/the_gambit_power.png",
"mengsan/assets/status/unmovable_power.png",
"mengsan/assets/status/vicious_power.png",
"mengsan/assets/status/vigor_power.png",
"mengsan/assets/status/vulnerable_power.png",
"mengsan/assets/status/weak_power.png",
"mengsan/assets/sushuang-zhangshiping.png",
"mengsan/battle/battle-director.js",
"mengsan/battle/battle-flow.js",
@@ -615,6 +679,7 @@
"mengsan/battle/intent-damage.js",
"mengsan/battle/intent-effects.js",
"mengsan/battle/skill-teardown.js",
"mengsan/battle/status-sources.js",
"mengsan/battle/stun-intent.js",
"mengsan/bonds/battle.js",
"mengsan/bonds/definitions.js",
@@ -742,10 +807,14 @@
"mengsan/monsters/vantom-intent.js",
"mengsan/monsters/vine-intent.js",
"mengsan/monsters/vine-tangled.js",
"mengsan/potions/battle.js",
"mengsan/potions/presentation.js",
"mengsan/potions/state.js",
"mengsan/progression/dialogue-choice.js",
"mengsan/progression/encounter-progress.js",
"mengsan/progression/map-checkpoint.js",
"mengsan/progression/mode-storage.js",
"mengsan/progression/random-event.js",
"mengsan/progression/reward-package.js",
"mengsan/progression/reward.js",
"mengsan/progression/state.js",
@@ -787,7 +856,10 @@
"mengsan/state.js",
"mengsan/style.css",
"mengsan/ui/bonds.js",
"mengsan/ui/card-choice-names.js",
"mengsan/ui/card-library.js",
"mengsan/ui/character-select.css",
"mengsan/ui/character-select.js",
"mengsan/ui/dialogue.js",
"mengsan/ui/energy-display.js",
"mengsan/ui/flow-ui.js",
@@ -799,14 +871,25 @@
"mengsan/ui/hand/input.js",
"mengsan/ui/hand/overlays.js",
"mengsan/ui/hand/style.css",
"mengsan/ui/hud/index.js",
"mengsan/ui/hud/overlays.js",
"mengsan/ui/hud/status-model.js",
"mengsan/ui/hud/style.css",
"mengsan/ui/intent-display.js",
"mengsan/ui/map/index.js",
"mengsan/ui/map/renderer.js",
"mengsan/ui/navigation.js",
"mengsan/ui/potions.css",
"mengsan/ui/potions.js",
"mengsan/ui/relic-icon.js",
"mengsan/ui/relic-strip.js",
"mengsan/ui/relics.js",
"mengsan/ui/rest-ui.js",
"mengsan/ui/rest.css",
"mengsan/ui/reward-package.js",
"mengsan/ui/reward-ui.js",
"mengsan/ui/shop-ui.js",
"mengsan/ui/shop.css",
"mengsan/ui/style.css",
"mengsan/ui/virtual-card-grid.js"
]
+28
View File
@@ -0,0 +1,28 @@
# 梦三战斗 UI 回归清单
每次 review 核验下表各项。在报告中逐项写明通过、失败或未验,并记录证据对应的代码版本、皮肤、尺寸和缩放。涉及战斗 UI 的改动,附受影响场景的渲染截图。
| 场景 | 操作与通过标准 |
| --- | --- |
| 触屏拖牌与目标连线 | 从手牌拖出一张【杀】并移动到可选敌人。线起点贴在拖动牌上缘中央,终点跟随触点,两端误差各不超过 2 CSS px。取消手势后线立即消失。对合法目标松手后拖线立即消失,原生提交只触发一次。完整对局中再检查提交后的出牌特效能指向实际目标。 |
| 普通出牌布局与缩放 | 在主动出牌阶段检查手牌扇面、提示语和「确定/回合结束」按钮组。三者共用战场中线,误差不超过 2 CSS px。改变界面缩放后重新检查对齐和拖牌线两端。 |
| 出牌响应布局与按钮交互 | 敌人出【杀】,选择【闪】,观察场上出牌副本、响应文字与「确定/取消」两键的整体边界。三者从上到下共用战场中线,横向中心误差不超过 2 CSS px,牌面、提示、按钮和选中手牌之间有可见间距。确认和取消分别可点击,响应结束后场上的牌恢复原生位置。 |
| 弃牌时技能栏稳定 | 启用十周年 UI,进入需弃置两张手牌的场景并点选第一张。技能栏在重建的首帧起就不出现重复的药水按钮,普通技能仍可见,弃牌计数正常更新。 |
| 战斗药水槽与计数信息 | 持有药水进入战斗。药水槽位于左上区域,可贴近轮数、时间及牌堆数量控件,各自的可见区域互不重叠。点按药水可打开详情,并能在可用阶段正常使用。 |
## 浏览器回归
从无名游戏目录内的术樱包根目录执行。脚本使用本地引擎、十周年 UI 样式、Playwright 和 Microsoft Edge。Playwright 安装在其他目录时,可将 `CODEX_NODE_MODULES` 指向包含它的 `node_modules`。
```powershell
$env:HUD_REVIEW = '1'
node mengsan/tools/test-battle-hud.cjs
```
需要截图时,将 `HUD_ARTIFACTS` 指向已建立的临时目录。完整矩阵覆盖原生 UI、十周年 UI 的手杀、十周年和新杀风格,以及 1080×486、812×375、667×375,含非整数像素比。1080×486 使用无名杀「新版」布局,从 65% 缩放基线切换到 50%、85%、100% 和 120%,核验普通出牌位置和拖牌线。出牌后的默认及金龙连线均检查端点,完整金龙贴图需在客户端核验。
## Android 实机复核
在本轮改动对应的 Android 客户端启用十周年 UI,使用该客户端当前启用的皮肤复核各场景,并记录十周年 UI 版本和皮肤。拖牌时分别观察松手前的拖线和松手后的出牌特效。响应用两次事件分别检查确认和取消。弃牌时观察点牌瞬间,检查原生计数面板与药水槽能同时看清并各自操作。实机结果单独记录,实机不可用时写明未验。
涉及地图、剧情、奖励、牌库、遗物或其他公共弹窗时,一并使用[梦三界面缩放回归清单](mengsan-ui-zoom.md)。
+39
View File
@@ -0,0 +1,39 @@
# 梦三界面缩放回归清单
无名杀原生 UI 底层以 `transform: scale()` 缩放,十周年 UI 以 `body.zoom` 缩放。检查通用界面时覆盖两条入口,并记录界面缩放、窗口尺寸、UI 版本和实际使用的风格。
## 实施方案
- 地图用实际渲染尺寸换算鼠标位移,保证地图和指针同速移动。窄小布局允许行军菜单和顶部栏在各自区域滚动。
- 选将和事件面板的高度随剩余空间调整,内容在面板内滚动,打开和关闭时恢复焦点也保持页面位置。
- 剧情将文本和分支选项放进同一滚动容器,跳过和菜单留在顶部。较高倍率下可滚动查看并点按选项。
- 牌库、牌堆、遗物、战斗状态、菜单确认和调试管理器沿用奖励与药水的原生对话框挂载方式,以可视窗口约束弹窗尺寸。打开、选择与关闭仍通过各自原有入口执行。
- 战场右侧的牌堆和遗物入口随可用高度调整。战斗状态平时放在头像上方,上方空间不足时移到头像侧面。
## 验收项
| 范围 | 操作与通过标准 |
| --- | --- |
| 选将、事件、商店、休息处 | 能看到主操作,点按后返回正确选择或退出。 |
| 地图和行军菜单 | 相同屏幕位移下,地图拖动与鼠标位移差不超过 2 CSS px。触屏能滚动,能点开菜单、查看行囊、返回和关闭,能选中可前往节点。 |
| 剧情 | 文本和分支选项可浏览,点按分支写入正确剧情状态,跳过和继续均可用。 |
| 奖励和战后结算 | 选牌、跳过和结算选项可到达,确认后继续流程。 |
| 牌库、牌堆、遗物、药水和战斗状态 | 能通过实际入口打开,弹窗在可视区域内,详情和关闭可点按。内容较长时能滚动。 |
| 菜单确认和调试管理器 | 对话框在可视区域内,所选操作返回正确结果,关闭后回到原界面。 |
## 浏览器复核
从术樱包根目录执行。脚本使用本地无名杀、十周年 UI、Playwright 和 Microsoft Edge。需要时将 `CODEX_NODE_MODULES` 指向包含 Playwright 的 `node_modules`,将 `HUD_ARTIFACTS` 指向已建立的截图目录。
```powershell
$env:UI_ZOOM_REVIEW = '1'
node mengsan/tools/test-battle-hud.cjs
```
自动回归覆盖 16 个界面与交互。以 812×375 横屏为基线,十周年 UI 检查 50%、65%、100%、150%、200%、300%,原生 UI 检查 150% 和 300%。两条缩放入口均检查界面打开后从 65% 切到 200%。另检查 420×360 窄屏、390×720 竖屏和 1280×720 桌面。
脚本通过渲染出的按钮执行代表性操作,检查界面边界、返回值和关闭结果。鼠标地图拖动单独检查像素误差。完整战斗 HUD 和出牌响应按[战斗回归清单](mengsan-battle-ui.md)复核。
## Android 实机复核
用 Android 客户端实际启用的十周年 UI 风格,在常用倍率和一个较高倍率下复核受影响的操作。优先确认触屏地图滚动、剧情分支点按、较长内容滑动和弹窗关闭。报告逐项标注通过、失败或未验。
@@ -0,0 +1,75 @@
# 梦三模式首次安装分包 Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal** 让梦三首次安装优先使用同源同版本的分包 ZIP,降低请求数并控制解包内存。
**Architecture** 两个发布工作流调用同一个 Python 打包脚本。客户端在现有暂存阶段串行处理附件,对剩余文件复用原有逐文件下载,全部暂存成功后继续执行现有安装事务。
**Tech Stack** Python 标准库 `zipfile` 和 `unittest`、PowerShell 发布工作流、宿主 JSZip 2.7、`DecompressionStream`、Electron HTTPS、Cordova `FileTransfer`、Node.js 测试运行器。
**Spec** `docs/superpowers/specs/2026-11-24-mengsan-zip-install-design.md`
## 全局约束
- GitHub 和 Gitea 发布同一标签对应的分包。客户端使用玩家已选的源和渠道。
- 单次只处理一个独立 ZIP。路径、大小和 SHA-256 以标签的模块清单为准。全部暂存后才安装。
- ZIP 不可用时从同源同标签补齐未完成文件。保留现有事务式安装、卸载与重启后重试。
- 首版只覆盖梦三首次安装。日常差量更新、查漏补缺、旧安装迁移、常规武将与天书乱斗继续使用现有下载方式。
- 实现和验证阶段通过临时测试配置打开 ZIP。两个源的实机验收通过后,再在正式配置默认启用。
## 审查重点
- GitHub 已推送标签,Release 仍在草稿或上传中。首次安装应使用同标签文件下载。
- 一包失败或重试时,其他包已通过校验的暂存文件只安装一次。
- 错误的标签、越界条目和错误字节不得导致正式目录写入未验证的文件。
- 文件系统写入失败应进入现有恢复逻辑。同源回退只处理附件下载、解包或内容校验失败。
- 重启后已知的新装可以重新使用 ZIP。旧版待修复记录和已有安装更新继续走原路径。
## 文件分工
- `tools/build_mengsan_archives.py` · 从正式梦三清单生成并验证分包。
- `.github/workflows/release.yml` 和 `.gitea/workflows/release.yml` · 在现有 ZIP 构建和草稿上传步骤加入分包。
- `update.js` · 查询附件、复用有字节上限的下载、在安装暂存阶段解包及补齐。
- `tools/test_mengsan_archives.py` 和 `tools/test_mengsan_zip_install.mjs` · 覆盖生成规则、正常安装入口及故障分支。
- `tools/UPDATE.md` · 记录附件格式和实机启用条件。
## 任务一 · 构建及核验分包
**接口** `build_archives(root: Path, output: Path, tag: str) -> list[Path]` 使用 `root/dist/modules/mengsan.json`,生成 `mengsan-<tag>-part-001.zip` 等附件。条目名为 `mengsan/…`,与模块清单路径逐字一致。
- [ ] 在 `tools/test_mengsan_archives.py` 写 `test_parts_cover_packable_files_once` 和 `test_reject_inconsistent_release`。用临时目录验证 `Counter(written_paths) == Counter(packable_paths)`、条目 SHA-256 与清单一致、超出 10 MiB 的单文件不入包。对清单版本不匹配、源文件变化和单个分包成品超过 11 MiB 分别断言生成失败。
- [ ] 运行 `python -m unittest discover -s tools -p test_mengsan_archives.py`,确认因生成器尚缺而失败。
- [ ] 实现生成器及 CLI `python tools/build_mengsan_archives.py --root <snapshot> --out-dir <output> --tag <tag>`。按清单路径排序,依次填入每包合计最多 10 MiB 的未压缩文件。使用 `ZIP_DEFLATED`、压缩级别 6。关闭 ZIP 后检查成品不超过 11 MiB,逐项校验路径、大小和 SHA-256,并检查各包合计覆盖所有可打包条目。调整上限时同步客户端和测试。
- [ ] 重跑 Python 测试并确认通过。以当前分支生成的清单和导出快照运行 CLI,检查实际分包数、最大包大小和完整覆盖。使用发布工作流同样的标签快照校验命令 `python tools/verify_manifest.py --root <snapshot> --version <version>`。
## 任务二 · 接入两个发布工作流
**接口** 复用任务一的 CLI。每个工作流向现有草稿 Release 上传生成器在单独输出目录产生的所有 `mengsan-<tag>-part-*.zip`,ZIP 附件使用 `application/zip`。
- [ ] 在两个 `release.yml` 的快照验证后调用 Python 构建,并在取消草稿前上传分包。沿用原来生成、上传完整 ZIP 和清单的步骤。CI 继续使用标签快照内的脚本与清单。
- [ ] 更新 `tools/UPDATE.md` 的发布步骤及分包命名。区分标签 raw 清单、梦三 Release 附件和完整离线包。
- [ ] 准备可发布的测试标签后,在获准的测试发布中运行两个工作流。核对同一标签均包含完整 ZIP 和相同编号的分包,完整 ZIP 的原有目录结构保持可用。发版附件下载验证归任务四。
## 任务三 · 在梦三首次安装的暂存阶段接入 ZIP
**接口** `getMengsanReleaseParts(manifest, shuYing) -> Promise<Array<{name: string, url: string, size: number}>>` 返回已选源的同标签分包。`stageMengsanArchives(shuYing, manifest, operationRoot, remaining: Set<string>, stageVerified, progress) -> Promise<void>` 串行读取这些包。`stageVerified(file: string, bytes: Uint8Array) -> Promise<void>` 在写盘前记录尝试,写盘成功后才从 `remaining` 移除文件。
- [ ] 在 `tools/test_mengsan_zip_install.mjs` 用 `node:test` 从正常菜单入口 `manageMengsanModule` 触发安装。`fresh install stages from selected release` 对两个源分别断言附件查询标签正确、成功分包文件无 raw 请求、所有文件备齐前无正式路径写入。`falls back for missing or unusable release parts` 覆盖 Release 404、草稿、标签不匹配、超限响应、损坏 ZIP、越界条目和错误 SHA-256,断言 `rawRequests` 恰好等于未成功暂存文件。`retries the failed ZIP once` 覆盖单包下载异常后成功。`staging write errors preserve recovery` 断言写入失败后无后续 raw 请求。`installed updates and legacy repairs stay on raw` 从 `checkVersion`、`repairMissingFiles` 和旧修复记录分别验证无 Release 请求。至少一个解析用例使用宿主实际捆绑的 JSZip 2.7 和脚本生成的 ZIP。
- [ ] 运行 `node --experimental-vm-modules --test tools/test_mengsan_zip_install.mjs` 并确认新增 ZIP 场景因当前只请求 raw 文件而失败。可通过 `vm.SourceTextModule` 和测试用 `SyntheticModule` 为 `../../noname.js` 注入宿主 API,无需从产品代码导出测试接口。
- [ ] 在 `update.js` 实现附件查询和下载。两源均请求所选 `<repoApi>/releases/tags/<tag>`,要求 `tag_name` 匹配且 `draft` 为 `false`。仅接收与版本文件名匹配、`size` 为正整数且不超过 11 MiB 的附件。使用该源的 HTTPS `browser_download_url`。GitHub 现有附件链接与 CDN 实测缺少浏览器跨域响应头,因此 Electron 使用支持 HTTPS 重定向的原生请求,Cordova 使用 `FileTransfer` 下载到本次操作目录,校验文件大小后读取并清理。网页 Fetch 用尽该附件的网络重试后回退同源逐文件下载。
- [ ] 使用 `get.zip` 获取 JSZip,逐包调用 `load` 读取目录和压缩字节。解包前检查文件名、清单归属、单条目声明大小和包内合计上限。用 `DecompressionStream("deflate-raw")` 解压到按清单大小分配的缓冲区并限制实际输出,随后调用 `verifyFile` 和 `stageVerified`。缺少流式解压能力的客户端直接逐文件下载。异常 ZIP 至多重新取一次再回退。校验、网络和解包错误记录包名及原因。写盘错误从暂存阶段直接抛出。
- [ ] 在 `manageMengsanModule` 判定首次安装。无既有安装,或已明确清空的卸载记录进入全新安装;旧待修复记录按原路径。操作记录只在已知首次安装进入 `installing` 时标记 `freshInstall: true`,失败后该标记用于重新发起完整下载。通过 `installMengsanFiles` 把这个选择传给 `updateAllFiles` 的暂存阶段;本次已完成的文件更新原进度和清理集合,原文件池仅处理剩余项。将 ZIP 网络进度与已验证文件字节分开,避免回退时重复计数。保留现有正式路径落盘前复核及安装记录提交逻辑。
- [ ] 运行 `node --check update.js` 和 Node 测试,确认通过。分别用清单对比正常 ZIP 和逐文件回退的最终目录及安装记录,确认每个新文件大小和 SHA-256 一致。
## 任务四 · 实机验收和默认启用
- [ ] 在同一台受支持手机上,用同一客户端版本、梦三标签、下载源和网络条件,对逐文件和分包的干净安装各测三次。每次从确认安装计时到校验完成。通过网络记录统计资源请求数,从应用及其 WebView 进程记录内存峰值,报告原始样本和中位数。先测 10 MiB 展开、11 MiB 下载上限,再按实测调整。
- [ ] 在客户端真实窗口验证 GitHub 与 Gitea Release 的匿名下载、重定向和跨域行为,并分别验证 ZIP 不可用时回退到当前源的同标签文件。测试手机端强制退出后再点击安装。通过安装记录、清单校验和重启后进入梦三确认结果。另跑桌面端首次安装及差量更新一次。
- [ ] 对照同环境逐文件基线检验收益。建议启用条件为手机端资源请求数和总耗时中位数下降,内存峰值无可重复的上升,两个源与回退均通过。记录采用的包大小、测试设备和结果,再启用默认 ZIP 路径。
## 资料
- [GitHub 按标签查询 Release](https://docs.github.com/en/rest/releases/releases#get-a-release-by-tag-name)
- [GitHub Release 附件字段](https://docs.github.com/en/rest/releases/assets#get-a-release-asset)
- [Gitea 按标签查询 Release](https://docs.gitea.com/api/1.25/operations/repo-get-release-by-tag/)
@@ -0,0 +1,19 @@
# 梦三模式首次安装分包设计
梦三模式首次安装目前会逐个下载模块清单文件。当前仓库按发布清单规则筛出的梦三模块有 846 个文件,约 143.5 MiB。分包的目标是减少首次安装的网络请求,在手机端控制单次解包的数据量,并保留逐文件校验和安装恢复能力。
## 方案选择
- 逐文件下载适合日常差量更新和少量补缺,继续沿用现有流程。
- 单个 ZIP 请求最少。现有客户端会在内存中拼接完整响应,单个 ZIP 需要持有整个模块的压缩数据。
- 首次安装使用多个有大小上限的独立 ZIP。每次只处理一包,下载失败时可以单独重试。首版覆盖梦三,常规武将和天书乱斗等实测后再决定。
## 发布与安装
GitHub 和 Gitea 的现有发布工作流使用各自同一发布标签的梦三清单生成分包,将分包与完整离线安装包一起上传为 Release 附件。客户端继续使用选定的源和渠道,先获得同一标签的模块清单,再查询该标签的 Release。首次安装每次下载和解开一包,每个文件按清单验证大小和 SHA-256 后写入现有暂存区。全部文件备齐后,现有安装流程再次验证暂存文件并负责替换、回滚和提交安装记录。
旧标签无 ZIP、附件暂不可用、解包失败或内容校验失败时,从同源同标签逐文件补齐。本次已校验并写入暂存区的文件可以继续用。暂存写入失败走现有安装失败处理。退出游戏后,安装按现有方式重新发起,部分下载进度只用于当前操作。已安装的模块更新、查漏补缺、卸载和旧安装迁移沿用现有行为。
## 启用条件
同一部手机、同一版本和同一下载源下,对比两种方式的请求数、总耗时和内存峰值。验证两个源的附件在游戏内均可下载,且 ZIP 不可用时均可从同源回退。手机实测确认有收益后再默认启用。具体分包上限由实测确定。
+1 -1
View File
@@ -6,7 +6,7 @@ import { configureDiagnostics } from "./diagnostics/index.js";
export const type = "extension";
export let shuYing = new Object();
const shuYingLocalVersion = "2.0.2.3-rc.5";
const shuYingLocalVersion = "2.0.2.3-rc.11";
shuYing.name = "术樱包";
shuYing.editable = false;
+4 -2
View File
@@ -39,6 +39,8 @@
手牌 UI 子扩展没有单独关闭开关;实现边界、日志位置和验证结果见
[手牌 UI 子扩展说明](docs/ui-hand-subextension.md)。
本机翻译、事件插图、药水及其他图集的位置见 [STS2 素材路径对照](docs/sts2-asset-paths.md)。
战后技能清理只针对本场角色。`fixed` / `superCharlotte` 的纯元数据技能
保留在即将销毁的角色上,不阻断结算;含触发器、规则修正、标记清理或
释放回调的技能在整角色销毁时正常卸载,等待回调完成。公共技能定义及
@@ -62,7 +64,7 @@
PC 和安卓客户端的完整对局验证。
梦三【杀】消耗 1 费用,基础伤害为 6;其他锦囊的基础伤害仍为 4。
【重杀】(`mengsan_zhongsha`)是普通战斗奖励池中的通用基本牌:
【重杀】(`mengsan_zhongsha`)是通用基本牌,只有允许通用卡的奖励才可从对应池抽到:
消耗 2 费用,对攻击范围内的一名其他角色直接造成 8 点伤害,
然后给予存活目标 2 层易伤,每回合使用次数不限。
易伤沿用既有规则:受到攻击伤害增加 50%(向上取整),
@@ -71,6 +73,6 @@ PC 和安卓客户端的完整对局验证。
强化规则集中在 `cards/upgrades.js`,未配置的牌不可强化。
【杀】最多强化一次,伤害由 6 变为 9;【重杀】最多强化一次,
伤害由 8 变为 10,易伤由 2 层变为 3 层,费用均不变。
随机强化只选尚未满级、可强化且没有“永恒”词缀的牌。
随机强化只选有强化规则且尚未满级的牌。「永恒」限制移除和变化,仍可强化。
没有候选牌时禁用休息节点的磨砺,并从随机奖励中排除强化。
旧存档不重写:历史超限等级按当前上限结算,未配置牌的历史等级不生效。
Binary file not shown.

After

Width:  |  Height:  |  Size: 785 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

+9 -3
View File
@@ -1,5 +1,6 @@
// Candidate external coordinator. Finish callbacks return a boolean, NEVER a drain promise.
import { getDiagnostics } from "../../diagnostics/index.js";
import { potionSlots } from "../potions/state.js";
const copy = value => JSON.parse(JSON.stringify(value));
export function createBattleFlow({settlement, chooseReward, chooseDefeat, showMap, showEnding, quiesce, releaseSkills = async () => {}, releaseBattle = () => {}, presentVictory = async () => {}}) {
let state = "map", active = null, work = null, job = null, error = null;
@@ -37,10 +38,15 @@ export function createBattleFlow({settlement, chooseReward, chooseDefeat, showMa
elite: job.pending.elite,
fixedRewards: copy(job.pending.fixedRewards || []),
rewardPackage: copy(job.pending.rewardPackage || null),
potionChoices: copy(job.pending.potionChoices || []),
potionSlots: potionSlots(job.pending.base.player),
}), false);
if (job.pending.outcome !== "defeat" && !job.pending.rewardPackage &&
job.choiceId !== null &&
!job.pending.choices.some(c => c.id === job.choiceId && c.kind !== "gold")) throw new Error("Invalid reward selection");
if (job.pending.outcome !== "defeat" && !job.pending.rewardPackage) {
const rewardId = job.pending.potionChoices?.length ? job.choiceId?.rewardId : job.choiceId;
if (rewardId !== null && !job.pending.choices.some(c => c.id === rewardId && c.kind !== "gold")) {
throw new Error("Invalid reward selection");
}
}
job.hasChoice = true;
}
job.pending = await step("applyChoice", () => settlement.choose(job.input.run.runId, job.pending.id, job.choiceId));
+6
View File
@@ -18,6 +18,12 @@ export function createBattleResources(session, {game, ui, _status}) {
const counters = {phaseNumber:game.phaseNumber, roundNumber:game.roundNumber};
game.phaseNumber = 0; game.roundNumber = 0;
session.ownResource({}, () => {
// 弃牌展示用的副本在开战后才挂到场上,实体牌回收时不会带走它们。
const arenaBefore = before.get(ui.arena);
const thrown = new Set(Array.from(ui.arena?.children || []).filter(node =>
!arenaBefore?.has(node) && node.classList.contains("card") && node.classList.contains("thrown")));
for (const node of thrown) node.remove();
if (thrown.size && Array.isArray(ui.thrown)) ui.thrown = ui.thrown.filter(node => !thrown.has(node));
for (const card of cards) card.remove();
for (const [node,parent] of nodes) if (node.parentNode === parent) node.remove();
for (const {object,key,value,descriptor} of fields.slice().reverse()) {
+14 -4
View File
@@ -9,6 +9,7 @@ import { heldRelics } from "../relics/definitions.js";
import { getDiagnostics } from "../../diagnostics/index.js";
import { prepareRewardPackage, applyRewardPackage }
from "../progression/reward-package.js";
import { applyPotionReward, rollPotionReward, samplePotions } from "../potions/state.js";
const copy = value => JSON.parse(JSON.stringify(value));
const idFor = (run, node) => JSON.stringify([run.runId, run.actIndex, node.id]);
@@ -89,6 +90,9 @@ export function createBattleSettlement({
getRandomRewardChoices) : null;
item = {id, state:"awaitingChoice", nodeId:node.id, base, choices:copy(choices), fixedRewards:copy(fixedRewards), victoryDialogue:copy(encounter.victoryDialogue || []), boss:!!encounter.boss, elite, outcome, relicRecovery, bondGrowth};
item.rewardPackage = copy(rewardPackage);
item.potionChoices = outcome !== "victory" ? []
: encounter.rewardPackage ? samplePotions(base, encounter.rewardPackage.potionChoices ?? 0)
: !encounter.boss && (encounter.tier === "normal" || elite) ? rollPotionReward(base, elite) : [];
diagnostics.info("prepared", {
outcome, choices: choices.map(choice => choice.id), fixedRewards,
expectedRevision: snapshot.revision, actualRevision: run.revision,
@@ -132,20 +136,26 @@ export function createBattleSettlement({
const sameChoice = item.rewardPackage
? item.choiceId?.cardId === choiceId?.cardId &&
item.choiceId?.relicId === choiceId?.relicId
: item.choiceId === choiceId;
if (!sameChoice) throw new Error("Choice already locked");
: item.potionChoices.length ? item.choiceId?.rewardId === choiceId?.rewardId
: item.choiceId === choiceId;
if (!sameChoice || item.choiceId?.potion?.id !== choiceId?.potion?.id ||
item.choiceId?.potion?.replaceIndex !== choiceId?.potion?.replaceIndex) {
throw new Error("Choice already locked");
}
return copy(item);
}
const result = copy(item.base);
let route = "defeat";
if (item.outcome === "victory") {
applyPotionReward(result.player, item.potionChoices, choiceId?.potion);
if (item.rewardPackage) {
applyRewardPackage(result, item.rewardPackage, choiceId,
applyReward);
}
if (!item.rewardPackage) {
const reward = item.choices.find(c => c.id === choiceId && c.kind !== "gold");
if (choiceId !== null && !reward) {
const rewardId = item.potionChoices.length ? choiceId?.rewardId : choiceId;
const reward = item.choices.find(c => c.id === rewardId && c.kind !== "gold");
if (rewardId !== null && !reward) {
throw new Error("Choose one pending reward or skip");
}
// 结果只计算一次;保存失败后的重试不再次发放金币。
+3 -2
View File
@@ -13,18 +13,19 @@ export function hasPendingDeathBlow(source) {
return pendingDeathBlows.has(source);
}
export async function beginDeathBlow(source, target, intent) {
export async function beginDeathBlow(source, target, intent, battle) {
if (!isDeathBlowIntent(intent)) {
throw new TypeError("濒死一击需要 death_blow 意图类型");
}
if (attackHitCount(intent) !== 1) {
throw new RangeError("濒死一击只能造成一次伤害");
}
const damage = outgoingAttackDamage(intent, source);
const damage = outgoingAttackDamage(intent, source, battle);
if (!source?.isAlive() || !target?.isAlive()) return false;
const hit = target.damage(damage, source);
hit.mengsanAttack_shuying = true;
hit.mengsanScriptedSkill_shuying = true;
await hit;
if (source.isAlive()) pendingDeathBlows.add(source);
return true;
+17 -10
View File
@@ -1,6 +1,8 @@
import { slowAttackDamage } from "../monsters/effigy-slow.js";
import { shrinkAttackDamage } from "../monsters/shrinker-status.js";
import { ironcladStrengthPenalty } from "../cards/ironclad-hooks.js";
import { applyBodyguardDamage, ironcladStrengthPenalty } from "../cards/ironclad-hooks.js";
import { applyInterceptDamage, applyIntangibleDamage } from "../cards/shared-hooks.js";
import { campEnemy } from "./camps.js";
export function attackHitCount(intent) {
const hits = intent.hits ?? 1;
@@ -10,23 +12,28 @@ export function attackHitCount(intent) {
return hits;
}
export function outgoingAttackDamage(intent, source) {
export function applyAttackWeakness(damage, source, owner, relics) {
if (!(source?.storage?.mengsanWeak_shuying > 0)) return damage;
const multiplier = campEnemy(owner, source) && relics?.has("paper_krane") ? 0.6 : 0.75;
return Math.floor(damage * multiplier);
}
export function outgoingAttackDamage(intent, source, battle) {
if (!Number.isInteger(intent.damage) || intent.damage < 0) {
throw new RangeError("预测伤害必须是非负整数");
}
const storedStrength = source?.storage?.mengsanStrength_shuying;
const strength = Number.isInteger(storedStrength) ? storedStrength : 0;
let damage = Math.max(0, intent.damage + strength - ironcladStrengthPenalty(source));
if (source?.storage?.mengsanWeak_shuying > 0) {
damage = Math.floor(damage * 0.75);
}
return shrinkAttackDamage(damage, source);
const damage = Math.max(0, intent.damage + strength - ironcladStrengthPenalty(source));
return shrinkAttackDamage(applyAttackWeakness(damage, source, battle?.owner, battle?.relics), source);
}
export function previewAttackDamage(intent, source, target) {
let damage = outgoingAttackDamage(intent, source);
export function previewAttackDamage(intent, source, target, battle) {
let damage = outgoingAttackDamage(intent, source, battle);
if (target?.storage?.mengsanVulnerable_shuying > 0) {
damage = Math.ceil(damage * 1.5);
}
return slowAttackDamage(damage, target);
damage = applyInterceptDamage(damage, source, target, battle?.players);
damage = applyBodyguardDamage(damage, source, target, battle?.players);
return applyIntangibleDamage(slowAttackDamage(damage, target), target);
}
+2 -2
View File
@@ -20,14 +20,14 @@ export function createIntentExecutor(game, getActiveBattle) {
if (!active(source)) break;
if (!target.isAlive()) continue;
if (isDeathBlowIntent(move)) {
await beginDeathBlow(source, target, move);
await beginDeathBlow(source, target, move, getActiveBattle());
continue;
}
if (move.damage != null) {
for (let hitIndex = 0; hitIndex < attackHitCount(move); hitIndex++) {
if (!target.isAlive() || !active(source)) break;
const hit = target.damage(
outgoingAttackDamage(move, source), source);
outgoingAttackDamage(move, source, getActiveBattle()), source);
hit.mengsanAttack_shuying = true;
hit.mengsanScriptedSkill_shuying = true;
await hit;
+2 -1
View File
@@ -3,6 +3,7 @@
import { cardPackDefinitions } from "./packs/data.js";
import { cardTypes, cardRarityLabels } from "./classification-types.js";
import { liubeiCardTraits } from "./packs/liubei/traits.js";
import { isRetiredDeckCard } from "./retired-cards.js";
const definitions = [
...cardPackDefinitions,
{ name: "sha", category: "damage", owner: null, ...liubeiCardTraits.sha },
@@ -42,6 +43,6 @@ export const cardDefinitions = createCardRegistry(definitions);
export function canAcquireCard(character, name, registry = cardDefinitions) {
const definition = Object.hasOwn(registry, name) ? registry[name] : null;
return !!definition && !definition.generatedOnly &&
return !!definition && !definition.generatedOnly && !isRetiredDeckCard(character, name) &&
(definition.owner === null || definition.owner === character);
}
+5
View File
@@ -6,3 +6,8 @@ export function cleanCardDescription(value) {
.replace(/^(?:主动使用消耗\s*\d+\s*(?:点)?费用|响应不消耗费用|\d+\s*(?:点)?费(?:用)?)[。;::,,]\s*/, "")
.replace(/^(?:主动使用消耗X费用|X费)[。;]\s*/, "消耗当前剩余费用,消耗量为X。");
}
export function cardDescriptionText(card, definition, fallback) {
const prompt = typeof definition?.cardPrompt === "function" ? definition.cardPrompt(card) : null;
return prompt || fallback || "暂无卡牌介绍。";
}
+11
View File
@@ -26,6 +26,17 @@ export const ironcladSkillExhausts = (player,card) => Boolean(ironcladHooks(play
export const ironcladCost = (player,card,cost) => ironcladHooks(player)?.cost(card,cost) ?? cost;
export const ironcladCardIsFree = (player,card) => Boolean(ironcladHooks(player)?.isFree(card));
export const ironcladStrengthPenalty = player => (ironcladHooks(player)?.strengthPenalty() || 0) + sharedStrengthPenalty(player);
export function applyBodyguardDamage(damage, source, target, players) {
if (!source || !target || !players) return damage;
let multiplier = 1;
for (const holder of players) {
if (ironcladHooks(holder)?.hasBodyguard?.() && holder.isFriendOf(target) && holder.isEnemyOf(source)) {
multiplier *= holder === target ? 2 : 0.5;
}
}
return multiplier === 1 ? damage : Math.floor(damage * multiplier);
}
export const queueIroncladExhaust = (player,card) => ironcladHooks(player)?.queueExhaust(card);
export const flushIroncladExhaust = async player => { await ironcladHooks(player)?.flushExhaust(); await flushRelicExhaust(player); };
export const afterIroncladDraw = async (player,cards) => { await ironcladHooks(player)?.afterDraw(cards); };
+4 -4
View File
@@ -58,12 +58,12 @@ export function createMengsanCards({ cardPacks, isBattleActive = () => true } =
card.sha.cardPrompt = used => {
const damage = cardUpgradeLevel(used)
? cardUpgradeRule("sha").damage : SHA_DAMAGE;
return `梦三:主动使用消耗1费用;目标须使用【闪】,` +
`否则受到${damage}点伤害。每回合使用次数不限。`;
return `出牌阶段,对攻击范围内的一名角色使用。目标须使用【闪】,否则受到${damage}点伤害。每回合使用次数不限。`;
};
translate.sha_info = `梦三:主动使用消耗1费用。出牌阶段,对攻击范围内的一名角色使用;其须使用【闪】,否则受到${SHA_DAMAGE}点伤害。每回合使用次数不限。`;
translate.sha_info = card.sha.cardPrompt({ name: "sha" });
card.tao.content = async function (event) { await event.target.recover(8); };
translate.tao_info = "梦三:主动使用消耗1费用,回复8点生命;濒死救援不消耗费用,同样回复8点生命。";
translate.tao_info = "出牌阶段,为自己回复8点生命。救援濒死角色时,为该角色回复8点生命,且不消耗费用。";
card.tao.cardPrompt = () => translate.tao_info;
card.taoyuan.content = async function (event) { await event.target.recover(8); };
translate.taoyuan_info = "梦三:主动使用消耗2费用。所有角色各回复8点生命。";
card.taoyuan.cardPrompt = () => translate.taoyuan_info;
+64 -64
View File
@@ -80,7 +80,7 @@ export const colorlessCards = Object.freeze([
"cardType": "attack",
"rarity": "uncommon",
"cost": 0,
"description": "造成8点伤害。对所有其他敌人造成等量的伤害。",
"description": "对目标造成8点伤害,再对其余敌人造成等量的非攻击伤害。",
"base": {
"damage": 8,
"hits": 1
@@ -89,7 +89,7 @@ export const colorlessCards = Object.freeze([
"damage": 11,
"hits": 1,
"cost": 0,
"description": "造成11点伤害。对所有其他敌人造成等量的伤害。"
"description": "对目标造成11点伤害,再对其余敌人造成等量的非攻击伤害。"
}
},
{
@@ -122,7 +122,7 @@ export const colorlessCards = Object.freeze([
"cardType": "attack",
"rarity": "uncommon",
"cost": 1,
"description": "造成7点伤害。获得等量于所造成伤害的格挡。",
"description": "造成7点伤害,并获得等量格挡。被敌人格挡吸收的伤害也计入。",
"base": {
"damage": 7,
"hits": 1
@@ -131,7 +131,7 @@ export const colorlessCards = Object.freeze([
"damage": 9,
"hits": 1,
"cost": 1,
"description": "造成9点伤害。获得等量于所造成伤害的格挡。"
"description": "造成9点伤害,并获得等量格挡。被敌人格挡吸收的伤害也计入。"
}
},
{
@@ -143,7 +143,7 @@ export const colorlessCards = Object.freeze([
"cardType": "attack",
"rarity": "uncommon",
"cost": 1,
"description": "造成5点伤害。本回合其他玩家每攻击过一次该敌人,该牌造成的伤害就额外增加5点。",
"description": "造成5点伤害。本回合每有一次其他友方角色对该目标的攻击,此牌的基础伤害增加5点。",
"base": {
"damage": 5,
"hits": 1,
@@ -154,7 +154,7 @@ export const colorlessCards = Object.freeze([
"hits": 1,
"perAllyAttack": 7,
"cost": 1,
"description": "造成5点伤害。本回合其他玩家每攻击过一次该敌人,该牌造成的伤害就额外增加7点。"
"description": "造成5点伤害。本回合每有一次其他友方角色对该目标的攻击,此牌的基础伤害增加7点。"
}
},
{
@@ -229,7 +229,7 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 0,
"description": "使一名敌人在本回合失去9点力量。消耗。",
"description": "使一名敌人失去9点力量,直到该敌人自己的回合结束。消耗。",
"base": {
"exhaust": true,
"negativeStrength": 9
@@ -238,7 +238,7 @@ export const colorlessCards = Object.freeze([
"exhaust": true,
"negativeStrength": 15,
"cost": 0,
"description": "使一名敌人在本回合失去15点力量。消耗。"
"description": "使一名敌人失去15点力量,直到该敌人自己的回合结束。消耗。"
}
},
{
@@ -354,7 +354,7 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 0,
"description": "获得2点能量。消耗。",
"description": "补充2点费用。消耗。",
"base": {
"exhaust": true,
"energy": 2
@@ -363,7 +363,7 @@ export const colorlessCards = Object.freeze([
"exhaust": true,
"energy": 3,
"cost": 0,
"description": "获得3点能量。消耗。"
"description": "补充3点费用。消耗。"
}
},
{
@@ -375,14 +375,14 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 0,
"description": "另一名玩家获得2点能量。",
"description": "为另一名友方角色补充2点费用。若当前轮到该角色,立即生效,否则在其下个回合开始时补充。",
"base": {
"allyEnergy": 2
},
"upgraded": {
"allyEnergy": 3,
"cost": 0,
"description": "另一名玩家获得3点能量。"
"description": "为另一名友方角色补充3点费用。若当前轮到该角色,立即生效,否则在其下个回合开始时补充。"
}
},
{
@@ -394,7 +394,7 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 0,
"description": "保留。如果你的手牌为空,则抽2张牌并获得2点能量。",
"description": "保留。若结算时你没有手牌,抽2张牌并补充2点费用。",
"base": {
"retain": true,
"emptyDraw": 2,
@@ -405,7 +405,7 @@ export const colorlessCards = Object.freeze([
"emptyDraw": 3,
"emptyEnergy": 3,
"cost": 0,
"description": "保留。如果你的手牌为空,则抽3张牌并获得3点能量。"
"description": "保留。若结算时你没有手牌,抽3张牌并补充3点费用。"
}
},
{
@@ -417,13 +417,13 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 0,
"description": "在下个回合获得等量于你当前格挡值的格挡。消耗。",
"description": "记录你当前的格挡值。在你的下个回合开始时,获得等量格挡。消耗。",
"base": {
"exhaust": true
},
"upgraded": {
"cost": 0,
"description": "在下个回合获得等量于你当前格挡值的格挡。"
"description": "记录你当前的格挡值。在你的下个回合开始时,获得等量格挡。"
}
},
{
@@ -435,7 +435,7 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 0,
"description": "获得30点格挡。你在接下来的2回合内无法再从卡牌中获得格挡。消耗。",
"description": "获得30点格挡。此后,直到你的回合结束两次,你无法再通过卡牌获得格挡。消耗。",
"base": {
"exhaust": true,
"block": 30
@@ -444,7 +444,7 @@ export const colorlessCards = Object.freeze([
"exhaust": true,
"block": 40,
"cost": 0,
"description": "获得40点格挡。你在接下来的2回合内无法再从卡牌中获得格挡。消耗。"
"description": "获得40点格挡。此后,直到你的回合结束两次,你无法再通过卡牌获得格挡。消耗。"
}
},
{
@@ -456,7 +456,7 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 1,
"description": "所有玩家抽2张牌。消耗。",
"description": "你和每名其他友方角色各抽2张牌。消耗。",
"base": {
"exhaust": true,
"teamDraw": 2
@@ -465,7 +465,7 @@ export const colorlessCards = Object.freeze([
"exhaust": true,
"teamDraw": 3,
"cost": 1,
"description": "所有玩家抽3张牌。消耗。"
"description": "你和每名其他友方角色各抽3张牌。消耗。"
}
},
{
@@ -514,14 +514,14 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 1,
"description": "获得9点格挡。将本回合所有要对另一名玩家发起的攻击转移到你的身上。",
"description": "获得9点格挡。选择一名其他友方角色。直到你的下个回合开始,敌人对其的攻击伤害归零,对你的攻击伤害翻倍。",
"base": {
"block": 9
},
"upgraded": {
"block": 13,
"cost": 1,
"description": "获得13点格挡。将本回合所有要对另一名玩家发起的攻击转移到你的身上。"
"description": "获得13点格挡。选择一名其他友方角色。直到你的下个回合开始,敌人对其的攻击伤害归零,对你的攻击伤害翻倍。"
}
},
{
@@ -533,14 +533,14 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 1,
"description": "给另一名玩家11点格挡。",
"description": "让另一名友方角色获得11点格挡。",
"base": {
"allyBlock": 11
},
"upgraded": {
"allyBlock": 16,
"cost": 1,
"description": "给另一名玩家16点格挡。"
"description": "让另一名友方角色获得16点格挡。"
}
},
{
@@ -552,14 +552,14 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 1,
"description": "在本回合给予其他玩家5点力量。",
"description": "每名其他友方角色各获得5点力量,持续到各自的行动回合结束。",
"base": {
"teamStrength": 5
},
"upgraded": {
"teamStrength": 8,
"cost": 1,
"description": "在本回合给予其他玩家8点力量。"
"description": "每名其他友方角色各获得8点力量,持续到各自的行动回合结束。"
}
},
{
@@ -571,14 +571,14 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 2,
"description": "从你的抽牌堆中随机打出2张牌。",
"description": "从你的抽牌堆随机选取2张牌并免费打出。",
"base": {
"autoDraw": 2
},
"upgraded": {
"autoDraw": 3,
"cost": 2,
"description": "从你的抽牌堆中随机打出3张牌。"
"description": "从你的抽牌堆随机选取3张牌并免费打出。"
}
},
{
@@ -609,14 +609,14 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "uncommon",
"cost": 2,
"description": "在3回合结束后,对所有敌人造成40点伤害。",
"description": "在你的第3次回合结束阶段,对所有敌人造成40点非攻击伤害。",
"base": {
"bombDamage": 40
},
"upgraded": {
"bombDamage": 50,
"cost": 2,
"description": "在3回合结束后,对所有敌人造成50点伤害。"
"description": "在你的第3次回合结束阶段,对所有敌人造成50点非攻击伤害。"
}
},
{
@@ -653,14 +653,14 @@ export const colorlessCards = Object.freeze([
"cardType": "power",
"rarity": "uncommon",
"cost": 0,
"description": "每当你在一回合内打出五张牌时,对所有敌人造成10点伤害。",
"description": "你每打出5张牌,对所有敌人造成10点非攻击伤害。计数在你的回合开始时清零。",
"base": {
"panache": 10
},
"upgraded": {
"panache": 14,
"cost": 0,
"description": "每当你在一回合内打出五张牌时,对所有敌人造成14点伤害。"
"description": "你每打出5张牌,对所有敌人造成14点非攻击伤害。计数在你的回合开始时清零。"
}
},
{
@@ -693,14 +693,14 @@ export const colorlessCards = Object.freeze([
"cardType": "power",
"rarity": "uncommon",
"cost": 1,
"description": "从“防御”牌中额外获得4点格挡。",
"description": "名称含「防御」的牌使你获得格挡时,额外增加4点格挡。",
"base": {
"defendBonus": 4
},
"upgraded": {
"defendBonus": 6,
"cost": 1,
"description": "从“防御”牌中额外获得6点格挡。"
"description": "名称含「防御」的牌使你获得格挡时,额外增加6点格挡。"
}
},
{
@@ -731,14 +731,14 @@ export const colorlessCards = Object.freeze([
"cardType": "power",
"rarity": "uncommon",
"cost": 1,
"description": "你每抽10张牌,获得1点能量。",
"description": "累计每抽满10张牌,补充1点费用。",
"base": {
"automation": 1
},
"upgraded": {
"automation": 1,
"cost": 0,
"description": "你每抽10张牌,获得1点能量。"
"description": "累计每抽满10张牌,补充1点费用。"
}
},
{
@@ -792,7 +792,7 @@ export const colorlessCards = Object.freeze([
"cardType": "attack",
"rarity": "rare",
"cost": 1,
"description": "造成本场战斗中所打出牌数的伤害。",
"description": "本场战斗中,玩家方每打出1张牌,此牌便造成1点基础伤害。本次打出也计入。",
"base": {
"hits": 1
},
@@ -800,7 +800,7 @@ export const colorlessCards = Object.freeze([
"retain": true,
"hits": 1,
"cost": 1,
"description": "保留。造成本场战斗中所打出牌数的伤害。"
"description": "保留。本场战斗中,玩家方每打出1张牌,此牌便造成1点基础伤害。本次打出也计入。"
}
},
{
@@ -835,7 +835,7 @@ export const colorlessCards = Object.freeze([
"cardType": "attack",
"rarity": "rare",
"cost": 2,
"description": "造成20点伤害。斩杀时,获得20金币。",
"description": "造成20点伤害。若玩家用此牌击杀敌人,获得20金币。",
"base": {
"damage": 20,
"hits": 1,
@@ -846,7 +846,7 @@ export const colorlessCards = Object.freeze([
"hits": 1,
"killGold": 25,
"cost": 2,
"description": "造成25点伤害。斩杀时,获得25金币。"
"description": "造成25点伤害。若玩家用此牌击杀敌人,获得25金币。"
}
},
{
@@ -858,7 +858,7 @@ export const colorlessCards = Object.freeze([
"cardType": "attack",
"rarity": "rare",
"cost": 3,
"description": "造成25点伤害。将3张随机0能量的牌加入你的手牌。",
"description": "造成25点伤害。从基础费用为0的牌中随机生成3张,加入你的手牌。",
"base": {
"damage": 25,
"hits": 1,
@@ -870,7 +870,7 @@ export const colorlessCards = Object.freeze([
"generateZero": 3,
"generatedUpgrade": 1,
"cost": 3,
"description": "造成30点伤害。将3张随机升级过的0能量的牌加入你的手牌。"
"description": "造成30点伤害。从基础费用为0的牌中随机生成3张,能强化的先强化,再加入你的手牌。"
}
},
{
@@ -882,7 +882,7 @@ export const colorlessCards = Object.freeze([
"cardType": "attack",
"rarity": "rare",
"cost": 3,
"description": "造成10点伤害。该敌人在本回合受到的来自其他玩家的伤害变为两倍。",
"description": "造成10点伤害。直到你的下个回合开始,其他友方角色对该敌人造成的伤害翻倍。",
"base": {
"damage": 10,
"hits": 1,
@@ -893,7 +893,7 @@ export const colorlessCards = Object.freeze([
"hits": 1,
"allyDamageMultiplier": 3,
"cost": 3,
"description": "造成14点伤害。该敌人在本回合受到的来自其他玩家的伤害变为三倍。"
"description": "造成14点伤害。直到你的下个回合开始,其他友方角色对该敌人造成的伤害变为3倍。"
}
},
{
@@ -981,7 +981,7 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "rare",
"cost": 1,
"description": "抽牌直到抽满手牌。消耗。",
"description": "抽牌直到手牌数量达到当前上限。消耗。",
"base": {
"exhaust": true
},
@@ -989,7 +989,7 @@ export const colorlessCards = Object.freeze([
"exhaust": true,
"retain": true,
"cost": 1,
"description": "保留。抽牌直到抽满手牌。消耗。"
"description": "保留。抽牌直到手牌数量达到当前上限。消耗。"
}
},
{
@@ -1001,13 +1001,13 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "rare",
"cost": 1,
"description": "获得等同于另一位玩家格挡值的格挡。消耗。",
"description": "选择另一名友方角色,获得等同于其当前格挡值的格挡。消耗。",
"base": {
"exhaust": true
},
"upgraded": {
"cost": 1,
"description": "获得等同于另一位玩家格挡值的格挡。"
"description": "选择另一名友方角色,获得等同于其当前格挡值的格挡。"
}
},
{
@@ -1039,14 +1039,14 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "rare",
"cost": 2,
"description": "所有玩家获得12点格挡。",
"description": "你和每名其他友方角色各获得12点格挡。",
"base": {
"teamBlock": 12
},
"upgraded": {
"teamBlock": 17,
"cost": 2,
"description": "所有玩家获得17点格挡。"
"description": "你和每名其他友方角色各获得17点格挡。"
}
},
{
@@ -1058,14 +1058,14 @@ export const colorlessCards = Object.freeze([
"cardType": "skill",
"rarity": "rare",
"cost": 3,
"description": "打出你弃牌堆中的3张随机攻击牌。",
"description": "从你的弃牌堆随机选择至多3张攻击牌并免费打出。",
"base": {
"autoDiscard": 3
},
"upgraded": {
"autoDiscard": 4,
"cost": 3,
"description": "打出你弃牌堆中的4张随机攻击牌。"
"description": "从你的弃牌堆随机选择至多4张攻击牌并免费打出。"
}
},
{
@@ -1077,11 +1077,11 @@ export const colorlessCards = Object.freeze([
"cardType": "power",
"rarity": "rare",
"cost": 1,
"description": "每回合首次打出攻击或技能牌时,将其置于你的抽牌堆顶端。",
"description": "每回合第一次打出攻击牌或技能牌后,将该牌从弃牌堆放回抽牌堆顶部。",
"base": {},
"upgraded": {
"cost": 0,
"description": "每回合首次打出攻击或技能牌时,将其置于你的抽牌堆顶端。"
"description": "每回合第一次打出攻击牌或技能牌后,将该牌从弃牌堆放回抽牌堆顶部。"
}
},
{
@@ -1093,12 +1093,12 @@ export const colorlessCards = Object.freeze([
"cardType": "power",
"rarity": "rare",
"cost": 1,
"description": "在你的回合开始时,变化你手牌中的1张牌。",
"description": "在你的回合开始时,选择一张可以变化的手牌,将它随机变为另一张牌。",
"base": {},
"upgraded": {
"innate": true,
"cost": 1,
"description": "固有。在你的回合开始时,变化你手牌中的1张牌。"
"description": "固有。在你的回合开始时,选择一张可以变化的手牌,将它随机变为另一张牌。"
}
},
{
@@ -1110,12 +1110,12 @@ export const colorlessCards = Object.freeze([
"cardType": "power",
"rarity": "rare",
"cost": 1,
"description": "每当你在你的回合获得格挡时,其他玩家获得相应一半的格挡。",
"description": "在你的回合内,每当你获得格挡,其他友方角色各获得其一半,向下取整。",
"base": {},
"upgraded": {
"innate": true,
"cost": 1,
"description": "固有。每当你在你的回合获得格挡时,其他玩家获得相应一半的格挡。"
"description": "固有。在你的回合内,每当你获得格挡,其他友方角色各获得其一半,向下取整。"
}
},
{
@@ -1127,11 +1127,11 @@ export const colorlessCards = Object.freeze([
"cardType": "power",
"rarity": "rare",
"cost": 2,
"description": "在你的回合开始时,打出你抽牌堆顶部的牌。",
"description": "你的摸牌阶段结束后,免费打出抽牌堆最上面的一张牌。",
"base": {},
"upgraded": {
"cost": 1,
"description": "在你的回合开始时,打出你抽牌堆顶部的牌。"
"description": "你的摸牌阶段结束后,免费打出抽牌堆最上面的一张牌。"
}
},
{
@@ -1178,14 +1178,14 @@ export const colorlessCards = Object.freeze([
"cardType": "power",
"rarity": "rare",
"cost": 3,
"description": "获得9层覆甲。",
"description": "获得9层覆甲。回合结束时获得等同于层数的格挡,你的回合开始时减少1层。",
"base": {
"plating": 9
},
"upgraded": {
"plating": 12,
"cost": 3,
"description": "获得12层覆甲。"
"description": "获得12层覆甲。回合结束时获得等同于层数的格挡,你的回合开始时减少1层。"
}
},
{
@@ -1197,7 +1197,7 @@ export const colorlessCards = Object.freeze([
"cardType": "attack",
"rarity": "uncommon",
"cost": 1,
"description": "造成10点伤害。将这张牌在本场战斗中的伤害增加15,然后将其交给一名随机盟友。",
"description": "造成10点伤害。此牌在本场战斗中的伤害增加15点。若有可以接收此牌的其他友方角色,将此牌交给随机一名。",
"base": {
"damage": 10,
"hits": 1,
@@ -1208,7 +1208,7 @@ export const colorlessCards = Object.freeze([
"hits": 1,
"ballGrowth": 25,
"cost": 1,
"description": "造成10点伤害。将这张牌在本场战斗中的伤害增加25,然后将其交给一名随机盟友。"
"description": "造成10点伤害。此牌在本场战斗中的伤害增加25点。若有可以接收此牌的其他友方角色,将此牌交给随机一名。"
}
}
]);
+4 -4
View File
@@ -52,7 +52,7 @@ export const curseCards = Object.freeze([
"cardType": "curse",
"rarity": "curse",
"cost": null,
"description": "不能被打出。你在本回合不能打出超过3张牌。",
"description": "不能被打出。此牌在你手中时,若本回合已主动打出3张牌,你不能再主动打牌。",
"base": {
"unplayable": true
}
@@ -66,7 +66,7 @@ export const curseCards = Object.freeze([
"cardType": "curse",
"rarity": "curse",
"cost": null,
"description": "不能被打出。在你的回合结束时,如果这张牌在你的手牌中, 你受到2点伤害。",
"description": "不能被打出。你的弃牌阶段开始时,若此牌仍在手牌中,你受到2点伤害。",
"base": {
"unplayable": true,
"endDamage": 2
@@ -81,7 +81,7 @@ export const curseCards = Object.freeze([
"cardType": "curse",
"rarity": "curse",
"cost": null,
"description": "不能被打出。在你的回合结束时,如果这张牌在你的手牌中,失去相当于手牌数量的生命。",
"description": "不能被打出。你的弃牌阶段开始时,若此牌仍在手牌中,你每持有1张手牌便失去1点生命。",
"base": {
"unplayable": true
}
@@ -126,7 +126,7 @@ export const curseCards = Object.freeze([
"cardType": "curse",
"rarity": "curse",
"cost": null,
"description": "不能被打出。在5场战斗后从你的牌组中移除。",
"description": "不能被打出。带着此牌赢得5场战斗后,它会从永久牌组移除。",
"base": {
"unplayable": true
}
+18 -18
View File
@@ -188,14 +188,14 @@ export const eventCards = Object.freeze([
"cardType": "skill",
"rarity": "event",
"cost": 0,
"description": "在这个回合,你当前手牌中所有牌的耗能降低至1。消耗。",
"description": "本回合,你当前手牌的费用最高为1点。消耗。",
"base": {
"exhaust": true
},
"upgraded": {
"exhaust": true,
"cost": 0,
"description": "在这场战斗,你当前手牌中所有牌的耗能降低至1。消耗。"
"description": "本场战斗中,你当前手牌的费用最高为1点。消耗。"
}
},
{
@@ -207,7 +207,7 @@ export const eventCards = Object.freeze([
"cardType": "skill",
"rarity": "event",
"cost": 1,
"description": "获得8点格挡。获得2点能量。",
"description": "获得8点格挡,再补充2点费用。",
"base": {
"block": 8,
"energy": 2
@@ -217,7 +217,7 @@ export const eventCards = Object.freeze([
"block": 8,
"energy": 2,
"cost": 1,
"description": "固有。获得8点格挡。获得2点能量。"
"description": "固有。获得8点格挡,再补充2点费用。"
}
},
{
@@ -229,7 +229,7 @@ export const eventCards = Object.freeze([
"cardType": "skill",
"rarity": "event",
"cost": 1,
"description": "获得8点格挡。抽3张牌",
"description": "获得8点格挡,再抽3张牌。",
"base": {
"block": 8,
"draw": 3
@@ -239,7 +239,7 @@ export const eventCards = Object.freeze([
"block": 8,
"draw": 3,
"cost": 1,
"description": "固有。获得8点格挡。抽3张牌"
"description": "固有。获得8点格挡,再抽3张牌。"
}
},
{
@@ -337,7 +337,7 @@ export const eventCards = Object.freeze([
"cardType": "power",
"rarity": "event",
"cost": 1,
"description": "能力牌的耗能减少1能量。",
"description": "本场战斗中,你打出能力牌的费用减少1点。",
"base": {
"powerDiscount": 1
},
@@ -345,7 +345,7 @@ export const eventCards = Object.freeze([
"innate": true,
"powerDiscount": 1,
"cost": 1,
"description": "固有。能力牌的耗能减少1能量。"
"description": "固有。本场战斗中,你打出能力牌的费用减少1点。"
}
},
{
@@ -357,7 +357,7 @@ export const eventCards = Object.freeze([
"cardType": "power",
"rarity": "event",
"cost": 1,
"description": "在战斗结束时,升级你牌组中的一张随机牌。",
"description": "赢得本场战斗后,随机强化永久牌组中一张可强化的牌。",
"base": {
"battleUpgrade": 1
},
@@ -365,7 +365,7 @@ export const eventCards = Object.freeze([
"innate": true,
"battleUpgrade": 1,
"cost": 1,
"description": "固有。在战斗结束时,升级你牌组中的一张随机牌。"
"description": "固有。赢得本场战斗后,随机强化永久牌组中一张可强化的牌。"
}
},
{
@@ -468,7 +468,7 @@ export const eventCards = Object.freeze([
"cardType": "skill",
"rarity": "ancient",
"cost": 0,
"description": "获得2点能量。抽2张牌。失去1点最大生命。",
"description": "补充2点费用,抽2张牌。若此时生命已满,先失去1点生命。随后降低1点最大生命。",
"base": {
"draw": 2,
"energy": 2
@@ -477,7 +477,7 @@ export const eventCards = Object.freeze([
"draw": 3,
"energy": 3,
"cost": 0,
"description": "获得3点能量。抽3张牌。失去1点最大生命。"
"description": "补充3点费用,抽3张牌。若此时生命已满,先失去1点生命。随后降低1点最大生命。"
}
},
{
@@ -511,7 +511,7 @@ export const eventCards = Object.freeze([
"cardType": "skill",
"rarity": "ancient",
"cost": 2,
"description": "固有。升级你的全部卡牌。消耗。",
"description": "固有。强化本场战斗中属于你的所有可强化牌。消耗。",
"base": {
"exhaust": true,
"innate": true
@@ -520,7 +520,7 @@ export const eventCards = Object.freeze([
"exhaust": true,
"innate": true,
"cost": 1,
"description": "固有。升级你的全部卡牌。消耗。"
"description": "固有。强化本场战斗中属于你的所有可强化牌。消耗。"
}
},
{
@@ -532,7 +532,7 @@ export const eventCards = Object.freeze([
"cardType": "skill",
"rarity": "ancient",
"cost": 3,
"description": "获得15点格挡。下个回合,抽2张牌并获得2点能量。消耗。",
"description": "获得15点格挡。在你的下个回合开始时,抽2张牌并补充2点费用。消耗。",
"base": {
"exhaust": true,
"block": 15,
@@ -545,7 +545,7 @@ export const eventCards = Object.freeze([
"nextDraw": 3,
"nextEnergy": 3,
"cost": 3,
"description": "获得17点格挡。下个回合,抽3张牌并获得3点能量。消耗。"
"description": "获得17点格挡。在你的下个回合开始时,抽3张牌并补充3点费用。消耗。"
}
},
{
@@ -557,7 +557,7 @@ export const eventCards = Object.freeze([
"cardType": "skill",
"rarity": "ancient",
"cost": 1,
"description": "从3张能力牌中选择1张加入你的手牌。这张牌在本回合可以免费打出。消耗。",
"description": "从随机出现的至多3张能力牌中选一张,加入手牌。本回合可免费打出该牌。消耗。",
"base": {
"exhaust": true
},
@@ -565,7 +565,7 @@ export const eventCards = Object.freeze([
"exhaust": true,
"generatedUpgrade": 1,
"cost": 1,
"description": "从3张升级过的能力牌中选择1张加入你的手牌。这张牌在本回合可以免费打出。消耗。"
"description": "从随机出现的至多3张能力牌中选一张,能强化时将其强化,再加入手牌。本回合可免费打出该牌。消耗。"
}
}
]);
+23 -16
View File
@@ -7,7 +7,7 @@ import { isStrikeCard } from "../../strike-counter.js";
import { snapshotRampage, copyRampageGrowth } from "../../rampage.js";
import { isAttackCard } from "../../../monsters/vine-tangled.js";
import { authorizeFreeCardUse, takeXCardUse, cardCost } from "../../../battle/combat-rules.js";
import { bindIroncladHooks } from "../../ironclad-hooks.js";
import { applyBodyguardDamage, bindIroncladHooks } from "../../ironclad-hooks.js";
import { sharedHooks } from "../../shared-hooks.js";
import { temporaryStrengthAmount } from "../../temporary-strength.js";
import { shrinkAttackDamage } from "../../../monsters/shrinker-status.js";
@@ -41,6 +41,7 @@ import { bindCombatStatusSource } from "../../../battle/status-sources.js";
export function createAdvancedIronclad({game,get,lib,status,getBattle,battleEnergy,random}) {
const states=new WeakMap(), uses=new WeakMap(), hits=new WeakMap(), growth=new WeakMap();
const seenUses=new WeakSet(), seenBlocks=new WeakSet(), seenDraws=new WeakSet();
const bridgeSignals = new WeakMap();
const valid=(player,token)=>Boolean(token && getBattle()===token.battle && token.session.active &&
token.battle.session===token.session && token.battle.root===token.root &&
token.battle.players.has(player) && player?.isAlive?.());
@@ -86,6 +87,7 @@ export function createAdvancedIronclad({game,get,lib,status,getBattle,battleEner
valid:()=>valid(player,token),
blocksDraw:()=>Boolean(s.turn.noDraw), blocksEnergy:()=>Boolean(s.turn.noEnergy),
preservesBlock:()=>Boolean(s.powers.barricade),
hasBodyguard: () => Boolean(s.powers.bodyguard),
skillExhausts:card=>Boolean(s.powers.corruption && skillCard(card)),
strengthPenalty:()=>s.negativeStrength,
isFree:card=>{
@@ -419,9 +421,17 @@ export function createAdvancedIronclad({game,get,lib,status,getBattle,battleEner
async content(event,trigger,player){trigger.num=Math.max(0,trigger.num-stateOf(player).negativeStrength);}},
[BRIDGE]:{trigger:{global:["useCard1","useCardAfter","cardsDiscardAfter","loseAfter","phaseBefore","phaseJieshuBegin","phaseAfter","drawAfter","changeHujiaAfter","damageBegin2"]},
forced:true,silent:true,popup:false,priority:60,
filter(event){const battle=getBattle();return Boolean(battle?.session.active&&belongs(event,battle.root));},
filter(event, player, name) {
const battle = getBattle();
return Boolean(battle?.session.active && !bridgeSignals.get(event)?.has(name) && belongs(event, battle.root));
},
async content(event,trigger){
const name=event.triggername;
// 同一事件的不同阶段分别结算一次,跨座位的副本跳过。
const signals = bridgeSignals.get(trigger) || new Set();
if (signals.has(name)) return;
signals.add(name);
bridgeSignals.set(trigger, signals);
if(name==="useCard1")await onUse(trigger);
else if(name==="useCardAfter")await onUseAfter(trigger);
else if(name==="phaseBefore")await turnBegin(trigger.player);
@@ -432,10 +442,7 @@ export function createAdvancedIronclad({game,get,lib,status,getBattle,battleEner
if(!seenDraws.has(trigger)&&!trigger.mengsanIcDrawHandled_shuying){seenDraws.add(trigger);await afterDraw(ensure(trigger.player),trigger.result?.cards||[]);}
} else if(name==="changeHujiaAfter")await afterBlock(trigger);
else if(name==="damageBegin2" && (trigger.mengsanAttack_shuying||isAttackCard(trigger.card))){
let multiplier=1;
for(const holder of getBattle().players){const s=stateOf(holder);if(s?.powers.bodyguard&&valid(holder,s.token)&&holder.isFriendOf(trigger.player)&&holder.isEnemyOf(trigger.source))
multiplier*=holder===trigger.player?2:0.5;}
if(multiplier!==1)trigger.num=Math.floor(trigger.num*multiplier);
trigger.num = applyBodyguardDamage(trigger.num, trigger.source, trigger.player, getBattle().players);
} else await flushAll();
}},
};
@@ -443,19 +450,19 @@ export function createAdvancedIronclad({game,get,lib,status,getBattle,battleEner
const r=cardUpgradeLevel(card)?spec.upgraded:spec.base,parts=[];
if(r.damage)parts.push(`对${r.all?"所有敌人":"一名敌人"}造成${r.damage+(r.absorbAttack?growthOf(card):0)}点伤害${r.hits?`${r.hits}次`:""}。`);
if(r.nextFreeAttack)parts.push("下一张攻击牌费用变为0。");
if(r.exhaustReplay)parts.push("回合结束时,此牌在消耗牌堆中则免费打出。");
if(r.attackDiscount)parts.push("本回合每打出一张攻击牌,费用减少1。");
if(r.exhaustReplay)parts.push("你的回合结束时,若此牌在你的消耗牌堆中,免费打出它。");
if(r.attackDiscount)parts.push("本回合你每打出1张攻击牌,此牌的费用减少1点。");
if(r.draw)parts.push(`抽${r.draw}张牌。`);
if(r.stopDraw)parts.push("本回合不能再抽牌。");
if(r.generateAttack)parts.push("随机生成一张刘备攻击牌至手牌,本回合费用为0。");
if(r.exhaustEnergy)parts.push(`被消耗时获得${r.exhaustEnergy}费用。`);
if(r.energyPerAttack)parts.push("每张攻击手牌获得1费用。");
if(r.stopEnergy)parts.push("本回合不能再获得费用。");
if(r.exhaustEnergy)parts.push(`当此牌被消耗时,补充${r.exhaustEnergy}点费用。`);
if(r.energyPerAttack)parts.push("结算时,手中每有1张攻击牌便补充1点费用。");
if(r.stopEnergy)parts.push("此后,本回合无法再获得费用。");
if(r.exhaustBlock)parts.push(`每张牌被消耗时获得${r.exhaustBlock}点格挡。`);
if(r.exhaustDraw)parts.push(`每张牌被消耗时抽${r.exhaustDraw}张牌。`);
if(r.vulnerableDraw)parts.push(`每次成功施加易伤抽${r.vulnerableDraw}张牌。`);
if(r.plating)parts.push(`获得${r.plating}层覆甲:回合末获得等量格挡,下个自身回合开始减少1层。`);
if(r.juggle)parts.push("每个自身回合的第三张攻击牌复制一张至手牌。");
if(r.juggle)parts.push("每回合你打出第3张攻击牌时,将它的一张副本加入手牌。");
if(r.innate)parts.push("固有。");
if(r.endAttack)parts.push("回合结束时,随机免费打出一张攻击手牌,目标随机。");
if(r.feed)parts.push(`斩杀敌人时永久增加${r.feed}点最大生命。`);
@@ -464,9 +471,9 @@ export function createAdvancedIronclad({game,get,lib,status,getBattle,battleEner
if(r.topPlays)parts.push(`免费打出抽牌堆顶的X${r.xBonus?"+1":""}张牌。`);
if(r.transformAttacks)parts.push(`所有攻击手牌变为巨石${r.boulderUpgrade?"+":""},仅本场战斗。`);
if(r.doubleTap)parts.push(`本回合接下来的${r.doubleTap}张攻击牌额外打出一次。`);
if(r.stoke)parts.push(`消耗所有手牌,每张随机生成一张${r.generatedUpgrade?"已强化":""}刘备或无色牌至手牌。`);
if(r.retrieveAttack)parts.push("自身回合开始,从弃牌堆随机获得一张攻击牌并强化。");
if(r.bodyguard)parts.push("你承受敌人双倍伤害,敌人对其他友方的伤害减半。");
if(r.stoke)parts.push(`消耗你的全部手牌。每消耗1张,随机获得1张刘备牌或无色牌${r.generatedUpgrade?",能强化的先强化再加入手牌":",加入手牌"}。`);
if(r.retrieveAttack)parts.push("你的回合开始时,从你的弃牌堆随机取回1张攻击牌到手牌,并在本场战斗中强化它。");
if(r.bodyguard)parts.push("敌人对你造成的攻击伤害翻倍,对其他友方角色造成的攻击伤害减半。");
if(r.autoStrike)parts.push("抽到【杀】或名称含“打击”的攻击牌时,免费向随机敌人打出。");
if(r.firstBlock)parts.push("每个自身回合首张获得格挡的卡牌,其获得的格挡翻倍;叠加时增加可翻倍的牌数。");
if(r.blockDamage)parts.push(`每次获得格挡,对随机敌人造成${r.blockDamage}点非攻击伤害。`);
@@ -474,7 +481,7 @@ export function createAdvancedIronclad({game,get,lib,status,getBattle,battleEner
if(r.copies)parts.push(`选择一张攻击或能力手牌,复制${r.copies}张至手牌。`);
if(r.corruption)parts.push("技能牌费用变为0,打出后被消耗。");
if(r.exhaustDiscount)parts.push("本场任意角色每消耗一张牌,费用减少1。");
if(r.partyCopies)parts.push("在所有存活角色的个人弃牌堆加入此牌副本。");
if(r.partyCopies)parts.push("在所有存活角色的弃牌堆中各放入1张此牌的副本,包括敌方角色。");
if(r.grapple)parts.push(`本回合每次获得格挡,对此目标造成${r.grapple}点非攻击伤害。`);
if(r.exhaust)parts.push("消耗。");
if(r.power)parts.push("能力持续本场战斗,打出后退出牌堆。");
+21 -31
View File
@@ -41,17 +41,13 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
: { damage: 8, vulnerable: 2 };
return "梦三:主动使用消耗2费用。对攻击范围内的" +
`一名其他角色造成${effect.damage}点伤害,然后给予其` +
`${effect.vulnerable}层易伤。受到攻击伤害增加50%` +
`${effect.vulnerable}层易伤。易伤使受到的攻击伤害增加50%` +
"(向上取整),每个自身回合结束减少1层。" +
"每回合使用次数不限。";
},
};
translate.mengsan_zhongsha = "重杀";
translate.mengsan_zhongsha_info =
"梦三:主动使用消耗2费用。出牌阶段,对攻击范围内的" +
"一名其他角色造成8点伤害,然后给予其2层易伤。" +
"易伤使受到的攻击伤害增加50%(向上取整)," +
"每个自身回合结束减少1层。每回合使用次数不限。";
translate.mengsan_zhongsha_info = card.mengsan_zhongsha.cardPrompt({ name: "mengsan_zhongsha" });
// STS2 Setup Strike: the new temporary strength does not enhance its own hit.
// STS2 Cinder: damage first, then exhaust one random remaining hand card.
card.mengsan_yujin = {
@@ -274,12 +270,12 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
const block = upgraded ? rule.block : rule.baseBlock;
const damage = upgraded ? rule.damage : rule.baseDamage;
return '梦三:主动使用消耗1费用。获得' + block +
'点格挡(护甲),然后对一名敌方角色造成' + damage +
'点格挡,然后对一名敌方角色造成' + damage +
'点伤害。每回合使用次数不限。';
},
};
translate.mengsan_tiezhanbo = "铁斩波";
translate.mengsan_tiezhanbo_info = "梦三:主动使用消耗1费用。获得5点格挡(护甲)," +
translate.mengsan_tiezhanbo_info = "梦三:主动使用消耗1费用。获得5点格挡," +
"然后对一名敌方角色造成5点伤害。每回合使用次数不限。";
// STS2 Twin Strike: each hit resolves on the same target separately.
card.mengsan_shuangchongdaji = {
@@ -399,8 +395,7 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
},
};
translate.mengsan_feijianhuixuanbiao = "飞剑回旋镖";
translate.mengsan_feijianhuixuanbiao_info = "梦三:主动使用消耗1费用。随机对敌人造成3点伤害3次。" +
"每次攻击重新随机选择存活的敌人,可以重复命中同一敌人。每回合使用次数不限。";
translate.mengsan_feijianhuixuanbiao_info = card.mengsan_feijianhuixuanbiao.cardPrompt({ name: "mengsan_feijianhuixuanbiao" });
// Resolve damage before drawing from the acting player's mode-owned pile.
card.mengsan_jianbingdaji = {
type: "basic", fullimage: true,
@@ -472,13 +467,13 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
},
cardPrompt(used) {
const cost = cardCost(used || { name: "mengsan_quanshenzhuangji" });
return `梦三:主动使用消耗${cost}费用。对一名敌方角色造成等同于你当前格挡(护甲)值的伤害。` +
return `梦三:主动使用消耗${cost}费用。对一名敌方角色造成等同于你当前格挡值的伤害。` +
"不消耗格挡,可以受到力量加成。" +
"每回合使用次数不限。";
},
};
translate.mengsan_quanshenzhuangji = "全身撞击";
translate.mengsan_quanshenzhuangji_info = "梦三:主动使用消耗1费用。对一名敌方角色造成等同于你当前格挡(护甲)值的伤害。" +
translate.mengsan_quanshenzhuangji_info = "梦三:主动使用消耗1费用。对一名敌方角色造成等同于你当前格挡值的伤害。" +
"不消耗格挡,可以受到力量加成。每回合使用次数不限。";
// Double only the surviving target's existing vulnerable after damage resolves.
card.mengsan_rongrongzhiquan = {
@@ -518,8 +513,7 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
},
};
translate.mengsan_rongrongzhiquan = "熔融之拳";
translate.mengsan_rongrongzhiquan_info = "梦三:主动使用消耗1费用。对一名敌方角色造成10点伤害,然后将该目标已有的易伤层数翻倍。" +
"消耗:使用后退出本场战斗。";
translate.mengsan_rongrongzhiquan_info = card.mengsan_rongrongzhiquan.cardPrompt({ name: "mengsan_rongrongzhiquan" });
// STS2【愤怒】:攻击后生成独立的战斗复制品,不扩充永久牌组。
card.mengsan_fennu = {
type: "basic", fullimage: true,
@@ -554,9 +548,7 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
},
};
translate.mengsan_fennu = "愤怒";
translate.mengsan_fennu_info = "梦三:主动使用消耗0费用。对一名敌方角色造成6点伤害," +
"然后将一张此牌的复制品加入你的个人弃牌堆。复制品保留原牌状态和词缀,仅存在于本场战斗。" +
"每回合使用次数不限。";
translate.mengsan_fennu_info = card.mengsan_fennu.cardPrompt({ name: "mengsan_fennu" });
// STS2【放血】:先等待原生生命流失及濒死救援,再增加当前战斗费用。
card.mengsan_fangxue = {
type: "basic", fullimage: true,
@@ -615,13 +607,13 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
const rule = cardUpgradeRule("mengsan_jianyi");
const current = cardUpgradeLevel(used);
const block = current ? rule.block : rule.baseBlock;
return "梦三:主动使用消耗1费用。获得" + block + "点格挡(护甲),然后" +
return "梦三:主动使用消耗1费用。获得" + block + "点格挡,然后" +
(current && rule.chooseExhaust ? "选择消耗" : "随机消耗") +
"一张你的手牌(退出本场战斗,不进入弃牌堆或洗牌)。没有手牌时不消耗牌。";
},
};
translate.mengsan_jianyi = "坚毅";
translate.mengsan_jianyi_info = "梦三:主动使用消耗1费用。获得7点格挡(护甲),然后随机消耗一张你的手牌(退出本场战斗,不进入弃牌堆或洗牌)。没有手牌时不消耗牌。";
translate.mengsan_jianyi_info = "梦三:主动使用消耗1费用。获得7点格挡,然后随机消耗一张你的手牌(退出本场战斗,不进入弃牌堆或洗牌)。没有手牌时不消耗牌。";
// STS2【破灭】:免费使用自己的堆顶原牌,再将这一原牌消耗。
card.mengsan_pomie = {
type: "basic", fullimage: true,
@@ -665,11 +657,11 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
cardPrompt(used) {
const rule = cardUpgradeRule("mengsan_songjianwushi");
const block = cardUpgradeLevel(used) ? rule.block : rule.baseBlock;
return "梦三:主动使用消耗1费用。获得" + block + "点格挡(护甲),然后抽" + rule.draw + "张牌。";
return "梦三:主动使用消耗1费用。获得" + block + "点格挡,然后抽" + rule.draw + "张牌。";
},
};
translate.mengsan_songjianwushi = "耸肩无视";
translate.mengsan_songjianwushi_info = "梦三:主动使用消耗1费用。获得8点格挡(护甲),然后抽1张牌。";
translate.mengsan_songjianwushi_info = "梦三:主动使用消耗1费用。获得8点格挡,然后抽1张牌。";
// STS2【暴走】:先攻击,再仅增加本场这张实体牌的伤害。
card.mengsan_baozou = {
type: "basic", fullimage: true,
@@ -751,8 +743,8 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
cardPrompt(used) {
const rule = cardUpgradeRule("mengsan_xuanfengzhan");
const amount = cardUpgradeLevel(used) ? rule.damage : rule.baseDamage;
return "梦三:X费用。消耗当前剩余费用,对所有敌方角色各造成" + amount +
"点伤害X次,每次分别结算。X为本次用于攻击的费用;缠结时先扣除1点附加费用。X为0时不造成伤害。";
return `消耗当前剩余费用,对所有敌方角色各造成${amount}点伤害,结算X次。` +
"X按本次用于攻击的费用计算。缠结时先扣除1点附加费用。";
},
};
translate.mengsan_xuanfengzhan = "旋风斩";
@@ -816,11 +808,11 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
cardPrompt(used) {
const rule = cardUpgradeRule("mengsan_xueqiang");
const block = cardUpgradeLevel(used) ? rule.block : rule.baseBlock;
return "梦三:主动使用消耗2费用。失去2点生命,然后获得" + block + "点格挡(护甲)。";
return "梦三:主动使用消耗2费用。失去2点生命,然后获得" + block + "点格挡。";
},
};
translate.mengsan_xueqiang = "血墙";
translate.mengsan_xueqiang_info = "梦三:主动使用消耗2费用。失去2点生命,然后获得16点格挡(护甲)。";
translate.mengsan_xueqiang_info = "梦三:主动使用消耗2费用。失去2点生命,然后获得16点格挡。";
// STS2【战栗】:施加易伤走既有人工制品入口,消耗走原生用牌及个人牌堆。
card.mengsan_zhanli = {
type: "basic", fullimage: true,
@@ -876,11 +868,11 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
ai: { order: 8, result: { player: 1 } },
cardPrompt(used) {
const selection = cardUpgradeLevel(used) ? "所有牌" : "一张牌";
return "梦三:主动使用消耗1费用。获得5点格挡(护甲),然后强化你手牌中的" + selection + "(仅本场战斗)。";
return "梦三:主动使用消耗1费用。获得5点格挡,然后强化你手牌中的" + selection + "(仅本场战斗)。";
},
};
translate.mengsan_wuzhuang = "武装";
translate.mengsan_wuzhuang_info = "梦三:主动使用消耗1费用。获得5点格挡(护甲),然后强化你手牌中的一张牌(仅本场战斗)。";
translate.mengsan_wuzhuang_info = "梦三:主动使用消耗1费用。获得5点格挡,然后强化你手牌中的一张牌(仅本场战斗)。";
// 【防御】沿用梦三护甲事件,保留脆弱与伤害抵扣等既有规则。
card.mengsan_fangyu = {
type: "basic",
@@ -899,12 +891,10 @@ export function createLegacyLiuBeiCards({ copyToDiscard, reclaimFromDiscard, tem
await player.changeHujia(cardUpgradeLevel(event.card) ? 8 : 5);
},
ai: { order: 7, result: { target: 1 } },
cardPrompt(used) { return `梦三:主动使用消耗1费用。获得${cardUpgradeLevel(used) ? 8 : 5}点格挡(护甲)。`; },
cardPrompt(used) { return `梦三:主动使用消耗1费用。获得${cardUpgradeLevel(used) ? 8 : 5}点格挡。`; },
};
translate.mengsan_fangyu = "防御";
translate.mengsan_fangyu_info =
"梦三:主动使用消耗1费用。出牌阶段,对自己使用,获得5点格挡(护甲)。" +
"每回合使用次数不限。";
translate.mengsan_fangyu_info = card.mengsan_fangyu.cardPrompt({ name: "mengsan_fangyu" });
// 【桃】的回复量也由梦三牌本体提供;救援仍不消耗费用。
return { cards:card, translate, names:Object.keys(card) };
}
+13 -13
View File
@@ -101,39 +101,39 @@ export function createIroncladRuntime({ game, get, lib, status, getBattle, handE
if (r.block) out.push(`获得${r.block}点格挡。`);
if (r.exhaustTurnBlock) out.push(`本回合消耗过卡牌时,再获得${r.block}点格挡。`);
if (r.doubleBlock) out.push("将当前格挡翻倍。");
if (r.allyBlock) out.push("给予另一名友方角色等于自己当前格挡值的格挡。");
if (r.allyBlock) out.push("令另一名友方角色获得格挡,数值等于你失去生命后的格挡值。");
if (r.chooseExhaust) out.push("消耗一张手牌。");
if (r.exhaustNonAttacks) out.push(`消耗所有非攻击手牌,每张获得${r.blockPerExhaust}点格挡。`);
if (r.hitsPerExhaust) out.push(`消耗所有手牌,每张对一名敌人造成${r.damage}点伤害。`);
if (r.hitsPerExhaust) out.push(`消耗所有手牌。每消耗1张,对同一名敌人造成${r.damage}点伤害。`);
else if (r.damage) {
let text = `${r.all ? "对所有敌人" : "对一名敌人"}造成${r.damage}点伤害`;
if (r.hits) text += `${r.hits}次`;
out.push(text + "。");
}
if (r.minExhaust) out.unshift(`仅当个人消耗牌堆至少${r.minExhaust}张时造成伤害。`);
if (r.vulnerableHits) out.push(`目标已有易伤时,攻击${r.vulnerableHits}次。`);
if (r.hitsPerHpLoss) out.push("本场战斗每次实际失去生命,额外攻击一次。");
if (r.vulnerableHits) out.push(`若目标已有易伤,改为造成${r.vulnerableHits}次上述伤害。`);
if (r.hitsPerHpLoss) out.push("本场战斗中,你每有一次实际失去生命的记录,便多攻击1次。");
if (r.perExhaust) out.push(`每张个人消耗牌额外增加${r.perExhaust}点基础伤害。`);
if (r.drawUntilSkill) out.push("抽牌直到抽到一张非攻击牌。");
if (r.vulnerable) out.push(`给予目标${r.vulnerable}层易伤。`);
if (r.weak) out.push(`给予目标${r.weak}层虚弱。`);
if (r.strengthFromVulnerable) out.push("目标每有一层易伤,获得1点力量。");
if (r.strength) out.push(`获得${r.strength}点力量。`);
if (r.vulnerable) out.push(`给予目标${r.vulnerable}层易伤。`);
if (r.strengthFromVulnerable) out.push("结算易伤后,目标每有1层易伤,你获得1点力量。");
if (r.enemyStrength) out.push(`目标获得${r.enemyStrength}点力量。`);
if (r.strength) out.push(`你获得${r.strength}点力量。`);
if (r.allyStrength) out.push(`给予另一名友方角色${r.allyStrength}点力量。`);
if (r.energy) out.push(`获得${r.energy}费用。`);
if (r.exhaustTurnEnergy) out.push(`本回合消耗过卡牌时,获得${r.exhaustTurnEnergy}费用。`);
if (r.energy) out.push(`补充${r.energy}点费用。`);
if (r.exhaustTurnEnergy) out.push(`若你本回合消耗过牌,补充${r.exhaustTurnEnergy}点费用。`);
if (r.draw) out.push(`抽${r.draw}张牌。`);
if (r.heal) out.push(`回复${r.heal}点生命。`);
if (r.turnStrength) out.push(`每个自身回合开始时获得${r.turnStrength}点力量。`);
if (r.turnEnergy) out.push(`每个自身回合开始时获得${r.turnEnergy}费用。`);
if (r.turnEnergy) out.push(`你的回合开始时,额外补充${r.turnEnergy}点费用。`);
if (r.turnBlock) out.push(`每个自身回合开始时失去${r.turnLoseHp}点生命,再获得${r.turnBlock}点格挡。`);
if (r.attackBlock) out.push(`本次自身回合内,每打出一张攻击牌获得${r.attackBlock}点格挡。`);
if (r.lossStrength) out.push(`在自身回合内每次实际失去生命,获得${r.lossStrength}点力量。`);
if (r.lossDamage) out.push(`自身回合开始时失去${r.infernoLoseHp}点生命;自身回合每次实际失血,对全部敌人造成${r.lossDamage}点非攻击伤害。`);
if (r.retaliation) out.push(`至下个自身回合开始,每受到一次攻击,对攻击者造成${r.retaliation}点伤害。`);
if (r.vulnerableReduction) out.push("至下个自身回合开始,易伤敌人对你的攻击伤害降低50%。");
if (r.vulnerableBonus) out.push(`你攻击易伤敌人的易伤伤害倍率额外增加${r.vulnerableBonus * 100}%。`);
if (r.retaliation) out.push(`直到你的下个回合开始,每次受到攻击伤害,便对攻击者造成${r.retaliation}点非攻击伤害。`);
if (r.vulnerableReduction) out.push("直到你的下个回合开始,带有易伤的角色对你造成的攻击伤害减半,向下取整。");
if (r.vulnerableBonus) out.push(`你攻击易伤敌人时,该次伤害的易伤倍率增加${r.vulnerableBonus * 100}个百分点。`);
if (r.exhaust) out.push("消耗。");
if (r.power) out.push("能力持续本场战斗,打出后退出牌堆。");
return `梦三:主动使用消耗${cardCost(card || { name: spec.name })}费用。` + out.join("");
+66 -46
View File
@@ -7,7 +7,7 @@ import { cardUpgradeLevel, cardUpgradeRule, canUpgradeCard } from "../../upgrade
import { generationPool } from "../../card-pools.js";
import { cardPackCosts } from "../data.js";
import { ironcladStrengthPenalty } from "../../ironclad-hooks.js";
import { installSharedHookResolver } from "../../shared-hooks.js";
import { applyInterceptDamage, applyIntangibleDamage, installSharedHookResolver } from "../../shared-hooks.js";
import { isAttackCard } from "../../../monsters/vine-tangled.js";
import { applyMengsanDebuff, consumeArtifact } from "../../../monsters/artifact-status.js";
import { isStunned } from "../../../battle/stun-intent.js";
@@ -15,7 +15,8 @@ import { canPayCard, isActiveCardUse, authorizeFreeCardUse, takeXCardUse, cardCo
import { grantGold } from "../../../relics/progression.js";
import { bindCombatStatusSource } from "../../../battle/status-sources.js";
const BRIDGE="mengsan_shared_bridge_shuying", RULES="mengsan_shared_rules_shuying", END="mengsan_shared_end_shuying", LIMIT="mengsan_shared_limit_shuying", AFTER="mengsan_shared_after_shuying";
const BRIDGE="mengsan_shared_bridge_shuying", RULES="mengsan_shared_rules_shuying", END="mengsan_shared_end_shuying", LIMIT="mengsan_shared_limit_shuying";
const TRACK = "mengsan_shared_track_use_shuying";
const safe=n=>Number.isSafeInteger(n) && n>=0;
function belongs(event,root) {
const seen=new Set();
@@ -33,6 +34,7 @@ const rule=card=>{const c=sharedByName[card?.name];return c ? cardUpgradeLevel(c
export function createSharedCardRuntime({game,get,lib,status,getBattle,battleEnergy,temporaryStrength,random}) {
const states=new WeakMap(), uses=new WeakMap(), replays=new WeakMap(), costCaps=new WeakMap(), ballBonuses=new WeakMap();
const seenUses=new WeakSet(), seenDraws=new WeakSet(), seenEnds=new WeakSet(), kills=new WeakMap();
const bridgeSignals = new WeakMap();
const tokenOf=player=>{
const b=getBattle();
return b?.session?.active && b.root && b.players?.has(player) && player?.isAlive?.()
@@ -186,10 +188,11 @@ export function createSharedCardRuntime({game,get,lib,status,getBattle,battleEne
}
return n;
}
installSharedHookResolver(player=>{
const s=ensure(player);if(!s)return null;
installSharedHookResolver((player, create = true)=>{
const s=create ? ensure(player) : stateOf(player);if(!s)return null;
return {isFree:card=>s.freeTurn.has(physical(card))||s.freeBattle.has(physical(card)),cost:(card,n)=>cost(s,card,n),
strengthPenalty:()=>s.negativeStrength,blockAmount:(n,e)=>cardBlock(s,n,e),afterDraw:cards=>afterDraw(s,cards),
interceptTarget:()=>s.turn.intercept,isIntangible:()=>Boolean(s.powers.intangible),
snapshotCard:card=>sharedByName[card.name]?.id==="the_ball"?{ballBonus:ballBonus(s,card),ballSession:s.token.session.id}:{},
copyCard(source,target){
if(sharedByName[source.name]?.id==="the_ball"&&target.name===source.name)ballBonuses.set(target,{session:s.token.session,amount:ballBonus(s,source)});
@@ -341,16 +344,31 @@ export function createSharedCardRuntime({game,get,lib,status,getBattle,battleEne
refresh(s);
}
function trackUse(use, battle) {
const pending = battle.sharedPendingUses ||= new Set();
if (pending.has(use)) return;
pending.add(use);
// 确认原牌及追加结算离开原生 after 队列后,再检查胜负。
async function finishUse() {
try {
if (!use.after.length) await onUseAfter(use);
} finally {
if (use.after.length) {
use.insertAfter(finishUse, { forceDie: true });
} else {
pending.delete(use);
if (getBattle() === battle && battle.session.active && !pending.size) game.checkResult();
}
}
}
use.insertAfter(finishUse, { forceDie: true });
}
async function onUse(use) {
const s=ensure(use.player);if(!s || seenUses.has(use))return;seenUses.add(use);
const b=s.token.battle,entry={s,snapshot:snapshot(use),vigor:0,echoes:[]};uses.set(use,entry);
b.sharedPendingUses||=new Set();b.sharedPendingUses.add(use);
// Death can omit useCardAfter/Cancelled while the native use event still
// drains its after queue. Release only this use's entry after that unwind;
// onUseAfter is idempotent and ignores effects owned by a dead player.
use.insertAfter(async () => {
await onUseAfter(use);
}, { forceDie: true });
trackUse(use, b);
if(game.me.isFriendOf(s.player))b.sharedCardUses=(b.sharedCardUses||0)+1;
if(isAttackCard(use.card)){
b.sharedAttackRecords||=[];entry.attackRecord={turn:status.currentPhase,source:s.player,targets:(use.targets||[]).filter(t=>valid(t,s.token)&&s.player.isEnemyOf(t))};b.sharedAttackRecords.push(entry.attackRecord);
@@ -381,30 +399,21 @@ export function createSharedCardRuntime({game,get,lib,status,getBattle,battleEne
}
async function onUseAfter(use) {
const entry=uses.get(use);if(!entry)return;
uses.delete(use);const {s}=entry,b=s.token.battle;
try {
if(valid(s.player,s.token) && !use._cancelled){
for(const targets of entry.echoes){if(!valid(s.player,s.token))break;await autoPlay(s,entry.snapshot.original,{echo:entry.snapshot,targets});}
if(entry.returnTop && valid(s.player,s.token))pileOf(s)?.moveDiscardToTop(entry.snapshot.original);
if(entry.ballHandoff && valid(s.player,s.token)){
const card=entry.snapshot.original,source=pileOf(s),recipients=friends(s).filter(p=>p!==s.player).map(ensure)
.filter(other=>pileOf(other)?.canReceiveTransfer(card,s.token.session));
const recipient=rand(s,recipients);
if(recipient){
const turnFree=s.freeTurn.has(card),battleFree=s.freeBattle.has(card);
if(await source?.transferTo(card,pileOf(recipient))){
if(turnFree)recipient.freeTurn.add(card);if(battleFree)recipient.freeBattle.add(card);
refresh(recipient);
}
}
uses.delete(use);const {s}=entry;
if (!valid(s.player,s.token) || use._cancelled) return;
for(const targets of entry.echoes){if(!valid(s.player,s.token))break;await autoPlay(s,entry.snapshot.original,{echo:entry.snapshot,targets});}
if(entry.returnTop && valid(s.player,s.token))pileOf(s)?.moveDiscardToTop(entry.snapshot.original);
if(entry.ballHandoff && valid(s.player,s.token)){
const card=entry.snapshot.original,source=pileOf(s),recipients=friends(s).filter(p=>p!==s.player).map(ensure)
.filter(other=>pileOf(other)?.canReceiveTransfer(card,s.token.session));
const recipient=rand(s,recipients);
if(recipient){
const turnFree=s.freeTurn.has(card),battleFree=s.freeBattle.has(card);
if(await source?.transferTo(card,pileOf(recipient))){
if(turnFree)recipient.freeTurn.add(card);if(battleFree)recipient.freeBattle.add(card);
refresh(recipient);
}
}
} finally {
b.sharedPendingUses?.delete(use);
if(getBattle()===b && b.session.active && !b.sharedPendingUses?.size){
if(b.sharedDeferredVictory && game.me?.isAlive()){b.sharedDeferredVictory=false;game.mengsanFinishBattle_shuying();}
else game.checkResult();
}
}
}
async function turnStart(player) {
@@ -506,7 +515,10 @@ export function createSharedCardRuntime({game,get,lib,status,getBattle,battleEne
cardPrompt(card){const r=rule(card||{name:spec.name});let description=r?.description||spec.description;
if(spec.id==="the_ball"){const s=stateOf(game.me);if(s)description=description.replace("造成10点伤害",`造成${10+ballBonus(s,card)}点伤害`);}
if(spec.id==="wither")description=description.replace("受到3点伤害",`受到${witherDamage(card)}点伤害`);
return `梦三:${spec.cost==null?"不能被打出":`${spec.cost==="X"?"X":cardCost(card||{name:spec.name})}费`}。${description}`;},
if (spec.cost == null) return description;
const cost = spec.cost === "X" ? "X" : cardCost(card || { name: spec.name });
return `梦三:${cost}费。${description}`;
},
ai:{order:spec.cardType==="power"?7:6,value:spec.cardType==="curse"?0:5,useful:spec.cardType==="curse"?0:5,
result:{target:enemy?-1:1},tag:spec.cardType==="attack"?{damage:1}:{}},
};
@@ -529,14 +541,28 @@ export function createSharedCardRuntime({game,get,lib,status,getBattle,battleEne
filter(event){const b=getBattle();return Boolean(b?.session.active && belongs(event,b.root) && limited(event.player,event.card,event));},
async content(event,trigger){trigger.cancel();},
},
[AFTER]:{trigger:{global:["useCardAfter","useCardCancelled"]},forced:true,silent:true,popup:false,priority:-500,
filter(event){return uses.has(event);},async content(event,trigger){await onUseAfter(trigger);},
[TRACK]: {
trigger: { player: "useCard1" },
forced: true, silent: true, popup: false, firstDo: true,
filter(event) {
const token = tokenOf(event.player);
return Boolean(token && belongs(event, token.root));
},
async content(event, trigger) { trackUse(trigger, getBattle()); },
},
[BRIDGE]:{group:[END,LIMIT,AFTER],trigger:{global:["useCard1","phaseBefore","phaseDrawAfter","phaseDiscardBegin","phaseJieshuBegin","phaseAfter","drawAfter","damageBegin1","damageBegin2","damageBegin4","loseHpBegin","damage","changeHujiaAfter"]},
[BRIDGE]:{group:[TRACK,END,LIMIT],trigger:{global:["useCard1","phaseBefore","phaseDrawAfter","phaseDiscardBegin","phaseJieshuBegin","phaseAfter","drawAfter","damageBegin1","damageBegin2","damageBegin4","loseHpBegin","damage","changeHujiaAfter"]},
forced:true,silent:true,popup:false,priority:300,
filter(event){const b=getBattle();return Boolean(b?.session.active&&belongs(event,b.root));},
filter(event, player, name) {
const battle = getBattle();
return Boolean(battle?.session.active && !bridgeSignals.get(event)?.has(name) && belongs(event, battle.root));
},
async content(event,trigger){
const name=event.triggername,b=getBattle();if(!b?.session.active)return;
// 同一事件的不同阶段分别结算一次,跨座位的副本跳过。
const signals = bridgeSignals.get(trigger) || new Set();
if (signals.has(name)) return;
signals.add(name);
bridgeSignals.set(trigger, signals);
if(name==="useCard0"){if(limited(trigger.player,trigger.card,trigger))trigger.cancel();return;}
if(name==="useCard1"){await onUse(trigger);return;}
if(name==="phaseBefore"){await turnStart(trigger.player);return;}
@@ -556,16 +582,10 @@ export function createSharedCardRuntime({game,get,lib,status,getBattle,battleEne
return;
}
if(name==="damageBegin4"||name==="loseHpBegin"){
const s=stateOf(trigger.player);if(s?.powers.intangible&&trigger.num>1)trigger.num=1;return;
trigger.num=applyIntangibleDamage(trigger.num,trigger.player);return;
}
if(name==="damageBegin2" && (trigger.mengsanAttack_shuying||isAttackCard(trigger.card))){
// Wiki's interception is attack damage suppression + doubled holder damage, not native retargeting.
let multiplier=1;
for(const p of b.players){const s=stateOf(p);if(!s?.turn.intercept || !valid(p,s.token) || !p.isEnemyOf(trigger.source))continue;
if(trigger.player===s.turn.intercept)multiplier=0;
if(trigger.player===p)multiplier*=2;
}
trigger.num=Math.floor(trigger.num*multiplier);return;
trigger.num=applyInterceptDamage(trigger.num,trigger.source,trigger.player,b.players);return;
}
if(name==="damage"){
const s=stateOf(trigger.player);
+3 -3
View File
@@ -67,7 +67,7 @@ export const statusCards = Object.freeze([
"cardType": "status",
"rarity": "status",
"cost": null,
"description": "不能被打出。在你的回合结束时,如果这张牌在你的手牌中,你受到3点伤害。",
"description": "不能被打出。你的弃牌阶段开始时,若此牌仍在手牌中,你受到3点伤害。",
"base": {
"unplayable": true,
"endDamage": 3
@@ -82,7 +82,7 @@ export const statusCards = Object.freeze([
"cardType": "status",
"rarity": "status",
"cost": null,
"description": "不能被打出。在你的回合结束时,如果这张牌在你的手牌中,你受到3点伤害。",
"description": "不能被打出。你的弃牌阶段开始时,若此牌仍在手牌中,你受到3点非攻击伤害。",
"base": {
"unplayable": true,
"endDamage": 3
@@ -125,7 +125,7 @@ export const statusCards = Object.freeze([
"cardType": "status",
"rarity": "status",
"cost": null,
"description": "不能被打出。虚无。每当你抽到这张牌时,失去1点能量。",
"description": "不能被打出。虚无。抽到此牌时,扣除1点费用。",
"base": {
"ethereal": true,
"unplayable": true
+2 -1
View File
@@ -96,6 +96,7 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
nature: card.nature || null, affixes: data.affixes?.slice() || [], upgrade: data.upgrade || 0 };
}
for (const data of battle.drawPile) {
if (data.name === "muniu") continue;
const card = game.createCard(data.name, data.suit, data.number, data.nature);
adopt(card, data); draw.appendChild(card);
}
@@ -344,7 +345,7 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
return [...cards];
},
addToDiscard(data) {
if (released || !session.active) return null;
if (released || !session.active || data?.name === "muniu") return null;
if (!data || typeof data.id !== "string" || !data.id ||
typeof data.name !== "string" || !/^[a-z][a-z0-9_]*$/.test(data.name) ||
!["spade", "heart", "club", "diamond"].includes(data.suit) ||
+14
View File
@@ -1,3 +1,5 @@
import { LIUBEI_CARD_OWNER } from "./packs/liubei/names.js";
// 仅迁移读取/写入时的存档副本,不重新注册已移除的独立牌。
const cardNames = Object.freeze({mengsan_ic_strike: "sha", mengsan_ic_bash: "mengsan_zhongsha"});
const rewardIds = Object.freeze({
@@ -10,6 +12,10 @@ export function resolveRetiredCardReward(id) {
return Object.hasOwn(rewardIds, id) ? rewardIds[id] : id;
}
export function isRetiredDeckCard(character, name) {
return name === "muniu" || (name === "bagua" && character === LIUBEI_CARD_OWNER);
}
export function migrateRetiredCards(run) {
if (!run || typeof run !== "object") return run;
// 同时覆盖永久牌组、待结算快照、已选结果与重试快照,保留牌实例ID及其余状态。
@@ -18,6 +24,14 @@ export function migrateRetiredCards(run) {
const value = pending.pop();
if (seen.has(value)) continue;
seen.add(value);
const player = value.player;
if (Array.isArray(player?.deck)) {
player.deck = player.deck.filter(card => !isRetiredDeckCard(player.character, card?.name));
}
if (Array.isArray(player?.relicState?.storedCards)) {
player.relicState.storedCards = player.relicState.storedCards.filter(card =>
!isRetiredDeckCard(player.character, card?.name));
}
if (Object.hasOwn(cardNames, value.name)) value.name = cardNames[value.name];
const cardName = Object.hasOwn(cardNames, value.card?.name) ? cardNames[value.card.name] : value.card?.name;
if (cardName === "sha" && value.name === "获得一张【打击】") value.name = "获得一张【杀】";
+17 -1
View File
@@ -7,7 +7,23 @@ export function installSharedHookResolver(next) {
export const sharedHooks = player => player ? resolver(player) : null;
export const sharedCardIsFree = (player,card) => sharedHooks(player)?.isFree(card) || false;
export const sharedCardCost = (player,card,cost) => sharedHooks(player)?.cost(card,cost) ?? cost;
export const sharedStrengthPenalty = player => sharedHooks(player)?.strengthPenalty() || 0;
export const sharedStrengthPenalty = player => player ? resolver(player, false)?.strengthPenalty() || 0 : 0;
export const beforeSharedBlock = (player,num,event) => sharedHooks(player)?.blockAmount(num,event) ?? num;
export const afterSharedDraw = async (player,cards) => sharedHooks(player)?.afterDraw(cards);
export function applyInterceptDamage(damage, source, target, players) {
if (!source || !target || !players) return damage;
let multiplier = 1;
for (const holder of players) {
const protectedAlly = resolver(holder, false)?.interceptTarget();
if (!protectedAlly || !holder.isEnemyOf(source)) continue;
if (target === protectedAlly) return 0;
if (target === holder) multiplier *= 2;
}
return multiplier === 1 ? damage : Math.floor(damage * multiplier);
}
export function applyIntangibleDamage(damage, target) {
return damage > 1 && target && resolver(target, false)?.isIntangible() ? 1 : damage;
}
+2 -3
View File
@@ -1,6 +1,6 @@
import { createCardData } from "./card-data.js";
// Mode-owned starting decks. Existing saves always retain their actual player.deck.
// Mode-owned starting decks. Saved decks are loaded separately.
export const defaultDeck = Object.freeze([
["spade", 7, "sha"], ["heart", 10, "sha"],
["club", 4, "sha"], ["diamond", 6, "sha"],
@@ -10,13 +10,12 @@ export const defaultDeck = Object.freeze([
].map(Object.freeze));
// Character ID -> [suit, number, card name, optional nature, optional affixes].
// Example: edit these twelve entries to change only this private Liu Bei's new-run deck.
export const characterDecks = {
mengsan_liubei_shuying: [
["spade", 7, "sha"], ["heart", 10, "sha"], ["club", 4, "sha"], ["diamond", 6, "sha"],
["heart", 2, "mengsan_fangyu"], ["diamond", 7, "mengsan_fangyu"], ["club", 2, "shan"],
["heart", 3, "tao"], ["heart", 7, "wuzhong"], ["spade", 1, "juedou"],
["spade", 2, "bagua"], ["club", 6, "sha"],
["club", 6, "sha"],
],
};
@@ -48,7 +48,7 @@ export default {
requiredCharacter: "mengsan_liubei_shuying",
enemies: ["mengsan_soldier_shuying"], gold: 400,
skipRandomReward: true, fixedRewards: ["act1.reward.dilu"], openingDialogue, victoryDialogue,
rewardPackage: { gold: 400, relicPool: "act1.pool.liubeiOpening.relics" },
rewardPackage: { gold: 400, relicPool: "act1.pool.liubeiOpening.relics", potionChoices: 3 },
battlePlan: {
units: [{
id: "soldier", character: "mengsan_soldier_shuying", camp: "enemy",
@@ -1,35 +1,35 @@
# 第一章结束与战斗奖励调整(2026-10-04)
本说明补充现有章节、助战和奖励文档,以当前源码为准。
规则按 2026-11-24 的梦三源码核对。
## 第一章结束
第一章 Boss 胜利后先完成奖励选择与结算,再播放旁白:
第一章 Boss 胜利后先完成奖励选择与结算,在同一事务中记录通关并清除当前征程存档。随后播放旁白:
> 战斗还未完结,等待后续更新。
随后结束本次征程并记录通关,不进入第二章的占位内容。第一章索引保留,供结束旁白读取;章节配置通过 `endsCurrentContent` 与 `completionDialogue` 控制这一行为。
旁白结束后结束本次对局。第二章和第三章仍为占位内容,正常征程在第一章结束。第一章索引保留供旁白读取,结束行为由 `endsCurrentContent` 和 `completionDialogue` 控制。
## 刘备和先天助战
显示名改为“刘备”,立绘使用 `image/character/liubei.jpg`,模式私有 ID 保持不变以兼容存档和专属卡归属。
显示名为「刘备」,立绘使用 `assets/portraits/liubei-portrait.jpg`,模式私有 ID 保持不变以兼容存档和专属卡归属。
先天桃园羁绊仍结识8级关羽和张飞,默认选中关羽。旧存档已结识关羽但未选择助战时补上默认选择;已选其他助战保留。默认选择只初始化一次,之后主动取消或改选不会被重置。专属开场仍不判定助战到场。
## 战斗奖励
| 战斗 | 必得奖励 | 可选卡牌 |
| --- | --- | --- |
| 普通 | 原配置金币 | 当前角色专属卡牌,三选一或跳过 |
| 精英 | 原配置金币+随机一件尚未持有的遗物 | 当前角色专属卡牌,三选一或跳过;每项候选普通20%、罕见60%、稀有20% |
| Boss | 原配置金币 | 三个不同的当前角色专属稀有牌候选,选一张或跳过 |
| 战斗 | 固定战利品 | 可选卡牌 | 常规药水掉落 |
| --- | --- | --- | --- |
| 普通 | 配置金币 | 当前角色专属卡牌,三选一或跳过 | 有概率掉落一瓶,可跳过 |
| 精英 | 配置金币,另抽一件可获得且未持有的遗物 | 当前角色专属卡牌,三选一或跳过。每项候选普通 20%、罕见 60%、稀有 20% | 有概率掉落一瓶,可跳过 |
| Boss | 配置金币 | 三张不同的当前角色专属稀有牌,选一张或跳过 | 无常规掉落 |
精英先按稀有度抽取,再在该等级内抽取不重复的卡牌,避免各等级牌数影响配置概率。若某等级候选耗尽,只在尚有候选的等级之间重新分配概率。Boss 专属稀有牌不足时拒绝降级,不混入遗物、属性或技能奖励。
精英遗物与卡牌候选一起写入结算检查点,跳过卡牌仍领取金币和遗物。遗物不重复获得;已持有全部遗物时,界面明确说明不再重复发放。
跳过卡牌后仍结算固定战利品。金币配置值可以受到遗物修正。精英可受黑星额外奖励一件遗物,第一章 Boss 可受熔岩石额外奖励两件遗物,实际发放受剩余合格候选限制。普通和精英的药水基础掉率初始为 40%,精英额外加 12.5 个百分点。每次判定命中后基础概率减 10 个百分点,未命中则加 10 个百分点。
普通随机卡牌奖励默认只允许当前角色专属牌。特定剧情的固定卡牌与开场强化包保持原规则;斥候谢礼与伏兵战利品作为特定剧情,显式配置 `allowSharedCardRewards: true` 保留原有通用牌。其他特定奖励也可使用此标记,通过抽奖入口的 `allowSharedCards` 选项传递,不改变永久牌组本身的可获得资格。Boss 不受此标记影响,始终限定角色专属稀有牌。
普通随机卡牌奖励按当前角色归属和获取资格筛选,现有池仍可抽到符合条件的刘备事件牌与古老牌。特定战斗可以通过 `allowSharedCardRewards: true` 放开通用卡牌候选,Boss 始终限定角色专属稀有牌。斥候谢礼与伏兵战利品仍有对应配置,当前第一章新征程没有「林中伏兵」入口。刘备专属首战使用单独的[首战奖励包](liubei-opening.md)。
旧存档已经生成的待领奖候选保持原样,不在恢复结算时重抽。后续新结算使用新规则。
同一次战斗的候选和已选结果保存在内存,保存失败后重试沿用同一结果。重载回到上一次地图存档,旧档中的战斗流程和待领奖状态不会恢复。详见[地图存档与阵亡规则](map-only-save-and-defeat-20261004.md)。
本次检查针对实际游戏源码;语法、配置核对不等于实机验收。
-14
View File
@@ -1,14 +0,0 @@
# 第一章早期精英限制修正(2026-10-04)
本说明修正 `act1-encounters.md` 中“精英可能在前三场普通战斗完成前出现”的旧规则。
- 角色专属开场不占弱怪池名额。开场后前三场普通战斗仍从弱怪池抽取,胜利结算后计数。
- 新地图开场后的前三层,随机抽到的精英改为普通战斗;事件、休息、商店仍可出现。
- 未完成三场普通战斗时,当前可前往的随机精英节点也改为普通战斗,并使用弱怪池、普通阶级和普通战斗奖励。这些胜场计入三场名额。
- 已有第一章地图在展示时修正前三层及当前可走的随机精英节点,保留完成记录和路线,无需重新开档。
- 完成第三场后,后续普通战斗使用强怪池,尚未转换的后续精英节点仍使用精英池。
- 固定内容、专属及剧情战斗、Boss、第二章和第三章保持原规则。失败或重试不增加胜场计数,已保存的重试遭遇保持原组合。
实现入口:`progression/encounter-progress.js` 的早期保护和计数常量,以及 `progression/state.js` 的地图生成、可选节点准备与遭遇抽取。
本次仅核对源码、语法及差异,未启动游戏;实机验收待用户执行。
+23 -5
View File
@@ -6,7 +6,7 @@
离开角色专属开场后,前3场普通战斗从弱怪池抽取,第4场起从强怪池抽取。
按普通战斗胜利完成结算计数,事件、休息、精英、Boss、专属及剧情战斗不计。
失败、重试和未完成战斗不增加计数;重试保留原遭遇组合,重复结算不重复计数。
阵亡、未完成战斗和重复提交不会增加计数。读档回到上一次地图检查点,正在进行的战斗和未确认的结算不会保存。详见[地图存档与阵亡规则](map-only-save-and-defeat-20261004.md)。
普通遭遇条目等概率抽取,条目内部的“或”方案也等概率抽取,允许不同场重复遭遇。
计数存于 `run.statistics.normalBattles`。旧第一章存档缺少此字段时,
@@ -47,20 +47,38 @@
Boss池:墨影幻灵、仪式兽、同族神官+2名同族信徒,各占一个条目。
同族信徒分别绑定本场神官,保留爪牙与胜利判断规则。
随机类型楼层的节点权重仍为普通50、精英15、事件15、休息10、商店10,
合计100。固定开场、宝箱、休息与最终Boss楼层不参与这一概率抽取。
精英可能在前三场普通战斗完成前出现,但不占弱池的三场名额。
从刘备专属开场算第 1 层,第 2 层固定为普通战斗,第 10 层为宝箱,第 16 层为休息,第 17 层为最终 Boss。这些层不参与节点类型抽取。其余楼层的节点权重为普通 50、精英 15、事件 15、休息 10、商店 10。
### 早期精英限制
- 新地图第 2 至 4 层不生成精英。第 2 层固定为普通战斗,第 3、4 层抽到精英时改为普通战斗,仍可抽到事件、休息和商店。
- 第一章普通战斗胜场不足3场时,当前可走的随机精英节点也会转为普通战斗,使用弱怪池、普通阶级和普通战斗奖励。转换后的战斗胜利结算后计入这3场。
- 第一章旧存档的普通战斗胜场不足3场时,展示地图也会修正前三层及当前可走的随机精英节点,保留已完成节点和已走路线。达到3场胜利后,后续普通战斗使用强怪池,未转换的后续精英节点使用精英池。
- 这项保护只作用于第一章随机精英节点。固定内容、专属及剧情战斗、Boss 沿用自己的配置。
地图普通战斗使用交叉兵器图标;精英使用紫色盾徽图标和“精英”文字;
Boss使用独立旗帜图标。随机出现不等于每张地图必定有精英。
## 随机事件与剧情入口
第一章的普通事件节点从辎重盘点、渡口禳符、营中抄手、裁囊人、县亭换策、旧营教头中选择。候选需至少有一项服务适用于当前牌组。即使选择「继续赶路」,完成节点后也会记录该事件,本章不再重复抽取。没有合格候选时,可收下钱袋,基础奖励为 15 金币。
「林中伏兵」已注册剧情配置,当前新征程的第一章地图没有入口,随机事件也不会插入该剧情。斥候援令仍可从第一章宝箱奖励池获得。章节结束及战利品规则见[第一章结束与奖励](act1-completion-and-rewards-20261004.md)。
## 休息与商店
- 休息点可选休息或磨砺。休息基础恢复 8 生命,磨砺随机强化一张可强化的牌。持有微型帐篷时,各休息选项可选一次,直到离开。
- 商店出售【杀】和回复生命服务,最多有三个遗物货位和三个药水货位。持有送货员时会补充购出的遗物和药水,商店折扣也适用于药水。入店时保存初始货品及已触发的进店效果,购买结果在离店时随节点一起保存。
## 配置入口
- `content/acts/act1/encounters.js`:4个弱遭遇、12个强遭遇、3个精英、3个Boss。
- `content/acts/act1/map.js`:地图类型权重及遭遇池ID。
- `content/registry.js`:跨章节遭遇注册与组合验证。
- `content/encounters.js`:从遭遇及其内部方案中抽取,并创建独立战斗计划。
- `progression/encounter-progress.js`:普通战斗计数与旧存档恢复。
- `progression/encounter-progress.js`:普通战斗计数、旧存档恢复与早期精英保护。
- `progression/state.js`:生成地图、准备可选节点及抽取遭遇时应用早期精英保护。
- `progression/random-event.js`:第一章普通事件及牌组服务候选。
- `battle/battle-settlement.js`:胜利结算事务中推进计数。
怪物生命、意图、牌堆、分裂、召唤与特殊行为沿用各自已实现的规则。
@@ -0,0 +1,503 @@
# 梦三全卡牌联合调整方案 V0.3
本文保留 2026-11-07 的候选方案和逐牌记录。第 2.1 节中的新档起手已按 2026-11-24 源码校正,候选参数沿用原提案。现行战后候选见[第一章奖励规则](act1-completion-and-rewards-20261004.md)。
- 日期:2026-11-07
- 状态:设计提案,未修改游戏规则,未完成实战验收。
- 本版范围:**219个已注册卡牌名+33个模式加载但未注册进永久牌组的原生卡牌名,共252项**。按卡牌名去重;强化、花色、火/雷属性、疯狂科学各分支的口径见下文。
- 前版:[V0.2:怪物、意图循环与Boss](liubei-gameplay-and-balance-proposal-v0.2-20261030.md)。本版补全卡池,不把V0.2建议冒充已实施机制。
- 当前证据:本地数据注册表、牌组运行时、原生标准/军争牌清单与关键敌人执行路径。图谱落后于当前文件,仅作定位,结论以当前源文件为准。
- 本文“保留”也是逐牌调整结论;“全部已有卡牌”不意味着所有卡都必须改数值。
## 1. 结论与覆盖口径
目前主要矛盾不是所有卡普遍太弱或太强,而是三类收益处于不同规则下:原生杀可以被闪,脚本攻击直接结算;少量零费抽牌能形成循环,有费攻防卡却争夺3点基础费用;支援牌依赖队友行动顺序,而怪物意图当前通常打全部敌对目标。应先统一这些规则,再试卡牌参数。
推荐保留刘备的四个方向:**力量多段、消耗转化、自残爆发、防御反击**。关张支援作为四个方向都能使用的协同层,不要求每套牌都塞支援牌。无色牌补构筑缺口,事件/古老牌提供有限例外,不能成为普通随机生成的稳定捷径。
| 范围 | 唯一卡牌名数 | 本文处理 |
| --- | ---: | --- |
| 刘备牌组 | 93 | 25张原有牌+68张数据驱动牌,含1张生成牌巨石 |
| 无色 | 60 | 全部逐牌,包含极端风险牌与多人牌 |
| 事件 | 26 | 疯狂科学的不同ID分开,不按中文同名合并 |
| 状态 | 12 | 包含4张沿用旧ID的状态及迁移占位牌 |
| 诅咒 | 18 | 全部逐牌,负面效果与投放代价一起调 |
| 注册表内传统通用牌 | 10 | 杀、重杀、闪、桃、酒、过河、无中、决斗、八卦、的卢 |
| 模式加载但注册表外的传统牌 | 33 | 原生装备/锦囊也列出,避免误认为不存在或已经开放奖励 |
| 合计 | **252** | 已注册219;运行时补充33;无重复 |
范围不包含其他扩展未由梦三加载的任意卡牌;已退休的 `mengsan_ic_strike`、`mengsan_ic_bash` 分别迁移为杀、重杀,不再另算两张。“火杀/雷杀”按同一 `sha` 的属性变体测试,不另计卡牌名。获得资格、普通奖励资格、随机生成资格、运行时可用是四个不同概念。
## 2. 当前基线与V0.2的关系
### 2.1 先确认真实起点
- 当前刘备基础费用 3、手牌上限 3。手牌上限是弃牌约束,摸牌时可以超过。新开局实际是 5 杀、2 防御、闪、桃、无中、决斗,共 11 张,见 `cards/starting-deck.js`。八卦只在通用默认牌组中,刘备使用自己的覆盖配置。
- 当前杀6/强化9,防御5/强化8,桃8;怪物普通/精英/Boss费用2/3/4。当前意图执行器仍遍历全部存活敌对目标。
- 当前墨影主要伤害7→12→26→整备,仪式兽一阶段18并加2力,同族神官8、8、3×3及加力;不能按V0.2已降伤、已限定单体来证明卡牌足够防御。
- 当前奖励数据已为事件/诅咒提供定向入口,但无色普通候选只列无色;刘备奖励ID表列入事件和古老牌。因此本版要求在最终抽取入口明确按稀有度过滤,不能只看到分类就认定已被排除。
- 当前随机生成按牌组归属和generatedOnly过滤,没有统一排除刘备事件/古老牌。破击、腐化等的生成资格应先于它们的裸数值处理。
### 2.2 两套环境必须分开记录
| 环境 | 用途 | 不允许的推断 |
| --- | --- | --- |
| A:当前源码敌人+当前卡牌 | 记录真实基线和故障 | 不把强卡掩盖的生存问题当成敌人合理 |
| B:V0.2的明确意图目标/追加攻击规则+本版候选卡牌 | 推荐设计方向的联合实验 | 不把B的净损血结论宣称适用于A |
| C:只改规则、不改HP/卡牌裸值 | 分离规则改动的贡献 | 若C已达到目标,不机械执行全部降血与削卡 |
V0.2的敌人HP和伤害表仍作为候选参数,不在本版再次整体降低。卡牌表的削弱项目不能直接单独投放到当前高压敌人环境;先消除规则失效和免费循环,再分组试验。
## 3. 优先统一的规则
### R1:效果持续到谁的回合
- “本回合”默认施放者当前完整行动;“保护至下次行动”必须覆盖中间全部敌人行动。减敌力量若用于应对意图,应持续至目标下一次完整行动结束。
- 当前黑暗镣铐的减力在目标自身回合结束清除,已经能覆盖目标行动;凌虐的高级牌状态却在每次phaseAfter统一清空,可能在玩家回合结束就丢失。后者需先修正,不能简单给更大的减力数值。
- 群起攻之目前按当前行动者记录友军攻击,常规轮流行动下可能吃不到前一名队友的贡献;改成“自上次自身回合开始以来”的有界窗口。
- 拦截当前按源码是保护者受击翻倍、被保护者伤害归零,不是把攻击事件实际转移;文案与建议机制都须明确,避免错误估算总承伤。
- 协同配合已使用接收者自身回合到期的临时力量;相信着你也已有回合外赠费排队逻辑。这两处保留,不重复修成另一套计时。
### R2:支援护甲必须撑到实际受击
托举、集结、恶魔护盾、希望灯塔等给予队友的护甲,不应在队友紧接着开始行动时全部清空。建议设“支援护甲”独立余额:即时可抵扣伤害;若在接收者回合外获得,第一次自身回合开始保留**剩余**部分,到其再下一次自身回合开始清除。不能补回已被打掉的量。持有壁垒时按保甲规则处理,不叠发第二份。拟态只复制当时可用护甲,不能复制待发放和已消耗部分。
### R3:消耗、失血、复制与循环
- 邪眼/被遗忘的仪式:当前消耗检测包含当前全局移动历史和自己的用牌历史,需用明确的自身回合令牌判定;仅检查属于本场战斗仍不足以证明属于本回合。
- 失血计数必须是实际生命下降事件;护甲吸收、取消伤害不算,3点失血算1次而非3次。自残带来的生存成本与力量收益一起计。
- 亮剑+妙计构成零费攻击/防御/过牌循环的风险;本版优先加消耗,而不是将全部过牌削至不可用。
- 回声不再生成回声;真实实体每次离场只结算一次消耗。1024次自动结算安全限制是防卡死保护,不是可接受的玩法上限。
- 壁垒、巩固、全身撞击保留构筑上限;先限制无成本反复回收,而不是给所有护甲设很低硬上限。
- 本版卡表中的触发次数上限是首轮试验值,需在界面明确显示剩余次数,不做隐藏限额。
### G1:生成、复制与X费用统一规则
1. 普通随机池按使用者归属生成,排除状态、诅咒、token、事件、古老、迁移占位及孤注一掷;明确指定的事件或巨石生成可以例外。
2. 随机生成链排除当前生成源及同链祖先牌,避免“花样百出→花样百出”无限扩展;劫难每自身回合至多生成3张,生成的攻击不再次触发劫难。
3. 当回合免费攻击的随机候选排除X;自动免费打出的X视为X=0,强化固定额外次数仍可生效。正常支付的X按支付时快照;连环拳的额外重放复制原支付次数,但不再次产生重放链。两者不能混成一个“免费仍用剩余能量”规则。
4. 复制保留基础牌名、强化及许可词缀,不继承运行时免费或费用封顶标记。当前共享复制钩子可继承永久免费/开悟费用封顶,这属于建议修改点,不是已经满足。
5. 生成牌仅本场;转移一张实体不等于复制;消耗后的实体不得被怀旧、无休手斧等凭空找回。
6. 本版仅提出规则;后续实现必须同步生成候选、说明、支付、牌堆与预告,不能只改数据表。
### G2:获取价值也参与平衡
- 第一轮固定各稀有度内部概率,先测试最终奖励候选中排除事件/古老/token的规则;不同时再调所有掉率。
- 刘备事件牌交锋、双持、巩固,古老牌破击、腐化,仅通过明确的定向渠道;事件奖励是否实际可达须逐节点确认,不能把“注册了”当成“必能获得”。
- 独行时降低纯支援牌进入普通候选的优先级;已有牌不删除,队友恢复后重新可用。纯支援定义包括只能选择另一友军、不能对自己生效的牌。
- 原生未注册牌只评价兼容、敌人/剧情和可能偷取路径;本轮不顺手开放33张新奖励。
## 4. 刘备起手与四条构筑路线
建议新开局12张:**4杀、3防御、闪、桃、无中、重杀、铁斩波各1**。相对当前 11 张起手,移出 1 杀、决斗,加入 1 防御、重杀、铁斩波。新重杀按本版1费7伤+1易伤,铁斩波提供一张攻防兼顾的普通牌。旧档不强制改牌。费用3、默认摸牌与手牌上限先保持,关张基础资源沿用V0.2“不同时削多项”的原则;仁德是换牌而非净抽牌。
| 路线 | 启动与支撑 | 收尾 | 主要限制与遭遇 |
| --- | --- | --- | --- |
| 力量多段 | 燃烧、预备打击、与我一战、炽焰支援 | 双重打击、飞剑、焚烧、旋风 | 多段对滑溜有效;抢杀同族随从;不让力量无限自残叠加 |
| 消耗转化 | 坚毅、燃烧契约、战鼓、无惧疼痛、黑暗之拥 | 灰烬打击、契约终结、恶魔之焰、午夜 | 状态清理与有效牌损失并存;不能靠事件/古老无限生成 |
| 自残爆发 | 放血、祭品、御血术、撕裂、绯红披风 | 怨恨、扯碎、狱火 | 失血实际次数、触发上限和桃消耗共同制约;不得假定战后可救死 |
| 防御反击 | 耸肩、铁斩波、火焰屏障、坚定不移、壁垒 | 全身撞击、势不可当、擒拿 | 保留有限强组合;应对多段异蛙;护甲时序与单次资源必须一致 |
## 5. 全卡逐项表的阅读方式
以下表格每个ID出现一次。普通/强化用“/”表示;“强化变化”仅列相对普通版改变的字段,其余效果沿用。没有强化规则的卡不虚构升级效果。费用单列为当前值,建议改费写在最后一列。
“当前效果”来自数据及对应运行时说明;共享牌的描述是当前声明文本,R1—R3及第9节列出已发现的运行时差异和验证边界。建议列未提及的字段保留。表格每条建议是待测候选,不是已经实装或已被胜率证明的最终值。
### 5.1 刘备原有25张
| 卡牌/ID | 当前普通/强化 | V0.3建议及理由 |
| --- | --- | --- |
| 暴走<br>`mengsan_baozou` | 1费,9伤;每次使用本实体成长5/9。 | 保留9及成长5/9;复制继承当前成长但不共用后续成长,稳定循环收尾。 |
| 怨恨<br>`mengsan_yuanhen` | 0费5伤;本回合实际失血后打2/3次。 | 保留;仅当本次自身回合实际失血触发,不把上一敌方回合受伤当条件。 |
| 旋风斩<br>`mengsan_xuanfengzhan` | X费,全敌每次5/8,攻击X次。 | 保留;X按支付快照,免费自动施放X=0;不得在剩3费时免费打3轮。 |
| 欺凌<br>`mengsan_qiling` | 0费,4+目标每层易伤2/3,仍吃易伤倍率。 | 改1费,4+每层易伤2/3保留,计入层数最多6;控制与翻倍易伤的乘积。 |
| 血墙<br>`mengsan_xueqiang` | 2费失血2,护甲16/20。 | 改1费,护甲12/16、失血2;兼顾防御与自残构筑,避免两费防御后无牌进攻。 |
| 战栗<br>`mengsan_zhanli` | 1费,单体易伤3/4,消耗。 | 改0费,易伤2/3,消耗;提升启动效率,减少为高层欺凌供能。 |
| 武装<br>`mengsan_wuzhuang` | 1费护甲5;强化当前手牌1张/全部,仅本场。 | 保留;当前少手牌使群体强化收益有限,不再减少基础甲。 |
| 耸肩无视<br>`mengsan_songjianwushi` | 1费护甲8/11,抽1。 | 保留;作为可靠防守过牌基准,先堵免费抽防而非削它。 |
| 破灭<br>`mengsan_pomie` | 1→0费,免费打堆顶牌并消耗原牌。 | 保留;先按合法性与实际使用支付X,不能免费继承剩余费用。 |
| 坚毅<br>`mengsan_jianyi` | 1费护甲7/9,消耗1手牌,普通随机/强化自选。 | 保留;消耗失败仍保留已结算护甲,不能假设每次都清掉最坏牌。 |
| 放血<br>`mengsan_fangxue` | 0费失血3,得2/3费。 | 保留数值,新增消耗;以一次性爆发替代可回收净产能。 |
| 余烬<br>`mengsan_yujin` | 2费18/24伤,随后随机消耗1手牌。 | 保留;不必为随机消耗误补过量伤害,消耗可能是正收益。 |
| 完美打击<br>`mengsan_wanmeidaji` | 2费6+每张杀/打击类2/3,统计本场实体含消耗。 | 保留;只统计自己的战斗牌,不含友军或公共堆,生成副本增长需记录。 |
| 预备打击<br>`mengsan_yubeidaji` | 1费7/9伤,然后本回合力量2/3。 | 保留;本次攻击不吃新增力量,主要服务多段。 |
| 突破<br>`mengsan_tupo` | 1费失血1,全敌9/13。 | 保留;群怪清理核心,先限制自残触发上限,不同时削伤。 |
| 头槌<br>`mengsan_touchui` | 1费9/12,个人弃牌选1回抽牌堆顶。 | 保留;检索不等于立刻抽取,不应计为净抽1。 |
| 铁斩波<br>`mengsan_tiezhanbo` | 1费先5/7甲,再5/7伤。 | 保留;攻防同牌比较基准,脆弱按甲单独取整。 |
| 双重打击<br>`mengsan_shuangchongdaji` | 1费5/7×2单体。 | 保留;力量按2段增长,多段对墨影有不可替代作用。 |
| 闪电霹雳<br>`mengsan_shandianpili` | 1费全体4/7,后施加1易伤。 | 保留;本牌不吃新易伤,队友能否接力要按座次计算。 |
| 愤怒<br>`mengsan_fennu` | 0费6/8,生成同牌副本入个人弃牌。 | 保留;副本增加牌组厚度是代价,生成数量记录,不把每次复制都变永久卡。 |
| 熔融之拳<br>`mengsan_rongrongzhiquan` | 1费10/14,目标已有易伤翻倍,消耗。 | 保留伤害和消耗;翻倍后易伤最多8/10层,与欺凌/主宰上限共同测试。 |
| 全身撞击<br>`mengsan_quanshenzhuangji` | 1→0费,按当前护甲造成攻击伤害,不消耗甲,吃力量。 | 保留;修免费循环后保留防守收尾,不先加伤害上限。 |
| 剑柄打击<br>`mengsan_jianbingdaji` | 1费9伤抽1/10伤抽2。 | 保留;与亮剑改消耗形成可循环有费攻击的区别。 |
| 飞剑回旋镖<br>`mengsan_feijianhuixuanbiao` | 1费随机3伤×3/4,逐次重选存活目标。 | 保留;多敌时不能按全部命中集火目标估击杀。 |
| 防御<br>`mengsan_fangyu` | 1费5/8甲。 | 保留;建议新开局增加至3张,先改善出现频率,不把基础卡直接提高到稀有卡水平。 |
### 5.2 刘备数据驱动68张(含巨石生成牌)
| 卡牌/ID | 当前费用;稀有度 | 当前普通效果 | 当前强化变化 | V0.3建议及理由 |
| --- | --- | --- | --- | --- |
| 拆卸<br>`mengsan_ic_dismantle` | 1;罕见 | 1费:8伤害;目标已有易伤时攻击2次。 | 伤害:10 | 保留8/10及易伤双击;作为单体力量收益基准,测试墨影破滑溜。 |
| 灰烬打击<br>`mengsan_ic_ashen_strike` | 1;罕见 | 1费:6伤害,每张消耗牌增加3伤害。 | 每消耗牌增伤:4 | 保留6+每消耗3/4;消耗计数只认个人实体,复制消耗不能重复计同一次事件。 |
| 劫掠<br>`mengsan_ic_pillage` | 1;罕见 | 6伤;抽牌直到抽到一张非攻击牌,包含终止牌。 | 伤害:9 | 保留6/9与抽至非攻击;明确包含抽到的终止牌,记录一次抽牌峰值。 |
| 御血术<br>`mengsan_ic_hemokinesis` | 1;罕见 | 1费:失去2生命,15伤害。 | 伤害:20 | 保留失血2、伤害15/20;自残换效率,但不可用战后回复抵消战中致死。 |
| 上勾拳<br>`mengsan_ic_uppercut` | 2;罕见 | 2费:13伤害,1虚弱,1易伤。 | 虚弱:2;易伤:2 | 保留2费13伤、虚弱易伤1/2;优先修持续时间,不先加伤。 |
| 与我一战!<br>`mengsan_ic_fight_me` | 2;罕见 | 2费:5伤害2次,获得3力量,敌人获得1力量。 | 伤害:6;力量:4 | 保留5×2/6×2、己方力3/4、敌方力1;预告立刻显示敌人各段增伤。 |
| 重锤<br>`mengsan_ic_bludgeon` | 3;罕见 | 3费:32伤害。 | 伤害:42 | 保留3费32/42;用一张牌应对昏眩的价值高,不按裸费效削弱。 |
| 恶魔护盾<br>`mengsan_ic_demonic_shield` | 0;罕见 | 0费:失去1生命,给予另一玩家等于自身当前格挡的格挡,消耗。 | 消耗:取消 | 改为0费、失血1、复制自身护甲至另一友军,上限16/24;普通消耗、强化不消耗保留;按支援护甲时序规则生效。 |
| 被遗忘的仪式<br>`mengsan_ic_forgotten_ritual` | 1;罕见 | 声明为本回合消耗过牌时得3费、消耗;当前历史判断范围须按R3核实。 | 满足本回合消耗条件时得费:4 | 保留1费得3/4费并消耗;必须是本次自身回合已成功消耗过另一张牌,不能用历史标记或本牌离场自激活。 |
| 燃烧契约<br>`mengsan_ic_burning_pact` | 1;罕见 | 1费:消耗一张牌,抽2。 | 抽牌:3 | 保留1费消耗1抽2/3;必须有可消耗实体才允许主动使用,空手不免费转抽牌。 |
| 挑衅<br>`mengsan_ic_taunt` | 1;罕见 | 1费:7格挡,1易伤。 | 护甲:8;易伤:2 | 保留7/8护甲与易伤1/2;攻防衔接基准。 |
| 邪眼<br>`mengsan_ic_evil_eye` | 1;罕见 | 8甲;声明本回合消耗过牌时再获8,见R3的历史范围问题。 | 护甲:11 | 保留8/11护甲、条件满足再获一次;条件只计本次自身回合成功消耗,不把两次护甲合并以绕开触发规则。 |
| 重振精神<br>`mengsan_ic_second_wind` | 1;罕见 | 1费:消耗所有非攻击手牌,每张获得5格挡。 | 每消耗牌获甲:7 | 保留每消耗5/7护甲;按实际被消耗数量结算,永恒牌按统一消耗资格处理。 |
| 主宰<br>`mengsan_ic_dominate` | 1;罕见 | 1费:1易伤,目标每层易伤获得1力量,消耗。 | 易伤:2 | 保留1费、易伤1/2与消耗;获得力量按施加后易伤计,但新增单次上限4/6,限制熔融之拳放大。 |
| 契约终结<br>`mengsan_ic_pacts_end` | 0;稀有 | 0费:消耗堆至少3张时全体17伤害。 | 伤害:23 | 0费全体17/23→14/18;至少3张个人消耗牌不变;多目标无代价输出略降,仍是消耗流收尾。 |
| 焚烧<br>`mengsan_ic_conflagration` | 1;稀有 | 1费:全体2伤害4次。 | 段数:5 | 保留1费2×4/2×5全体;重点限制力量无界增长,不把破滑溜特色改成单段。 |
| 恶魔之焰<br>`mengsan_ic_fiend_fire` | 2;稀有 | 2费:消耗所有手牌,每张造成7伤害,消耗。 | 伤害:10 | 保留2费每消耗7/10、消耗;锁定施放时其他手牌快照,新抽入的牌不追加为燃料。 |
| 祭品<br>`mengsan_ic_offering` | 0;稀有 | 0费:失去6生命,获得2费用,抽3,消耗。 | 抽牌:5 | 保留失血6、得2费、抽3/5、消耗;明确满手也可抽到超弃牌上限,不能凭上限误判为无收益。 |
| 烙印<br>`mengsan_ic_brand` | 0;稀有 | 0费:失去1生命,消耗一张牌,获得1力量。 | 力量:2 | 保留0费失血1、消耗1、得力1/2;必须成功消耗另一张手牌才得力量,无目标时禁主动使用。 |
| 岿然不动<br>`mengsan_ic_impervious` | 2;稀有 | 2费:30格挡,消耗。 | 护甲:40 | 保留2费30/40并消耗;Boss尖峰的有限防守牌,不砍为普通防御。 |
| 时候未到<br>`mengsan_ic_not_yet` | 2;稀有 | 2费:回复10生命,消耗。 | 回复:13 | 2费回复10/13→1费回复8/11,仍消耗;提升实际可用性,总续航略降;本版桃也改为主动消耗后,以更高回复保留区别。 |
| 交锋<br>`mengsan_ic_clash` | 0;事件 | 0费:手牌全部是攻击时可用,14伤害。 | 伤害:18 | 保留0费14/18及全攻击手牌限制;独行状态污染已构成真实代价。 |
| 巩固<br>`mengsan_ic_entrench` | 2;事件 | 2费:当前格挡翻倍。 | 费用:1 | 保留2→1费翻倍;不新增硬上限,先解决免费回收循环。 |
| 破击<br>`mengsan_ic_break` | 1;古老 | 1费:20伤害,5易伤。 | 伤害:30;易伤:7 | 保留古老牌1费20/30与易伤5/7;仅定向古老奖励,不进普通或随机生成池。 |
| 炽焰<br>`mengsan_ic_blaze` | 2;罕见 | 2费:给予另一玩家5力量。 | 给予另一友军力量:7 | 2费改1费,本场持续的友军力量5/7→2/3;单场可叠,但不让一次投资无代价放大全队多段。 |
| 燃烧<br>`mengsan_ic_inflame` | 1;罕见 | 1费:获得2力量。 | 力量:3 | 保留1费力量2/3,作为永久成长比较基线。 |
| 恶魔形态<br>`mengsan_ic_demon_form` | 3;稀有 | 3费:回合开始获得2力量。 | 每回合力量:3 | 保留3费每回合力2/3;只在Boss长战评价,不因普通战无用强行降费。 |
| 薪火之源<br>`mengsan_ic_pyre` | 2;稀有 | 2费:回合开始获得1费用。 | 每回合能量:2 | 保留2费每回合能量1/2;修正复制能力叠加与生成资格后再测,不能只按首轮亏费判弱。 |
| 绯红披风<br>`mengsan_ic_crimson_mantle` | 1;稀有 | 1费:回合开始失去1生命并获得8格挡。 | 每回合护甲:10 | 保留1费每回合失血1、护甲8/10;自残事件与撕裂、狱火明确只结算一次。 |
| 狂怒<br>`mengsan_ic_rage` | 0;罕见 | 0费:本回合每打出攻击获得3格挡。 | 每攻击获甲:5 | 保留0费每攻击护甲3/5;触发按真实出牌计,多段伤害不算多张攻击。 |
| 撕裂<br>`mengsan_ic_rupture` | 1;罕见 | 1费:自身回合每次失血获得1力量。 | 每次失血得力:2 | 保留力1/2;新增每自身回合最多由3次实际失血触发,额外失血照常扣血不再得力。 |
| 火焰屏障<br>`mengsan_ic_flame_barrier` | 2;罕见 | 2费:12格挡,每受到一次攻击反击4伤害。 | 护甲:16;每次受击反伤:6 | 保留2费12/16甲、每攻击反伤4/6;多段可多次反击,但被完全取消的攻击不触发。 |
| 巨像<br>`mengsan_ic_colossus` | 1;罕见 | 5甲;至自己下次回合开始,易伤敌人对自己的攻击减半。 | 护甲:8 | 保留1费5/8甲与50%减伤;持续至施放者下次回合开始,需覆盖敌方意图。 |
| 残酷<br>`mengsan_ic_cruelty` | 1;稀有 | 1费:易伤敌人额外受到25%伤害。 | 易伤额外倍率:50% | 保留易伤额外倍率25%/50%;显示最终倍率1.75/2.0,叠加副本收益单独测试。 |
| 狱火<br>`mengsan_ic_inferno` | 1;罕见 | 1费:回合开始失去1生命,自身回合每次失血全体6伤害。 | 每次失血群伤:9 | 每失血全体6/9→5/7,每自身回合最多触发3次;自身回合开始失血1保留,避免0费自残无限清场。 |
| 扯碎<br>`mengsan_ic_tear_asunder` | 2;稀有 | 5伤×(1+本场自身实际失血事件数),当前无玩法段数上限。 | 伤害:7 | 保留2费5/7每段;段数改为1+本场实际失血次数、最多5段;计次数不计失血点数,含受伤但不含护甲吸收。 |
| 无情猛攻<br>`mengsan_ic_relentless_assault` | 2;罕见 | 2费:14伤害,下一张攻击费用变为0。 | 伤害:20 | 保留2费14/20与下一攻击免费;免费机会仅到自己本回合末,X牌按统一规则,不跨回合囤积。 |
| 彼岸咆哮<br>`mengsan_ic_howl_from_beyond` | 3;罕见 | 3费:全体16伤害;回合末在消耗堆中则打出。 | 伤害:21 | 保留3费全体16/21;消耗堆每轮至多自动打出一次,明确重放后实体位置,不默认永久自动复制。 |
| 踩踏<br>`mengsan_ic_stomp` | 3;罕见 | 3费:全体12伤害,本回合每打出过一张攻击费用减少1。 | 伤害:15 | 保留3费12/15全体、每已打攻击减1费;最低0,自身不为自己的支付降费。 |
| 战斗专注<br>`mengsan_ic_battle_trance` | 0;罕见 | 0费:抽3,本回合不能再抽牌。 | 抽牌:4 | 保留0费抽3/4后禁抽;禁止额外抽牌不应禁止已在牌堆中的检索,说明两者差异。 |
| 地狱之刃<br>`mengsan_ic_infernal_blade` | 1;罕见 | 1费:随机攻击加入手牌,本回合免费,消耗。 | 费用:0 | 保留1→0费随机攻击免费并消耗;随机池排除古老/事件/token及X牌。 |
| 战鼓<br>`mengsan_ic_drum_of_battle` | 1;罕见 | 1费:抽2;被消耗时获得2费用。 | 被消耗时得费:3 | 保留1费抽2、被消耗返2/3费;一张实体一次消耗只返一次,先验证与腐化组合。 |
| 跃跃欲试<br>`mengsan_ic_eager` | 2;罕见 | 2费:每张攻击手牌获得1费用,本回合不能再获得费用。 | 费用:1 | 保留2→1费、按攻击手牌得费后禁得费;显示净收入N−费用,不能把N当净收益。 |
| 无惧疼痛<br>`mengsan_ic_feel_no_pain` | 1;罕见 | 1费:每张牌被消耗时获得3格挡。 | 每消耗获甲:4 | 保留每消耗3/4甲;真实消耗逐张触发,能力打出退出牌堆不自动算消耗。 |
| 凶恶<br>`mengsan_ic_ferocity` | 1;罕见 | 1费:每次给予易伤抽1。 | 施加易伤抽牌:2 | 保留每施加易伤抽1/2;每自身回合最多触发3次,群体施加可逐目标计至上限,避免群怪直接抽空。 |
| 岩石铠甲<br>`mengsan_ic_stone_armor` | 1;罕见 | 1费:获得4覆甲。 | 覆甲:6 | 保留1费覆甲4/6;明确每自身回合衰减1,并测试先结算护甲后清空问题。 |
| 杂耍<br>`mengsan_ic_juggle` | 1;罕见 | 1费:每回合第三张攻击复制至手牌。 | 固有:有 | 保留第三张攻击复制1;本回合免费标记不继承,永久免费属性也不应被复制放大(见生成规则)。 |
| 惊逃<br>`mengsan_ic_stampede` | 2;罕见 | 2费:回合末随机打出手牌攻击,目标随机。 | 费用:1 | 保留2→1费、回合末自动攻击1;自动牌仍需合法目标和阶段限额,不能绕过Boss昏眩。 |
| 狂宴<br>`mengsan_ic_feed` | 1;稀有 | 1费:10伤害,斩杀永久获得3最大生命,消耗。 | 伤害:12;斩杀最大生命:4 | 保留10/12、斩杀最大生命3/4及消耗;同一遭遇的召唤物/亡语随从合计最多提供一次成长。 |
| 痛殴<br>`mengsan_ic_thrash` | 1;稀有 | 1费:4伤害2次,随机消耗攻击手牌并继承其伤害。 | 伤害:6 | 保留4×2/6×2;吸收只取被消耗牌的基础单段值,不计力量/临时力量,累计吸收上限12/18;避免力量被存入后再次加成。 |
| 凌虐<br>`mengsan_ic_bully` | 3;稀有 | 15伤,登记目标减力10;见R1:其清理时序可能使防守收益失效。 | 伤害:20;减敌力量:15 | 3费15/20改2费12/16;减力10/15→4/6,持续到目标下一次完整行动结束;先修有效期再调数值。 |
| 倾泻<br>`mengsan_ic_unleash` | X;稀有 | X费:打出抽牌堆顶X张牌。 | X额外次数:1 | 保留X张/X+1张;自动免费重放X牌按X=0,不能借当前剩余费用;强化仍可多打1张。 |
| 原始力量<br>`mengsan_ic_primal_force` | 0;稀有 | 0费:所有攻击手牌变为巨石。 | 生成巨石强化等级:1 | 保留0费手中攻击变巨石/巨石+;仅战斗内变化,不继承原牌永久免费标记。 |
| 连环拳<br>`mengsan_ic_twin_strike` | 1;稀有 | 1费:下1张攻击额外打出一次。 | 后续额外重放攻击张数:2 | 保留1费下一1/2张攻击额外打出一次;回声不再生成回声,X的额外打出采用已支付快照且不触发新扩增链。 |
| 添柴<br>`mengsan_ic_stoke` | 1;稀有 | 1费:消耗所有手牌,每张生成一张随机牌至手牌。 | 生成牌强化等级:1 | 保留1费消耗手牌并等量生成;随机池排除事件/古老/token,新增牌只本场存在。 |
| 好勇斗狠<br>`mengsan_ic_battle_ready` | 1;稀有 | 1费:回合开始从弃牌堆随机取一张攻击至手牌并升级。 | 固有:有 | 保留1费每回合随机回收攻击并临时强化;不永久强化,不从消耗堆回收。 |
| 肉盾<br>`mengsan_ic_bodyguard` | 1;稀有 | 能力:自身受到敌方攻击×2,其他友军受到敌方攻击×0.5;非攻击不属于此分支。 | 费用:0 | 重做为可选择友军获得保护:敌人对该友军攻击减半,自己受击×1.5;不随机转移伤害,持续本场;1→0费保留。独行时不可主动打出。 |
| 地狱狂徒<br>`mengsan_ic_hellraiser` | 2;稀有 | 能力:抽到杀或打击类攻击,随机目标免费打出。 | 费用:1 | 保留2→1费;每自身回合最多自动打出3张打击类攻击;其引发的抽牌可继续入手但不无限自动打。 |
| 黑暗之拥<br>`mengsan_ic_dark_embrace` | 2;稀有 | 2费:每张牌被消耗时抽1。 | 费用:1 | 保留2→1费、每消耗抽1;先加生成牌资格及回声规则,不直接砍消耗核心。 |
| 坚定不移<br>`mengsan_ic_unshakable` | 2;稀有 | 2费:每回合第一次从卡牌获得的格挡翻倍。 | 费用:1 | 保留2→1费、首张护甲牌翻倍;同一张牌多次加甲属于同一使用事件,预告显示总效果。 |
| 势不可当<br>`mengsan_ic_juggernaut` | 2;稀有 | 2费:每次获得格挡,对随机敌人造成6伤害。 | 每次获甲随机伤害:8 | 保留2费每获甲随机6/8;每自身回合最多触发6次,独立记录来自技能或牌的护甲事件。 |
| 壁垒<br>`mengsan_ic_barricade` | 3;稀有 | 3费:回合开始不清空格挡。 | 费用:2 | 保留3→2费保甲;避免同时削巩固、撞击,保留防御成长路线。 |
| 双持<br>`mengsan_ic_dual_wield` | 1;事件 | 1费:复制一张攻击或能力手牌至手牌。 | 复制张数:2 | 保留1费复制1/2攻击或能力;副本保留强化与词缀,不继承运行时免费/费用封顶状态;复制能力按单卡上限执行。 |
| 腐化<br>`mengsan_ic_corruption` | 3;古老 | 3费:技能费用变为0,打出的技能被消耗。 | 费用:2 | 保留3→2费技能免费并消耗;作为古老定向奖励,不与普通刘备生成混池。 |
| 午夜<br>`mengsan_ic_midnight` | 12;稀有 | 99伤,基础12费,本场所有角色累计消耗每张减1费用。 | 伤害:120 | 保留12费99/120、消耗降费;计数改为己方个人牌堆真实消耗,不吃敌人消耗,最低0。 |
| 群情激愤<br>`mengsan_ic_rally` | 0;罕见 | 9伤;向所有存活且有个人牌堆的角色弃牌堆加入副本,包含敌人。 | 伤害:13 | 0费9/13→6/8;只向其他存活友军弃牌堆各加1副本,每张实体每回合至多传播一次;取消给敌人造牌。 |
| 擒拿<br>`mengsan_ic_grapple` | 1;罕见 | 1费:7伤害,本回合获得格挡时对该目标5伤害。 | 伤害:9;获甲后对目标伤害:7 | 保留1费7/9+获甲伤害5/7;每自身回合最多触发3次,和势不可当分别记账。 |
| 巨石<br>`mengsan_ic_boulder` | 1;生成 | 16伤,仅原始力量等明确生成渠道,不可正常获得。 | 伤害:20 | 保留生成牌1费16/20;不进入奖励、商店或随机生成池。 |
### 5.3 无色60张
| 卡牌/ID | 当前费用;稀有度 | 当前普通效果 | 当前强化变化 | V0.3建议及理由 |
| --- | --- | --- | --- | --- |
| 连射<br>`mengsan_colorless_volley` | X;罕见 | 随机对敌人造成10点伤害X次。 | 随机对敌人造成14点伤害X次。 | 保留X费10/14随机X次;免费生成不借剩余能量,按X=0;比较旋风的单体与群体差异。 |
| 亮剑<br>`mengsan_colorless_flash_of_steel` | 0;罕见 | 造成5点伤害。抽1张牌。 | 造成8点伤害。抽1张牌。 | 0费5/8伤+抽1→新增消耗,数值保留;阻断小牌组无限自循环。 |
| 闪亮登场<br>`mengsan_colorless_dramatic_entrance` | 0;罕见 | 固有。对所有敌人造成11点伤害。消耗。 | 固有。对所有敌人造成15点伤害。消耗。 | 保留0费固有全体11/15并消耗;不入普通白卡池,早期三怪战记录开场减员率。 |
| 万向斩<br>`mengsan_colorless_omnislice` | 0;罕见 | 造成8点伤害。对所有其他敌人造成等量的伤害。 | 造成11点伤害。对所有其他敌人造成等量的伤害。 | 0费改1费,主目标8/11及等伤溅射保留;溅射不再吃力量/易伤二次倍率。 |
| 究极打击<br>`mengsan_colorless_ultimate_strike` | 1;罕见 | 造成14点伤害。 | 造成20点伤害。 | 1费14/20→12/16;作为稀有度较高的纯攻击,避免压倒全部刘备普通单攻。 |
| 拳斗<br>`mengsan_colorless_fisticuffs` | 1;罕见 | 造成7点伤害。获得等量于所造成伤害的格挡。 | 造成9点伤害。获得等量于所造成伤害的格挡。 | 保留1费7/9伤并按结算伤害获甲;护甲收益单次上限12/16,避免巨额易伤同时变巨额防御。 |
| 群起攻之<br>`mengsan_colorless_gang_up` | 1;罕见 | 造成5点伤害。本回合其他玩家每攻击过一次该敌人,该牌造成的伤害就额外增加5点。 | 造成5点伤害。本回合其他玩家每攻击过一次该敌人,该牌造成的伤害就额外增加7点。 | 保留1费5伤+每友军攻击5/7;计数窗口改为自上次自身回合开始至本次施放,最多计3次,解决同回合无队友行动。 |
| 探寻打击<br>`mengsan_colorless_seeker_strike` | 1;罕见 | 造成9点伤害。从抽牌堆的随机3张牌中选择一张加入你的手牌。 | 造成12点伤害。从抽牌堆的随机3张牌中选择一张加入你的手牌。 | 保留1费9/12与三选一检索;检索不是额外生成,不绕过个人牌堆。 |
| 无休手斧<br>`mengsan_colorless_thrumming_hatchet` | 1;罕见 | 造成11点伤害。在你的下个回合开始时,将此卡返回你的手牌。 | 造成14点伤害。在你的下个回合开始时,将此卡返回你的手牌。 | 保留1费11/14,下回合实体返回;消耗或移交后不复制一张回来。 |
| 心灵震慑<br>`mengsan_colorless_mind_blast` | 1→0;罕见 | 固有。造成你抽牌堆中剩余牌数的伤害。 | 固有。造成你抽牌堆中剩余牌数的伤害。 | 保留1→0费、抽牌堆张数伤害;只算个人抽牌堆,避免读公共牌堆。 |
| 黑暗镣铐<br>`mengsan_colorless_dark_shackles` | 0;罕见 | 使一名敌人在本回合失去9点力量。消耗。 | 使一名敌人在本回合失去15点力量。消耗。 | 减力9/15→4/6,0费消耗保留;持续至目标下一次完整行动结束,覆盖多段与后续杀。 |
| 花样百出<br>`mengsan_colorless_jack_of_all_trades` | 0;罕见 | 将1张随机无色牌加入你的手牌。消耗。 | 将2张随机无色牌加入你的手牌。消耗。 | 保留0费生成1/2无色并消耗;排除自身及事件/状态/诅咒,生成牌不带运行时免费。 |
| 急躁<br>`mengsan_colorless_impatience` | 0;罕见 | 如果你的手牌中没有攻击牌,抽2张牌。 | 如果你的手牌中没有攻击牌,抽3张牌。 | 保留0费条件抽2/3;新增消耗,避免无攻击牌组反复抽费。 |
| 净化<br>`mengsan_colorless_purity` | 0;罕见 | 保留。从手牌中选择最多3张牌消耗。消耗。 | 保留。从手牌中选择最多5张牌消耗。消耗。 | 保留0费保留、消耗至多3/5并自身消耗;清污工具,不视为永久删牌。 |
| 妙计<br>`mengsan_colorless_finesse` | 0;罕见 | 获得4点格挡。抽1张牌。 | 获得7点格挡。抽1张牌。 | 0费4/7甲+抽1新增消耗;堵住免费抽防循环,保留一次性救急。 |
| 深谋远虑<br>`mengsan_colorless_thinking_ahead` | 0;罕见 | 抽2张牌。将手牌中的一张牌放到你的抽牌堆的顶端。消耗。 | 抽2张牌。将手牌中的一张牌放到你的抽牌堆的顶端。 | 抽2回顶1保留;强化仍消耗,强化额外保留;避免强化取消消耗后组成闭环。 |
| 生产制造<br>`mengsan_colorless_production` | 0;罕见 | 获得2点能量。消耗。 | 获得3点能量。消耗。 | 保留0费得2/3费并消耗;随机生成不得再次生成同源资源牌链(G1)。 |
| 相信着你<br>`mengsan_colorless_believe_in_you` | 0;罕见 | 另一名玩家获得2点能量。 | 另一名玩家获得3点能量。 | 保留0费给友军2/3费,新增消耗;沿用下一次自身行动补发机制,不让回合重置吞掉赠费。 |
| 心神不宁<br>`mengsan_colorless_restlessness` | 0;罕见 | 保留。如果你的手牌为空,则抽2张牌并获得2点能量。 | 保留。如果你的手牌为空,则抽3张牌并获得3点能量。 | 保留空手得2/3牌及2/3费、保留;新增消耗;按本牌离手后为空判断,避免永远不满足。 |
| 延伸<br>`mengsan_colorless_prolong` | 0;罕见 | 在下个回合获得等量于你当前格挡值的格挡。消耗。 | 在下个回合获得等量于你当前格挡值的格挡。 | 保留护甲快照延至下回合;强化仍消耗、改为保留,限制永久保甲与0费回收闭环。 |
| 应急按钮<br>`mengsan_colorless_panic_button` | 0;罕见 | 获得30点格挡。你在接下来的2回合内无法再从卡牌中获得格挡。消耗。 | 获得40点格挡。你在接下来的2回合内无法再从卡牌中获得格挡。消耗。 | 保留0费30/40甲、消耗及禁卡牌获甲;明确禁甲持续当前余下回合和下一个自身回合,不写模糊“两回合”。 |
| 抱团<br>`mengsan_colorless_huddle_up` | 1;罕见 | 所有玩家抽2张牌。消耗。 | 所有玩家抽3张牌。消耗。 | 保留1费全友军抽2/3并消耗;不因助战缺席免费补发第三人收益。 |
| 发现<br>`mengsan_colorless_discovery` | 1;罕见 | 从3张随机牌中选择1张加入你的手牌。这张牌在本回合可以免费打出。消耗。 | 从3张随机牌中选择1张加入你的手牌。这张牌在本回合可以免费打出。 | 保留1费三选一当回合免费;强化仍消耗、生成牌改已强化;限制反复找资源牌。 |
| 究极防御<br>`mengsan_colorless_ultimate_defend` | 1;罕见 | 获得11点格挡。 | 获得15点格挡。 | 1费11/15甲→10/13;仍高于基础防御,但不全面替代耸肩的过牌定位。 |
| 拦截<br>`mengsan_colorless_intercept` | 1;罕见 | 获得9点格挡。将本回合所有要对另一名玩家发起的攻击转移到你的身上。 | 获得13点格挡。将本回合所有要对另一名玩家发起的攻击转移到你的身上。 | 先修说明:当前是被保护者攻击伤害归零、持有者受击翻倍,并非真正转移。建议1费9/13甲、保护友军减伤50%、自身×1.5,持续至下次自身回合开始。 |
| 托举<br>`mengsan_colorless_lift` | 1;罕见 | 给另一名玩家11点格挡。 | 给另一名玩家16点格挡。 | 保留1费给友军11/16甲;采用R2的支援护甲保留规则,独行时不出现常规奖励。 |
| 协同配合<br>`mengsan_colorless_coordinate` | 1;罕见 | 在本回合给予其他玩家5点力量。 | 在本回合给予其他玩家8点力量。 | 保留1费给其他友军临时力5/8;现代码已覆盖接收者自己的回合,不误判为施放回合清除;测试双助战多段。 |
| 横祸<br>`mengsan_colorless_catastrophe` | 2;罕见 | 从你的抽牌堆中随机打出2张牌。 | 从你的抽牌堆中随机打出3张牌。 | 保留2费随机自动打2/3;展示候选池风险,X与自残遵守G1,不凭空指定最优牌。 |
| 均衡<br>`mengsan_colorless_equilibrium` | 2;罕见 | 获得13点格挡。在本回合保留你的手牌。 | 获得16点格挡。在本回合保留你的手牌。 | 保留2费13/16甲和手牌保留;属于持牌防守工具,不额外加抽牌。 |
| 炸弹<br>`mengsan_colorless_the_bomb` | 2;罕见 | 在3回合结束后,对所有敌人造成40点伤害。 | 在3回合结束后,对所有敌人造成50点伤害。 | 保留2费三次自身回合末后全体40/50;记录首轮放置是否计第一次,不能当即时40伤。 |
| 震荡波<br>`mengsan_colorless_shockwave` | 2;罕见 | 给予所有敌人3层虚弱和易伤。消耗。 | 给予所有敌人5层虚弱和易伤。消耗。 | 保留2费全体虚弱易伤3/5并消耗;关键多怪减伤,不先削持续。 |
| 神气制胜<br>`mengsan_colorless_panache` | 0;罕见 | 每当你在一回合内打出五张牌时,对所有敌人造成10点伤害。 | 每当你在一回合内打出五张牌时,对所有敌人造成14点伤害。 | 保留0费每5张全体10/14;每自身回合最多触发3次,按真实出牌事件不按攻击段数。 |
| 非凡技艺<br>`mengsan_colorless_prowess` | 1;罕见 | 获得1点力量。获得1点敏捷。 | 获得2点力量。获得2点敏捷。 | 保留1费力量敏捷各1/2;单体稳定能力基准。 |
| 勒紧<br>`mengsan_colorless_fasten` | 1;罕见 | 从“防御”牌中额外获得4点格挡。 | 从“防御”牌中额外获得6点格挡。 | 保留1费防御额外甲4/6;使用明确防御标签,不按中文名称包含关系误增其他牌。 |
| 准备时间<br>`mengsan_colorless_prep_time` | 1;罕见 | 在你的回合开始时,获得4点活力。 | 在你的回合开始时,获得6点活力。 | 保留1费每回合活力4/6;明确活力用于下一张攻击的各段,需与多段一起验算。 |
| 自动化<br>`mengsan_colorless_automation` | 1→0;罕见 | 你每抽10张牌,获得1点能量。 | 你每抽10张牌,获得1点能量。 | 保留1→0费、每抽10得1费;只计真实抽牌,检索/复制/生成不算抽牌。 |
| 流星锤<br>`mengsan_colorless_bolas` | 0;稀有 | 造成3点伤害。在你的下个回合开始时,将此卡返回你的手牌。 | 造成4点伤害。在你的下个回合开始时,将此卡返回你的手牌。 | 保留0费3/4下轮返回;实体每自身回合最多打出1次,阻止回收循环。 |
| 箭雨<br>`mengsan_colorless_salvo` | 1;稀有 | 造成12点伤害。在本回合保留你的手牌。 | 造成16点伤害。在本回合保留你的手牌。 | 1费12/16→10/14,保留全手牌保留;避免纯攻击和控制手牌均无代价领先。 |
| 金斧<br>`mengsan_colorless_gold_axe` | 1;稀有 | 造成本场战斗中所打出牌数的伤害。 | 保留。造成本场战斗中所打出牌数的伤害。 | 保留1费、强化保留;伤害计数改本人本场已使用牌数,不含本次及友军,单次基础上限30/40。 |
| 撕碎<br>`mengsan_colorless_rend` | 2;稀有 | 造成15点伤害。该名敌人身上每有一种负面效果,就额外造成5点伤害。 | 造成18点伤害。该名敌人身上每有一种负面效果,就额外造成8点伤害。 | 保留2费15+每负面5/18+每负面8;负面种类最多计4,不把层数当种类。 |
| 贪婪之手<br>`mengsan_colorless_hand_of_greed` | 2;稀有 | 造成20点伤害。斩杀时,获得20金币。 | 造成25点伤害。斩杀时,获得25金币。 | 保留2费20/25、斩杀金币20/25;召唤/亡语随从全场合计至多结算一次金币。 |
| 大奖<br>`mengsan_colorless_jackpot` | 3;稀有 | 造成25点伤害。将3张随机0能量的牌加入你的手牌。 | 造成30点伤害。将3张随机升级过的0能量的牌加入你的手牌。 | 保留3费25/30+3张零费牌;生成池排除资源自循环牌及自身,牌仍需合法条件。 |
| 击倒<br>`mengsan_colorless_knockdown` | 3;稀有 | 造成10点伤害。该敌人在本回合受到的来自其他玩家的伤害变为两倍。 | 造成14点伤害。该敌人在本回合受到的来自其他玩家的伤害变为三倍。 | 3→2费,伤害10/14保留;其他友军伤害倍率2/3→1.5/2,持续至施放者下回合开始;显示是他人增伤。 |
| 孤注一掷<br>`mengsan_colorless_the_gambit` | 0;稀有 | 获得50点格挡。如果你在本场战斗中受到未被格挡的攻击伤害,则立刻死亡。 | 获得75点格挡。如果你在本场战斗中受到未被格挡的攻击伤害,则立刻死亡。 | 保留0费50/75甲与未挡攻击即死;从随机生成与常规奖励移至明确风险事件,自动打牌禁止自动施放。 |
| 秘密技法<br>`mengsan_colorless_secret_technique` | 0;稀有 | 从抽牌堆中选择一张技能牌放入你的手牌。消耗。 | 从抽牌堆中选择一张技能牌放入你的手牌。 | 0费技能检索保留;强化仍消耗、增加保留,避免稳定无限检索链。 |
| 秘密武器<br>`mengsan_colorless_secret_weapon` | 0;稀有 | 从抽牌堆中选择一张攻击牌放入你的手牌。消耗。 | 从抽牌堆中选择一张攻击牌放入你的手牌。 | 0费攻击检索保留;强化仍消耗、增加保留,与秘密技法一致。 |
| 战略大师<br>`mengsan_colorless_master_of_strategy` | 0;稀有 | 抽3张牌。消耗。 | 抽4张牌。消耗。 | 保留0费抽3/4并消耗;一次性无色过牌基准。 |
| 潦草急就<br>`mengsan_colorless_scrawl` | 1;稀有 | 抽牌直到抽满手牌。消耗。 | 保留。抽牌直到抽满手牌。消耗。 | 1费改0费,补到当前手牌上限与消耗保留,强化保留;默认上限3时不按原作大手牌上限定价。 |
| 拟态<br>`mengsan_colorless_mimic` | 1;稀有 | 获得等同于另一位玩家格挡值的格挡。消耗。 | 获得等同于另一位玩家格挡值的格挡。 | 保留1费复制友军护甲;复制上限20/30,强化不消耗保留;只能复制当前真实可用护甲。 |
| 天选<br>`mengsan_colorless_anointed` | 1;稀有 | 将你抽牌堆中的所有稀有牌放入你的手牌。消耗。 | 保留。将你抽牌堆中的所有稀有牌放入你的手牌。消耗。 | 保留1费检索稀有牌、消耗、强化保留;检索严格认rare,不把event/ancient视为rare。 |
| 集结<br>`mengsan_colorless_rally` | 2;稀有 | 所有玩家获得12点格挡。 | 所有玩家获得17点格挡。 | 保留2费全友军12/17甲;自己即时获甲,友军遵循R2的支援护甲保留规则;不重复计全队收益为刘备收益。 |
| 狠揍<br>`mengsan_colorless_beat_down` | 3;稀有 | 打出你弃牌堆中的3张随机攻击牌。 | 打出你弃牌堆中的4张随机攻击牌。 | 保留3费从弃牌随机打3/4攻击;每张实体最多一次,不把新弃回的牌重复抽入同批。 |
| 怀旧<br>`mengsan_colorless_nostalgia` | 1→0;稀有 | 每回合首次打出攻击或技能牌时,将其置于你的抽牌堆顶端。 | 每回合首次打出攻击或技能牌时,将其置于你的抽牌堆顶端。 | 保留1→0费每回合首张攻击/技能回顶;消耗和能力离场优先,不回收已消耗牌。 |
| 熵<br>`mengsan_colorless_entropy` | 1;稀有 | 在你的回合开始时,变化你手牌中的1张牌。 | 固有。在你的回合开始时,变化你手牌中的1张牌。 | 保留1费每回合变化1、强化固有;仅个人手牌、战斗内变化,不能洗去永恒。 |
| 希望灯塔<br>`mengsan_colorless_beacon_of_hope` | 1;稀有 | 每当你在你的回合获得格挡时,其他玩家获得相应一半的格挡。 | 固有。每当你在你的回合获得格挡时,其他玩家获得相应一半的格挡。 | 保留1费自身获甲时给其他友军一半、强化固有;继承护甲不再次触发灯塔,并采用R2的支援护甲保留规则。 |
| 乱战<br>`mengsan_colorless_mayhem` | 2→1;稀有 | 在你的回合开始时,打出你抽牌堆顶部的牌。 | 在你的回合开始时,打出你抽牌堆顶部的牌。 | 保留2→1费每回合自动堆顶1;自动使用依然可能自残,禁止孤注一掷自动致死风险。 |
| 滚石<br>`mengsan_colorless_rolling_boulder` | 3;稀有 | 在你的回合开始时,对所有敌人造成5点伤害,然后将该伤害增加5点。 | 在你的回合开始时,对所有敌人造成10点伤害,然后将该伤害增加5点。 | 3→2费,每回合全体5起/强化10起、每轮增5保留;给成长型无色能力一个能留防御费的启动窗口。 |
| 劫难<br>`mengsan_colorless_calamity` | 3→2;稀有 | 每当你打出一张攻击牌时,将一张随机攻击牌添加到你的手牌。 | 每当你打出一张攻击牌时,将一张随机攻击牌添加到你的手牌。 | 保留3→2费每攻击随机生成攻击;每自身回合最多生成3张,生成牌不再触发本能力生成。 |
| 永恒铠甲<br>`mengsan_colorless_eternal_armor` | 3;稀有 | 获得9层覆甲。 | 获得12层覆甲。 | 3→2费覆甲9/12不变;收益逐轮衰减而非每轮恒定,先核对结算顺序。 |
| 魔球<br>`mengsan_colorless_the_ball` | 1;罕见 | 造成10点伤害。将这张牌在本场战斗中的伤害增加15,然后将其交给一名随机盟友。 | 造成10点伤害。将这张牌在本场战斗中的伤害增加25,然后将其交给一名随机盟友。 | 保留1费10起,增长15/25→6/9;移交真实实体及成长保留,每个持有者每自身回合最多打出一次。 |
### 5.4 事件26张
| 卡牌/ID | 当前费用;稀有度 | 当前普通效果 | 当前强化变化 | V0.3建议及理由 |
| --- | --- | --- | --- | --- |
| 异鸟扑击<br>`mengsan_event_byrd_swoop` | 0;事件 | 造成14点伤害。 | 造成18点伤害。 | 保留0费14/18;一次性事件来源,不进普通奖励或随机池,统计重复获取路径。 |
| 疯狂科学<br>`mengsan_event_mad_science_sapping` | 1;事件 | 造成12点伤害。给予2层虚弱。给予2层易伤。 | 固有。造成12点伤害。给予2层虚弱。给予2层易伤。 | 保留1费12伤+2虚弱2易伤、强化固有;限定一次事件所得。 |
| 疯狂科学<br>`mengsan_event_mad_science_violence` | 1;事件 | 造成12点伤害3次。 | 固有。造成12点伤害3次。 | 1费12×3→8×3,强化仍固有;一次性奖励保留强度,但不以36裸伤再吃3倍力量。 |
| 疯狂科学<br>`mengsan_event_mad_science_choking` | 1;事件 | 造成12点伤害。本回合,你每打出一张牌,该敌人失去6点生命。 | 固有。造成12点伤害。本回合,你每打出一张牌,该敌人失去6点生命。 | 1费12伤保留,每出牌失血6→4,强化固有;每自身回合最多触发4次。 |
| 杀灭<br>`mengsan_event_exterminate` | 1;事件 | 对所有敌人造成3点伤害4次。 | 对所有敌人造成4点伤害4次。 | 保留1费全体3×4/4×4;事件卡优势保留,不进入一般生成池。 |
| 压扁<br>`mengsan_event_squash` | 1;事件 | 造成10点伤害。给予2层易伤。 | 造成12点伤害。给予3层易伤。 | 保留1费10/12伤及2/3易伤;与基础重杀区分获取成本。 |
| 啄击<br>`mengsan_event_peck` | 1;事件 | 造成2点伤害3次。 | 造成2点伤害4次。 | 保留1费2×3/2×4;多段破盾和力量收益已足够,避免按裸6伤误判弱。 |
| 疯狂进食<br>`mengsan_event_feeding_frenzy` | 0;事件 | 在本回合内获得5点力量。 | 在本回合内获得7点力量。 | 0费临时力5/7→3/4,新增消耗;限制事件多段爆发重复循环。 |
| 开悟<br>`mengsan_event_enlightenment` | 0;事件 | 在这个回合,你当前手牌中所有牌的耗能降低至1。消耗。 | 在这场战斗,你当前手牌中所有牌的耗能降低至1。消耗。 | 保留0费降至1及消耗,强化战斗内持续;0费不涨费,X不变,复制不继承降费标记。 |
| 疯狂科学<br>`mengsan_event_mad_science_energized` | 1;事件 | 获得8点格挡。获得2点能量。 | 固有。获得8点格挡。获得2点能量。 | 保留1费8甲+2费、强化固有;新增消耗,防止净产能被重复回收。 |
| 疯狂科学<br>`mengsan_event_mad_science_wisdom` | 1;事件 | 获得8点格挡。抽3张牌 | 固有。获得8点格挡。抽3张牌 | 保留1费8甲+抽3、强化固有;先限制事件重复获取,不同步削抽牌。 |
| 疯狂科学<br>`mengsan_event_mad_science_chaos` | 1;事件 | 获得8点格挡。将一张随机牌放入你的手牌,这张牌在本回合可以免费打出。 | 固有。获得8点格挡。将一张随机牌放入你的手牌,这张牌在本回合可以免费打出。 | 保留1费8甲+随机免费牌、强化固有;按G1排除危险及资源自循环牌。 |
| 坚韧之环<br>`mengsan_event_toric_toughness` | 2;事件 | 获得5点格挡。在接下来的2个回合开始时,获得5点格挡。 | 获得7点格挡。在接下来的2个回合开始时,获得7点格挡。 | 2费改1费;当前及后2回合甲5/7保留,延迟甲在清空之后发放。 |
| 羽化<br>`mengsan_event_metamorphosis` | 2;事件 | 在你的抽牌堆中加入3张随机攻击牌。它们在本场战斗中可以被免费打出。消耗。 | 在你的抽牌堆中加入5张随机攻击牌。它们在本场战斗中可以被免费打出。消耗。 | 保留2费生成3/5攻击至抽牌堆并消耗;免费仅本场该实体,副本不继承,排除X及事件/古老。 |
| 疯狂科学<br>`mengsan_event_mad_science_expertise` | 1;事件 | 获得2点力量。获得2点敏捷。 | 固有。获得2点力量。获得2点敏捷。 | 保留1费力敏各2、强化固有;独占事件能力,不将其强度作为普通能力基准。 |
| 疯狂科学<br>`mengsan_event_mad_science_curious` | 1;事件 | 能力牌的耗能减少1能量。 | 固有。能力牌的耗能减少1能量。 | 保留1费能力减费1、强化固有;同名能力不叠加减费,最低0。 |
| 疯狂科学<br>`mengsan_event_mad_science_improvement` | 1;事件 | 在战斗结束时,升级你牌组中的一张随机牌。 | 固有。在战斗结束时,升级你牌组中的一张随机牌。 | 保留1费战后随机强化、强化固有;每场最多触发1次永久强化,不因复制叠加刷强化。 |
| 涅奥之怒<br>`mengsan_event_neows_fury` | 1;古老 | 造成10点伤害。将你弃牌堆中的至多2张牌放入你的手牌。消耗。 | 造成14点伤害。将你弃牌堆中的至多3张牌放入你的手牌。消耗。 | 保留1费10/14及弃牌回收至多2/3、消耗;不可回收消耗牌,目标已死不吞掉合法回收。 |
| 撕咬<br>`mengsan_event_maul` | 1;古老 | 造成5点伤害两次。在这场战斗中,将所有“撕咬”牌的伤害增加1。 | 造成6点伤害两次。在这场战斗中,将所有“撕咬”牌的伤害增加2。 | 保留1费5×2/6×2及全同名增长1/2;每张基础伤害成长上限+8/12,防止长战无界。 |
| 吹哨<br>`mengsan_event_whistle` | 3;古老 | 造成33点伤害。击晕该敌人。消耗。 | 造成44点伤害。击晕该敌人。消耗。 | 保留3费33/44、击晕、消耗;Boss同一阶段最多承受1次此类击晕,额外命中仍造成伤害。 |
| 许愿<br>`mengsan_event_wish` | 0;古老 | 将你抽牌堆中的一张牌放入你的手牌。消耗。 | 保留。将你抽牌堆中的一张牌放入你的手牌。消耗。 | 保留0费任意检索、消耗、强化保留;不复制检索目标。 |
| 至亮之焰<br>`mengsan_event_brightest_flame` | 0;古老 | 获得2点能量。抽2张牌。失去1点最大生命。 | 获得3点能量。抽3张牌。失去1点最大生命。 | 保留0费得2/3费抽2/3、损失1最大生命;新增消耗,避免减最大生命可被无实体弱化后持续循环。 |
| 灵体<br>`mengsan_event_apparition` | 1;古老 | 虚无。获得1层无实体。消耗。 | 获得1层无实体。消耗。 | 保留1费无实体1、消耗,强化去虚无;仅一次事件渠道,明确每段减至1、多段仍危险。 |
| 神化<br>`mengsan_event_apotheosis` | 2→1;古老 | 固有。升级你的全部卡牌。消耗。 | 固有。升级你的全部卡牌。消耗。 | 保留2→1费固有、全牌战斗强化、消耗;不写回永久牌组。 |
| 放松<br>`mengsan_event_relax` | 3;古老 | 获得15点格挡。下个回合,抽2张牌并获得2点能量。消耗。 | 获得17点格挡。下个回合,抽3张牌并获得3点能量。消耗。 | 3→2费;15/17甲及下回合牌/费各2/3不变,消耗;避免占满本回合费用却不能应对尖峰。 |
| 富足<br>`mengsan_event_abundance` | 1;古老 | 从3张能力牌中选择1张加入你的手牌。这张牌在本回合可以免费打出。消耗。 | 从3张升级过的能力牌中选择1张加入你的手牌。这张牌在本回合可以免费打出。消耗。 | 保留1费能力三选一、当回合免费、消耗、强化生成已强化;候选不含古老腐化。 |
### 5.5 状态12张
| 卡牌/ID | 当前费用;稀有度 | 当前普通效果 | 当前强化变化 | V0.3建议及理由 |
| --- | --- | --- | --- | --- |
| 毒素<br>`mengsan_status_toxic` | 1;状态 | 在你的回合结束时,如果这张牌在你的手牌中,你受到5点伤害。消耗。 | 无强化规则 | 5伤→4伤,1费消耗保留;最多每轮新塞1张作为第一章建议,不能仅改单张不管投放。 |
| 呼唤<br>`mengsan_status_beckon` | 1;状态 | 在你的回合结束时,如果这张牌在你的手牌中,你失去6点生命。 | 无强化规则 | 失血6→4;1费主动清除改消耗,给玩家明确应对,禁止永久玩家奖励。 |
| 黏液<br>`mengsan_slimed_shuying` | 1;状态 | 抽1张牌。消耗。 | 无强化规则 | 保留1费抽1消耗;优先调怪物每次塞牌数量,不能当0费过牌。 |
| 碎屑<br>`mengsan_status_debris` | 1;状态 | 消耗。 | 无强化规则 | 保留1费消耗;与黏液差异是无补牌,限制普通遭遇一次塞牌不超过1。 |
| 凋萎<br>`mengsan_status_wither` | 不可打出;状态 | 不能被打出。在你的回合结束时,如果这张牌在你的手牌中,你受到3点伤害。 | 无强化规则 | 保留基础3;敌方成长改3+2×层数、最多7伤;图标显示实际层数,升级与成长分离。 |
| 感染<br>`mengsan_infection_shuying` | 不可打出;状态 | 不能被打出。在你的回合结束时,如果这张牌在你的手牌中,你受到3点伤害。 | 无强化规则 | 保留每张3伤、不可打出;异蛙本体每次建议3→2张、虫每次1,衔接V0.2。 |
| 煤灰<br>`mengsan_status_soot` | 不可打出;状态 | 不能被打出。 | 无强化规则 | 保留不可打出;与伤口相同数值但记录来源,先不另增惩罚。 |
| 伤口<br>`mengsan_wound_shuying` | 不可打出;状态 | 不能被打出。 | 无强化规则 | 保留不可打出;墨影肢解塞3→2属于敌方建议,勿同时再削所有消耗清污卡。 |
| 虚空<br>`mengsan_status_void` | 不可打出;状态 | 不能被打出。虚无。每当你抽到这张牌时,失去1点能量。 | 无强化规则 | 保留抽到失1费、虚无、不可打出;每玩家回合最多由虚空扣2费,保留至少一次1费应对空间(能量本来为0除外)。 |
| 晕眩<br>`mengsan_dazed_shuying` | 不可打出;状态 | 不能被打出。虚无。 | 无强化规则 | 保留不可打出与虚无;雾菇眼每次建议3→2张,持续召唤压力另测。 |
| 灼伤<br>`mengsan_status_burn` | 不可打出;状态 | 不能被打出。在你的回合结束时,如果这张牌在你的手牌中,你受到2点伤害。 | 无强化规则 | 保留不可打出、每张2伤;按每张单独抵扣护甲,不直接失血。 |
| 弃用卡牌<br>`mengsan_status_deprecated_card` | 0;状态 | 这张牌在近期的一次更新中被移除。抽1张牌。将这张牌从你的牌组中移除。消耗。 | 无强化规则 | 保留0费抽1、永久移除及消耗;只作旧档迁移,不进奖励商店或生成。 |
### 5.6 诅咒18张
| 卡牌/ID | 当前费用;稀有度 | 当前普通效果 | 当前强化变化 | V0.3建议及理由 |
| --- | --- | --- | --- | --- |
| 孢子心灵<br>`mengsan_curse_spore_mind` | 1;诅咒 | 消耗。 | 无强化规则 | 保留1费消耗;战斗清除不等于永久删诅咒,交易奖励需体现长期负担。 |
| 执迷<br>`mengsan_curse_enthralled` | 2;诅咒 | 如果这张牌在你的手牌中,你必须优先打出这张牌。永恒。 | 无强化规则 | 2费→1费,仍须优先打出、永恒;保留控制代价但不吃掉三费回合的三分之二。 |
| 笨拙<br>`mengsan_curse_clumsy` | 不可打出;诅咒 | 不能被打出。虚无。 | 无强化规则 | 保留不可打出、虚无;作为轻诅咒基准。 |
| 凡庸<br>`mengsan_curse_normality` | 不可打出;诅咒 | 不能被打出。你在本回合不能打出超过3张牌。 | 无强化规则 | 保留手中时最多3次主动出牌;响应不计,回声是否计用统一行动规则明确,不能当全局3牌。 |
| 腐朽<br>`mengsan_curse_decay` | 不可打出;诅咒 | 不能被打出。在你的回合结束时,如果这张牌在你的手牌中, 你受到2点伤害。 | 无强化规则 | 保留每张2伤;护甲可挡,和直接失血区别说明。 |
| 悔恨<br>`mengsan_curse_regret` | 不可打出;诅咒 | 不能被打出。在你的回合结束时,如果这张牌在你的手牌中,失去相当于手牌数量的生命。 | 无强化规则 | 保留按结束时手牌数失血;每张上限5,手牌快照包含自身,与大量抽牌有明确代价。 |
| 进阶之灾<br>`mengsan_curse_ascenders_bane` | 不可打出;诅咒 | 不能被打出。虚无。永恒。 | 无强化规则 | 保留虚无、永恒、不可打出;仅对应难度设置投放,不混入普通事件随机惩罚。 |
| 苦恼<br>`mengsan_curse_writhe` | 不可打出;诅咒 | 不能被打出。固有。 | 无强化规则 | 保留固有不可打出;不占掉全部起手保障,仅影响其实际占用一张的位置。 |
| 愧疚<br>`mengsan_curse_guilty` | 不可打出;诅咒 | 不能被打出。在5场战斗后从你的牌组中移除。 | 无强化规则 | 保留5次胜利后移除;文案改“5场战斗胜利后”,与现结算一致。 |
| 铃铛的诅咒<br>`mengsan_curse_curse_of_the_bell` | 不可打出;诅咒 | 不能被打出。永恒。 | 无强化规则 | 保留永恒不可打出;只配对应强奖励,不新增末尾扣血。 |
| 霉运<br>`mengsan_curse_bad_luck` | 不可打出;诅咒 | 不能被打出。在你的回合结束时,如果这张牌在你的手牌中,你失去13点生命。永恒。 | 无强化规则 | 末尾失血13→5,永恒保留;50基础生命下单张26%生命过重,仍需高价值明确交易。 |
| 受伤<br>`mengsan_curse_injury` | 不可打出;诅咒 | 不能被打出。 | 无强化规则 | 保留不可打出;普通纯污染基准。 |
| 睡眠不佳<br>`mengsan_curse_poor_sleep` | 不可打出;诅咒 | 不能被打出。保留。 | 无强化规则 | 保留不可打出与保留;允许永久删除,显示不计弃牌上限不等于不占抽牌机会。 |
| 贪婪<br>`mengsan_curse_greed` | 不可打出;诅咒 | 不能被打出。永恒。 | 无强化规则 | 保留永恒不可打出;不因名称自行加扣钱机制。 |
| 羞耻<br>`mengsan_curse_shame` | 不可打出;诅咒 | 不能被打出。在你的回合结束时,如果这张牌在你的手牌中,则获得1层脆弱。 | 无强化规则 | 保留末尾1脆弱;下一自身行动必须真实生效,负面后置衰减规则保持。 |
| 疑虑<br>`mengsan_curse_doubt` | 不可打出;诅咒 | 不能被打出。在你的回合结束时,如果这张牌在你的手牌中,获得1层虚弱。 | 无强化规则 | 保留末尾1虚弱;与群怪抢杀窗口联合测,不叠加额外扣血。 |
| 愚行<br>`mengsan_curse_folly` | 不可打出;诅咒 | 不能被打出。固有。虚无。永恒。 | 无强化规则 | 保留固有、虚无、永恒;只作指定高价值事件负担。 |
| 债务<br>`mengsan_curse_debt` | 不可打出;诅咒 | 不能被打出。在你的回合结束时,如果这张牌在你的手牌中,你失去10金币。 | 无强化规则 | 保留末尾扣10金币、最低0;连续拖回合风险明示,不允许负金币。 |
## 6. 传统牌43项:注册10项+运行时补充33项
表内全部无额外强化,除杀与重杀已在现状注明。普通火/雷杀共享杀的ID与强化。补充33项并不代表已进入常规奖励;推荐保持隔离的牌也给出了具体理由。
| 卡牌/ID | 当前身份 | 当前效果 | V0.3建议及理由 |
| --- | --- | --- | --- |
| 杀<br>`sha` | 已注册 | 1费6/9;可闪,无次数限制。 | 保留;火杀/雷杀是同名属性变体,伤害基数相同,另测连环传导。 |
| 重杀<br>`mengsan_zhongsha` | 已注册 | 2费8/10,随后易伤2/3,按攻击范围直接伤害。 | 改1费7/9、易伤1/2;新开局替换低效决斗,仍先伤后易伤。 |
| 闪<br>`shan` | 已注册 | 0费响应杀;不能抵消普通脚本意图;无强化。 | 保留响应;新增主动1费得5甲并消耗本牌的可选用途,无强化。主动护甲不等于闪掉意图。 |
| 桃<br>`tao` | 已注册 | 主动1费回8;濒死响应不耗费也回8;无强化。 | 保留8;主动使用后消耗,救援响应不消耗;限制拖战反复回血但保留救援互动。 |
| 酒<br>`jiu` | 已注册 | 1费下一杀基数+1;自救回1,原生每回合限制;无强化。 | 主动仍1费、下一杀+3;自救改回4;只增强杀、不泛化到所有多段攻击。 |
| 过河拆桥<br>`guohe` | 已注册 | 1费弃对方区域1牌;不取消脚本意图;无强化。 | 保留;敌方追加杀如已预告可被拆掉,若未采用V0.2预告规则则收益较低。 |
| 无中生有<br>`wuzhong` | 已注册 | 1费抽2;无强化。 | 保留;腐化可使其0费但消耗,不能作为天然0费抽2分析。 |
| 决斗<br>`juedou` | 已注册 | 2费轮流响应杀,失败方受4;无强化。 | 改1费,失败方受8;保留双方手牌消耗与反伤风险;新开局移出,成为可选技巧牌。 |
| 八卦阵<br>`bagua` | 已注册 | 1费装备;需要闪时红判视为闪,不挡脚本意图;无强化。 | 保留原响应,新增候选被动:每次自身回合开始、清甲后,若八卦仍在装备区则获2甲;新开局暂移出以免误导。 |
| 的卢<br>`dilu` | 已注册 | 1费装备,其他角色计算到你距离+1;刘备首关固定来源;无强化。 | 保留距离;说明不挡意图,不追加永久减伤;首关教学奖励身份保留。 |
| 绝影<br>`jueying` | 运行时补充 | 1费装备,防御距离+1。 | 保留;不开放常规奖励,与的卢同槽避免重复稀释。 |
| 爪黄飞电<br>`zhuahuang` | 运行时补充 | 1费装备,防御距离+1。 | 保留;仅原生/剧情路径,不宣称抵挡意图。 |
| 赤兔<br>`chitu` | 运行时补充 | 1费装备,攻击距离-1。 | 保留;仅影响需要距离的牌,不提高全体攻击。 |
| 大宛<br>`dawan` | 运行时补充 | 1费装备,攻击距离-1。 | 保留;与赤兔同槽,不增加普通奖励占比。 |
| 紫骍<br>`zixin` | 运行时补充 | 1费装备,攻击距离-1。 | 保留;按原生范围,不做全攻击伤害加成。 |
| 诸葛连弩<br>`zhuge` | 运行时补充 | 1费装备,杀无次数限制;梦三杀本已不限。 | 暂不开放奖励;若后续纳入则重做为每自身回合首张杀费用-1、最低0,原无限次数在梦三无额外价值。 |
| 雌雄双股剑<br>`cixiong` | 运行时补充 | 1费装备,异性目标弃牌或令你摸1。 | 保留原生,暂不开放奖励;怪物性别条件与摸牌次数需实测。 |
| 青釭剑<br>`qinggang` | 运行时补充 | 1费装备,杀暂时忽略目标防具技能。 | 保留;不等于忽略护甲值或滑溜,说明明确。 |
| 青龙偃月刀<br>`qinglong` | 运行时补充 | 1费装备,杀被闪后可追杀。 | 保留;追杀仍是实体杀,不得绕过本次行动的费用与出牌限制。 |
| 丈八蛇矛<br>`zhangba` | 运行时补充 | 1费装备,可2手牌转杀。 | 保留;状态/诅咒是否允许作为材料按不可打出资格校验,禁止无代价绕过污染。 |
| 贯石斧<br>`guanshi` | 运行时补充 | 1费装备,杀被闪后弃2牌强制命中。 | 保留;弃2是实际资源成本,不按无条件命中平衡。 |
| 方天画戟<br>`fangtian` | 运行时补充 | 1费装备,最后手牌杀可多选至多2目标。 | 保留;费用仅一次,按最多3目标计伤,暂不开放常规奖励。 |
| 麒麟弓<br>`qilin` | 运行时补充 | 1费装备,杀伤害后可弃目标坐骑。 | 保留;仅有坐骑遭遇有价值,不能填入通用奖励。 |
| 寒冰剑<br>`hanbing` | 运行时补充 | 1费装备,可取消杀伤害改弃2牌。 | 保留;弃牌不取消意图,避免AI总选弃牌拖战。 |
| 仁王盾<br>`renwang` | 运行时补充 | 1费装备,黑杀无效。 | 保留;脚本意图没有黑色杀性质,仍正常受伤。 |
| 五谷丰登<br>`wugu` | 运行时补充 | 1费,所有角色各选公开牌1张。 | 保留但不开放玩家常规池;公共牌堆与个人牌堆归属必须先明确。 |
| 桃园结义<br>`taoyuan` | 运行时补充 | 2费所有角色各回8,含敌人。 | 保留现值及全体目标;暂不开放常规奖励,不能当纯友方治疗。 |
| 南蛮入侵<br>`nanman` | 运行时补充 | 2费所有其他角色响应杀,否则4伤,含友军。 | 保留隔离;若正式入玩家池,单独试仅敌方、2费6伤响应杀,不与当前值混用。 |
| 万箭齐发<br>`wanjian` | 运行时补充 | 2费所有其他角色响应闪,否则4伤,含友军。 | 保留隔离;若正式入玩家池,单独试仅敌方、2费6伤响应闪。 |
| 顺手牵羊<br>`shunshou` | 运行时补充 | 1费,距离1取对方区域牌1张。 | 保留;偷到未注册原生牌仅战斗内可用,不直接写永久牌组。 |
| 借刀杀人<br>`jiedao` | 运行时补充 | 1费,令持武器者出杀,否则移交武器。 | 保留且隔离奖励;命令的杀与费用归属需覆盖友军/敌军两种情况。 |
| 无懈可击<br>`wuxie` | 运行时补充 | 0费响应锦囊;不取消脚本意图。 | 保留;不作为Boss意图万能取消牌,暂无永久奖励。 |
| 乐不思蜀<br>`lebu` | 运行时补充 | 1费判定非红桃跳过出牌阶段。 | 保留隔离;先验证意图是否位于该阶段,不能默认完整击晕Boss。 |
| 闪电<br>`shandian` | 运行时补充 | 1费延时,黑桃2—9命中12雷伤,否则传递。 | 保留隔离;记录无来源伤害与连环效果,不作为稳定12伤。 |
| 骅骝<br>`hualiu` | 运行时补充 | 1费装备,防御距离+1。 | 保留;与其他防御坐骑同槽,不新增奖励重复。 |
| 白银狮子<br>`baiyin` | 运行时补充 | 1费装备,每次伤害超过1改为1;失去装备回1。 | 禁止常规获得及随机生成;若今后正式开放,改每段攻击减2、最低1,失去回2,避免单体Boss攻击被压成1。 |
| 藤甲<br>`tengjia` | 运行时补充 | 1费装备,普杀及南蛮万箭无效,火伤+1。 | 保留原生隔离;不当全攻击免疫,属性风险说明。 |
| 古锭刀<br>`guding` | 运行时补充 | 1费装备,对空手目标杀伤害+1。 | 保留原生隔离;后续入池才试+3,先不全局抬高怪物武器伤害。 |
| 朱雀羽扇<br>`zhuque` | 运行时补充 | 1费装备,普杀可变火杀。 | 保留;连环传导按独立伤害事件实测,不凭属性额外加裸伤。 |
| 火攻<br>`huogong` | 运行时补充 | 1费展示目标牌、弃同花色后4火伤。 | 暂不开放奖励;若纳入玩家池建议6火伤并抽1,仍有花色成本,当前基数传入路径另验。 |
| 铁索连环<br>`tiesuo` | 运行时补充 | 1费可横置至多2角色,可重铸。 | 保留隔离;必须验证重铸费用与个人牌堆摸牌,不能作为免费循环入口。 |
| 兵粮寸断<br>`bingliang` | 运行时补充 | 1费距离1,非梅花跳过摸牌。 | 保留;只限摸牌,不默认压制意图;不要混入普通构筑奖励。 |
| 木牛流马<br>`muniu` | 运行时补充 | 1费宝物,原生储牌/转移机制。 | 保留隔离;个人牌堆所有权、转移和退出战斗清理验收前不开放玩家永久获得。 |
## 7. 联合验算:卡牌必须放进敌人行动循环
下列为无额外遗物、无随机响应干扰的条件算例,不能当作实际胜率。所有例子同时约束费用、手牌和目标,不允许分别取最佳输出与最佳防御拼成不存在的一回合。
### 7.1 三费回合能否形成有效攻防
| 牌序/条件 | 费用 | 输出与防御 | 意义与边界 |
| --- | ---: | --- | --- |
| 燃烧→双重打击→防御,均普通 | 3 | 得2力;(5+2)×2=14伤;5甲 | 成长回合仍有少量防御,三张必须实际在手 |
| 耸肩无视→铁斩波→杀,均普通 | 3 | 8+5=13甲;5+6=11潜在伤;耸肩抽1 | 杀可被闪,11不是保证伤害;必须抽到可用牌 |
| 本版重杀→双重打击→防御 | 3 | 7+ceil(5×1.5)×2=23伤;5甲 | 同手牌可杀18—23血刺客;目标必须在重杀距离内,且无人工制品挡易伤、无减伤 |
| 当前重杀→双重打击 | 3 | 8+8×2=24伤;0新增甲 | 当前2费重杀让同类集火失去防御余地;不是简单把玩家总输出抬高 |
| 放血→御血术→怨恨 | 支付1,放血另得2 | 主动失血共5;15+5×2=25伤,余费供后续行动 | 未预设撕裂/遗物;须实际同时抽到,失5血不能算成免费 |
| 祭品普通 | 0 | 失6血、得2费抽3、消耗 | 资源供给明显,但入场低血可能直接致死,不能从“净产费”推断必选 |
当前劫掠者刺客+斧手+弩手首轮意图为10+5+0=15;若在敌人行动前用上表候选23伤确实击杀刺客,则剩余原始意图5,5甲可覆盖。**这只验证一个首轮窗口**:未计敌方追加杀、响应、座次、状态和抽不到牌;第二轮仍要按剩余敌人的循环计算。
### 7.2 多段、消耗与自残的量级
- 普通焚烧无力为2×4=8/敌;2力量后为4×4=16/敌,三敌总48。不能拿“8点基础伤害”证明它弱,也不能拿三敌48伤判断单Boss输出。
- 飞剑普通在单敌且3次均命中时,2力为(3+2)×3=15;三敌时伤害分散,不能假设15全部打中最危险目标。
- 灰烬打击消耗3张时为6+3×3=15,强化为18;契约终结建议此时全体14/强化18。前者可持续单体,后者群体免费但需要门槛,不能两者一起无条件砍低。
- 扯碎当前在本场实际失血8次、力量3时,普通为(5+3)×9=72;本版5段上限下为40。8次失血不必等于8点血,必须记录来源与代价;此项调整应在敌方规则改善后试。
- 痛殴若吸收一张高伤牌,当前增长同时加到两段上,又可在之后继续吃力量;本版只吸收基础单段且累计上限12/18,是为限制重复放大,而非取消成长路线。
- 黑暗镣铐建议减4力:当前异蛙4×4可降至0×4,墨影26单段只降到22。多段被克制是合理特色,但还需计其他敌人、追加攻击和人工制品。
- 火焰屏障普通12甲/反伤4,面对4×4意图:若四段都产生有效反击事件,最多反伤16,刘备该组意图损4血。是否每段都触发需实机验收;不得在源码假设之外保证全额反伤。
### 7.3 三个Boss的卡组检验点
| Boss | 当前已核对压力 | V0.2候选环境 | V0.3卡组验收 |
| --- | --- | --- | --- |
| 墨影 | 173HP、初始滑溜9,第三轮26,另有原生出牌变量 | 150HP、滑溜4、第三轮18;明确单体/全体及预告杀 | 不依赖指定金卡也有多段/清污方案;不能用白银狮子将大招恒定压成1来证明通过 |
| 仪式兽 | 252HP、一阶段18并逐次加2力;转阶段限制出牌 | 180HP、108阈值、一阶段14并加1力 | 4轮内实际打72是目标;昏眩回合只准一次主动行动,不能偷塞“先抽再防”两步 |
| 同族 | 神官190、两随从各58—59;三者循环叠加 | 神官140、两随从各24—28;无自由追加牌 | 检查前两轮减员是否依赖事件爆卡;本版23伤普通牌序尚不能单独保证击杀满血28随从,需助战/强化/其他伤害 |
| 异蛙精英 | 本体61—64,亡语四虫各17—21;4段攻击及污染 | 本体58—60,虫各12—14;塞2感染 | 检查首阶段是否耗尽群攻与防御;清本体不代表结束战斗 |
关张支援不是恒定DPS:到场、手牌、自己的费用、伤害目标、行动顺序与是否濒死都要记录。单独刘备、带关羽、带张飞分别评估,不以全员理想行动掩盖独行失败。
## 8. 调整优先级与实验顺序
### 第一批:先解决规则与来源,尽量冻结裸数值
1. 修正凌虐减力、群起攻之窗口、拦截说明及支援护甲时序。
2. 明确普通奖励/随机生成排除项,隔离白银狮子、孤注一掷及事件/古老捷径。
3. 统一X支付、回声、实体复制、消耗资格和本回合判定;生成状态不能当永久牌组资产。
4. 记录当前敌人整轮意图+原生主动牌,不用屏幕上单个意图数字代替实际压力。
### 第二批:联合敌人规则试卡池
- 先采用V0.2的预告与单体/全体规则,再试本版12张起手、重杀、血墙及防守支持。
- 零费循环优先试亮剑、妙计、急躁、深谋远虑、资源牌消耗;只在同一种子和同一获得路径比较,不将牌组变化混作操作差异。
- 自残上限、扯碎、痛殴、欺凌/主宰等分组试;若削弱后成长路线明显无法达成Boss击杀窗口,先回调本组,不用降低所有敌人掩盖。
- 最后试无色高费牌的启动费用、事件爆发和诅咒负担;跨关治疗必须在战斗生存成立后评价。
### 第三批:验证收益差异,再决定保留哪些候选
| 记录项 | 建议首轮判据 |
| --- | --- |
| 覆盖 | 252项每项有现状与结论;普通/强化、有无助战、手牌空与满等边界按能力覆盖 |
| 攻防同手资源 | 正常3费回合至少存在一条有效进攻兼防御的牌序;实际抽不到时记录卡手而非默认可用 |
| 对局 | 12组固定种子作初筛,独行/关羽/张飞;Boss按力量、消耗、自残、防御四路线、30/45入场生命交叉 |
| 群怪 | 劫掠10组合、三墨宝、史莱姆、异蛙亡语;记录首次减员轮次与付出的生命 |
| 循环 | 无零费“回到同状态且伤害/护甲/能量净增”的可重复闭环;不是等跑到1024安全限制才算结束 |
| 一次性高价值 | 单张可改变一轮,但需占抽牌、费用、生命、消耗或定向获得成本;事件牌不作所有牌的标杆 |
| 跨关 | 战斗毛扣血、实际治疗、战后回复、最大生命增长、金币获取分开;召唤物不得成为无限资源农场 |
| 玩家体验 | 额外伤害全部可解释;被削联动上限可见;持续时间与实际行动顺序一致 |
V0.2的暂定耗血目标继续作参照:弱战4—10、强战8—16、精英14—24、Boss20—32,均指战中实际生命损失总量且未加回治疗。它们是校准目标,不是当前测试结果或对所有种子的保证。不发布由少量固定种子算出的“精确通关率”。
## 9. 证据、未决问题与实施边界
### 9.1 已完成的文档核对
- 从纯数据模块读取注册表、费用、强化与卡牌定义,逐一核对覆盖;219个注册ID全部进入本表,另补33个运行时原生ID。
- 对普通/强化字段进行比对,保留疯狂科学不同ID;退休牌、属性杀与生成牌单独说明,避免虚增数量。
- 读取刘备普通/高级运行时及共享运行时,重点核对消耗、失血、生成、复制、支援、减力、回收与Boss相互作用。
- 复核关键算术与引用路径。本轮未运行自动战斗或真实游戏,不把源码阅读称作全卡实机验收。
### 9.2 不应掩盖的未决点
- 原生装备、延时锦囊和响应事件受引擎时序影响;本版给出保留/隔离/重做方向,不能据描述推断其全部实战分支。
- 火攻在模式层设置baseDamage,但原生内容是否正确取到该值需专项验证;不在此宣布已经造成4伤或已经修复。
- 自动打牌与仪式兽昏眩/凡庸的交互需统一:建议自动使用也消耗允许的主动出牌额度,原生响应不计;回声是否允许属于独立规则,建议每次回声计一次并在超限时取消。正常X支付快照不会覆盖限额。
- 狂宴、贪婪之手对真实敌人和召唤单位的奖励,需要新的“召唤/亡语来源”资格判断;当前不声称已经有防刷限制。
- 凋萎包含独立敌人成长字段,实际为3+3×层数,不能将静态说明的3当永久固定值。
- 拟态/拳斗/支援护甲取值、无实体对直接失血的作用、回声复制原牌强化等,须以实际事件序列验证。
- 当前表中事件ID的存在仅证明已实现/已注册,不能证明地图内每个事件都可获得。后续需逐一映射来源;本轮不虚构获得概率。
- 未评估全部遗物排列组合。至少对增费、抽牌、回甲、消耗和伤害倍率遗物各选代表做交叉测试,不能把裸卡参数称为全系统平衡完成。
### 9.3 实施入口
| 事项 | 当前文件 |
| --- | --- |
| 全卡注册与可获得资格 | [card-definitions.js](../cards/card-definitions.js)、[card-pools.js](../cards/card-pools.js) |
| 卡包数据聚合 | [packs/data.js](../cards/packs/data.js)、[packs/index.js](../cards/packs/index.js) |
| 刘备68张数据牌 | [data.js](../cards/packs/liubei/data.js)、[advanced-data.js](../cards/packs/liubei/advanced-data.js) |
| 刘备25张原有牌及重杀 | [legacy.js](../cards/packs/liubei/legacy.js)、[metadata.js](../cards/packs/liubei/metadata.js) |
| 刘备效果、条件、复制与回声 | [runtime.js](../cards/packs/liubei/runtime.js)、[advanced.js](../cards/packs/liubei/advanced.js) |
| 无色/事件/状态/诅咒 | [colorless](../cards/packs/colorless/data.js)、[event](../cards/packs/event/data.js)、[status](../cards/packs/status/data.js)、[curse](../cards/packs/curse/data.js) |
| 共用卡牌执行与支援 | [shared/runtime.js](../cards/packs/shared/runtime.js)、[temporary-strength.js](../cards/temporary-strength.js) |
| 奖励入口 | [刘备奖励](../cards/packs/liubei/rewards.js)、[无色奖励](../cards/packs/colorless/rewards.js) |
| 费用、强化、新开局 | [combat-rules.js](../battle/combat-rules.js)、[upgrades.js](../cards/upgrades.js)、[starting-deck.js](../cards/starting-deck.js) |
| 状态成长、战后效果、退休牌 | [wither-card.js](../cards/wither-card.js)、[shared-battle-end.js](../cards/shared-battle-end.js)、[retired-cards.js](../cards/retired-cards.js) |
| 模式原生牌覆写 | [mode-cards.js](../cards/mode-cards.js)、[标准牌](../../../../card/standard.js)、[军争牌](../../../../card/extra.js) |
| 怪物与意图 | [monster.js](../monsters/monster.js)、[intent-effects.js](../battle/intent-effects.js)、[actions.js](../monsters/actions.js) |
本版交付的是**全卡逐项、有规则前提的联合调整草案**。建议先实施规则和获取资格,再逐批验证卡牌数值;不建议一次性套用252项中的全部候选改动。
+6 -3
View File
@@ -87,10 +87,13 @@ battlePlan: {
行囊的“战斗支援”显示来源名称和持续场数。羁绊助战单独在行军菜单
“羁绊”中管理,规则和配置见 [bonds.md](bonds.md)。
## 已接入的示例
- 林中伏兵“主动追击”:两名初始敌人,第 3 轮必定出现一名敌军援军。
## 林中伏兵配置示例
「林中伏兵」已在第一章内容表中注册,当前新征程没有地图或随机事件入口。以下规则描述的是其剧情配置:
- 「主动追击」有两名初始敌人,第 3 轮出现一名敌军援军。
- 敌军队长体力不高于 2 时摸两张;主角手牌不多于 1 时补两张,各限一次。
- 斥候谢礼奖励池加入“道具·斥候援令”,本征程后续每场由友方张辽参战。
- 斥候谢礼奖励池含「斥候援令」,第一章宝箱奖励池也包含该道具。领取后,本次征程后续战斗由友方张辽支援。
## 结算和清理
仅主角死亡判负;存活友军不阻碍胜利。清空敌军且没有必须等待的敌军规则后判胜。
+1 -2
View File
@@ -3,8 +3,7 @@
## 当前规则
- 行军菜单 → 羁绊:可结识多名 NPC,但只能指定一名助战;允许不指定。
- 羁绊仅随本次征程保存,新征程重置。刘备先天技能“桃园羁绊”
初始结识 `guanyu`、`zhangfei`,均为 8 级、升级进度 0%,默认未指定助战。
- 羁绊仅随本次征程保存。刘备新征程通过「桃园羁绊」初始结识 `guanyu`、`zhangfei`,均为 8 级、进度 0%,首次默认指定关羽。旧档已结识关羽且尚未做过默认初始化时,只有未指定助战才补选关羽。初始化后,主动取消或改选都会保留。
- 普通事件结识默认 1 级、进度 0%。每级助战概率为 `(level - 1) / 9`,
1 级为 0%,10 级为 100%。
- 战前在地图切换助战;开战只判定一次。成功后占玩家下家,AI 自动行动。
+4
View File
@@ -2,6 +2,8 @@
只影响梦三模式,不修改 noname 的标准/军争原始牌包。`cards/mode-cards.js` 从标准、军争实体牌列表逐一复制模式专属定义,沿用原牌名以保留响应、装备、转化兼容性;图鉴说明在梦三模式覆盖。新征程的界刘备为 50/50 生命,默认每回合摸 2 张、手牌上限 3、回合费用恢复至 3。主动使用牌消耗费用,转化牌按转化后的牌名计费;响应【闪】、救援【桃】等不消耗费用。默认主动牌 1 费,`battle/combat-rules.js` 中列出例外。【杀】1 费、可多次使用,牌定义的基础伤害为 6;【桃】及【桃园结义】回复 8 点生命;【南蛮入侵】、【万箭齐发】、【决斗】、【火攻】基础伤害 4,【闪电】命中伤害 12。其余卡牌保留原有效果,并加上梦三费用与图鉴说明。
新档刘备的专属起始牌组共 11 张,包括 5 张【杀】、2 张【防御】和【闪】【桃】【无中生有】【决斗】各一张。强化只能用于有规则且尚未满级的牌,永恒词缀限制移除和变化,仍可强化。
## 怪物
梦三模式护甲不设数值上限,玩家、敌人和友方单位均适用;
@@ -11,6 +13,8 @@
`monsters/monster.js` 的 `Monster` 类统一提供阶级默认值。普通/精英/Boss 分别每回合摸 1/2/3 张、手牌上限 3/5/7、回合费用 2/3/4。每名敌人拥有自己的抽牌堆、弃牌堆与手牌;怪物默认使用阶级牌堆,不再从公共牌堆摸牌。羁绊助战使用各自专属牌堆;其他友方支援仍用公共牌堆。
通用怪物意图对全部存活敌对角色逐个结算伤害与负面效果,己方增益只结算一次。常规意图在出牌阶段前消耗 1 费用,怪物可以继续按剩余费用主动用牌。
`HEALTH` 为目前各敌人的独立生命值;新怪物未配置时使用阶级兜底生命值。`OpeningSoldier extends Monster` 是继承示例;新子类在 `MONSTER_TYPES` 注册。关卡单位可以写 `tier`、`hp/maxHp`、`draw`、`handLimit`、`energy`、`deck` 覆盖默认值;`deck` 可为牌名数组(如 `deck:["sha","shan","tao"]`),也可用 `{name,suit,number}` 指定单张牌。牌名必须在 noname 中存在。
## 配置位置
@@ -0,0 +1,137 @@
# 梦三与刘备玩法调整方案 V0.1
本稿保留 2026-10-30 的提案基线,供 [V0.2](liubei-gameplay-and-balance-proposal-v0.2-20261030.md) 对照。现行开局及奖励见[刘备首关配置](liubei-opening.md),现行助战见[羁绊与助战](bonds.md)。
- 日期:2026-10-30
- 状态:策划提案,尚未实施
- 依据:当前项目源码与配置,尚未进行实战采样
- 适用范围:梦三模式中的刘备、先天关张助战及相关构筑
建议把刘备定位为“能独立作战、通过仁德调度关张的协同型主角”,保留现有力量、自损、消耗牌组作为构筑分支。
本文中的建议数值需要通过对局验证;生成本文档不代表已经修改游戏机制,也不代表完成实机验收。
## 一、简单评估
梦三已经具备个人牌库、费用、怪物意图、地图选择、遗物和羁绊,足以支撑“战斗—构筑—路线选择”的基本循环。当前更值得优先处理的是角色特色和资源分配。
| 方面 | 当前情况 | 策划判断 |
| --- | --- | --- |
| 刘备特色 | 先天结识关张,但专属牌主要围绕力量、自损、消耗 | 角色技能与牌组之间缺少直接联系 |
| 玩家操作 | 3费用,默认每回合摸2张,手牌上限3 | 响应牌也占用手牌,可能出现有费用却缺少主动选择 |
| 关张差异 | 基础属性、默认牌库和意图相同 | 更换助战缺少战术意义 |
| 战斗波动 | 初始8级助战到场概率为77.78% | 重要战斗可能因助战缺席产生明显波动 |
| 回复收益 | 休息基础回复8;初始遗物每战结束回复6 | 休息的机会成本偏高,值得重新测试 |
助战的群伤尤其需要关注:当前一次6点群体意图面对3名敌人,可以造成合计18点基础伤害,随后还可以继续出牌。这个收益会随敌人数增长,不能只按“6点伤害”估价。此处为不计力量、易伤、护甲等修正的数值举例,不是实测平均伤害。
## 二、刘备玩法方向
核心体验:**刘备决定资源交给谁、何时防守、集火哪个敌人,关张负责兑现不同的战术收益。**
建议先保留两条主要路线:
| 路线 | 核心打法 | 助战选择 | 代价 |
| --- | --- | --- | --- |
| 协同破阵 | 刘备施加易伤、提供手牌,集中消灭关键敌人 | 关羽 | 清理大量小怪较慢 |
| 坚守清场 | 刘备积累防御、处理杂牌,让助战持续压制群敌 | 张飞 | 单体爆发较弱 |
现有自损、力量、消耗体系保留为进阶构筑。先让基础协同成立,再逐步加入“刘备承担代价、换取团队收益”的专属牌。
## 三、核心机制调整
新增先天技能「仁德」:
> 每个自身出牌阶段限一次,消耗1费用,将一张可转移的非状态、非诅咒手牌交给另一名友方角色;然后自己摸1张牌,获得5点护甲。
> 没有其他存活友方时,改为弃置一张符合条件的手牌,获得相同收益。
设计目的:
- 有助战时,可以把攻击牌交给关张,自己承担防守。
- 独自作战时,仍可整理手牌。
- 与普通「防御」相比,同为1费用、5护甲;额外收益来自调度手牌,但每回合只能使用一次。
- 转交不视为使用或响应,不触发该牌的使用效果;费用和手牌必须同时满足才能发动。
先维持刘备**50生命、3费用、每回合摸2张、手牌上限3**,观察仁德是否已经改善缺牌问题,避免同时提高所有资源。
## 四、第一轮数值平衡
以下数值作为一组测试配置,与当前版本对照。实际实施时仍按第六节分阶段验证。
| 项目 | 当前值 | 建议值 | 目的 |
| --- | --- | --- | --- |
| 刘备先天关张到场 | 初始8级,77.78% | 可参战且未濒死时100%;首战限制保留 | 让角色核心能力可靠 |
| 关张每回合费用 | 3 | 2,意图仍消耗1 | 降低助战替玩家完成战斗的程度 |
| 关张每回合摸牌 | 2 | 1 | 让仁德送牌具有实际价值 |
| 关张初始手牌 | 4 | 3 | 收紧开场爆发 |
| 关张手牌上限 | 5 | 4 | 仍允许保存玩家交来的牌 |
| 关羽最大生命 | 各等级40 | 30+等级,初始8级为38 | 等级提供小幅、确定的成长 |
| 张飞最大生命 | 各等级40 | 34+等级,初始8级为42 | 承担更持久的群战 |
| 休息基础回复 | 8 | 最大生命的30%,向上取整 | 50生命时回复15,让休息值得选择 |
关张的确定到场规则仅作用于刘备先天羁绊。等级和现有成长进度保留,等级收益由到场概率转为上述生命成长。
关张意图改为各自循环:
| 角色 | 第一次行动 | 第二次行动 | 第三次行动 |
| --- | --- | --- | --- |
| 关羽 | 单体7伤害 | 自身获得6护甲 | 单体10伤害 |
| 张飞 | 对全部敌人各造成3伤害 | 自身获得6护甲 | 对全部敌人各造成4伤害 |
关羽优先攻击刘备上一回合最后攻击的存活敌人;没有有效目标时,攻击生命最低的敌人。张飞负责群体压制。
这些意图替换当前默认循环,并保留之后用剩余费用出牌的行为。面对3名敌人时,张飞第一次意图基础总伤害为9,低于当前的18;确定到场则减少了整体体验的波动。
## 五、初始牌组与高风险卡牌
初始牌组继续保持12张:
**4杀+3防御+1闪+1桃+1无中生有+1八卦阵+1重杀。**
具体是将当前的一张杀换成防御,将决斗换成重杀。这样新征程较早阶段即可体验“防御、施加易伤、关羽跟进”的基本配合。杀、防御、重杀的基础数值暂时保持。角色专属首战仍按现有限制不触发羁绊助战;关羽跟进的配合在后续允许助战的战斗中体验。
两张专属牌优先测试:
| 卡牌 | 当前效果 | 建议调整 |
| --- | --- | --- |
| 炽焰 | 2费,给予另一友方5/7力量 | 改为3/4力量;费用保持 |
| 扯碎 | 2费,每次实际失血额外攻击一次,没有设计上限 | 最多额外攻击5次;每段伤害保持5/7 |
表中的“5/7”等数值按未强化/强化顺序列出。扯碎上限仅针对额外段数,基础1段保留,即最多6段;其他伤害修正照常结算。
炽焰的力量会被多段、群体攻击放大,需要随助战体系一起评估。扯碎则保留成长爽点,但避免通过拖长战斗无限增加段数。
初始遗物每战回复6点、自损牌的生命代价先保持,避免这一轮同时改变过多续航来源。
## 六、验证与实施顺序
先收集当前版本基线,再测试调整版。使用相同地图种子和遭遇,分别覆盖单体、群怪、精英、Boss,以及助战濒死后的独立作战。
重点记录:
- 刘备每回合剩余费用,以及“有费用却无有效牌”的次数。
- 刘备与助战各自的伤害占比、战斗回合数。
- 每场损失生命及战后回复后的净损失。
- 关羽、张飞在不同遭遇中的选择价值。
- 仁德使用率、送出的牌是否被有效使用。
首轮暂定目标:普通战斗约3—5个刘备回合;助战伤害占比中位数约25%—40%;关羽在单体战更有效,张飞在群怪战更有效。这些是调参目标,不是当前实测结果。
落地顺序建议为:**先测试助战与初始牌组数值,再加入仁德,最后调整专属牌和休息收益。** 每一步保留对照数据,确认收益来自哪里,再决定是否调整怪物强度。
## 七、当前配置依据
以下链接指向项目实际文件,便于后续实施时重新核对。本文记录的是编写时观察到的配置,源码后续可能变化。
- [刘备属性与先天技能](../content/scenario-characters.js)
- [费用、手牌上限与基础伤害](../battle/combat-rules.js)
- [刘备初始牌组](../cards/starting-deck.js)
- [关张基础属性与成长配置](../bonds/definitions.js)
- [助战概率、初始化与成长](../bonds/state.js)
- [默认助战意图及费用](../bonds/intents.js)
- [意图的敌对目标与效果结算](../battle/intent-effects.js)
- [炽焰、扯碎等专属牌数值](../cards/packs/liubei/data.js)
- [专属牌实际结算与失血次数统计](../cards/packs/liubei/runtime.js)
- [休息回复](../relics/rooms.js)
- [燃烧之血回复规则](../relics/rules.js)
- [新征程初始遗物授予](../progression/state.js)
@@ -0,0 +1,391 @@
# 梦三与刘备玩法调整方案 V0.2:敌人、意图循环与 Boss 联合平衡
本稿保留 2026-10-30 的平衡基线和候选参数。普通意图仍逐个结算存活敌对单位,关张仍按照当前羁绊等级判定到场。本稿的单体目标、锁定追加杀及关张差异化方案仍为提案。现行流程见[战斗规则](combat-rules.md)和[羁绊与助战](bonds.md)。
- 日期:2026-10-30
- 状态:策划提案;建议参数尚未实施,也未完成游戏内验证。
- 范围:当前第一章、刘备、关张助战、4种弱池遭遇、12种强池遭遇、3种精英与3种 Boss 遭遇,以及它们的随从。
- 前版:[V0.1](liubei-gameplay-and-balance-proposal-20261030.md)。本版与前版冲突时以本版建议为准,V0.1 保留作对照。
- 证据:当前本地源码。下文的逐轮数据是规则推算,不是自动对局胜率;没有以外部游戏原版的数值证明梦三平衡。
## 1. 对 V0.1 的修正
V0.1 没有充分考虑怪物,不能直接作为平衡改动清单执行。它主要讨论玩家、助战和回复,遗漏了以下约束:
1. 怪物的攻击意图目前通常作用于全部存活敌对角色,刘备和助战各承受完整伤害;助战到场并不分摊刘备受到的意图伤害。
2. 意图通常只花1费用,之后仍能主动出牌。普通/精英/Boss 原有费用为2/3/4;图标上的意图伤害不等于整回合伤害。
3. 力量按攻击段数放大;增益招式后的原生攻击牌会立即享受新力量,不能把增益轮直接当作安全轮。
4. 血量之外,还有滑溜、护甲、回复、缩小、缓慢、伤口、感染、亡语和胜利条件。它们会改变击杀速度或实际生存空间。
5. 多敌人的循环会在某一轮叠出峰值,不能把单只怪物平均伤害相加后就判定合理。
6. V0.1 同时削减助战费用、摸牌、起手和攻击,缺少玩家能否承受后续怪物的依据;仁德换牌也不增加净手牌数量。
本版采用“先计算敌方整轮压力,再决定玩家可承担的防御成本和击杀时间”的方法。所有新规则均为策划建议,不能读成已经存在的机制。
## 2. 当前战斗规则及计算口径
### 2.1 已核对的事实
| 项目 | 当前实际规则 | 对平衡的影响 |
| ------------ | ----------------------------------------------------------------- | ------------------------------------------------------------ |
| 刘备 | 50生命,3费用,默认摸2张,手牌上限3 | 不能默认每轮都有3张主动牌,更不能把3费用全部算作攻击 |
| 防御与回复 | 防御1费获得5护甲,强化为8;桃回复8;燃烧之血战后回复6 | 战后回复救不了战斗中的致死峰值 |
| 护甲 | 通常在持有者下次主循环回合开始时清除;保留类效果例外 | 护甲不能当作跨轮累计生命;给即将行动的助战护甲,可能先被清除 |
| 意图攻击 | 直接造成攻击伤害,没有【杀】的【闪】响应过程 | 不能把手中的闪自动算作抵消一次意图 |
| 普通敌人 | 摸1、上限3、费用2;大部分初始4张 | 意图后通常还留1费用 |
| 精英 | 摸2、上限5、费用3 | 意图后通常还留2费用 |
| Boss | 摸3、上限7、费用4 | 意图后通常还留3费用 |
| 关张 | 当前均40生命、起手4、摸2、上限5、费用3 | 两人尚无数值与意图差异 |
| 当前敌方牌组 | 包含杀、闪、桃、酒,较高阶还有决斗、无中、过河 | 原生出牌、响应及治疗都是额外变量 |
| 第一章 | 前3场普通胜利用弱池,之后用强池;专属首战不计数;当前章末结束内容 | 不能把第二、三章占位配置当成当前连续难度曲线 |
来源:[战斗费用](../battle/combat-rules.js)、[卡牌效果](../cards/mode-cards.js)、[怪物属性与牌组](../monsters/monster.js)、[主循环与状态](../mode.js)、[普通胜场计数](../progression/encounter-progress.js)、[第一章地图](../content/acts/act1/map.js)。
### 2.2 应计算什么
以“刘备行动开始,到刘备下一次行动开始”为一轮,同时记录每个敌人实际执行的行动次数。下列简化表假设没有额外回合、击晕、提前死亡、反伤中断和异常状态;有这些效果时必须按实际行动重算。
- 每段攻击先计基础伤害与力量,再计虚弱、缩小,之后计目标易伤等修正。虚弱与缩小分别向下取整,易伤向上取整,不能先把所有段数合并再取整。
- 基础攻击修正示例:`每段 = ceil(floor((基础伤害 + 力量) × 0.75) × 1.5)`,仅适用于同时有虚弱和易伤、没有其他修正的情况。
- 一轮总压力 = 全部实际命中的意图伤害 + 实际命中的手牌攻击 + 感染/紧缠等额外伤害。
- 生命损失按事件顺序抵扣当时护甲;不把同一份护甲重复用于多个敌人。没有中途增减护甲等效果时,才可简化为 `max(0, 本轮可抵扣伤害合计 - 本轮护甲)`。
- 击杀所需时间同时取决于有效生命和实际输出。普通 `HP÷每轮输出` 只作估算;滑溜要数命中事件,雕像要数前置出牌,亡语要算下一批敌人。
- 单独记录刘备和助战生命。当前全部意图打全队时,增加队友会增加队伍总承伤,不会降低刘备承伤。
**例如多尼斯异鸟3段啄击,+3力量后为6×3=18;若目标同时易伤,则9×3=27。绝不能算成9+3=12。**
来源:[意图执行](../battle/intent-effects.js)、[意图伤害](../battle/intent-damage.js)。
## 3. 当前普通怪物:血量、循环与压力
以下数值均为当前值。`→循环`表示回到循环首项;“+力”在该次攻击结算后获得,除非注明开场增益。伤害均为单个目标承受的基础值,当前通常每名友方各受一份。HP范围采用入场随机函数,不用资料页中间值冒充固定血量。
| 敌人 | 当前HP | 当前意图与附加机制 | 主要问题 |
| ------------- | ------------------------------ | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| 首关士兵 | 24 | 没有这批怪物的专属意图;依靠原生手牌、坐骑 | 单独作为教学战评价,不套专属意图伤害公式 |
| 毛绒伏地虫 | 55—57 | 酸液4→力量+7→酸液4→循环 | 实际前6次意图伤害4、0、11、11、0、18;第2次加力后仍可能出杀13 |
| 小啃兽 | 42—46 | 顶撞12→斩击6并护甲5→力量+2→循环 | 弱池首轮12,仍可能追加杀;双只从斩击、哈气错位开场 |
| 缩小甲虫 | 38—40 | 首次缩小,此后7与13交替;缩小令攻击伤害降低30%,源死亡解除 | 把玩家输出降低后,还按原DPS估计战斗时长会偏乐观 |
| 树叶史莱姆·小 | 11—15 | 每次等概率冲撞3或塞1黏液 | 随机重复塞牌拖慢循环 |
| 树叶史莱姆·中 | 32—35 | 塞2黏液→攻击8→循环 | 群怪战的卡手压力不能只计为0伤害 |
| 树枝史莱姆·小 | 7—11 | 每次攻击4 | 单只不高,和大怪同步时要合计 |
| 树枝史莱姆·中 | 26—28 | 首次塞1黏液,之后攻击11;黏液不连用,攻击最多连用两次 | 连续两轮11是实际允许分支 |
| 飞蝇菌子 | 48 | 猛砸11不连用;孢子8并2脆弱,间隔至少2次;2易伤第二次起可用,间隔至少3次 | 与同行怪物叠加易伤/脆弱,且座次决定当轮谁吃到增益 |
| 闪光贾克斯果 | 31—33 | 每次攻击3,之后力量+2 | 意图前4轮3、5、7、9;加力同时提高当轮后续杀 |
| 立柱构造体 | 65;初始13护甲、1人工制品 | 首次力量+2;以后攻击7并+2力、攻击7并+2力、5×2循环 | 实际前4次0、9、11、22;13初始护甲通常到其首回合开始被清除,并非永久加血 |
| 雾菇 | 74;眼6 | 首次召眼;重击8并+1力,最多连用两次,再头槌14;眼每次塞3晕眩 | 眼不必击杀才能获胜,但放任会降低摸到有效牌的概率 |
| 蛮兽 | 72 | 首次4×2;之后与14重击及一次性3易伤怒吼按约束抽选,同种攻击不连用 | 易伤后的14变21,仍未计额外出牌 |
| 藤蔓蹒跚者 | 61 | 6×2→8并1缠结→16→循环 | 缠结让下一次应对大伤害时攻击牌加费,抢杀能力下降 |
| 蛇行扼杀者 | 53—55 | 叠3紧缠→等概率7并护甲5或12→循环 | 紧缠在目标回合末造成可被护甲抵扣的非攻击伤害;来源存活时层数累计 |
| 墨宝 | 每只11—17,开场1滑溜;三只一组 | 奇数位刺击3,偶数位2×3起手;之后随机10或2×3与刺击交替 | 第一轮三只合计12,第二轮15—23;各自滑溜增加击杀所需命中次数 |
循环源文件: [毛虫](../monsters/crawler-intent.js)、[小啃兽](../monsters/nibbit-intent.js)、[甲虫](../monsters/shrinker-intent.js)、[树叶小](../monsters/leafslime-intent.js)、[树叶中](../monsters/leafmedium-intent.js)、[树枝小](../monsters/twigslime-intent.js)、[树枝中](../monsters/twigmedium-intent.js)、[飞蝇](../monsters/flyconid-intent.js)、[贾克斯果](../monsters/jaxfruit-intent.js)、[立柱](../monsters/cubex-intent.js)、[雾菇](../monsters/fogmog-intent.js)、[蛮兽](../monsters/mawler-intent.js)、[藤蔓](../monsters/vine-intent.js)、[扼杀者](../monsters/strangler-intent.js)、[紧缠伤害](../monsters/strangler-constrict.js)、[墨宝](../monsters/inklet-intent.js)。
### 3.1 劫掠者必须作为组合评价
当前从5种成员随机取3名且不重复;表内HP为实际关卡抽取范围。
| 成员 | 当前HP | 当前循环 |
| ------ | ------ | ------------------------------------------------ |
| 暴徒 | 30—33 | 7伤害→力量+3→循环 |
| 刺客 | 18—23 | 每次10伤害 |
| 斧手 | 20—22 | 5伤害并护甲5→同招→12伤害→循环 |
| 弩手 | 18—21 | 护甲3→14伤害→循环 |
| 追踪手 | 21—25 | 首次2脆弱,此后每次1×8伤害;并非持续在两招间交替 |
“刺客+弩手+追踪手”第二轮有10+14+8=32点意图伤害,对当前每名友方各结算一次;三名普通敌人还各可能出一张杀。该组合不能按三只低血量敌人处理。
来源:[三人编队](../content/acts/act1/raider-trio.js)、[实际循环](../monsters/raider-intent.js)。
## 4. 当前精英与 Boss 的完整威胁
### 4.1 精英
| 精英 | 血量与实际击杀要求 | 当前攻击循环 | 压力结论 |
| ---------- | -------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| 多尼斯异鸟 | 81—84 | 17与3×3交替;每个自身回合结束+1力 | 前6次17、12、19、18、21、24;多段招增长更快 |
| 旧日雕像 | 127;己方每使用一张牌,后续攻击对它多10%伤害,同回合累计 | 沉睡→力量+10→每次13伤害 | 实际斩击23;只有沉睡明确取消出牌,苏醒轮仍可能出力量加成的手牌 |
| 异蛙寄生虫 | 61—64,死后生成4只17—21HP扭动虫,都要处理 | 塞3感染→4×4→循环;虫生成时跳过一次完整回合,此后错位执行6伤害与塞1感染/+2力 | 总需处理生命129—148;不能按62血精英定价。感染留在手中到弃牌前,每张造成3非攻击伤害 |
来源:[异鸟](../monsters/byrdonis-intent.js)、[雕像](../monsters/effigy-intent.js)、[缓慢](../monsters/effigy-slow.js)、[异蛙与虫](../monsters/phrog-intent.js)、[亡语](../monsters/phrog-battle.js)、[感染](../cards/infection-card.js)。
### 4.2 Boss:当前逐轮意图伤害
以下只算意图,假定相关敌人持续存活、没有减伤和护甲。数值是对刘备的伤害;当前助战通常另承受同样一份。
| Boss/阶段 | 当前HP与机制 | 第1—8次行动的意图伤害 |
| ------------ | ---------------------------------------------------------- | -------------------------------------------------- |
| 墨影幻灵 | 173;初始9滑溜,每次实际失血至多1并耗1层;肢解塞3伤口 | 7、12、26、0、9、16、28、0,合计98 |
| 仪式兽一阶段 | 252;首招设置150血转换阈值,之后18伤害并+2力 | 若一直不转阶段:0、18、20、22、24、26、28、30 |
| 仪式兽二阶段 | 转换后力量归零,并跳过一次意图及出牌;之后咆哮→15→17并+3力 | 从二阶段首次咆哮起:0、15、17、0、18、20、0、21 |
| 同族小队 | 神官190+两信徒各58—59;只需杀神官即可获胜 | 三者均存活:18、16、9、14、26、10、33、24,合计150 |
同族小队拆分:神官前8次为8、8、9、0、10、10、15、0;每名信徒为5、4、0、7、8、0、9、12。神官四步循环与信徒三步循环形成12轮组合;第11轮全部存活时,意图合计为53,不能只验第一圈。
仪式兽的150是生命阈值,不是150护甲。正常满血需先造成102实际生命损失才抵达该区间,并由符合条件的伤害事件触发转换;不能把血量写成252+150。
来源:[墨影](../monsters/vantom-intent.js)、[仪式兽](../monsters/beast-intent.js)、[同族](../monsters/kin-intent.js)、[Boss编队](../content/acts/act1/kin-group.js)、[意图实际执行](../monsters/actions.js)。
### 4.3 原生出牌造成的额外峰值
| 情景 | 意图 | 条件成立时的额外攻击 | 合计 |
| ------------- | ----------------- | ---------------------------------------------- | ------------------ |
| 墨影第3次行动 | 26 | 剩3费用,若有3杀且均合法使用、均未被闪抵消:18 | 44,另塞3伤口 |
| 同族第1轮 | 18 | 神官3杀+两信徒各1杀,均打刘备且命中:30 | 48,另施加脆弱 |
| 毛虫第2次行动 | 意图伤害0,力量+7 | 1杀,6+7=13 | 13,增益轮并不安全 |
这些是有条件的压力情景,不是AI一定执行的行为,也不是全游戏理论上限。酒、其他增益、易伤、距离、手牌、选目标与响应都会改变结果。V0.1 用普通怪3—5回合、助战占比25%—40%作为直接平衡目标,依据不足。
## 5. V0.2 推荐采用的战斗规则
### 5.1 考虑过的两种路径
| 路径 | 做法 | 取舍 |
| -------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------ |
| 保留自由出牌并降数值 | 保持当前全部意图打全队,敌人自由用剩余费用出牌,只降HP/伤害 | 改动较小,但意图仍不能解释整轮风险;需要大量对局才能约束峰值 |
| **意图明确目标,追加攻击也预告(本版推荐)** | 为招式区分单体/全体,收紧专属怪物的额外主动攻击,按完整预告调数值 | 需要调整执行与预告,换取可判断的防御窗口;保留有限的三国杀响应互动 |
推荐路径由本提案提出,尚不代表用户已批准实现。下列参数以推荐路径为前提;如果保留当前无限制混合出牌,不可直接套用后面的承伤结论。
### 5.2 意图目标与原生响应
1. 普通怪和精英的意图默认单体,固定预告指向刘备;墨宝旋风、藤蔓挥击、异蛙甩动、异鸟啄击明确为全体。负面状态默认只施加给本次目标。
2. Boss 招式按第8节逐招列出的目标执行。全体招式对每名友方结算完整伤害,不分摊;单体招式不暗中随机切到关张。
3. 来源或目标提前死亡时取消对应效果,不在行动时临时换人;现有“刘备阵亡则结束征程”的流程优先。
4. 脚本意图继续使用护甲、虚弱等机制应对,仍不能用闪直接抵消;预告中明确标注。实际追加的杀仍走闪、距离、装备等原生规则。
5. 敌人的闪、对决斗打出的杀和濒死救援等响应继续保留;它们仍可能延长实际击杀时间,必须纳入游戏内采样。
### 5.3 限制意图后的额外主动出牌
对有专属意图的敌人,取消“发动完意图后任意主动出牌”。只允许下述事先预告的追加杀;不再自由主动使用桃、酒、无中、决斗或过河。没有专属意图的首关士兵仍按原流程行动。
- 普通遭遇:整支敌队每轮最多追加1张杀。该轮只有在意图原始合计伤害加该杀伤害不超过16时可选;含力量、段数,暂不计目标易伤、护甲及玩家减益。该值是基础预算,实际易伤后的伤害必须另行显示。
- 精英遭遇:同口径上限20,整支敌队每轮最多追加1张杀。亡语生成的虫也共享额度。
- Boss:仅墨影“墨迹”轮允许追加1杀;仪式兽、同族小队不额外主动出牌,使用其完整意图循环提供压力。
- 只有本轮执行伤害意图的单位可以追加。整备、沉睡、苏醒、蓄力、召唤、单独施加负面状态和阶段击晕的单位不追加,形成真实准备窗口。
- 在刘备行动前从符合条件的敌人已有手牌中选择并锁定1张实体杀,按固定座次选首个合格单位;不得把敌人随后新摸到的牌临时追加。预告显示来源、目标、伤害和“可用闪响应”。
- 使用仍支付原费用并重新校验牌、距离、目标和战斗会话;牌被夺走、费用不足、单位被击晕时取消,不补抽、不替换、不补偿攻击。实际伤害按当时状态结算,预告随状态刷新。
- 群怪原始意图本身已超过16/20时,不通过暗中削伤压回预算,而是禁止追加,并按第7节调整组合和出场时机。
这项规则会改变敌人手牌的主动用途,也减少主动回血造成的额外有效生命;因此它与后面的HP调整需要分批验证。
## 6. 刘备与助战:修订 V0.1 的内容
| 项目 | V0.2 建议 | 理由 |
| ---------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| 刘备基础 | 保持50生命、3费用、摸2、手牌上限3 | 先核对真实手牌吞吐;若缺牌再独立试摸3,不预先认定已有足够防御与输出 |
| 先天羁绊 | 仍提议关张可参战时100%到场,保留首战排除、濒死不能到场 | 核心玩法应可依赖 |
| 助战资源 | **撤回同时削费、削摸牌、削起手的建议**;首轮保留费用3、摸2、起手4、上限5、HP40 | 减少叠加削弱;先改敌方目标与意图,再观察输出占比 |
| 关羽意图 | 单体7→自身护甲8→单体10,循环;每次仍消耗1费用 | 集火,保留能应对群体攻击的防守轮 |
| 张飞意图 | 全敌各3→自身护甲8→全敌各4,循环;每次仍消耗1费用 | 清理低血随从,与关羽形成区别 |
| 仁德 | 沿用V0.1:1费用、每出牌阶段一次,给一张合规手牌/独行时弃一张,再摸1并自身护甲5 | 它是换牌与支援,不是净抽牌;不能当作每轮多摸1张 |
| 初始牌库 | 保留V0.1的12张提案:4杀、3防御、闪、桃、无中、八卦、重杀各1 | 提供防御、易伤和有限响应;首战不承诺关羽配合 |
| 炽焰/扯碎 | **撤回首轮立即削弱**;原数值作为候选基线,后续按力量多段与失血构筑实测处理 | 敌人和助战机制变化后,不能沿用旧假设直接砍关键输出 |
| 回复 | 休息基础30%最大生命向上取整仍列为后续独立实验;遗物额外休息回复另加;战后6保留 | 必须先保证战斗可生存,再评价跨关续航 |
仁德的“不可转移/非状态/非诅咒”按卡牌实际资格判定;转交不等于打出。若实施为独立技能,需要明确仪式兽昏眩期间能否发动:本版建议**昏眩时仁德与主动牌共用一次主动行动额度**,避免技能绕过Boss限制;它不因此被视为卡牌,也不凭空触发出牌连锁。
新关羽优先攻击刘备最近一个自身回合最后攻击且仍存活的敌人,否则选最低生命敌人;张飞作用于全部存活敌人。护甲只给自己,避免“刘备先给关羽护甲、关羽回合开始立即清空”的时序问题。
## 7. 普通怪、编队与精英的建议参数
这是首轮试验值,不是已证明的最终值。未列出的机制保留;本节目标规则统一遵从5.2。所有修改按第10节分批加入,不一口气套用。
### 7.1 普通怪参数
| 敌人 | 当前HP → 建议HP | 意图建议 | 目标 |
| -------------- | ---------------------- | ----------------------------------------------------------------------------- | --------------------------------------- |
| 首关士兵 | 24 → 24 | 保留原生出牌;不套专属意图限制 | 校准教学战 |
| 毛虫 | 55—57 → 45—48 | 4→加4力→4,循环 | 前6次变4、0、8、8、0、12;减缓滚雪球 |
| 小啃兽 | 42—46 → 36—40 | 顶撞12→10;斩击6→5、护甲5保留;加2力保留 | 压低弱池首轮冲击 |
| 缩小甲虫 | 38—40 → 34—36 | 缩小30%保留;7/13改7/11 | 用更低生命补偿其降低玩家输出的能力 |
| 树叶小/树枝小 | 11—15/7—11不变 | 3/4伤害保留,塞1黏液保留 | 让单体集火有明确击杀收益 |
| 树叶中 | 32—35 → 28—31 | 塞2黏液→1;伤害8→7 | 缓和多怪的卡手叠加 |
| 树枝中 | 26—28 → 24—26 | 扑击11→9,原连用限制保留 | 降低连续两轮尖峰 |
| 飞蝇菌子 | 48 → 42 | 猛砸11→9;伤害孢子8→6,脆弱2→1;易伤2保留 | 保留“先杀增伤源”的判断 |
| 贾克斯果 | 31—33 → 28—30 | 3伤害保留,每次+2力→+1力 | 增长3、4、5、6,便于给玩家集火时间 |
| 立柱 | 65 → 56;初始护甲13→10 | 开场+1力;重复轰击7并+1力,两次后4×2 | 前4次0、8、9、14,仍是成长型敌人 |
| 雾菇 | 74 → 64;眼6不变 | 重击8并+1力保留;头槌14→12;眼每次3晕眩→2 | 保留处理眼或抢杀本体的取舍 |
| 蛮兽 | 72 → 60 | 4×2保留;14→12;3易伤→2,怒吼一次限制保留 | 易伤重击由21降至18 |
| 藤蔓 | 61 → 54 | 全体5×2→单体6并缠结1→单体13 | 群体招更轻,缠结后仍有危险单体招 |
| 扼杀者 | 53—55 → 46—48 | 紧缠每次3→2;重击7/护甲5→6/4;甩动12→10 | 紧缠仍累计并由杀源解除 |
| 墨宝三只 | 各11—17保留 | 刺击3、全体2×3保留;凝视10→8;开场滑溜1保留 | 不同时削生命与破盾机制;控制随机爆发 |
| 劫掠者 | 五种原HP范围保留 | 暴徒5/加2力;刺客7;斧手4+护甲4、4+护甲4、9;弩手护甲3/10;追踪2脆弱后1×6 | 三人组合第二轮高压示例32→23,且无额外杀 |
### 7.2 编队必须有出场时机和峰值验算
- 原有前3次普通胜利用弱池保持。前3胜保护已有普通化精英节点的逻辑,不重复设计一个冲突的保护。
- 建议第4—5场普通战斗优先开放单体强敌与两单位组合;三墨宝、四史莱姆、劫掠者三人组从第6场普通战斗起加入。
- 小啃兽双只继续错位起手。建议版前3轮意图为5、12、19:第一只“斩击、加力、顶撞”,第二只“加力、顶撞、斩击”。第3轮要在预告中表现为集火节点。
- 甲虫+毛虫要同时计缩小对队伍输出的影响。优先杀甲虫释放输出,或抢杀毛虫阻止加力,都应有可行牌序;不要仅因总血量低于两只普通怪就判断简单。
- 飞蝇与其他怪的组合应按实际座次计算:先施加易伤,后面的怪可能当轮受益;易伤层数在目标自己的回合结束衰减,不能按全局轮数随意扣。
- 劫掠者3选5共有10种组合,全部检查前6轮。建议版“刺客+弩手+追踪手”第2轮仍有23原始伤害,作为晚段集火考验;若代表牌组在该轮前无法稳定杀掉一个低血目标,应继续降低该组合伤害或延后出现,不靠提高所有怪物血量修补。
- 群怪阵亡后立即移除该单位余下行动、负面来源和后续轮贡献;“所有敌人永远存活”的表仅作为压力包络。
来源:[遭遇组成](../content/acts/act1/encounters.js)、[小啃兽双只](../content/acts/act1/nibbit-pair.js)。
#### 7.2.1 劫掠者10种组合的六轮压力表
以下按三人始终存活、原有循环起点不变计算,仅列对刘备的意图伤害;未加入手牌攻击、玩家护甲及状态修正。建议版采用7.1的参数。当前版同样的意图伤害通常还会对助战各结算一份,建议版这些招式均为单体刘备。
| 组合 | 当前第1—6轮 | 建议第1—6轮 | 六轮内最高意图伤害:当前→建议 |
| ------------------ | ---------------------- | ---------------------- | ----------------------------- |
| 暴徒+刺客+斧手 | 22、15、32、15、28、22 | 16、11、23、11、20、16 | 32→23 |
| 暴徒+刺客+弩手 | 17、24、20、24、23、24 | 12、17、14、17、16、17 | 24→17 |
| 暴徒+刺客+追踪手 | 17、18、28、18、31、18 | 12、13、20、13、22、13 | 31→22 |
| 暴徒+斧手+弩手 | 12、19、22、19、18、26 | 9、14、16、14、13、19 | 26→19 |
| 暴徒+斧手+追踪手 | 12、13、30、13、26、20 | 9、10、22、10、19、15 | 30→22 |
| 暴徒+弩手+追踪手 | 7、22、18、22、21、22 | 5、16、13、16、15、16 | 22→16 |
| 刺客+斧手+弩手 | 15、29、22、29、15、36 | 11、21、16、21、11、26 | 36→26 |
| 刺客+斧手+追踪手 | 15、23、30、23、23、30 | 11、17、22、17、17、22 | 30→22 |
| 刺客+弩手+追踪手 | 10、32、18、32、18、32 | 7、23、13、23、13、23 | 32→23 |
| 斧手+弩手+追踪手 | 5、27、20、27、13、34 | 4、20、15、20、10、25 | 34→25 |
这张表说明建议值仍需要集火条件:例如“刺客+斧手+弩手”第6轮仍有26,“斧手+弩手+追踪手”仍有25。16点只是**追加杀的准入预算**,不是整轮伤害硬上限。对应超预算轮不追加杀;不能把这些组合标为已经平衡。
首轮实测优先检查第2次敌方行动前能否用正常手牌击杀刺客或弩手,并记录为此放弃的护甲和响应。若必须依赖极优起手或稀有卡,先降低相关成员伤害或延后组合开放,再复测;若常规集火已能稳定减员,则保留后续高压,让拖延具有明确代价。跟随追踪手的脆弱会使防御收益下降,仍须按实际逐张护甲向下取整,不能把上表直接减一个固定防御值就当成实战结果。
### 7.3 精英建议
| 精英 | 建议HP | 意图与机制调整 | 检验的能力 |
| ---------- | --------------------- | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| 多尼斯异鸟 | 74—78 | 单体俯冲17→14;全体3×3保留;每回合+1力保留 | 前6次14、12、16、18、18、24,要求及时结束战斗或减力量/施虚弱 |
| 旧日雕像 | 108 | 沉睡、苏醒均无额外主动攻击;苏醒加10力→5;斩击基础13→11,即稳定单体16;缓慢机制保留 | 两轮准备后持续16,考验铺场和同回合多牌增伤 |
| 异蛙寄生虫 | 本体58—60;4虫各12—14 | 单体塞2感染与全体3×4交替;死亡仍生成4虫并各跳过一次完整回合;虫单体4与塞1感染/加1力错位循环 | 总生命106—116,考验在感染污染前杀本体并保留清场资源 |
异蛙的4只虫是第二阶段战斗,不是奖励动画。不能在击杀本体时提前结算胜利;也不能按同族信徒的“杀首领即可赢”规则处理它。
## 8. 三类 Boss 的 V0.2 方案
### 8.1 墨影幻灵:多段破盾与伤口管理
| 参数 | 当前 → 建议 |
| -------- | -------------------------------------------------------------- |
| HP | 173 → 150 |
| 初始滑溜 | 9 → 4;只初始化一次,按实际失血事件消耗 |
| 墨迹 | 7不变,单体刘备;允许预告追加1杀 |
| 墨水长枪 | 6×2 → 5×2,明确全体 |
| 肢解 | 26 → 18,单体刘备;伤口3→2,只加入被攻击且存活的目标个人弃牌堆 |
| 准备 | +2力→+1力,无主动出牌 |
| 循环 | 墨迹→长枪→肢解→准备→循环 |
建议版前8次意图:**7、10、18、0、8、12、19、0**,合计74。假设两次墨迹轮都合法追加一张杀且命中,杀分别为6、7,则刘备总压力为**13、10、18、0、15、12、19、0**,合计87。关张只承受两次全体长枪,共22,不再完整复制刘备全部87点压力。
用“每轮恰有10护甲”的纯算术情景举例,刘备净损失为3、0、8、0、5、2、9、0,共27。没有把准备轮多余护甲挪到其他轮,也没有算战后回复。**此情景不证明2张摸牌、3费用能每轮同时打出10护甲与足够攻击,必须实战核对。**
滑溜会使前4次真正掉血的事件每次最多掉1;不等于加4生命。若全是单段6伤害且全部命中、没有其他效果,150血+4滑溜需要4次各1伤害,再25次6伤害,共29次命中;同口径当前173血+9滑溜需37次。多段、非攻击伤害和响应会改变这个比较。
### 8.2 仪式兽:明确的转阶段窗口
| 参数 | 当前 → 建议 |
| ---------- | ----------------------------------------------------------- |
| HP | 252 → 180 |
| 转阶段阈值 | 150/252比例 → 明确108/180,即60%;覆写最大生命时按60%取整 |
| 一阶段 | 首次跺地设置阈值;之后单体14伤害并+1力,替代18并+2力 |
| 破阶段 | 保留符合条件伤害触发、力量归零、跳过一次意图与出牌 |
| 二阶段咆哮 | 对全体施加昏眩,下个自身回合只有一次主动行动;原生响应保留 |
| 二阶段踩踏 | 15 → 10,全体 |
| 二阶段碾碎 | 17/加3力 → 14/加1力,单体刘备 |
| 二阶段循环 | 咆哮→踩踏→碾碎→循环;无额外主动出牌 |
**示例时间线,前提为玩家在第4个刘备行动中把Boss打到108或以下并成功触发转换:**
| 敌方行动轮 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| -------------- | ---- | ---- | ---- | -------- | ---- | ---- | ---- | ---- | ---- | ---- |
| 行动 | 跺地 | 冲撞 | 冲撞 | 阶段击晕 | 咆哮 | 踩踏 | 碾碎 | 咆哮 | 踩踏 | 碾碎 |
| 对刘备意图伤害 | 0 | 14 | 15 | 0 | 0 | 10 | 14 | 0 | 11 | 15 |
第4轮转阶段需要此前累计造成至少72实际伤害,平均约18/刘备行动;180生命希望在约8—10个玩家回合结束,需要整场实际输出约18—23/回合。它是检验牌组的目标,不是当前实测DPS。若第4轮没打到阈值,后续仍是16、17等一阶段冲撞,不能继续使用上表的安全窗口。
以每个危险轮8护甲示例,上表净损失合计31。昏眩后能否凑出8护甲尤其需要验证:一张未强化防御只有5,不能假设照常出两张牌。关张只承受表中两次全体踩踏,合计21;咆哮依然降低其有效输出。
### 8.3 同族小队:清随从与抢杀首领都应有价值
| 参数 | 当前 → 建议 |
| ------------ | -------------------------------------------- |
| 神官HP | 190 → 140 |
| 两名信徒HP | 各58—59 → 各24—28 |
| 神官循环 | 单体6+1脆弱→单体6+1虚弱→全体3×2→自身+1力 |
| 信徒循环 | 单体4→单体2×2→自身+1力;两名仍同步起手 |
| 追加主动出牌 | 无;保留原生响应与濒死救援 |
| 胜利 | 杀神官获胜,仍不强制杀信徒;无新增召唤或复活 |
全员存活时,前8轮对刘备意图为**14、14、6、10、19、7、20、16**,合计106;第11轮仍可达30。它仍是一个要求减员的Boss,不能宣称全部放着不管也已平衡。
若第3次敌方行动前已经杀掉一名信徒,且另一名始终存活,前8轮变为**14、14、6、5、13、7、14、10**,合计83。若每轮基础护甲8,受第1/5轮脆弱影响,第2/6轮只能获得6护甲,净损失为6、8、0、0、5、1、6、2,共28。神官第2轮施加虚弱还会降低随后玩家输出,此处没有把它忽略成免费的伤害窗口。
清一名随从约多花24—28点实际输出,却持续降低后续压力;抢杀神官只需处理140主体生命,但必须承担两名信徒全部攻击。建议以“第2轮能否杀掉一名信徒、杀后能否在第8轮附近结束”作为首轮验算,不把190+两只59全部当成强制击杀量。
## 9. 回合目标、牌组供给和跨关消耗
### 9.1 暂定的测试目标
“毛伤害”指实际扣血总量,尚未加回战中治疗及战后回复;它不同于意图原始伤害。
| 遭遇 | 暂定玩家回合数 | 对熟悉规则的代表牌组,刘备毛伤害目标 | 检查重点 |
| ---- | -------------- | ------------------------------------ | ---------------------------------------------------- |
| 首关 | 3—5 | 0—8 | 距离、坐骑、四回合剧情支援、提前胜利 |
| 弱池 | 3—5 | 4—10 | 不依赖稀有卡,单人也能通过 |
| 强池 | 4—6 | 8—16 | 组合优先击杀、应对状态牌 |
| 精英 | 5—8 | 14—24 | 有合理构筑后通过,失败能归因于战术或构筑缺口 |
| Boss | 7—10 | 20—32 | 约40以上生命进入时存在合理容错;各Boss按独立机制检验 |
这些区间是设计目标,不是对全部种子、全部操作或未成型牌组的保证。第4次普通胜利后也不能机械把敌人整体再加血来满足回合数。
### 9.2 同时满足防御和输出
不能分别证明“能打20伤害”和“能有10护甲”就认定该回合可行;必须使用同一手牌、同一费用和同一响应消耗验证。
- 3费用中用2张基础防御取得10护甲后,只剩1费用,基础杀只能打6且可能被闪。
- 每轮摸2、持续打出3张还要留闪,长期会缺牌。仁德给一摸一不增加刘备净手牌;助战也要花自己的费用用收到的牌。
- 12张初始牌库的空转周期不等于固定6轮:起手、无中、保留手牌、响应、弃牌、消耗、状态牌都会改变它。
- Boss前代表牌组至少分别验证:普通单体攻击构筑、易伤/力量构筑、消耗/多段构筑。不能只用一套极优稀有牌组来调全部Boss。
- 若多数代表牌组付出一费防御后,仍常常无法形成有效进攻,单独比较“刘备每回合摸3”实验;先冻结其他数值,避免一起加摸牌、加费用、减敌血。
- 昏眩、伤口、感染和缠结专门记录损失了多少有效出牌机会;不能都折成一个固定伤害系数。
### 9.3 续航与濒死
每场净变化按“入场生命+实际战中治疗-毛伤害+可生效的战后回复”计算,并受生命上限限制;阵亡时不能用战后6点逆转失败。
例如强池毛伤害12、没有战中治疗、战后实际回6,净耗6;连续4场约耗24,再考虑休息、商店和路线。休息由8提高至15的候选值应在这个背景下评估,而非仅与桃比较。
助战一旦濒死,当前救助取得途径尚不完整,必须测试缺席后能否继续推进。V0.2先用明确单体目标减少随机永久失去伙伴的风险;救助渠道作为后续独立设计项,不把未存在的免费复活计入生存预算。
## 10. 落地次序与验证要求
本次只交付方案。若后续实施,建议使用以下顺序,每阶段保留同种子对照,不把V0.2整包数值一次性落地。
1. **当前版本基线。** 记录实际入场HP、座次、起手、每次意图、力量、状态持续、主动牌、响应、护甲和净掉血;特别覆盖旧版墨影第3轮、同族第2/5/11轮、仪式兽转换和异蛙亡语。
2. **先改威胁可读性与规则。** 实施单体/全体目标、受限且可预告的追加杀,冻结HP与其他伤害;确认没有隐藏的额外主动攻击,并观察仅此改动降低多少压力。
3. **按遭遇逐个试建议HP与循环。** 先弱池,再强池组合,再精英,最后三个Boss。若第2阶段已经达到目标,相关降血/降伤可撤回,不机械执行全表。
4. **再试刘备与助战。** 确定到场、关张差异、仁德和初始牌组分别记录效果;先保留助战原资源,确认是否确实需要削弱。
5. **最后处理跨关续航及强构筑。** 单独试休息30%,再检查炽焰、扯碎及多段/消耗连锁,不用削核心牌补偿未处理的怪物问题。
建议首轮使用12组固定起始牌序/遭遇随机种子覆盖代表场景,不把同一随机种子的重复点击当独立样本。普通与精英各覆盖单独刘备、关羽、张飞;Boss另交叉3种代表牌组、至少2档入场生命(30/45)。无法一次完成时,先完成三个Boss及最高压群怪,不以少量样本发布精确胜率。
| 核对项 | 需要的记录/判据 |
| ---------- | ------------------------------------------------------------------------------------ |
| 循环正确 | 至少两圈;同族至少12轮包络;仪式兽分别覆盖早、正常、晚转换 |
| 伤害正确 | 按目标、按段、按当时力量及状态重算;示例中的53、44只是特定情景而非固定伤害 |
| 防御可行 | 同一手牌与费用同时满足防御和攻击;护甲不能跨自身回合误累计 |
| 群怪峰值 | 列出10种劫掠组合、三墨宝随机分支、双小啃兽错位、四史莱姆、飞蝇组合 |
| 实际减员 | 第一名敌人何时死、何时减少意图压力;不得只保留永远全员存活的模型 |
| 助战安全 | 被全体技能命中的轮次、是否在预告之外濒死、AI是否会用收到的牌 |
| 特殊机制 | 滑溜消耗、感染每张3伤害、亡语4虫、神官与雾菇胜利条件、击晕与昏眩区别 |
| 预告准确 | 显示目标与段数,额外杀单列;玩家改状态、夺牌或击杀后刷新;不给未锁定的新抽牌追加攻击 |
| 保存与兼容 | 旧存档现有牌组不强制重写;新数值作用范围明确;改过的规则说明同步 |
参数数据、手算/脚本推演、隔离行为检查和真实游戏对局是不同证据。只有真实对局才能验证敌方AI、响应选择、抽牌波动、战斗耗时和体验;本版没有宣称这些已经完成。
## 11. 实施时必须同步的源码位置
| 事项 | 入口与约束 |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 敌人HP | [monster.js](../monsters/monster.js)、各 `roll*Hp`、关卡单位覆盖及[角色资料](../content/scenario-characters.js);只改HEALTH可能被子类固定值或入场随机覆盖 |
| 意图目标、伤害与追加牌 | [actions.js](../monsters/actions.js)、[intent-effects.js](../battle/intent-effects.js)、[mode.js](../mode.js)及意图预告;不得只改文字 |
| 仪式兽阈值 | [beast-intent.js](../monsters/beast-intent.js)中当前比例150/252与阶段状态;新180HP下明确改60%,不能遗漏旧比例 |
| 状态牌数量 | [infection-card.js](../cards/infection-card.js)有本体必须3、虫必须1的校验,建议本体2必须连同校验调整;伤口、晕眩同样核对生成入口 |
| 助战与仁德 | [definitions.js](../bonds/definitions.js)、[state.js](../bonds/state.js)、[intents.js](../bonds/intents.js)、卡牌所有权与阶段限制;新单体关羽需要执行器支持 |
| 早期与后期组合 | [encounters.js](../content/acts/act1/encounters.js)、[state.js](../progression/state.js)、[encounter-progress.js](../progression/encounter-progress.js);按普通胜利次数,不按楼层替代 |
| 回复 | [rooms.js](../relics/rooms.js)、[rules.js](../relics/rules.js);先核对战中存活,后核对跨关净消耗 |
本文是可审阅的联合平衡草案,关键建议是:**限制未预告的额外伤害,逐轮计算全队压力,保留Boss机制差异,并用相同资源约束同时验证输出与生存。**
+4 -4
View File
@@ -1,6 +1,6 @@
# 刘备首关配置
新征程仅显示梦三私有界刘备:4/4、无初始技能。原版界刘备和其他模式不变;旧征程不强行换主角。
新征程仅可选择梦三私有刘备,初始为 50/50 生命,带「桃园羁绊」。原版界刘备和其他模式不变,旧征程保留原主角。
## 编辑入口
`content/acts/act1/stories/liubei-opening.js`:
@@ -15,9 +15,9 @@
- 支援单位 `after:"player"` 插入刘备下家;该支援仅当前战斗有效,不写入永久道具/羁绊。
- 苏双&张世平为一名男性蜀势力武将,暂设无技能、4/4、4张初始手牌,可自行调整。
- `discardEquipment` 弃置指定单位装备区的指定牌;已不在装备区则不重复弃置,不影响其他装备。
- `fixedRewards` 固定获得梅花5的卢一张,加入征程个人牌库;此关关闭随机三选一。奖励与节点完成一起事务提交,重试不会重复发牌。
- `rewardPackage` 额外固定获得400金币、手动强化1张牌、随机遗物三选一。遗物候选复用当前新遗物奖励池,排除已持有项,随机结果在打开界面前保存;不足三件时显示剩余候选。强化只允许选择尚未满级且没有永恒词缀的可强化牌;没有候选时明确提示并跳过该项。两项选择完成后,与金币、的卢及节点完成一起提交,重试或恢复存档不会重复领取。遗物池耗尽时同样提示并跳过遗物选择。
- 固定奖励与选择奖励共用过关奖励界面,以“固定战利品”/“可选战利品”等文字区分;固定奖励显示名称和说明,点击“领取固定奖励”后继续结算,不能放弃。若同时配置两类奖励,固定奖励全部获得,候选奖励仍择一领取或放弃。
- 固定战利品为 400 金币和梅花 5 的卢一张,的卢加入征程个人牌库。此关关闭普通随机卡牌奖励。
- 可选战利品包括手动强化一张牌、随机遗物三选一和药水三选一。强化候选需有强化规则且尚未满级,永恒牌也可以强化。遗物候选排除已持有或不可获得的条目,不足三件时显示实际数量。药水栏满时可选择替换一瓶,也可保留已有药水。
- 界面区分固定和可选战利品。可逐项选择或跳过,也可直接跳过全部可选项,固定战利品照常结算。候选及已选结果在确认前只保留在内存,最终与固定战利品、剧情标记和节点完成一起写入地图存档。保存失败时重试同一结果,读档仍回到上次保存的地图。
- 初始士兵/支援手牌仍来自公共牌堆;弃掉的敌方的卢走原生弃牌流程,胜利所得的卢是持久牌库新卡,并非再从弃牌区拾取。
- 提前击败敌人允许正常获胜,此时未到第四次回合的支援不会触发。不强行等待、不添加免死。
@@ -11,6 +11,12 @@
- 战斗中或领奖确认前读档,回到上一次保存的地图;未完成节点仍可重新选择。
- 读取旧存档时忽略 `battleFlow`、`bondBattle` 与战斗临时卡牌效果 `sharedBattleCardEffects`,不自动进入旧战斗或失败弹窗。以后写入存档也不保留这些字段。
## 返回模式选择与主动重开
「返回模式选择」保留上次已提交的征程存档。未完成的战斗和对话会在下次进入时重新开始。
有进行中的征程时,可在存档选择画面或征程菜单中选择「重新开始」。确认后清除当前征程存档,重载并进入角色选择。取消确认保留存档。这与下方阵亡界面的重开流程不同,后者直接用阵亡角色开启新征程。
## 角色阵亡
阵亡后显示两个选项,无倒计时,也不自动提交失败:
@@ -29,7 +35,8 @@
- `battle/battle-flow.js`:阵亡等待选择及结算、清理顺序。
- `mode.js`:阵亡按钮、地图恢复、主菜单及战斗中成长延后保存。
- `ui/flow-ui.js`:阵亡界面关闭额外流程菜单。
- `ui/navigation.js`:返回模式选择、主动重开确认和重载后的角色选择入口标记。
实机验收建议:战斗中读档应回地图;阵亡弹窗停留后读档仍可继续原征程;点击重新开始应沿用当前角色从头开始;点击返回主菜单后旧征程应结束;过关奖励选择或跳过后再次读档不应重复发奖。
实机验收建议:战斗中读档应回地图。阵亡时等待选择后读档仍可继续原征程,从阵亡界面重开沿用当前角色,返回主菜单会结束旧征程并清档。另需确认主动重开会在确认后清档并进入角色选择,取消时可继续原征程。过关奖励选择或跳过后读档不会重复发奖。
本次仅核对实际源码、语法和差异,未启动游戏或运行行为测试。
+83
View File
@@ -0,0 +1,83 @@
# Slay the Spire 2 素材路径对照
供梦三开发时查找本机参考资料。绝对路径可复制到 Windows 文件资源管理器,表内短路径以各节标注的目录为起点。
## 常用完整路径
**简体中文翻译目录**
```text
D:\workspace\术樱包-本地资料\参考资料\Slay the Spire 2\localization\zhs
```
**药水拆分 PNG**
```text
D:\workspace\术樱包-本地资料\参考资料\梦三\STS2拆分图集\Godot_Atlas_Sprites_v0.111.0\images\atlases\potion_atlas.sprites
```
**事件背景和插图**
```text
D:\workspace\术樱包-本地资料\参考资料\梦三\STS2拆分图集\Godot_Recovered_v0.111.0\images\events
```
## 简中翻译文件
以下文件都在上面的 `localization\zhs` 目录中。游戏目录里还有其他语言,可在 `localization` 下选择对应语言目录。
| 文件 | 查找内容 |
| --- | --- |
| `events.json` | 事件标题、选项与结果文本 |
| `potions.json`、`potion_lab.json` | 药水名称和效果说明、药水实验室界面文字 |
| `cards.json`、`card_keywords.json` | 卡牌名称和说明、卡牌关键词 |
| `relics.json`、`relic_collection.json` | 遗物名称和效果说明、遗物图鉴界面文字 |
| `powers.json`、`intents.json` | 状态名称和说明、战斗意图文字 |
| `monsters.json`、`encounters.json` | 怪物和遭遇相关文字 |
| `characters.json`、`ancients.json` | 角色和先古相关文字 |
| `afflictions.json`、`enchantments.json` | 苦痛和附魔相关文字 |
| `map.json`、`merchant_room.json`、`rest_site_ui.json` | 地图、商店和休息处界面文字 |
## 拆分图集
下表中的目录都位于这个图集根目录。
```text
D:\workspace\术樱包-本地资料\参考资料\梦三\STS2拆分图集\Godot_Atlas_Sprites_v0.111.0\images\atlases
```
| 查找内容 | 子目录 | 样例或数量 |
| --- | --- | --- |
| 药水图标 | `potion_atlas.sprites` | 64 张 PNG,例如 `energy_potion.png` |
| 药水描边 | `potion_outline_atlas.sprites` | 64 张同名 PNG |
| 遗物图标 | `relic_atlas.sprites` | 346 张 PNG,例如 `akabeko.png` |
| 遗物描边 | `relic_outline_atlas.sprites` | 346 张同名 PNG |
| 状态图标 | `power_atlas.sprites` | 271 张 PNG,例如 `accuracy_power.png` |
| 通用界面图标 | `ui_atlas.sprites` | 例如 `back_button.png`、`confirm_button.png` |
| 触控按钮小图 | `compressed.sprites` | 例如 `back_button_arrow.png` |
| 卡面图集条目 | `card_atlas.sprites` | 当前只有 `ancient_beta.png` 和 `beta.png` |
## 完整资料目录
下表路径均相对于这个目录。
```text
D:\workspace\术樱包-本地资料\参考资料\Slay the Spire 2
```
| 查找内容 | 相对路径 |
| --- | --- |
| 事件背景、插图和专用界面素材 | `images\events`、`images\events\custom`、`images\events\crystal_sphere` |
| 大号药水图 | `images\potions\large`,有 64 张 PNG |
| 药水合图及描边合图 | `images\atlases\potion_atlas.png`、`images\atlases\potion_outline_atlas.png` |
| 独立遗物、状态图标 | `images\relics`、`images\powers` |
| 选角界面资源 | `images\packed\character_select` |
| 战斗意图与抽牌堆、弃牌堆、结束回合图标 | `images\packed\intents`、`images\packed\combat_ui` |
| 地图绘制图标与房间场景素材 | `images\packed\map`、`images\rooms` |
| 通用界面图标和卡牌模板 | `images\packed\common_ui`、`images\packed\card_template` |
| 特效图和参考音效 | `images\vfx`、`debug_audio` |
| 药水、事件、遗物、卡牌的模型资料 | `src\Core\Models\Potions`、`src\Core\Models\Events`、`src\Core\Models\Relics`、`src\Core\Models\Cards` |
完整资料的 `images\atlases\*.sprites` 下通常是 Godot 的 `.tres` 图块描述。找单张药水、遗物或状态 PNG 时,直接查上面的拆分图集。事件素材可以先用 `events.json` 查事件文字,再在 `images\events` 中按英文文件名定位,例如 `abyssal_baths.png`。
梦三运行用的成品资源存放在项目的 `mengsan/assets/`。本页记录的绝对路径供本机查阅。
+1 -1
View File
@@ -3,7 +3,7 @@
2026-10-03来源:https://sts2.huijiwiki.com/wiki/同族小队
首领遭遇由1名同族神官KIN_PRIEST和2名同族信徒KIN_FOLLOWER组成,不是一个融合角色。注册mengsan_kin_priest_shuying / mengsan_kin_follower_shuying。
普通神官HP190;信徒58~59,入场使用征程随机源独立抽取,默认资料值59;覆盖HP不消耗随机数。进阶A8神官199/信徒62~63,A9法球9及仪式/舞蹈3只记录,不混入当前普通数值。
第一层act1Map.boss保留墨影幻灵作为旧配置兼容值,新增bossEnemies=[墨影幻灵,同族神官],等权种子选择。神官条目自动展开三单位kin-group;信徒不单独加入首领/普通/精英池。专属开局、其他层和奖励保持不变。现有墨影幻灵保留;旧墨影单一首领测试新增对应池选择适配,旧报告不覆盖。
第一章 Boss 从墨影幻灵、仪式兽、同族小队三个遭遇中使用征程随机源等权抽取,见 `content/acts/act1/encounters.js`。同族小队条目配置一名神官和两名绑定到该神官的信徒,信徒不单独加入首领、普通或精英池。`act1Map.boss` 的单一墨影幻灵值仅供旧逻辑兼容。
网页SVG神官:开始→脆弱法球8+1脆弱→虚弱法球8+1虚弱→灵魂光束3×3→黑暗仪式自身力量+2→脆弱法球。信徒:开始→快斩5→回旋镖2×2→力量之舞自身力量+2→快斩。两个信徒同一起始动作,没有虚构错位开场、召唤/复活、群体力量/治疗、阶段切换。
爪牙不单独阻止胜利:所属神官被击杀即可获胜,无需击败存活信徒;不额外发第二份奖励。与普通敌人混合时普通敌人仍须击败。绑定关卡单位ID,不串到另一神官;孤立信徒整回合取消、抽牌0,不能继续原生出牌。神官死亡即时清空所属信徒意图,没有杀死信徒的副作用或复活逻辑。
沿用梦三神官Boss抽3/上限7/费用4,信徒普通抽1/上限3/费用2,每次意图消耗1费用,随后保留原生出牌;费用不足不发动但推进循环;击晕advance/retry沿用同一恢复。力量按每段攻击和原生攻击牌生效,脚本不重复加。脆弱/虚弱通过已有人工制品拦截入口,伤害先结算,目标存活才施加;虚弱是weak,不误标成易伤。伤害作用所有存活敌对角色,沿用逐目标护甲与状态。
+7 -7
View File
@@ -10,6 +10,8 @@
| --- | --- |
| `ui/hand/index.js` | 挂载、同步、局部输入适配、回退和幂等卸载 |
| `ui/hand/adapter.js` | 校验引擎容器并读取真实卡牌,识别第二容器离线结构 |
| `ui/hand/fan.js` | 计算扇形位置、角度及悬停呈现 |
| `ui/hand/input.js` | 适配主动出牌阶段的单目标和无须手动指定目标的拖牌 |
| `ui/hand/overlays.js` | 费用与强化覆盖层,仅维护当前手牌的显示节点 |
| `ui/hand/style.css` | 独立排列、尺寸、间距、选中标记及隔离样式 |
| `ui/hand/diagnostics.js` | 生命周期、回退和加载失败诊断日志 |
@@ -29,15 +31,13 @@
也依赖真实节点的父容器和变换。因此首期选用真实节点原位复用,
不复制卡面,不移动手牌容器,不替换全局原型或布局函数。
排列使用独立命名空间的 flex 样式;默认卡牌 90×110、间距 8,
小屏卡牌 80×100,牌多时横向滚动。具体尺寸集中在本模块 CSS。
卡面继续采用当前引擎/主题生成的内容。选择、取消、出牌、响应和
选目标继续交给引擎,模块不另行计算卡牌可用性或提交出牌事件。
当前复用原位手牌并按扇形排列,默认卡牌 112×156,小屏 82×114。牌多时按容器宽度收窄间距,悬停时上抬并放大。卡面继续采用当前引擎或主题生成的内容。
主动出牌阶段支持鼠标和触屏拖牌。适用的单目标牌和无须手动指定目标的牌,通过引擎选牌、`game.check()` 和原生确认操作结算。复杂多目标、响应和技能选择继续走原生交互。
引擎仍维护节点上的 `selected`、`selectable` 等状态。本模块通过这些
原有类显示选择状态,保留 DOM 顺序作为引擎排序的依据。
检测到移动手势时临时退回既有排列,释放或取消后恢复独立排列;
触屏水平滚动保留独立排列。首期没有另做手动拖动排序系统。
未由梦三接管的原生排序手势可临时退回原排列,释放或取消后恢复扇形。战斗结算期间停止手牌交互并保留外观,会话结束后恢复原布局。玩家 HUD 的当前范围见[统一战斗 HUD](unified-battle-hud-20261021.md)。
费用调用既有 `cardCost`,强化读取既有 `cardUpgradeLevel`。
覆盖层只在自己的子节点 dataset 上保存显示值,使用伪元素显示文字,
@@ -64,7 +64,7 @@
挂载、回退、卸载与加载错误。最近 100 条覆盖写入,串行提交。
没有文件接口时保留控制台日志;布局回退也写入游戏日志。
## 验证结果及边界
## 首期验证记录及边界
本次参考安装源码:本体 `game/update.js` 为 1.11.5.2;
十周年 `info.json` 为 1.3.1。
+198 -81
View File
@@ -44,7 +44,7 @@ import {
} from "./monsters/actions.js";
import { constrictTotal, resolveConstrict, clearConstrictSource } from "./monsters/strangler-constrict.js";
import { isShrunk, clearShrinkSource, shrinkAttackDamage } from "./monsters/shrinker-status.js";
import { advanceTangled } from "./monsters/vine-tangled.js";
import { advanceTangled, isAttackCard } from "./monsters/vine-tangled.js";
import { isMawler, recordMawlerAction } from "./monsters/mawler-intent.js";
import { isVine, recordVineAction } from "./monsters/vine-intent.js";
import { isCubex, recordCubexAction, initializeCubex } from "./monsters/cubex-intent.js";
@@ -93,6 +93,7 @@ import {
canPayCard, payCard, isActiveCardUse, isXCostCard,
} from "./battle/combat-rules.js";
import { mountBattlePiles } from "./ui/card-library.js";
import { mountCardChoiceNames } from "./ui/card-choice-names.js";
import { mountGMManager } from "./ui/gm-manager.js";
import { createPlayerTeardown } from "./battle/skill-teardown.js";
import { createBattleResources } from "./battle/battle-resources.js";
@@ -109,13 +110,22 @@ import { showMap as renderMap } from "./ui/map/index.js";
import { getRandomRewardChoices } from "./progression/reward.js";
import { canAcquireCard } from "./cards/card-definitions.js";
import { addCardToDeck, createRandomCardData } from "./cards/card-data.js";
import { LIUBEI_CARD_OWNER } from "./cards/packs/liubei/names.js";
import { hasUpgradeableCard, upgradeRandomCard } from "./cards/upgrades.js";
import { chooseBattleReward } from "./ui/reward-ui.js";
import { chooseRewardPackage } from "./ui/reward-package.js";
import { applyStoryOutcome, getAvailableStoryChoices } from "./progression/story.js";
import { finishRandomEvent } from "./progression/random-event.js";
import { playDialogue } from "./ui/dialogue.js";
import { chooseButtons } from "./ui/flow-ui.js";
import { openModeSelection } from "./ui/navigation.js";
import { chooseCharacterCards } from "./ui/character-select.js";
import { chooseRest } from "./ui/rest-ui.js";
import { chooseShop } from "./ui/shop-ui.js";
import { acquirePotion, createPotionOffer, potionSlots } from "./potions/state.js";
import { loadPotionAssets, potionView } from "./potions/presentation.js";
import { createPotionActions, createPotionSkills, potionBlockType, potionSkillIds, potionSkillTranslations } from "./potions/battle.js";
import { choosePotionReplacement, choosePotionReward, mountPotionSlots } from "./ui/potions.js";
import { confirmRestartJourney, consumeJourneyRestart, openModeSelection } from "./ui/navigation.js";
import {
completeNode,
createRun,
@@ -169,20 +179,30 @@ const reportFlowError = error => {
const chooseRun = async savedRun => {
const available = savedRun?.status === "running";
const act = available ? config.acts[savedRun.actIndex] : null;
return chooseButtons("梦三", [
const choices = [
{ id: "continue", name: "继续征程", disabled: !available,
description: available ? `${get.translation(savedRun.player.character)} · ${act?.name || "未知区域"} · 已完成 ${savedRun.statistics?.completedNodes || 0} 个节点` : "暂无进行中的征程" },
{ id: "new", name: "开始新征程", description: available ? "选择角色,确认后替换当前自动存档" : "选择一名武将,踏入第一关" },
], "单一自动存档 · 完成节点后记录进度", { eyebrow: "水墨行军 · 存档选择" });
];
if (available) {
choices.push({ id: "restart", name: "重新开始", danger: true, description: "清除上次征程的存档,进入角色选择" });
}
return chooseButtons("梦三", choices, "单一自动存档 · 完成节点后记录进度", { eyebrow: "水墨行军 · 存档选择" });
};
const chooseCharacter = async (backLabel = "返回存档选择") => {
const choices = config.characters.filter(name => lib.character[name]).map(name => ({
id: name,
name: get.translation(name),
description: lib.translate[`${name}_title`] || "作为本次征程的角色",
}));
return chooseButtons("选择出征武将", [...(choices.length ? choices : [{ id: "mengsan_liubei_shuying", name: "刘备" }]), { id: "back", name: backLabel, description: "不会修改现有征程" }], "此武将将陪伴你完成本次征程。", { back: "back", eyebrow: "出征准备" });
const playable = config.characters.filter(id => lib.character[id]).map(id => {
const { group, img } = lib.character[id];
return {
id,
name: get.translation(id),
faction: group,
factionName: get.translation(group),
portrait: img ? lib.assetURL + img : "",
description: lib.translate[`${id}_title`] || "作为本次征程的角色",
};
});
return chooseCharacterCards(playable, STYLE_PATH, backLabel);
};
const chooseDefeatAction = async run => chooseButtons("角色阵亡", [
@@ -296,25 +316,27 @@ const finishUtilityNode = async (run, node) => {
applyRelicNodeEnter(run,node);
applyRoomRelics(run,node,"enter");
if (node.type == "rest") {
const used=new Set(),tent=heldRelics(run).some(r=>r.rule.allRestOptions);
while(true){
const choices=[
{ id: "heal", name: "休息",
description: `回复 ${restRecovery(run)} 点生命` },
{ id: "upgrade", name: "磨砺",
description: hasUpgradeableCard(run.player.deck)
? "随机强化一张尚未满级的可强化牌"
: "没有可强化卡牌",
disabled: !hasUpgradeableCard(run.player.deck) },
...relicRestChoices(run)].filter(choice=>!used.has(choice.id));
if(tent)choices.push({id:"done",name:"离开休息处"});
if(!choices.some(choice=>!choice.disabled))break;
const choice=await chooseButtons("休息节点",choices);
if(choice==="done")break;
const result=applyRoomRelics(run,node,choice); used.add(choice);
if(result?.recovered)game.log(`回复${result.recovered}点生命`);
await finishRelicChoices(run);
if(!tent)break;
const used = new Set();
const tent = heldRelics(run).some(relic => relic.rule.allRestOptions);
let lastAction;
while (true) {
const canUpgrade = hasUpgradeableCard(run.player.deck);
const choices = [
{ id: "heal", name: "休息", description: `回复 ${restRecovery(run)} 点生命` },
{ id: "upgrade", name: "磨砺",
description: canUpgrade ? "随机强化一张尚未满级的可强化牌" : "没有可强化卡牌",
disabled: !canUpgrade },
...relicRestChoices(run),
].filter(choice => !used.has(choice.id));
if (!tent && !choices.some(choice => !choice.disabled)) break;
const choice = await chooseRest(choices, { tent, lastAction });
if (choice === "done") break;
const result = applyRoomRelics(run, node, choice);
used.add(choice);
lastAction = choices.find(option => option.id === choice)?.name;
if (result?.recovered) game.log(`回复${result.recovered}点生命`);
await finishRelicChoices(run);
if (!tent) break;
}
}
else if (node.type == "chest") {
@@ -325,41 +347,96 @@ const finishUtilityNode = async (run, node) => {
});
}
else if (node.type == "shop") {
const stockKey=`${run.actIndex}:${node.id}`,state=relicState(run);
const sampleRelic=(exclude=[])=>{
const eligible=relicShopRewardIds.filter(id=>!exclude.includes(id) && canAcquireRelic(run,config.rewards[id]?.relic));
return eligible.length ? eligible[Math.floor(nextRandom(run)*eligible.length)] : null;
const stockKey = `${run.actIndex}:${node.id}`;
const state = relicState(run);
const sampleRelic = (exclude = []) => {
const eligible = relicShopRewardIds.filter(id => !exclude.includes(id) && canAcquireRelic(run, config.rewards[id]?.relic));
return eligible.length ? eligible[Math.floor(nextRandom(run) * eligible.length)] : null;
};
state.shopStock ||= {};
if(!state.shopStock[stockKey]){
const stock=[];for(let i=0;i<3;i++)stock.push(sampleRelic(stock));state.shopStock[stockKey]=stock;
if (!state.shopStock[stockKey]) {
const stock = [];
for (let index = 0; index < 3; index++) stock.push(sampleRelic(stock));
state.shopStock[stockKey] = stock;
}
const purchased=new Set();
run.potionShopStock ||= {};
if (!run.potionShopStock[stockKey]) {
const offers = [];
for (let index = 0; index < 3; index++) {
offers.push(createPotionOffer(run, offers.map(offer => offer?.id)));
}
run.potionShopStock[stockKey] = offers;
}
const potionOffers = run.potionShopStock[stockKey];
const purchased = new Set();
await saveRun(run);
while(true){
const price = relicShopPrice(run,20),relicPrice=relicShopPrice(run,120);
const stock=relicState(run).shopStock[stockKey];
const choices=[
{ id: "card_sha", name: `购买【杀】(${price}金币)`, description: "加入个人牌组", disabled: run.player.gold < price || !canAcquireCard(run.player.character, "sha") },
{ id: "heal", name: `恢复生命(${price}金币)`, description: "回复 8 点生命", disabled: run.player.gold < price },
].filter(choice=>!purchased.has(choice.id));
stock.forEach((id,index)=>{const reward=config.rewards[id];if(reward && canAcquireRelic(run,reward.relic))choices.push({id:`relic:${index}`,name:`${reward.name}(${relicPrice}金币)`,description:reward.description,image:reward.image,disabled:run.player.gold<relicPrice});});
choices.push({id:"leave",name:"离开",description:"结束购物"});
const choice=await chooseButtons("商店",choices);
if (choice != "leave" && choice != null) {
const selected=choices.find(item=>item.id===choice);
if(!selected || selected.disabled)throw new Error("梦三商店购买资格无效");
const relicIndex=choice.startsWith("relic:") ? Number(choice.slice(6)) : null;
const cost=relicIndex!==null ? relicPrice : price;
if(run.player.gold<cost)throw new Error("梦三商店金币不足");
run.player.gold-=cost;recordRelicShopPurchase(run);
applyReward(run,relicIndex!==null ? stock[relicIndex] : choice);
while (true) {
const price = relicShopPrice(run, 20);
const relicPrice = relicShopPrice(run, 120);
const stock = relicState(run).shopStock[stockKey];
const choices = [
{ id: "card_sha", name: "【杀】", price, description: "加入个人牌组",
disabled: run.player.gold < price || !canAcquireCard(run.player.character, "sha") },
{ id: "heal", name: "恢复生命", price, description: "回复 8 点生命",
disabled: run.player.gold < price },
].filter(choice => !purchased.has(choice.id));
stock.forEach((id, index) => {
const reward = config.rewards[id];
if (!reward || !canAcquireRelic(run, reward.relic)) return;
choices.push({
id: `relic:${index}`,
name: getRelic(reward.relic).name,
price: relicPrice,
description: reward.description,
image: reward.image,
disabled: run.player.gold < relicPrice,
});
});
potionOffers.forEach((offer, index) => {
if (!offer) return;
const price = relicShopPrice(run, offer.price);
choices.push({
...potionView(offer.id),
id: "potion:" + index,
price,
disabled: run.player.gold < price,
});
});
const choice = await chooseShop(run.player, choices);
if (choice === "leave" || choice == null) break;
const selected = choices.find(item => item.id === choice);
if (!selected || selected.disabled) throw new Error("梦三商店购买资格无效");
const relicIndex = choice.startsWith("relic:") ? Number(choice.slice(6)) : null;
if (run.player.gold < selected.price) throw new Error("梦三商店金币不足");
if (choice.startsWith("potion:")) {
const index = Number(choice.slice(7));
const offer = potionOffers[index];
const selection = await choosePotionReplacement(potionSlots(run.player), offer.id);
if (!selection) continue;
if (!acquirePotion(run.player, offer.id, selection.replaceIndex)) {
throw new Error("梦三商店药水栏位无效");
}
run.player.gold -= selected.price;
recordRelicShopPurchase(run);
const courier = heldRelics(run).some(relic => relic.wikiId === "the_courier");
potionOffers[index] = courier ? createPotionOffer(run,
potionOffers.filter((_, slot) => slot !== index).map(offer => offer?.id)) : null;
continue;
}
run.player.gold -= selected.price;
recordRelicShopPurchase(run);
applyReward(run, relicIndex !== null ? stock[relicIndex] : choice);
await finishRelicChoices(run);
if(relicIndex!==null)relicState(run).shopStock[stockKey][relicIndex]=heldRelics(run).some(r=>r.wikiId==="the_courier") ? sampleRelic(relicState(run).shopStock[stockKey]) : null;
else if(!heldRelics(run).some(r=>r.wikiId==="the_courier"))purchased.add(choice);
} else break;
const hasCourier = heldRelics(run).some(relic => relic.wikiId === "the_courier");
if (relicIndex !== null) {
const currentStock = relicState(run).shopStock[stockKey];
currentStock[relicIndex] = hasCourier ? sampleRelic(currentStock) : null;
} else if (!hasCourier) purchased.add(choice);
}
}
else if (await finishRandomEvent(run, node, chooseButtons, name => get.translation(name))) {
await finishRelicChoices(run);
}
else {
const choices = [
{ id: "gold", name: "收下钱袋", description: "获得 15 金币" },
@@ -496,6 +573,7 @@ const { planBondIntent, executeBondIntent } =
createBondIntentActions(game, () => activeBattle);
const equipBattleUnit = async (player, spec, resources) => {
for (const info of spec.equipment || []) {
if (info.name === "muniu") continue;
const card = resources.card(game.createCard(info.name, info.suit, info.number, info.nature));
await player.equip(card);
}
@@ -515,7 +593,7 @@ const spawnBattleUnit = async (current, spec, anchor) => {
mountEnergy(player, current.session, document));
current.intentUI.set(player, mountEnemyIntent(player,
current.session, STYLE_PATH, document,
() => getIntentHostiles(game, player)));
() => getIntentHostiles(game, player), () => current));
}
for (const participant of [...game.players, ...game.dead]) participant.setSeatNum(Number(participant.dataset.position) + 1);
await equipBattleUnit(player, spec, current.resources);
@@ -582,6 +660,7 @@ const prepareBattle = async (run, node, encounter, session, resources) => {
for (const skill of spec.skills || []) if (!lib.skill[skill]) throw new Error("关卡技能未加载:" + skill);
const slots = new Set();
for (const card of spec.equipment || []) {
if (card.name === "muniu") continue;
const info = lib.card[card.name];
if (!info || info.type !== "equip" || !info.subtype || slots.has(info.subtype)) throw new Error("初始装备不存在、不是装备或槽位重复:" + card.name);
slots.add(info.subtype);
@@ -593,6 +672,7 @@ const prepareBattle = async (run, node, encounter, session, resources) => {
consumeSupports(run);
document.body.classList.add("mengsan-battle-ui-shuying");
session.ownResource({}, () => document.body.classList.remove("mengsan-battle-ui-shuying"));
mountCardChoiceNames(session, resources, { ui, lib, document });
resources.field(_status, "mengsanRun_shuying", run);
resources.field(_status, "mengsanNode_shuying", node);
resources.field(_status, "mengsanEncounter_shuying", encounter);
@@ -604,6 +684,8 @@ const prepareBattle = async (run, node, encounter, session, resources) => {
});
shuffleBattlePile(run, _status.mengsanBattle_shuying.drawPile);
// 剧情 NPC 和判定仍用公共牌堆,建堆前排除所有牌包里的木牛流马。
resources.field(lib.card, "list", lib.card.list.filter(([, , name]) => name !== "muniu"));
game.prepareArena(1 + plan.units.length);
resources.capturePreparedArena();
// Register runtime IDs before card ownership transfers (gain/lose).
@@ -634,7 +716,7 @@ const prepareBattle = async (run, node, encounter, session, resources) => {
participants.forEach((player, index) => {
if (monsters[index]) currentBattle.intentUI.set(player,
mountEnemyIntent(player, session, STYLE_PATH, document,
() => getIntentHostiles(game, player)));
() => getIntentHostiles(game, player), () => currentBattle));
});
participants.forEach(player => {
if (player.storage.mengsanBond_shuying) {
@@ -671,6 +753,7 @@ const prepareBattle = async (run, node, encounter, session, resources) => {
piles:currentBattle.personalPiles,
isStrike: card => isStrikeCard(card,lib),
draw: number => game.mengsanDraw_shuying(me, number),
onCounterChange: () => currentBattle.relicUI?.refreshCounters(),
effect: createOpeningEffects(game, me,
() => currentBattle.energyUI.get(me)?.(), () => nextRandom(run)),
log: (relic, effect) => {
@@ -686,7 +769,8 @@ const prepareBattle = async (run, node, encounter, session, resources) => {
sessionId: session.id,
existingGlobalSkills: [...(lib.skill.global || [])],
});
for (const skill of [
// 原生全局注册只处理传入的技能,group 中的触发需要逐个注册。
for (const skill of game.expandSkills([
"mengsan_draw_shuying", "mengsan_card_use_shuying", "mengsan_ic_bridge_shuying", "mengsan_shared_bridge_shuying",
"mengsan_card_affixes_shuying", "mengsan_scenario_shuying", "mengsan_intent_refresh_shuying",
"mengsan_card_payment_shuying", "mengsan_monster_draw_shuying",
@@ -709,7 +793,7 @@ const prepareBattle = async (run, node, encounter, session, resources) => {
"mengsan_relics_shuying",
"mengsan_relic_attack_shuying",
"mengsan_relic_boot_shuying",
]) {
])) {
if (!lib.skill.global.includes(skill)) {
game.addGlobalSkill(skill);
session.ownResource({}, () => game.removeGlobalSkill(skill));
@@ -717,6 +801,11 @@ const prepareBattle = async (run, node, encounter, session, resources) => {
}
activeBattle.pilesUI = mountBattlePiles(session, _status.mengsanBattle_shuying);
currentBattle.owner = me;
currentBattle.run = run;
potionSkillIds.forEach(skill => me.addSkill(skill));
currentBattle.potionUI = mountPotionSlots(ui.arena, run.player,
createPotionActions(currentBattle, { lib, game, ui, _status }));
session.ownResource(currentBattle.potionUI, () => currentBattle.potionUI.dispose());
currentBattle.hud = mountBattleHUD(me, currentBattle, {
game, ui, get, lib, _status, document, window, assetBase: STYLE_PATH,
log: message => game.log(message),
@@ -811,13 +900,16 @@ const makeFlow = (releaseSkills = async () => {}, releaseBattle = () => {}) => c
(card ? `强化【${get.translation(card.name)}】` : "未强化卡牌"));
},
}),
chooseReward: (choices, options) => (options.rewardPackage
? chooseRewardPackage : chooseBattleReward)(choices, {
...options,
fixedRewards: options.fixedRewards.map(id => ({
chooseReward: async (choices, options) => {
const rewards = { ...options, fixedRewards: options.fixedRewards.map(id => ({
...config.rewards[id], id,
})),
}),
})) };
if (rewards.rewardPackage) return chooseRewardPackage(choices, rewards);
const rewardId = await chooseBattleReward(choices, rewards);
if (!rewards.potionChoices.length) return rewardId;
const potion = await choosePotionReward(rewards.potionChoices, rewards.potionSlots);
return { rewardId, potion };
},
chooseDefeat:chooseDefeatAction,
showMap,
showEnding:async (route, run) => {
@@ -836,12 +928,14 @@ const requestBattleFinish = outcome => {
// Complete the original card and all queued replays before snapshotting a victory.
if(outcome==="victory" && current.sharedPendingUses?.size){
diagnostics.info("victory.deferred", { pendingUses: current.sharedPendingUses.size });
current.sharedDeferredVictory=true;return false;
return false;
}
for (const player of game.dead) {
recordBondDeath(player, _status.mengsanRun_shuying,
message => game.log(message));
}
// Capture the final HUD state while its battle session is still active.
current.hud?.refresh();
const accepted = current.flow.requestFinish({session:current.session, hp:game.me?.hp || 0, outcome, defeatedEnemies:current.director?.defeatedEnemies ?? 1});
if (accepted) {
current.pilesUI?.dispose();
@@ -965,9 +1059,15 @@ const routeRun = async (run, selected = null, supplied = false) => {
const startJourney = async () => {
lib.translate.restart = "返回";
let run = modeStorage.read()[config.saveKey] || null;
let selectCharacterDirectly = consumeJourneyRestart() && !run;
while (true) {
const action = await chooseRun(run);
const action = selectCharacterDirectly ? "new" : await chooseRun(run);
selectCharacterDirectly = false;
if (action === "continue") break;
if (action === "restart") {
await confirmRestartJourney();
continue;
}
const character = await chooseCharacter();
if (character === "back") continue;
if (run) {
@@ -993,6 +1093,7 @@ const createMode = () => {
const nativeChangeHujia = lib.element.Player.prototype.changeHujia;
const nativeChangeHp = lib.element.Player.prototype.changeHp;
const nativeAddSkill = lib.element.Player.prototype.addSkill;
const nativePhaseDraw = lib.element.Player.prototype.phaseDraw;
const cardContext = {
game, get, lib, random:nextRandom, status:_status, getBattle:()=>activeBattle,
copyToDiscard: createBattleCardCopier(game, () => activeBattle),
@@ -1029,6 +1130,11 @@ const createMode = () => {
element: {
player: {
...createCampPlayerMethods(game),
phaseDraw() {
const next = nativePhaseDraw.call(this);
if (this.storage?.mengsanPlayer_shuying && this.name1 === LIUBEI_CARD_OWNER) next.num = 3;
return next;
},
addSkill(skill, ...args) {
// 初始武将技能由核心过滤;同时阻止奖励、剧情等动态授予主公技。
if (Array.isArray(skill)) skill = skill.filter(name => !lib.skill[name]?.zhuSkill);
@@ -1059,6 +1165,7 @@ const createMode = () => {
return next;
},
changeHujia(num, type) {
if (type === potionBlockType) return nativeChangeHujia.call(this, num, "gain", false);
if(activeBattle?.session.active && type!=="damage")num=relicBlockAmount(this,beforeIroncladBlock(this,beforeSharedBlock(this,num??1,_status.event),_status.event),_status.event);
// 脆弱只削减正向获得的护甲,不改变受伤时消耗护甲的数值。
if (this.storage?.mengsanFrail_shuying > 0 && (num == null || num > 0) && type !== "damage") {
@@ -1350,6 +1457,7 @@ const createMode = () => {
},
skill: {
...cardPacks.skills,
...createPotionSkills(() => activeBattle, game),
...createRelicSkills(() => activeBattle, () => game.me),
...createRelicCombatSkills(() => activeBattle, () => game.me),
mengsan_taoyuan_bond_shuying: {
@@ -1803,25 +1911,32 @@ const createMode = () => {
},
mengsan_vulnerable_shuying: {
mark: true, marktext: "易",
group: "mengsan_vulnerable_damage_shuying",
onremove(player) { delete player.storage.mengsanVulnerable_shuying; },
intro: { content(storage, player) { return `剩余${player.storage.mengsanVulnerable_shuying || 0}回合:受到攻击伤害增加50%(向上取整)`; } },
trigger: { player: ["damageBegin1", "phaseAfter"] },
trigger: { player: "phaseAfter" },
forced: true, silent: true, popup: false,
filter(event, player) {
if (!player.storage?.mengsanVulnerable_shuying) return false;
return event.name !== "damage" || Boolean(event.card || event.mengsanAttack_shuying);
},
filter(event, player) { return player.storage?.mengsanVulnerable_shuying > 0; },
async content(event, trigger, player) {
if (event.triggername === "damageBegin1") {
trigger.num = Math.ceil(trigger.num * ((trigger.source===game.me && activeBattle?.relics?.has("paper_phrog") ? 1.75 : 1.5) + cardPacks.vulnerableBonus(trigger.source, player)));
return;
}
const remaining = Math.max(0, (player.storage.mengsanVulnerable_shuying || 0) - 1);
player.storage.mengsanVulnerable_shuying = remaining;
if (remaining) player.markSkill("mengsan_vulnerable_shuying");
else player.removeSkill("mengsan_vulnerable_shuying");
},
},
mengsan_vulnerable_damage_shuying: {
// 来源的力量、虚弱和缩小在 damageBegin1 结算,易伤随后统一放大。
trigger: { player: "damageBegin2" },
forced: true, silent: true, popup: false, firstDo: true,
filter(event, player) {
return player.storage?.mengsanVulnerable_shuying > 0 &&
(isAttackCard(event.card) || event.mengsanAttack_shuying);
},
async content(event, trigger, player) {
const base = trigger.source === game.me && activeBattle?.relics?.has("paper_phrog") ? 1.75 : 1.5;
trigger.num = Math.ceil(trigger.num * (base + cardPacks.vulnerableBonus(trigger.source, player)));
},
},
mengsan_intent_refresh_shuying: {
trigger: { global: ["useCardAfter", "useSkillAfter", "respondAfter", "changeHpAfter", "dieAfter", "phaseAfter"] },
forced: true, silent: true, popup: false, priority: -1000,
@@ -1943,6 +2058,7 @@ const createMode = () => {
},
},
translate: {
...potionSkillTranslations,
mengsan_ally_shuying: "友",
mengsan_ally_shuying2: "友方",
mengsan_enemy_shuying: "敌",
@@ -2025,10 +2141,11 @@ export async function createMengsanMode() {
[245, 196, 193, 1], [192, 85, 91, 1],
] });
}
await new Promise(resolve => {
const style = lib.init.css(`${STYLE_PATH}/ui`, "style", resolve);
await Promise.all(["style", "shop", "rest", "potions", "character-select"].map(name => new Promise(resolve => {
const style = lib.init.css(`${STYLE_PATH}/ui`, name, resolve);
style.addEventListener("error", resolve, { once: true });
});
})));
await loadPotionAssets(lib);
const mode = createMode();
mode.splash = "ext:术樱包/pve/images/tianshu.jpg";
return mode;
+99
View File
@@ -0,0 +1,99 @@
import { campEnemy } from "../battle/camps.js";
import { createOpeningEffects } from "../relics/combat.js";
import { getPotion, potionIds, potionSlots, removePotion } from "./state.js";
const selectedSlots = new WeakMap();
const skillId = id => "mengsan_use_" + id.toLowerCase() + "_shuying";
export const potionSkillIds = potionIds.map(skillId);
export const potionSkillTranslations = Object.fromEntries(
potionIds.map(id => [skillId(id), getPotion(id).name]));
export const potionBlockType = "mengsanPotionBlock";
const openingEffects = {
ENERGY_POTION: "energy",
FIRE_POTION: "targetDamage",
STRENGTH_POTION: "openingStrength",
};
function phaseChoice(event, player, battle) {
return battle?.session.active && player === battle.owner && player.isAlive() &&
event?.name === "chooseToUse" && event.type === "phase" &&
event.player === player && event.parent?.name === "phaseUse" && !event.respondTo;
}
const legalEnemy = (game, player, enemy) => game.players.includes(enemy) &&
enemy.isAlive() && campEnemy(player, enemy);
export function createPotionSkills(getBattle, game) {
return Object.fromEntries(potionIds.map(id => {
const { amount, enemy, name } = getPotion(id);
const skill = {
enable: "phaseUse",
manualConfirm: true,
discard: false,
lose: false,
log: false,
filter(event, player) {
const battle = getBattle();
return phaseChoice(event, player, battle) && potionSlots(battle.run.player).includes(id) &&
(!enemy || game.players.some(target => legalEnemy(game, player, target)));
},
async content(event, trigger, player) {
const battle = getBattle();
const choice = event.getParent("chooseToUse");
if (!phaseChoice(choice, player, battle)) return;
const target = event.targets?.[0];
if (enemy && !legalEnemy(game, player, target)) return;
const inventory = battle.run.player;
const request = selectedSlots.get(choice);
selectedSlots.delete(choice);
const index = request?.id === id ? request.index : potionSlots(inventory).indexOf(id);
if (!removePotion(inventory, index, id)) return;
battle.potionUI?.refresh();
game.log(player, "使用了" + name);
if (id === "SWIFT_POTION") {
await game.mengsanDraw_shuying(player, amount);
} else if (id === "BLOCK_POTION") {
await player.changeHujia(amount, potionBlockType);
} else {
const applyEffect = createOpeningEffects(game, player, () => battle.energyUI.get(player)?.());
await applyEffect({ effect: openingEffects[id], amount, target });
}
},
};
if (enemy) {
skill.selectTarget = 1;
skill.filterTarget = (card, player, target) => legalEnemy(game, player, target);
}
return [skillId(id), skill];
}));
}
export function createPotionActions(battle, { lib, game, ui, _status }) {
const { owner, run } = battle;
const ready = () => {
const event = _status.event;
return phaseChoice(event, owner, battle) && event.isMine() && !event.finished &&
!event.skill && !_status.paused2 && !ui.intro &&
!ui.selected.cards.length && !ui.selected.targets.length && !ui.selected.buttons.length;
};
const canUse = (index, id) => ready() && potionSlots(run.player)[index] === id &&
lib.filter.filterEnable(_status.event, owner, skillId(id));
return {
canUse,
canDiscard: ready,
use(index, id) {
if (!canUse(index, id)) return;
selectedSlots.set(_status.event, { index, id });
ui.click.skill(skillId(id));
},
discard(index, id) {
if (!ready() || !removePotion(run.player, index, id)) return;
selectedSlots.delete(_status.event);
battle.potionUI?.refresh();
game.log(owner, "丢弃了" + getPotion(id).name);
delete _status.event._skillChoice;
game.check();
},
};
}
+65
View File
@@ -0,0 +1,65 @@
import { getPotion, potionIds } from "./state.js";
const configKey = "mengsan_potion_localization_shuying";
const assetBase = new URL("../assets/sts2/potions/", import.meta.url);
const referenceRoot = "D:/workspace/术樱包-本地资料/参考资料/";
const localText = referenceRoot + "Slay the Spire 2/localization/zhs/potions.json";
const localIcons = referenceRoot +
"梦三/STS2拆分图集/Godot_Atlas_Sprites_v0.111.0/images/atlases/potion_atlas.sprites/";
let translations = null;
const localImages = new Map();
export function setPotionText(source) {
const entries = potionIds.flatMap(id => [id + ".title", id + ".description"]);
if (entries.some(key => typeof source?.[key] !== "string" || !source[key].trim())) {
throw new Error("请选择包含首批五种药水名称和说明的 potions.json");
}
translations = Object.fromEntries(entries.map(key => [key, source[key]]));
return translations;
}
export const hasPotionText = () => translations !== null;
export async function loadPotionAssets(lib) {
const fs = lib.node?.fs?.promises;
if (fs) {
await Promise.allSettled([
fs.readFile(localText, "utf8").then(source => setPotionText(JSON.parse(source))),
...potionIds.map(async id => {
const bytes = await fs.readFile(localIcons + id.toLowerCase() + ".png");
localImages.set(id, "data:image/png;base64," + bytes.toString("base64"));
}),
]);
}
if (hasPotionText()) return;
if (lib.config[configKey]) {
try { setPotionText(lib.config[configKey]); } catch { /* Try the resource directory. */ }
}
if (!hasPotionText()) {
try {
const response = await fetch(new URL("potions.json", assetBase));
if (response.ok) setPotionText(await response.json());
} catch { /* The player can load their JSON from the map. */ }
}
}
export async function importPotionText(file, game) {
const text = setPotionText(JSON.parse(await file.text()));
game.saveConfig(configKey, text);
}
export function potionView(id) {
const definition = getPotion(id);
if (!definition) return null;
const template = translations?.[id + ".description"];
const rendered = template?.replace(/\{(\w+)(?::([^}]+))?\}/g, (token, key, formatter) => {
if (key !== definition.variable) return token;
return formatter === "energyIcons()" ? "⚡".repeat(definition.amount) : String(definition.amount);
}) ?? (definition.stat + " " + definition.amount);
return {
name: translations?.[id + ".title"] ?? definition.name,
description: rendered.replace(/\[\/?(?:blue|gold|green|red)\]/g, ""),
richDescription: rendered,
image: localImages.get(id) ?? new URL(id.toLowerCase() + ".png", assetBase).href,
};
}
+63
View File
@@ -0,0 +1,63 @@
import { nextRandom } from "../progression/state.js";
export const potions = Object.freeze({
ENERGY_POTION: { name: "能量药水", stat: "能量", variable: "Energy", amount: 2 },
BLOCK_POTION: { name: "格挡药水", stat: "格挡", variable: "Block", amount: 12 },
SWIFT_POTION: { name: "迅捷药水", stat: "抽牌", variable: "Cards", amount: 3 },
FIRE_POTION: { name: "火焰药水", stat: "伤害", variable: "Damage", amount: 20, enemy: true },
STRENGTH_POTION: { name: "力量药水", stat: "力量", variable: "StrengthPower", amount: 2 },
});
export const potionIds = Object.freeze(Object.keys(potions));
export const getPotion = id => Object.hasOwn(potions, id) ? potions[id] : null;
export const potionCapacity = player => 3 + (player.potionSlotBonus ?? 0);
export const potionSlots = player => Array.from({ length: potionCapacity(player) }, (_, index) =>
getPotion(player.potions?.[index]) ? player.potions[index] : null);
export function samplePotions(run, count, exclude = []) {
const pool = potionIds.filter(id => !exclude.includes(id));
const result = [];
while (result.length < count && pool.length) {
result.push(pool.splice(Math.floor(nextRandom(run) * pool.length), 1)[0]);
}
return result;
}
export function rollPotionReward(run, elite) {
const chance = run.potionDropChance ?? 40;
const dropped = nextRandom(run) * 100 < chance + (elite ? 12.5 : 0);
run.potionDropChance = chance + (dropped ? -10 : 10);
return dropped ? samplePotions(run, 1) : [];
}
export function createPotionOffer(run, excluded) {
const [id] = samplePotions(run, 1, excluded);
return id ? { id, price: Math.round(50 * (0.95 + nextRandom(run) * 0.1)) } : null;
}
export function acquirePotion(player, id, replaceIndex = null) {
if (!getPotion(id)) return false;
const slots = potionSlots(player);
const empty = slots.indexOf(null);
const index = replaceIndex ?? empty;
if (!Number.isInteger(index) || index < 0 || index >= slots.length ||
(replaceIndex !== null && (empty >= 0 || !slots[index]))) return false;
slots[index] = id;
player.potions = slots;
return true;
}
export function removePotion(player, index, id) {
const slots = potionSlots(player);
if (!getPotion(id) || slots[index] !== id) return false;
slots[index] = null;
player.potions = slots;
return true;
}
export function applyPotionReward(player, candidates, selection) {
if (selection == null) return;
if (!candidates.includes(selection.id) || !acquirePotion(player, selection.id, selection.replaceIndex)) {
throw new Error("药水奖励选择无效");
}
}
+2 -1
View File
@@ -74,6 +74,7 @@ const persistModeStorage = (update = () => {}, context = {}) => {
receipt.phase = "mutator";
update(storage);
stripBattleProgress(storage[config.saveKey]);
migrateRetiredCards(storage[config.saveKey]);
storage.version = lib.version;
await writeModeStorage(storage, receipt);
receipt.phase = "memory.publish";
@@ -99,7 +100,7 @@ const persistModeStorage = (update = () => {}, context = {}) => {
const saveRun = async run => {
try {
// Capture before enqueue: subsequent gameplay mutations cannot alter this save.
const snapshot = migrateRetiredCards(stripBattleProgress(copy(run)));
const snapshot = copy(run);
await persistModeStorage(storage => {
storage[config.saveKey] = snapshot;
}, { runId: snapshot.runId, revision: snapshot.revision });
+121
View File
@@ -0,0 +1,121 @@
import { cardDefinitions } from "../cards/card-definitions.js";
import { isRetiredDeckCard } from "../cards/retired-cards.js";
import { canUpgradeCard } from "../cards/upgrades.js";
import { addPermanentRelicCard, relicCardPool, transformPermanentCard } from "../relics/progression.js";
import { randomGet } from "./state.js";
const services = {
remove: { name: "剔除", description: "从永久牌组移除一张牌" },
transform: { name: "易换", description: "将一张牌变成另一张随机武将牌" },
upgrade: { name: "磨砺", description: "永久强化一张牌" },
duplicate: { name: "誊录", description: "复制一张牌,保留强化和已有成长" },
cleanse: { name: "禳解", description: "移除牌组中所有可移除的诅咒牌" },
};
const events = [
{
id: "quartermaster",
actIndex: 0,
name: "辎重盘点",
description: "车骑将在天明前启程。管领辎重的军吏愿匀出片刻,按你的意思整备行装。",
services: ["remove", "transform", "upgrade"],
},
{
id: "ford-ward",
name: "渡口禳符",
description: "渡口有人替夜行的旅人解去厄契。他望见你行囊里的咒印,请你把能解的都交出来。",
services: ["cleanse"],
},
{
id: "camp-scribe",
name: "营中抄手",
description: "帐里灯火未熄。书吏铺开一片新简,愿为你照录一份军中旧法。",
services: ["duplicate"],
},
{
id: "pack-mender",
name: "裁囊人",
description: "背囊的缝线快绷开了。驿道旁的修补匠替你理出了一处可以舍去的累赘。",
services: ["remove"],
},
{
id: "county-exchange",
name: "县亭换策",
description: "县亭墙下有人收集各营送来的战书。交出手中一策,他便从封存的竹筒中取出另一策。",
services: ["transform"],
},
{
id: "old-drillmaster",
name: "旧营教头",
description: "废营里仍立着几只草靶。一名老教头正在校正槊架,答应替你指点一门尚未练熟的本领。",
services: ["upgrade"],
},
];
const leave = { id: "leave", name: "继续赶路" };
const canRemove = card => !card.affixes?.includes("eternal");
const suitNames = { spade: "♠", heart: "♥", club: "♣", diamond: "♦" };
function eventTargets(run, transformPool) {
const { deck, character } = run.player;
const removable = deck.filter(canRemove);
const curses = removable.filter(card => cardDefinitions[card.name]?.cardType === "curse");
return {
remove: deck.length > 1 ? removable : [],
transform: removable.filter(card => transformPool.some(name => name !== card.name)),
upgrade: deck.filter(canUpgradeCard),
duplicate: deck.filter(card => Object.hasOwn(cardDefinitions, card.name) && !isRetiredDeckCard(character, card.name)),
cleanse: curses.length < deck.length ? curses : [],
};
}
async function applyEventService(run, event, kind, targets, transformPool, choose, translate) {
const { deck } = run.player;
if (kind === "cleanse") {
const removed = new Set(targets);
run.player.deck = deck.filter(card => !removed.has(card));
return;
}
const options = targets.map(card => ({
id: card.id,
name: `${translate(card.name) || card.name}${card.upgrade ? ` +${card.upgrade}` : ""}`,
description: `${suitNames[card.suit] || card.suit} ${card.number}`,
}));
const selected = await choose(event.name, [...options, leave], services[kind].description, { back: leave.id });
if (selected === leave.id) return;
const card = targets.find(card => card.id === selected);
if (!card) throw new Error("梦三事件选牌无效");
if (kind === "remove") {
deck.splice(deck.indexOf(card), 1);
} else if (kind === "transform") {
const candidates = transformPool.filter(name => name !== card.name);
transformPermanentCard(run, card, false, candidates);
await choose(event.name, [{ id: "continue", name: "继续赶路" }], `获得【${translate(card.name) || card.name}】。`);
} else if (kind === "upgrade") {
card.upgrade = (card.upgrade || 0) + 1;
} else if (kind === "duplicate") {
addPermanentRelicCard(run, card.name, card);
}
}
export async function finishRandomEvent(run, node, choose, translate) {
if (run.actIndex !== 0 || node.type !== "event" || node.contentId || node.completed) return false;
const seen = new Set(run.map.nodes.filter(entry => entry.completed).map(entry => entry.eventId));
const transformPool = relicCardPool(run);
const targets = eventTargets(run, transformPool);
const candidates = events.filter(event => (event.actIndex == null || event.actIndex === run.actIndex) &&
!seen.has(event.id) && event.services.some(kind => targets[kind].length));
if (!candidates.length) return false;
const event = randomGet(run, candidates);
const options = event.services.map(kind => ({ id: kind, ...services[kind], disabled: !targets[kind].length }));
const kind = await choose(event.name, [...options, leave], event.description, { back: leave.id });
if (kind !== leave.id) {
if (!event.services.includes(kind) || !targets[kind].length) throw new Error("梦三事件选项无效");
await applyEventService(run, event, kind, targets[kind], transformPool, choose, translate);
}
node.eventId = event.id;
return true;
}
+1
View File
@@ -181,6 +181,7 @@ export const createRun = character => {
permanentSkills: [],
temporarySkills: [],
items: [],
potions: [],
handLimitBonus: 0,
},
statistics: {
@@ -1,5 +1,7 @@
# STS2 遗物接入记录(2026-10-06)
> **2026-11-24 现状补记** 下方统计和逐件记录对应 2026-10-06 接入批次。当前 `relics/definitions.js` 的 298 件 Wiki 遗物中,167 件标记为已接入、14 件为适配、117 件仍待实现。当前已有可用药水和商店药水货位,送货员会补充购出的药水,见[休息与商店](../docs/act1-encounters.md#休息与商店)。
已登记全部 **298** 件 Wiki 遗物,匹配 **298** 张原图。**181** 件效果已接入,其中 **13** 件有明确梦三适配;**117** 件保留资料、图片及缺口记录,获取资格拒绝这些条目。另保留原梦三束带,不计入 Wiki 298 件。
本次直接修改实际梦三模块,未制作修复副本;没有生成或重绘三国杀风格图片。原有三个 dist 发布清单的既存改动未触碰。本记录中的“已接入”仅表示源码有对应执行接口,**不是实机验收结论**。
+6
View File
@@ -20,6 +20,12 @@
保留蛇之戒指、长蛇戒指、百年积木、节日拉炮等既有内部ID;支持 Wiki ID 查询。
全部原图见 [资源记录](ASSETS.md)。图片和隔离检查通过不代表实机验收。
遗物校验、遗物导入和状态图标导入共用一处拆分图集来源。把包含
`Godot_Atlas_Sprites_v0.111.0/` 的目录写入 `mengsan/tools/.sts2-source`,
一行 UTF-8 纯文本即可,此文件仅用于当前机器。也可以设置
`MENGSAN_STS2_SOURCE` 临时覆盖。相对路径以 `mengsan/tools/` 为基准,
两处均未设置时读取原 `mengsan/assets/sts2/`。遗物导入还需单独提供 Wiki 快照。
从术樱包目录运行检查:
```powershell
+175 -37
View File
@@ -1,6 +1,7 @@
import { heldRelics, grantRelic, getRelic, relicDefinitions, canAcquireRelic } from "./definitions.js";
import { cardType, starterKind, relicState, healRun, grantGold, changeMaxHp, upgradeCards, newRelicCard, relicCardPool } from "./progression.js";
import { cardUpgradeLevel, canUpgradeCard } from "../cards/upgrades.js";
import { isRetiredDeckCard } from "../cards/retired-cards.js";
import { relicRandomGet, relicRandom } from "./random.js";
import { sharedByName } from "../cards/packs/shared/data.js";
import { ironcladByName } from "../cards/packs/liubei/data.js";
@@ -10,15 +11,30 @@ export function nearestRelicUse(event) {
for (let current=event;current && !seen.has(current);current=current.parent) { seen.add(current); if(current.name==="useCard")return current; }
return null;
}
export function createRelicBattle(run,{active,draw,log,effect,owner,node={},encounter={},piles,isStrike=card=>starterKind(card)==="strike"}) {
const progress = (value, label, goal) => ({
value,
label: `${label} ${value}${goal === undefined ? "" : `/${goal}`}`,
});
export function createRelicBattle(run,{active,draw,log,effect,owner,node={},encounter={},piles,isStrike=card=>starterKind(card)==="strike",onCounterChange=()=>{}}) {
const relics=heldRelics(run).filter(r=>r.implementation!=="pending"), rules=relics.map(r=>r.rule);
const has=id=>relics.some(r=>r.wikiId===id), sum=key=>rules.reduce((s,r)=>s+(r[key] || 0),0);
const saved=relicState(run), uses=new WeakMap(), seenTurns=new WeakSet(), seenLosses=new WeakSet();
saved.counterStarts ||= {};
const attackCount = relic => (saved.attackCount || 0)-(saved.counterStarts[relic.wikiId]?.attack || 0);
const skillCount = relic => (saved.skillCount || 0)-(saved.counterStarts[relic.wikiId]?.skill || 0);
let started=false, turns=0, firstLoss=false, openingHandBonus=0, inRelicEffect=0, ownTurn=false;
let attacks=0, skills=0, powers=0, cards=0, previousCards=null, turnAttacks=0, turnSkills=0, nextEnergy=0, nextBlock=0, hpLost=0;
const runCount = (relic, kind, total) => total - (saved.counterStarts?.[relic.wikiId]?.[kind] || 0);
const attackEnergyRelics = relics.filter(relic => relic.rule.attackEnergyEvery);
const seenResponses = new WeakSet();
const attackEnergyProgress = (relic, count=energyAttacks) => count % relic.rule.attackEnergyEvery;
const skillProgress = (relic, count=saved.skillCount || 0) => runCount(relic, "skill", count) % relic.rule.skillBlockEvery;
const cardProgress = (relic, count=saved.totalCardCount || 0) => runCount(relic, "card", count) % relic.rule.cardDrawEvery;
const exhaustProgress = relic => runCount(relic, "exhaust", saved.exhaustCount || 0) % relic.rule.exhaustDrawEvery;
const periodicDrawRelics = relics.filter(relic => relic.rule.turnEvery);
const turnDrawProgress = relic => saved.turnDrawProgress?.[relic.wikiId] || 0;
const nextEnergy = new Map();
let started=false, turns=0, endedTurns=0, firstLoss=false, openingHandBonus=0, inRelicEffect=0, ownTurn=false;
let attacks=0, cards=0, previousCards=null, turnAttacks=0, turnSkills=0, nextBlock=0, hpLost=0;
let energyAttacks = 0;
const turnAttackProgress = () => turnAttacks % 3;
const turnSkillProgress = () => turnSkills % 3;
let firstPower=false, usedDeath=false, firstCardBlock=false, freeCards=new WeakSet(), dexterity=0, plating=sum("plating"), exhaustQueue=[], shuffles=0, flushing=false;
const physical=card=>card?.cards?.length===1 ? card.cards[0] : card;
const upgradePhysical=card=>{const data=physical(card)?.storage?.mengsanCard_shuying;if(data && canUpgradeCard(data))data.upgrade++;};
@@ -34,7 +50,49 @@ export function createRelicBattle(run,{active,draw,log,effect,owner,node={},enco
const drawMore=async (relic,amount)=>{ if(!usable() || !(amount>0))return; if(!turns)openingHandBonus+=amount; log(relic,`摸${amount}张牌`); await draw(amount); };
const controller={
has,
displayState(){return {dexterity,plating,nextEnergy,nextBlock};},
counter(relic) {
if (relic.implementation === "pending") return null;
const r = relic.rule, id = relic.wikiId;
if (r.attackEnergyEvery) return progress(attackEnergyProgress(relic), "本场攻击牌", r.attackEnergyEvery);
if (r.nthAttackDouble) return progress(runCount(relic, "attack", saved.attackCount || 0) % r.nthAttackDouble, "累计攻击牌", r.nthAttackDouble);
if (r.skillBlockEvery) return progress(skillProgress(relic), "累计技能牌", r.skillBlockEvery);
if (r.cardDrawEvery) return progress(cardProgress(relic), "累计出牌", r.cardDrawEvery);
if (r.exhaustDrawEvery) return progress(exhaustProgress(relic), "累计消耗牌", r.exhaustDrawEvery);
if (r.turnEvery) return progress(turnDrawProgress(relic), "累计自身回合", r.turnEvery);
if (r.tripleAttackBlock || r.tripleAttackDamage || r.tripleAttackDexterity || r.tripleAttackStrength) {
return progress(turnAttackProgress(), "本回合攻击牌", 3);
}
if (r.tripleSkillDamage) return progress(turnSkillProgress(), "本回合技能牌", 3);
if (r.turnCardLimit) return progress(cards, "自身回合已出牌", r.turnCardLimit);
if (r.fifthCardFree) return progress(Math.max(0, 5 - cards), "距离免费出牌还差");
if (r.fewCardsDraw) return progress(cards, "自身回合已出牌", r.fewCardsLimit);
if (r.turnHpLossCap) return progress(Math.max(0, r.turnHpLossCap - hpLost), "本回合还可失去的生命");
if (r.nthTurn || r.fromTurn) return progress(Math.max(0, (r.nthTurn || r.fromTurn) - turns), "触发前剩余回合");
if (r.endTurn) return progress(Math.max(0, r.endTurn - endedTurns), "触发前剩余回合结束次数");
if (r.earlyTurns) return progress(Math.max(0, r.earlyTurns - turns), "剩余额外抽牌回合");
if (r.turnNumberDamage) return progress(turns, "当前自身回合");
if (r.plating) return progress(plating, "当前覆甲");
if (r.vigor) return progress(attacks ? 0 : r.vigor, "剩余活力");
if (r.hpLossNextBlock) return progress(nextBlock, "下回合格挡");
if (r.noAttackNextEnergy || r.unspentNextEnergy) return progress(nextEnergy.get(relic) || 0, "下回合额外能量");
if (r.firstHpLossDraw) return progress(Number(!firstLoss), "本场受伤抽牌剩余次数");
if (r.firstCardBlockDouble) return progress(Number(!firstCardBlock), "本场格挡翻倍剩余次数");
if (r.firstPowerBlock) return progress(Number(!firstPower), "本场能力牌格挡剩余次数");
if (r.afterRestEnergy) return progress(Number(Boolean(saved.afterRest)), "休息后待触发次数");
if (r.oneBattleDrawCards) return progress(Number(!saved.oneBattleUsed?.[id]), "剩余战斗触发次数");
if (r.deathHealFraction) return progress(Number(!saved.lizardTailUsed), "剩余复活次数");
if (r.deckAddHealEvery) return progress((saved.deckAdds || 0) % r.deckAddHealEvery, "累计加入牌组", r.deckAddHealEvery);
if (r.normalBattleUpgradeEvery) return progress((saved.fishingBattles || 0) % r.normalBattleUpgradeEvery, "累计普通战胜利", r.normalBattleUpgradeEvery);
if (r.eliteTransformAfter) return progress(saved.eliteTransform?.[id] || 0, "累计精英战胜利", r.eliteTransformAfter);
if (r.afterBattles) return progress(Math.max(0, r.afterBattles - (saved.battleCounters?.[id] || 0)), "领取遗物前剩余胜利场次");
if (r.candleBattles) return progress(saved.candleRemaining || 0, "剩余燃烧场次");
if (r.limitedBattles) return progress(saved.emberRemaining || 0, "剩余生效场次");
if (r.returnStored) return progress(saved.storedCards?.length || 0, "待返还牌数");
if (r.restAction === "lift") return progress(saved.giryaLevels || 0, "已举重次数", 3);
if (r.breaksOnPurchase) return progress(Number(!saved.mawBankBroken), "储蓄罐可用状态");
return null;
},
displayState(){return {dexterity,plating,nextEnergy:[...nextEnergy.values()].reduce((sum,amount)=>sum+amount,0),nextBlock};},
retainsHand(){return has("runic_pyramid") || has("ringing_triangle") && turns===1;},
get openingHandBonus(){return openingHandBonus;},
get turns(){return turns;},
@@ -62,16 +120,29 @@ export function createRelicBattle(run,{active,draw,log,effect,owner,node={},enco
}
}
if(firstLoss)for(const relic of relics)if(relic.rule.firstHpLossDraw)await drawMore(relic,relic.rule.firstHpLossDraw);
onCounterChange();
},
globalTurnStart(player) {
hpLost=0;
turnAttacks=0;
turnSkills=0;
ownTurn=player===owner;
onCounterChange();
},
globalTurnStart(player){hpLost=0;ownTurn=player===owner;},
resetEnergy(base,current){return base+(has("ice_cream") && turns ? Math.max(0,current || 0) : 0);},
retainedBlock(block){return !turns ? block : Math.min(block,sum("keepBlock"));},
async turnStart(event){
if(!usable() || seenTurns.has(event))return; seenTurns.add(event); turns++;
previousCards=turns>1 ? cards : null; cards=0; turnAttacks=0; turnSkills=0;
if(!usable() || seenTurns.has(event))return; seenTurns.add(event);
endedTurns=turns++;
previousCards=turns>1 ? cards : null; cards=0;
if(turns>1)freeCards=new WeakSet();
await give("nextEnergy",nextEnergy); nextEnergy=0;
for (const relic of periodicDrawRelics) {
(saved.turnDrawProgress ||= {})[relic.wikiId] = (turnDrawProgress(relic) + 1) % relic.rule.turnEvery;
}
for (const [relic, amount] of nextEnergy) await fire(relic, "nextEnergy", amount);
nextEnergy.clear();
await give("nextBlock",nextBlock); nextBlock=0;
onCounterChange();
for(const relic of relics){
const r=relic.rule;
let energy=(r.turnEnergy && (!r.fromTurn || turns>=r.fromTurn) ? r.turnEnergy : 0)+(turns===1 ? r.firstTurnEnergy || 0 : r.laterTurnEnergy || 0);
@@ -82,7 +153,7 @@ export function createRelicBattle(run,{active,draw,log,effect,owner,node={},enco
if(r.paidTurnEnergy && run.player.gold>=r.paidTurnGold){run.player.gold-=r.paidTurnGold;energy+=r.paidTurnEnergy;}
await fire(relic,"energy",energy);
await fire(relic,"openingBlock",r.turnBlock);
let amount=r.turnDraw && (!r.turnEvery || turns%r.turnEvery===0) ? r.turnDraw : 0;
let amount=r.turnDraw && (!r.turnEvery || turnDrawProgress(relic)===0) ? r.turnDraw : 0;
if(r.earlyTurnDraw && turns<=r.earlyTurns)amount+=r.earlyTurnDraw;
if(r.fewCardsDraw && previousCards!==null && previousCards<=r.fewCardsLimit)amount+=r.fewCardsDraw;
await drawMore(relic,amount);
@@ -91,6 +162,7 @@ export function createRelicBattle(run,{active,draw,log,effect,owner,node={},enco
await fire(relic,"openingEnemyStrength",r.enemyTurnStrength);
}
if(turns===1)delete saved.afterRest;
onCounterChange();
},
async beforeDiscard(){
if(!usable())return;
@@ -100,13 +172,16 @@ export function createRelicBattle(run,{active,draw,log,effect,owner,node={},enco
if(!usable())return;
for(const relic of relics){const r=relic.rule;
if(r.noAttackBlock && !turnAttacks)await fire(relic,"openingBlock",r.noAttackBlock);
if(r.noAttackNextEnergy && !turnAttacks)nextEnergy+=r.noAttackNextEnergy;
if(r.unspentNextEnergy && owner.storage.mengsanEnergy_shuying>0)nextEnergy+=r.unspentNextEnergy;
const energy=(!turnAttacks ? r.noAttackNextEnergy || 0 : 0) +
(r.unspentNextEnergy && owner.storage.mengsanEnergy_shuying>0 ? r.unspentNextEnergy : 0);
if(energy)nextEnergy.set(relic,(nextEnergy.get(relic) || 0)+energy);
if(r.emptyBlock && !owner.hujia)await fire(relic,"openingBlock",r.emptyBlock);
if(r.endBlockThreshold && owner.hujia>=r.endBlockThreshold)await fire(relic,"randomDamage",r.endBlockDamage);
if(r.endTurn===turns)await fire(relic,"openingDamage",r.endTurnDamage);
}
if(plating)await give("plating",plating);
endedTurns=turns;
onCounterChange();
},
beforeHpLoss(amount,armor=0){
if(!(amount<0) || !started)return amount;
@@ -119,34 +194,72 @@ export function createRelicBattle(run,{active,draw,log,effect,owner,node={},enco
if(!active() || seenLosses.has(event) || !(event.num<0))return; seenLosses.add(event); hpLost-=event.num;
if(event.parent?.name==="damage")event.parent.mengsanHpDamage_shuying=-event.num;
for(const r of rules)if(r.hpLossNextBlock)nextBlock+=r.hpLossNextBlock;
if(!firstLoss){firstLoss=true; if(started)for(const relic of relics)if(relic.rule.firstHpLossDraw)await drawMore(relic,relic.rule.firstHpLossDraw);}
const first=!firstLoss;
firstLoss=true;
onCounterChange();
if(first && started)for(const relic of relics)if(relic.rule.firstHpLossDraw)await drawMore(relic,relic.rule.firstHpLossDraw);
},
async dying(){
if(!active() && !(owner.hp<=0))return;
if(!has("lizard_tail") || usedDeath || saved.lizardTailUsed || owner.hp>0)return;
usedDeath=true;saved.lizardTailUsed=true;
onCounterChange();
await give("healAbsolute",Math.ceil(owner.maxHp*0.5)-owner.hp);
},
async onUse(use){
if(!usable() || uses.has(use) || use.player!==owner || !use.card || use.mengsanIcEcho_shuying || use.mengsanSharedEcho_shuying)return;
const type=cardType(use.card); const record={type,index:++cards,attackIndex:attacks,vigor:0};uses.set(use,record);
const type=cardType(use.card), record={type,attackIndex:0,vigor:0};
uses.set(use,record);
if(ownTurn)cards++;
saved.totalCardCount=(saved.totalCardCount || 0)+1;
const firstPowerUse=type==="power" && !firstPower;
if(type==="attack"){
attacks++;turnAttacks++;saved.attackCount=(saved.attackCount || 0)+1;record.attackIndex=saved.attackCount; if(attacks===1)record.vigor=sum("vigor");
for(const relic of relics){const r=relic.rule;
if(r.attackEnergyEvery && attackCount(relic)%r.attackEnergyEvery===0)await fire(relic,"energy",1);
if(r.attackBlock)await fire(relic,"openingBlock",r.attackBlock);
if(turnAttacks%3===0){dexterity+=r.tripleAttackDexterity || 0;await fire(relic,"openingBlock",r.tripleAttackBlock);await fire(relic,"randomDamage",r.tripleAttackDamage);await fire(relic,"openingStrength",r.tripleAttackStrength);}
}
attacks++;turnAttacks++;saved.attackCount=(saved.attackCount || 0)+1;
energyAttacks++;
record.attackIndex=saved.attackCount;
if(attacks===1)record.vigor=sum("vigor");
} else if(type==="skill"){
skills++;turnSkills++;saved.skillCount=(saved.skillCount || 0)+1;
for(const relic of relics){const r=relic.rule;if(r.skillBlockEvery && skillCount(relic)%r.skillBlockEvery===0)await fire(relic,"openingBlock",r.skillBlock);if(turnSkills%3===0)await fire(relic,"openingDamage",r.tripleSkillDamage);}
} else if(type==="power"){
powers++;
for(const relic of relics){const r=relic.rule;if(!firstPower)await fire(relic,"openingBlock",r.firstPowerBlock);await drawMore(relic,r.powerDraw);await fire(relic,"openingDamage",r.powerDamage);if(r.powerFreeRandom){const card=relicRandomGet(run,owner.getCards("h").filter(card=>card!==physical(use.card)));if(card)freeCards.add(card);}}
firstPower=true;
turnSkills++;saved.skillCount=(saved.skillCount || 0)+1;
} else if(type==="power")firstPower=true;
const energyAttackCount=energyAttacks, skillCount=saved.skillCount, cardCount=saved.totalCardCount;
const thirdAttack=turnAttackProgress()===0, thirdSkill=turnSkillProgress()===0;
onCounterChange();
for(const relic of relics){
const r=relic.rule;
if(type==="attack"){
if(r.attackEnergyEvery && attackEnergyProgress(relic,energyAttackCount)===0)await fire(relic,"energy",1);
if(r.attackBlock)await fire(relic,"openingBlock",r.attackBlock);
if(thirdAttack){
dexterity+=r.tripleAttackDexterity || 0;
await fire(relic,"openingBlock",r.tripleAttackBlock);
await fire(relic,"randomDamage",r.tripleAttackDamage);
await fire(relic,"openingStrength",r.tripleAttackStrength);
}
} else if(type==="skill"){
if(r.skillBlockEvery && skillProgress(relic,skillCount)===0)await fire(relic,"openingBlock",r.skillBlock);
if(thirdSkill)await fire(relic,"openingDamage",r.tripleSkillDamage);
} else if(type==="power"){
if(firstPowerUse)await fire(relic,"openingBlock",r.firstPowerBlock);
await drawMore(relic,r.powerDraw);
await fire(relic,"openingDamage",r.powerDamage);
if(r.powerFreeRandom){
const card=relicRandomGet(run,owner.getCards("h").filter(card=>card!==physical(use.card)));
if(card)freeCards.add(card);
}
}
}
for(const relic of relics)if(relic.rule.cardDrawEvery && cardProgress(relic,cardCount)===0)await drawMore(relic,1);
},
async onRespond(response) {
if (!attackEnergyRelics.length || !usable() || response.player !== owner ||
seenResponses.has(response) || cardType(response.card) !== "attack") return;
seenResponses.add(response);
const count = ++energyAttacks;
onCounterChange();
for (const relic of attackEnergyRelics) {
if (attackEnergyProgress(relic, count) === 0) await fire(relic, "energy", 1);
}
for(const relic of relics){const r=relic.rule;if(r.cardDrawEvery && (saved.totalCardCount-(saved.counterStarts[relic.wikiId]?.card || 0))%r.cardDrawEvery===0)await drawMore(relic,1);}
},
limited(){return ownTurn && rules.some(r=>r.turnCardLimit && cards>=r.turnCardLimit);},
isFree(card){return freeCards.has(physical(card)) || ownTurn && has("brilliant_scarf") && cards===4;},
@@ -157,7 +270,11 @@ export function createRelicBattle(run,{active,draw,log,effect,owner,node={},enco
const use=nearestRelicUse(event);
if(use?.player!==owner || !use.card)return amount;
const value=Math.max(0,amount+sum("openingDexterity")+dexterity);
if(!firstCardBlock && has("vambrace")){firstCardBlock=true;return value*2;}
if(!firstCardBlock && has("vambrace")){
firstCardBlock=true;
onCounterChange();
return value*2;
}
return value;
},
outgoingDamage(event){
@@ -168,14 +285,17 @@ export function createRelicBattle(run,{active,draw,log,effect,owner,node={},enco
if(isStrike(event.card))amount+=sum("strikeDamage");
if(cardUpgradeLevel(event.card)>0)amount+=sum("upgradedAttackDamage");
if(owner.hp<=owner.maxHp/2)amount+=sum("lowHpStrength");
if(record && relics.some(relic=>relic.rule.nthAttackDouble && (record.attackIndex-(saved.counterStarts[relic.wikiId]?.attack || 0))%relic.rule.nthAttackDouble===0))amount*=2;
if(record?.type==="attack" && relics.some(relic=>relic.rule.nthAttackDouble && runCount(relic,"attack",record.attackIndex)%relic.rule.nthAttackDouble===0))amount*=2;
return amount;
},
lateOutgoingDamage(event){const unblocked=event.num-(event.player?.hujia || 0);return has("the_boot") && event.source===owner && cardType(event.card)==="attack" && unblocked>0 && unblocked<5 ? event.num+5-unblocked : event.num;},
async afterDamage(event){
if(event.player!==owner || !(event.num>0))return;
const attack=cardType(event.card)==="attack" || event.mengsanAttack_shuying;
if(attack && plating && event.mengsanHpDamage_shuying>0)plating--;
if(attack && plating && event.mengsanHpDamage_shuying>0){
plating--;
onCounterChange();
}
if(attack && event.source?.isAlive?.())for(const relic of relics)if(relic.rule.thorns)await fire({...relic,target:event.source},"targetDamage",relic.rule.thorns);
},
async enemyDeath(target){if(!usable() || target.storage?.mengsanCamp_shuying!=="enemy")return;saved.relicEnemyKills++;for(const relic of relics){await fire(relic,"energy",relic.rule.killEnergy);await drawMore(relic,relic.rule.killDraw);}},
@@ -187,11 +307,15 @@ export function createRelicBattle(run,{active,draw,log,effect,owner,node={},enco
while(shuffles && usable()){shuffles--;for(const relic of relics)await fire(relic,"openingBlock",relic.rule.shuffleBlock);}
while(exhaustQueue.length && usable()){
exhaustQueue.shift();saved.exhaustCount=(saved.exhaustCount || 0)+1;
for(const relic of relics){const r=relic.rule;await fire(relic,"openingDamage",r.exhaustDamage);if(r.exhaustDrawEvery && (saved.exhaustCount-(saved.counterStarts[relic.wikiId]?.exhaust || 0))%r.exhaustDrawEvery===0)await drawMore(relic,1);}
onCounterChange();
for(const relic of relics){const r=relic.rule;await fire(relic,"openingDamage",r.exhaustDamage);if(r.exhaustDrawEvery && exhaustProgress(relic)===0)await drawMore(relic,1);}
}
}finally{flushing=false;}
},
status(relic){return relic.implementation==="pending" ? relic.implementationNote : `本场第${turns}回合 · 已出${cards}张牌${relic.rule.firstHpLossDraw ? firstLoss ? " · 受伤摸牌已触发" : " · 等待首次受伤" : ""}`;},
status(relic) {
if (relic.implementation === "pending") return relic.implementationNote;
return controller.counter(relic)?.label ?? null;
},
};
return controller;
}
@@ -210,7 +334,15 @@ export function applyBattleEndRelics(run,outcome,{node={},encounter={}}={}) {
}
if(r.candleBattles)state.candleRemaining=Math.max(0,(state.candleRemaining || 0)-1);
if(r.limitedBattles)state.emberRemaining=Math.max(0,(state.emberRemaining || 0)-1);
if(r.returnStored && state.storedCards?.length){const card=relicRandomGet(run,state.storedCards);upgradeCards({ ...run, player:{...run.player,deck:[card]} },1);state.storedCards.splice(state.storedCards.indexOf(card),1);run.player.deck.push(card);}
if (r.returnStored && state.storedCards?.length) {
state.storedCards = state.storedCards.filter(card => !isRetiredDeckCard(run.player.character, card?.name));
const card = relicRandomGet(run, state.storedCards);
if (card) {
upgradeCards({ ...run, player: { ...run.player, deck: [card] } }, 1);
state.storedCards.splice(state.storedCards.indexOf(card), 1);
run.player.deck.push(card);
}
}
if(r.eliteTransformAfter && encounter.tier==="elite"){
const counters=relicState(run).eliteTransform ||= {};counters[relic.wikiId]=(counters[relic.wikiId] || 0)+1;
if(counters[relic.wikiId]>=r.eliteTransformAfter){run.player.items=run.player.items.filter(id=>getRelic(id)?.id!==relic.id);grantRelic(run,r.transformRelic);}
@@ -227,9 +359,14 @@ export function applyBattleEndRelics(run,outcome,{node={},encounter={}}={}) {
export function createRelicSkills(getBattle,getOwner){
return {mengsan_relics_shuying:{
group:["mengsan_relics_limit_shuying"],
trigger:{global:["phaseBefore","phaseBegin","changeHp","useCard1","phaseDiscardBegin","phaseJieshuBegin","damage","dying"]},
trigger:{global:["phaseBefore","phaseBegin","changeHp","useCard1","respond","phaseDiscardBegin","phaseJieshuBegin","damage","dying"]},
forced:true,silent:true,popup:false,priority:400,
filter(event){return Boolean(getBattle()?.session.active && getBattle()?.relics && (event.player===getOwner() || event.name==="phase"));},
filter(event, player) {
const owner = getOwner(), battle = getBattle();
// 全局技能按座位排队,只有遗物持有者的座位结算。
return Boolean(owner && player === owner && battle?.session.active && battle.relics &&
(event.player === owner || event.name === "phase"));
},
async content(event,trigger){
const r=getBattle()?.relics;if(!r)return;
if(event.triggername==="phaseBefore")r.globalTurnStart(trigger.player);
@@ -237,6 +374,7 @@ export function createRelicSkills(getBattle,getOwner){
if(event.triggername==="phaseBegin")await r.turnStart(trigger);
else if(event.triggername==="changeHp")await r.loseHp(trigger);
else if(event.triggername==="useCard1")await r.onUse(trigger);
else if(event.triggername==="respond")await r.onRespond(trigger);
else if(event.triggername==="phaseDiscardBegin")await r.beforeDiscard();
else if(event.triggername==="phaseJieshuBegin")await r.turnEnd();
else if(event.triggername==="damage")await r.afterDamage(trigger);
+7 -6
View File
@@ -1,6 +1,7 @@
import { applyMengsanDebuff } from "../monsters/artifact-status.js";
import { ironcladBlocksEnergy, ironcladStrengthPenalty } from "../cards/ironclad-hooks.js";
import { isAttackCard } from "../monsters/vine-tangled.js";
import { applyAttackWeakness } from "../battle/intent-damage.js";
export function createOpeningEffects(game, owner, refreshEnergy, random = Math.random) {
const enemies = () => game.players.filter(player =>
@@ -61,8 +62,9 @@ export function createOpeningEffects(game, owner, refreshEnergy, random = Math.r
export function createRelicCombatSkills(getBattle, getOwner) {
return {
mengsan_relic_attack_shuying: {
trigger: { global: "damageBegin1" },
forced: true, silent: true, popup: false, priority: 80,
// 伤害在来源座位结算,包括来源已离场的延迟伤害。
trigger: { source: "damageBegin1" },
forced: true, silent: true, popup: false, priority: 80, forceDie: true, forceOut: true,
filter(event) {
const source = event.source;
return Boolean(getBattle()?.session.active && (isAttackCard(event.card) || event.mengsanAttack_shuying) &&
@@ -76,13 +78,12 @@ export function createRelicCombatSkills(getBattle, getOwner) {
trigger.num = Math.max(0, trigger.num + (source.storage.mengsanStrength_shuying || 0) - ironcladStrengthPenalty(source));
trigger.num = getBattle().relics?.outgoingDamage(trigger) ?? trigger.num;
}
if (source.storage.mengsanWeak_shuying > 0) {
trigger.num = Math.floor(trigger.num * (source !== getOwner() && getBattle().relics?.has("paper_krane") ? 0.6 : 0.75));
}
trigger.num = applyAttackWeakness(trigger.num, source, getOwner(), getBattle()?.relics);
},
},
mengsan_relic_boot_shuying: {
trigger:{global:"damageBegin2"},forced:true,silent:true,popup:false,priority:-1000,
trigger: { source: "damageBegin2" },
forced: true, silent: true, popup: false, priority: -1000, forceDie: true, forceOut: true,
filter(event){return Boolean(getBattle()?.session.active && event.source===getOwner() && (isAttackCard(event.card) || event.mengsanAttack_shuying) && !event.mengsanScriptedSkill_shuying);},
async content(event,trigger){trigger.num=getBattle().relics?.lateOutgoingDamage(trigger) ?? trigger.num;},
},
+4 -1
View File
@@ -3,6 +3,7 @@ import { relicRules, missingMechanisms, unhandledRelicRule } from "./rules.js";
import { applyRelicPickup, relicCardRequirements } from "./progression.js";
export const relicAdaptations = Object.freeze({
nunchaku:"梦三每场战斗从零开始累计攻击牌。",
the_courier:"梦三商店出售【杀】、回复生命及三件随机遗物;购买后补货,折扣适用现有商品。药水尚无接口。遗物基价120金币,为梦三配置值。",
miniature_tent:"每个休息选项可各选择一次,直至选择离开;不允许无限重复同一选项。",
meat_cleaver:"网页没有烹饪细则;暂定每次烹饪最大生命+5,待用户确认。",
@@ -22,7 +23,9 @@ const entries = relicCatalog.map(item => {
const missingCards = rule ? relicCardRequirements(rule) : [];
const unhandled = rule ? unhandledRelicRule(rule) : [];
const reason = missingMechanisms[item.wikiId] || (missingCards.length ? `尚缺网页对应卡牌:${missingCards.join("、")}` : !rule ? "尚未接入此效果" : unhandled.length ? `尚缺效果接口:${unhandled.join("、")}` : null);
return Object.freeze({ ...item, owner: null, rule: rule || Object.freeze({}),
return Object.freeze({ ...item,
description: item.wikiId === "nunchaku" ? "每场战斗中,你每打出10张攻击牌,获得[能量]。" : item.description,
owner: null, rule: rule || Object.freeze({}),
implementation: reason ? "pending" : relicAdaptations[item.wikiId] ? "adapted" : "implemented",
implementationNote: reason || relicAdaptations[item.wikiId] || "效果已接入,实机验收待完成。", effect: "sts2" });
});
+19 -9
View File
@@ -4,12 +4,14 @@ import { relicRandom, relicRandomGet } from "./random.js";
import { installRelicDeckHook } from "./hooks.js";
import { cardDefinitions, canAcquireCard } from "../cards/card-definitions.js";
import { createCardData } from "../cards/card-data.js";
import { isRetiredDeckCard } from "../cards/retired-cards.js";
import { canUpgradeCard, upgradeRandomCard } from "../cards/upgrades.js";
import { isAttackCard } from "../monsters/vine-tangled.js";
const ids = new Map(relicCatalog.flatMap(r => [[r.id,r.wikiId],[r.wikiId,r.wikiId],[`mengsan_${r.wikiId}_shuying`,r.wikiId]]));
export const hasRelic = (run, id) => (run?.player?.items || []).some(value => ids.get(value) === id);
export const relicState = run => run.player.relicState ||= {};
export const cardType = card => cardDefinitions[card?.name]?.cardType;
export const cardType = card => cardDefinitions[card?.name]?.cardType ?? (isAttackCard(card) ? "attack" : undefined);
export const starterKind = card => card?.name === "sha" ? "strike" : card?.name === "mengsan_fangyu" ? "defend" : null;
export function relicCardRequirements(rule) {
return [...(rule.addCards || []), ...(rule.openingCards || []), ...(rule.openingDrawCards || []), ...(rule.oneBattleDrawCards || []), ...(rule.shuffleCard ? [rule.shuffleCard] : []), ...(rule.choice === "bite" ? ["mengsan_event_maul"] : [])].filter(name => !Object.hasOwn(cardDefinitions,name));
@@ -66,18 +68,26 @@ export function afterDeckAdd(run,card,{duplicate=true}={}) {
}
}
installRelicDeckHook(afterDeckAdd);
export function addPermanentRelicCard(run,name,spec) {
const card=newRelicCard(run,name,spec); run.player.deck.push(card); afterDeckAdd(run,card); return card;
export function addPermanentRelicCard(run, name, spec) {
const cardName = spec?.name ?? name;
if (isRetiredDeckCard(run.player.character, cardName)) {
throw new Error(`武将 ${run.player.character} 无法获得牌:${cardName}`);
}
const card = newRelicCard(run, cardName, spec);
run.player.deck.push(card);
afterDeckAdd(run, card);
return card;
}
const queue = (run,relic,spec) => (relicState(run).choices ||= []).push({relic:relic.name,...spec});
const transform = (run,card,upgrade=false) => {
const name=relicRandomGet(run,relicCardPool(run)); if (!name) return false;
export function transformPermanentCard(run,card,upgrade=false,candidates=relicCardPool(run)) {
const name=relicRandomGet(run,candidates); if (!name) return false;
const next=newRelicCard(run,name); next.id=card.id; if (upgrade && canUpgradeCard(next)) next.upgrade++;
Object.keys(card).forEach(key=>delete card[key]); Object.assign(card,next); return true;
};
}
export function applyRelicPickup(run,relic,{entries,canAcquire,grant}) {
const r=relic.rule;
const state=relicState(run);
if (r.breaksOnPurchase) delete state.mawBankBroken;
(state.counterStarts ||= {})[relic.wikiId]={attack:state.attackCount || 0,skill:state.skillCount || 0,card:state.totalCardCount || 0,exhaust:state.exhaustCount || 0};
if (r.handLimit) run.player.handLimitBonus=(run.player.handLimitBonus || 0)+r.handLimit;
if (r.maxHp) changeMaxHp(run,r.maxHp);
@@ -88,8 +98,8 @@ export function applyRelicPickup(run,relic,{entries,canAcquire,grant}) {
for (const name of r.addCards || []) addPermanentRelicCard(run,name);
for (let i=0;i<(r.randomCurse || 0);i++) { const name=relicRandomGet(run,relicCardPool(run,{pack:"curse"})); if (name) addPermanentRelicCard(run,name); }
if (r.upgradeStarters) for (const kind of ["strike","defend"]) { const card=run.player.deck.find(card=>starterKind(card)===kind && canUpgradeCard(card)); if (card) card.upgrade++; }
if (r.transformAllStarters) for (const card of run.player.deck) if (starterKind(card) && !card.affixes.includes("eternal")) transform(run,card);
if (r.transformStarters) for (const kind of ["strike","defend"]) { const card=run.player.deck.find(card=>starterKind(card)===kind && !card.affixes.includes("eternal")); if (card) transform(run,card); }
if (r.transformAllStarters) for (const card of run.player.deck) if (starterKind(card) && !card.affixes.includes("eternal")) transformPermanentCard(run,card);
if (r.transformStarters) for (const kind of ["strike","defend"]) { const card=run.player.deck.find(card=>starterKind(card)===kind && !card.affixes.includes("eternal")); if (card) transformPermanentCard(run,card); }
if (r.addStarters) { addPermanentRelicCard(run,"sha"); addPermanentRelicCard(run,"mengsan_fangyu"); }
if (r.gainRandomRarity) { const name=relicRandomGet(run,relicCardPool(run,{rarity:r.gainRandomRarity})); if (name) addPermanentRelicCard(run,name); }
if (r.gainAncientCard) { const name=relicRandomGet(run,relicCardPool(run,{rarity:"ancient",pack:"event"})); if (name) addPermanentRelicCard(run,name); }
@@ -127,7 +137,7 @@ export async function resolveRelicChoices(run,choose,{cardName=name=>name}={}) {
if (task.kind==="upgrade") card.upgrade++;
else if (task.kind==="duplicate") addPermanentRelicCard(run,card.name,{...card,affixes:[...card.affixes]});
else if (task.kind==="remove") run.player.deck.splice(index,1);
else if (task.kind==="transform" || task.kind==="transformUpgrade") transform(run,card,task.kind==="transformUpgrade");
else if (task.kind==="transform" || task.kind==="transformUpgrade") transformPermanentCard(run,card,task.kind==="transformUpgrade");
else if (task.kind==="bite") { const next=newRelicCard(run,"mengsan_event_maul");next.id=card.id;Object.keys(card).forEach(key=>delete card[key]);Object.assign(card,next); }
else if (task.kind==="store") (relicState(run).storedCards ||= []).push(...run.player.deck.splice(index,1));
}
+16 -8
View File
@@ -4,15 +4,23 @@ import { relicRandomGet } from "./random.js";
export const restRecovery = run => 8+heldRelics(run).reduce((n,r)=>n+(r.rule.restHeal || 0),0);
export const relicShopPrice = (run,base) => Math.max(1,Math.floor(heldRelics(run).reduce((n,r)=>n*(r.rule.shopDiscount || 1),base)));
export function recordRelicShopPurchase(run){relicState(run).mawBankBroken=true;}
export function recordRelicShopPurchase(run) {
if (heldRelics(run).some(relic => relic.rule.breaksOnPurchase)) relicState(run).mawBankBroken = true;
}
export function relicRestChoices(run) {
const state=relicState(run),choices=[];
for(const relic of heldRelics(run)){
const action=relic.rule.restAction;
if(action==="dig")choices.push({id:"dig",name:"挖掘",description:"获得一件可实现的随机普通、罕见或稀有遗物"});
if(action==="lift")choices.push({id:"lift",name:"举重",description:`以后每场战斗获得额外力量(${state.giryaLevels || 0}/3)`,disabled:(state.giryaLevels || 0)>=3});
if(action==="rekindle")choices.push({id:"rekindle",name:"添火",description:"让南瓜蜡烛再次燃烧5场战斗",disabled:(state.candleRemaining || 0)>=5});
if(action==="cook")choices.push({id:"cook",name:"烹饪",description:"最大生命+5;梦三适配值"});
const state = relicState(run), choices = [];
for (const relic of heldRelics(run)) {
const id = relic.rule.restAction;
const image = relic.image;
if (id === "dig") choices.push({ id, image, name: "挖掘", description: "随机获得一件普通、罕见或稀有遗物" });
if (id === "lift") {
const levels = state.giryaLevels || 0;
choices.push({ id, image, name: "举重", description: `以后每场战斗获得额外力量(${levels}/3)`,
disabled: levels >= 3, disabledReason: "已达举重上限" });
}
if (id === "rekindle") choices.push({ id, image, name: "添火", description: "让南瓜蜡烛再燃烧 5 场战斗",
disabled: (state.candleRemaining || 0) >= 5, disabledReason: "南瓜蜡烛的燃烧场次已满" });
if (id === "cook") choices.push({ id, image, name: "烹饪", description: "最大生命 +5" });
}
return choices;
}
+254 -10
View File
@@ -2,17 +2,36 @@
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import { createHash } from "node:crypto";
import { registerHooks } from "node:module";
import { join } from "node:path";
import { getSts2Atlas } from "./sts2-atlas.js";
import { relicCatalog } from "../relics/catalog.js";
import { relicDefinitions, getRelic, heldRelics, canAcquireRelic, grantRelic, relicRewardIds, relicRewardPools } from "../relics/definitions.js";
import { relicState, grantGold, newRelicCard, resolveRelicChoices, relicCardPool } from "../relics/progression.js";
import { createRelicBattle, applyBattleEndRelics } from "../relics/battle.js";
import { applyRoomRelics, applyRelicNodeEnter, relicShopPrice } from "../relics/rooms.js";
import { relicState, grantGold, newRelicCard, resolveRelicChoices, relicCardPool, addPermanentRelicCard } from "../relics/progression.js";
import { createRelicBattle, createRelicSkills, applyBattleEndRelics } from "../relics/battle.js";
import { applyRoomRelics, applyRelicNodeEnter, relicShopPrice, recordRelicShopPurchase } from "../relics/rooms.js";
import { addCardToDeck } from "../cards/card-data.js";
import { canAcquireCard } from "../cards/card-definitions.js";
import { createModeStorage } from "../progression/mode-storage.js";
import { createBattleSettlement } from "../battle/battle-settlement.js";
import { getRandomRewardChoices } from "../progression/reward.js";
import config from "../config.js";
import { createRun } from "../progression/state.js";
import { createRelicCombatSkills } from "../relics/combat.js";
import { previewAttackDamage } from "../battle/intent-damage.js";
import { createIntentExecutor } from "../battle/intent-effects.js";
import { applyBodyguardDamage, bindIroncladHooks } from "../cards/ironclad-hooks.js";
// The shared runtime only needs the engine's status export in this isolated check.
const engineStatusHook = registerHooks({
resolve(specifier, context, nextResolve) {
if (specifier.endsWith("/noname.js") && context.parentURL?.endsWith("/mengsan/battle/combat-rules.js")) {
return { url: "data:text/javascript,export const _status = %7B%7D", shortCircuit: true };
}
return nextResolve(specifier, context);
},
});
const { createSharedCardRuntime } = await import("../cards/packs/shared/runtime.js");
engineStatusHook.deregister();
let checks=0;
const check=(condition,message)=>{assert.ok(condition,message);checks++;};
@@ -24,14 +43,15 @@ const makeRun=()=>({runId:"relic-test",actIndex:0,revision:0,status:"running",ra
map:{nodes:[{id:"battle-1",type:"battle",completed:false}],completedNodeIds:[]}});
function starter(run){for(let i=0;i<6;i++)run.player.deck.push(newRelicCard(run,i<3 ? "sha" : "mengsan_fangyu"));}
function add(run,id){assert.ok(grantRelic(run,id),`grant ${id}`);checks++;}
function fixture(run,{encounter={}}={}){
function fixture(run,{encounter={},onCounterChange}={}){
let hand=[],drawn=0,alive=true;const drawPile=run.player.deck.map(data=>({name:data.name,storage:{mengsanCard_shuying:copy(data)}}));
const owner={hp:run.player.hp,maxHp:run.player.maxHp,hujia:0,storage:{mengsanEnergy_shuying:3},getCards:()=>hand,isAlive:()=>alive};
const piles={drawCards:()=>drawPile,addToDraw(data,index){const card={name:data.name,storage:{mengsanCard_shuying:copy(data)}};drawPile.splice(index,0,card);return card;},async addToHand(data){const card={name:data.name,storage:{mengsanCard_shuying:copy(data)}};hand.push(card);return card;}};
const effects=[];
const controller=createRelicBattle(run,{active:()=>alive,owner,piles,encounter,draw:async n=>{drawn+=n;return [];},log:()=>{},
effect:async relic=>{effects.push([relic.effect,relic.amount]);if(["openingBlock","nextBlock","plating"].includes(relic.effect))owner.hujia+=relic.amount;if(["energy","nextEnergy"].includes(relic.effect))owner.storage.mengsanEnergy_shuying=Math.max(0,owner.storage.mengsanEnergy_shuying+relic.amount);if(["openingHeal","healAbsolute"].includes(relic.effect))owner.hp=Math.min(owner.maxHp,owner.hp+relic.amount);},});
onCounterChange, effect:async relic=>{effects.push([relic.effect,relic.amount]);if(["openingBlock","nextBlock","plating"].includes(relic.effect))owner.hujia+=relic.amount;if(["energy","nextEnergy"].includes(relic.effect))owner.storage.mengsanEnergy_shuying=Math.max(0,owner.storage.mengsanEnergy_shuying+relic.amount);if(["openingHeal","healAbsolute"].includes(relic.effect))owner.hp=Math.min(owner.maxHp,owner.hp+relic.amount);},});
return {owner,piles,controller,effects,get drawn(){return drawn;},setHand(cards){hand=cards;},stop(){alive=false;},
counter(id){return controller.counter(getRelic(id))?.value ?? null;},
async turn(){controller.globalTurnStart(owner);await controller.turnStart({name:"phase",player:owner});},
async use(name="sha"){const use={name:"useCard",player:owner,card:{name},parent:null};await controller.onUse(use);return use;}};
}
@@ -39,9 +59,10 @@ function fixture(run,{encounter={}}={}){
eq(relicCatalog.length,298,"complete catalog");eq(new Set(relicCatalog.map(r=>r.wikiId)).size,298);
eq(relicCatalog.map(r=>r.order),Array.from({length:298},(_,i)=>i+1));
const manifest=JSON.parse(await readFile(new URL("../assets/relics/manifest.json",import.meta.url),"utf8"));
const relicAtlas = getSts2Atlas("relic_atlas.sprites");
for(const asset of manifest.assets){
const bytes=await readFile(new URL(`../${asset.runtime}`,import.meta.url));
const source=await readFile(new URL(`../assets/sts2/Godot_Atlas_Sprites_v0.111.0/images/atlases/relic_atlas.sprites/${asset.source}`,import.meta.url));
const source=await readFile(join(relicAtlas, asset.source));
eq(createHash("sha256").update(bytes).digest("hex"),asset.sha256,asset.wikiId);
eq(bytes,source,`original image ${asset.wikiId}`);
eq([bytes.readUInt32BE(16),bytes.readUInt32BE(20)],[asset.width,asset.height]);
@@ -93,12 +114,49 @@ for(const [key,ids] of Object.entries(relicRewardPools)){
const run=makeRun();starter(run);add(run,"paels_tooth");await resolveRelicChoices(run,async(title,choices)=>choices[0].id);
eq(run.player.deck.length,1);eq(relicState(run).storedCards.length,5);applyBattleEndRelics(run,"victory");eq(run.player.deck.length,2);eq(relicState(run).storedCards.length,4);check(run.player.deck.some(c=>c.upgrade===1));
}
{
const run = makeRun();
add(run, "paels_tooth");
const valid = newRelicCard(run, "sha");
const bagua = newRelicCard(run, "bagua");
const muniu = { ...valid, id: "old-muniu", name: "muniu" };
relicState(run).storedCards = [muniu, bagua, valid];
const lib = { storage: { [config.saveKey]: run }, status: { reload: 0 }, version: 1 };
let written;
const store = createModeStorage({
lib, config, game: { reload2() { lib.status.reload--; } },
localStorage: { setItem(key, value) { written = JSON.parse(value); } },
});
eq(store.read()[config.saveKey].player.relicState.storedCards.map(card => card.id), [valid.id]);
await store.update(storage => { storage[config.saveKey] = copy(run); });
eq(written[config.saveKey].player.relicState.storedCards.map(card => card.id), [valid.id]);
applyBattleEndRelics(run, "victory");
eq(run.player.deck.map(card => [card.id, card.upgrade]), [[valid.id, 1]]);
eq(relicState(run).storedCards, []);
check(!canAcquireCard(run.player.character, "bagua"));
check(canAcquireCard("another_character", "bagua"));
assert.throws(() => addCardToDeck(run, bagua), /无法获得牌/);
assert.throws(() => addPermanentRelicCard(run, bagua.name), /无法获得牌/);
assert.throws(() => addPermanentRelicCard(run, "sha", { name: "bagua" }), /无法获得牌/);
checks += 3;
}
{
const run=makeRun();add(run,"meal_ticket");const shop={id:'shop',type:'shop'};
eq(applyRoomRelics(run,shop,'enter').recovered,15);eq(applyRoomRelics(run,shop,'enter'),null);
add(run,"membership_card");add(run,"the_courier");eq(relicShopPrice(run,120),48);
add(run,"regal_pillow");const rest={id:'rest',type:'rest'};applyRoomRelics(run,rest,'enter');eq(applyRoomRelics(run,rest,'heal').recovered,23);eq(applyRoomRelics(run,rest,'heal'),null);
add(run,"maw_bank");applyRelicNodeEnter(run,{id:'1'});eq(run.player.gold,12);applyRelicNodeEnter(run,{id:'1'});eq(run.player.gold,12);relicState(run).mawBankBroken=true;applyRelicNodeEnter(run,{id:'2'});eq(run.player.gold,12);
recordRelicShopPurchase(run);
eq(relicState(run).mawBankBroken, undefined, "shopping before pickup does not break the bank");
relicState(run).mawBankBroken = true; // Old save that purchased something before the pickup.
add(run, "maw_bank");
applyRelicNodeEnter(run, { id: "1" });
eq(run.player.gold, 12, "pickup clears stale pre-ownership failure");
applyRelicNodeEnter(run, { id: "1" });
eq(run.player.gold, 12);
recordRelicShopPurchase(run);
applyRelicNodeEnter(run, { id: "2" });
eq(run.player.gold, 12, "shopping while holding the bank breaks it");
}
{
const run=makeRun();add(run,"anchor");add(run,"bag_of_preparation");add(run,"lantern");add(run,"centennial_puzzle");add(run,"venerable_tea_set");relicState(run).afterRest=true;
@@ -124,8 +182,124 @@ for(const [key,ids] of Object.entries(relicRewardPools)){
{
const run=makeRun();add(run,"pen_nib");add(run,"akabeko");add(run,"strike_dummy");add(run,"nunchaku");const f=fixture(run);await f.controller.start();await f.turn();
let use=await f.use();eq(f.controller.outgoingDamage({source:f.owner,card:{name:'sha'},num:6,parent:use}),17);
for(let i=1;i<9;i++)await f.use();const next=fixture(run);await next.controller.start();await next.turn();use=await next.use();
eq(next.controller.outgoingDamage({source:next.owner,card:{name:'sha'},num:6,parent:use}),34,"pen nib persists + fresh battle vigor");eq(next.owner.storage.mengsanEnergy_shuying,4);
for(let i=1;i<9;i++)await f.use();
eq(f.counter("nunchaku"),9);eq(f.counter("pen_nib"),9);
const next=fixture(copy(run));await next.controller.start();await next.turn();
eq(next.counter("nunchaku"),0);eq(next.counter("pen_nib"),9);
use=await next.use();
eq(next.controller.outgoingDamage({source:next.owner,card:{name:'sha'},num:6,parent:use}),34,"pen nib persists + fresh battle vigor");
eq(next.counter("nunchaku"),1);eq(next.counter("pen_nib"),0);
eq(next.owner.storage.mengsanEnergy_shuying,3,"nunchaku does not trigger from the previous battle's attacks");
await next.turn();
await next.use("mengsan_fangyu");
eq(next.counter("nunchaku"),1,"progress survives an own turn boundary and ignores skills");
for(let i=1;i<9;i++)await next.use();
eq(next.counter("nunchaku"),9);eq(next.owner.storage.mengsanEnergy_shuying,3);
const battle = { session: { active: true }, relics: next.controller };
const responseSkill = createRelicSkills(() => battle, () => next.owner).mengsan_relics_shuying;
check(responseSkill.trigger.global.includes("respond"));
const respond = async response => {
check(responseSkill.filter(response, next.owner));
await responseSkill.content({ triggername: "respond" }, response);
};
await respond({ name: "respond", player: next.owner, card: { name: "shan" } });
eq(next.counter("nunchaku"),9);
next.controller.globalTurnStart(f.owner);
const duelResponse = { name: "respond", player: next.owner, card: { name: "sha" } };
check(!responseSkill.filter({ ...duelResponse, player: f.owner }, next.owner));
await respond(duelResponse);
eq(next.counter("nunchaku"),0);eq(next.owner.storage.mengsanEnergy_shuying,4);
await respond(duelResponse);
eq(next.counter("nunchaku"),0);eq(next.owner.storage.mengsanEnergy_shuying,4);
eq(next.counter("pen_nib"),8,"responses only advance Nunchaku");
await next.use();eq(next.counter("nunchaku"),1);eq(next.counter("pen_nib"),9);
}
{
for (const name of ["nanman", "wanjian", "huogong"]) {
const run = makeRun();
add(run, "pen_nib"); add(run, "nunchaku"); add(run, "the_boot");
const f = fixture(run);
await f.controller.start(); await f.turn();
for (let i = 0; i < 9; i++) await f.use();
const use = await f.use(name);
eq(f.counter("pen_nib"), 0);
eq(f.counter("nunchaku"), 0);
eq(f.owner.storage.mengsanEnergy_shuying, 4);
const hit = { source: f.owner, card: use.card, num: 4, parent: use };
eq(f.controller.outgoingDamage(hit), 8);
eq(f.controller.lateOutgoingDamage(hit), 5);
}
}
{
const run=makeRun();add(run,"pendulum");add(run,"pollinous_core");
const first=fixture(run);await first.controller.start();await first.turn();await first.turn();
eq(first.counter("pendulum"),2);eq(first.counter("pollinous_core"),2);eq(first.drawn,0);
const next=fixture(copy(run));await next.controller.start();await next.turn();
eq(next.counter("pendulum"),0);eq(next.counter("pollinous_core"),3);eq(next.drawn,1);
await next.turn();
eq(next.counter("pendulum"),1);eq(next.counter("pollinous_core"),0);eq(next.drawn,3);
}
{
const run=makeRun();add(run,"ornamental_fan");add(run,"letter_opener");
let updates=0;
const f=fixture(run,{onCounterChange:()=>updates++});
await f.controller.start();await f.turn();
await f.use();await f.use();
eq(f.counter("ornamental_fan"),2);eq(f.owner.hujia,0);
const before=updates;
f.controller.globalTurnStart({});
eq(f.counter("ornamental_fan"),0);eq(updates,before+1);
await f.use();await f.use();await f.use();
eq(f.counter("ornamental_fan"),0);eq(f.owner.hujia,4);
await f.use("mengsan_fangyu");await f.use("mengsan_fangyu");
eq(f.counter("letter_opener"),2);
f.controller.globalTurnStart({});
await f.use("mengsan_fangyu");
eq(f.counter("letter_opener"),1);eq(f.effects.filter(([key])=>key==="openingDamage").length,0);
await f.use("mengsan_fangyu");await f.use("mengsan_fangyu");
eq(f.counter("letter_opener"),0);eq(f.effects.filter(([key])=>key==="openingDamage").length,1);
}
{
const run=makeRun();add(run,"tuning_fork");add(run,"iron_club");add(run,"joss_paper");
const f=fixture(run);await f.controller.start();await f.turn();
for(let i=0;i<9;i++)await f.use("mengsan_fangyu");
for(let i=0;i<4;i++)f.controller.queueExhaust({});
await f.controller.flushExhaust();
eq([f.counter("tuning_fork"),f.counter("iron_club"),f.counter("joss_paper")],[9,1,4]);
const next=fixture(copy(run));await next.controller.start();await next.turn();
eq([next.counter("tuning_fork"),next.counter("iron_club"),next.counter("joss_paper")],[9,1,4]);
await next.use("mengsan_fangyu");await next.use();await next.use();
next.controller.queueExhaust({});await next.controller.flushExhaust();
eq([next.counter("tuning_fork"),next.counter("iron_club"),next.counter("joss_paper")],[0,0,0]);
eq(next.owner.hujia,7);eq(next.drawn,2);
}
{
const run=makeRun();add(run,"stone_calendar");add(run,"horn_cleat");add(run,"pumpkin_candle");add(run,"centennial_puzzle");
const f=fixture(run);await f.controller.start();
eq([f.counter("stone_calendar"),f.counter("horn_cleat"),f.counter("pumpkin_candle")],[7,2,5]);
for(let i=0;i<6;i++){await f.turn();await f.controller.turnEnd();}
await f.turn();
eq(f.counter("stone_calendar"),1);
await f.controller.turnEnd();
eq(f.counter("stone_calendar"),0);eq(f.effects.filter(([key])=>key==="openingDamage").length,1);
await f.controller.loseHp({num:-1});
eq(f.counter("centennial_puzzle"),0);
applyBattleEndRelics(run,"victory");
const next=fixture(copy(run));await next.controller.start();
eq([next.counter("stone_calendar"),next.counter("horn_cleat"),next.counter("pumpkin_candle"),next.counter("centennial_puzzle")],[7,2,4,1]);
eq(next.counter("burning_blood"),null);
await next.turn();await next.use();
eq(next.controller.status(getRelic("burning_blood")),null,"non-counting relic has no battle progress");
eq(next.controller.status(getRelic("stone_calendar")),"触发前剩余回合结束次数 7");
}
{
const run=makeRun();add(run,"art_of_war");add(run,"paels_tears");
const f=fixture(run);await f.controller.start();await f.turn();await f.controller.turnEnd();
eq([f.counter("art_of_war"),f.counter("paels_tears"),f.controller.displayState().nextEnergy],[1,2,3]);
await f.turn();
eq([f.counter("art_of_war"),f.counter("paels_tears"),f.controller.displayState().nextEnergy],[0,0,0]);
eq(f.owner.storage.mengsanEnergy_shuying,6);
}
{
const run=makeRun();add(run,"permafrost");const f=fixture(run);await f.controller.start();await f.turn();const power='mengsan_ic_demon_form';
@@ -142,11 +316,81 @@ for(const [key,ids] of Object.entries(relicRewardPools)){
{
const run=makeRun();run.player.relicPool='静默猎手';add(run,'paper_krane');const f=fixture(run);await f.controller.start();
const skills=createRelicCombatSkills(()=>({session:{active:true},relics:f.controller}),()=>f.owner);
const enemy={storage:{mengsanWeak_shuying:1}},event={source:enemy,card:null,mengsanAttack_shuying:true,num:10};
eq(skills.mengsan_relic_attack_shuying.trigger, { source: "damageBegin1" });
eq(skills.mengsan_relic_boot_shuying.trigger, { source: "damageBegin2" });
f.owner.storage.mengsanCamp_shuying = "ally";
const enemy = { isAlive: () => true, storage: { mengsanWeak_shuying: 1, mengsanCamp_shuying: "enemy" } };
const event = { source: enemy, card: null, mengsanAttack_shuying: true, num: 10 };
check(skills.mengsan_relic_attack_shuying.filter(event),'explicit scripted attack marker supports Weak');
await skills.mengsan_relic_attack_shuying.content({},event);eq(event.num,6);
check(!skills.mengsan_relic_attack_shuying.filter({...event,mengsanScriptedSkill_shuying:true}),'relic damage is not an attack');
check(!skills.mengsan_relic_attack_shuying.filter({source:f.owner,card:{name:'tao'},num:1}),'non-attack cards do not receive Strength');
const hits = [];
f.owner.damage = num => { const hit = { num }; hits.push(hit); return hit; };
const battle = { session: { active: true }, owner: f.owner, relics: f.controller };
const executeIntent = createIntentExecutor({ players: [f.owner, enemy] }, () => battle);
eq(previewAttackDamage({ damage: 20 }, enemy, f.owner, battle), 12);
eq(previewAttackDamage({ damage: 20 }, enemy, f.owner), 15);
await executeIntent(enemy, { damage: 20, hits: 2 });
await executeIntent(enemy, { damage: 20, intentType: "death_blow" });
eq(hits.map(hit => hit.num), [12, 12, 12]);
check(hits.every(hit => hit.mengsanAttack_shuying && hit.mengsanScriptedSkill_shuying));
check(hits.every(hit => !skills.mengsan_relic_attack_shuying.filter({ ...hit, source: enemy })), "intent Weak is applied before native damage, once");
const ally = { storage: { mengsanCamp_shuying: "ally" } };
f.owner.playerid = "preview-owner";
f.owner.isFriendOf = player => player === f.owner || player === ally;
f.owner.isEnemyOf = player => player === enemy;
battle.players = new Set([f.owner, ally, enemy]);
const bodyguardSession = { active: true, ownResource() {} };
bindIroncladHooks(f.owner, bodyguardSession, { valid: () => true, hasBodyguard: () => true });
eq([f.owner, ally].map(target => previewAttackDamage({ damage: 20 }, enemy, target, battle)), [24, 6]);
const root = battle.root = {};
battle.session.ownResource = () => {};
f.owner.addSkill = () => {};
f.owner.changeHujia = async amount => { f.owner.hujia += amount; };
ally.isAlive = () => true;
enemy.addSkill = () => assert.fail("Intent preview should not register skills");
const runtime = createSharedCardRuntime({
game: { me: f.owner }, lib: {}, status: {}, getBattle: () => battle,
});
const bridge = runtime.skills.mengsan_shared_bridge_shuying;
const resolve = async (triggername, trigger) => {
check(bridge.filter(trigger, f.owner, triggername));
await bridge.content({ triggername }, trigger);
};
const preview = () => [f.owner, ally].map(target => previewAttackDamage({ damage: 20 }, enemy, target, battle));
eq(preview(), [24, 6]);
const play = async name => runtime.cards[name].content({
parent: root, card: { name }, target: ally,
}, null, f.owner);
const interceptName = "mengsan_colorless_intercept";
for (const [upgrade, block] of [[0, 9], [1, 13]]) {
const data = { name: interceptName, upgrade };
const card = { name: interceptName, storage: { mengsanCard_shuying: data } };
const prompt = runtime.cards[interceptName].cardPrompt(card);
eq(prompt, `梦三:1费。获得${block}点格挡。选择一名其他友方角色。直到你的下个回合开始,敌人对其的攻击伤害归零,对你的攻击伤害翻倍。`);
}
await play(interceptName);
eq(preview(), [48, 0]);
const settle = async target => {
const hit = { parent: root, player: target, source: enemy, num: 12, mengsanAttack_shuying: true };
await resolve("damageBegin2", hit);
hit.num = applyBodyguardDamage(hit.num, enemy, target, battle.players);
await resolve("damageBegin4", hit);
return hit.num;
};
eq(await Promise.all([f.owner, ally].map(settle)), preview());
await play("mengsan_event_apparition");
eq(preview(), [1, 0]);
eq(await Promise.all([f.owner, ally].map(settle)), preview());
await resolve("phaseAfter", { parent: root, player: f.owner });
eq(preview(), [1, 0]);
await resolve("phaseBefore", { parent: root, player: f.owner });
eq(preview(), [24, 6]);
bodyguardSession.active = false;
eq(previewAttackDamage({ damage: 20 }, enemy, ally, battle), 12);
}
{
const run=makeRun();add(run,'joss_paper');add(run,'the_abacus');add(run,'charons_ashes');const f=fixture(run);await f.controller.start();
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 KiB

+2 -1
View File
@@ -4,8 +4,9 @@ const crypto = require('node:crypto');
const { pathToFileURL } = require('node:url');
(async () => {
const root = path.resolve(__dirname, '..');
const { getSts2Atlas } = await import('./sts2-atlas.js');
const source = getSts2Atlas('power_atlas.sprites');
const { statusIconNames } = await import(pathToFileURL(path.join(root, 'ui/hud/status-model.js')).href);
const source = path.join(root, 'assets/sts2/Godot_Atlas_Sprites_v0.111.0/images/atlases/power_atlas.sprites');
const output = path.join(root, 'assets/status');
fs.mkdirSync(output, {recursive:true});
const entries = [], missing = [];
+19 -1
View File
@@ -2,6 +2,7 @@
import argparse
import hashlib
import json
import os
import struct
from pathlib import Path
@@ -24,6 +25,23 @@ LIUBEI_RELICS = frozenset({
})
def get_relic_atlas():
tools_dir = ROOT / "tools"
config = tools_dir / ".sts2-source"
source = os.environ.get("MENGSAN_STS2_SOURCE", "").strip()
if not source and config.is_file():
source = config.read_text(encoding="utf-8-sig").strip()
atlas = (
tools_dir / (source or "../assets/sts2")
/ "Godot_Atlas_Sprites_v0.111.0" / "images" / "atlases" / "relic_atlas.sprites"
).resolve()
if not atlas.is_dir():
raise FileNotFoundError(
f"找不到 STS2 拆分图集:{atlas}。请检查 MENGSAN_STS2_SOURCE 或 tools/.sts2-source。"
)
return atlas
def main():
parser = argparse.ArgumentParser()
parser.add_argument("snapshot", type=Path)
@@ -32,7 +50,7 @@ def main():
rows = source["relics"]
if len(rows) != 298 or len({row["id"] for row in rows}) != 298:
raise ValueError("Expected reviewed 298 unique relics")
atlas = ROOT / "assets/sts2/Godot_Atlas_Sprites_v0.111.0/images/atlases/relic_atlas.sprites"
atlas = get_relic_atlas()
target = ROOT / "assets/relics"
target.mkdir(exist_ok=True)
entries, assets = [], []
+17
View File
@@ -0,0 +1,17 @@
import { existsSync, readFileSync, statSync } from "node:fs";
import { join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const toolsDir = fileURLToPath(new URL(".", import.meta.url));
export function getSts2Atlas(name) {
const config = join(toolsDir, ".sts2-source");
const source = process.env.MENGSAN_STS2_SOURCE?.trim()
|| (existsSync(config) ? readFileSync(config, "utf8").trim() : "")
|| "../assets/sts2";
const atlas = resolve(toolsDir, source, "Godot_Atlas_Sprites_v0.111.0", "images", "atlases", name);
if (!statSync(atlas, { throwIfNoEntry: false })?.isDirectory()) {
throw new Error("找不到 STS2 拆分图集:" + atlas + "。请检查 MENGSAN_STS2_SOURCE 或 tools/.sts2-source。");
}
return atlas;
}
+574 -18
View File
@@ -4,9 +4,26 @@ const http = require('node:http');
const fs = require('node:fs');
const path = require('node:path');
const app = path.resolve(__dirname, '../../../..');
const packages = process.env.CODEX_NODE_MODULES || 'C:/Users/Diuse/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules';
const { chromium } = require(path.join(packages, 'playwright'));
const packages = process.env.CODEX_NODE_MODULES;
const { chromium } = require(packages ? path.join(packages, 'playwright') : 'playwright');
const prefix = '/extension/' + encodeURIComponent('术樱包') + '/mengsan';
const decadePrefix = '/extension/' + encodeURIComponent('十周年UI');
const reviewOnly = process.env.HUD_REVIEW === '1';
const journeyReview = process.env.UI_ZOOM_REVIEW === '1';
const holdStatus = async (page, locator, pointerType = 'mouse') => {
const box = await locator.boundingBox();
const point = {x:box.x + box.width / 2,y:box.y + box.height / 2};
if (pointerType === 'touch') {
await locator.dispatchEvent('pointerdown', {button:0,pointerId:44,
pointerType,clientX:point.x,clientY:point.y});
await page.waitForTimeout(550);
await page.evaluate(() => window.dispatchEvent(
new PointerEvent('pointerup', {pointerId:44,pointerType:'touch'})));
} else {
await page.mouse.move(point.x,point.y); await page.mouse.down();
await page.waitForTimeout(550); await page.mouse.up();
}
};
// Native themes use different button sizes. Drag onto an exposed point on the
// original player, rather than assuming its center is clear in the dense fixture.
const exposedTarget = (page,index) => page.evaluate(index => {
@@ -17,10 +34,389 @@ const exposedTarget = (page,index) => page.evaluate(index => {
}
throw new Error('Native target has no exposed drag point: '+index);
},index);
async function checkMobileTargetLine(page, artifact) {
const touch = await page.context().newCDPSession(page);
const handCard = page.locator('.handcards>.card').first();
const target = await exposedTarget(page, 1);
const end = {x:target.x, y:target.y};
const aim = page.locator('.mengsan-hand-aim-shuying');
async function drag() {
const start = await handCard.boundingBox();
const source = {x:start.x + start.width / 2,y:start.y + start.height / 2};
await touch.send('Input.dispatchTouchEvent', {type:'touchStart',touchPoints:[source]});
await touch.send('Input.dispatchTouchEvent', {type:'touchMove',touchPoints:[end]});
await aim.waitFor({state:'visible',timeout:2500});
}
// Exercise a WebView-style mismatch between the SVG matrix and its painted bounds.
await page.evaluate(() => {
const create = document.createElementNS.bind(document);
document.createElementNS = (namespace,tag) => {
const node = create(namespace,tag);
if (tag === 'svg') {
const screenMatrix = node.getScreenCTM.bind(node);
node.getScreenCTM = () => screenMatrix()?.translate(-120,45);
}
return node;
};
});
await drag();
const geometry = await aim.evaluate((overlay, pointer) => {
const card = window.card.getBoundingClientRect();
const origin = {x:card.left + card.width / 2, y:card.top};
const line = overlay.querySelector('line');
if (line) {
const matrix = line.getScreenCTM();
return {origin,pointer,from:new DOMPoint(line.x1.baseVal.value,line.y1.baseVal.value).matrixTransform(matrix).toJSON(),
to:new DOMPoint(line.x2.baseVal.value,line.y2.baseVal.value).matrixTransform(matrix).toJSON(),bounds:line.getBoundingClientRect().toJSON()};
}
const bounds = overlay.getBoundingClientRect();
const left = origin.x <= pointer.x, up = origin.y <= pointer.y;
return {origin,pointer,from:{x:left?bounds.left:bounds.right,y:up?bounds.top:bounds.bottom},
to:{x:left?bounds.right:bounds.left,y:up?bounds.bottom:bounds.top}};
},end);
await page.evaluate(() => { delete document.createElementNS; });
if (artifact) await page.screenshot({path:artifact});
await touch.send('Input.dispatchTouchEvent', {type:'touchCancel',touchPoints:[]});
assert.equal(await aim.count(),0,'the target line disappears on touch cancellation');
assert.ok(Math.hypot(geometry.from.x-geometry.origin.x,geometry.from.y-geometry.origin.y)<=2,
'A012 target line starts at the selected card’s top center: '+JSON.stringify(geometry));
assert.ok(Math.hypot(geometry.to.x-end.x,geometry.to.y-end.y)<=2,
'A012 target line ends at the current touch: '+JSON.stringify(geometry));
assert.ok(geometry.bounds && Math.abs(geometry.bounds.bottom-geometry.origin.y)<=2 &&
Math.abs(geometry.bounds.top-end.y)<=2,'A012 the rendered line reaches both endpoint heights');
await page.waitForTimeout(180);
await drag();
const before = await page.evaluate(()=>game.isSubmitted());
await touch.send('Input.dispatchTouchEvent', {type:'touchEnd',touchPoints:[]});
assert.equal(await aim.count(),0,'the target line disappears on touch release');
assert.equal(await page.evaluate(()=>game.isSubmitted()),before+1,'touch release still submits the valid target once');
}
async function checkOrdinaryPlayCenter(page, skin, artifact) {
const geometry = await page.evaluate(async skin => {
const {arena,control,me} = ui;
const prompt = document.createElement('div');
prompt.className = skin === 'native' ? 'dialog' : 'hand-tip';
prompt.textContent = '请选择要使用的牌';
arena.append(prompt);
ui.dialog = prompt;
hudEventState.event.dialog = prompt;
hud.refresh();
await new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve)));
const bounds = node => node.getBoundingClientRect().toJSON();
const result = {arena:bounds(arena),hand:bounds(me),card:bounds(card),prompt:bounds(prompt),
buttons:[...control.firstElementChild.children].map(bounds)};
if (!window.card.isConnected) throw new Error('The original hand card must remain connected');
return result;
},skin);
if (artifact) await page.screenshot({path:artifact});
await page.evaluate(()=>{ui.dialog.remove();delete ui.dialog;delete hudEventState.event.dialog;hud.refresh();});
const {arena,hand,card,prompt,buttons} = geometry;
const center = box => (box.left+box.right)/2;
const actions = {left:Math.min(...buttons.map(box=>box.left)),right:Math.max(...buttons.map(box=>box.right))};
assert.ok([hand,card,prompt,actions].every(box=>Math.abs(center(box)-center(arena))<=2),
'ordinary play fan, prompt and action buttons share the arena center: '+JSON.stringify(geometry));
}
async function setBattleZoom(page, zoom) {
await page.evaluate(zoom => {
const {style} = document.body;
style.zoom = zoom;
style.width = style.height = '100%';
},zoom);
// Let the native hand transform and the resize observers settle after a zoom change.
await page.waitForFunction(() => {
const arena = ui.arena.getBoundingClientRect(), hand = card.getBoundingClientRect();
return Math.abs(arena.width-innerWidth)<=2 &&
Math.abs((arena.left+arena.right-hand.left-hand.right)/2)<=2;
},null,{timeout:2500});
}
async function checkCommittedLine(page, skin) {
const geometry = await page.evaluate(async ({skin,decadePrefix}) => {
const engine = await import('/noname.js');
const {Player} = await import('/noname/library/element/player.js');
const {arena,me:hand} = window.ui;
const [actor,target] = window.game.players;
// Use the shipped line producers and renderer, with only the game lifecycle isolated.
engine.lib.config ??= {};
engine.setUI({arena,create:{div:selector => {
const node = document.createElement('div');
if (selector) node.className = 'linexy hidden';
node.show = () => node.classList.remove('hidden');
node.listenTransition = () => {};
node.setBackgroundImage = path => {node.style.backgroundImage = `url(${path})`;};
return node;
}},refresh:node=>node.getBoundingClientRect()});
const get = engine.get;
engine.setGet({itemtype:()=> 'player',objtype:get.objtype.bind(get),xyDistance:get.xyDistance.bind(get)});
engine.setGame({me:actor,broadcast(){},addVideo(){},linexy:engine.Game.prototype.linexy});
actor.getLeft = target.getLeft = function() { return this.offsetLeft; };
actor.getTop = target.getTop = function() { return this.offsetTop; };
let line = Player.prototype.line;
if (skin !== 'native') {
const {playerLine} = await import(decadePrefix+'/src/overrides/player/animations.js');
const {BoundsCache} = await import(decadePrefix+'/src/utils/bounds.js');
window.decadeUI ??= {boundsCaches:{hand:new BoundsCache(hand)}};
actor.checkBoundsCache = target.checkBoundsCache = function() {
this.cacheLeft = this.offsetLeft;
this.cacheTop = this.offsetTop;
this.cacheWidth = this.offsetWidth;
this.cacheHeight = this.offsetHeight;
};
line = playerLine;
}
line.call(actor,target,{duration:120});
const effect = arena.querySelector('.linexy');
if (!effect) return null;
await new Promise(resolve=>setTimeout(resolve,150));
const matrix = new DOMMatrix(getComputedStyle(effect).transform);
const x1 = parseFloat(effect.style.left), y1 = parseFloat(effect.style.top);
const length = parseFloat(effect.style.height);
const expectedStart = skin === 'native'
? {x:actor.offsetLeft+actor.offsetWidth/2,y:actor.offsetTop+actor.offsetHeight/2}
: {x:arena.offsetWidth/2,y:hand.offsetTop};
const result = {x1,y1,x2:x1+matrix.c*length,y2:y1+matrix.d*length,expectedStart,
expectedEnd:{x:target.offsetLeft+target.offsetWidth/2,y:target.offsetTop+target.offsetHeight/2}};
effect.remove();
// Run the configured renderer as well as the default one. Its art may be provided by the Android package.
Object.assign(engine.game,{
linexy:engine.Game.prototype.zsJinlongLineXy,
zsPlayLineAnimationByName:engine.Game.prototype.zsPlayLineAnimationByName,
zsPlayLineAnimation:engine.Game.prototype.zsPlayLineAnimation,
jianqiLineAnim:new engine.Game().jianqiLineAnim,
});
line.call(actor,target,{duration:120});
const dragon = arena.lastElementChild;
const {left,top,width,transform,backgroundImage} = dragon.style;
const degrees = Number(transform.match(/rotate\(([-.\d]+)deg\)/)?.[1]);
const radians = degrees*Math.PI/180;
const distance = parseFloat(width)-2;
const start = {x:parseFloat(left),y:parseFloat(top)+10};
result.dragon = {start,end:{x:start.x+distance*Math.cos(radians),y:start.y+distance*Math.sin(radians)},backgroundImage};
return result;
},{skin,decadePrefix});
assert.ok(geometry && Math.hypot(geometry.x1-geometry.expectedStart.x,geometry.y1-geometry.expectedStart.y)<=2 &&
Math.hypot(geometry.x2-geometry.expectedEnd.x,geometry.y2-geometry.expectedEnd.y)<=2,
'A012 the committed card effect retains its native origin and reaches the target: '+JSON.stringify(geometry));
assert.ok(geometry.dragon.backgroundImage.includes('jinlonglinexy') &&
Math.hypot(geometry.dragon.start.x-geometry.expectedStart.x,geometry.dragon.start.y-geometry.expectedStart.y)<=2 &&
Math.hypot(geometry.dragon.end.x-geometry.expectedEnd.x,geometry.dragon.end.y-geometry.expectedEnd.y)<=2,
'the configured Jinlong effect retains its origin and reaches the target: '+JSON.stringify(geometry));
}
async function checkBattlePotionSlots(page, skin, artifact) {
await page.evaluate(async ({prefix,skin}) => {
const {mountPotionSlots} = await import(prefix+'/ui/potions.js');
const {ui,battle,hud} = window;
const counter = document.createElement('div');
counter.className = 'cardRoundNumber';
counter.innerHTML = '<div class="cardPileNumber"><span>23</span></div><div class="roundNumber">第3轮</div><div class="time">03:00</div>';
if (skin === 'native') counter.style.cssText = 'left:18px;top:4px;width:140px;height:40px';
(skin === 'shousha' ? document.body : ui.arena).append(counter);
ui.cardRoundTime = counter;
window.reviewCounter = counter;
window.potionActionCalls = 0;
battle.potionUI = mountPotionSlots(ui.arena,{potions:['ENERGY_POTION',null,'FIRE_POTION']},{
canUse:()=>true,use:()=>{ window.potionActionCalls++; },
});
hud.refresh();
},{prefix,skin});
const geometry = await page.evaluate(() => {
const box = node => node.getBoundingClientRect().toJSON();
return {arena:box(ui.arena),strip:box(document.querySelector('.mengsan-battle-potions')),
counters:[reviewCounter,...reviewCounter.querySelectorAll('div,span')].map(box)};
});
const {arena,strip,counters} = geometry;
assert.ok(strip.left>=arena.left && strip.right<=arena.left+arena.width/2 && strip.top>=arena.top &&
strip.bottom<=arena.top+140,'battle potions stay at the upper left: '+JSON.stringify(geometry));
assert.ok(counters.every(box=>!box.width||!box.height||strip.right<=box.left||strip.left>=box.right||
strip.bottom<=box.top||strip.top>=box.bottom),'battle potion slots clear the round, time and pile counters');
if (artifact) await page.screenshot({path:artifact});
await page.getByRole('button',{name:'能量药水',exact:true}).tap();
await page.getByRole('button',{name:'使用',exact:true}).tap();
assert.equal(await page.evaluate(()=>potionActionCalls),1,'the relocated potion button opens details and submits once');
const fallback = await page.evaluate(() => {
reviewCounter.className = '';
reviewCounter.replaceChildren();
reviewCounter.style.cssText = 'position:absolute;left:0;top:0;width:46%;height:46px;transition:none';
hud.refresh();
const panel = reviewCounter.getBoundingClientRect(), arena = ui.arena.getBoundingClientRect();
const slots = ui.arena.querySelector('.mengsan-battle-potions').getBoundingClientRect();
return slots.top>panel.bottom && slots.left>=arena.left && slots.right<=arena.left+arena.width/2;
});
assert.ok(fallback,'the potion strip drops below a counter that leaves no room beside it');
await page.evaluate(()=>{battle.potionUI.dispose();delete battle.potionUI;reviewCounter.remove();delete ui.cardRoundTime;});
}
async function checkPotionSkillsDuringDiscard(page, skin, artifact) {
const [factory,filename] = {shousha:['createShoushaSkillPlugin','shousha'],
shizhounian:['createShizhounianSkillPlugin','shizhounian'],xinsha:['createXinshaSkillPlugin','xinsha']}[skin];
await page.evaluate(async ({prefix,decadePrefix,filename,factory}) => {
const [engine,{Click},{Check},skinModule,{createBaseLbtnPlugin},potions] = await Promise.all([
import('/noname.js'),import('/noname/ui/click/index.js'),import('/noname/game/check.js'),
import(decadePrefix+`/ui/skill/skins/${filename}.js`),import(decadePrefix+'/ui/lbtn/skins/base.js'),import(prefix+'/potions/battle.js'),
]);
const {ui,game,card,hud,hudEventState:status} = window;
const me = game.me;
const passive = 'mengsan_taoyuan_bond_shuying';
const names = {...potions.potionSkillTranslations,[passive]:'桃园羁绊'};
const skill = {...potions.createPotionSkills(()=>null,game),[passive]:{locked:true,mark:true}};
const config = {touchscreen:true,phonelayout:true,extension_十周年UI_rightLayout:'on'};
const lib = {config,skill};
const get = {info:id=>skill[id],translation:id=>names[id]||id,
is:{locked:id=>id===passive,zhuanhuanji:()=>false,phoneLayout:()=>true}};
const app = {listen(){},reWriteFunction(){},get:{skillInfo(id) {
return {id,name:id,info:skill[id],translation:names[id],type:skill[id].enable?'enable':'trigger'};
}}};
Array.prototype.addArray ??= function(items){for(const item of items)if(!this.includes(item))this.push(item);return this;};
Array.prototype.add ??= function(item){if(!this.includes(item))this.push(item);return this;};
Array.prototype.remove ??= function(item){const i=this.indexOf(item);if(i!==-1)this.splice(i,1);return this;};
ui.controls = [ui.control.firstElementChild];
ui.updatec = ()=>{};
ui.create = {div(selector,parent,label) {
const node = document.createElement('div');
if(selector) node.className = selector.split('.').filter(Boolean).join(' ');
if(label) node.textContent=label;
parent?.appendChild(node);
return node;
},control:()=>ui.control.firstElementChild};
engine.lib.config = config;
engine.lib.device = 'android';
engine.setUI(ui);engine.setGame(game);engine.setGet(get);engine.setStatus(status);
Object.assign(status.event,{name:'chooseToDiscard',selectCard:[2,2],position:'h'});
delete status.event.respondTo;
window.reviewResponse.card.remove();
ui.thrown = [];
const prompt = window.reviewResponse.prompt;
const count = document.createElement('span');
count.textContent = '0/2';
prompt.replaceChildren('请弃置两张手牌',document.createElement('br'),count);
status.event.custom = {add:{card() {count.textContent = `${ui.selected.cards.length}/2`;}}};
Object.assign(me,{getSkills:type=>type==='e'?[]:Object.keys(skill),invisibleSkills:[],awakenedSkills:[],
getStorage:(key,fallback=[])=>me.storage[key]??fallback,isTempBanned:()=>false});
Object.assign(game,{expandSkills:skills=>skills,addVideo(){},countChoose(){},check:()=>Check.prototype.confirm(status.event,'')});
const plugin = skinModule[factory](lib,game,ui,get,{},status,app);
if (filename === 'xinsha') {
plugin.initCreateFunctions();
plugin.initUpdateFunctions();
} else {
plugin._extendUICreate();
plugin._extendUI();
}
plugin.updateSkillMarks=()=>{};
createBaseLbtnPlugin(lib,game,ui,get,{},status,app).initConfirmRewrite();
ui.confirm = null;
ui.create.confirm('');
card.classList.remove('selected');
card.updateTransform=()=>{};
card.addEventListener('touchend',()=>{
status.clicked=false;
Click.prototype.card.call(card);
});
hud.refresh();
const visiblePotionButtons = () => [...ui.skillControl.querySelectorAll('[data-id]')].filter(node=>
node.getClientRects().length && potions.potionSkillIds.includes(node.dataset.id)).map(node=>node.dataset.id);
window.discardSkillCheck = {frames:[],visiblePotionButtons,passive,
initialPotionButton:ui.skillControl.querySelector(`[data-id="${potions.potionSkillIds[0]}"]`)};
const capture = event => {
if (event.target.closest('.card')!==card) return;
// Listen after the real card handler, before any scheduled HUD refresh.
discardSkillCheck.frames.push(visiblePotionButtons());
requestAnimationFrame(()=>discardSkillCheck.frames.push(visiblePotionButtons()));
};
window.addEventListener('touchend',capture,{once:true});
},{prefix,decadePrefix,factory,filename});
await page.locator('.handcards>.card').first().tap();
const result = await page.evaluate(async () => {
await new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve)));
const {frames,passive,initialPotionButton,visiblePotionButtons} = discardSkillCheck;
return {frames,visible:visiblePotionButtons(),rebuilt:initialPotionButton && !initialPotionButton.isConnected,
selected:ui.selected.cards.length,count:ui.dialog.textContent,passiveVisible:Boolean(ui.skillControl.querySelector(`[data-id="${passive}"]`)?.getClientRects().length)};
});
if (artifact) await page.screenshot({path:artifact});
assert.equal(result.rebuilt,true,'ten-year UI rebuilt the skill row on tap');
assert.ok(result.selected===1 && result.count.endsWith('1/2'),'the original touch selects one discard card and updates the count');
assert.ok(result.passiveVisible,'normal skills remain visible');
assert.equal(result.frames.length,2,'both touch and first animation frame were sampled');
assert.deepEqual([...result.frames.flat(),...result.visible],[],'potion skill duplicates are hidden from the first frame');
}
async function checkMobileResponseLayout(page, skin, artifact) {
await page.evaluate(({skin,decadePrefix}) => {
const {arena,control} = ui;
const card = document.createElement('div');
const scale = Math.min(arena.clientHeight * .18 / 156,1);
card.className = 'card thrown';
card.style.cssText = `left:calc(50% - 56px);top:calc(50% - 78px);width:112px;height:156px;transform:scale(${scale});`;
card.style.background = `center/100% 100% url("${decadePrefix}/image/card-skins/decade/sha.png")`;
arena.appendChild(card);
ui.thrown = [card];
const prompt = document.createElement('div');
prompt.className = skin === 'native' ? 'dialog' : 'hand-tip';
prompt.innerHTML = skin === 'native'
? '<div class="content-container"><div class="content"><div class="caption">请使用一张闪响应杀</div></div></div>'
: '<span>请使用一张闪响应杀</span>';
arena.appendChild(prompt);
ui.dialog = prompt;
const event = hudEventState.event;
event.name = 'chooseToUse';
event.respondTo = [game.players[1],{name:'sha'}];
event.dialog = prompt;
window.reviewResponses = [];
const confirm = control.firstElementChild;
confirm.classList.remove('stayleft');
ui.confirm = confirm;
if (skin !== 'native') confirm.classList.add('combo-control','lbtn-confirm');
const [ok,cancel] = confirm.children;
confirm.node = {ok,cancel};
[ok,cancel].forEach((node,index) => {
node.dataset.response = index ? 'cancel' : 'ok';
if (skin !== 'native') node.classList.add('control');
if (skin === 'shousha') {
(node.firstElementChild || node).textContent = '';
if (index) node.innerHTML = '<img src="/extension/十周年UI/ui/assets/lbtn/uibutton/QX.png" alt="取消">';
} else (node.firstElementChild || node).textContent = index ? '取消' : '确定';
node.addEventListener('click',()=>reviewResponses.push(node.dataset.response));
});
window.reviewResponse = {card,prompt};
window.card.classList.add('selected');
window.card.style.backgroundImage = `url("${decadePrefix}/image/card-skins/decade/shan.png")`;
window.card.textContent = '';
hud.refresh();
},{skin,decadePrefix});
await page.waitForTimeout(550);
const geometry = await page.evaluate(() => {
const box = node => node.getBoundingClientRect().toJSON();
return {arena:box(ui.arena), card:box(reviewResponse.card), prompt:box(reviewResponse.prompt),
ok:box(document.querySelector('[data-response="ok"]')),cancel:box(document.querySelector('[data-response="cancel"]')),
hand:box(card)};
});
if (artifact) await page.screenshot({path:artifact});
const {arena, card, prompt, ok, cancel, hand} = geometry;
const center = ({left,right}) => (left + right) / 2;
assert.ok([card,prompt,{left:ok.left,right:cancel.right}].every(box=>Math.abs(center(box)-center(arena))<=2),
'A013 played card, response prompt and action group share the arena center: '+JSON.stringify(geometry));
const gap = 4;
assert.ok(card.top >= arena.top+2 && card.bottom+gap <= prompt.top && prompt.bottom+gap <= Math.min(ok.top,cancel.top) &&
Math.max(ok.bottom,cancel.bottom)+gap <= hand.top && ok.right <= cancel.left,
'A013 played card, prompt, actions and selected hand card do not overlap: '+JSON.stringify(geometry));
await page.locator('[data-response="ok"]').tap();
await page.locator('[data-response="cancel"]').tap();
assert.deepEqual(await page.evaluate(()=>reviewResponses),['ok','cancel'],'both original response callbacks are reachable');
const restored = await page.evaluate(() => {
delete hudEventState.event.respondTo;
hud.refresh();
const verticalShift = Number.parseFloat(ui.control.style.translate.split(/\s+/)[1]) || 0;
return verticalShift === 0 && reviewResponse.card.style.translate === '';
});
assert.ok(restored,'response spacing is released when the original event ends');
}
const fixture = `<!doctype html><meta charset="utf-8"><link rel="stylesheet" href="/layout/default/layout.css"><div id="window"><div id="arena"><div id="mebg"></div><div id="me" class="mengsan-hand-root-shuying"><div id="handcards1" class="mengsan-hand-scroll-shuying"><div class="handcards mengsan-hand-zone-shuying mengsan-hand-layout-shuying"></div></div><div id="handcards2"><div class="handcards"></div></div></div><div id="control"><div class="control"><div>测试技能</div><div>结束出牌</div></div></div></div></div><style>html,body,#window{margin:0;width:100%;height:100%;position:absolute}#arena{inset:0;width:100%;height:100%;position:absolute}#arena>.player{position:absolute;width:100px;height:130px;background:#345;color:#fff}#arena>.player .avatar{height:100%;width:100%;background:linear-gradient(#334f4b,#172d29)}#arena>.player .name{position:absolute;top:4px;left:4px}#me{position:absolute;bottom:0;width:100%;height:160px}#handcards1,#handcards2{position:absolute;width:100%;height:100%}.handcards{height:100%}.card{background:#e8d7b2;color:#263b35;position:absolute}.mengsan-intent-shuying{position:absolute}</style>`;
const importMap = reviewOnly || journeyReview ? fs.readFileSync(path.join(app,'index.html'),'utf8').match(/<script type="importmap">.*?<\/script>/s)[0] : '';
const server = http.createServer((req, res) => {
if (req.url === '/fixture') { res.setHeader('Content-Type','text/html;charset=utf-8');res.end(fixture);return; }
if(req.url==='/noname.js'){res.setHeader('Content-Type','text/javascript');res.end('export const _status={};');return;}
if (req.url === '/fixture') { res.setHeader('Content-Type','text/html;charset=utf-8');res.end(fixture.replace('<meta charset="utf-8">','<meta charset="utf-8">'+importMap));return; }
if(!reviewOnly && !journeyReview && req.url==='/noname.js'){res.setHeader('Content-Type','text/javascript');res.end('export const _status={};');return;}
if(decodeURIComponent(new URL(req.url,'http://localhost').pathname)==='/extension/术樱包/diagnostics/index.js') {
res.setHeader('Content-Type','text/javascript');res.end('export const getDiagnostics=()=>({status:()=>({enabled:false}),scope:()=>({info(){},error(){}})});');return;
}
@@ -34,20 +430,32 @@ const server = http.createServer((req, res) => {
const origin = 'http://127.0.0.1:' + server.address().port;
const browser = await chromium.launch({channel:'msedge',headless:true});
let checks = 0;
const reviewFailures = [];
const viewports = reviewOnly ? [{width:1080,height:486},{width:812,height:375},{width:667,height:375}]
: [{width:1280,height:720},{width:1234,height:920},{width:812,height:600},{width:812,height:375},{width:667,height:375},{width:375,height:500},{width:540,height:900}];
try {
if (journeyReview) {
await require('./test-journey-ui-zoom.cjs').testJourneyZoom(browser,origin,prefix);
return;
}
for (const skin of process.env.HUD_TEST_SKIN?[process.env.HUD_TEST_SKIN]:['native','shousha','shizhounian','xinsha']) {
for (const viewport of [{width:1280,height:720},{width:1234,height:920},{width:812,height:600},{width:812,height:375},{width:667,height:375},{width:375,height:500},{width:540,height:900}]) {
const page = await browser.newPage({viewport,hasTouch:true});
for (const viewport of viewports) {
const page = await browser.newPage({viewport,hasTouch:true,deviceScaleFactor:reviewOnly?2.625:1});
await page.goto(origin+'/fixture');
if (reviewOnly && viewport.width===1080) {
await page.addStyleTag({url:origin+'/layout/nova/layout.css'});
await page.addStyleTag({content:'body{zoom:.65;width:100%;height:100%}'});
}
await page.addStyleTag({content:'body{background:#161e29 url("/image/background/lanting_bg.jpg") center/cover no-repeat}'});
await page.addStyleTag({url:origin+prefix+'/ui/style.css'});
if(reviewOnly) await page.addStyleTag({url:origin+prefix+'/ui/potions.css'});
if(skin!=='native') {
for(const css of ['/extension/'+encodeURIComponent('十周年UI')+'/src/styles/layout.css','/extension/'+encodeURIComponent('十周年UI')+'/ui/styles/base.css','/extension/'+encodeURIComponent('十周年UI')+'/ui/styles/skill/'+skin+'.css','/extension/'+encodeURIComponent('十周年UI')+'/ui/styles/lbtn/'+skin+'.css'])await page.addStyleTag({url:origin+css});
await page.addStyleTag({url:origin+'/extension/'+encodeURIComponent('十周年UI')+'/src/styles/player'+({shousha:2,shizhounian:1,xinsha:3}[skin])+'.css'});
await page.addStyleTag({url:origin+'/extension/'+encodeURIComponent('十周年UI')+'/src/styles/equip.css'});
}
await page.addStyleTag({url:origin+prefix+'/ui/hand/style.css'});
const initial = await page.evaluate(async ({prefix,skin}) => {
const initial = await page.evaluate(async ({prefix,skin,reviewOnly,decadePrefix}) => {
const mod = await import(prefix+'/ui/hud/index.js').catch(error=>({error:String(error)}));
if(typeof mod.mountBattleHUD!=='function')return {module:false,error:mod.error};
const releases=[];window.session={id:'hud-test',active:true,ownResource:(_,f)=>releases.push(f)};
@@ -68,12 +476,16 @@ const server = http.createServer((req, res) => {
node.addEventListener('click',()=>{window.nativeActionClicks=(window.nativeActionClicks||0)+1;});
});
const players=[];
for(let i=0;i<8;i++) {
for(let i=0;i<(reviewOnly?2:8);i++) {
const player=document.createElement('div');player.className='player';player.dataset.position=String(i);player.playerid=String(i);player.name=i?'enemy'+i:'liubei';player.hp=40;player.maxHp=60;player.hujia=8;
player.storage={mengsanCamp_shuying:i?'enemy':'ally',mengsanStrength_shuying:i===1?3:0,mengsanVulnerable_shuying:i===2?2:0,mengsanEnergy_shuying:3,mengsanMaxEnergy_shuying:3};
player.innerHTML=skin==='native' ? '<div class="avatar"></div><div class="name">'+(i?'敌人'+i:'刘备')+'</div><div class="hp">40/60</div><div class="marks"></div>' : '<div class="primary-avatar has-outcrop"><div class="action">回合开始</div></div><div class="framebg"></div><div class="identity">汉</div><div class="camp-wrap"><div class="camp-border"></div><div class="avatar-name">'+(i?'敌人'+i:'刘备')+'</div></div><div class="hp-wrap"><div class="hp">40/60</div></div><div class="card-count">8</div><div class="dui-marks"></div>';
if(i)player.insertAdjacentHTML('beforeend','<div class="mengsan-intent-shuying">攻击 8×2</div>');
player.node={avatar:player.querySelector('.avatar,.primary-avatar'),hp:player.querySelector('.hp'),hpWrap:player.querySelector('.hp-wrap'),campWrap:player.querySelector('.camp-wrap'),name:player.querySelector('.name,.avatar-name'),identity:player.querySelector('.identity'),framebg:player.querySelector('.framebg'),count:player.querySelector('.card-count'),marks:player.querySelector('.marks,.dui-marks')};
if (reviewOnly && i && window.innerWidth>=1000) {
player.style.cssText='left:50%!important;right:auto!important;top:12px!important;bottom:auto!important;transform:translateX(-50%)!important;';
}
if (reviewOnly && !i) player.node.avatar.style.backgroundImage=`url(${prefix}/assets/portraits/liubei-portrait.jpg)`;
player.node.avatar.style.backgroundImage='url("/image/character/'+(i?'caocao':'liubei')+'.jpg")';
if(i){player.style.cssText=`left:${(i-1)%4*21+5}%;top:${68+Math.floor((i-1)/4)*96}px;width:68px;height:82px;transform:none`;}
const equips=document.createElement('div');equips.className='equips';player.node.equips=equips;player.appendChild(equips);
@@ -105,6 +517,10 @@ const server = http.createServer((req, res) => {
me.node.handcards1=ui.handcards1Container.firstElementChild;me.node.handcards2=ui.handcards2Container.firstElementChild;
const get={translation:value=>value==='liubei'?'刘备':String(value).replace(/^enemy/,'敌人'),select:value=>value};
const card=document.createElement('div');card.className='card selectable';card.textContent='杀';card.name='sha';me.node.handcards1.appendChild(card);window.card=card;
if (reviewOnly) {
card.style.background=`center/100% 100% url("${decadePrefix}/image/card-skins/decade/sha.png")`;
card.textContent='';
}
card.addEventListener('contextmenu',event=>{
event.preventDefault();window.introOpens=(window.introOpens||0)+1;
const tip=document.createElement('div');tip.className='dialog popped static';
@@ -124,9 +540,9 @@ const server = http.createServer((req, res) => {
window.originalEnemyPresentation=players.slice(1).map(p=>({style:p.style.cssText,classes:p.className,html:p.innerHTML}));
window.hud=mod.mountBattleHUD(me,battle,{ui,game,get,lib:{skill:{},translate:{}},_status:hudEventState,document,window,assetBase:prefix});
const {mountRelicStrip}=await import(prefix+'/ui/relic-strip.js');
window.testRelics=[];window.testStrip=mountRelicStrip(arena,()=>testRelics,relic=>{window.lastRelicOpened=relic.id;},()=>{
window.testRelics=[];window.testRelicCounters={};window.testStrip=mountRelicStrip(arena,()=>testRelics,relic=>{window.lastRelicOpened=relic.id;},()=>{
const icon=document.createElement('img');icon.src=prefix+'/assets/status/strength_power.png';return icon;
},document,window);releases.push(()=>testStrip.dispose());
},document,window,relic=>testRelicCounters[relic.id] ?? null);releases.push(()=>testStrip.dispose());
let submitted=0;game.check=()=>ui.selected.cards.length===1&&ui.selected.targets.length===1;game.uncheck=()=>{ui.selected.cards=[];ui.selected.targets=[];};
ui.click.card=function(){ui.selected.cards=[this];players.slice(1).forEach(p=>p.classList.add('selectable'));};ui.click.target=function(){ui.selected.targets=[this];};ui.click.ok=()=>{submitted++;game.uncheck();};
game.isSubmitted=()=>submitted;const event=hudEventState.event;event.selectTarget=[1,1];event.selectCard=[1,1];
@@ -134,10 +550,80 @@ const server = http.createServer((req, res) => {
window.testHandUI=await mountHandUI(me,session,{ui,game,get,lib:{card:{},translate:{}},_status:hudEventState,document,window,isActiveCardUse:()=>true,canPayCard:()=>true,cardCost:()=>1,styleURL:prefix+'/ui/hand/style.css'});
window.testInput={owns:()=>false};hud.refresh();window.testFan={sync:()=>testHandUI.refresh()};
return {module:true,parentKept:hand.parentNode===oldParents.hand&&control.parentNode===oldParents.control&&card.parentNode===oldParents.card,skin};
},{prefix,skin});
},{prefix,skin,reviewOnly,decadePrefix});
assert.equal(initial.module,true,initial.error||'HUD mount module must exist');checks++;
assert.equal(initial.parentKept,true);checks++;
await page.waitForTimeout(70);
if (reviewOnly) {
const scenario = `${skin}-${viewport.width}x${viewport.height}`;
const artifact = name => process.env.HUD_ARTIFACTS && path.join(process.env.HUD_ARTIFACTS,`${name}-${scenario}.png`);
try { await checkMobileTargetLine(page,artifact('A012')); await checkCommittedLine(page,skin); checks+=8; }
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
try { await checkOrdinaryPlayCenter(page,skin,artifact('ordinary-play-center')); checks++; }
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
if (viewport.width===1080) {
for (const zoom of [.5,.85,1,1.2]) {
try {
await setBattleZoom(page,zoom);
await checkOrdinaryPlayCenter(page,skin);
await checkMobileTargetLine(page);
await checkCommittedLine(page,skin);
checks+=9;
} catch (error) { reviewFailures.push(`${scenario} zoom ${zoom} ${error.message}`); }
}
await setBattleZoom(page,.65);
}
try { await checkBattlePotionSlots(page,skin,artifact('battle-potion-slots')); checks+=4; }
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
try { await checkMobileResponseLayout(page,skin,artifact('A013')); checks+=4; }
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
if (skin!=='native') {
try { await checkPotionSkillsDuringDiscard(page,skin,artifact('discard-skill-controls')); checks+=5; }
catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
try {
assert.equal(await page.evaluate(()=>{
const bounds = window.decadeUI.boundsCaches.hand;
bounds.check();
hud.dispose();
return bounds.updated;
}),false,'the skin will read restored hand geometry after the HUD exits');
checks++;
} catch (error) { reviewFailures.push(`${scenario} ${error.message}`); }
}
if (!reviewFailures.some(failure => failure.startsWith(`${scenario} `))) console.log(`${scenario} battle UI review passed`);
await page.close();
continue;
}
const releasedControls = await page.evaluate(() => {
const control = document.createElement('div');
control.className = 'control';
control.style.setProperty('left', '7px', 'important');
ui.control.appendChild(control);
hud.refresh();
const managed = control.style.left === 'auto';
control.remove();
hud.refresh();
const released = control.style.left === '7px' && control.style.getPropertyPriority('left') === 'important';
control.style.left = '13px';
ui.control.appendChild(control);
hud.refresh();
const reacquired = control.style.left === 'auto';
control.remove();
hud.refresh();
const restoredAgain = control.style.left === '13px';
const popup = document.createElement('div');
popup.className = 'damage skill-popup';
popup.style.left = game.me.offsetLeft + 'px';
popup.style.top = game.me.offsetTop + 80 + 'px';
ui.arena.appendChild(popup);
hud.refresh();
const popupManaged = popup.classList.contains('mengsan-hud-notification-shuying');
popup.remove();
hud.refresh();
return { managed, released, reacquired, restoredAgain, popupManaged,
popupReleased: !popup.classList.contains('mengsan-hud-notification-shuying') };
});
assert.ok(Object.values(releasedControls).every(Boolean), 'detached controls and notifications release HUD ownership and can be acquired again: ' + JSON.stringify(releasedControls));checks++;
await page.evaluate(()=>testFan.sync(true));
const corners=await page.evaluate(()=>({portrait:parseFloat(getComputedStyle(game.me.node.avatar).borderTopLeftRadius)}));
assert.ok(corners.portrait>=12,'portrait retains rounded edges: '+JSON.stringify(corners));checks++;
@@ -205,15 +691,33 @@ const server = http.createServer((req, res) => {
assert.equal(await page.evaluate(()=>window.nativeSkillUsed),true,'native skill callbacks survive the separate rail');checks++;
await page.evaluate(()=>{testNativeSkills.remove();delete ui.skills;hud.refresh();});
const relicGeometry=await page.evaluate(()=>{
testRelics=[{id:'test',name:'遗物'}];testStrip.refresh();
const strip=document.querySelector('.mengsan-hand-relics-shuying').getBoundingClientRect(),icon=document.querySelector('.mengsan-hand-relics-shuying button').getBoundingClientRect();
return {strip:strip.toJSON(),icon:icon.toJSON()};
testRelics=[{id:'test',name:'遗物'}];
testRelicCounters.test={value:0,label:'当前计数 0'};
testStrip.refresh();
const strip=document.querySelector('.mengsan-hand-relics-shuying').getBoundingClientRect();
const button=document.querySelector('.mengsan-hand-relics-shuying button');
const badge=button.querySelector('.mengsan-relic-counter-shuying');
const initial=badge.textContent;
button.focus();
testRelicCounters.test={value:20,label:'当前计数 20'};
testStrip.refreshCounters();
return {
strip:strip.toJSON(),icon:button.getBoundingClientRect().toJSON(),
initial,value:badge.textContent,position:badge.getBoundingClientRect().toJSON(),
focused:document.activeElement===button,label:button.getAttribute('aria-label'),
};
});
assert.equal(relicGeometry.initial,'0','zero progress renders on the icon');checks++;
assert.equal(relicGeometry.value,'20','two-digit progress updates in the same badge');checks++;
assert.ok(relicGeometry.focused && relicGeometry.label.includes('20'),'counter updates preserve focus and update the accessible name');checks++;
assert.ok(Math.abs(relicGeometry.icon.right-relicGeometry.position.right)<=2 &&
Math.abs(relicGeometry.icon.bottom-relicGeometry.position.bottom)<=2,'the badge stays within the lower right corner');checks++;
assert.ok(relicGeometry.icon.y>=relicGeometry.strip.y&&relicGeometry.icon.bottom<=relicGeometry.strip.bottom,'top relic icon fits without clipping');checks++;
assert.ok(relicGeometry.strip.width<=142,'relic area stays compact above the right skill rail');checks++;
assert.ok(relicGeometry.strip.x>=viewport.width-166,'relic area is on the right');checks++;
assert.ok(Math.abs(relicGeometry.strip.bottom-(viewport.height-Number.parseFloat(await page.locator('#arena').evaluate(n=>n.style.getPropertyValue('--mengsan-relic-dock-bottom')))))<2,'relic area aligns with the side dock, with a compact narrow-screen offset');checks++;
await page.evaluate(()=>{testRelics=Array.from({length:10},(_,i)=>({id:'r'+i,name:'遗物'+i}));testStrip.refresh();hud.refresh();});
assert.equal(await page.locator('.mengsan-relic-counter-shuying').count(),0,'relics without progress have no badge');checks++;
const battlefieldClear=await page.evaluate(()=>{
const strip=document.querySelector('.mengsan-hand-relics-shuying').getBoundingClientRect();
const intersects=(a,b)=>a.left<b.right&&a.right>b.left&&a.top<b.bottom&&a.bottom>b.top;
@@ -265,17 +769,68 @@ const server = http.createServer((req, res) => {
await page.evaluate(()=>{game.players[7].hp=0;hud.refresh();});
assert.equal(await page.evaluate(()=>game.players[7].style.cssText===originalEnemyPresentation[6].style&&!game.players[7].classList.contains('mengsan-hud-defeated-shuying')),true,'death keeps the original battlefield presentation');checks++;
await page.evaluate(()=>{game.players[7].hp=40;game.me.storage.mengsanVulnerable_shuying=3;hud.refresh();});
assert.match(await page.locator('.mengsan-hud-statuses-shuying').innerText(),/3/);checks++;
assert.equal(await page.locator('.mengsan-hud-statuses-shuying').innerText(),'','status chips contain icons only');checks++;
const heldStatus = page.locator('.mengsan-hud-statuses-shuying button').first();
await heldStatus.dispatchEvent('pointerdown', {button:0,pointerId:45,
pointerType:'touch',clientX:10,clientY:10});
await page.waitForTimeout(150);
await page.evaluate(() => {
game.me.storage.mengsanWeak_shuying=1; hud.refresh();
});
await page.waitForTimeout(450);
assert.equal(await page.locator('dialog.mengsan-hud-dialog-shuying').count(),1,'unrelated status update preserves an active hold');checks++;
await page.evaluate(() => window.dispatchEvent(
new PointerEvent('pointerup', {pointerId:45,pointerType:'touch'})));
await page.evaluate(() => {
game.me.storage.mengsanVulnerable_shuying=5; hud.refresh();
});
assert.match(await page.locator('dialog.mengsan-hud-dialog-shuying').innerText(),/易伤 5/,'open details show the current value');checks++;
await page.evaluate(() => {
delete game.me.storage.mengsanVulnerable_shuying; hud.refresh();
});
assert.match(await page.locator('dialog.mengsan-hud-dialog-shuying').innerText(),/已失效/,'removed state is explicitly expired');checks++;
await page.getByRole('button',{name:'关闭',exact:true}).click();
await page.evaluate(() => {
delete game.me.storage.mengsanWeak_shuying;
game.me.storage.mengsanVulnerable_shuying=3; hud.refresh();
});
await page.evaluate(()=>{for(const key of ['Weak','Frail','Artifact','Constrict','Tangled','Shrink','Plow','Slippery'])game.me.storage['mengsan'+key+'_shuying']=2;hud.refresh();});
assert.equal(await page.evaluate(()=>{const row=document.querySelector('.mengsan-hud-statuses-shuying').getBoundingClientRect();return [...document.querySelectorAll('.mengsan-hud-statuses-shuying button')].every(n=>{const r=n.getBoundingClientRect();return r.bottom<=row.bottom+1&&r.right<=row.right+1;});}),true,'matrix overflow keeps the visible statuses and more button inside the grid');checks++;
await page.getByRole('button',{name:'查看全部状态',exact:true}).click();
// Compact icon chips fit more states; register enough real display fields
// to exercise overflow on wide screens as well as phones.
await page.evaluate(async prefix => {
const {bindCombatStatusSource} = await import(prefix+'/battle/status-sources.js');
const keys=['turnStrength','turnEnergy','turnBlock','turnLoseHp',
'infernoLoseHp','lossDamage','lossStrength','vulnerableBonus',
'attackBlock','retaliation','colossus','freeAttack','noDraw',
'noEnergy','doubleTap','plating','exhaustBlock','exhaustDraw',
'vulnerableDraw','juggle','endAttack','retrieveAttack','bodyguard',
'autoStrike','firstBlock','blockDamage','barricade','corruption'];
bindCombatStatusSource(game.me,session,'overflow-test',() => ({
powers:Object.fromEntries(keys.map(key => [key,1])),
}));
hud.refresh();
},prefix);
await holdStatus(page,page.getByRole('button',{
name:'点击查看全部状态',exact:true}));
assert.ok(await page.getByRole('dialog').isVisible(),'overflow states remain available in the details');checks++;
await page.getByRole('button',{name:'关闭',exact:true}).click();
assert.equal(await page.evaluate(()=>{const s=document.querySelector('.mengsan-hud-center-shuying').getBoundingClientRect(),p=game.me.getBoundingClientRect();return s.bottom<=p.top&&p.top-s.bottom<=13;}),true,'status chips automatically appear just above the portrait');checks++;
await page.locator('.mengsan-hud-statuses-shuying button').first().click();
await page.locator('.mengsan-hud-statuses-shuying button').first().tap();
assert.equal(await page.locator('dialog.mengsan-hud-dialog-shuying').count(),1,'short tap opens the status list');checks++;
const statusList = await page.locator('.mengsan-hud-detail-body-shuying').evaluate(body => ({
rows:body.querySelectorAll('details').length,
position:getComputedStyle(body).position,
minHeight:Math.min(...[...body.querySelectorAll('summary')].map(row=>row.getBoundingClientRect().height)),
height:body.getBoundingClientRect().height,
scrollable:body.scrollHeight>body.clientHeight,
}));
assert.ok(statusList.rows>20&&statusList.position!=='absolute'&&statusList.minHeight>=48&&statusList.height>0&&statusList.scrollable,'status list keeps all entries in normal flow with large tap targets: '+JSON.stringify(statusList));checks++;
await page.getByRole('button',{name:'关闭',exact:true}).click();
await holdStatus(page,page.locator('.mengsan-hud-statuses-shuying button').first());
assert.ok(await page.locator('dialog.mengsan-hud-dialog-shuying').isVisible());checks++;
await page.getByRole('button',{name:'关闭',exact:true}).click();
await page.locator('.mengsan-hud-statuses-shuying button').first().tap();
await holdStatus(page,page.locator('.mengsan-hud-statuses-shuying button').first(),'touch');
assert.ok(await page.locator('dialog.mengsan-hud-dialog-shuying').isVisible(),'touch opens the player status details');checks++;
await page.getByRole('button',{name:'关闭',exact:true}).click();
await page.evaluate(()=>game.uncheck());
@@ -331,6 +886,7 @@ const server = http.createServer((req, res) => {
await page.close();
}
}
if (reviewFailures.length) throw new Error(reviewFailures.join('\n'));
console.log('HUD browser checks: '+checks);
} finally {await browser.close();await new Promise(resolve=>server.close(resolve));}
})().catch(error=>{console.error(error);server.close();process.exitCode=1;});
+198
View File
@@ -0,0 +1,198 @@
const assert = require('node:assert/strict');
const path = require('node:path');
const surfaces = [
['选将', '.mengsan-character-overlay-shuying', '确认出征', 'mengsan_liubei_shuying'],
['地图', '.mengsan-map-overlay-shuying', /可前往$/, 'route'],
['事件选项', '.mengsan-flow-overlay-shuying', '继续', 'go'],
['商店', '.mengsan-shop-overlay-shuying', '离开商店', 'leave'],
['休息处', '.mengsan-rest-overlay-shuying', '离开休息处', 'done'],
['剧情', '.mengsan-dialogue-overlay-shuying', /跳过对话/, null],
['剧情分支', '.mengsan-dialogue-overlay-shuying', /剧情文本/, 'pledge'],
['奖励选牌', '.mengsan-card-choice-dialog-shuying', '跳过', null],
['战后选择', '.mengsan-victory-dialog-shuying', /领取战利品/, 'claim'],
['牌库', '.mengsan-deck-dialog-shuying', '关闭', null],
['牌堆', '.mengsan-deck-dialog-shuying', '关闭', null],
['遗物', '.mengsan-relic-dialog-shuying', '关闭', null],
['药水详情', '.mengsan-potion-dialog', '关闭', null],
['菜单确认', '.mengsan-menu-dialog-shuying', '保留', 'keep'],
['调试管理器', '.mengsan-gm-dialog-shuying', '关闭', null],
['战斗状态', '.mengsan-hud-dialog-shuying', '关闭', null],
];
async function mountSurface(page, origin, prefix, settings, surface) {
await page.goto(origin+'/fixture');
await page.addStyleTag({content:'#window,#arena{transition:none}'});
for (const file of ['style','shop','rest','potions','character-select']) {
await page.addStyleTag({url:origin+prefix+`/ui/${file}.css`});
}
await page.evaluate(async ({prefix,settings,surface}) => {
const engine = await import('/noname.js');
const imported = await import(prefix+'/progression/state.js');
const updateZoom = settings.transform ? engine.UI.prototype.updatez.bind(engine.ui) :
(await import('/extension/'+encodeURIComponent('十周年UI')+'/src/overrides/ui/update.js')).uiUpdatez;
window.zoomReviewSetScale = zoom => {
engine.game.documentZoom = zoom;
updateZoom();
};
window.zoomReviewSetScale(settings.zoom);
const ui = {window:document.getElementById('window'),arena:document.getElementById('arena'),create:{}};
ui.create.div = (selector,...args) => {
const element = document.createElement('div');
element.className = selector.split('.').filter(Boolean).join(' ');
element.setBackground = (name,type) => {element.style.backgroundImage=`url(/image/${type}/${name}.jpg)`;};
for (const arg of args) {
if (arg instanceof Node) arg.append(element);
else if (typeof arg === 'string') element.textContent = arg;
}
return element;
};
engine.lib.config ??= {};
engine.lib.assetURL = '/';
engine.lib.card.sha ??= {type:'basic'};
engine.lib.translate.sha = '杀';
engine.lib.translate.sha_info = '对一名其他角色造成伤害。';
engine.lib.translate.mengsan_liubei_shuying = '刘备';
engine.setUI(ui);
const run = imported.createRun('mengsan_liubei_shuying');
Object.assign(run.player,{gold:99,hp:25,maxHp:50,potions:['ENERGY_POTION']});
window.zoomReviewResult = null;
function settled(value) {window.zoomReviewResult = value;}
const modules = name => import(prefix+`/ui/${name}.js`);
const choices = [{id:'go',name:'继续'},{id:'leave',name:'离开'}];
if (surface==='选将') {
const {chooseCharacterCards} = await modules('character-select');
chooseCharacterCards([{id:run.player.character,name:'刘备',description:'出征武将'}],prefix,'返回').then(settled);
} else if (surface==='地图') {
const {showMap} = await modules('map/renderer');
showMap(run).then(()=>settled('route'));
} else if (surface==='事件选项') {
const {chooseButtons} = await modules('flow-ui');
chooseButtons('地图事件',choices,'选择一项继续前进').then(settled);
} else if (surface==='商店') {
const {chooseShop} = await modules('shop-ui');
chooseShop(run.player,[{id:'supply:heal',name:'补给',description:'获得补给',price:30}]).then(settled);
} else if (surface==='休息处') {
const {chooseRest} = await modules('rest-ui');
chooseRest([{id:'heal',name:'休息',description:'恢复生命'}],{tent:true}).then(settled);
} else if (surface==='剧情' || surface==='剧情分支') {
const {playDialogue} = await modules('dialogue');
const branch = surface==='剧情分支';
const lines = branch ? [{type:'choice',text:'如何回答?',speed:0,flag:'story.zoom',
choices:[{id:'pledge',text:'结伴前行'},{id:'leave',text:'独自出发'}]}] :
[{type:'narrator',text:'整备完毕,今日继续向前。',speed:0}];
playDialogue(lines,{run}).then(()=>settled(branch ? run.storyFlags['story.zoom'] : null));
} else if (surface==='奖励选牌') {
const {chooseCardDialog} = await modules('reward-ui');
chooseCardDialog([{id:'sha',card:{name:'sha'}}]).then(settled);
} else if (surface==='战后选择') {
const {chooseVictoryOptions} = await modules('reward-ui');
chooseVictoryOptions([{id:'claim',label:'领取战利品'}]).then(settled);
} else if (surface==='牌库') {
const {openCardLibrary} = await modules('card-library');
run.player.deck = Array.from({length:48},()=>({name:'sha',suit:'heart',number:5}));
openCardLibrary(run);
} else if (surface==='牌堆') {
const {mountBattlePiles} = await modules('card-library');
mountBattlePiles({active:true,ownResource(){}},{drawPile:run.player.deck,discardPile:[],exhaustPile:[]});
} else if (surface==='遗物') {
const {mountRelics} = await modules('relics');
mountRelics({active:true,ownResource(){}},run,{status(){},counter:()=>({value:null,label:null})},{stripRoot:ui.arena});
} else if (surface==='药水详情') {
const {mountPotionSlots} = await modules('potions');
const slots = mountPotionSlots(ui.arena,run.player,{use(){},canUse:()=>true});
slots.layoutBattleSlots(ui);
} else if (surface==='菜单确认') {
const {askMenu} = await modules('navigation');
askMenu('结束征程?','保留进度后可以继续。',[{id:'keep',name:'保留'}]).then(settled);
} else if (surface==='调试管理器') {
const {mountGMManager} = await modules('gm-manager');
const game = {};
mountGMManager({active:true,ownResource(){}},{getCards:()=>[]},{},{},
{field:(target,key,value)=>{target[key]=value;}},game);
game.mengsanGM_shuying();
} else if (surface==='战斗状态') {
const {mountBattleHUD} = await modules('hud/index');
ui.me = document.getElementById('me');
ui.control = document.getElementById('control');
const player = ui.create.div('.player',ui.arena);
Object.assign(player,{name:run.player.character,hp:25,maxHp:50,storage:{mengsanStrength_shuying:2},node:{}});
mountBattleHUD(player,{session:{active:true,ownResource(){}}},{ui,get:engine.get,_status:engine._status,document,window,assetBase:prefix});
}
},{prefix,settings,surface});
}
async function checkMapDrag(page) {
const viewport = page.locator('.mengsan-map-viewport-shuying');
const scroll = await viewport.evaluate(element => {
element.scrollTop = (element.scrollHeight-element.clientHeight)/2;
const box = element.getBoundingClientRect();
const y = Math.min(box.bottom-4,innerHeight-4);
return {top:element.scrollTop,scale:box.height/element.offsetHeight,x:box.left+box.width/2,y,
distance:Math.min(32,Math.floor((y-Math.max(0,box.top))/2))};
});
assert.ok(scroll.distance>=8,`the map still provides a draggable viewport: ${JSON.stringify(scroll)}`);
await page.mouse.move(scroll.x,scroll.y);
await page.mouse.down();
await page.mouse.move(scroll.x,scroll.y-scroll.distance,{steps:4});
await page.mouse.up();
const moved = await viewport.evaluate(element=>element.scrollTop)-scroll.top;
assert.ok(Math.abs(moved*scroll.scale-scroll.distance)<=2,`map drag follows the pointer: ${JSON.stringify({...scroll,moved})}`);
}
async function checkSurface(page, surface, settings, origin, prefix) {
const [name,selector,buttonName,result] = surface;
await mountSurface(page,origin,prefix,settings,name);
const launcher = {'牌堆':'.mengsan-battle-piles-button-shuying','遗物':'.mengsan-battle-relics-button-shuying',
'药水详情':'button.mengsan-potion-slot','战斗状态':'.mengsan-hud-status-shuying'}[name];
if (launcher) await page.locator(launcher).first().tap({timeout:1800});
const root = page.locator(selector);
await root.waitFor({state:'visible',timeout:1800});
if (settings.switchTo) {
await page.evaluate(zoom => window.zoomReviewSetScale(zoom), settings.switchTo);
}
const box = await root.boundingBox();
const viewport = page.viewportSize();
assert.ok(box.x>=-2 && box.y>=-2 && box.x+box.width<=viewport.width+2 && box.y+box.height<=viewport.height+2,
`surface within viewport: ${JSON.stringify({box,viewport})}`);
if (name==='地图') {
await checkMapDrag(page);
await root.getByRole('button',{name:'菜单',exact:true}).tap({timeout:1800});
const drawer = root.locator('.mengsan-map-menu-sheet-shuying');
await drawer.getByRole('button',{name:/行囊/}).tap({timeout:1800});
await drawer.getByRole('button',{name:'返回菜单',exact:true}).tap({timeout:1800});
await drawer.getByRole('button',{name:'关闭菜单',exact:true}).tap({timeout:1800});
}
if (process.env.HUD_ARTIFACTS && settings.zoom===1.5 && !settings.transform && !settings.viewport) {
await page.screenshot({path:path.join(process.env.HUD_ARTIFACTS,`zoom-${name}.png`)});
}
if (name==='剧情分支') await root.getByRole('button',{name:'结伴前行',exact:true}).tap({timeout:1800});
const action = root.getByRole('button',{name:buttonName}).first();
if(name==='牌库') {
const card = root.locator('.ms-deck-card').first();
await card.tap({timeout:1800});
assert.ok(await root.locator('.ms-deck-detail').isVisible(),'a card opens its details');
}
await action.tap({timeout:1800});
assert.equal(await root.count(),0,'the original action closes the surface');
if (result!==null) assert.equal(await page.evaluate(()=>zoomReviewResult),result,'the original action returns the choice');
}
exports.testJourneyZoom = async function testJourneyZoom(browser,origin,prefix) {
const failures = [];
let checks = 0;
const scenarios = [{zoom:.5},{zoom:.65},{zoom:1},{zoom:1.5},{zoom:2},{zoom:3},{zoom:1.5,transform:true},
{zoom:1.5,viewport:{width:420,height:360}}, {zoom:.65,transform:true,viewport:{width:390,height:720}},
{zoom:1,transform:true,viewport:{width:1280,height:720}}, {zoom:3,transform:true},
{zoom:.65,switchTo:2}, {zoom:.65,switchTo:2,transform:true}];
for (const settings of scenarios) {
const page = await browser.newPage({viewport:settings.viewport??{width:812,height:375},hasTouch:true});
for (const surface of surfaces) {
try { await checkSurface(page,surface,settings,origin,prefix); checks++; }
catch (error) { failures.push(`${surface[0]} ${JSON.stringify(settings)} ${error.message}`); }
}
await page.close();
}
if (failures.length) throw new Error(`${checks} passed\n${failures.join('\n')}`);
console.log(`Journey UI zoom: ${checks} passed`);
};
+24
View File
@@ -0,0 +1,24 @@
import { cardUpgradeLevel } from "../cards/upgrades.js";
export function mountCardChoiceNames(session, resources, { ui, lib, document }) {
const createButton = ui.create.button;
resources.field(ui.create, "button", function (...args) {
const button = createButton.apply(this, args);
if (!session.active || !button?.matches(".button.card:not(.blank, .infohidden, .infoflip)")) return button;
const name = button.name;
const definition = lib.card[name];
const title = lib.translate[name];
if (definition?.fullimage !== true ||
definition.image !== `ext:术樱包/mengsan/assets/cards/${name}.png` ||
typeof title !== "string" || !title) return button;
// 实体牌按钮的强化数据在原牌上,虚拟牌按钮没有实体牌实例。
const level = Array.isArray(button.link) ? 0 : cardUpgradeLevel(button.link);
const label = document.createElement("span");
label.className = "mengsan-choice-card-name-shuying";
label.textContent = level ? `${title}+${level}` : title;
button.appendChild(label);
return button;
});
}
+27 -8
View File
@@ -9,7 +9,7 @@ import { cardAffixes } from "../cards/intrinsic-affixes.js";
import { cardUpgradeLevel, cardUpgradeRule } from "../cards/upgrades.js";
import { getCardRarity, applyCardRarity } from "../cards/rarity.js";
import { cleanCardDescription } from "../cards/description.js";
import { cardDescriptionText, cleanCardDescription } from "../cards/description.js";
import { createVirtualCardGrid } from "./virtual-card-grid.js";
const suits = { spade: "♠ 黑桃", heart: "♥ 红桃", club: "♣ 梅花", diamond: "♦ 方块" };
@@ -31,9 +31,7 @@ export function describeLibraryCard(card) {
number: ({ 1: "A", 11: "J", 12: "Q", 13: "K" })[card.number] || String(card.number ?? "—"),
nature: nature || "无属性", type: cardTypes[cardDefinitions[card.name]?.cardType || info?.cardType] || types[info?.type] || "未知类别",
red: card.suit === "heart" || card.suit === "diamond",
description: cleanCardDescription(text((cardUpgradeRule(card.name)||info?.mengsanShared_shuying) && info?.cardPrompt
? info.cardPrompt(card)
: lib.translate[`${card.name}_info`] || "暂无卡牌介绍。")),
description: cleanCardDescription(text(cardDescriptionText(card, info, lib.translate[`${card.name}_info`]))),
affixes: cardAffixes(card).filter(key => key !== "annihilate").map(key => affixes[key] || `词缀:${translate(key)}`),
rarity: getCardRarity(card),
upgrade: cardUpgradeLevel(card),
@@ -116,6 +114,7 @@ export function openCardLibrary(run, options = {}) {
const existing = document.querySelector("dialog.mengsan-deck-dialog-shuying[open]");
if (existing) { existing.focus(); return () => {}; }
const previousFocus = document.activeElement;
const selection = options.selection;
const dialog = element("dialog", "mengsan-deck-dialog-shuying", null);
dialog.setAttribute("aria-label", options.title || "卡牌库");
const header = element("header", "ms-deck-header", null, dialog);
@@ -143,12 +142,13 @@ export function openCardLibrary(run, options = {}) {
onClose?.(close);
};
button("关闭", header, close);
let view = !options.sections && options.view === "catalog" ? "catalog" : "deck";
let view = selection || (!options.sections && options.view === "catalog")
? "catalog" : "deck";
const navigation = element("nav", "ms-deck-tabs", null, dialog);
navigation.setAttribute("aria-label", "卡牌列表视图");
const deckTab = button("持有牌", navigation, () => { view = "deck"; render(); });
const catalogTab = button("图鉴", navigation, () => { view = "catalog"; render(); });
deckTab.hidden = catalogTab.hidden = Boolean(options.sections);
deckTab.hidden = catalogTab.hidden = Boolean(options.sections || selection);
let sectionIndex = 0;
const sectionTabs = options.sections ? options.sections().map((section, index) =>
button(section.title, navigation, () => { sectionIndex = index; render(); })) : [];
@@ -222,6 +222,24 @@ export function openCardLibrary(run, options = {}) {
element("p", "ms-deck-rules", details.description, copy);
if (!details.available) element("p", "ms-deck-warning", "该卡牌定义未加载;保留存档记录,不删除此牌。", copy);
for (const affix of details.affixes) element("p", "ms-deck-rules", affix, copy);
if (catalog && selection) {
const reason = !details.available ? "该卡牌定义未加载。" :
selection.unavailableReason?.(card) || "";
const feedback = element("p", "ms-deck-rules", reason, copy);
feedback.setAttribute("role", "status");
const confirm = button(selection.label, copy, () => {
if (closed || confirm.disabled) return;
confirm.disabled = true;
try {
selection.onSelect(card);
close();
} catch (error) {
feedback.textContent = error.message || "添加失败,请重试。";
confirm.disabled = false;
}
});
confirm.disabled = Boolean(reason);
}
body.scrollTop = 0; backButton.focus();
}
function fitCards() {
@@ -296,7 +314,8 @@ export function openCardLibrary(run, options = {}) {
summary.textContent = options.sections ? "剩余牌堆按从左到右、从上到下的顺序摸取;第 1 张为下一张。" :
`本次征程实际携带 · 共 ${current.length} 张 · 同名不同花色、点数分别展示`;
}
footer.textContent = catalog ? "图鉴仅供查阅,不会获得卡牌或改变征程牌组 · 点击卡牌查看完整介绍" :
if (catalog && selection) footer.textContent = selection.description;
else footer.textContent = catalog ? "图鉴仅供查阅,不会获得卡牌或改变征程牌组 · 点击卡牌查看完整介绍" :
"点击卡牌查看完整介绍 · 仅供查看,不改变牌组或抽牌顺序";
virtualGrid.setRecords(catalog || options.sections ? records : current.map(card => ({ card })));
if (!(catalog || options.sections ? records : current).length) {
@@ -309,7 +328,7 @@ export function openCardLibrary(run, options = {}) {
// Prevent the map's Escape/Tab handler from acting behind this modal.
dialog.addEventListener("keydown", event => event.stopPropagation());
render();
document.body.appendChild(dialog);
document.documentElement.appendChild(dialog);
try { dialog.showModal(); } catch (error) { close(); throw error; }
fitCards();
if (typeof ResizeObserver !== "undefined") {
+199
View File
@@ -0,0 +1,199 @@
.mengsan-flow-overlay-shuying.mengsan-character-overlay-shuying {
background: radial-gradient(ellipse at 48% 12%, #35403c, #111819 76%);
}
.mengsan-character-panel-shuying {
--character-paper: #f5ead6;
--character-gold: #e6c493;
--character-line: #706047;
--character-panel-padding: clamp(12px, 3vw, 30px);
--character-panel-gap: clamp(12px, 2vw, 20px);
--character-title-size: clamp(22px, 3.6vw, 38px);
/* Overlay padding, heading, and footer consume this space before the portraits. */
--character-controls-height: calc(192px + 2 * var(--character-panel-padding)
+ 2 * var(--character-panel-gap) + 1.15 * var(--character-title-size));
gap: var(--character-panel-gap);
width: min(1000px, 100%) !important;
max-height: 100% !important;
padding: var(--character-panel-padding);
border: 1px solid var(--character-line);
border-radius: 8px;
background: radial-gradient(ellipse at 50% 0, #30362c, transparent 72%), #151d1d;
color: var(--character-paper);
scrollbar-width: thin;
}
.ms-character-header,
.ms-character-footer {
display: flex;
flex: none;
align-items: center;
justify-content: space-between;
gap: 10px;
}
.ms-character-header {
padding-bottom: 12px;
border-bottom: 1px solid var(--character-line);
}
.ms-character-heading { position: relative; min-width: 0; }
.ms-character-eyebrow,
.ms-character-title,
.ms-character-status { margin: 0; }
.ms-character-eyebrow {
margin-bottom: 3px;
color: var(--character-gold);
font-size: 12px;
letter-spacing: .16em;
}
.ms-character-title {
font: 700 var(--character-title-size)/1.15 "KaiTi", "STKaiti", "SimSun", serif;
letter-spacing: .08em;
}
.ms-character-status { color: #d4c9b6; font-size: 13px; }
.ms-character-button {
flex: none;
min-height: 44px;
padding: 6px clamp(8px, 1.6vw, 16px);
border: 1px solid var(--character-line);
border-radius: 4px;
background: #1b2120;
color: inherit;
font: inherit;
font-size: 13px;
cursor: pointer;
touch-action: manipulation;
}
.ms-character-button:hover { background: #322f25; }
.ms-character-confirm {
min-width: 7.5em;
border-color: var(--character-gold);
background: var(--character-gold);
color: #251b12;
font-weight: 700;
}
.ms-character-confirm:hover:not(:disabled) { background: #f8d9a7; }
.ms-character-confirm:disabled {
border-color: var(--character-line);
background: #252c2b;
color: #c5bfad;
cursor: default;
}
.ms-character-list {
display: grid;
flex: none;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: clamp(7px, 1.8vw, 17px);
}
.ms-character-card {
--character-accent: #c9b894;
--character-deep: #554629;
position: relative;
isolation: isolate;
overflow: hidden;
min-width: 0;
min-height: clamp(132px, min(46vw, calc(100vh - var(--character-controls-height))), 404px);
padding: 0;
border: 1px solid var(--character-line);
border-color: color-mix(in srgb, var(--character-accent) 45%, #3e3e36);
border-radius: 5px;
background: #171c1d;
color: #fff3dd;
font: inherit;
text-align: left;
cursor: pointer;
touch-action: manipulation;
}
.ms-character-card[data-faction="han"] { --character-accent: #df8979; --character-deep: #883b36; }
.ms-character-card[data-faction="wei"] { --character-accent: #99c3ed; --character-deep: #34577f; }
.ms-character-card[data-faction="wu"] { --character-accent: #9acb91; --character-deep: #3a694a; }
.ms-character-card::after {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(0deg, #121715, #151817db 14%, #16181730 54%, transparent 78%);
pointer-events: none;
}
.ms-character-card:hover,
.ms-character-card[aria-pressed="true"] { border-color: var(--character-accent); }
.ms-character-card[aria-pressed="true"] {
box-shadow: 0 0 0 1px var(--character-accent), 0 0 24px color-mix(in srgb, var(--character-accent) 18%, transparent);
}
.ms-character-panel-shuying button:focus-visible {
outline: 2px solid var(--character-gold);
outline-offset: 3px;
}
.ms-character-portrait {
position: absolute;
inset: 0;
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center 17%;
pointer-events: none;
}
.ms-character-faction,
.ms-character-picked,
.ms-character-caption {
position: absolute;
z-index: 1;
}
.ms-character-faction {
top: 10px;
left: 10px;
display: grid;
place-items: center;
min-width: 30px;
height: 30px;
border: 1px solid var(--character-accent);
border-radius: 2px;
background: var(--character-deep);
font: 700 18px/1 "KaiTi", "STKaiti", "SimSun", serif;
}
.ms-character-picked {
top: 10px;
right: 10px;
padding: 2px 5px;
border-radius: 2px;
background: #121715;
font-size: 11px;
}
.ms-character-picked[hidden] { display: none; }
.ms-character-caption {
right: 10px;
bottom: 10px;
left: 10px;
}
.ms-character-name {
display: block;
font: 700 clamp(19px, 3.8vw, 36px)/1.14 "KaiTi", "STKaiti", "SimSun", serif;
}
.ms-character-description {
display: block;
min-height: 2.6em;
margin-top: 5px;
color: #f0e7d8;
font-size: clamp(11px, 1.5vw, 13px);
line-height: 1.3;
}
@media (max-width: 520px) {
.mengsan-character-overlay-shuying { padding-inline: 10px; }
.ms-character-faction { top: 6px; left: 6px; min-width: 25px; height: 25px; }
.ms-character-picked { top: 7px; right: 5px; }
.ms-character-caption { right: 5px; bottom: 7px; left: 6px; }
.ms-character-button { font-size: 12px; }
}
@media (max-height: 440px) {
.mengsan-flow-overlay-shuying.mengsan-character-overlay-shuying { padding-block: 62px 10px; }
.mengsan-character-panel-shuying { gap: 8px; padding: 10px; }
.ms-character-header { padding-bottom: 4px; }
.ms-character-title { font-size: 22px; }
.ms-character-card { min-height: clamp(114px, calc(100vh - 210px), 190px); }
}
+105
View File
@@ -0,0 +1,105 @@
import { chooseFlow } from "./flow-ui.js";
import { mountMenu } from "./navigation.js";
const featuredCharacters = [
{ id: "mengsan_liubei_shuying", name: "刘备", faction: "han", factionName: "汉", file: "liubei-portrait.jpg" },
{ id: "mengsan_caocao_shuying", name: "曹操", faction: "wei", factionName: "魏", file: "caocao-portrait.jpg" },
{ id: "mengsan_sunquan_shuying", name: "孙权", faction: "wu", factionName: "吴", file: "sunquan-portrait.jpg" },
];
function element(tag, className, text = "") {
const node = document.createElement(tag);
node.className = className;
if (text) node.textContent = text;
return node;
}
export function chooseCharacterCards(playable, assetBase, backLabel) {
const available = new Map(playable.map(character => [character.id, character]));
const featuredIds = new Set(featuredCharacters.map(character => character.id));
const roster = featuredCharacters.map(character => {
const registered = available.get(character.id);
return {
...character,
name: registered?.name || character.name,
portrait: registered?.portrait || `${assetBase}/assets/portraits/${character.file}`,
description: registered?.description,
};
});
roster.push(...playable.filter(character => !featuredIds.has(character.id)));
const title = "选择出征武将";
return chooseFlow(title, (overlay, finish) => {
overlay.classList.add("mengsan-character-overlay-shuying");
const panel = element("section", "mengsan-panel-shuying mengsan-character-panel-shuying");
const header = element("header", "ms-character-header");
const heading = element("div", "ms-character-heading");
heading.append(
element("p", "ms-character-eyebrow", "梦三 · 出征准备"),
element("h1", "ms-character-title", title),
);
const back = element("button", "ms-character-button", backLabel);
back.type = "button";
back.addEventListener("click", () => finish("back"));
header.append(heading, back);
const list = element("section", "ms-character-list");
list.setAttribute("aria-label", "武将");
const footer = element("footer", "ms-character-footer");
const status = element("p", "ms-character-status");
status.setAttribute("role", "status");
const confirm = element("button", "ms-character-button ms-character-confirm", "确认出征");
confirm.type = "button";
footer.append(status, confirm);
panel.append(header, list, footer);
overlay.appendChild(panel);
let selected = roster.find(character => available.has(character.id)) || roster[0];
const cards = roster.map(character => {
const button = element("button", "ms-character-card");
button.type = "button";
button.dataset.faction = character.faction;
if (character.portrait) {
const portrait = element("img", "ms-character-portrait");
portrait.alt = "";
portrait.draggable = false;
portrait.src = character.portrait;
button.appendChild(portrait);
}
const seal = element("span", "ms-character-faction", character.factionName);
const mark = element("span", "ms-character-picked", "已选");
mark.setAttribute("aria-hidden", "true");
const caption = element("span", "ms-character-caption");
caption.append(
element("strong", "ms-character-name", character.name),
element("span", "ms-character-description", available.has(character.id) ? character.description : "玩法待定"),
);
button.append(seal, mark, caption);
button.addEventListener("click", () => {
selected = character;
updateSelection();
});
list.appendChild(button);
return { character, button, mark };
});
function updateSelection() {
for (const { character, button, mark } of cards) {
const isSelected = character === selected;
button.setAttribute("aria-pressed", String(isSelected));
mark.hidden = !isSelected;
}
const canDepart = available.has(selected.id);
confirm.disabled = !canDepart;
confirm.textContent = canDepart ? "确认出征" : "玩法待定";
status.textContent = `${canDepart ? "已选" : "正在查看"}${selected.name} · ${selected.factionName}`;
}
confirm.addEventListener("click", () => {
if (available.has(selected.id)) finish(selected.id);
});
updateSelection();
mountMenu(overlay);
return cards.find(({ character }) => character === selected).button;
}, { back: "back" });
}
+6 -5
View File
@@ -29,21 +29,22 @@ export const playDialogue = (lines, options = {}) => new Promise(resolve => {
const overlay = ui.create.div(".mengsan-dialogue-overlay-shuying", ui.window);
const stage = ui.create.div(".mengsan-dialogue-stage-shuying", overlay);
ui.create.div(".mengsan-dialogue-chapter-shuying", options.title || "剧情", stage);
const textBox = ui.create.div(".mengsan-dialogue-box-shuying", stage);
ui.create.div(".mengsan-dialogue-chapter-shuying", options.title || "剧情", overlay);
const content = ui.create.div(".mengsan-dialogue-content-shuying", stage);
const choices = ui.create.div(".mengsan-dialogue-choices-shuying", content);
const textBox = ui.create.div(".mengsan-dialogue-box-shuying", content);
const portraitFrame = ui.create.div(
".mengsan-dialogue-portrait-frame-shuying", textBox);
const speaker = ui.create.div(".mengsan-dialogue-speaker-shuying", textBox);
const text = ui.create.div(".mengsan-dialogue-text-shuying", textBox);
const progress = ui.create.div(".mengsan-dialogue-progress-shuying", textBox);
const indicator = ui.create.div(".mengsan-dialogue-indicator-shuying", "◆", textBox);
const choices = ui.create.div(".mengsan-dialogue-choices-shuying", stage);
const skipButton = document.createElement("button");
skipButton.type = "button";
skipButton.className = "mengsan-dialogue-skip-shuying";
skipButton.textContent = "跳过对话";
skipButton.setAttribute("aria-label", "跳过对话,未选择的发言使用默认选项");
stage.appendChild(skipButton);
overlay.appendChild(skipButton);
let lineIndex = -1;
let timer = null;
@@ -189,5 +190,5 @@ export const playDialogue = (lines, options = {}) => new Promise(resolve => {
const help = ui.create.div(".mengsan-dialogue-help-shuying", stage);
help.textContent = "点击补全文字 · 再次点击继续 · Enter / 空格";
showNextLine();
textBox.focus();
if (!awaitingChoice || typing) textBox.focus({ preventScroll: true });
});
+25 -20
View File
@@ -2,12 +2,34 @@ import { ui } from "../../../../noname.js";
import { mountMenu } from "./navigation.js";
import { createRelicIcon } from "./relic-icon.js";
export const chooseButtons = (title, choices, description = "", options = {}) => new Promise(resolve => {
export const chooseFlow = (title, render, { back } = {}) => new Promise(resolve => {
const previousFocus = document.activeElement;
const overlay = ui.create.div(".mengsan-overlay-shuying.mengsan-flow-overlay-shuying", ui.window);
overlay.setAttribute("role", "dialog");
overlay.setAttribute("aria-modal", "true");
overlay.setAttribute("aria-label", title);
const finish = id => {
if (overlay.dataset.resolved) return;
overlay.dataset.resolved = "true";
overlay.remove();
if (previousFocus?.isConnected) previousFocus.focus({ preventScroll: true });
resolve(id);
};
const initialFocus = render(overlay, finish);
overlay.addEventListener("keydown", event => {
if (event.key === "Escape" && back) {
event.preventDefault(); finish(back); return;
}
if (event.key !== "Tab") return;
const focusable = [...overlay.querySelectorAll("button:not(:disabled)")];
const first = focusable[0], last = focusable[focusable.length - 1];
if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last.focus(); }
else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first.focus(); }
});
initialFocus?.focus({ preventScroll: true });
});
export const chooseButtons = (title, choices, description = "", options = {}) => chooseFlow(title, (overlay, finish) => {
const panel = ui.create.div(".mengsan-panel-shuying.mengsan-flow-panel-shuying", overlay);
const eyebrow = document.createElement("p");
eyebrow.className = "mengsan-flow-eyebrow-shuying";
@@ -22,13 +44,6 @@ export const chooseButtons = (title, choices, description = "", options = {}) =>
summary.textContent = description;
}
const buttons = ui.create.div(".mengsan-choice-list-shuying", panel);
const finish = id => {
if (overlay.dataset.resolved) return;
overlay.dataset.resolved = "true";
overlay.remove();
if (previousFocus?.isConnected) previousFocus.focus();
resolve(id);
};
choices.forEach(choice => {
const button = document.createElement("button");
button.type = "button";
@@ -51,15 +66,5 @@ export const chooseButtons = (title, choices, description = "", options = {}) =>
buttons.appendChild(button);
});
if (options.menu !== false) mountMenu(overlay);
overlay.addEventListener("keydown", event => {
if (event.key === "Escape" && options.back) {
event.preventDefault(); finish(options.back); return;
}
if (event.key !== "Tab") return;
const focusable = [...overlay.querySelectorAll("button:not(:disabled)")];
const first = focusable[0], last = focusable[focusable.length - 1];
if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last.focus(); }
else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first.focus(); }
});
buttons.querySelector("button:not(:disabled)")?.focus();
});
return buttons.querySelector("button:not(:disabled)");
}, options);
+113 -5
View File
@@ -1,6 +1,21 @@
import { AFFIX_INFO } from "../cards/affixes.js";
import { hasCardAffix } from "../cards/intrinsic-affixes.js";
import { describeLibraryCard } from "./card-library.js";
import { describeLibraryCard, openCardLibrary } from "./card-library.js";
import { cardDefinitions } from "../cards/card-definitions.js";
import { createCardData } from "../cards/card-data.js";
import { DAZED_NAME, createDazedData } from "../cards/status-cards.js";
import { SLIMED_NAME, createSlimedData } from "../cards/slimed-card.js";
import { WOUND_NAME, createWoundData } from "../cards/wound-card.js";
import { INFECTION_NAME, createInfectionData } from "../cards/infection-card.js";
import { getDiagnostics } from "../../diagnostics/index.js";
import { _status } from "../../../../noname.js";
const statusFactories = {
[DAZED_NAME]: createDazedData,
[SLIMED_NAME]: createSlimedData,
[WOUND_NAME]: createWoundData,
[INFECTION_NAME]: createInfectionData,
};
const node = (tag, className, label, parent) => {
const element = document.createElement(tag);
@@ -20,6 +35,10 @@ const button = (label, parent, action) => {
// Keep the command battle-scoped; further GM actions can be added as panels here.
export function mountGMManager(session, owner, piles, battle, resources, game) {
let dialog = null, selected = null, previousFocus = null, disposed = false;
let closePicker = null, sequence = 0, message = "";
const diagnostics = getDiagnostics().scope("mengsan.gm", () => ({
sessionId: session.id,
}));
const available = () => !disposed && session.active && !battle.resolving;
const close = () => {
if (!dialog) return;
@@ -32,6 +51,7 @@ export function mountGMManager(session, owner, piles, battle, resources, game) {
};
const render = () => {
if (!dialog) return;
dialog.querySelector(".ms-gm-feedback").textContent = message;
const list = dialog.querySelector(".ms-gm-hand");
const editor = dialog.querySelector(".ms-gm-editor");
list.replaceChildren(); editor.replaceChildren();
@@ -60,9 +80,89 @@ export function mountGMManager(session, owner, piles, battle, resources, game) {
item.title = info.description;
}
};
const chooseTemporaryCard = () => {
if (!available() || closePicker) return;
close();
closePicker = openCardLibrary(null, {
title: "添加临时牌", eyebrow: "梦三 · GM",
view: "catalog",
selection: {
label: "加入手牌 · 仅本场战斗",
description: "选择卡牌查看详情并加入手牌;正常弃置和洗牌," +
"战斗结束清理。默认黑桃 A、未强化。",
unavailableReason: card =>
Object.hasOwn(cardDefinitions, card.name) ||
Object.hasOwn(statusFactories, card.name) ? "" :
"该卡牌尚无可用的战斗创建规则。",
onSelect(card) {
if (!available() || !owner.isAlive()) {
throw new Error("当前战斗已结束或角色已阵亡,无法添加。");
}
if (!describeLibraryCard(card).available) {
throw new Error("该卡牌定义未加载。");
}
const id = `mengsan_gm_${session.id}_${++sequence}`;
const factory = Object.hasOwn(statusFactories, card.name)
? statusFactories[card.name] : null;
const data = factory ? factory(id) : createCardData({
id, name: card.name, suit: "spade", number: 1,
nature: null, affixes: [], upgrade: 0,
}, { enemy: true });
// GM injection must not await the paused native event queue.
const created = piles.addToDiscard(data);
if (!created) throw new Error("当前战斗无法创建临时牌。");
try {
owner.directgain([created]);
if (!owner.getCards("h").includes(created)) {
throw new Error("临时牌未能加入手牌。");
}
} catch (error) {
created.remove();
diagnostics.error("temporaryCard.failed", error, {
cardName: data.name, cardId: id,
});
game.log("GM 临时牌添加失败", data.name, id,
error.message);
throw error;
}
selected = created;
message = `已将【${describeLibraryCard(data).name}】加入手牌,` +
"仅本场战斗有效。";
game.log("GM 添加临时牌", owner, data.name, id,
session.id);
diagnostics.info("temporaryCard.added", {
cardName: data.name, cardId: id,
});
try {
// check() reuses the choices from before directgain.
// Invalidate them without clearing the user's selection.
const event = _status.event;
if (event?.player === owner) {
delete event._cardChoice;
delete event._targetChoice;
delete event._skillChoice;
}
game.check();
}
catch (error) {
game.log("GM 临时牌已入手,选择状态刷新失败",
error.message);
}
},
},
onClose() {
closePicker = null;
if (available()) open();
},
});
};
const open = () => {
if (!available()) return false;
if (closePicker) return true;
if (dialog?.open) { render(); dialog.focus(); return true; }
const existing = document.querySelector(
"dialog.mengsan-deck-dialog-shuying[open]");
if (existing) { existing.focus(); return false; }
previousFocus = document.activeElement;
dialog = node("dialog", "mengsan-deck-dialog-shuying mengsan-gm-dialog-shuying", null);
dialog.setAttribute("aria-label", "梦三 GM 管理器");
@@ -70,14 +170,18 @@ export function mountGMManager(session, owner, piles, battle, resources, game) {
const header = node("header", "ms-deck-header", null, dialog);
node("h2", "ms-deck-title", "GM 管理器", header);
button("关闭", header, close);
node("p", "ms-deck-summary", "手牌词缀 · 仅本场战斗生效,不改永久牌组或存档。", dialog);
node("p", "ms-deck-summary",
"手牌词缀 / 添加临时牌 · 仅本场战斗生效,不改永久牌组或存档。", dialog);
button("添加临时牌", dialog, chooseTemporaryCard);
button("刷新手牌", dialog, render);
const feedback = node("p", "ms-gm-feedback", "", dialog);
feedback.setAttribute("role", "status");
node("div", "ms-gm-hand", null, dialog);
node("section", "ms-gm-editor", null, dialog);
const created = dialog;
dialog.addEventListener("close", () => { if (dialog === created) close(); });
dialog.addEventListener("keydown", event => event.stopPropagation());
document.body.appendChild(dialog);
document.documentElement.appendChild(dialog);
try { dialog.showModal(); } catch (error) { close(); throw error; }
render();
dialog.querySelector(".ms-deck-header button").focus();
@@ -85,7 +189,11 @@ export function mountGMManager(session, owner, piles, battle, resources, game) {
};
resources.field(globalThis, "mengsanGM_shuying", open);
resources.field(game, "mengsanGM_shuying", open);
const handle = { dispose: close };
session.ownResource(handle, () => { disposed = true; close(); });
const handle = { dispose() {
disposed = true;
closePicker?.(); closePicker = null;
close();
} };
session.ownResource(handle, handle.dispose);
return handle;
}
+46 -19
View File
@@ -69,7 +69,8 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
event.name !== "chooseToUse" || event.player !== player || !event.isMine?.() ||
event.skill || event.complexSelect || event.custom?.replace?.card || event.custom?.replace?.target || event.custom?.replace?.confirm ||
!env.isActiveCardUse(event, player) || !env.canPayCard?.(player, card) ||
ui.selected.cards.length || ui.selected.targets.length || ui.selected.buttons.length ||
(ui.selected.cards.length && (ui.selected.cards.length !== 1 || ui.selected.cards[0] !== card)) ||
ui.selected.targets.length || ui.selected.buttons.length ||
!card.classList.contains("selectable") || card.classList.contains("noclick") ||
status.mousedragging || status.dragged || status.paused2) return false;
const cards = get.select(event.selectCard);
@@ -77,27 +78,31 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
}
function removeAim() { aim?.remove(); aim = null; }
function showAim(card, point) {
const rect = card.getBoundingClientRect();
const x = rect.left + rect.width / 2, y = rect.top;
if (!(rect.width > 0 && rect.height > 0 && Number.isFinite(point.x) && Number.isFinite(point.y))) {
removeAim();
return;
}
if (!aim) {
aim = document.createElementNS("http://www.w3.org/2000/svg", "svg");
const svg = "http://www.w3.org/2000/svg";
aim = document.createElementNS(svg, "svg");
aim.classList.add("mengsan-hand-aim-shuying");
aim.setAttribute("aria-hidden", "true");
const path = document.createElementNS(aim.namespaceURI, "path");
aim.appendChild(path); document.body.appendChild(aim);
aim.setAttribute("preserveAspectRatio", "none");
aim.appendChild(document.createElementNS(svg, "line"));
document.documentElement.appendChild(aim);
}
const rect = card.getBoundingClientRect();
const x = rect.left + rect.width / 2, y = rect.top + 12;
aim.setAttribute("viewBox", `0 0 ${window.innerWidth} ${window.innerHeight}`);
// clientX/Y 与卡牌矩形都是视口坐标,SVG 本身却可能受到 body zoom/transform 影响。
// 用 SVG 实际屏幕矩阵反变换,不能重复除 documentZoom 或假定 SVG 没有偏移。
const matrix = aim.getScreenCTM();
if (!matrix) { removeAim(); return; }
const inverse = matrix.inverse();
const start = new window.DOMPoint(x, y).matrixTransform(inverse);
const end = new window.DOMPoint(point.x, point.y).matrixTransform(inverse);
if (![start.x, start.y, end.x, end.y].every(Number.isFinite)) { removeAim(); return; }
// 十周年金色细线(本地 CONFIG.LINE_COLOR/LINE_WIDTH),不采用尖塔箭头/骨节造型。
aim.firstElementChild.setAttribute("d", `M ${start.x} ${start.y} L ${end.x} ${end.y}`);
aim.firstElementChild.setAttribute("vector-effect", "non-scaling-stroke");
// Use the painted overlay bounds so card, touch and line share viewport CSS pixels.
const overlay = aim.getBoundingClientRect();
if (!(overlay.width > 0 && overlay.height > 0)) { removeAim(); return; }
const viewBox = `0 0 ${overlay.width} ${overlay.height}`;
if (aim.getAttribute("viewBox") !== viewBox) aim.setAttribute("viewBox", viewBox);
const line = aim.firstElementChild;
line.setAttribute("x1", x - overlay.left);
line.setAttribute("y1", y - overlay.top);
line.setAttribute("x2", point.x - overlay.left);
line.setAttribute("y2", point.y - overlay.top);
}
function clearSelection(state) {
if (!live(state) || !state.selected) return;
@@ -157,7 +162,7 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
if (!state.moved && Math.hypot(point.x - state.x, point.y - state.y) < 9) return;
if (!state.moved) {
state.moved = true;
engineCall(() => ui.click.card.call(state.card));
if (!ui.selected.cards.includes(state.card)) engineCall(() => ui.click.card.call(state.card));
state.selected = ui.selected.cards.includes(state.card);
const targets = range(state.event);
if (!state.selected || !live(state) || !targets) { cleanup(true); return; }
@@ -229,6 +234,28 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
for (const type of ["mousedown", "mousemove", "mouseup", "click", "touchstart", "touchmove", "touchend"]) {
listen(window, type, compatibility, { capture: true, passive: false });
}
} else if (adapter.root && status && get) {
// Older Android WebViews expose TouchEvent but no PointerEvent.
// Route them through the same selection and drawing code.
const touchEvent = (event, touch, type) => ({
button: 0, isPrimary: true, pointerId: touch.identifier,
target: event.target, clientX: touch.clientX, clientY: touch.clientY,
type, preventDefault: () => event.preventDefault(),
stopImmediatePropagation: () => event.stopImmediatePropagation(),
});
const options = { capture: true, passive: false };
listen(window, "touchstart", event => {
if (event.touches.length !== 1) { cancel(); return; }
start(touchEvent(event, event.touches[0], "pointerdown"));
}, options);
for (const [type, handler] of [["touchmove", move], ["touchend", end], ["touchcancel", end]]) {
listen(window, type, event => {
const touch = Array.from(event.changedTouches).find(item => item.identifier === gesture?.id);
if (touch) handler(touchEvent(event, touch, type === "touchcancel" ? "pointercancel" : type));
}, options);
}
listen(window, "click", compatibility, options);
listen(window, "blur", cancel);
}
listen(adapter.root, "pointerover", hover);
listen(adapter.root, "pointerleave", () => { if (!gesture) fan.setHover(null); });
+5 -6
View File
@@ -79,17 +79,16 @@
.mengsan-hand-aim-shuying {
position: fixed;
inset: 0;
width: 100vw;
height: 100vh;
width: 100%;
height: 100%;
z-index: 1000;
pointer-events: none;
overflow: visible;
}
.mengsan-hand-aim-shuying > path {
fill: none;
.mengsan-hand-aim-shuying > line {
stroke: rgb(250, 220, 140);
stroke-width: 2.6;
stroke-width: 2.6px;
stroke-linecap: round;
vector-effect: non-scaling-stroke;
filter: drop-shadow(0 0 2px #f5d25b);
}
/* 只在梦三手牌挂载期间隐藏十周年阶段、等待响应和对方思考图片。 */
+227 -40
View File
@@ -1,5 +1,6 @@
import { collectCombatStatuses } from './status-model.js';
import { createOverlayLayout } from './overlays.js';
import { potionSkillIds } from '../../potions/battle.js';
// Native cards, players and controls stay under their original parents.
export function mountBattleHUD(player, battle, env) {
@@ -8,11 +9,24 @@ export function mountBattleHUD(player, battle, env) {
if (!arena || !ui.me || !ui.control || !battle.session.active) throw new Error('梦三 HUD 缺少原生界面容器');
const handRoot = ui.me, controlRoot = ui.control;
const overlays = createOverlayLayout(arena, handRoot, ui, player);
const restores = [], styled = new WeakMap(), hiddenMarks = new Set();
const restores = [], nodeRestores = new Map(), styled = new WeakMap(), hiddenMarks = new Set();
let disposed = false, frozen = false, frame = null, dialog = null, previousFocus = null, resize, observer;
const retain = (node, restore) => {
let releases = nodeRestores.get(node);
if (!releases) nodeRestores.set(node, releases = []);
releases.push(restore);
};
const releaseNodes = (detachedOnly = false) => {
for (const [node, releases] of nodeRestores) {
if (detachedOnly && node.isConnected) continue;
for (const restore of releases.reverse()) restore();
nodeRestores.delete(node);
styled.delete(node);
}
};
const ownClass = (node, name) => {
if (!node || node.classList.contains(name)) return;
node.classList.add(name); restores.push(() => node.classList.remove(name));
node.classList.add(name); retain(node, () => node.classList.remove(name));
};
const style = (node, key, value) => {
let values = styled.get(node);
@@ -20,7 +34,7 @@ export function mountBattleHUD(player, battle, env) {
if (!values.has(key)) {
const old = node.style.getPropertyValue(key), priority = node.style.getPropertyPriority(key);
const record = { last: null }; values.set(key, record);
restores.push(() => {
retain(node, () => {
if (node.style.getPropertyValue(key) !== record.last) return;
if (old) node.style.setProperty(key, old, priority); else node.style.removeProperty(key);
});
@@ -55,56 +69,171 @@ export function mountBattleHUD(player, battle, env) {
const statuses = create('div', 'mengsan-hud-statuses-shuying', center);
statuses.setAttribute('aria-label', '玩家当前状态');
const link = create('link', '', null); link.rel = 'stylesheet'; link.href = `${assetBase}/ui/hud/style.css`;
let detailTarget = null, detailId = null, detailBody = null;
let detailSignature = null;
const closeDialog = () => {
if (!dialog) return;
const current = dialog; dialog = null;
detailTarget = null; detailId = null; detailBody = null;
detailSignature = null;
if (current.open) current.close(); current.remove();
if (previousFocus?.isConnected) previousFocus.focus();
};
const openDetails = target => {
if (disposed || !battle.session.active) return;
closeDialog(); previousFocus = document.activeElement;
dialog = create('dialog', 'mengsan-hud-dialog-shuying', document.body);
const current = dialog;
create('h2', '', dialog, `${nameOf(target)} · 当前状态`);
const close = create('button', 'mengsan-hud-dialog-close-shuying', dialog, '关闭'); close.addEventListener('click', closeDialog);
const entries = collectCombatStatuses(target, battle);
const refreshDetails = () => {
if (!dialog || !detailBody) return;
const entries = collectCombatStatuses(detailTarget, battle);
const signature = JSON.stringify(entries);
if (signature === detailSignature) return;
const expanded = detailSignature === null ? new Set(detailId ? [detailId] : []) :
new Set([...detailBody.querySelectorAll('details[open]')].map(row => row.dataset.statusId));
detailSignature = signature; detailBody.replaceChildren();
if (detailId && !entries.some(entry => entry.id === detailId)) {
create('p', '', detailBody, '该状态已失效。');
}
for (const entry of entries) {
const row = create('section', 'mengsan-hud-detail-row-shuying', dialog);
create('strong', '', row, `${entry.name}${entry.value == null ? '' : ` ${entry.value}${entry.unit ? ` ${entry.unit}` : ''}`}`);
const row = create('details', 'mengsan-info-row-shuying',
detailBody);
row.dataset.statusId = entry.id;
row.open = expanded.has(entry.id);
const summary = create('summary', '', row);
if (entry.icon) {
const icon = create('img', 'mengsan-relic-icon-shuying', summary);
icon.src = `${assetBase}/assets/status/${entry.icon}`; icon.alt = '';
}
create('strong', '', summary, `${entry.name}${entry.value == null ? '' : ` ${entry.value}${entry.unit ? ` ${entry.unit}` : ''}`}`);
create('p', '', row, entry.detail);
}
if (!entries.length) create('p', '', dialog, '暂无已登记状态。');
if (!entries.length && !detailId) create('p', '', detailBody, '暂无已登记状态。');
};
const openDetails = (target, id = null) => {
if (disposed || frozen || !battle.session.active) return;
closeDialog(); previousFocus = document.activeElement;
dialog = create('dialog', 'mengsan-hud-dialog-shuying mengsan-deck-dialog-shuying mengsan-relic-dialog-shuying', document.documentElement);
const current = dialog;
const header = create('header', 'ms-deck-header', dialog);
create('h2', '', header, `${nameOf(target)} · 当前状态`);
const close = create('button', 'ms-deck-button', header, '关闭'); close.addEventListener('click', closeDialog);
detailTarget = target; detailId = id;
detailBody = create('div', 'mengsan-hud-detail-body-shuying mengsan-relic-list-shuying', dialog);
refreshDetails();
// Unknown/native marks retain their engine intro and are never hidden by the HUD.
dialog.addEventListener('cancel', event => { event.preventDefault(); closeDialog(); });
dialog.addEventListener('close', () => { if (dialog === current) closeDialog(); });
for (const type of ['pointerdown', 'pointerup', 'click', 'touchstart', 'touchend', 'keydown']) dialog.addEventListener(type, event => event.stopPropagation());
dialog.showModal(); close.focus();
};
let statusHold = null, statusTimer = null;
const cancelStatusHold = () => {
if (statusTimer !== null) window.clearTimeout(statusTimer);
statusHold?.button.classList.remove('is-pressed');
statusHold = null; statusTimer = null;
};
const statusButton = event => {
const button = event.target.closest?.('.mengsan-hud-status-shuying');
return button && statuses.contains(button) ? button : null;
};
const statusDown = event => {
cancelStatusHold();
const button = statusButton(event);
if (!button || event.button !== 0 || disposed || frozen) return;
statusHold = { button, id: event.pointerId,
x: event.clientX, y: event.clientY };
button.classList.add('is-pressed');
statusTimer = window.setTimeout(() => {
cancelStatusHold();
if (button.isConnected) {
openDetails(player, button.dataset.statusId || null);
}
}, 500);
};
const statusMove = event => {
if (event.pointerId !== statusHold?.id) return;
if (Math.hypot(event.clientX - statusHold.x,
event.clientY - statusHold.y) > 8) cancelStatusHold();
};
const statusUp = event => {
if (event.pointerId === statusHold?.id) cancelStatusHold();
};
const statusListeners = [
[statuses, 'pointerdown', statusDown],
[statuses, 'scroll', cancelStatusHold],
[window, 'pointermove', statusMove, true],
[window, 'pointerup', statusUp, true],
[window, 'pointercancel', statusUp, true],
[window, 'blur', cancelStatusHold],
];
for (const args of statusListeners) {
args[0].addEventListener(...args.slice(1));
}
const stopStatusInput = () => {
cancelStatusHold();
for (const args of statusListeners) {
args[0].removeEventListener(...args.slice(1));
}
};
statuses.addEventListener('click', event => {
event.preventDefault();
const button = statusButton(event);
// Every entry opens the whole list; precise long presses are optional.
if (button && !dialog) {
openDetails(player, button.dataset.statusId || null);
}
});
statuses.addEventListener('contextmenu', event => event.preventDefault());
let statusSignature = null;
function renderStatuses() {
const entries = collectCombatStatuses(player, battle);
const columns = layout === 'narrow' ? 1 : 2;
const columns = Math.max(1,
Math.floor(((center.clientWidth || 76) + 6) / 38));
const rows = Math.max(1, Math.floor((statuses.clientHeight || 80) / 38));
const maximum = Math.max(0, columns * rows - (entries.length > columns * rows ? 1 : 0));
const signature = JSON.stringify([maximum, entries]);
if (signature !== statusSignature) {
statusSignature = signature; statuses.replaceChildren();
statusSignature = signature;
center.hidden = entries.length === 0;
const existing = new Map([...statuses.children].map(button =>
[button.dataset.statusId || null, button]));
const wantedButtons = [];
for (const entry of entries.slice(0, maximum)) {
const button = create('button', 'mengsan-hud-status-shuying', statuses);
button.setAttribute('aria-label', `${entry.name} ${entry.value ?? ''} ${entry.unit},查看状态详情`);
if (entry.icon) {
const image = create('img', '', button); image.src = `${assetBase}/assets/status/${entry.icon}`; image.alt = '';
image.addEventListener('error', () => image.remove(), { once: true });
const button = existing.get(entry.id) ||
create('button', 'mengsan-hud-status-shuying', null);
button.dataset.statusId = entry.id;
button.setAttribute('aria-label', `${entry.name} ${entry.value ?? ''} ${entry.unit},点击查看状态列表`);
button.setAttribute('aria-haspopup', 'dialog');
if (button.dataset.icon !== (entry.icon || '')) {
button.dataset.icon = entry.icon || '';
button.replaceChildren();
button.classList.remove('mengsan-hud-status-fallback-shuying');
if (entry.icon) {
const image = create('img', '', button);
image.src = `${assetBase}/assets/status/${entry.icon}`;
image.alt = '';
image.addEventListener('error', () => {
image.remove();
button.classList.add('mengsan-hud-status-fallback-shuying');
}, { once: true });
}
}
create('span', '', button, entry.name);
if (entry.value != null) create('b', '', button, entry.value);
button.addEventListener('click', () => openDetails(player));
wantedButtons.push(button);
}
if (entries.length > maximum) {
const more = create('button', 'mengsan-hud-status-shuying', statuses, `+${entries.length - maximum}`);
more.setAttribute('aria-label', '查看全部状态'); more.addEventListener('click', () => openDetails(player));
const more = existing.get(null) || create('button',
'mengsan-hud-status-shuying mengsan-hud-status-more-shuying',
null);
more.setAttribute('aria-label', '点击查看全部状态');
more.setAttribute('aria-haspopup', 'dialog');
wantedButtons.push(more);
}
if (statusHold && !wantedButtons.includes(statusHold.button)) {
cancelStatusHold();
}
for (const button of [...statuses.children]) {
if (!wantedButtons.includes(button)) button.remove();
}
for (const [index, button] of wantedButtons.entries()) {
if (statuses.children[index] !== button) {
statuses.insertBefore(button, statuses.children[index] || null);
}
}
}
const wanted = new Set();
@@ -118,8 +247,13 @@ export function mountBattleHUD(player, battle, env) {
for (const mark of hiddenMarks) if (!wanted.has(mark)) { mark.classList.remove('mengsan-hud-represented-mark-shuying'); hiddenMarks.delete(mark); }
for (const mark of wanted) if (!mark.classList.contains('mengsan-hud-represented-mark-shuying')) { mark.classList.add('mengsan-hud-represented-mark-shuying'); hiddenMarks.add(mark); }
}
let layout = null;
let layout = null, handGeometry;
const hudHeightFor = () => layout === 'short' ? 188 : layout === 'narrow' ? 288 : 274;
function invalidateHandBounds() {
// Decade uses this cache to place the origin of committed card effects.
const bounds = window.decadeUI?.boundsCaches?.hand;
if (bounds) bounds.updated = false;
}
const oldLayout = arena.getAttribute('data-mengsan-hud-layout');
restores.push(() => {
if (arena.getAttribute('data-mengsan-hud-layout') !== layout) return;
@@ -143,20 +277,41 @@ export function mountBattleHUD(player, battle, env) {
const hudHeight = hudHeightFor();
style(arena, '--mengsan-hud-height', `${hudHeight}px`);
const large = width >= 1000;
style(arena, '--mengsan-hud-left', short ? '216px' : narrow ? '116px' : large ? '352px' : '292px');
style(arena, '--mengsan-hud-right', short ? '132px' : narrow ? '116px' : '184px');
const left = short ? 216 : narrow ? 116 : large ? 352 : 292;
const right = short ? 132 : narrow ? 116 : 184;
style(arena, '--mengsan-hud-left', `${left}px`);
style(arena, '--mengsan-hud-right', `${right}px`);
// Nova sets important geometry on #me and #handcards1. The HUD owns these positions for this battle.
const handInset = Math.min(Math.max(left,right),Math.max(0,(width-114)/2));
for (const [key,value] of Object.entries({left:`${handInset}px`,right:`${handInset}px`,
width:'auto',bottom:short?'64px':'68px'})) style(handRoot,key,value);
const firstHand = ui.handcards1Container;
if (firstHand && handRoot.contains(firstHand)) {
style(firstHand,'left','0px');
style(firstHand,'width','100%');
}
const geometry = [handRoot.offsetLeft, handRoot.offsetTop, handRoot.offsetWidth, handRoot.offsetHeight].join(',');
if (geometry !== handGeometry) {
handGeometry = geometry;
invalidateHandBounds();
}
style(arena, '--mengsan-profile-info-left', short ? '108px' : narrow ? '22px' : large ? '200px' : '160px');
style(arena, '--mengsan-profile-width', short ? '172px' : narrow ? '76px' : large ? '200px' : '130px');
skinActor(player);
// Inline important dimensions also beat skins with #arena > .player !important rules.
const selfLeft = short ? 24 : narrow ? 22 : 40;
const selfWidth = short || narrow ? 76 : large ? 144 : 104;
const selfBottom = narrow ? 180 : 24;
const selfHeight = short || narrow ? 104 : large ? 196 : 148;
const infoTop = narrow ? hudHeight - selfBottom + 16 : hudHeight - selfBottom - selfHeight + (short ? 0 : 20);
style(arena, '--mengsan-profile-info-top', `${infoTop}px`);
for (const [key, value] of Object.entries({left: short ? '24px' : narrow ? '22px' : '40px', right:'auto', top:'auto',
bottom:`${selfBottom}px`, width:short ? '76px' : narrow ? '76px' : large ? '144px' : '104px',
for (const [key, value] of Object.entries({left:`${selfLeft}px`, right:'auto', top:'auto',
bottom:`${selfBottom}px`, width:`${selfWidth}px`,
height:`${selfHeight}px`, transform:'none'})) style(player, key, value);
style(arena, '--mengsan-side-dock-bottom', `${selfBottom + selfHeight + 12}px`);
const statusBottom = selfBottom + selfHeight + 12;
const statusBesidePortrait = height - statusBottom < 36;
style(arena, '--mengsan-status-left', `${statusBesidePortrait ? selfLeft + selfWidth + 8 : selfLeft}px`);
style(arena, '--mengsan-side-dock-bottom', `${statusBesidePortrait ? 8 : statusBottom}px`);
style(arena, '--mengsan-relic-dock-bottom', `${selfBottom + selfHeight + (narrow ? -4 : 12)}px`);
style(arena, '--mengsan-skill-ceiling', `${Math.min(hudHeight - 36, selfBottom + selfHeight)}px`);
style(arena, '--mengsan-status-height', short ? '52px' : narrow ? '84px' : '160px');
@@ -183,16 +338,35 @@ export function mountBattleHUD(player, battle, env) {
right:`${(h.right - a.right + (layout === 'wide' ? 24 : 16) * arenaScale) / scale}px`, bottom:`${(h.bottom - a.bottom + bottom * arenaScale) / scale}px`,
width:`${rail * arenaScale / scale}px`, 'max-height':`${maxHeight * arenaScale / scale}px`})) style(node, key, value);
}
function syncControls() {
function syncControls(response) {
// The actual action controls stay horizontal above the hand; skill references get their own rail.
const candidates = [...new Set([ui.skills, ui.skills2, ui.skills3, ui.skillControl, ui.gskillControl])]
.filter(node => node?.isConnected && node !== ui.control);
const external = candidates.filter(node => !candidates.some(other => other !== node && other.contains(node)));
// The potion slots submit these engine skills directly, so the skill bar has no buttons for them.
const hiddenClass = 'mengsan-hud-potion-action-shuying';
const visible = candidates.filter(control => {
const skinned = control === ui.skillControl || control === ui.gskillControl;
const items = [...(skinned ? control.querySelectorAll('.skillitem[data-id]') : control.children)];
let hiddenCount = 0;
for (const item of items) {
if (potionSkillIds.includes(item.dataset.id ?? item.link)) {
ownClass(item, hiddenClass);
hiddenCount++;
} else item.classList.remove(hiddenClass);
}
if (hiddenCount && hiddenCount === items.length) {
ownClass(control, hiddenClass);
return false;
}
control.classList.remove(hiddenClass);
return true;
});
const external = visible.filter(node => !visible.some(other => other !== node && other.contains(node)));
const hudHeight = hudHeightFor();
const rail = layout === 'wide' ? 142 : layout === 'short' ? 112 : 96;
const actionBottom = layout === 'narrow' ? hudHeight - 48 : hudHeight + 8;
const compactActions = arena.clientWidth < 1000;
for (const [key,value] of Object.entries({position:'absolute',left:compactActions?'16px':'var(--mengsan-hud-left)',right:compactActions?'16px':'var(--mengsan-hud-right)',top:'auto',bottom:`${actionBottom}px`,width:'auto','max-height':'none',transform:'none'})) style(ui.control,key,value);
const actionInset = response || arena.clientWidth < 1000 ? '16px' : 'max(var(--mengsan-hud-left),var(--mengsan-hud-right))';
for (const [key,value] of Object.entries({position:'absolute',left:actionInset,right:actionInset,top:'auto',bottom:`${actionBottom}px`,width:'auto','max-height':'none',transform:'none'})) style(ui.control,key,value);
for (const group of ui.control.children) if (group.classList.contains('control')) {
if (external.includes(group)) {
ownClass(group,'mengsan-hud-native-skills-shuying');
@@ -213,8 +387,9 @@ export function mountBattleHUD(player, battle, env) {
ownClass(node,'mengsan-hud-external-action-shuying');
const host=node.offsetParent||arena,a=arena.getBoundingClientRect(),h=host.getBoundingClientRect();
const scale=h.width/host.offsetWidth||1,zoom=a.width/arena.clientWidth||1;
const center=(parseFloat(arena.style.getPropertyValue('--mengsan-hud-left'))+arena.clientWidth-parseFloat(arena.style.getPropertyValue('--mengsan-hud-right')))/2;
const side=node===ui.confirm?-1:1;
const responseConfirm = response && node === ui.confirm;
const center=arena.clientWidth/2;
const side=responseConfirm ? 0 : node===ui.confirm?-1:1;
for(const [key,value] of Object.entries({position:'absolute',left:`${(a.left+center*zoom-h.left)/scale+side*80}px`,right:'auto',top:'auto',bottom:`${(h.bottom-a.bottom+actionBottom*zoom)/scale}px`,width:`${Math.min(rail,140)}px`,transform:'translateX(-50%)'}))style(node,key,value);
}
}
@@ -233,11 +408,18 @@ export function mountBattleHUD(player, battle, env) {
function refresh() {
if (disposed || frozen) return;
if (!battle.session.active || !arena.isConnected || !handRoot.isConnected || ui.me !== handRoot || ui.control !== controlRoot) { dispose(); return; }
// Closed native controls and expired popups must not stay retained for the whole battle.
// Restore them before forgetting their snapshots so reused nodes get a fresh baseline.
releaseNodes(true);
text(name, nameOf(player)); text(hp, `生命 ${player.hp} / ${player.maxHp}`); text(block, `格挡 ${player.hujia || 0}`);
healthFill.style.width = `${Math.max(0, Math.min(100, player.maxHp > 0 ? player.hp / player.maxHp * 100 : 0))}%`;
text(energy, `费用 ${player.storage.mengsanEnergy_shuying ?? 0} / ${player.storage.mengsanMaxEnergy_shuying ?? 0}`);
syncActors(); syncExternalEquipment(); renderStatuses(); syncControls(); syncNotifications();
overlays.refresh({ footerHeight:hudHeightFor(), status:_status });
syncActors(); syncExternalEquipment(); renderStatuses();
const event = _status.event;
const response = event?.player === player && Boolean(event.respondTo || event.name === 'chooseToRespond');
refreshDetails(); syncControls(response); syncNotifications();
battle.potionUI?.layoutBattleSlots(ui);
overlays.refresh({ footerHeight:hudHeightFor(), status:_status, response });
}
function schedule() {
if (disposed || frozen || document.hidden || frame !== null) return;
@@ -246,13 +428,16 @@ export function mountBattleHUD(player, battle, env) {
const timer = window.setInterval(schedule, 200);
function freeze() {
if(disposed || frozen)return;
stopStatusInput();
frozen=true;window.clearInterval(timer);
if(frame!==null){window.cancelAnimationFrame(frame);frame=null;}
observer?.disconnect();resize?.disconnect();closeDialog();overlays.dispose();
releaseNodes(true);
ownClass(arena,'mengsan-hud-frozen-shuying');
}
function dispose() {
if (disposed) return; disposed = true;
stopStatusInput();
window.clearInterval(timer); if (frame !== null) window.cancelAnimationFrame(frame);
observer?.disconnect(); resize?.disconnect(); window.removeEventListener('resize', schedule);
document.removeEventListener('visibilitychange', schedule);
@@ -260,6 +445,8 @@ export function mountBattleHUD(player, battle, env) {
closeDialog();
for (const mark of hiddenMarks) mark.classList.remove('mengsan-hud-represented-mark-shuying'); hiddenMarks.clear();
for (const restore of restores.reverse()) restore();
releaseNodes();
invalidateHandBounds();
root.remove(); link.remove();
}
ownClass(document.body, 'mengsan-hud-active-shuying'); ownClass(arena, 'mengsan-hud-arena-shuying');
+93 -14
View File
@@ -32,14 +32,18 @@ export function createOverlayLayout(arena, hand, ui, player) {
for (const [name, had] of record.classes) if (!had) node.classList.remove(name);
records.delete(node);
}
function mark(node, name) {
function recordFor(node) {
let record=records.get(node);
if(!record) {record={styles:new Map(),classes:new Map()};records.set(node,record);}
return record;
}
function mark(node, name) {
const record = recordFor(node);
if(!record.classes.has(name))record.classes.set(name,node.classList.contains(name));
node.classList.add(name);return record;
}
function style(node,key,value) {
const record=records.get(node);
const record=recordFor(node);
if(!record.styles.has(key))record.styles.set(key,{before:node.style.getPropertyValue(key),priority:node.style.getPropertyPriority(key)});
const field=record.styles.get(key);
if(field.requested!==value||node.style.getPropertyValue(key)!==field.last)node.style.setProperty(key,value,'important');
@@ -52,32 +56,107 @@ export function createOverlayLayout(arena, hand, ui, player) {
style(node,'left',`${(x-h.left)/sx-host.clientLeft+host.scrollLeft}px`);
style(node,'top',`${(y-h.top)/sy-host.clientTop+host.scrollTop}px`);
}
function hostScale(node) {
const host = node.offsetParent || arena;
const box = host.getBoundingClientRect();
return {x:box.width / host.offsetWidth || 1,y:box.height / host.offsetHeight || 1};
}
function currentShift(node, scale) {
const field = records.get(node)?.styles.get('translate');
return field?.last && node.style.getPropertyValue('translate') === field.last
? {x:field.x * scale.x,y:field.y * scale.y} : {x:0,y:0};
}
function shift(node, x, y, scale, used) {
if (Math.abs(x) < .05 && Math.abs(y) < .05) return;
// Keep the engine's transform animation, but apply the layout shift immediately.
if (arena.ownerDocument.defaultView.getComputedStyle(node).transitionProperty === 'all') {
style(node, 'transition-property', 'transform, opacity, left, top');
}
const dx = x / scale.x, dy = y / scale.y;
style(node, 'translate', `${dx}px ${dy}px`);
Object.assign(records.get(node).styles.get('translate'), {x:dx,y:dy});
used.add(node);
}
function visibleButtons(node, selector) {
return [...node.querySelectorAll(selector)]
.filter(button => !button.closest('.mengsan-hud-external-control-shuying,.removing,.closing'))
.map(button => button.getBoundingClientRect()).filter(box => box.height && box.width);
}
function alignActions(handTop, center, gap, used, response) {
const controls = [ui.control];
if (response && ui.confirm?.isConnected && !ui.control.contains(ui.confirm)) controls.push(ui.confirm);
let top = Infinity;
for (const node of controls) {
const isRoot = node === ui.control;
const buttons = visibleButtons(node,isRoot ? ':scope > .control > div' : ':scope > div');
if (!buttons.length) continue;
const confirm = ui.confirm;
let responseButtons = [];
if (confirm && (node === confirm || node.contains(confirm))) {
responseButtons = confirm.node ? [confirm.node.ok,confirm.node.cancel]
.filter(button => button?.isConnected && button.getClientRects().length)
.map(button => button.getBoundingClientRect()) : visibleButtons(confirm,':scope > div');
}
const centered = responseButtons.length ? responseButtons : buttons;
const left = Math.min(...centered.map(box => box.left));
const right = Math.max(...centered.map(box => box.right));
const scale = hostScale(node), previous = currentShift(node,scale);
const bottom = Math.max(...buttons.map(box => box.bottom)) - previous.y;
const offset = response ? handTop - gap - bottom : 0;
shift(node,center - (left + right)/2 + previous.x,offset,scale,used);
top = Math.min(top, ...buttons.map(box => box.top - previous.y + offset));
}
return top;
}
function clearResponseCards(promptTop, battlefieldTop, gap, used) {
const cards = (ui.thrown || []).filter(card => card.parentNode === arena && !card.fixed &&
!card.matches('.drawingcard,.gainingcard,.movingcard,.removing,.hidden'));
const geometry = cards.map(card => {
const scale = hostScale(card), previous = currentShift(card,scale), box = card.getBoundingClientRect();
return {card,scale,top:box.top - previous.y,bottom:box.bottom - previous.y};
});
if (!geometry.length) return;
const top = Math.min(...geometry.map(box => box.top));
const bottom = Math.max(...geometry.map(box => box.bottom));
const offset = Math.min(0, Math.max(battlefieldTop + gap - top, promptTop - gap - bottom));
// The normal discard position wins whenever it clears the response prompt.
for (const {card,scale} of geometry) shift(card,0,offset,scale,used);
}
const api = {
refresh(nextOptions) {
options = nextOptions;
const {footerHeight,status} = nextOptions;
const {footerHeight,status,response} = nextOptions;
const used=new Set(),a=arena.getBoundingClientRect(),zoom=a.width/arena.clientWidth||1;
const left=parseFloat(arena.style.getPropertyValue('--mengsan-hud-left'))||0;
const right=parseFloat(arena.style.getPropertyValue('--mengsan-hud-right'))||0;
const x=a.left+left*zoom,width=Math.max(100,arena.clientWidth-left-right);
const controlTop=ui.control.getBoundingClientRect().top;
const prompts=new Set(arena.querySelectorAll(':scope > .hand-tip,:scope > .hand-tip-info'));
const dialog=ui.dialog;
if(dialog?.isConnected && !dialog.classList.contains('popped') && !dialog.classList.contains('fullheight') && !dialog.forcebutton && !dialog.buttons?.length && !dialog.querySelector('.button,.card,.player,input,textarea,select') && status.event?.player===player)prompts.add(dialog);
// The event owns simple native prompt dialogs too, without a global game dependency.
const eventDialog=status.event?.dialog;
if(eventDialog?.isConnected && eventDialog===dialog && !eventDialog.buttons?.length && !eventDialog.forcebutton && !eventDialog.querySelector('.button,.card,.player,input,textarea,select'))prompts.add(eventDialog);
let promptBottom=Math.min(controlTop-10*zoom,a.bottom-(footerHeight+54)*zoom);
for(const node of prompts) {
if(node.hidden || node.style.display==='none')continue;
mark(node,'mengsan-hud-prompt-shuying');used.add(node);
position(node,x,0,width,arena.clientHeight<=500?34:64);
const height=node.getBoundingClientRect().height;
position(node,x,Math.max(a.top+50*zoom,promptBottom-height),width,arena.clientHeight<=500?34:64);
promptBottom=node.getBoundingClientRect().top-6*zoom;
}
const handBox=hand.getBoundingClientRect();
const handTop=Math.min(handBox.top,...[...hand.querySelectorAll('.handcards>.card')].map(node=>node.getBoundingClientRect().top));
const handCards=[...hand.querySelectorAll('.handcards>.card')].map(node=>node.getBoundingClientRect()).filter(box=>box.height&&box.width);
const handTop=Math.min(handBox.top,...handCards.map(box=>box.top));
const gap=Math.max(4,(arena.clientHeight<=500?6:8)*zoom);
const actionTop=alignActions(handCards.length ? Math.min(...handCards.map(box=>box.top)) : handTop,(a.left+a.right)/2,gap,used,response);
const controlTop=ui.control.getBoundingClientRect().top;
let promptBottom=Math.min(controlTop-10*zoom,a.bottom-(footerHeight+54)*zoom);
if(response && Number.isFinite(actionTop))promptBottom=actionTop-gap;
let promptTop=Infinity;
for(const node of prompts) {
if(node.hidden || !node.getClientRects().length)continue;
mark(node,'mengsan-hud-prompt-shuying');used.add(node);
const promptWidth=response?arena.clientWidth-32:width;
const promptX=a.left+(arena.clientWidth-promptWidth)*zoom/2;
position(node,promptX,0,promptWidth,arena.clientHeight<=500?34:64);
const height=node.getBoundingClientRect().height;
position(node,promptX,Math.max(a.top+(response?8:50)*zoom,promptBottom-height),promptWidth,arena.clientHeight<=500?34:64);
promptTop=node.getBoundingClientRect().top;
promptBottom=promptTop-6*zoom;
}
if(response && Number.isFinite(promptTop)) clearResponseCards(promptTop,a.top,gap,used);
const popups=popped();
let hasPopup=false;
for(const node of popups) {
+2 -2
View File
@@ -26,8 +26,8 @@ const effects = {
lossStrength: ['撕裂', 'rupture', '力量', '自身回合失去生命时获得力量。'],
vulnerableBonus: ['易伤增幅', 'vicious', '倍率加成', '对易伤敌人的伤害倍率额外加成。'],
attackBlock: ['狂怒', 'rage', '格挡', '本回合每打出一张攻击牌获得格挡。'],
retaliation: ['火焰屏障', 'flame_barrier', '伤害', '本回合受到攻击后反击。'],
colossus: ['巨像', 'colossus', '', '本回合受到易伤敌人的攻击伤害减少50%。'],
retaliation: ['火焰屏障', 'flame_barrier', '伤害', '至下个自身回合开始,受到攻击后反击。'],
colossus: ['巨像', 'colossus', '', '至下个自身回合开始,受到易伤敌人的攻击伤害减少50%。'],
freeAttack: ['免费攻击', 'free_attack', '', '下一张符合规则的攻击牌免费。'],
noDraw: ['不可抽牌', 'no_draw', '', '本回合不能继续抽牌。'],
noEnergy: ['无法获得费用', 'no_energy_gain', '', '本回合不能再获得费用。'],
+15 -12
View File
@@ -18,13 +18,18 @@
.mengsan-hud-health-track-shuying { width:100%;height:4px;margin:0 0 2px;background:#ffffff1a;border-radius:4px;overflow:hidden; }
.mengsan-hud-health-track-shuying>span { height:100%;background:#9bb78d; }
.mengsan-hud-energy-shuying { color:#eacb87;font-size:16px;font-variant-numeric:tabular-nums;white-space:nowrap; }
.mengsan-hud-center-shuying { left:40px;right:auto;top:auto;bottom:var(--mengsan-side-dock-bottom);width:var(--mengsan-profile-width);height:var(--mengsan-status-height); }
.mengsan-hud-shuying .mengsan-hud-statuses-shuying { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:32px;align-content:end;gap:6px;overflow:hidden;white-space:nowrap;height:100%; }
.mengsan-hud-shuying .mengsan-hud-status-shuying { display:flex;align-items:center;gap:4px;max-width:100%;min-width:0;min-height:32px;padding:3px 6px;background:transparent;border-radius:10px; }
.mengsan-hud-status-shuying span { overflow:hidden;text-overflow:ellipsis;font-size:12px; }
.mengsan-hud-status-shuying b { font-variant-numeric:tabular-nums;font-size:13px; }
.mengsan-hud-status-shuying img { width:22px;height:22px;object-fit:contain; }
.mengsan-hud-hand-shuying { position:absolute!important;left:var(--mengsan-hud-left)!important;right:var(--mengsan-hud-right)!important;bottom:68px!important;top:auto!important;width:calc(100% - var(--mengsan-hud-left) - var(--mengsan-hud-right))!important;height:calc(var(--mengsan-hud-height,274px) - 126px)!important;z-index:24!important;background:none!important;border:0!important;transform:none!important;pointer-events:none; }
.mengsan-hud-center-shuying { left:var(--mengsan-status-left);right:auto;top:auto;bottom:var(--mengsan-side-dock-bottom);width:var(--mengsan-profile-width);height:var(--mengsan-status-height); }
.mengsan-hud-shuying .mengsan-hud-statuses-shuying { display:grid;grid-template-columns:repeat(auto-fill,32px);grid-auto-rows:32px;align-content:end;gap:6px;overflow:hidden;white-space:nowrap;height:100%; }
.mengsan-hud-shuying .mengsan-hud-status-shuying { display:flex;align-items:center;justify-content:center;width:32px;height:32px;min-width:0;min-height:32px;padding:2px;background:transparent;border-radius:6px;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;touch-action:pan-y; }
.mengsan-hud-status-shuying img { width:26px;height:26px;object-fit:contain;pointer-events:none; }
.mengsan-hud-status-shuying.is-pressed { border-color:#dcc18e;background:#ffffff12; }
.mengsan-hud-status-more-shuying::after { content:'\2022\2022\2022';letter-spacing:1px; }
.mengsan-hud-status-fallback-shuying::after { content:'';width:12px;height:12px;border:2px solid #dcc18e;transform:rotate(45deg); }
/* Equipment Spine effects live on this body canvas (native z-index 7).
Keep them above the portrait (25) and below action controls (30).
Inline elevations used by awakening animations still take precedence. */
body.mengsan-hud-active-shuying>#decadeUI-canvas { z-index:28; }
.mengsan-hud-hand-shuying { position:absolute!important;top:auto!important;height:calc(var(--mengsan-hud-height,274px) - 126px)!important;z-index:24!important;background:none!important;border:0!important;transform:none!important;pointer-events:none; }
.mengsan-hud-hand-shuying .handcards>.card { pointer-events:auto; }
.mengsan-hud-mebg-shuying,.mengsan-hud-hand-shuying>.fakeme.avatar { display:none!important; }
/* These explicit references cover Decade's nested camp-wrap and hp-wrap as well. */
@@ -50,6 +55,8 @@ body.mengsan-hud-active-shuying #arena>.mengsan-hud-controls-shuying>.control>di
.mengsan-hud-skin-skills-shuying>.enable>.skillitem { width:100%!important;min-height:34px!important;text-align:center; }
.mengsan-hud-skin-skills-shuying .skillitem { -webkit-text-fill-color:currentColor!important;-webkit-text-stroke:0!important;background-clip:border-box!important;-webkit-background-clip:border-box!important; }
.mengsan-hud-skin-skills-shuying .skillitem::before,.mengsan-hud-skin-skills-shuying .skillitem-child { display:none!important; }
body.mengsan-hud-active-shuying #arena>.mengsan-hud-controls-shuying>.control.mengsan-hud-potion-action-shuying,
body.mengsan-hud-active-shuying .mengsan-hud-potion-action-shuying { display:none!important; }
.mengsan-hud-skin-skills-shuying .skillitem:is(.select,.selected) { outline:1px solid #e6cb93;outline-offset:-2px; }
.mengsan-hud-skin-skills-shuying>.enable>.skillitem:not(.usable):not(.select),.mengsan-hud-skin-skills-shuying .skillitem.shixiao { opacity:.55; }
.mengsan-hud-skin-skills-shuying>.trigger>.skillitem { color:#c2c7c8!important;font-size:12px!important; }
@@ -68,12 +75,10 @@ body.mengsan-hud-active-shuying #arena>.mengsan-hud-controls-shuying>.control>di
[data-mengsan-hud-layout="short"] .mengsan-hud-hp-shuying,[data-mengsan-hud-layout="short"] .mengsan-hud-block-shuying { font-size:11px; }
[data-mengsan-hud-layout="short"] .mengsan-hud-name-shuying { font-size:15px; }
[data-mengsan-hud-layout="short"] .mengsan-hud-energy-shuying { font-size:14px; }
[data-mengsan-hud-layout="short"] .mengsan-hud-hand-shuying { bottom:64px!important;height:calc(var(--mengsan-hud-height) - 122px)!important; }
[data-mengsan-hud-layout="short"] .mengsan-hud-center-shuying { top:auto;left:24px; }
[data-mengsan-hud-layout="short"] .mengsan-hud-hand-shuying { height:calc(var(--mengsan-hud-height) - 122px)!important; }
[data-mengsan-hud-layout="short"] .mengsan-hud-shuying .mengsan-hud-status-shuying { min-height:26px;padding:2px 4px; }
[data-mengsan-hud-layout="short"] .mengsan-hud-status-shuying img { width:18px;height:18px; }
[data-mengsan-hud-layout="narrow"] .mengsan-hud-shuying .mengsan-hud-info-shuying { left:22px;width:76px;font-size:12px;gap:5px; }
[data-mengsan-hud-layout="narrow"] .mengsan-hud-hand-shuying { bottom:68px!important; }
[data-mengsan-hud-layout="narrow"] .mengsan-hud-name-shuying { font-size:16px; }
[data-mengsan-hud-layout="narrow"] .mengsan-hud-status-shuying span { display:none; }
#arena.mengsan-hud-arena-shuying>.mengsan-hud-notification-shuying { width:148px!important;max-width:148px!important;min-height:30px;height:30px!important;transition:none!important;font:600 16px/30px "Microsoft YaHei",sans-serif!important;white-space:nowrap; }
@@ -112,9 +117,7 @@ body.mengsan-hud-active-shuying #arena .mengsan-hud-equips-shuying::-webkit-scro
[data-mengsan-hud-layout="narrow"] .mengsan-hand-relics-shuying { right:16px!important;width:96px!important;max-width:96px!important;max-height:36px;flex-wrap:nowrap;justify-content:flex-start;overflow-x:auto;overflow-y:hidden;touch-action:pan-x; }
body.mengsan-hud-active-shuying #arena>.mengsan-hud-controls-shuying>.mengsan-hud-native-skills-shuying { flex-direction:column!important;flex-wrap:nowrap!important;align-items:stretch!important;max-width:none!important;overflow:auto!important; }
body.mengsan-hud-active-shuying #arena .mengsan-hud-native-skills-shuying>div { width:100%!important;min-width:0!important;box-sizing:border-box!important;padding:8px 10px!important;min-height:40px!important;font:14px/20px "Microsoft YaHei",sans-serif!important;white-space:normal!important; }
[data-mengsan-hud-layout="narrow"] .mengsan-hud-center-shuying { left:22px; }
[data-mengsan-hud-layout="short"] .mengsan-hud-shuying .mengsan-hud-statuses-shuying { height:100%; }
[data-mengsan-hud-layout="narrow"] .mengsan-hud-shuying .mengsan-hud-statuses-shuying { grid-template-columns:1fr; }
.mengsan-hud-prompt-shuying { box-sizing:border-box!important;height:auto!important;min-height:0!important;overflow:auto!important;padding:2px 6px!important;background:none!important;border:0!important;box-shadow:none!important;text-align:center!important;z-index:32!important;color:#f6edcb!important;text-shadow:0 1px 3px #000,0 0 6px #000!important; }
body.mengsan-hud-active-shuying .mengsan-hud-card-intro-shuying { box-sizing:border-box!important;z-index:90!important;height:auto!important;min-height:0!important;overflow:auto!important;border-radius:14px!important;background:#202020f5!important;box-shadow:0 8px 24px #0007!important;color:#f4f4f4!important;transition:none!important; }
body.mengsan-hud-active-shuying #window>.mengsan-hud-card-intro-shuying { z-index:90!important; }
+3 -3
View File
@@ -65,7 +65,7 @@ export function attackIconForDamage(damage) {
}
export function mountEnemyIntent(player, session, assetBase, document,
getTarget = () => null) {
getTarget = () => null, getBattle = () => null) {
const badge = document.createElement("div");
badge.className = "mengsan-intent-shuying";
badge.hidden = true;
@@ -185,7 +185,7 @@ export function mountEnemyIntent(player, session, assetBase, document,
const target = getTarget();
const targets = Array.isArray(target) ? target : [target];
const damages = (targets.length ? targets : [null]).map(
current => previewAttackDamage(intent, player, current));
current => previewAttackDamage(intent, player, current, getBattle()));
const damage = Math.max(...damages);
const minimum = Math.min(...damages);
const range = minimum === damage ? String(damage) :
@@ -237,7 +237,7 @@ export function mountEnemyIntent(player, session, assetBase, document,
const target = getTarget();
const targets = Array.isArray(target) ? target : [target];
for (const current of targets.length ? targets : [null]) {
values.push(previewAttackDamage(currentIntent, player, current));
values.push(previewAttackDamage(currentIntent, player, current, getBattle()));
}
}
if (previous && previous.length === values.length && values.every((value, index) => Object.is(value, previous[index]))) return;
+11 -2
View File
@@ -1,10 +1,11 @@
import { openCardLibrary } from "../card-library.js";
import { askMenu, openModeSelection, openNonameMenu } from "../navigation.js";
import { askMenu, confirmRestartJourney, openModeSelection, openNonameMenu } from "../navigation.js";
import { ui, get } from "../../../../../noname.js";
import config from "../../config.js";
import { getRelic } from "../../relics/definitions.js";
import { createRelicIcon } from "../relic-icon.js";
import { renderBonds } from "../bonds.js";
import { mountPotionSlots } from "../potions.js";
import { getSelectableNodes } from "../../progression/state.js";
import { getDiagnostics } from "../../../diagnostics/index.js";
@@ -27,6 +28,7 @@ const controlIconPaths = {
book: "M5 5h9a5 5 0 015 5v17a5 5 0 00-5-5H5zM27 5h-9a5 5 0 00-5 5v17a5 5 0 015-5h9z",
record: "M8 4h16v24H8zM12 10h8M12 16h8M12 22h5",
settings: "M16 11a5 5 0 100 10 5 5 0 000-10zM16 3v4M16 25v4M3 16h4M25 16h4M7 7l3 3M22 22l3 3M25 7l-3 3M10 22l-3 3",
restart: "M5 15a11 11 0 111 7M5 6v9h9",
exit: "M13 5H6v22h7M20 10l6 6-6 6M26 16H11",
back: "M20 7l-9 9 9 9M11 16h16",
close: "M8 8l16 16M24 8L8 24",
@@ -100,11 +102,13 @@ export const showMap = (run, { saveRun } = {}) => new Promise(resolve => {
const { overlay, panel, header } = createMapOverlay(act.name);
let closeCardLibrary = null;
let savingBonds = false;
let potionUI;
const finish = result => {
if (overlay.dataset.resolved || savingBonds) return;
overlay.dataset.resolved = "true";
document.removeEventListener("keydown", handleEscape);
closeCardLibrary?.();
potionUI?.dispose();
overlay.remove();
resolve(result);
};
@@ -132,6 +136,7 @@ export const showMap = (run, { saveRun } = {}) => new Promise(resolve => {
createText("mengsan-map-stat-label-shuying", label, item);
createText("mengsan-map-stat-value-shuying", value, item);
});
potionUI = mountPotionSlots(status, run.player, { allowImport: true });
const menuLayer = ui.create.div(".mengsan-map-menu-layer-shuying", panel);
menuLayer.id = "mengsan-map-menu-shuying";
@@ -339,6 +344,9 @@ export const showMap = (run, { saveRun } = {}) => new Promise(resolve => {
}
},
}).setAttribute("aria-haspopup", "dialog");
createMenuAction({ icon: "restart", name: "重新开始", description: "结束本次征程,返回角色选择",
danger: true, onClick: confirmRestartJourney,
}).setAttribute("aria-haspopup", "dialog");
}
function handleEscape(event) {
@@ -407,7 +415,8 @@ export const showMap = (run, { saveRun } = {}) => new Promise(resolve => {
suppressClick = true;
if (!viewport.hasPointerCapture(event.pointerId)) viewport.setPointerCapture(event.pointerId);
viewport.classList.add("dragging");
viewport.scrollTop = drag.top - distance;
const scale = viewport.getBoundingClientRect().height / viewport.offsetHeight || 1;
viewport.scrollTop = drag.top - distance / scale;
event.preventDefault();
});
const endDrag = event => {
+65 -3
View File
@@ -1,9 +1,21 @@
import { lib, game, ui, _status } from "../../../../noname.js";
import { save } from "../../../../noname/util/config.js";
import { getDiagnostics } from "../../diagnostics/index.js";
import config from "../config.js";
let selectingMode = false;
let nonameMenuTask = null;
let restartingJourney = false;
const journeyRestartKey = () => `${lib.configprefix}${config.modeId}:restart`;
const canRestartJourney = () => lib.storage?.[config.saveKey]?.status === "running";
export const consumeJourneyRestart = () => {
const key = journeyRestartKey();
if (sessionStorage.getItem(key) !== "true") return false;
sessionStorage.removeItem(key);
return true;
};
// Open the engine's real settings menu without ending the current expedition flow.
export const openNonameMenu = async () => {
@@ -133,11 +145,58 @@ export const askMenu = (title, description, choices) => new Promise(resolve => {
dialog.appendChild(button);
}
dialog.addEventListener("cancel", event => { event.preventDefault(); finish(null); });
document.body.appendChild(dialog);
document.documentElement.appendChild(dialog);
dialog.showModal();
dialog.querySelector("button")?.focus();
});
export const confirmRestartJourney = async () => {
if (restartingJourney || !canRestartJourney()) return;
restartingJourney = true;
let cleared = false;
try {
const confirmed = await askMenu("重新开始?", "当前征程的存档将被清除。确认后返回角色选择。", [
{ id: "cancel", name: "取消" },
{ id: "confirm", name: "确认重新开始", danger: true },
]);
if (confirmed !== "confirm") return;
const restartKey = journeyRestartKey();
const directStartKey = `${lib.configprefix}directstart`;
const previousDirectStart = localStorage.getItem(directStartKey);
const previousInert = ui.window.inert;
const wasPaused = _status.paused2;
ui.window.inert = true;
game.pause2();
try {
sessionStorage.setItem(restartKey, "true");
localStorage.setItem(directStartKey, "true");
await game.mengsanClearRun_shuying();
} catch (error) {
ui.window.inert = previousInert;
if (!wasPaused) game.resume2();
sessionStorage.removeItem(restartKey);
if (previousDirectStart === null) localStorage.removeItem(directStartKey);
else localStorage.setItem(directStartKey, previousDirectStart);
throw error;
}
cleared = true;
// Reload through the engine so the old flow stops and pending DB writes can finish.
game.reload();
await new Promise(() => {});
} catch (error) {
console.error("梦三重新开始失败:", error);
getDiagnostics().scope("mengsan.navigation").error("restart.failed", error);
const message = cleared ? "本局存档已清除,请重新进入梦三选择角色。" : "请关闭提示后重试。";
await askMenu("暂时无法重新开始", message, [
{ id: "close", name: "关闭提示" },
]);
} finally {
restartingJourney = false;
}
};
export const mountMenu = (overlay, options = {}) => {
const button = document.createElement("button");
button.type = "button";
@@ -160,12 +219,15 @@ export const mountMenu = (overlay, options = {}) => {
options.onOpen?.();
let action = null;
try {
action = await askMenu("征程菜单", "退出不删除存档。未完成的节点与对话将在下次进入时重新开始。", [
const choices = [
{ id: "resume", name: "继续当前界面" },
{ id: "noname", name: "显示 Noname 菜单" },
{ id: "exit", name: "返回模式选择" },
]);
];
if (canRestartJourney()) choices.push({ id: "restart", name: "重新开始", danger: true });
action = await askMenu("征程菜单", "返回模式选择会保留存档。未完成的节点与对话将在下次进入时重新开始。", choices);
if (action === "noname") { await openNonameMenu(); return; }
if (action === "restart") { await confirmRestartJourney(); return; }
if (action !== "exit") return;
const confirmed = await askMenu("返回模式选择?", "保留上次已完成节点的存档。本次尚未完成的内容不会提交。", [
{ id: "cancel", name: "留在梦三" },
+80
View File
@@ -0,0 +1,80 @@
.mengsan-potion-slots {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 5px;
position: relative;
width: auto;
pointer-events: auto;
}
.mengsan-battle-potions {
position: absolute;
top: var(--mengsan-potion-top, 8px);
left: var(--mengsan-potion-left, 8px);
width: max-content;
max-width: calc(50% - 16px);
transition: none;
z-index: 7;
}
/* Decade UI sets data-id during every skill-bar rebuild, before its first paint. */
.mengsan-hud-arena-shuying :is(.skill-control, .skill-controlzuoshou, .gskill-control)
[data-id^="mengsan_use_"][data-id$="_potion_shuying"] {
display: none !important;
}
.mengsan-potion-slot {
display: inline-grid;
place-items: center;
width: 34px;
height: 34px;
padding: 2px;
border: 1px solid #c89658;
border-radius: 6px;
background: #241e19;
color: #f2d8ab;
}
button.mengsan-potion-slot, .mengsan-potion-import { cursor: pointer; }
.mengsan-potion-slot-empty { border-style: dashed; opacity: .65; }
.mengsan-potion-icon { position: relative; display: grid; place-items: center; width: 100%; height: 100%; }
.mengsan-potion-icon > img { grid-area: 1 / 1; width: 100%; height: 100%; object-fit: contain; }
.mengsan-potion-icon > span { grid-area: 1 / 1; }
.mengsan-potion-icon > [hidden] { display: none; }
.ms-shop-potion-image { width: 48px; height: 48px; object-fit: contain; }
.mengsan-potion-choice-tile .mengsan-card-choice-art-shuying { aspect-ratio: 1; }
.mengsan-potion-choice-tile .mengsan-card-choice-art-shuying img { object-fit: contain; }
.mengsan-potion-choice-tile .mengsan-card-choice-art-shuying:has(img) .mengsan-card-choice-glyph-shuying { display: none; }
.mengsan-potion-text-blue { color: #91c8f2; }
.mengsan-potion-text-gold { color: #efc57e; }
.mengsan-potion-text-green { color: #bee09b; }
.mengsan-potion-text-red { color: #f39d8c; }
.mengsan-potion-import { border: 0; background: transparent; color: #f2d8ab; }
.mengsan-map-status-shuying:has(> .mengsan-potion-slots) {
flex-wrap: wrap;
}
.mengsan-potion-dialog {
box-sizing: border-box;
width: min(340px, calc(100vw - 32px));
padding: 20px;
border: 1px solid #c89658;
border-radius: 10px;
background: #241e19;
color: #f9e6c8;
text-align: center;
}
.mengsan-potion-dialog::backdrop { background: #100d0abf; }
.mengsan-potion-dialog > .mengsan-potion-icon { width: 56px; height: 56px; margin: auto; }
.mengsan-potion-dialog h2 { margin: 12px 0 6px; }
.mengsan-potion-dialog p { line-height: 1.5; white-space: pre-line; }
.mengsan-potion-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.mengsan-potion-actions button { min-height: 34px; padding: 3px 12px; }
@media (pointer: coarse) {
.mengsan-potion-slot { width: 40px; height: 40px; }
.mengsan-potion-actions button { min-height: 44px; }
}
+189
View File
@@ -0,0 +1,189 @@
import { game } from "../../../../noname.js";
import { potionSlots } from "../potions/state.js";
import { hasPotionText, importPotionText, potionView } from "../potions/presentation.js";
import { chooseButtons } from "./flow-ui.js";
import { choosePotionDialog } from "./reward-ui.js";
export async function choosePotionReplacement(slots, id) {
if (slots.includes(null)) return { id, replaceIndex: null };
const selected = await chooseButtons("药水栏已满", [
...slots.map((held, index) => {
const { name, description } = potionView(held);
return { id: String(index), name: "替换 " + name, description };
}),
{ id: "skip", name: "保留已有药水" },
], "选择一个栏位来放入" + potionView(id).name, { back: "skip", menu: false });
return selected === "skip" ? null : { id, replaceIndex: Number(selected) };
}
export async function choosePotionReward(candidates, slots) {
const id = await choosePotionDialog(candidates.map(id => ({ id, ...potionView(id) })));
return id === null ? null : choosePotionReplacement(slots, id);
}
function element(tag, className, text) {
const node = document.createElement(tag);
if (className) node.className = className;
if (text != null) node.textContent = text;
return node;
}
function potionIcon(view) {
const icon = element("span", "mengsan-potion-icon");
icon.setAttribute("aria-hidden", "true");
const fallback = element("span", "", view.name[0]);
const image = element("img");
image.alt = "";
image.addEventListener("load", () => { fallback.hidden = true; }, { once: true });
image.addEventListener("error", () => image.remove(), { once: true });
image.src = view.image;
icon.append(fallback, image);
return icon;
}
export function showPotionDescription(node, view) {
const tags = /\[(\/?)(blue|gold|green|red)\]/g;
let parent = node;
let start = 0;
for (const match of view.richDescription.matchAll(tags)) {
parent.append(view.richDescription.slice(start, match.index));
if (match[1]) {
parent = node;
} else {
parent = element("span", "mengsan-potion-text-" + match[2]);
node.append(parent);
}
start = match.index + match[0].length;
}
parent.append(view.richDescription.slice(start));
}
function positionBattlePotions(root, strip, ui) {
if (!root.clientWidth || !root.clientHeight) return;
const view = root.ownerDocument.defaultView;
const arena = root.getBoundingClientRect();
const scaleX = arena.width / root.clientWidth || 1;
const scaleY = arena.height / root.clientHeight || 1;
const {width,height} = strip.getBoundingClientRect();
const gapX = 8 * scaleX, gapY = 8 * scaleY;
const startX = arena.left + gapX;
const limitX = arena.left + arena.width / 2 - gapX;
const obstacles = [];
for (const panel of new Set([ui.cardRoundTime,ui.cardRoundTimeNode,ui.cardPileNumber,
ui.time,ui.time3,ui.time4,ui.timeNode,ui.roundmenu])) {
if (!panel?.isConnected) continue;
const style = view.getComputedStyle(panel);
if (style.visibility === 'hidden' || style.display === 'none' || Number(style.opacity) === 0) continue;
for (const node of [panel,...panel.querySelectorAll('.cardPileNumber,.roundNumber,.time,.cardPileNumber > span')]) {
const box = node.getBoundingClientRect();
if (box.width && box.height) obstacles.push(box);
}
}
let x = startX, y = arena.top + gapY;
for (;;) {
const nearby = obstacles.filter(box => box.left < x + width + gapX && box.right + gapX > x &&
box.top < y + height + gapY && box.bottom + gapY > y);
if (!nearby.length) break;
const nextX = Math.max(...nearby.map(box=>box.right)) + gapX;
if (nextX + width <= limitX) {
x = nextX;
} else {
x = startX;
y = Math.min(...nearby.map(box=>box.bottom)) + gapY;
}
}
const left = `${(x-arena.left)/scaleX}px`, top = `${(y-arena.top)/scaleY}px`;
if (strip.style.getPropertyValue('--mengsan-potion-left') !== left) strip.style.setProperty('--mengsan-potion-left',left);
if (strip.style.getPropertyValue('--mengsan-potion-top') !== top) strip.style.setProperty('--mengsan-potion-top',top);
}
export function mountPotionSlots(root, player, actions = {}) {
const strip = element("div", "mengsan-potion-slots");
if (actions.use) strip.classList.add("mengsan-battle-potions");
strip.setAttribute("role", "group");
strip.setAttribute("aria-label", "药水栏");
root.append(strip);
let dialog = null;
let previousFocus = null;
function close() {
if (!dialog) return;
dialog.close();
dialog.remove();
dialog = null;
if (previousFocus?.isConnected) previousFocus.focus();
}
function details(index, id) {
const view = potionView(id);
previousFocus = document.activeElement;
dialog = element("dialog", "mengsan-potion-dialog");
dialog.setAttribute("aria-label", view.name);
dialog.addEventListener("cancel", event => { event.preventDefault(); close(); });
dialog.addEventListener("keydown", event => event.stopPropagation());
const description = element("p");
showPotionDescription(description, view);
dialog.append(potionIcon(view), element("h2", "", view.name), description);
const buttons = element("div", "mengsan-potion-actions");
const button = (caption, callback, disabled = false) => {
const control = element("button", "", caption);
control.type = "button";
control.disabled = disabled;
control.addEventListener("click", () => { close(); callback?.(); });
buttons.append(control);
};
if (actions.use) button("使用", () => actions.use(index, id), !actions.canUse(index, id));
if (actions.discard) button("丢弃", () => actions.discard(index, id), !actions.canDiscard());
button("关闭");
dialog.append(buttons);
document.documentElement.append(dialog);
dialog.showModal();
}
function refresh() {
strip.replaceChildren();
for (const [index, id] of potionSlots(player).entries()) {
if (id === null) {
const empty = element("span", "mengsan-potion-slot mengsan-potion-slot-empty", "·");
empty.setAttribute("aria-label", "空药水槽");
strip.append(empty);
continue;
}
const view = potionView(id);
const button = element("button", "mengsan-potion-slot");
button.type = "button";
button.title = view.name;
button.setAttribute("aria-label", view.name);
button.append(potionIcon(view));
button.addEventListener("click", () => details(index, id));
strip.append(button);
}
if (actions.allowImport && !hasPotionText()) {
const input = element("input");
input.type = "file";
input.accept = "application/json,.json";
input.hidden = true;
const importButton = element("button", "mengsan-potion-import", "载入药水文本");
importButton.type = "button";
importButton.addEventListener("click", () => input.click());
input.addEventListener("change", async () => {
if (!input.files[0]) return;
try {
await importPotionText(input.files[0], game);
refresh();
} catch (error) {
importButton.textContent = "重新选择 potions.json";
importButton.title = error.message;
input.value = "";
}
});
strip.append(importButton, input);
}
}
for (const type of ["click", "pointerdown", "pointerup", "mousedown", "mouseup", "touchstart", "touchend"]) {
strip.addEventListener(type, event => event.stopPropagation());
}
refresh();
return {
refresh,
layoutBattleSlots(ui) { if (actions.use && strip.isConnected) positionBattlePotions(root, strip, ui); },
dispose() { close(); strip.remove(); },
};
}
+29 -6
View File
@@ -1,10 +1,11 @@
export function mountRelicStrip(root, getRelics, open, createIcon,
document, window) {
document, window, getCounter = () => null) {
const strip = document.createElement("div");
strip.className = "mengsan-hand-relics-shuying";
strip.setAttribute("aria-label", "持有遗物,长按查看描述");
strip.setAttribute("aria-label", "持有遗物,点击查看列表");
const before = root.style.getPropertyValue("--mengsan-relic-space");
const priority = root.style.getPropertyPriority("--mengsan-relic-space");
const counters = [];
let pending = null, timer = null, signature = null, disposed = false;
const cancel = () => {
if (timer !== null) window.clearTimeout(timer);
@@ -38,7 +39,6 @@ export function mountRelicStrip(root, getRelics, open, createIcon,
const click = event => {
stop(event);
event.preventDefault();
if (event.detail !== 0) return;
const button = event.target.closest?.("button");
const relic = getRelics().find(item => item.id === button?.dataset.relicId);
if (relic) open(relic);
@@ -57,21 +57,35 @@ export function mountRelicStrip(root, getRelics, open, createIcon,
];
for (const args of listeners) args[0].addEventListener(...args.slice(1));
root.appendChild(strip);
const refreshCounters = () => {
if (disposed) return;
for (const { relic, button, badge } of counters) {
const { value, label } = getCounter(relic);
const text = String(value);
if (text === badge.textContent) continue;
badge.textContent = text;
button.setAttribute("aria-label", `${relic.name},${label},点击查看遗物列表`);
}
};
const refresh = () => {
if (disposed) return;
const relics = getRelics();
const next = JSON.stringify(relics.map(item => [item.id, item.image, item.name]));
if (next === signature) return;
if (next === signature) {
refreshCounters();
return;
}
signature = next;
cancel();
strip.replaceChildren();
counters.length = 0;
strip.hidden = relics.length === 0;
root.style.setProperty("--mengsan-relic-space", relics.length ? "88px" : "0px");
for (const relic of relics) {
const button = document.createElement("button");
button.type = "button";
button.dataset.relicId = relic.id;
button.setAttribute("aria-label", `${relic.name},长按查看描述`);
button.setAttribute("aria-label", `${relic.name},点击查看遗物列表`);
button.setAttribute("aria-haspopup", "dialog");
const fallback = document.createElement("span");
fallback.textContent = relic.name;
@@ -83,14 +97,23 @@ export function mountRelicStrip(root, getRelics, open, createIcon,
button.appendChild(icon);
}
button.appendChild(fallback);
if (getCounter(relic) !== null) {
const badge = document.createElement("span");
badge.className = "mengsan-relic-counter-shuying";
badge.setAttribute("aria-hidden", "true");
button.appendChild(badge);
counters.push({ relic, button, badge });
}
strip.appendChild(button);
}
refreshCounters();
};
refresh();
return { refresh, dispose() {
return { refresh, refreshCounters, dispose() {
if (disposed) return;
disposed = true;
cancel();
counters.length = 0;
for (const args of listeners) args[0].removeEventListener(...args.slice(1));
strip.remove();
const value = root.style.getPropertyValue("--mengsan-relic-space");
+19 -11
View File
@@ -26,22 +26,30 @@ export function mountRelics(session, run, battleRelics, { stripRoot = ui.me } =
button.textContent = `遗物 ${relics.length}`;
strip?.refresh();
if (!list) return;
const expanded = new Set([...list.querySelectorAll('details[open]')].map(row => row.dataset.relicId));
if (!list.children.length && selected) expanded.add(selected);
list.replaceChildren();
if (!relics.length) {
const empty = document.createElement("p");
empty.textContent = "本次征程尚未获得遗物。";
list.appendChild(empty);
}
for (const relic of selected ? relics.filter(r => r.id === selected) : relics) {
const row = document.createElement("section");
const icon=createRelicIcon(relic.image);if(icon)row.appendChild(icon);
const name = document.createElement("h3");
for (const relic of relics) {
const row = document.createElement("details");
row.className = "mengsan-info-row-shuying";
row.dataset.relicId = relic.id;
row.open = expanded.has(relic.id);
const summary = document.createElement("summary");
const icon=createRelicIcon(relic.image);if(icon)summary.appendChild(icon);
const name = document.createElement("strong");
name.textContent = relic.name;
summary.appendChild(name);
const description = document.createElement("p");
description.textContent = relic.description;
const status = document.createElement("small");
status.textContent = `${relic.pool} · ${relic.tier}${relic.ancient ? ` · ${relic.ancient}` : ""} · ${battleRelics.status(relic)}`;
row.append(name, description, status);
status.textContent = [relic.pool, relic.tier, relic.ancient, battleRelics.status(relic)]
.filter(Boolean).join(" · ");
row.append(summary, description, status);
list.appendChild(row);
}
};
@@ -53,11 +61,11 @@ export function mountRelics(session, run, battleRelics, { stripRoot = ui.me } =
const currentDialog = dialog;
dialog.className = "mengsan-deck-dialog-shuying " +
"mengsan-relic-dialog-shuying";
dialog.setAttribute("aria-label", relic?.name || "遗物(道具)");
dialog.setAttribute("aria-label", "遗物(道具)");
const header = document.createElement("header");
header.className = "ms-deck-header";
const title = document.createElement("h2");
title.textContent = relic?.name || "遗物(道具)";
title.textContent = "遗物(道具)";
const dismiss = document.createElement("button");
dismiss.type = "button";
dismiss.className = "ms-deck-button";
@@ -75,17 +83,17 @@ export function mountRelics(session, run, battleRelics, { stripRoot = ui.me } =
});
dialog.addEventListener("keydown", event => event.stopPropagation());
refresh();
document.body.appendChild(dialog);
document.documentElement.appendChild(dialog);
try { dialog.showModal(); dismiss.focus(); }
catch (error) { close(); throw error; }
};
button.addEventListener("click", () => open());
if (stripRoot) strip = mountRelicStrip(stripRoot, () => heldRelics(run),
open, createRelicIcon, document, window);
open, createRelicIcon, document, window, relic => battleRelics.counter(relic));
const dispose = () => {
if (disposed) return;
disposed = true; close(); strip?.dispose(); button.remove();
};
session.ownResource(button, dispose);
return { dispose, refresh };
return { dispose, refresh, refreshCounters: () => strip?.refreshCounters() };
}
+95
View File
@@ -0,0 +1,95 @@
import { chooseFlow } from "./flow-ui.js";
import { mountMenu } from "./navigation.js";
import { createRelicIcon } from "./relic-icon.js";
const iconPaths = {
heal: "M3 12h4l2-4 3 8 2-4h7M20.8 12.2c1.8-2.4.9-6.2-2-7.2-2.5-.9-4.9.3-6.8 2.3C10.1 5.3 7.7 4.1 5.2 5c-2.9 1-3.8 4.8-2 7.2 2.3 3 5.6 6.4 8.8 8.3 3.2-1.9 6.5-5.3 8.8-8.3Z",
upgrade: "m15 10-9.5 9.5-2-2L13 8m2-4 5 5-3 3-5-5 3-3ZM19 4l2 2",
relic: "m12 3 8 9-8 9-8-9 8-9Z",
chevron: "m9 6 6 6-6 6",
leave: "M4 12h15m-6-6 6 6-6 6",
};
function element(tag, className, text) {
const node = document.createElement(tag);
node.className = `ms-rest-${className}`;
if (text != null) node.textContent = text;
return node;
}
function icon(name) {
const namespace = "http://www.w3.org/2000/svg";
const svg = document.createElementNS(namespace, "svg");
svg.setAttribute("viewBox", "0 0 24 24");
svg.setAttribute("aria-hidden", "true");
const path = document.createElementNS(namespace, "path");
path.setAttribute("d", iconPaths[name]);
svg.append(path);
return svg;
}
function actionButton(choice, core, finish) {
const button = element("button", "action");
button.type = "button";
button.dataset.choice = choice.id;
button.disabled = Boolean(choice.disabled);
const art = element("span", "action-art");
art.append(createRelicIcon(choice.image) || icon(core ? choice.id : "relic"));
const copy = element("span", "action-copy");
const description = choice.disabled && choice.disabledReason ? choice.disabledReason : choice.description;
copy.append(element("strong", "action-name", choice.name), element("span", "action-description", description));
button.append(art, copy);
if (core) button.append(icon("chevron"));
button.addEventListener("click", () => {
if (!button.disabled) finish(choice.id);
});
return button;
}
export const chooseRest = (choices, { tent, lastAction }) => chooseFlow("休息处", (overlay, finish) => {
overlay.classList.add("mengsan-rest-overlay-shuying");
const header = element("header", "header");
const brand = element("p", "brand");
const mark = element("span", "mark", "夢");
mark.setAttribute("aria-hidden", "true");
brand.append(mark, element("span", "context", "梦三 · 征程"));
header.append(brand);
const menu = mountMenu(header);
const body = element("section", "body");
const dock = element("div", "dock");
const core = element("div", "core");
const relics = element("section", "relics");
const relicActions = element("div", "relic-actions");
for (const choice of choices) {
const isCore = choice.id === "heal" || choice.id === "upgrade";
(isCore ? core : relicActions).append(actionButton(choice, isCore, finish));
}
if (core.childElementCount) dock.append(core);
if (relicActions.childElementCount) {
relics.append(element("h2", "relic-heading", "遗物选项"), relicActions);
dock.append(relics);
}
const footer = element("footer", "footer");
const remaining = choices.filter(choice => !choice.disabled).length;
const rule = remaining ? `还可执行 ${remaining} 项,每项限一次` : "已完成所有可用选项";
const prefix = lastAction ? `已执行${lastAction}` : "微型帐篷";
const status = element("p", "status", tent ? `${prefix} · ${rule}` : "选择一项后返回地图");
status.setAttribute("role", "status");
footer.append(status);
if (tent) {
const leave = element("button", "leave");
leave.type = "button";
leave.dataset.choice = "done";
leave.append("离开休息处", icon("leave"));
leave.addEventListener("click", () => finish("done"));
footer.append(leave);
}
dock.append(footer);
body.append(element("h1", "title", "休息处"), dock);
overlay.append(header, body);
return dock.querySelector("button:not(:disabled)") || menu;
});

Some files were not shown because too many files have changed in this diff Show More