diff --git a/game/tests/unit/core/effect_words_t1_test.gd b/game/tests/unit/core/effect_words_t1_test.gd index f0ce4845..2169b743 100644 --- a/game/tests/unit/core/effect_words_t1_test.gd +++ b/game/tests/unit/core/effect_words_t1_test.gd @@ -93,4 +93,34 @@ func _init() -> void: fx4.counters_seed({"pain_layers": 7}) Kit.check_quiet(fx4.counter("pain_layers") == 7, "seed 回灌:counters_seed 后 adventure 域计数器=7〔专长批 V1〕") + # ⑦ V4——攒层/计数类件跨事件计数(置计数→事件路径→清零点:round_start 重置/用后清零) + var fx5 = EffectEngineScript.new(null) + fx5.rebuild([], [], []) + fx5._push_trigger("test", "round_row", {"on": "mine_hit", + "do": {"kind": "counter_add", "counter_id": "round_mines", "value": 1}}, {}) # 未声明 reset_at——round_start 不重置(声明制对照面) + fx5._push_trigger("test", "spend_row", {"on": "treasure_used", + "do": {"kind": "counter_spend", "counter_id": "round_mines", "value": 1}}, {}) + for h in fx5.dispatch("mine_hit", {}): + if String(h.get("kind", "")) == "counter_add": + fx5.counter_add(String(h.get("counter_id", "")), int(h.get("value", 0))) + for h in fx5.dispatch("mine_hit", {}): + if String(h.get("kind", "")) == "counter_add": + fx5.counter_add(String(h.get("counter_id", "")), int(h.get("value", 0))) + Kit.check_quiet(fx5.counter("round_mines") == 2, "V4:跨事件计数累积(两雷两计)〔专长批 V4〕") + Kit.check_quiet(fx5.counter_spend("round_mines", 1) and fx5.counter("round_mines") == 1, + "V4:counter_spend 写口消耗(用后清零语义承载面)〔专长批 V4〕") + fx5.dispatch("round_start", {"round": 2}) + Kit.check_quiet(fx5.counter("round_mines") == 1, + "V4:非 reset 点计数器不受 round_start 影响(reset_at 声明制——round_mines 未声明重置)〔专长批 V4〕") + var fx6 = EffectEngineScript.new(null) + fx6.rebuild([], [], []) + fx6._push_trigger("test", "reset_row", {"on": "mine_hit", + "do": {"kind": "counter_add", "counter_id": "helm_layers", "value": 1, "reset_at": "round_start"}}, {}) + for h in fx6.dispatch("mine_hit", {}): + if String(h.get("kind", "")) == "counter_add": + fx6.counter_add(String(h.get("counter_id", "")), int(h.get("value", 0))) + fx6.dispatch("round_start", {"round": 2}) + Kit.check_quiet(fx6.counter("helm_layers") == 0, + "V4:round_start 重置点清零(订阅行声明 reset_at——安全帽攒层清零语义)〔专长批 V4〕") + quit(Kit.finish("effect_words_t1"))