Files
gplan-2/game/data/schemas/difficulty_table.gd
T
DKChan 9a72394652 chore(代码卫生): 头注存量清偿批——82 文件按两类白名单改写为 ## 文档注释载体
按 code-conventions §1.4.1 第三轮定稿执行:core 22+schemas 18+presentation 根 14+views 28,全部头注 #→##、删日期/变更叙事/GDD 与架构反向链接/字段与域清单/机制描述,保留职责摘要+真实使用约束(防事故禁令/单一入口/信号契约每信号一行)。main.gd 31→5 行、save_manager 45→5 行、adventure_runner 37→5 行为最大单件。子代理分模块执行(波一 core+schemas、波二 presentation+views,并发≤2)。验收=tools/verify_comment_only_change.py 逐字节校验(82 文件头注区外逐行一致=零行为变更)+audit_file_headers 全绿;纯注释批免冒烟(先例 5843270)
2026-10-16 23:28:07 +08:00

31 lines
1.3 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## VERTICAL SLICE - NOT FOR PRODUCTION
## 难度修饰表 schema:按 (level_index, node_depth) 精确匹配施加乘数的类型化读取(空表=零行为合法态)。
## Boss 数值走行值直填不经本表;乘数越域仅告警、使用时 clamp(组合事故不作配置事故拒载)。
class_name DifficultyTable
extends Resource
@export var rows: Array[Dictionary] = [] # Array[Dictionary]:{level_index, node_depth, hp_mult, atk_mult}
const MULT_MIN := 0.1
const MULT_MAX := 10.0
func validate() -> Array:
var errs: Array[Dictionary] = []
var seen := {}
for row in rows:
var L: int = int(row.get("level_index", 0))
var D: int = int(row.get("node_depth", -1))
var key := "%d_%d" % [L, D]
if seen.has(key):
errs.append({"category": "dup_key", "message": "DifficultyTable 键重复: %s" % key})
seen[key] = true
if L < 1 or D < 0:
errs.append({"category": "domain", "message": "难度键越域 (%d,%d)" % [L, D]})
# 乘数越域 = warning 级(使用时 clamp——组合事故非配置事故,难度曲线与Boss GDD Edge Case 预登记)
for k in ["hp_mult", "atk_mult"]:
var v: float = float(row.get(k, 1.0))
if v < MULT_MIN or v > MULT_MAX:
errs.append({"category": "mult_oor_warning", "message": "%s (%s) 越域 [0.1,10] 使用时 clamp: %f" % [key, k, v]})
return errs