diff --git a/docs/EVIDENCE_LEDGER.md b/docs/EVIDENCE_LEDGER.md index de8a7cac..c47af8b6 100644 --- a/docs/EVIDENCE_LEDGER.md +++ b/docs/EVIDENCE_LEDGER.md @@ -17,6 +17,7 @@ | 2026-09-15 | M79-F 区域 6 内容(数据/本地化/立绘/音乐/战场)+ 推进门到第十一份合同 + 注册表测试 R6 计修正 | `feat(m79-f)` `c728a49a`/`a4de1565` | `m79-region6` `20260915T050042Z-16542` | runtime_verified | 240 装备/45 遗物/74 敌人/12 Boss/12 合同/461 本地化;`contracts=11 region=RG-06`;15 marker 各 1 次 | | 2026-09-15 | M79-E 区域 5 内容(数据/本地化/立绘/音乐/战场)+ 推进门到第九份合同 + 注册表验证器修 13 敌人 | `feat(m79-e)` `aff0358b`/`6a9518e3` | `m79-region5` `20260915T023248Z-65213` | runtime_verified | 200 装备/37 遗物/61 敌人/10 Boss/10 合同/395 本地化;`contracts=9 region=RG-05`;15 marker 各 1 次 | | 2026-09-15 | M79-D 区域 4 美术+音乐+接线(含 R2/R3 姿态回填;risk 选项轮询去 flake) | `feat(m79-d)` `5f9723d2` + `test(m79-d)` `c7abcb97` | `m79-region4` `20260915T022134Z-55448` | runtime_verified | 28 张 R4 立绘+卷根战场+`battle_r4`/`boss_r4`;R2/R3 42 条姿态接线回填;15 marker 各 1 次 | +| 2026-09-16 | M80-I32 跨单位标签机制(EQ-148 镜像 / EQ-154 共享清洁) | `feat(m80-i32)` | runtime_verified | 状态门 `mirror=once cleanse=shared`;implemented 272→274 | | 2026-09-16 | M80-I31 打断/防护三类(EQ-062/090/222 转正) | `feat(m80-i31)` | runtime_verified | windup 门 `row_interrupt=true guard=delays`;implemented 269→272;15 门+探针绿 | | 2026-09-16 | M80-I30 站点扩展第二批(reach/heal/haste,9 行) | `feat(m80-i30)` | runtime_verified | implemented 260→269;三条站点断言;14 门+探针绿 | | 2026-09-16 | M80-I29 存留减伤池(EQ-044/EQ-187 转正) | `feat(m80-i29)` | runtime_verified | implemented 258→260;六门绿;池化与声明式等效有断言 | diff --git a/docs/plans/M80_BATTLE_SIMULATION.md b/docs/plans/M80_BATTLE_SIMULATION.md index 1cfd6a34..dc0d3dc2 100644 --- a/docs/plans/M80_BATTLE_SIMULATION.md +++ b/docs/plans/M80_BATTLE_SIMULATION.md @@ -113,6 +113,9 @@ reach/目标选择、Guard/护盾、伤害公式(含暴击与标签化随机 条件 `enemy_major_windup`(major = ≥12 tick);门 `ABG_M80_WINDUP_OK` | | `M80-I14` | RESOLVED(2026-09-15)| 链接落地:`link`/`relink` 字段、`link_id` 绑定、`link_broken` 条件随绑定单位倒下而成立、PF-B08 三行可跑; 门 `ABG_M80_LINK_OK`。**至此 23 个优先条件全部 enabled(pending=0)** | +| `M80-I32` | RESOLVED(2026-09-16)| 跨单位标签机制前两条(2 行):EQ-148 `tag_copy`(戴者身上落下的**第一个**标签,以相反符号镜像给最近敌人,每战一次; + 递归保护=先置"已用"再镜像,两侧都带此件也不会无限回声)、EQ-154 `cleanse_share`(敌方清洁时,对面戴者同步脱落**最老的一条妨碍**,每战一次)。 + implemented 272→274;状态门标记扩为 `mirror=once cleanse=shared`(含"用过后不再触发"的反向断言) | | `M80-I31` | RESOLVED(2026-09-16)| 装备效果类 ⑦ **打断与防护**(3 行):EQ-090 `interrupt_strike`(施法前声明的打断能力在下一次命中生效—— 注意顺序陷阱:**攻击记录构造时取值并清零**,早清零会让记录读到 false,我已按此修正)、EQ-062 `interrupt_guard`(被守卫的蓄力首次被打断改为 `cast_delayed`/`INTERRUPT_GUARD` 并延长一个 MAJOR 窗口)、EQ-222 `movement_immunity`(倒下时让下一名同伴获得不可位移)。 diff --git a/runtime/domain/battle_simulation.gd b/runtime/domain/battle_simulation.gd index 8f72fd88..19660563 100644 --- a/runtime/domain/battle_simulation.gd +++ b/runtime/domain/battle_simulation.gd @@ -675,6 +675,39 @@ func _apply_status(victim: Dictionary, source: Dictionary, status: Dictionary, r journal.append({"tick": tick, "actor": str(source.get("id", "")), "target": str(victim.id), "kind": "status", "status_id": str(entry.id), "sign": sign, "ticks": int(entry.ticks)}) _fire_status_hook(victim, "on_status_apply") + _mirror_tag(victim, source, status) + + +func _mirror_tag(victim: Dictionary, source: Dictionary, status: Dictionary) -> void: + # A tag-copy row mirrors the first tag that lands on its owner onto the + # nearest opponent with the opposite sign, once per battle. The spent flag is + # raised before the mirrored application so two wearers cannot echo forever. + if int(source.side) == int(victim.side) or bool(victim.get("tag_copy_spent", false)): + return + if int(_trait_effect(victim, "on_status_apply").get("tag_copy", 0)) <= 0: + return + var opposing: Array[Dictionary] = enemies if int(victim.side) == Side.ALLY else allies + var nearest := {} + for candidate in opposing: + if bool(candidate.fallen): + continue + if nearest.is_empty() or absi(int(candidate.position) - int(victim.position)) \ + < absi(int(Dictionary(nearest).position) - int(victim.position)): + nearest = candidate + if nearest.is_empty(): + return + victim.tag_copy_spent = true + var sign := String(status.get("sign", "hindrance")) + var mirrored := { + "id": str(status.get("id", "")), + "sign": "boon" if sign == "hindrance" else "hindrance", + "ticks": int(status.get("ticks", 30)), + "chance_bp": 10000, + } + _apply_status(nearest, victim, mirrored, {"tick": tick, "actor": str(victim.id), "target": str(nearest.id)}) + journal.append({"tick": tick, "actor": str(victim.id), "target": str(nearest.id), + "kind": "tag_mirror", "status_id": str(mirrored.id), "sign": str(mirrored.sign), + "reflected_from": str(source.get("id", "")), "amount": 0, "hp_after": int(nearest.hp)}) func _cleanse(victim: Dictionary, source: Dictionary, record: Dictionary) -> void: @@ -691,6 +724,38 @@ func _cleanse(victim: Dictionary, source: Dictionary, record: Dictionary) -> voi journal.append({"tick": tick, "actor": str(source.get("id", "")), "target": str(victim.id), "kind": "status_expire", "status_id": status_id, "expired": true, "hp_after": int(victim.hp)}) _fire_status_hook(victim, "on_status_expire") + _share_cleanse(victim) + + +func _share_cleanse(victim: Dictionary) -> void: + # A cleanse-share row lets the cleansed unit's opposing wearer shed its own + # oldest hindrance at the same moment, once per battle and only while the + # cleansed unit belongs to the other side. + var opposing: Array[Dictionary] = allies if int(victim.side) == Side.ENEMY else enemies + for candidate in opposing: + if bool(candidate.fallen) or bool(candidate.get("cleanse_share_spent", false)): + continue + if int(_trait_effect(candidate, "on_status_expire").get("cleanse_share", 0)) <= 0: + continue + var oldest := "" + for status in Array(candidate.statuses): + var entry: Dictionary = Dictionary(status) + if String(entry.get("sign", "hindrance")) == "hindrance": + oldest = String(entry.get("id", "")) + break + if oldest.is_empty(): + candidate.cleanse_share_spent = true + continue + var kept: Array = [] + for status in Array(candidate.statuses): + if String(Dictionary(status).get("id", "")) != oldest: + kept.append(status) + candidate.statuses = kept + candidate.cleanse_share_spent = true + journal.append({"tick": tick, "actor": str(candidate.id), "target": str(candidate.id), + "kind": "status_expire", "status_id": oldest, "expired": true, "shared_from": str(victim.id), + "hp_after": int(candidate.hp)}) + _fire_status_hook(candidate, "on_status_expire") func _extend_status(victim: Dictionary, source: Dictionary, record: Dictionary) -> void: @@ -855,7 +920,7 @@ func _trait_effect(actor: Dictionary, hook: String) -> Dictionary: "resource_gain": 0, "haste": 0, "damage_reduction": 0, "tempo_bonus": 0, "status_apply": 0, "movement_bonus": 0, "cooldown_cut": 0, "transfer": 0, "neighbor_guard_chip": 0, "rear_guard": 0, "interrupt_strike": 0, - "interrupt_guard": 0, "movement_immunity": 0} + "interrupt_guard": 0, "movement_immunity": 0, "tag_copy": 0, "cleanse_share": 0} for row in Array(actor.get("traits", [])): var entry: Dictionary = Dictionary(row) if not bool(entry.get("implemented", false)) or String(entry.get("hook", "")) != hook: diff --git a/runtime/domain/equipment_hooks.gd b/runtime/domain/equipment_hooks.gd index 4dd27178..40cc8e52 100644 --- a/runtime/domain/equipment_hooks.gd +++ b/runtime/domain/equipment_hooks.gd @@ -87,8 +87,8 @@ const EXPLICIT := { "EQ-114": {"hook": "on_push", "kind": "movement", "implemented": true}, "EQ-118": {"hook": "on_advance", "kind": "movement", "implemented": true}, "EQ-119": {"hook": "on_advance", "kind": "status", "implemented": false, "reason": "missing_system:indexed_opposite_position"}, - "EQ-148": {"hook": "on_status_apply", "kind": "status", "implemented": false, "reason": "missing_system:tag_sign_copy"}, - "EQ-154": {"hook": "on_status_expire", "kind": "status", "implemented": false, "reason": "missing_system:cross_side_cleanse"}, + "EQ-148": {"hook": "on_status_apply", "kind": "tag_copy", "implemented": true}, + "EQ-154": {"hook": "on_status_expire", "kind": "cleanse_share", "implemented": true}, "EQ-155": {"hook": "on_advance", "kind": "status", "implemented": false, "reason": "battle_scoped:mark_duration_preserve"}, "EQ-158": {"hook": "on_status_apply", "kind": "status", "implemented": false}, "EQ-160": {"hook": "on_status_expire", "kind": "immunity", "implemented": false}, @@ -179,7 +179,7 @@ const DECLARED_PENDING_KINDS := { const IMPLEMENTED_KINDS := ["guard_bonus", "heal_bonus", "reach_bonus", "resource_gain", "damage_bonus", "haste", "damage_reduction", "tempo_bonus", "movement", - "interrupt_strike", "interrupt_guard", "movement_immunity"] + "interrupt_strike", "interrupt_guard", "movement_immunity", "tag_copy", "cleanse_share"] static func classify(effect_text: String, tradeoff_text := "") -> Dictionary: diff --git a/runtime/tests/battle/status_test.gd b/runtime/tests/battle/status_test.gd index 83eaf23a..69c9c425 100644 --- a/runtime/tests/battle/status_test.gd +++ b/runtime/tests/battle/status_test.gd @@ -19,8 +19,10 @@ func _run() -> void: _verify_resist_path() _verify_hook_fires() _verify_conditions_follow_state() + _verify_tag_mirror() + _verify_cleanse_share() if failures.is_empty(): - print("ABG_M80_STATUS_OK applied=true resisted=true expired=true hook=fires conditions=follow determinism=true") + print("ABG_M80_STATUS_OK applied=true resisted=true expired=true hook=fires conditions=follow mirror=once cleanse=shared determinism=true") quit(0) return for failure in failures: @@ -28,6 +30,69 @@ func _run() -> void: quit(1) +func _verify_tag_mirror() -> void: + # EQ-148: the first tag that lands on the wearer is mirrored onto the nearest + # opponent with the opposite sign, once. + var strike := {"id": "strike", "base": 4, "coefficient": 1.0, "kind": "damage", "reach": 1, + "target": "frontmost", "power_source": "physical_power"} + var wearer: Dictionary = _actor("ally-0", 0, strike, { + "equipment_hooks": [{"hook": "on_status_apply", "implemented": true, + "effect": {"kind": "tag_copy", "value": 1, "scope": "test"}}]}) + var foe: Dictionary = _actor("enemy-0", 0, strike, {"profession_base_hp": 3000}) + var simulation: ABGBattleSimulation = Simulation.new() + simulation.setup("mirror", [wearer], [foe]) + simulation._apply_status(simulation.allies[0], simulation.enemies[0], + {"id": "tagged", "sign": "hindrance", "ticks": 20, "chance_bp": 10000}, {}) + var mirrored := 0 + var reflected_sign := "" + for record in simulation.journal: + var entry: Dictionary = Dictionary(record) + if str(entry.get("kind", "")) == "tag_mirror": + mirrored += 1 + reflected_sign = str(entry.get("sign", "")) + _expect(mirrored == 1 and reflected_sign == "boon", + "the wearer's first incoming tag is mirrored once with the opposite sign (count=%d sign=%s)" % [mirrored, reflected_sign]) + simulation._apply_status(simulation.allies[0], simulation.enemies[0], + {"id": "tagged", "sign": "hindrance", "ticks": 20, "chance_bp": 10000}, {}) + var again := 0 + for record in simulation.journal: + if str(Dictionary(record).get("kind", "")) == "tag_mirror": + again += 1 + _expect(again == 1, "a spent tag-copy row stops mirroring (count=%d)" % again) + + +func _verify_cleanse_share() -> void: + # EQ-154: the opposing wearer sheds its oldest hindrance when the enemy + # cleanses, once per battle. + var strike := {"id": "strike", "base": 4, "coefficient": 1.0, "kind": "damage", "reach": 1, + "target": "frontmost", "power_source": "physical_power"} + var wearer: Dictionary = _actor("ally-0", 0, strike, { + "equipment_hooks": [{"hook": "on_status_expire", "implemented": true, + "effect": {"kind": "cleanse_share", "value": 1, "scope": "test"}}]}) + var foe: Dictionary = _actor("enemy-0", 0, strike, {"profession_base_hp": 3000}) + var simulation: ABGBattleSimulation = Simulation.new() + simulation.setup("share", [wearer], [foe]) + simulation._apply_status(simulation.allies[0], simulation.enemies[0], + {"id": "tagged", "sign": "hindrance", "ticks": 20, "chance_bp": 10000}, {}) + simulation._cleanse(simulation.enemies[0], simulation.enemies[0], {}) + var shared := 0 + for record in simulation.journal: + var entry: Dictionary = Dictionary(record) + if not str(entry.get("shared_from", "")).is_empty(): + shared += 1 + _expect(shared == 1 and Array(simulation.allies[0].statuses).is_empty(), + "an enemy cleanse sheds the wearer's oldest hindrance once (shared=%d left=%d)" + % [shared, Array(simulation.allies[0].statuses).size()]) + simulation._apply_status(simulation.allies[0], simulation.enemies[0], + {"id": "tagged", "sign": "hindrance", "ticks": 20, "chance_bp": 10000}, {}) + simulation._cleanse(simulation.enemies[0], simulation.enemies[0], {}) + var again := 0 + for record in simulation.journal: + if not str(Dictionary(record).get("shared_from", "")).is_empty(): + again += 1 + _expect(again == 1, "a spent cleanse-share row stops sharing (shared=%d)" % again) + + func _actor(actor_id: String, side_position: int, action: Dictionary, row := {}) -> Dictionary: var base := { "id": actor_id, "position": side_position, "level": 5, "profession_id": "", "trait_ids": [],