| 1476 | } |
| 1477 | |
| 1478 | void |
| 1479 | goto_level( |
| 1480 | d_level *newlevel, /* destination */ |
| 1481 | boolean at_stairs, /* True if arriving via stairs/ladder */ |
| 1482 | boolean falling, /* when falling to level, objects might tag along */ |
| 1483 | boolean portal) /* True if arriving via magic portal */ |
| 1484 | { |
| 1485 | int l_idx, save_mode; |
| 1486 | NHFILE *nhfp; |
| 1487 | xint16 new_ledger; |
| 1488 | boolean cant_go_back, great_effort, |
| 1489 | up = (depth(newlevel) < depth(&u.uz)), |
| 1490 | newdungeon = (u.uz.dnum != newlevel->dnum), |
| 1491 | leaving_tutorial = FALSE, |
| 1492 | was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz), |
| 1493 | familiar = FALSE, |
| 1494 | new = FALSE; /* made a new level? */ |
| 1495 | struct monst *mtmp; |
| 1496 | char whynot[BUFSZ]; |
| 1497 | int dist = depth(newlevel) - depth(&u.uz); |
| 1498 | boolean do_fall_dmg = FALSE; |
| 1499 | schar prev_temperature = svl.level.flags.temperature; |
| 1500 | |
| 1501 | if (dunlev(newlevel) > dunlevs_in_dungeon(newlevel)) |
| 1502 | newlevel->dlevel = dunlevs_in_dungeon(newlevel); |
| 1503 | if (newdungeon) { |
| 1504 | if (In_endgame(newlevel)) { /* 1st Endgame Level !!! */ |
| 1505 | if (!u.uhave.amulet) |
| 1506 | return; /* must have the Amulet */ |
| 1507 | if (!wizard) /* wizard ^V can bypass Earth level */ |
| 1508 | assign_level(newlevel, &earth_level); /* (redundant) */ |
| 1509 | } else if (In_tutorial(newlevel)) { |
| 1510 | tutorial(TRUE); /* entering tutorial */ |
| 1511 | } else if (In_tutorial(&u.uz)) { |
| 1512 | tutorial(FALSE); /* leaving tutorial */ |
| 1513 | up = FALSE; /* re-enter level 1 as if starting new game */ |
| 1514 | leaving_tutorial = TRUE; |
| 1515 | } |
| 1516 | } |
| 1517 | new_ledger = ledger_no(newlevel); |
| 1518 | if (new_ledger <= 0) |
| 1519 | done(ESCAPED); /* in fact < 0 is impossible */ |
| 1520 | |
| 1521 | /* If you have the amulet and are trying to get out of Gehennom, |
| 1522 | * going up a set of stairs sometimes does some very strange things! |
| 1523 | * Biased against law and towards chaos. (The chance to be sent |
| 1524 | * down multiple levels when attempting to go up are significantly |
| 1525 | * less than the corresponding comment in older versions indicated |
| 1526 | * due to overlooking the effect of the call to assign_rnd_lvl().) |
| 1527 | * |
| 1528 | * Odds for making it to the next level up, or of being sent down: |
| 1529 | * "up" L N C |
| 1530 | * +1 75.0 75.0 75.0 |
| 1531 | * 0 6.25 8.33 12.5 |
| 1532 | * -1 11.46 12.50 12.5 |
| 1533 | * -2 5.21 4.17 0.0 |
| 1534 | * -3 2.08 0.0 0.0 |
| 1535 | * |
no test coverage detected