伤害预览 / Damage Preview 预览图

杀戮尖塔 2 (Slay the Spire 2)

伤害预览 / Damage Preview

最后更新 2026/11/15文件 153.6 KBID 3809166825

模组简介

拖动攻击卡并悬停敌人时,在敌人旁显示这次伤害的完整算式: 基础值 → 每一项增/减伤(带来源图标)→ 最终伤害。 按 Alt 在「简洁 / 详细 / 关闭」之间循环切换。 ■ 显示的是什么 Hook.ModifyDamage 全部修正跑完、扣格挡之前的值——也就是「这次攻击会造成多少伤害」。 力量、易伤、虚弱、无实体、附魔等一切走标准伤害钩子的来源都会计入,并显示对应图标, 绿色为增伤、红色为减伤。 多段卡逐段计算后相加,并显示「×N 总计」。每一段用自己那一段的状态重算,所以段间 会变的机制(逐段递减的层数、逐段被消耗的格挡)也能算对。段数读不出来时会标注 「共多段(段数未声明)」,而不是假装它只打一下。 算式末尾出现「13.5 → 13」是正常的:游戏按整数结算,箭头前是算式的精确结果(灰色), 箭头后才是真正打出的伤害(按与基础值的比较着色)。 ■ 兼容性 只依赖游戏本体,不需要任何前置模组。 凡使用标准伤害钩子的模组(含自定义能力、遗物、附魔)都会被自动计入,无需专门适配。 若你装有提供「斩击/突刺/打击」属性抗性的模组:算式中会自动多出一项带图标的抗性乘区, 与实战结算对得上。这类抗性不经过任何伤害钩子,本模组靠自动探测接上, 探测不到就静默退回原行为——**它是可选的,不是依赖**。 若你同时装有「废墟图书馆 Library Of Ruina」:它自带同款预览,两个浮窗会并排显示 (本模组检测到它之后会主动让到敌人另一侧,不会互相盖住)。这是有意保留的—— 两份算式放在一起,正好可以看出哪一边算错了。想只看一份请自行关闭其一。 ■ 联机 本模组标记为非玩法类模组,与未安装的玩家联机不会阻断连接 (游戏明确允许非玩法类模组不一致)。 ■ 给 mod 作者 两个口,完整契约(发现方式、类型纪律、返回值规则、示例)随包发布: 接口.md 请以那份文件为准。 ① **推演隔离协议(必须遵守)** 本模组的推演会在沙盒里真跑一遍原版伤害逻辑。影子层能拦住原版状态,但拦不住 **第三方自己的数据**——所以第三方必须问一句「现在是不是在推演」: ★ 本版起另加一层**字段级快照**做兜底:推演前把对象(生物、怪物模型、每个能力)的 可变实例字段整批存下、推演后整批写回。你声明的私有字段此前对每一层都不可见, 现在它们的**值**会被恢复。 **但这一层不替代协议**:它只恢复值,不撤销副作用(播音效、加节点、移除生物等, 写回字段救不回来)。要防发生,仍然只有 IsSimulating() 这一条路。 DamagePreview.DamagePreviewApi.IsSimulating() → bool 鸭子类型,不需要引用本程序集。返回 true 时**不得写入任何会影响真实战斗的状态**。 不接的话,把攻击卡指到敌人身上(没打出去)就可能改到你的数据——隔离协议要求 双方各守一半,本模组护住原版状态,你护住自己的数据。 ② **往算式里追加自定义行(可选)** 实现 IDamagePreviewValueProvider。两个数值来自本次算式**自己的**链条,直接用它 们就好——卡面上的 DynamicVar.PreviewValue 属于另一条管线,不是这条链的数。 ■ 其他 完全免费,无任何付费内容。游戏需为测试分支 v0.111.X。 ──────────────────────────────── Shows the full damage calculation in a tooltip next to the enemy while you drag an attack card onto a target: base value → every additive / multiplicative / cap modifier with its source icon → final damage. Press Alt to cycle Simple / Detailed / Off. ■ What it shows The value after every Hook.ModifyDamage step and BEFORE block is subtracted — i.e. how much damage this attack will deal. Any source using the standard damage hooks (Strength, Vulnerable, Weak, Intangible, enchantments, and any mod's custom powers or relics) is included automatically, with its own icon. Green = increased, red = reduced. Multi-hit cards are evaluated hit by hit and summed, shown as ×N with the total. Each hit uses its own state, so between-hit changes (decaying stacks, block consumed hit by hit) are accounted for. If the hit count cannot be determined, it says so instead of pretending the card hits once. A trailing 13.5 → 13 is expected: the game resolves damage as an integer. The number before the arrow is the exact result of the formula (grey); the one after it is the damage actually dealt (coloured by comparison with the base value). ■ Compatibility Requires only the base game — no dependencies. Any mod that uses the standard damage hooks is accounted for automatically. If you run a mod that provides slash/pierce/blunt resistances, the formula gains an extra resistance multiplier step with its own icon, matching how damage is actually resolved. Such resistances bypass the damage hooks entirely, so this mod finds them by runtime detection and silently falls back if none is present — it is OPTIONAL, not a dependency. If you also run Library Of Ruina, which ships its own preview, both tooltips will show side by side (this mod detects it and moves its own tooltip to the other side of the enemy, so they do not cover each other). That is intentional: putting the two calculations next to each other is how you can tell which one is wrong. Disable one if you only want a single tooltip. ■ For mod authors Two hooks; the full contract (discovery, type discipline, return rules, examples) ships with the mod as 接口.md — treat that file as authoritative. (1) Simulation isolation protocol (mandatory). This mod computes damage by actually running vanilla logic in a sandbox, so it cannot block **your own data**. Ask: As of this version there is also a field-level snapshot fallback: every mutable instance field of each object (creature, monster model, each power) is captured before the simulation and written back afterwards. Fields you declared privately were previously invisible to every layer; their VALUES are now restored. This does NOT replace the protocol: it restores values only and cannot undo side effects (playing audio, adding nodes, removing creatures). To prevent those happening at all, IsSimulating() remains the only way. DamagePreview.DamagePreviewApi.IsSimulating() -> bool (duck-typed). While true you must not write any state that affects real combat. Skip it and merely hovering an attack card over an enemy can change your data — an isolation protocol requires each side to guard its half. (2) Appending a line (optional). Implement IDamagePreviewValueProvider; both numbers come from the preview formula's own chain. Use those, not DynamicVar.PreviewValue, which belongs to a different pipeline. ■ Multiplayer Marked as a non-gameplay mod: playing with someone who does not have it will NOT block the connection (the game explicitly allows non-gameplay mods to differ). ■ Misc Completely free. Requires the beta branch v0.111.X.

详情图片

条目信息

所属游戏
杀戮尖塔 2 (Slay the Spire 2)
创意工坊 ID
3809166825
文件名
3809166825.bin
文件大小
153.6 KB
最后更新
2026/11/15
内容版本
v1794706549-b3f3c9ea0f38e4f6
作者与来源
由原作者发布于 Steam 创意工坊。本站不改变署名,作者信息与原始内容请以 Steam 原始页面 为准。