ComputerScienceHouse / ComputerScienceHouse/bingehack

Successful Knock Spell Pointed Down Incorrectly Assumes Bear Trap

Offen
#129 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
C
Sterne
24
Forks
4
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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;
}
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne in src/zap.c beim SPE_KNOCK-Zweig in zapupdown und vergleiche dessen Bear-Trap-Behandlung mit libnethack/zap.c. Reproduziere das Aufstoßen einer Truhe nach unten und überprüfe anschließend, dass die Meldung nicht mehr behauptet, eine Bärenfalle sei geöffnet worden, wenn der Spieler nicht gefangen ist, während das tatsächliche Verhalten von Bärenfallen intakt bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c
Bereich
game-dev
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
52/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.