* Expel the player to the stairs on the parent of the quest dungeon. * * This assumes that the hero is currently _in_ the quest dungeon and that * there is a single branch to and from it. */
| 183 | * there is a single branch to and from it. |
| 184 | */ |
| 185 | staticfn void |
| 186 | expulsion(boolean seal) |
| 187 | { |
| 188 | branch *br; |
| 189 | d_level *dest; |
| 190 | struct trap *t; |
| 191 | int portal_flag = u.uevent.qexpelled ? UTOTYPE_NONE : UTOTYPE_PORTAL; |
| 192 | |
| 193 | br = dungeon_branch("The Quest"); |
| 194 | dest = (br->end1.dnum == u.uz.dnum) ? &br->end2 : &br->end1; |
| 195 | if (seal) |
| 196 | portal_flag |= UTOTYPE_RMPORTAL; |
| 197 | nomul(0); /* stop running */ |
| 198 | schedule_goto(dest, portal_flag, (char *) 0, (char *) 0); |
| 199 | if (seal) { /* remove the portal to the quest - sealing it off */ |
| 200 | int reexpelled = u.uevent.qexpelled; |
| 201 | |
| 202 | u.uevent.qexpelled = 1; |
| 203 | remdun_mapseen(quest_dnum); |
| 204 | /* Delete the near portal now; the far (main dungeon side) |
| 205 | portal will be deleted as part of arrival on that level. |
| 206 | If monster movement is in progress, any who haven't moved |
| 207 | yet will now miss out on a chance to wander through it... */ |
| 208 | for (t = gf.ftrap; t; t = t->ntrap) |
| 209 | if (t->ttyp == MAGIC_PORTAL) |
| 210 | break; |
| 211 | if (t) |
| 212 | deltrap(t); /* (display might be briefly out of sync) */ |
| 213 | else if (!reexpelled) |
| 214 | impossible("quest portal already gone?"); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | /* Either you've returned to quest leader while carrying the quest |
| 219 | artifact or you've just thrown it to/at him or her. If quest |
no test coverage detected