From a5288943aa222b6216a804215712590b69c774d6 Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Wed, 18 Oct 2023 11:09:47 -0400 Subject: [PATCH] Disallow levelporting from ongoing deathmatch Not entirely happy about this but I found that branchporting is already forbidden, so we'll stick with that for now. The problem with allowing escape from other sources than the portal is that it's not feasible to seal off the arena level when it happens, unless the destination happens to be the level with the arena portal. I have been thinking that maybe we could force the destination of levelport or branchport to be the arena portal level and then move the portal-sealing and item-erasure parts from domagicportal to goto_level, but this is a simple initial fix at least. --- src/artifact.c | 13 +++++++------ src/teleport.c | 6 +++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/artifact.c b/src/artifact.c index 99a4e06a1..a6e75826f 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1531,11 +1531,12 @@ struct obj *obj; winid tmpwin; anything any; - /* TNNT: player can't branchport out of the arena if the match is in - * progress. */ + /* TNNT: player can't branchport out of the arena if the match is + * in progress. */ if (Is_deathmatch_level(&u.uz) && tnnt_globals.deathmatch_started && !tnnt_globals.deathmatch_completed) { - pline("Somehow, %s seems unable to make a portal.", the(xname(obj))); + pline("Somehow, %s seems unable to make a portal.", + the(xname(obj))); break; } @@ -1547,9 +1548,9 @@ struct obj *obj; if (!dungeons[i].dunlev_ureached) continue; - /* TNNT: player can't branchport back into the npcdeath arena if - * they fled the deathmatch (wizard mode #wizlevelport ought to - * work though since it doesn't go through here.) */ + /* TNNT: player can't branchport back into the npcdeath arena + * if they fled the deathmatch (wizard mode #wizlevelport + * ought to work though since it doesn't go through here.) */ if (!strcmp(dungeons[i].dname, "Deathmatch Arena") && tnnt_globals.deathmatch_started && !tnnt_globals.deathmatch_completed) diff --git a/src/teleport.c b/src/teleport.c index 362aefce1..113f23b0b 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -790,7 +790,11 @@ level_tele() if (iflags.debug_fuzzer) goto random_levtport; - if ((u.uhave.amulet || In_endgame(&u.uz) || In_sokoban(&u.uz)) + if ((u.uhave.amulet || In_endgame(&u.uz) || In_sokoban(&u.uz) + /* TNNT: player must exit ongoing deathmatch via portal, since it's + * infeasible to seal the level otherwise */ + || (Is_deathmatch_level(&u.uz) && tnnt_globals.deathmatch_started + && !tnnt_globals.deathmatch_completed)) && !wizard) { You_feel("very disoriented for a moment."); return;