Files
gplan-2/game/data/schemas/difficulty_table.gd
T

33 lines
1.6 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
# Date: 2026-09-12
# 数据配置 DifficultyTable schema(难度曲线与Boss GDD Core Rule 1 兑现——敌人系统 Rule 10 "接口未定 provisional" 的建表兑现,走 数据配置 接口漂移规则)。
# 全局修饰结构位:按 (L,D) 精确匹配施加乘数于 EnemyTable 行值(敌人系统.spawn 实例化时、行值快照前)。
# MVP 空表(零行为——AC-10);首个使用场景 = 精英节点(关卡节点地图 定稿联动,难度曲线与Boss OQ5);Boss 走 Dmax 直填行不走本表。
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