feat(mana): 游戏设计器支持 mana 字段(补 Mana MVP 配套)
- Core 编辑器加「蓝上限/回蓝」两栏(_on_select 读 / _on_apply 写 / _on_new 默认), 修复此前编辑 Core 保存会静默丢失 mana_max/mana_regen 的数据丢失洞 - 法术编辑器 4 个 meta 模板加 mana_cost,新法术默认有合理蓝耗 - handbook 07 补 Core 蓝池字段 + 法术 mana_cost 说明 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,8 @@ var _slots: SpinBox
|
||||
var _topo: OptionButton
|
||||
var _cpu: SpinBox
|
||||
var _interval: SpinBox
|
||||
var _mana_max: SpinBox
|
||||
var _mana_regen: SpinBox
|
||||
var _feat: OptionButton
|
||||
var _rows: SpinBox
|
||||
var _cols: SpinBox
|
||||
@@ -39,6 +41,8 @@ func _ready() -> void:
|
||||
_topo = _row("拓扑", UI.opt(TOPO, 0))
|
||||
_cpu = _row("CPU 上限", UI.spin(1, 40, 1, 5))
|
||||
_interval = _row("施法间隔(s)", UI.spin(0.05, 5, 0.05, 0.5))
|
||||
_mana_max = _row("蓝上限(Mana Max)", UI.spin(0, 1000, 5, 100))
|
||||
_mana_regen = _row("回蓝/秒(Mana Regen)", UI.spin(0, 100, 0.5, 5))
|
||||
_feat = _row("特性", UI.opt(FEAT, 0))
|
||||
_rows = _row("矩阵行(MATRIX)", UI.spin(1, 8, 1, 1))
|
||||
_cols = _row("矩阵列(MATRIX)", UI.spin(1, 16, 1, 5))
|
||||
@@ -81,6 +85,8 @@ func _on_select(idx: int) -> void:
|
||||
_topo.selected = int(d.get("topology", 0))
|
||||
_cpu.value = float(d.get("cpu_limit", 5))
|
||||
_interval.value = float(d.get("cast_interval", 0.5))
|
||||
_mana_max.value = float(d.get("mana_max", 100))
|
||||
_mana_regen.value = float(d.get("mana_regen", 5))
|
||||
_feat.selected = int(d.get("feature_tags", 0))
|
||||
_rows.value = float(d.get("grid_rows", 1))
|
||||
_cols.value = float(d.get("grid_cols", 5))
|
||||
@@ -99,6 +105,7 @@ func _on_apply() -> void:
|
||||
"display_name": _name.text, "slot_count": int(_slots.value),
|
||||
"topology": _topo.selected, "cpu_limit": int(_cpu.value),
|
||||
"cast_interval": _interval.value, "feature_tags": _feat.selected,
|
||||
"mana_max": int(_mana_max.value), "mana_regen": _mana_regen.value,
|
||||
"grid_rows": int(_rows.value), "grid_cols": int(_cols.value), "edges": edges,
|
||||
}
|
||||
_cur = cid
|
||||
@@ -110,7 +117,8 @@ func _on_new() -> void:
|
||||
var i := 1
|
||||
while _data.has(cid): cid = "new_core_%d" % i; i += 1
|
||||
_data[cid] = {"display_name": cid, "slot_count": 5, "topology": 0,
|
||||
"cpu_limit": 5, "cast_interval": 0.5, "feature_tags": 0, "edges": []}
|
||||
"cpu_limit": 5, "cast_interval": 0.5, "feature_tags": 0,
|
||||
"mana_max": 100, "mana_regen": 5, "edges": []}
|
||||
_refresh()
|
||||
|
||||
func _on_delete() -> void:
|
||||
|
||||
@@ -8,10 +8,10 @@ const TYPE_NAMES: Array = ["ACTION", "MODIFIER", "TRIGGER", "LOGIC"]
|
||||
|
||||
## meta 模板(按类型“插入模板”用)
|
||||
const META_TEMPLATES: Dictionary = {
|
||||
0: '{ "base_damage": 5.0, "speed": 350.0, "lifetime": 4.0, "radius": 6.0, "damage_type": 0, "shop_cost": 20 }',
|
||||
1: '{ "damage_add": 10.0, "shop_cost": 20 }',
|
||||
2: '{ "base_damage": 3.0, "speed": 250.0, "lifetime": 4.0, "radius": 6.0, "damage_type": 0, "shop_cost": 30 }',
|
||||
3: '{ "logic_op": "every_n_shots", "n": 3, "reg": 0, "shop_cost": 24 }',
|
||||
0: '{ "base_damage": 5.0, "speed": 350.0, "lifetime": 4.0, "radius": 6.0, "damage_type": 0, "mana_cost": 5, "shop_cost": 20 }',
|
||||
1: '{ "damage_add": 10.0, "mana_cost": 10, "shop_cost": 20 }',
|
||||
2: '{ "base_damage": 3.0, "speed": 250.0, "lifetime": 4.0, "radius": 6.0, "damage_type": 0, "mana_cost": 10, "shop_cost": 30 }',
|
||||
3: '{ "logic_op": "every_n_shots", "n": 3, "reg": 0, "mana_cost": 0, "shop_cost": 24 }',
|
||||
}
|
||||
|
||||
var _spells: Dictionary = {} # { id: {type, display_name, description, element_tags, meta} }
|
||||
|
||||
Reference in New Issue
Block a user