#sit command */
| 397 | |
| 398 | /* #sit command */ |
| 399 | int |
| 400 | dosit(void) |
| 401 | { |
| 402 | static const char sit_message[] = "sit on the %s."; |
| 403 | struct trap *trap = t_at(u.ux, u.uy); |
| 404 | int typ = levl[u.ux][u.uy].typ; |
| 405 | |
| 406 | if (u.usteed) { |
| 407 | You("are already sitting on %s.", mon_nam(u.usteed)); |
| 408 | return ECMD_OK; |
| 409 | } |
| 410 | if (u.uundetected && is_hider(gy.youmonst.data) |
| 411 | && u.umonnum != PM_TRAPPER) /* trapper can stay hidden on floor */ |
| 412 | u.uundetected = 0; /* no longer on the ceiling */ |
| 413 | |
| 414 | if (!can_reach_floor(FALSE)) { |
| 415 | if (u.uswallow) |
| 416 | There("are no seats in here!"); |
| 417 | else if (Levitation) |
| 418 | You("tumble in place."); |
| 419 | else |
| 420 | You("are sitting on air."); |
| 421 | return ECMD_OK; |
| 422 | } else if (u.ustuck && !sticks(gy.youmonst.data)) { |
| 423 | /* holding monster is next to hero rather than beneath, but |
| 424 | hero is in no condition to actually sit at has/her own spot */ |
| 425 | if (humanoid(u.ustuck->data)) |
| 426 | pline("%s won't offer %s lap.", Monnam(u.ustuck), mhis(u.ustuck)); |
| 427 | else |
| 428 | pline("%s has no lap.", Monnam(u.ustuck)); |
| 429 | return ECMD_OK; |
| 430 | } else if (is_pool(u.ux, u.uy) && !Underwater) { /* water walking */ |
| 431 | goto in_water; |
| 432 | } else if (Upolyd && u.umonnum == PM_GREMLIN |
| 433 | && (levl[u.ux][u.uy].typ == FOUNTAIN || is_pool(u.ux, u.uy))) { |
| 434 | goto in_water; |
| 435 | } |
| 436 | |
| 437 | if (OBJ_AT(u.ux, u.uy) |
| 438 | /* ensure we're not standing on the precipice */ |
| 439 | && !(uteetering_at_seen_pit(trap) || uescaped_shaft(trap))) { |
| 440 | struct obj *obj; |
| 441 | |
| 442 | obj = svl.level.objects[u.ux][u.uy]; |
| 443 | if (gy.youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) { |
| 444 | You("coil up around your %shoard.", |
| 445 | (obj->quan + money_cnt(gi.invent) < u.ulevel * 1000) |
| 446 | ? "meager " : ""); |
| 447 | } else if (obj->otyp == TOWEL) { |
| 448 | pline("It's probably not a good time for a picnic..."); |
| 449 | } else { |
| 450 | if (slithy(gy.youmonst.data)) |
| 451 | You("coil up around %s.", the(xname(obj))); |
| 452 | else |
| 453 | You("sit on %s.", the(xname(obj))); |
| 454 | if (obj->otyp == CORPSE && amorphous(&mons[obj->corpsenm])) |
| 455 | pline("It's squishy..."); |
| 456 | else if (obj->otyp == CREAM_PIE) { |
nothing calls this directly
no test coverage detected