iter51-卡2
This commit is contained in:
1 parent
1cd6e2b1b0
commit
372b4fdc31
27 files changed
+1231
-356
No files matched your search
@@ -668,7 +668,7 @@ func _smoke_feats() -> void:
|
||||
apply_fx.call(fx.dispatch(orch.fx_host().counters_ctx, "mine_hit", {}))
|
||||
var pm_hits: Array = fx.dispatch(orch.fx_host().counters_ctx, "attack_commit", {"atk": 10, "target": "敌", "matchup": "", "dig_streak": 0, "nest_count": 0})
|
||||
var pm_bonus := 0
|
||||
for h in orch._hits_of(pm_hits, "attack_bonus"):
|
||||
for h in DamageController.hits_of(pm_hits, "attack_bonus"):
|
||||
pm_bonus = EffectEngine.counter(orch.fx_host().counters_ctx, String(h.get("value_counter", "")))
|
||||
Kit.check("疼痛记忆:攻击附加层值伤害=层值 2·用后清零(set 行随施加面)〔专长批 V3〕", pm_bonus == 2)
|
||||
fx.rebuild(["fuse_wire"], [], {})
|
||||
@@ -688,7 +688,7 @@ func _smoke_feats() -> void:
|
||||
apply_fx.call(fx.dispatch(orch.fx_host().counters_ctx, "mine_hit", {}))
|
||||
var ti_hits: Array = fx.dispatch(orch.fx_host().counters_ctx, "attack_commit", {"atk": 10, "target": "敌", "matchup": "", "dig_streak": 0, "nest_count": 0})
|
||||
var ti_val := 0
|
||||
for h in orch._hits_of(ti_hits, "attack_bonus"):
|
||||
for h in DamageController.hits_of(ti_hits, "attack_bonus"):
|
||||
ti_val = EffectEngine.counter(orch.fx_host().counters_ctx, String(h.get("value_counter", "")))
|
||||
Kit.check("陷阱本能:踩雷本轮攻击 +2(attack_bonus 通道——面板加算)〔专长批 V3〕", ti_val == 2)
|
||||
fx.rebuild(["chain_traps", "pain_memory"], [], {})
|
||||
@@ -724,7 +724,7 @@ func _smoke_feats() -> void:
|
||||
EffectEngine.counter_add(orch.fx_host().counters_ctx, "stop_swap", 4) # value_event="ap_left" 解析归施加面(action_economy 载荷取值)——冒烟手动落账
|
||||
Kit.check("弃图兑换:停手剩余 AP≥3 入账〔专长批 V3〕", _hits_kind(me_hits, "counter_add").size() == 1)
|
||||
var me_atk := 0
|
||||
for h in orch._hits_of(fx.dispatch(orch.fx_host().counters_ctx, "attack_commit", {"atk": 10, "target": "敌", "matchup": "", "dig_streak": 0, "nest_count": 0}), "attack_bonus"):
|
||||
for h in DamageController.hits_of(fx.dispatch(orch.fx_host().counters_ctx, "attack_commit", {"atk": 10, "target": "敌", "matchup": "", "dig_streak": 0, "nest_count": 0}), "attack_bonus"):
|
||||
me_atk = EffectEngine.counter(orch.fx_host().counters_ctx, String(h.get("value_counter", "")))
|
||||
Kit.check("弃图兑换:折为攻击伤害=剩余 AP 全额·用后清零〔专长批 V3〕", me_atk == 4)
|
||||
Kit.check("弃图兑换反例:剩余 AP<3 不触发〔专长批 V3〕", _hits_kind(fx.dispatch(orch.fx_host().counters_ctx, "dig_stop", {"ap_left": 2}), "counter_add").is_empty())
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
# tests/unit/core/encapsulation_sweep_test.gd — 架构审查 5.1 封装修复·五处结构性零命中扫描宿主
|
||||
# 断言面 = 七段断言组(全部带「扫描面非空前置+正锚」——非空防扫描面为空静默绿,正锚证新面在用):
|
||||
# V2 settlement 七文件:非空+class_name 正锚+\boc\b 全文零命中(段类对编排器引用归零,含头注)
|
||||
# V3 battle_orchestrator:非空+搬家五方法定义零命中(宿主原方法删除禁留壳)
|
||||
# V4 adventure_runner:非空+_bp_store._ 零命中+bp_read 正锚(公开面在用)
|
||||
# V5 save_manager:非空+slots._ 零命中+active_path 正锚;slot_store:非空+_save._ 零命中+公开面正锚
|
||||
# V6 grant_segment:非空+两 fx 私键零命中+mark_new_resource_type 正锚
|
||||
# V7 config_db:非空+._resolver 直写零命中+bind_resolver 正锚
|
||||
# 手法沿 player_copy_sweep_test 源 token 扫描先例(不并件——扫描面归属与尾缀语义本批特有)。
|
||||
# 运行:godot --headless --path game --script res://tests/unit/core/encapsulation_sweep_test.gd
|
||||
extends SceneTree
|
||||
|
||||
const Kit := preload("res://tests/unit/test_kit.gd")
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
_sweep_settlement_segments()
|
||||
_sweep_orchestrator_methods()
|
||||
_sweep_breakpoint_pair()
|
||||
_sweep_save_pair()
|
||||
_sweep_fx_host_accumulators()
|
||||
_sweep_config_resolver()
|
||||
quit(Kit.finish("encapsulation_sweep_test"))
|
||||
|
||||
|
||||
# 源文件读取+非空前置(返 "" 即已判红——调用侧跳过后续正则断言)
|
||||
func _src(path: String) -> String:
|
||||
var src := FileAccess.get_file_as_string(path)
|
||||
Kit.check("扫描面非空前置:%s" % path, src.length() > 0)
|
||||
return src
|
||||
|
||||
|
||||
# 正则零命中断言(-pattern 意图写入断言文案——可 grep 定位)
|
||||
func _zero(pattern: String, src: String, label: String, path: String) -> void:
|
||||
var re := RegEx.create_from_string(pattern)
|
||||
Kit.check("%s:%s 零命中〔封装5.1〕" % [label, pattern], re.search(src) == null)
|
||||
|
||||
|
||||
# 正锚在案断言(正则命中 ≥1——新公开面/新形态在用)
|
||||
func _anchor(pattern: String, src: String, label: String, path: String) -> void:
|
||||
var re := RegEx.create_from_string(pattern)
|
||||
Kit.check("%s:%s 正锚在案〔封装5.1〕" % [label, pattern], re.search(src) != null)
|
||||
|
||||
|
||||
# ① V2 settlement 七文件(束注入换代——对编排器引用归零)
|
||||
func _sweep_settlement_segments() -> void:
|
||||
var classes := {
|
||||
"res://core/settlement/grant_segment.gd": "GrantSegment",
|
||||
"res://core/settlement/combat_segment.gd": "CombatSegment",
|
||||
"res://core/settlement/round_cycle.gd": "RoundCycle",
|
||||
"res://core/settlement/verdict_segment.gd": "VerdictSegment",
|
||||
"res://core/settlement/battle_refresh_flow.gd": "BattleRefreshFlow",
|
||||
"res://core/settlement/aura_segment.gd": "AuraSegment",
|
||||
"res://core/settlement/decay_segment.gd": "DecaySegment",
|
||||
}
|
||||
for path in classes:
|
||||
var src := _src(path)
|
||||
if src.length() == 0:
|
||||
continue
|
||||
_anchor("class_name %s" % classes[path], src, "class_name 正锚(%s)" % classes[path], path)
|
||||
_zero("\\boc\\b", src, "对编排器标识符全归零(%s)" % classes[path], path)
|
||||
|
||||
|
||||
# ② V3 编排器搬家五方法零残留
|
||||
func _sweep_orchestrator_methods() -> void:
|
||||
var src := _src("res://core/battle_orchestrator.gd")
|
||||
if src.length() == 0:
|
||||
return
|
||||
_zero("func _hero_atk\\(|func _feat_yield_adjust\\(|func _harmful_variants\\(|func _harmful_adjacent\\(|func _hits_of\\(",
|
||||
src, "编排器搬家五方法定义零残留(宿主删除禁留壳)", "res://core/battle_orchestrator.gd")
|
||||
|
||||
|
||||
# ③ V4 断点域(adventure_runner → BreakpointStore 公开面)
|
||||
func _sweep_breakpoint_pair() -> void:
|
||||
var src := _src("res://core/adventure_runner.gd")
|
||||
if src.length() == 0:
|
||||
return
|
||||
_zero("_bp_store\\._", src, "宿主对断点件私取归零", "res://core/adventure_runner.gd")
|
||||
_anchor("_bp_store\\.bp_read\\(", src, "断点公开读侧在用", "res://core/adventure_runner.gd")
|
||||
|
||||
|
||||
# ④ V5 存档双向公开面(save_manager↔slot_store)
|
||||
func _sweep_save_pair() -> void:
|
||||
var src_m := _src("res://core/save_manager.gd")
|
||||
if src_m.length() > 0:
|
||||
_zero("slots\\._", src_m, "save_manager 对槽位件私取归零", "res://core/save_manager.gd")
|
||||
_anchor("slots\\.active_path\\(\\)", src_m, "槽路径读投影在用", "res://core/save_manager.gd")
|
||||
var src_s := _src("res://core/slot_store.gd")
|
||||
if src_s.length() > 0:
|
||||
_zero("_save\\._", src_s, "slot_store 反向私取归零", "res://core/slot_store.gd")
|
||||
_anchor("_save\\.(set_read_only|read_only|reset_to_default|data_snapshot|restore_data|peek_summary_at|rename_overwrite)",
|
||||
src_s, "存档公开承接面在用", "res://core/slot_store.gd")
|
||||
|
||||
|
||||
# ⑤ V6 效果宿主累积面(grant → BattleFxHost 公开累积方法)
|
||||
func _sweep_fx_host_accumulators() -> void:
|
||||
var src := _src("res://core/settlement/grant_segment.gd")
|
||||
if src.length() == 0:
|
||||
return
|
||||
_zero("_fx_new_resource_types|_fx_bonus_delta", src, "授予段对效果宿主私键直写归零", "res://core/settlement/grant_segment.gd")
|
||||
_anchor("mark_new_resource_type\\(", src, "首见登记公开方法在用", "res://core/settlement/grant_segment.gd")
|
||||
|
||||
|
||||
# ⑥ V7 配置挂载面(config_db → 三 schema bind_resolver)
|
||||
func _sweep_config_resolver() -> void:
|
||||
var src := _src("res://core/config_db.gd")
|
||||
if src.length() == 0:
|
||||
return
|
||||
_zero("\\._resolver\\s*=", src, "解析协作件直写归零", "res://core/config_db.gd")
|
||||
_anchor("bind_resolver\\(_resolver\\)", src, "挂载口在用", "res://core/config_db.gd")
|
||||
@@ -0,0 +1 @@
|
||||
uid://dq1huyomw37m2
|
||||
@@ -15,23 +15,33 @@ func _init() -> void:
|
||||
quit(1)
|
||||
return
|
||||
|
||||
# V4-1 段类直接 new()(构造收宿主引用——五类同构)
|
||||
# V4-1 段类直接 new()(引用束注入——编排器 _init 同款 20 键束组装,逐段 new(bundle) 成功断言)
|
||||
var oc = load("res://core/battle_orchestrator.gd").new(db, load("res://core/rng_service.gd").new())
|
||||
Kit.check_quiet(load("res://core/settlement/grant_segment.gd").new(oc, oc.fx_host(), oc.reward_grant()) != null, "V4 GrantSegment 直接 new()〔迭代27 T2〕")
|
||||
Kit.check_quiet(load("res://core/settlement/aura_segment.gd").new(oc) != null, "V4 AuraSegment 直接 new()〔迭代27 T2〕")
|
||||
Kit.check_quiet(load("res://core/settlement/combat_segment.gd").new(oc, oc.fx_host(), oc.reward_grant()) != null, "V4 CombatSegment 直接 new()〔迭代27 T2〕")
|
||||
Kit.check_quiet(load("res://core/settlement/decay_segment.gd").new(oc) != null, "V4 DecaySegment 直接 new()〔迭代27 T2〕")
|
||||
Kit.check_quiet(load("res://core/settlement/verdict_segment.gd").new(oc) != null, "V4 VerdictSegment 直接 new()〔迭代27 T2〕")
|
||||
var seg_bundle: Dictionary[Variant, Variant] = {
|
||||
"facts": oc._facts, "units": oc._enemy_system, "damage": oc._damage,
|
||||
"status_effects": oc._status_effects, "reward_economy": oc._reward_economy,
|
||||
"reward_grant": oc.reward_grant(), "fx_host": oc.fx_host(), "minesweeper": oc.minesweeper,
|
||||
"db": oc.db, "action_economy": oc.action_economy, "rng": oc.rng,
|
||||
"emit_row_cb": oc._emit_row, "fatal_cb": oc._fatal, "install_cb": oc._install_and_reset,
|
||||
"battle_over_cb": oc._battle_over, "exit_distribution_cb": oc._exit_distribution,
|
||||
"emit_snapshot_cb": oc._emit_settlement_snapshot, "emit_composition_cb": oc._emit_composition_effects,
|
||||
"attune_param_sum_cb": oc.attune_param_sum, "perfect_sweep_cb": oc.perfect_sweep_earned,
|
||||
}
|
||||
Kit.check_quiet(load("res://core/settlement/grant_segment.gd").new(seg_bundle) != null, "V4 GrantSegment 束构造〔迭代27 T2〕")
|
||||
Kit.check_quiet(load("res://core/settlement/aura_segment.gd").new(seg_bundle) != null, "V4 AuraSegment 束构造〔迭代27 T2〕")
|
||||
Kit.check_quiet(load("res://core/settlement/combat_segment.gd").new(seg_bundle) != null, "V4 CombatSegment 束构造〔迭代27 T2〕")
|
||||
Kit.check_quiet(load("res://core/settlement/decay_segment.gd").new(seg_bundle) != null, "V4 DecaySegment 束构造〔迭代27 T2〕")
|
||||
Kit.check_quiet(load("res://core/settlement/verdict_segment.gd").new(seg_bundle) != null, "V4 VerdictSegment 束构造〔迭代27 T2〕")
|
||||
|
||||
# V4-2 编排器 _init 接线(段持宿主引用;段序编排面在位)——注册面批同代归约 V1:
|
||||
# V4-2 编排器 _init 接线(段持注入引用同一性——宿主回指对象随束注入退役;段序编排面在位):
|
||||
# 段件宿主直持改经 _rounds(轮循环驱动件)承载,接线断言改指 _rounds 段族
|
||||
Kit.check_quiet(oc._rounds != null and oc._rounds.oc == oc, "V1 编排器接线·轮循环驱动件在座且宿主回指〔编排归约 V1〕")
|
||||
Kit.check_quiet(oc._rounds != null and oc._rounds.facts == oc._facts, "V1 编排器接线·轮循环驱动件在座且束注入同一性〔编排归约 V1〕")
|
||||
Kit.check_quiet(oc._facts != null, "V1 编排器接线·战斗事实件在座〔编排归约 V1〕")
|
||||
Kit.check_quiet(oc._rounds._grant_seg != null and oc._rounds._grant_seg.oc == oc, "V4 编排器接线·授予段(宿主回指)〔迭代27 T2〕")
|
||||
Kit.check_quiet(oc._rounds._aura_seg != null and oc._rounds._aura_seg.oc == oc, "V4 编排器接线·增益/减益段〔迭代27 T2〕")
|
||||
Kit.check_quiet(oc._rounds._combat_seg != null and oc._rounds._combat_seg.oc == oc, "V4 编排器接线·战斗段〔迭代27 T2〕")
|
||||
Kit.check_quiet(oc._rounds._decay_seg != null and oc._rounds._decay_seg.oc == oc, "V4 编排器接线·衰减段〔迭代27 T2〕")
|
||||
Kit.check_quiet(oc._rounds._verdict_seg != null and oc._rounds._verdict_seg.oc == oc, "V4 编排器接线·判定段〔迭代27 T2〕")
|
||||
Kit.check_quiet(oc._rounds._grant_seg != null and oc._rounds._grant_seg.facts == oc._facts, "V4 编排器接线·授予段(束注入同一性·facts)〔迭代27 T2〕")
|
||||
Kit.check_quiet(oc._rounds._aura_seg != null and oc._rounds._aura_seg.emit_composition_cb.get_object() == oc, "V4 编排器接线·增益/减益段(回调对象同一性)〔迭代27 T2〕")
|
||||
Kit.check_quiet(oc._rounds._combat_seg != null and oc._rounds._combat_seg.fx_host == oc.fx_host(), "V4 编排器接线·战斗段(束注入同一性·fx_host)〔迭代27 T2〕")
|
||||
Kit.check_quiet(oc._rounds._decay_seg != null and oc._rounds._decay_seg.status_effects == oc._status_effects, "V4 编排器接线·衰减段(束注入同一性·status_effects)〔迭代27 T2〕")
|
||||
Kit.check_quiet(oc._rounds._verdict_seg != null and oc._rounds._verdict_seg.units == oc._enemy_system, "V4 编排器接线·判定段(束注入同一性·units)〔迭代27 T2〕")
|
||||
# counter_add 写口真实路径(geologist 订阅行承载:公共命令链 begin_battle→move→dig→stop
|
||||
# 经授予段 counter_add 单点落 counters_ctx battle 桶——受理载荷+公开读数口 fx_host().counters_ctx)
|
||||
var rng_c = load("res://core/rng_service.gd").new()
|
||||
|
||||
Reference in new issue
Block a user