Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Successful Knock Spell Pointed Down Incorrectly Assumes Bear Trap

未关闭
#129 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
c
领域
game-dev

调研方向

从 src/zap.c 中 zapupdown 的 SPE_KNOCK 分支开始,并将其对 bear trap 的处理与 libnethack/zap.c 进行比较。重现向下敲开箱子的操作,然后验证当玩家没有被困住时,消息不再声称打开了 bear trap,同时真正的 bear trap 行为仍保持不变。

由索引模型根据 Issue 内容生成。

描述

bug

Knocking open a chest downward produces the message "The bear trap opens. Klick!".
This is not at all indicative, as one might think, of a hitherto undiscovered beartrap that you happen to be standing on, but it is instead a bug, as zapupdown in src/zap.c indicates:

        case SPE_KNOCK:
            /* up or down, but at closed portcullis only */
            if (is_db_wall(x,y) && find_drawbridge(&xx, &yy)) {
                open_drawbridge(xx, yy);
                disclose = TRUE;
            } else if (u.dz > 0 && (x == xdnstair && y == ydnstair) &&
                        /* can't use the stairs down to quest level 2 until
                           leader "unlocks" them; give feedback if you try */
                        on_level(&u.uz, &qstart_level) && !ok_to_quest()) {
                pline_The("stairs seem to ripple momentarily.");
                disclose = TRUE;
            } else if (u.utraptype == TT_BEARTRAP) {
                pline_The("bear trap opens.");
                u.utrap = 0;
            }

However, TT_BEARTRAP happens to be 0, which apparently what u.utraptype is set to /even if you're not in a trap/.

... this does not appear to be a problem in NetHack 4, where libnethack/zap.c's zapupdown covers this case as:

    case SPE_KNOCK:
        /* up or down, but at closed portcullis only */
        if (is_db_wall(x, y) && find_drawbridge(&xx, &yy)) {
            open_drawbridge(xx, yy);
            disclose = TRUE;
        } else if (dz > 0 && (x == level->dnstair.sx && y == level->dnstair.sy)
                   &&
                   /* can't use the stairs down to quest level 2 until leader
                      "unlocks" them; give feedback if you try */
                   on_level(&u.uz, &qstart_level) && !ok_to_quest()) {
            pline("The stairs seem to ripple momentarily.");
            disclose = TRUE;
        }
主要语言
C
星标
24
派生
4
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ComputerScienceHouse/bingehack 的其他 Issue

查看 ComputerScienceHouse/bingehack 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。