fix(mana): LOOP 体 / CIRCUIT 分支节点也扣蓝(堵住免蓝重复施法漏洞)
This commit is contained in:
@@ -563,6 +563,9 @@ func _run_logic_loop(node: SpellNode, ctx: SpellContext, spawn_pos: Vector2,
|
|||||||
ops_count += 1
|
ops_count += 1
|
||||||
if ops_count >= max_ops:
|
if ops_count >= max_ops:
|
||||||
return ops_count
|
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:
|
match n.type:
|
||||||
SpellNode.SpellType.ACTION:
|
SpellNode.SpellType.ACTION:
|
||||||
_push_projectile(n, ctx, spawn_pos, -1)
|
_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_rad: float = s.radius_mult
|
||||||
var b_crit: float = s.crit_chance
|
var b_crit: float = s.crit_chance
|
||||||
for node in nodes:
|
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:
|
match node.type:
|
||||||
SpellNode.SpellType.ACTION:
|
SpellNode.SpellType.ACTION:
|
||||||
_push_projectile(node, ctx, spawn_pos, -1)
|
_push_projectile(node, ctx, spawn_pos, -1)
|
||||||
|
|||||||
Reference in New Issue
Block a user