Demon lords and princes suppress teleporting in Gehennom

Instead of having the demon lair levels unconditionally no-teleport,
grant demon lords and princes the ability to suppress teleportation
in Gehennom on the level they are on.
This commit is contained in:
Pasi Kallinen
2020-02-26 20:03:00 +02:00
parent 816079c8dd
commit d86b7e8e7c
11 changed files with 39 additions and 17 deletions
+23 -3
View File
@@ -11,6 +11,26 @@ static void NDECL(vault_tele);
static boolean FDECL(rloc_pos_ok, (int, int, struct monst *));
static void FDECL(mvault_tele, (struct monst *));
/* teleporting is prevented on this level for this monster? */
boolean
noteleport_level(mon)
struct monst *mon;
{
struct monst *mtmp;
/* demon court in Gehennom prevent others from teleporting */
if (In_hell(&u.uz) && !(is_dlord(mon->data) || is_dprince(mon->data)))
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
if (is_dlord(mtmp->data) || is_dprince(mtmp->data))
return TRUE;
/* natural no-teleport level */
if (g.level.flags.noteleport)
return TRUE;
return FALSE;
}
/*
* Is (x,y) a good position of mtmp? If mtmp is NULL, then is (x,y) good
* for an object?
@@ -495,7 +515,7 @@ struct obj *scroll;
boolean result = FALSE; /* don't learn scroll */
/* Disable teleportation in stronghold && Vlad's Tower */
if (g.level.flags.noteleport) {
if (noteleport_level(&g.youmonst)) {
if (!wizard) {
pline("A mysterious force prevents you from teleporting!");
return TRUE;
@@ -1316,7 +1336,7 @@ boolean
tele_restrict(mon)
struct monst *mon;
{
if (g.level.flags.noteleport) {
if (noteleport_level(mon)) {
if (canseemon(mon))
pline("A mysterious force prevents %s from teleporting!",
mon_nam(mon));
@@ -1591,7 +1611,7 @@ boolean give_feedback;
if (give_feedback)
pline("%s resists your magic!", Monnam(mtmp));
return FALSE;
} else if (g.level.flags.noteleport && u.uswallow && mtmp == u.ustuck) {
} else if (u.uswallow && mtmp == u.ustuck && noteleport_level(mtmp)) {
if (give_feedback)
You("are no longer inside %s!", mon_nam(mtmp));
unstuck(mtmp);