Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 10, 2025

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>### 在提问之前...

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


💡 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.

When using .rc command with custom attributes (e.g., .st 长剑=4 then .rc 长剑),
the modifier value was not displayed in the output, showing "9[d20] +  = 13"
instead of "9[d20] + 4 = 13".

This fix adds a fallback to use the modifier value directly when
GetDetailText() returns an empty string, which happens for custom attributes.

Co-authored-by: Szzrain <[email protected]>
Copilot AI changed the title [WIP] Fix bug with .st custom attribute value not displaying Fix DND5E .rc command: display custom attribute values in check output Nov 10, 2025
Copilot AI requested a review from Szzrain November 10, 2025 04:29
@github-actions
Copy link

🚨 PR Title Needs Formatting

The title of this PR needs to be formatted correctly.
Please update the title to match the format type: description. Examples:

  • `fix: fix typo in README.md
  • chore: update dependencies
  • feat: add new feature
  • chore: fixing build pipeline
  • etc.
    More information can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 在dnd规则下试图".st"自定义属性数值,但.rc的时候无法显示设置属性的数值

3 participants