Skip to content

Commit 461f453

Browse files
committed
Prevent bypassing demon boss lairs via level teleport.
Now that the player no longer needs to come back up through Gehennom for the ascension run, it became possible for the player to skip all of the demon bosses altogether via levelporting past their lairs. You could do this before Purgatory was introduced, but you still had to come back up with the Amulet of Yendor/imbued Idol of Moloch, and teleportation is suppressed at that point. This patch prevents levelporting past the demon boss lairs. If the player tries to levelport past them, they'll land on each demon boss level instead. And because using teleportation on yourself is greatly supressed while that demon boss is alive, it virtually guarantees each demon boss having to be dealt with.
1 parent 36c6f90 commit 461f453

File tree

6 files changed

+41
-8
lines changed

6 files changed

+41
-8
lines changed

doc/evilhack-changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,4 +2682,5 @@ The following changes to date are:
26822682

26832683
- Latest merges from 'vanilla' NetHack 3.6.6 official release (as of January 23rd, 2022)
26842684
- Initial preparation for new version (0.8.2)
2685+
- Prevent bypassing demon boss lairs via level teleport
26852686

include/dungeon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ typedef struct branch {
118118
#define Is_hella_level(x) (Lcheck(x, &hella_level))
119119
#define Is_hellb_level(x) (Lcheck(x, &hellb_level))
120120
#define Is_hellc_level(x) (Lcheck(x, &hellc_level))
121+
#define Is_orcustown(x) (Lcheck(x, &orcus_level))
121122
#define Is_wiz1_level(x) (Lcheck(x, &wiz1_level))
122123
#define Is_wiz2_level(x) (Lcheck(x, &wiz2_level))
123124
#define Is_wiz3_level(x) (Lcheck(x, &wiz3_level))

include/you.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ struct u_event {
4949
Bitfield(invoked, 1); /* invoked Gate to the Sanctum level */
5050
Bitfield(gehennom_entered, 1); /* entered Gehennom via Valley */
5151
Bitfield(tower_entered, 1); /* entered Vlad's tower (cavern level) */
52+
Bitfield(hella_entered, 1); /* entered the first demon lord lair */
53+
Bitfield(hellb_entered, 1); /* entered the second demon lord lair */
5254
Bitfield(hellc_entered, 1); /* entered one of the demon prince lairs */
55+
Bitfield(orcus_entered, 1); /* entered Orcus town */
5356
Bitfield(iceq_entered, 1); /* entered the Ice Queen's realm */
5457
Bitfield(vecnad_entered, 1); /* entered Vecna's domain */
5558
Bitfield(gtown_entered, 1); /* entered Goblin Town */

src/do.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,11 +1884,26 @@ boolean at_stairs, falling, portal;
18841884
com_pager(300);
18851885
}
18861886

1887-
/* made it to the final demon boss lair? */
1887+
/* made it to the first demon lord lair? */
1888+
if (!Is_hella_level(&u.uz0) && Is_hella_level(&u.uz)
1889+
&& !u.uevent.hella_entered)
1890+
u.uevent.hella_entered = 1;
1891+
1892+
/* made it to the second demon lord lair? */
1893+
if (!Is_hellb_level(&u.uz0) && Is_hellb_level(&u.uz)
1894+
&& !u.uevent.hellb_entered)
1895+
u.uevent.hellb_entered = 1;
1896+
1897+
/* made it to the final demon prince lair? */
18881898
if (!Is_hellc_level(&u.uz0) && Is_hellc_level(&u.uz)
18891899
&& !u.uevent.hellc_entered)
18901900
u.uevent.hellc_entered = 1;
18911901

1902+
/* made it to Orcus Town? */
1903+
if (!Is_orcustown(&u.uz0) && Is_orcustown(&u.uz)
1904+
&& !u.uevent.orcus_entered)
1905+
u.uevent.orcus_entered = 1;
1906+
18921907
if (!In_icequeen_branch(&u.uz0) && Iniceq
18931908
&& !u.uevent.iceq_entered) {
18941909
u.uevent.iceq_entered = 1;
@@ -1962,7 +1977,7 @@ boolean at_stairs, falling, portal;
19621977

19631978
/* special location arrival messages/events */
19641979
if (In_endgame(&u.uz)) {
1965-
if (new &&on_level(&u.uz, &astral_level))
1980+
if (new && on_level(&u.uz, &astral_level))
19661981
final_level(); /* guardian angel,&c */
19671982
else if (newdungeon && u.uhave.amulet)
19681983
resurrect(); /* force confrontation with Wizard */

src/potion.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ register struct obj *otmp;
11271127
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
11281128
/* order is important here, should a demon
11291129
prince summon a demon lord */
1130-
if (is_dlord(mtmp->data) && rn2(5)) {
1130+
if (is_dlord(mtmp->data) && rn2(10)) {
11311131
pline("Demonic forces prevent you from rising up.");
11321132
goto no_rise;
11331133
} else if (is_dprince(mtmp->data) && rn2(20)) {

src/teleport.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ struct obj *scroll;
541541
/* Being in the presence of demon lords/princes can negate
542542
teleportation most of the time */
543543
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
544-
if (is_dlord(mtmp->data) && rn2(5)
544+
if (is_dlord(mtmp->data) && rn2(10)
545545
&& !wizard) {
546546
pline("Demonic forces prevent you from teleporting.");
547547
return TRUE;
@@ -852,7 +852,7 @@ level_tele()
852852
/* Being in the presence of demon lords/princes can negate
853853
level teleportation most of the time */
854854
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
855-
if (is_dlord(mtmp->data) && rn2(5)
855+
if (is_dlord(mtmp->data) && rn2(10)
856856
&& !wizard) {
857857
pline("Demonic forces prevent you from teleporting.");
858858
return;
@@ -1103,11 +1103,24 @@ level_tele()
11031103

11041104
/* if invocation did not yet occur, teleporting into
11051105
* the last level of Gehennom is forbidden.
1106+
* attempting to bypass the three demon boss lairs
1107+
* or Orcus town is also forbidden
11061108
*/
1107-
if (!wizard && Inhell && !u.uevent.invoked && newlev >= deepest) {
1108-
newlev = deepest - 1;
1109-
pline("Sorry...");
1109+
if (!wizard && Inhell) {
1110+
if (!u.uevent.hella_entered && newlev > depth(&hella_level))
1111+
newlev = depth(&hella_level);
1112+
if (!u.uevent.hellb_entered && newlev > depth(&hellb_level))
1113+
newlev = depth(&hellb_level);
1114+
if (!u.uevent.hellc_entered && newlev > depth(&hellc_level))
1115+
newlev = depth(&hellc_level);
1116+
if (!u.uevent.orcus_entered && newlev > depth(&orcus_level))
1117+
newlev = depth(&orcus_level);
1118+
if (!u.uevent.invoked && newlev >= deepest) {
1119+
newlev = deepest - 1;
1120+
pline("Sorry...");
1121+
}
11101122
}
1123+
11111124
/* no teleporting out of quest dungeon */
11121125
if (In_quest(&u.uz) && newlev < depth(&qstart_level))
11131126
newlev = depth(&qstart_level);

0 commit comments

Comments
 (0)