fix(mana): LOOP 体 / CIRCUIT 分支节点也扣蓝(堵住免蓝重复施法漏洞)

This commit is contained in:
2026-07-20 16:42:20 +08:00
parent 8a86d35145
commit 8b9565e1ff
@@ -563,6 +563,9 @@ func _run_logic_loop(node: SpellNode, ctx: SpellContext, spawn_pos: Vector2,
ops_count += 1
if ops_count >= max_ops:
return ops_count
var n_cost: float = float(n.meta.get("mana_cost", 0.0))
if n_cost > 0.0 and not PlayerStats.spend_mana(n_cost):
return ops_count # 蓝不足 → 停止整个 LOOP
match n.type:
SpellNode.SpellType.ACTION:
_push_projectile(n, ctx, spawn_pos, -1)
@@ -591,6 +594,9 @@ func _run_branch_payload(payload_id: int, ctx: SpellContext, spawn_pos: Vector2)
var b_rad: float = s.radius_mult
var b_crit: float = s.crit_chance
for node in nodes:
var node_cost: float = float(node.meta.get("mana_cost", 0.0))
if node_cost > 0.0 and not PlayerStats.spend_mana(node_cost):
break # 蓝不足 → 停止本分支
match node.type:
SpellNode.SpellType.ACTION:
_push_projectile(node, ctx, spawn_pos, -1)