sealdice-core icon indicating copy to clipboard operation
sealdice-core copied to clipboard

Fix DND5E .rc command: display custom attribute values in check output

Open Copilot opened this issue 5 months ago • 0 comments

Custom attribute values set via .st were omitted from .rc check output despite being included in calculations. Result showed 9[d20] + = 13 instead of 9[d20] + 4 = 13.

Changes

  • dice/ext_dnd5e.go: Add fallback to display modifier value when GetDetailText() returns empty string
// Before
detail := fmt.Sprintf("%s + %s", diceDetail, r2.vm.GetDetailText())

// After
modifierDetail := r2.vm.GetDetailText()
if modifierDetail == "" {
    modifierDetail = fmt.Sprintf("%d", modifier)
}
detail := fmt.Sprintf("%s + %s", diceDetail, modifierDetail)

The VM's GetDetailText() returns empty for simple attribute lookups but has values for complex expressions. This preserves existing detail text behavior while properly formatting custom attributes.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: 在dnd规则下试图".st"自定义属性数值,但.rc的时候无法显示设置属性的数值</issue_title> <issue_description>### 在提问之前...

  • [x] 我理解 Issue 是用于反馈和解决问题的,而非吐槽评论区,将尽可能提供更多信息帮助问题解决
  • [x] 我填写了简短且清晰明确的标题,以便开发者在翻阅 issue 列表时能快速确定大致问题。而不是“一个建议”、“卡住了”等
  • [x] 我已查看master branch或最新测试版的更新内容,并未提及该 bug 已被修复的情况
  • [ ] 我没有仔细查看这些选项,只是在无脑的勾选所有选项,请关闭这个 issue
  • [x] 已有issue中并没有看见其他人与我反馈相同的问题

问题描述

在回复文本为默认,房规设定为dnd规则的前提下,试图按照海豹手册的示例,进行".st"自定义属性数值来作为熟练项加值。但是.rc进行自定义属性检定的时候,无法显示自定义属性的数值。而最终总值却是正确的。

如何复现

示例:1.发送指令 ".setdnd" 2.发送指令 ".st 长剑=4" 或者 ".st 长剑:4" 3.发送指令 ".rc 长剑" 4.产生错误回复 "<玩家>的"长剑"检定(DND5E)结果为: 9[d20] + = 13"

你期望发生的

正常来说应该在最终骰点回复时,显示自定义属性数值——即作为熟练加值的用途进行检定。

实际上发生的

实际上在"检定计算过程"时并没有出现自定义属性数值,但是最终总值是加上了自定义属性数值的。

日志文件

Image

截图

Image

海豹核心版本

1.5.1+20251010

操作系统

linux - amd64

帐号类型

QQ:2752253397

使用协议

Napcat

附加内容

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes sealdice/sealdice-core#1524

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Nov 10 '25 04:11 Copilot