fix github issue #1046 - tutorial anomalies

Reported by Noisytoot:  going from level tut-1 to tut-2 returned the
hero's starting equipment too soon, and exiting the tutorial from
tut-2 let the hero keep any equipment acquired within the tutorial.

Entering and leaving the tutorial was being handled by lua code in
the level description of tut-1 and adding a second level messed that
up.  I didn't see any way of handing that with level-specific lua
code so I made it become the core's responsibility.  gotolevel()
knows when the hero is moving from one dungeon branch to another so
it can recognize entry to or exit from the tutorial easily.

While fixing this, prevent #invoke of the Eye of the Aethiopica from
offering the tutorial as a candidate destination (was feasible if it
had been entered at start of game).

Not fixed:  levels visited in the tutorial become part of #overview.

Show location as "Tutorial:1" instead of "Dlvl:1" on status lines.
Only tested with tty; some interfaces handle location themselves and
may need their own fixup for this.

Fixes #1046
This commit is contained in:
PatR
2023-06-03 16:39:12 -07:00
parent 4e32364313
commit 2bbfed2183
10 changed files with 87 additions and 40 deletions

View File

@@ -1411,11 +1411,19 @@ goto_level(
if (dunlev(newlevel) > dunlevs_in_dungeon(newlevel))
newlevel->dlevel = dunlevs_in_dungeon(newlevel);
if (newdungeon && In_endgame(newlevel)) { /* 1st Endgame Level !!! */
if (!u.uhave.amulet)
return; /* must have the Amulet */
if (!wizard) /* wizard ^V can bypass Earth level */
assign_level(newlevel, &earth_level); /* (redundant) */
if (newdungeon) {
if (In_endgame(newlevel)) { /* 1st Endgame Level !!! */
if (!u.uhave.amulet)
return; /* must have the Amulet */
if (!wizard) /* wizard ^V can bypass Earth level */
assign_level(newlevel, &earth_level); /* (redundant) */
} else if (newlevel->dnum == tutorial_dnum) {
tutorial(TRUE); /* entering tutorial */
} else if (u.uz.dnum == tutorial_dnum) {
tutorial(FALSE); /* leaving tutorial */
up = FALSE; /* re-enter level 1 as if starting new game */
/* TODO: remove tutorial level(s) from #overview data */
}
}
new_ledger = ledger_no(newlevel);
if (new_ledger <= 0)
@@ -1623,7 +1631,6 @@ goto_level(
if (portal && !In_endgame(&u.uz)) {
/* find the portal on the new level */
register struct trap *ttrap;
struct stairway *stway;
for (ttrap = gf.ftrap; ttrap; ttrap = ttrap->ntrap)
if (ttrap->ttyp == MAGIC_PORTAL)
@@ -1636,9 +1643,6 @@ goto_level(
after already getting expelled once. The portal back
doesn't exist anymore - see expulsion(). */
u_on_rndspot(0);
} else if ((stway = stairway_find_dir(TRUE)) != 0) {
/* returning from tutorial via portal */
u_on_newpos(stway->sx, stway->sy);
} else {
if (!iflags.debug_fuzzer)
impossible("goto_level: no corresponding portal!");