From d3f399061ac53c42bd3fbca84ccb952d60a2d4e0 Mon Sep 17 00:00:00 2001 From: wusumac <736139669@qq.com> Date: Wed, 16 Sep 2026 17:38:00 +0800 Subject: [PATCH] feat(m80-i20): implement the equipment movement effect class --- docs/EVIDENCE_LEDGER.md | 1 + docs/plans/M80_BATTLE_SIMULATION.md | 3 +++ runtime/domain/battle_simulation.gd | 21 ++++++++++++++++----- runtime/domain/equipment_hooks.gd | 21 ++++++++++----------- runtime/tests/battle/movement_test.gd | 20 +++++++++++++++++++- 5 files changed, 49 insertions(+), 17 deletions(-) diff --git a/docs/EVIDENCE_LEDGER.md b/docs/EVIDENCE_LEDGER.md index df0213a2..28e30b64 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-I20 装备 movement 效果类(推/拉/蓄势/前压) | `feat(m80-i20)` | runtime_verified | implemented 233→241;位移门 `bonus=applied`;六门绿 | | 2026-09-16 | M80-I19 钩子站点:on_critical / on_barrier_break | `feat(m80-i19)` | runtime_verified | 四门绿 | | 2026-09-16 | M80-I18 钩子站点补齐(on_fallen/after_collapse/on_advance) | `feat(m80-i18)` | runtime_verified | 六门绿;死亡触发写入 `death_trigger` | | 2026-09-16 | M80-I17 敌人签名机制接通(before_target/on_protection_change/on_push 站点) | `feat(m80-i17)` | runtime_verified | `signature_events=12`;全流程/三周目/探针绿 | diff --git a/docs/plans/M80_BATTLE_SIMULATION.md b/docs/plans/M80_BATTLE_SIMULATION.md index 4f2082b6..8840b2c1 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-I20` | RESOLVED(2026-09-16)| 装备效果类 ③ **位移**:`movement` 类落地——推/拉距离 + 前进后蓄势(`momentum_bonus` 下一次位移消耗) + 与命中后前压(`after_damage`);8 行改点(EQ-005/006/017/101/103/112/114/118),implemented 233→241; + 位移门新增断言 `bonus=applied`(带 `movement_bonus` 的推击实测多走一步)。EQ-317(`after_collapse`)维持未实现 | | `M80-I19` | RESOLVED(2026-09-16)| 钩子站点再补两个:`on_critical`(暴击为该次攻击加值)、`on_barrier_break`(护盾池被一次打空时回填)。 剩余未接站点均为无声明行的钩子(`on_signature`/`on_summon`/`on_withdraw` 等) | | `M80-I18` | RESOLVED(2026-09-16)| 钩子站点补齐:`on_fallen` / `after_collapse`(倒下时对幸存者结算并记 `death_trigger`)、 diff --git a/runtime/domain/battle_simulation.gd b/runtime/domain/battle_simulation.gd index c772596d..fc982913 100644 --- a/runtime/domain/battle_simulation.gd +++ b/runtime/domain/battle_simulation.gd @@ -270,9 +270,15 @@ func _resolve_attack(actor: Dictionary, target: Dictionary, action: Dictionary) if not declared.is_empty(): hook_status = declared _apply_status(target, actor, hook_status, {"tick": tick, "actor": str(actor.id), "target": str(target.id)}) - var guard_bonus := int(_trait_effect(actor, "after_damage").get("guard_bonus", 0)) - if guard_bonus > 0: - actor.guard = int(actor.guard) + guard_bonus + var follow_up := _trait_effect(actor, "after_damage") + if int(follow_up.get("guard_bonus", 0)) > 0: + actor.guard = int(actor.guard) + int(follow_up.guard_bonus) + if int(follow_up.get("movement_bonus", 0)) > 0: + var step_from := int(actor.position) + if _forced_swap(actor, -1): + journal.append({"tick": tick, "actor": str(actor.id), "target": str(actor.id), + "kind": "movement", "steps": 1, "from": step_from, "to": int(actor.position), + "hp_after": int(actor.hp)}) if int(bonuses.get("resource_gain", 0)) > 0: actor.resource = int(actor.resource) + int(bonuses.resource_gain) var crit_bp: int = int(damage_preview(actor, target, action).crit_chance_bp) @@ -674,7 +680,10 @@ func _apply_forced_movement(victim: Dictionary, source: Dictionary, push: int, p # Immovable actor or the line boundary deals one collision event: # max(1, floor(0.08 * source PhysicalPower)). var direction := 1 if push > 0 else -1 - var steps := maxi(push, pull) + var push_hook := "on_push" if direction > 0 else "on_pull" + var banked := int(source.get("momentum_bonus", 0)) + source.momentum_bonus = 0 + var steps := maxi(push, pull) + int(_trait_effect(source, push_hook).get("movement_bonus", 0)) + banked var from_position := int(victim.position) var moved := 0 var blocked := false @@ -687,6 +696,8 @@ func _apply_forced_movement(victim: Dictionary, source: Dictionary, push: int, p var advance := _trait_effect(victim, "on_advance") if int(advance.get("guard_bonus", 0)) > 0: victim.guard = int(victim.guard) + int(advance.guard_bonus) + if int(advance.get("movement_bonus", 0)) > 0: + victim.momentum_bonus = int(victim.get("momentum_bonus", 0)) + int(advance.movement_bonus) if moved > 0: journal.append({ "tick": tick, @@ -762,7 +773,7 @@ func _trait_effect(actor: Dictionary, hook: String) -> Dictionary: # declarative effect. Unimplemented rows are skipped until their system lands. var total := {"reach_bonus": 0, "damage_bonus": 0, "guard_bonus": 0, "heal_bonus": 0, "resource_gain": 0, "haste": 0, "damage_reduction": 0, "tempo_bonus": 0, - "status_apply": 0} + "status_apply": 0, "movement_bonus": 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 19ae33b6..3a541ed0 100644 --- a/runtime/domain/equipment_hooks.gd +++ b/runtime/domain/equipment_hooks.gd @@ -53,12 +53,12 @@ const EFFECT_KEYWORDS := [ ## section-17 hook that owns their decision. Kinds outside the simulation's ## applied set stay `implemented: false` so the gap is visible, never guessed. const EXPLICIT := { - "EQ-005": {"hook": "on_pull", "kind": "movement", "implemented": false}, - "EQ-006": {"hook": "on_pull", "kind": "movement", "implemented": false}, + "EQ-005": {"hook": "on_pull", "kind": "movement", "implemented": true}, + "EQ-006": {"hook": "on_pull", "kind": "movement", "implemented": true}, "EQ-010": {"hook": "on_advance", "kind": "mark", "implemented": false}, "EQ-015": {"hook": "on_advance", "kind": "cooldown", "implemented": false}, "EQ-016": {"hook": "on_advance", "kind": "cooldown", "implemented": false}, - "EQ-017": {"hook": "on_pull", "kind": "movement", "implemented": false}, + "EQ-017": {"hook": "on_pull", "kind": "movement", "implemented": true}, "EQ-018": {"hook": "on_advance", "kind": "cooldown", "implemented": false}, "EQ-020": {"hook": "on_advance", "kind": "protection", "implemented": false}, "EQ-022": {"hook": "on_cast_complete", "kind": "mark", "implemented": false}, @@ -79,13 +79,13 @@ const EXPLICIT := { "EQ-090": {"hook": "before_cast", "kind": "interrupt", "implemented": false}, "EQ-095": {"hook": "before_target", "kind": "reach_bonus", "implemented": false}, "EQ-097": {"hook": "on_summon", "kind": "reach_bonus", "implemented": false}, - "EQ-101": {"hook": "on_advance", "kind": "movement", "implemented": false}, - "EQ-103": {"hook": "after_damage", "kind": "movement", "implemented": false}, + "EQ-101": {"hook": "on_advance", "kind": "movement", "implemented": true}, + "EQ-103": {"hook": "after_damage", "kind": "movement", "implemented": true}, "EQ-104": {"hook": "on_advance", "kind": "haste", "implemented": false}, "EQ-108": {"hook": "after_collapse", "kind": "delay", "implemented": false}, - "EQ-112": {"hook": "on_advance", "kind": "movement", "implemented": false}, - "EQ-114": {"hook": "on_push", "kind": "movement", "implemented": false}, - "EQ-118": {"hook": "on_advance", "kind": "movement", "implemented": false}, + "EQ-112": {"hook": "on_advance", "kind": "movement", "implemented": true}, + "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}, "EQ-148": {"hook": "on_status_apply", "kind": "status", "implemented": false}, "EQ-154": {"hook": "on_status_expire", "kind": "status", "implemented": false}, @@ -147,7 +147,7 @@ const EXPLICIT := { const IMPLEMENTED_KINDS := ["guard_bonus", "heal_bonus", "reach_bonus", "resource_gain", - "damage_bonus", "haste", "damage_reduction", "tempo_bonus"] + "damage_bonus", "haste", "damage_reduction", "tempo_bonus", "movement"] static func classify(effect_text: String, tradeoff_text := "") -> Dictionary: @@ -181,8 +181,7 @@ static func table(catalog: Dictionary) -> Dictionary: var classified := classify(String(entry.get("effect", "")), String(entry.get("tradeoff", ""))) var hook := String(classified.hook) var kind := String(classified.kind) - var implemented := kind in ["guard_bonus", "heal_bonus", "reach_bonus", "resource_gain", - "damage_bonus", "haste", "damage_reduction", "tempo_bonus"] + var implemented := kind in IMPLEMENTED_KINDS var named: Dictionary = EXPLICIT.get(item_id, {}) if not named.is_empty(): hook = String(named.get("hook", hook)) diff --git a/runtime/tests/battle/movement_test.gd b/runtime/tests/battle/movement_test.gd index 536a9787..a868793b 100644 --- a/runtime/tests/battle/movement_test.gd +++ b/runtime/tests/battle/movement_test.gd @@ -17,8 +17,9 @@ func _run() -> void: _verify_push_swaps() _verify_pull_swaps() _verify_blocked_collision() + _verify_movement_bonus() if failures.is_empty(): - print("ABG_M80_MOVEMENT_OK push=swaps pull=swaps collision=formula immovable=blocks") + print("ABG_M80_MOVEMENT_OK push=swaps pull=swaps collision=formula immovable=blocks bonus=applied") quit(0) return for failure in failures: @@ -47,6 +48,23 @@ func _enemy(enemy_id: String, position: int, extra := {}) -> Dictionary: return row +func _verify_movement_bonus() -> void: + # An equipment row declaring the movement kind extends the owner's push. + var action := {"id": "shove", "base": 0, "coefficient": 0.0, "power_source": "physical_power", + "kind": "damage", "reach": 1, "target": "frontmost", "push": 1} + var row := _ally(action) + row["equipment_hooks"] = [{"hook": "on_push", "implemented": true, + "effect": {"kind": "movement_bonus", "value": 1, "scope": "test"}}] + var simulation: ABGBattleSimulation = Simulation.new() + simulation.setup("movement-bonus", [row], + [_enemy("front", 0), _enemy("second", 1), _enemy("third", 2), _enemy("fourth", 3)]) + simulation.run() + var moved := _first_movement(simulation.journal) + _expect(not moved.is_empty(), "a movement-bonus push records a movement event") + if not moved.is_empty(): + _expect(int(Dictionary(moved).get("to", -1)) == 2, "a declared movement bonus extends the push by one step") + + func _verify_push_swaps() -> void: var action := {"id": "shove", "base": 0, "coefficient": 0.0, "power_source": "physical_power", "kind": "damage", "reach": 1, "target": "frontmost", "push": 1}