feat(attr): 接线 MAX_OPS/移速/施法间隔;法杖 cpu_limit 以加成来源接入

MAX_OPS 由硬编码 40×5 改为读生效 cpu_limit——cores.json 里逐法杖配置的
3/5/6/8 自此生效,法杖间恢复运算力区分度。玩家基准取 0,故小木法杖仍为
5 → 200 步,现有平衡零改动。

法杖份额走 add_modifier 而非调用点相加:否则 hard(50) 只钳制玩家那一份,
法杖份额加在钳制之后可使总值越界。换杖时先 remove_modifiers_from("core")
再 add,防止累积。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-31 11:35:24 +08:00
co-authored by Claude Opus 5
parent 69ddcddba6
commit a3bb778715
3 changed files with 12 additions and 4 deletions
+3
View File
@@ -269,6 +269,9 @@ func _rebuild_wand() -> void:
if n != null:
leech += float(n.meta.get("mana_leech", 0.0))
PlayerStats.mana_leech = leech
# 法杖运算力以加成来源接入(非调用点相加),使 hard 上限作用于生效总值
PlayerStats.remove_modifiers_from("core")
PlayerStats.add_modifier("cpu_limit", "flat", float(_equipped_core.cpu_limit) if _equipped_core else 0.0, "core")
# ── 法杖存档(ProfileManager A/B 槽,ADR-A2)─────────────────
func get_wand_save_data() -> Dictionary:
+2 -3
View File
@@ -4,7 +4,6 @@
## S4:停步蓄力 / 冲刺边沿检测(P6-N69、P6-N36
extends Node
const MOVE_SPEED: float = 200.0
const MOVE_THRESHOLD_NORM: float = 0.1
const CHARGE_TRIGGER_TIME: float = 1.5
@@ -42,7 +41,7 @@ func _handle_movement(delta: float) -> void:
_is_moving = dir.length() > MOVE_THRESHOLD_NORM
if _is_moving:
dir = dir.normalized()
_velocity = dir * MOVE_SPEED
_velocity = dir * PlayerStats.move_speed
else:
_velocity = Vector2.ZERO
_position += _velocity * delta
@@ -85,7 +84,7 @@ func _handle_auto_cast(delta: float) -> void:
func equip_wand(core: CoreDefinition, compiled: CompiledDeck) -> void:
_equipped_core = core
_equipped_compiled = compiled
_cast_interval = core.cast_interval if core else 0.5
_cast_interval = (core.cast_interval if core else 0.5) * PlayerStats.cast_delay_mod
_cast_timer = 0.0
if core:
PlayerStats.set_mana_pool(core.base_mana_max, core.base_mana_regen)
@@ -329,7 +329,13 @@ func execute_compiled(compiled: CompiledDeck, caster_id: int, spawn_pos: Vector2
var heat_mult: float = 1.0 + PlayerStats.mana_heat
var deck: SpellDeck = compiled.make_runtime_deck()
var ops_count: int = 0
var max_ops: int = MAX_OPS_PER_CPU * 5
# 生效 cpu_limit 已含法杖份额(combat_manager 以 source="core" 的加成接入)
# 0 守卫:cpu_limit=0 意味着所有法术执行零步、全局静默失效。此处是该故障唯一可观测处,
# 能同时兜住上游两种失败(attributes.json 缺失 → 裸字段停在 0add_modifier 的 attr_id 打错 →
# "core" 份额没注入),而根因处的报错够不到这两种。
if PlayerStats.cpu_limit <= 0:
push_error("SpellEvaluator: PlayerStats.cpu_limit=%d,法术将无法执行;检查 attributes.json 与 _rebuild_wand 的 core 加成注入" % PlayerStats.cpu_limit)
var max_ops: int = MAX_OPS_PER_CPU * maxi(PlayerStats.cpu_limit, 1)
var actions_remaining: int = 1 # 初始为 1,由 multicast_count 加成
while deck.has_next() and ops_count < max_ops:
ops_count += 1