/* try to force a chest with your weapon */ int doforce(const struct nh_cmd_arg *arg) { struct obj *otmp; int c; const char *qbuf; if (!uwep_can_force()) return 0; if (u.utracked[tos_lock] && u.uoccupation_progress[tos_lock]) { if (turnstate.continue_message) pline(msgc_occstart, "You resume your attempt to force the lock."); one_occupation_turn(forcelock, "forcing the lock", occ_lock); return 1; } /* A lock is made only for the honest man, the thief will break it. */ u.utracked[tos_lock] = NULL; u.uoccupation_progress[tos_lock] = 0; for (otmp = level->objects[youmonst.mx][youmonst.my]; otmp; otmp = otmp->nexthere) if (Is_box(otmp)) { if (otmp->obroken || !otmp->olocked) { pline(msgc_cancelled, "There is %s here, but its lock is already %s.", doname(otmp), otmp->obroken ? "broken" : "unlocked"); continue; } qbuf = msgprintf( "There is %s here, force its lock?", safe_qbuf("", sizeof ("There is here, force its lock?"), doname(otmp), an(simple_typename(otmp->otyp)), "a box")); c = ynq(qbuf); if (c == 'q') return 0; if (c == 'n') continue; if (is_blade(uwep)) pline(msgc_occstart, "You force your %s into a crack and pry.", xname(uwep)); else pline(msgc_occstart, "You start bashing it with your %s.", xname(uwep)); u.utracked[tos_lock] = otmp; break; } if (u.utracked[tos_lock]) { one_occupation_turn(forcelock, "forcing the lock", occ_lock); return 1; } else { pline(msgc_cancelled, "You decide not to force the issue."); return 0; } }
/* Also, give hints about portal locations, if amulet is worn/wielded -dlc */ void amulet() { struct monst *mtmp; struct trap *ttmp; struct obj *amu; #if 0 /* caller takes care of this check */ if (!u.uhave.amulet) return; #endif if ((((amu = uamul) != 0 && amu->otyp == AMULET_OF_YENDOR) || ((amu = uwep) != 0 && amu->otyp == AMULET_OF_YENDOR)) && !rn2(15)) { for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) { if(ttmp->ttyp == MAGIC_PORTAL) { int du = distu(ttmp->tx, ttmp->ty); if (du <= 9) /*JP pline("%s hot!", Tobjnam(amu, "feel")); */ pline("%sは熱く感じた!", xname(amu)); else if (du <= 64) /*JP pline("%s very warm.", Tobjnam(amu, "feel")); */ pline("%sはとても暖かく感じた。", xname(amu)); else if (du <= 144) /*JP pline("%s warm.", Tobjnam(amu, "feel")); */ pline("%sは暖かく感じた。", xname(amu)); /* else, the amulet feels normal */ break; } } } if (!flags.no_of_wizards) return; /* find Wizard, and wake him if necessary */ for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) if (!DEADMONSTER(mtmp) && mtmp->iswiz && mtmp->msleeping && !rn2(40)) { mtmp->msleeping = 0; if (distu(mtmp->mx,mtmp->my) > 2) You( /*JP "get the creepy feeling that somebody noticed your taking the Amulet." */ "あなたが魔除けを持っていることが誰かに知られたと感じてぞくぞくした。" ); return; } }
void ballfall(void) { boolean gets_hit; gets_hit = (((uball->ox != u.ux) || (uball->oy != u.uy)) && ((uwep == uball) ? FALSE : (boolean) rn2(5))); if (carried(uball)) { pline("Startled, you drop the iron ball."); unwield_silently(uball); if (uwep != uball) freeinv(uball); } if (gets_hit) { int dmg = rn1(7, 25); pline("The iron ball falls on your %s.", body_part(HEAD)); if (uarmh) { if (is_metallic(uarmh)) { pline("Fortunately, you are wearing a hard helmet."); dmg = 3; } else if (flags.verbose) pline("Your %s does not protect you.", xname(uarmh)); } losehp(dmg, "crunched in the head by an iron ball"); } }
void ballfall() { boolean gets_hit; gets_hit = (((uball->ox != u.ux) || (uball->oy != u.uy)) && ((uwep == uball)? FALSE : (boolean)rn2(5))); if (carried(uball)) { pline("Startled, you drop the iron ball."); if (uwep == uball) setuwep((struct obj *)0); if (uswapwep == uball) setuswapwep((struct obj *)0); if (uquiver == uball) setuqwep((struct obj *)0);; if (uwep != uball) freeinv(uball); } if(gets_hit){ int dmg = rn1(7,25); pline_The("iron ball falls on your %s.", body_part(HEAD)); if (uarmh) { if(is_metallic(uarmh)) { pline("Fortunately, you are wearing a hard helmet."); dmg = 3; } else if (flags.verbose) Your("%s does not protect you.", xname(uarmh)); } losehp(dmg, "crunched in the head by an iron ball", NO_KILLER_PREFIX); } }
/* * This routine changes the address of obj. Be careful not to call it * when there might be pointers around in unknown places. For now: only * when obj is in the inventory. */ static void do_oname(struct obj *obj) { char buf[BUFSZ], qbuf[QBUFSZ]; const char *aname; short objtyp; sprintf(qbuf, "What do you want to name %s %s?", is_plural(obj) ? "these" : "this", xname(obj)); getlin(qbuf, buf); if (!*buf || *buf == '\033') return; /* strip leading and trailing spaces; unnames item if all spaces */ mungspaces(buf); /* relax restrictions over proper capitalization for artifacts */ if ((aname = artifact_name(buf, &objtyp)) != 0 && objtyp == obj->otyp) strcpy(buf, aname); if (obj->oartifact) { pline("The artifact seems to resist the attempt."); return; } else if (restrict_name(obj, buf) || exist_artifact(obj->otyp, buf)) { int n = rn2((int)strlen(buf)); char c1, c2; c1 = lowc(buf[n]); do c2 = 'a' + rn2('z'-'a'); while (c1 == c2); buf[n] = (buf[n] == c1) ? c2 : highc(c2); /* keep same case */ pline("While engraving your %s slips.", body_part(HAND)); win_pause_output(P_MESSAGE); pline("You engrave: \"%s\".",buf); } oname(obj, buf); }
char *aobjnam(struct obj *otmp, char *verb) { char *bp = xname(otmp); char prefix[PREFIX]; if(otmp->quan != 1) { sprintf(prefix, "%d ", otmp->quan); bp = strprepend(bp, prefix); } if(verb != NULL) { /* Verb is given in plural (i.e., without trailing 's') */ strcat(bp, " "); if(otmp->quan != 1) { strcat(bp, verb); } else if(strcmp(verb, "are") == 0) { strcat(bp, "is"); } else { strcat(bp, verb); strcat(bp, "s"); } } return bp; }
int dothrow() { register struct obj *obj; if(check_capacity(NULL)) return(0); obj = getobj(toss_objs, "throw"); /* it is also possible to throw food */ /* (or jewels, or iron balls... ) */ if(!obj || !getdir(NULL)) { /* ask "in what direction?" */ if (obj && obj->oclass == GOLD_CLASS) { u.ugold += obj->quan; flags.botl = 1; dealloc_obj(obj); } return(0); } if(obj->oclass == GOLD_CLASS) return(throw_gold(obj)); if(!canletgo(obj,"throw")) return(0); if (obj->oartifact == ART_MJOLLNIR && obj != uwep) { You("must be wielding %s in order to throw it.", xname(obj)); return(0); } if ((obj->oartifact == ART_MJOLLNIR && ACURR(A_STR) != 125) || (obj->otyp == BOULDER #ifdef POLYSELF && !throws_rocks(uasmon) #endif )) { pline("It's too heavy."); return(1); } if(!u.dx && !u.dy && !u.dz) { You("cannot throw an object at yourself."); return(0); } u_wipe_engr(2); if(obj == uwep) { if(welded(obj)) { weldmsg(obj, FALSE); return(1); } if(obj->quan > 1L) setuwep(splitobj(obj, 1L)); else { setuwep((struct obj *)0); if (uwep) return(1); /* unwielded, died, rewielded */ } } else if(obj->quan > 1L) (void) splitobj(obj, 1L); freeinv(obj); return(throwit(obj)); }
/* * creature (usually player) tries to touch (pick up or wield) an artifact obj. * Returns 0 if the object refuses to be touched. * This routine does not change any object chains. * Ignores such things as gauntlets, assuming the artifact is not * fooled by such trappings. */ int touch_artifact(struct obj *obj, struct monst *mon) { const struct artifact *oart = get_artifact(obj); boolean badclass, badalign, self_willed, yours; if (!oart) return 1; yours = (mon == &youmonst); /* all quest artifacts are self-willed; it this ever changes, `badclass' will have to be extended to explicitly include quest artifacts */ self_willed = ((oart->spfx & SPFX_INTEL) != 0); if (yours) { badclass = self_willed && ((oart->role != NON_PM && !Role_if (oart->role)) || (oart->race != NON_PM && !Race_if (oart->race))); badalign = (oart->spfx & SPFX_RESTR) && oart->alignment != A_NONE && (oart->alignment != u.ualign.type || u.ualign.record < 0); } else if (!is_covetous(mon->data) && !is_mplayer(mon->data)) { badclass = self_willed && oart->role != NON_PM && oart != &artilist[ART_EXCALIBUR]; badalign = (oart->spfx & SPFX_RESTR) && oart->alignment != A_NONE && (oart->alignment != sgn(mon->data->maligntyp)); } else { /* an M3_WANTSxxx monster or a fake player */ /* special monsters trying to take the Amulet, invocation tools or quest item can touch anything except for `spec_applies' artifacts */ badclass = badalign = FALSE; } /* weapons which attack specific categories of monsters are bad for them even if their alignments happen to match */ if (!badalign && (oart->spfx & SPFX_DBONUS) != 0) { struct artifact tmp; tmp = *oart; tmp.spfx &= SPFX_DBONUS; badalign = !!spec_applies(&tmp, mon); } if (((badclass || badalign) && self_willed) || (badalign && (!yours || !rn2(4)))) { int dmg; char buf[BUFSZ]; if (!yours) return 0; pline("You are blasted by %s power!", s_suffix(the(xname(obj)))); dmg = dice((Antimagic ? 2 : 4), (self_willed ? 10 : 4)); sprintf(buf, "touching %s", oart->name); losehp(dmg, buf, KILLED_BY); exercise(A_WIS, FALSE); } /* can pick it up unless you're totally non-synch'd with the artifact */ if (badclass && badalign && self_willed) { if (yours) pline("%s your grasp!", Tobjnam(obj, "evade")); return 0; } return 1; }
int do_naming(void) { int n, selected[1]; struct obj *obj; static const char allowall[] = {ALL_CLASSES, 0}; struct menulist menu; init_menulist(&menu); add_menuitem(&menu, 1, "Name a monster", 'C', FALSE); add_menuitem(&menu, 2, "Name the current level", 'f', FALSE); add_menuitem(&menu, 3, "Name an individual item", 'y', FALSE); add_menuitem(&menu, 4, "Name all items of a certain type", 'n', FALSE); n = display_menu(menu.items, menu.icount, "What do you wish to name?", PICK_ONE, selected); free(menu.items); if (n) n = selected[0] - 1; else return 0; switch (n) { default: break; case 0: do_mname(); break; case 1: donamelevel(); break; /* cases 2 & 3 duplicated from ddocall() */ case 2: obj = getobj(allowall, "name"); if(obj) do_oname(obj); break; case 3: obj = getobj(callable, "call"); if (obj) { /* behave as if examining it in inventory; * this might set dknown if it was picked up * while blind and the hero can now see */ xname(obj); if (!obj->dknown) { pline("You would never recognize another one."); return 0; } docall(obj); } break; } return 0; }
void weldmsg(struct obj *obj) { long savewornmask; savewornmask = obj->owornmask; pline("Your %s %s welded to your %s!", xname(obj), otense(obj, "are"), bimanual(obj) ? (const char *)makeplural(body_part(HAND)) : body_part(HAND)); obj->owornmask = savewornmask; }
CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { User* u = ServerInstance->FindNick(parameters[0]); Channel* c = ServerInstance->FindChan(parameters[1]); if ((!c) || (!u) || (u->registered != REG_ALL)) { if (!c) { user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[1].c_str()); } else { user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str()); } return CMD_FAILURE; } if (IS_LOCAL(user)) { if (c->GetPrefixValue(user) < HALFOP_VALUE) { user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator", user->nick.c_str(), c->name.c_str(), c->GetPrefixValue(u) == HALFOP_VALUE ? "" : "half-"); return CMD_FAILURE; } } /* Servers remember invites only for their local users, so act * only if the target is local. Otherwise the command will be * passed to the target users server. */ LocalUser* lu = IS_LOCAL(u); if (lu) { irc::string xname(c->name.c_str()); if (!lu->IsInvited(xname)) { user->SendText(":%s 505 %s %s %s :Is not invited to channel %s", user->server.c_str(), user->nick.c_str(), u->nick.c_str(), c->name.c_str(), c->name.c_str()); return CMD_FAILURE; } user->SendText(":%s 494 %s %s %s :Uninvited", user->server.c_str(), user->nick.c_str(), c->name.c_str(), u->nick.c_str()); lu->RemoveInvite(xname); lu->WriteNumeric(493, "%s :You were uninvited from %s by %s", u->nick.c_str(), c->name.c_str(), user->nick.c_str()); std::string msg = "*** " + user->nick + " uninvited " + u->nick + "."; c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE " + c->name + " :" + msg); ServerInstance->PI->SendChannelNotice(c, 0, msg); } return CMD_SUCCESS; }
void TData::SetName(QString name) { if(Root.IsNull()) { throw NoLabelInicialisationException("TData: label do not inicialised."); } TCollection_ExtendedString xname(name.toAscii().data()); TDataStd_Name::Set(Root, xname); }
void TData::SetValue(QString value) { if(Root.IsNull()) { throw NoLabelInicialisationException("TData: label do not inicialised."); } UnSetValue(); TCollection_ExtendedString xname(value.toAscii().data()); TDataStd_Comment::Set(Root, xname); }
static void at91tctmr_attach(device_t parent, device_t self, void *aux) { struct at91tctmr_softc *sc = device_private(self); struct at91bus_attach_args *sa = aux; aprint_normal("\n"); sc->sc_dev = self; sc->sc_addr = (void*)sa->sa_addr; sc->sc_pid = sa->sa_pid; if (at91tctmr_sc == NULL) at91tctmr_sc = sc; at91_peripheral_clock(sc->sc_pid, 1); WRITE_TC(sc, TC_CCR, TC_CCR_CLKDIS); WRITE_TC(sc, TC_IDR, -1); /* make sure interrupts are disabled */ /* find divider */ u_int32_t cmr = 0; if (AT91_MSTCLK / 2U / HZ <= 65536) { sc->sc_timerclock = AT91_MSTCLK / 2U; cmr = TC_CMR_TCCLKS_MCK_DIV_2; } else if (AT91_MSTCLK / 8U / HZ <= 65536) { sc->sc_timerclock = AT91_MSTCLK / 8U; cmr = TC_CMR_TCCLKS_MCK_DIV_8; } else if (AT91_MSTCLK / 32U / HZ <= 65536) { sc->sc_timerclock = AT91_MSTCLK / 32U; cmr = TC_CMR_TCCLKS_MCK_DIV_32; } else if (AT91_MSTCLK / 128U / HZ <= 65536) { sc->sc_timerclock = AT91_MSTCLK / 128U; cmr = TC_CMR_TCCLKS_MCK_DIV_128; } else panic("%s: cannot setup timer to reach HZ", device-xname(sc->sc_dev)); sc->sc_divider = (sc->sc_timerclock + HZ - 1) / HZ; /* round up */ sc->sc_usec_per_tick = 1000000UL / (sc->sc_timerclock / sc->sc_divider); WRITE_TC(sc, TC_CMR, TC_CMR_WAVE | cmr | TC_CMR_WAVSEL_UP_RC); WRITE_TC(sc, TC_CCR, TC_CCR_CLKEN); WRITE_TC(sc, TC_RC, sc->sc_divider - 1); WRITE_TC(sc, TC_CCR, TC_CCR_SWTRG); sc->sc_initialized = 1; DPRINTF("%s: done, tclock=%"PRIu32" div=%"PRIu32" uspertick=%"PRIu32"\n", __FUNCTION__, sc->sc_timerclock, sc->sc_divider, sc->sc_usec_per_tick); }
/* * This routine changes the address of obj. Be careful not to call it * when there might be pointers around in unknown places. For now: only * when obj is in the inventory. */ int do_oname(const struct nh_cmd_arg *arg) { const char *qbuf, *buf; const char *aname; short objtyp; struct obj *obj; obj = getargobj(arg, nameable, "name"); if (!obj) return 0; qbuf = msgprintf("What do you want to name %s %s?", is_plural(obj) ? "these" : "this", safe_qbuf("", sizeof("What do you want to name these ?"), xname(obj), simple_typename(obj->otyp), is_plural(obj) ? "things" : "thing")); buf = getarglin(arg, qbuf); if (!*buf || *buf == '\033') return 0; /* strip leading and trailing spaces; unnames item if all spaces */ buf = msgmungspaces(buf); /* relax restrictions over proper capitalization for artifacts */ if ((aname = artifact_name(buf, &objtyp)) != 0 && objtyp == obj->otyp) buf = aname; char slipbuf[strlen(buf) + 1]; if (obj->oartifact) { pline("The artifact seems to resist the attempt."); return 0; } else if (restrict_name(obj, buf) || exist_artifact(obj->otyp, buf)) { int n = rn2((int)strlen(buf)); char c1, c2; strcpy(slipbuf, buf); c1 = lowc(buf[n]); do c2 = 'a' + rn2('z' - 'a' + 1); while (c1 == c2); slipbuf[n] = (slipbuf[n] == c1) ? c2 : highc(c2); /* keep same case */ pline("While engraving your %s slips.", body_part(HAND)); win_pause_output(P_MESSAGE); pline("You engrave: \"%s\".", slipbuf); buf = slipbuf; } oname(obj, buf); return 0; }
bool shkcatch(struct obj *obj) { struct monst *shkp = shopkeeper; if (u.uinshop && shkp && !shkp->mfroz && !shkp->msleep && u.dx && u.dy && inroom(u.ux + u.dx, u.uy + u.dy) + 1 == u.uinshop && shkp->mx == ESHK(shkp)->shk.x && shkp->my == ESHK(shkp)->shk.y && u.ux == ESHK(shkp)->shd.x && u.uy == ESHK(shkp)->shd.y) { pline("%s nimbly catches the %s.", Monnam(shkp), xname(obj)); obj->nobj = shkp->minvent; shkp->minvent = obj; return (1); } return (0); }
Boolean shkcatch(obj_t *obj) { monst_t *shkp = shopkeeper; if (you.uinshop && shkp && !(shkp->bitflags & (M_IS_FROZEN | M_IS_ASLEEP)) && you.dx && you.dy && inroom(you.ux+you.dx, you.uy+you.dy) + 1 == you.uinshop && shkp->mx == ESHK(shkp)->shk.x && shkp->my == ESHK(shkp)->shk.y && you.ux == ESHK(shkp)->shd.x && you.uy == ESHK(shkp)->shd.y) { StrPrintF(ScratchBuffer, "%s nimbly catches the %s.", Monnam(shkp), xname(obj)); message(ScratchBuffer); obj->nobj = shkp->minvent; shkp->minvent = obj; return true; } return false; }
void DOF1::SetName(QString name) { if(Root.IsNull()) { throw NoLabelInicialisationException("DOF1: label do not inicialised."); } char nf[1000]; for (int i = 0; i < name.size(); i++) { nf[i] = name.at(i).toAscii(); } nf[name.size()] = 0; TCollection_ExtendedString xname(nf); TDataStd_Name::Set(Root, xname); }
void TData::GetValue(QString* value) { if(Root.IsNull()) { throw NoLabelInicialisationException("TData: label do not inicialised."); } Handle(TDataStd_Comment) STRING = new TDataStd_Comment(); TCollection_ExtendedString xname(""); if(Root.FindAttribute(TDataStd_Comment::GetID(),STRING)) { xname = STRING->Get(); TCollection_AsciiString AsciiName(xname); QString qstr(AsciiName.ToCString()); *value = qstr; } }
QString TData::GetName() { if(Root.IsNull()) { throw NoLabelInicialisationException("TData: label do not inicialised."); } Handle(TDataStd_Name) NAME = new TDataStd_Name(); TCollection_ExtendedString xname(""); if(Root.FindAttribute(TDataStd_Name::GetID(),NAME)) { // the attribute is found xname = NAME->Get(); } TCollection_AsciiString AsciiName(xname); QString qstr(AsciiName.ToCString()); return qstr; }
void rndcurse() /* curse a few inventory items at random! */ { int nobj = 0; int cnt, onum; struct obj *otmp; static const char *mal_aura = "feel a malignant aura surround %s."; if (uwep && (uwep->oartifact == ART_MAGICBANE) && rn2(20)) { You(mal_aura, "the magic-absorbing blade"); return; } if(Antimagic) { shieldeff(u.ux, u.uy); You(mal_aura, "you"); } for (otmp = invent; otmp; otmp = otmp->nobj) nobj++; if (nobj) for (cnt = rnd(6/((!!Antimagic) + (!!Half_spell_damage) + 1)); cnt > 0; cnt--) { onum = rn2(nobj); for(otmp = invent; onum != 0; onum--) otmp = otmp->nobj; if(otmp->oartifact && spec_ability(otmp, SPFX_INTEL) && rn2(10) < 8) { pline("%s resists!", The(xname(otmp))); continue; } if(otmp->blessed) unbless(otmp); else curse(otmp); } }
void docall(struct obj *obj) { char buf[BUFSZ], qbuf[QBUFSZ]; struct obj otemp; char **str1; if (!obj->dknown) return; /* probably blind */ otemp = *obj; otemp.quan = 1L; otemp.onamelth = 0; otemp.oxlth = 0; if (objects[otemp.otyp].oc_class == POTION_CLASS && otemp.fromsink) /* kludge, meaning it's sink water */ sprintf(qbuf,"Call a stream of %s fluid:", OBJ_DESCR(objects[otemp.otyp])); else sprintf(qbuf, "Call %s:", an(xname(&otemp))); getlin(qbuf, buf); if (!*buf || *buf == '\033') return; /* clear old name */ str1 = &(objects[obj->otyp].oc_uname); if (*str1) free(*str1); /* strip leading and trailing spaces; uncalls item if all spaces */ mungspaces(buf); if (!*buf) { if (*str1) { /* had name, so possibly remove from disco[] */ /* strip name first, for the update_inventory() call from undiscover_object() */ *str1 = NULL; undiscover_object(obj->otyp); } } else { *str1 = strcpy(malloc((unsigned)strlen(buf)+1), buf); discover_object(obj->otyp, FALSE, TRUE); /* possibly add to disco[] */ } }
int dosit() { static const char *sit_message = "sit on the %s."; register struct trap *trap; register int typ = levl[u.ux][u.uy].typ; if(Levitation) { pline("You're sitting on air."); return 0; } if(OBJ_AT(u.ux, u.uy)) { register struct obj *obj; obj = level.objects[u.ux][u.uy]; You("sit on %s.", the(xname(obj))); if(!Is_box(obj)) pline("It's not very comfortable..."); } else if ((trap = t_at(u.ux, u.uy)) != 0) { if (u.utrap) { exercise(A_WIS, FALSE); /* you're getting stuck longer */ if(u.utraptype == TT_BEARTRAP) { You("can't sit down with your %s in the bear trap.", body_part(FOOT)); u.utrap++; } else if(u.utraptype == TT_PIT) { if(trap->ttyp == SPIKED_PIT) { You("sit down on a spike. Ouch!"); losehp(1, "sitting on an iron spike", KILLED_BY); exercise(A_STR, FALSE); } else You("sit down in the pit."); u.utrap += rn2(5); } else if(u.utraptype == TT_WEB) { You("sit in the spider web and get entangled further!"); u.utrap += rn1(10, 5); } else if(u.utraptype == TT_LAVA) { /* Must have fire resistance or they'd be dead already */ You("sit in the lava!"); u.utrap += rnd(4); losehp(d(2,10), "sitting in lava", KILLED_BY); } else if(u.utraptype == TT_INFLOOR) { You("can't maneuver to sit!"); u.utrap++; } } else { You("sit down."); dotrap(trap); } } else if(Underwater || Is_waterlevel(&u.uz)) { if (Is_waterlevel(&u.uz)) pline("There are no cushions floating nearby."); else You("sit down in the muddy bottom."); } else if(is_pool(u.ux, u.uy)) { You("sit in the water."); if (!rn2(10) && uarm) (void) rust_dmg(uarm, "armor", 1, TRUE); #ifdef POLYSELF /* Note: without POLYSELF, this can't _happen_ without */ /* water walking boots.... */ if (!rn2(10) && uarmf && uarmf->otyp != WATER_WALKING_BOOTS) (void) rust_dmg(uarm, "armor", 1, TRUE); #endif #ifdef SINKS } else if(IS_SINK(typ)) { You(sit_message, defsyms[S_sink].explanation); Your("%s gets wet.", humanoid(uasmon) ? "rump" : "underside"); #endif } else if(IS_ALTAR(typ)) { You(sit_message, defsyms[S_altar].explanation); altar_wrath(u.ux, u.uy); } else if(typ == STAIRS) { You(sit_message, "stairs"); } else if(typ == LADDER) { You(sit_message, "ladder"); } else if (is_lava(u.ux, u.uy)) { /* must be WWalking */ You(sit_message, "lava"); pline("The lava burns you!"); losehp(d((Fire_resistance ? 2 : 10), 10), "sitting on lava", KILLED_BY); } else if (is_ice(u.ux, u.uy)) { You(sit_message, defsyms[S_ice].explanation); if (!Cold_resistance) pline("The ice feels cold."); } else if (typ == DRAWBRIDGE_DOWN) { You(sit_message, "drawbridge"); } else if(IS_THRONE(typ)) { You(sit_message, defsyms[S_throne].explanation); if (rnd(6) > 4) { switch (rnd(13)) { case 1: (void) adjattrib(rn2(A_MAX), -rn1(4,3), FALSE); losehp(rnd(10), "cursed throne", KILLED_BY_AN); break; case 2: (void) adjattrib(rn2(A_MAX), 1, FALSE); break; case 3: pline("A%s electric shock shoots through your body!", (Shock_resistance) ? "" : " massive"); losehp(Shock_resistance ? rnd(6) : rnd(30), "electric chair", KILLED_BY_AN); exercise(A_CON, FALSE); break; case 4: You("feel much, much better!"); if(u.uhp >= (u.uhpmax - 5)) u.uhpmax += 4; u.uhp = u.uhpmax; make_blinded(0L,TRUE); make_sick(0L,FALSE); heal_legs(); flags.botl = 1; break; case 5: take_gold(); break; case 6: if(u.uluck + rn2(5) < 0) { You("feel your luck is changing."); change_luck(1); } else makewish(); break; case 7: { register int cnt = rnd(10); pline("A voice echoes:"); verbalize("Thy audience hath been summoned, %s!", flags.female ? "Dame" : "Sire"); while(cnt--) (void) makemon(courtmon(), u.ux, u.uy); break; } case 8: pline("A voice echoes:"); verbalize("By thy Imperious order, %s...", flags.female ? "Dame" : "Sire"); do_genocide(1); break; case 9: pline("A voice echoes:"); verbalize("A curse upon thee for sitting upon this most holy throne!"); if (Luck > 0) { make_blinded(Blinded + rn1(100,250),TRUE); } else rndcurse(); break; case 10: if (Luck < 0 || (HSee_invisible & INTRINSIC)) { if (level.flags.nommap) { pline( "A terrible drone fills your head!"); make_confused(HConfusion + rnd(30), FALSE); } else { pline("An image forms in your mind."); do_mapping(); } } else { Your("vision becomes clear."); HSee_invisible |= FROMOUTSIDE; newsym(u.ux, u.uy); } break; case 11: if (Luck < 0) { You("feel threatened."); aggravate(); } else { You("feel a wrenching sensation."); tele(); /* teleport him */ } break; case 12: You("are granted an insight!"); if (invent) { int ret, cval = rn2(5); /* agrees w/seffects() */ /* use up `cval' "charges"; 0 is special case */ do { ret = ggetobj("identify", identify, cval); if (ret < 0) break; /* quit */ } while (ret == 0 || (cval -= ret) > 0); } break; case 13: Your("mind turns into a pretzel!"); make_confused(HConfusion + rn1(7,16),FALSE); break; default: impossible("throne effect"); break; } } else You("feel somehow out of place..."); if (!rn2(3) && IS_THRONE(levl[u.ux][u.uy].typ)) { /* may have teleported */ pline("The throne vanishes in a puff of logic."); levl[u.ux][u.uy].typ = ROOM; if(Invisible) newsym(u.ux,u.uy); } #ifdef POLYSELF } else if (lays_eggs(uasmon) || u.umonnum == PM_QUEEN_BEE) { struct obj *uegg; if (!flags.female) { pline("Males can't lay eggs!"); return 0; } if (u.uhunger < (int)objects[EGG].oc_nutrition) { You("don't have enough energy to lay an egg."); return 0; } uegg = mksobj(EGG, FALSE, FALSE); uegg->spe = 1; uegg->quan = 1; uegg->owt = weight(uegg); uegg->corpsenm = (u.umonnum==PM_QUEEN_BEE ? PM_KILLER_BEE : monsndx(uasmon)); uegg->known = uegg->dknown = 1; You("lay an egg."); dropy(uegg); stackobj(uegg); morehungry((int)objects[EGG].oc_nutrition); #endif } else if (u.uswallow) pline("There are no seats in here!"); else pline("Having fun sitting on the %s?", surface(u.ux,u.uy)); return(1); }
int dosit() { static const char sit_message[] = "VERB_SITZEN auf OBJECT KASUS_DATIV ARTIKEL_BESTIMMTER %s."; /* EN static const char sit_message[] = "sit on the %s."; */ register struct trap *trap; register int typ = levl[u.ux][u.uy].typ; #ifdef STEED if (u.usteed) { You("VERB_SITZEN bereits auf KASUS_DATIV %s.", mon_nam(u.usteed)); /* EN You("are already sitting on %s.", mon_nam(u.usteed)); */ return (0); } #endif if(!can_reach_floor()) { if (Levitation) You("VERB_SCHLAGEN Purzelbäume."); /* EN You("tumble in place."); */ else You("VERB_SITZEN auf Luft."); /* EN You("are sitting on air."); */ return 0; } else if (is_pool(u.ux, u.uy) && !Underwater) { /* water walking */ goto in_water; } if(OBJ_AT(u.ux, u.uy)) { register struct obj *obj; obj = level.objects[u.ux][u.uy]; You("VERB_SITZEN auf OBJECT KASUS_DATIV %s.", the(xname(obj))); /* EN You("sit on %s.", the(xname(obj))); */ if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH)) pline("Das ist nicht sehr bequem ..."); /* EN pline("It's not very comfortable..."); */ } else if ((trap = t_at(u.ux, u.uy)) != 0 || (u.utrap && (u.utraptype >= TT_LAVA))) { if (u.utrap) { exercise(A_WIS, FALSE); /* you're getting stuck longer */ if(u.utraptype == TT_BEARTRAP) { pline("Mit KASUS_DATIV PRONOMEN_POSSESSIV %s in KASUS_DATIV ARTIKEL_BESTIMMTER NOUN_BEARTRAP SUBJECT_IM_SATZ VERB_KOENNEN PRONOMEN_PERSONAL OBJECT PRONOMEN_PERSONAL nicht hinsetzen.", body_part(FOOT)); /* EN You_cant("sit down with your %s in the bear trap.", body_part(FOOT)); */ u.utrap++; } else if(u.utraptype == TT_PIT) { if(trap->ttyp == SPIKED_PIT) { You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL auf einen Stachel. Aua!"); /* EN You("sit down on a spike. Ouch!"); */ losehp(1, "durch Sitzen auf einen Eisenstachel", KILLED_WITHOUT_PREPOSITION); /* EN losehp(1, "sitting on an iron spike", KILLED_BY); */ exercise(A_STR, FALSE); } else You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL in die Grube."); /* EN You("sit down in the pit."); */ u.utrap += rn2(5); } else if(u.utraptype == TT_WEB) { You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL ins Spinnenetz und VERB_VERHEDDERN OBJECT PRONOMEN_PERSONAL noch mehr!"); /* EN You("sit in the spider web and get entangled further!"); */ u.utrap += rn1(10, 5); } else if(u.utraptype == TT_LAVA) { /* Must have fire resistance or they'd be dead already */ You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL in die Lava!"); /* EN You("sit in the lava!"); */ u.utrap += rnd(4); losehp(d(2,10), "durch Sitzen in Lava", KILLED_WITHOUT_PREPOSITION); /* EN losehp(d(2,10), "sitting in lava", KILLED_BY); */ } else if(u.utraptype == TT_INFLOOR) { You("VERB_CAN OBJECT PRONOMEN_PERSONAL nicht richtig hinsetzen!"); /* EN You_cant("maneuver to sit!"); */ u.utrap++; } } else { You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL hin."); /* EN You("sit down."); */ dotrap(trap, 0); } } else if(Underwater || Is_waterlevel(&u.uz)) { if (Is_waterlevel(&u.uz)) pline("Hier gibt es keine Sitzkissen."); /* EN There("are no cushions floating nearby."); */ else You("VERB_SETZEN OBJECT PRONOMEN_PERSONAL auf den schlammigen Untergrund."); /* EN You("sit down on the muddy bottom."); */ } else if(is_pool(u.ux, u.uy)) { in_water: You("VERB_SITZEN im Wasser."); /* EN You("sit in the water."); */ if (!rn2(10) && uarm) (void) rust_dmg(uarm, "NOUN_ARMOR", 1, TRUE, &youmonst); /* EN (void) rust_dmg(uarm, "armor", 1, TRUE, &youmonst); */ if (!rn2(10) && uarmf && uarmf->otyp != WATER_WALKING_BOOTS) (void) rust_dmg(uarm, "NOUN_ARMOR", 1, TRUE, &youmonst); /* EN (void) rust_dmg(uarm, "armor", 1, TRUE, &youmonst); */ #ifdef SINKS } else if(IS_SINK(typ)) { You(sit_message, defsyms[S_sink].explanation); Your("%s VERB_WERDEN nass.", humanoid(youmonst.data) ? "NOUN_HINTERTEIL" : "NOUN_UNTERSEITE"); /* EN Your("%s gets wet.", humanoid(youmonst.data) ? "rump" : "underside"); */ #endif } else if(IS_ALTAR(typ)) { You(sit_message, defsyms[S_altar].explanation); altar_wrath(u.ux, u.uy); } else if(IS_GRAVE(typ)) { You(sit_message, defsyms[S_grave].explanation); } else if(typ == STAIRS) { You(sit_message, "NOUN_STUFEs"); /* EN You(sit_message, "stairs"); */ } else if(typ == LADDER) { You(sit_message, "NOUN_LADDER"); /* EN You(sit_message, "ladder"); */ } else if (is_lava(u.ux, u.uy)) { /* must be WWalking */ You(sit_message, "NOUN_LAVA"); /* EN You(sit_message, "lava"); */ burn_away_slime(); if (likes_lava(youmonst.data)) { pline_The("NOUN_LAVA fühlt sich warm an."); /* EN pline_The("lava feels warm."); */ return 1; } pline_The("NOUN_LAVA VERB_VERBRENNEN OBJECT PRONOMEN_PERSONAL!"); /* EN pline_The("lava burns you!"); */ losehp(d((Fire_resistance ? 2 : 10), 10), "durch Sitzen auf Lava", KILLED_WITHOUT_PREPOSITION); /* EN "sitting on lava", KILLED_BY); */ } else if (is_ice(u.ux, u.uy)) { You(sit_message, defsyms[S_ice].explanation); if (!Cold_resistance) pline_The("NOUN_ICE fühlt sich kalt an."); /* EN if (!Cold_resistance) pline_The("ice feels cold."); */ } else if (typ == DRAWBRIDGE_DOWN) { You(sit_message, "NOUN_DRAWBRIDGE"); /* EN You(sit_message, "drawbridge"); */ } else if(IS_THRONE(typ)) { You(sit_message, defsyms[S_throne].explanation); if (rnd(6) > 4) { switch (rnd(13)) { case 1: (void) adjattrib(rn2(A_MAX), -rn1(4,3), FALSE); losehp(rnd(10), "ADJEKTIV_CURSED NOUN_THRON", KILLED_BY_AN); /* EN losehp(rnd(10), "cursed throne", KILLED_BY_AN); */ break; case 2: (void) adjattrib(rn2(A_MAX), 1, FALSE); break; case 3: pline("SUBJECT ARTIKEL_UNBESTIMMTER%s elektrischer NOUN_SCHLAG VERB_SCHIESSEN OBJECT durch PRONOMEN_POSSESSIV NOUN_BODY!", /* EN pline("A%s electric shock shoots through your body!", */ (Shock_resistance) ? "" : " massiver"); /* EN (Shock_resistance) ? "n" : " massive"); */ losehp(Shock_resistance ? rnd(6) : rnd(30), "ADJEKTIV_ELEKTRISCH NOUN_STUHL", KILLED_BY_AN); /* EN "electric chair", KILLED_BY_AN); */ exercise(A_CON, FALSE); break; case 4: Du_fuehlst_dich("viel, viel besser!"); /* EN You_feel("much, much better!"); */ if (Upolyd) { if (u.mh >= (u.mhmax - 5)) u.mhmax += 4; u.mh = u.mhmax; } if(u.uhp >= (u.uhpmax - 5)) u.uhpmax += 4; u.uhp = u.uhpmax; make_blinded(0L,TRUE); make_sick(0L, (char *) 0, FALSE, SICK_ALL); heal_legs(); flags.botl = 1; break; case 5: take_gold(); break; case 6: if(u.uluck + rn2(5) < 0) { You("VERB_FUEHLEN, NEUER_SATZ SUBJECT_IM_SATZ wie PRONOMEN_POSSESSIV NOUN_LUCK sich ändert."); /* EN You_feel("your luck is changing."); */ change_luck(1); } else makewish(); break; case 7: { register int cnt = rnd(10); pline("Eine Stimme ertönt:"); /* EN pline("A voice echoes:"); */ verbalize("Euer Auditorium erwartet Euch bereits, %s!", /* EN verbalize("Thy audience hath been summoned, %s!", */ flags.female ? "Gebieterin" : "Gebieter"); /* EN flags.female ? "Dame" : "Sire"); */ while(cnt--) (void) makemon(courtmon(), u.ux, u.uy, NO_MM_FLAGS); break; } case 8: pline("Eine Stimme ertönt:"); /* EN pline("A voice echoes:"); */ verbalize("Wie es Euch beliebt, %s...", /* EN verbalize("By thy Imperious order, %s...", */ flags.female ? "Gebieterin" : "Gebieter"); /* EN flags.female ? "Dame" : "Sire"); */ do_genocide(5); /* REALLY|ONTHRONE, see do_genocide() */ break; case 9: pline("Eine Stimme ertönt:"); /* EN pline("A voice echoes:"); */ verbalize("SATZBEGINN MODIFIER_VERB_IMPERATIV VERB_SEIN verflucht dafür, NEUER_SATZ dass SUBJECT_IM_SATZ PRONOMEN_PERSONAL OBJECT PRONOMEN_PERSONAL auf diesem allerheiligsten Thron niedergelassen VERB_HABEN!"); /* EN verbalize("A curse upon thee for sitting upon this most holy throne!"); */ if (Luck > 0) { make_blinded(Blinded + rn1(100,250),TRUE); } else rndcurse(); break; case 10: if (Luck < 0 || (HSee_invisible & INTRINSIC)) { if (level.flags.nommap) { pline( "Ein schreckliches Dröhnen erfüllt KASUS_AKKUSATIV PRONOMEN_POSSESSIV NOUN_KOPF!"); /* EN "A terrible drone fills your head!"); */ make_confused(HConfusion + rnd(30), FALSE); } else { pline("Ein Bild formt sich in KASUS_DATIV PRONOMEN_POSSESSIV NOUN_GEDANKEs."); /* EN pline("An image forms in your mind."); */ do_mapping(); } } else { Your("NOUN_BLICK klärt sich."); /* EN Your("vision becomes clear."); */ HSee_invisible |= FROMOUTSIDE; newsym(u.ux, u.uy); } break; case 11: if (Luck < 0) { Du_fuehlst_dich("bedroht."); /* EN You_feel("threatened."); */ aggravate(); } else { Du_spuerst("einen reißenden Schmerz."); /* EN You_feel("a wrenching sensation."); */ tele(); /* teleport him */ } break; case 12: Dir_wird("eine Einsicht gewährt!"); /* EN You("are granted an insight!"); */ if (invent) { /* rn2(5) agrees w/seffects() */ identify_pack(rn2(5)); } break; case 13: Your("NOUN_VERSTAND verknotet sich zu einer Bretzel!"); /* EN Your("mind turns into a pretzel!"); */ make_confused(HConfusion + rn1(7,16),FALSE); break; default: impossible("throne effect"); break; } } else { if (is_prince(youmonst.data)) Du_fuehlst_dich("hier sehr wohl."); /* EN You_feel("very comfortable here."); */ else Du_fuehlst_dich("irgendwie fehl am Platz ..."); /* EN You_feel("somehow out of place..."); */ } if (!rn2(3) && IS_THRONE(levl[u.ux][u.uy].typ)) { /* may have teleported */ levl[u.ux][u.uy].typ = ROOM; pline_The("NOUN_THRON VERB_AUFLOESEN sich in ein Logikwölkchen SATZKLAMMER."); /* EN pline_The("throne vanishes in a puff of logic."); */ newsym(u.ux,u.uy); } } else if (lays_eggs(youmonst.data)) { struct obj *uegg; if (!flags.female) { pline("Männchen können keine Eier legen!"); /* EN pline("Males can't lay eggs!"); */ return 0; } if (u.uhunger < (int)objects[EGG].oc_nutrition) { You("VERB_HAVE nicht genug Energie um ein Ei zu legen."); /* EN You("don't have enough energy to lay an egg."); */ return 0; } uegg = mksobj(EGG, FALSE, FALSE); uegg->spe = 1; uegg->quan = 1; uegg->owt = weight(uegg); uegg->corpsenm = egg_type_from_parent(u.umonnum, FALSE); uegg->known = uegg->dknown = 1; attach_egg_hatch_timeout(uegg); You("VERB_LEGEN ein Ei."); /* EN You("lay an egg."); */ dropy(uegg); stackobj(uegg); morehungry((int)objects[EGG].oc_nutrition); } else if (u.uswallow) pline("Hier gibt es keine Sitzmöglichkeiten!"); /* EN There("are no seats in here!"); */ else pline("Spaß daran, %s zu sitzen?", auf_dem_Boden(u.ux,u.uy)); /* EN pline("Having fun sitting on the %s?", surface(u.ux,u.uy)); */ return(1); }
/* Called every turn during chest-forcing. The caller must set u.utracked[tos_lock] to the chest in question. */ static int forcelock(void) { struct monst *shkp; boolean costly; struct obj *otmp; struct obj *box = u.utracked[tos_lock]; if (!obj_with_u(box)) return reset_pick(); if (!uwep_can_force()) /* prints the messages; ensures uwep != NULL */ return reset_pick(); if (u.uoccupation_progress[tos_lock]++ >= 50 || nohands(youmonst.data)) { pline(msgc_failrandom, "You give up your attempt to force the lock."); if (!nohands(youmonst.data)) exercise(is_blade(uwep) ? A_DEX : A_STR, TRUE); return reset_pick(); } if (is_blade(uwep)) { if (rn2(1000 - (int)uwep->spe) > (992 - greatest_erosion(uwep) * 10) && !uwep->cursed && !obj_resists(uwep, 0, 99)) { /* for a +0 weapon, probability that it survives an unsuccessful attempt to force the lock is (.992)^50 = .67 */ pline(msgc_substitute, "%sour %s broke!", (uwep->quan > 1L) ? "One of y" : "Y", xname(uwep)); useup(uwep); pline_implied(msgc_failcurse, "You can't exactly force that lock now."); exercise(A_DEX, TRUE); return reset_pick(); } } else /* blunt */ wake_nearby(FALSE); /* due to hammering on the container */ if (rn2(100) >= objects[uwep->otyp].oc_wldam * 2) return 1; /* still busy */ pline(msgc_actionok, "You succeed in forcing the lock."); box->olocked = 0; box->obroken = 1; costly = (*u.ushops && costly_spot(youmonst.mx, youmonst.my)); shkp = costly ? shop_keeper(level, *u.ushops) : 0; if (!is_blade(uwep) && !rn2(3)) { long loss = 0L; pline(msgc_substitute, "In fact, you've totally destroyed %s.", the(xname(box))); /* Put the contents on ground at the hero's feet. */ while ((otmp = box->cobj) != 0) { obj_extract_self(otmp); if (!rn2(3) || otmp->oclass == POTION_CLASS) { chest_shatter_msg(otmp); if (costly) loss += stolen_value(otmp, youmonst.mx, youmonst.my, (boolean) shkp->mpeaceful, TRUE); if (otmp->quan == 1L) { obfree(otmp, NULL); continue; } useup(otmp); } if (box->otyp == ICE_BOX && otmp->otyp == CORPSE) { otmp->age = moves - otmp->age; /* actual age */ start_corpse_timeout(otmp); } place_object(otmp, level, youmonst.mx, youmonst.my); stackobj(otmp); } if (costly) loss += stolen_value(box, youmonst.mx, youmonst.my, (boolean) shkp->mpeaceful, TRUE); if (loss) pline(msgc_unpaid, "You owe %ld %s for objects destroyed.", loss, currency(loss)); delobj(box); } else { if (costly) { struct obj *cobjbak = box->cobj; box->cobj = (struct obj *)0; verbalize(msgc_unpaid, "You damage it, you bought it!"); bill_dummy_object(box); box->cobj = cobjbak; } } exercise(is_blade(uwep) ? A_DEX : A_STR, TRUE); return reset_pick(); }
/* pick a lock on a chest or door with a given object */ int pick_lock(struct obj *pick, const struct nh_cmd_arg *arg) { int picktyp, c; coord cc; schar dx, dy, dz; struct rm *door; struct obj *otmp; const char *qbuf; if (!getargdir(arg, NULL, &dx, &dy, &dz)) return 0; cc.x = youmonst.mx + dx; cc.y = youmonst.my + dy; if (!isok(cc.x, cc.y)) return 0; picktyp = pick->otyp; pick->lastused = moves; /* Check whether we're resuming an interrupted previous attempt. For a floor pick, we have u.utracked[tos_lock] as a non-zeroobj and dx and dy as 0. For a door, we have u.utracked_location[tl_lock] specifying the location and u.utracked[tos_lock] as &zeroobj. */ if (u.uoccupation_progress[tos_lock] && ((u.utracked_location[tl_lock].x == cc.x && u.utracked_location[tl_lock].y == cc.y && u.utracked[tos_lock] == &zeroobj) || (dx == 0 && dy == 0 && u.utracked[tos_lock] != &zeroobj))) { static const char no_longer[] = "Unfortunately, you can no longer %s %s."; if (nohands(youmonst.data)) { const char *what = (picktyp == LOCK_PICK) ? "pick" : "key"; if (picktyp == CREDIT_CARD) what = "card"; pline(msgc_interrupted, no_longer, "hold the", what); return reset_pick(); } else if (u.utracked[tos_lock] != &zeroobj && !can_reach_floor()) { pline(msgc_interrupted, no_longer, "reach the", "lock"); return reset_pick(); } else { const char *action = lock_action(); if (turnstate.continue_message) pline(msgc_occstart, "You resume your attempt at %s.", action); one_occupation_turn(picklock, "picking the lock", occ_lock); return 1; } } if (nohands(youmonst.data)) { pline(msgc_cancelled, "You can't hold %s -- you have no hands!", doname(pick)); return 0; } if ((picktyp != LOCK_PICK && picktyp != CREDIT_CARD && picktyp != SKELETON_KEY)) { impossible("picking lock with object %d?", picktyp); return 0; } if (!dx && !dy) { /* pick lock on a container */ const char *verb; boolean it; int count; if (dz < 0) { pline(msgc_cancelled, "There isn't any sort of lock up %s.", Levitation ? "here" : "there"); return 0; } else if (is_lava(level, youmonst.mx, youmonst.my)) { pline(msgc_cancelled, "Doing that would probably melt your %s.", xname(pick)); return 0; } else if (is_pool(level, youmonst.mx, youmonst.my) && !Underwater) { /* better YAFM - AIS */ pline(msgc_cancelled, "Canals might have locks, but this water doesn't."); return 0; } count = 0; c = 'n'; /* in case there are no boxes here */ for (otmp = level->objects[cc.x][cc.y]; otmp; otmp = otmp->nexthere) if (Is_box(otmp)) { ++count; if (!can_reach_floor()) { pline(msgc_cancelled, "You can't reach %s from up here.", the(xname(otmp))); return 0; } it = 0; if (otmp->obroken) verb = "fix"; else if (!otmp->olocked) verb = "lock", it = 1; else if (picktyp != LOCK_PICK) verb = "unlock", it = 1; else verb = "pick"; qbuf = msgprintf( "There is %s here, %s %s?", safe_qbuf("", sizeof ("There is here, unlock its lock?"), doname(otmp), an(simple_typename(otmp->otyp)), "a box"), verb, it ? "it" : "its lock"); c = ynq(qbuf); if (c == 'q') return 0; if (c == 'n') continue; if (otmp->obroken) { pline(msgc_cancelled, "You can't fix its broken lock with %s.", doname(pick)); return 0; } else if (picktyp == CREDIT_CARD && !otmp->olocked) { /* credit cards are only good for unlocking */ pline(msgc_cancelled, "You can't do that with %s.", doname(pick)); return 0; } u.utracked[tos_lock] = otmp; u.uoccupation_progress[tos_lock] = 0; break; } if (c != 'y') { if (!count) pline(msgc_cancelled, "There doesn't seem to be any sort of lock here."); return 0; /* decided against all boxes */ } } else { /* pick the lock in a door */ struct monst *mtmp; if (u.utrap && u.utraptype == TT_PIT) { pline(msgc_cancelled, "You can't reach over the edge of the pit."); return 0; } door = &level->locations[cc.x][cc.y]; if ((mtmp = m_at(level, cc.x, cc.y)) && canseemon(mtmp)) { if (picktyp == CREDIT_CARD && (mx_eshk(mtmp) || mtmp->data == &mons[PM_ORACLE])) verbalize(msgc_npcvoice, "No checks, no credit, no problem."); else pline(msgc_mispaste, "I don't think %s would appreciate that.", mon_nam(mtmp)); return 0; } if (mtmp && (mtmp->m_ap_type == M_AP_FURNITURE) && (mtmp->mappearance == S_hcdoor || mtmp->mappearance == S_vcdoor) && !Protection_from_shape_changers) { stumble_onto_mimic(mtmp, dx, dy); return 1; } if (!IS_DOOR(door->typ)) { if (is_drawbridge_wall(cc.x, cc.y) >= 0) pline(msgc_cancelled, "You %s no lock on the drawbridge.", Blind ? "feel" : "see"); else pline(msgc_mispaste, "You %s no door there.", Blind ? "feel" : "see"); return 0; } switch (door->doormask) { case D_NODOOR: pline(msgc_cancelled, "This doorway has no door."); return 0; case D_ISOPEN: pline(msgc_cancelled, "You cannot lock an open door."); return 0; case D_BROKEN: pline(msgc_cancelled, "This door is broken."); return 0; default: /* credit cards are only good for unlocking */ if (picktyp == CREDIT_CARD && !(door->doormask & D_LOCKED)) { pline(msgc_cancelled, "You can't lock a door with a credit card."); return 0; } /* At this point, the player knows that the door is a door, and whether it's locked, but not whether it's trapped; to do this, we set the mem_door_l flag and call map_background, which will clear it if necessary (i.e. not a door after all). */ level->locations[cc.x][cc.y].mem_door_l = 1; map_background(cc.x, cc.y, TRUE); u.utracked[tos_lock] = &zeroobj; u.utracked_location[tl_lock] = cc; u.uoccupation_progress[tos_lock] = 0; } } one_occupation_turn(picklock, "picking the lock", occ_lock); return 1; }
int dosit() { static const char sit_message[] = "sit on the %s."; register struct trap *trap; register int typ = levl[u.ux][u.uy].typ; #ifdef STEED if (u.usteed) { You("are already sitting on %s.", mon_nam(u.usteed)); return (0); } #endif if(!can_reach_floor()) { if (Levitation) You("tumble in place."); else You("are sitting on air."); return 0; } else if (is_pool(u.ux, u.uy) && !Underwater) { /* water walking */ goto in_water; } if(OBJ_AT(u.ux, u.uy)) { register struct obj *obj; obj = level.objects[u.ux][u.uy]; You("sit on %s.", the(xname(obj))); if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH)) pline("It's not very comfortable..."); } else if ((trap = t_at(u.ux, u.uy)) != 0 || (u.utrap && (u.utraptype >= TT_LAVA))) { if (u.utrap) { exercise(A_WIS, FALSE); /* you're getting stuck longer */ if(u.utraptype == TT_BEARTRAP) { You_cant("sit down with your %s in the bear trap.", body_part(FOOT)); u.utrap++; } else if(u.utraptype == TT_PIT) { if(trap->ttyp == SPIKED_PIT) { You("sit down on a spike. Ouch!"); losehp(1, "sitting on an iron spike", KILLED_BY); exercise(A_STR, FALSE); } else You("sit down in the pit."); u.utrap += rn2(5); } else if(u.utraptype == TT_WEB) { You("sit in the spider web and get entangled further!"); u.utrap += rn1(10, 5); } else if(u.utraptype == TT_LAVA) { /* Must have fire resistance or they'd be dead already */ You("sit in the lava!"); u.utrap += rnd(4); losehp(d(2,10), "sitting in lava", KILLED_BY); } else if(u.utraptype == TT_INFLOOR) { You_cant("maneuver to sit!"); u.utrap++; } } else { You("sit down."); dotrap(trap, 0); } } else if(Underwater || Is_waterlevel(&u.uz)) { if (Is_waterlevel(&u.uz)) There("are no cushions floating nearby."); else You("sit down on the muddy bottom."); } else if(is_pool(u.ux, u.uy)) { in_water: You("sit in the water."); if (!rn2(10) && uarm) (void) rust_dmg(uarm, "armor", 1, TRUE, &youmonst); if (!rn2(10) && uarmf && uarmf->otyp != WATER_WALKING_BOOTS) (void) rust_dmg(uarm, "armor", 1, TRUE, &youmonst); #ifdef SINKS } else if(IS_SINK(typ)) { You(sit_message, defsyms[S_sink].explanation); Your("%s gets wet.", humanoid(youmonst.data) ? "rump" : "underside"); #endif } else if(IS_ALTAR(typ)) { You(sit_message, defsyms[S_altar].explanation); altar_wrath(u.ux, u.uy); } else if(IS_GRAVE(typ)) { You(sit_message, defsyms[S_grave].explanation); } else if(typ == STAIRS) { You(sit_message, "stairs"); } else if(typ == LADDER) { You(sit_message, "ladder"); } else if (is_lava(u.ux, u.uy)) { /* must be WWalking */ You(sit_message, "lava"); burn_away_slime(); if (likes_lava(youmonst.data)) { pline_The("lava feels warm."); return 1; } pline_The("lava burns you!"); losehp(d((Fire_resistance ? 2 : 10), 10), "sitting on lava", KILLED_BY); } else if (is_ice(u.ux, u.uy)) { You(sit_message, defsyms[S_ice].explanation); if (!Cold_resistance) pline_The("ice feels cold."); } else if (typ == DRAWBRIDGE_DOWN) { You(sit_message, "drawbridge"); } else if(IS_THRONE(typ)) { You(sit_message, defsyms[S_throne].explanation); if (rnd(6) > 4) { switch (rnd(13)) { case 1: (void) adjattrib(rn2(A_MAX), -rn1(4,3), FALSE); losehp(rnd(10), "cursed throne", KILLED_BY_AN); break; case 2: (void) adjattrib(rn2(A_MAX), 1, FALSE); break; case 3: pline("A%s electric shock shoots through your body!", (Shock_resistance) ? "n" : " massive"); losehp(Shock_resistance ? rnd(6) : rnd(30), "electric chair", KILLED_BY_AN); exercise(A_CON, FALSE); break; case 4: You_feel("much, much better!"); if (Upolyd) { if (u.mh >= (u.mhmax - 5)) u.mhmax += 4; u.mh = u.mhmax; } if(u.uhp >= (u.uhpmax - 5)) u.uhpmax += 4; u.uhp = u.uhpmax; make_blinded(0L,TRUE); make_sick(0L, (char *) 0, FALSE, SICK_ALL); heal_legs(); flags.botl = 1; break; case 5: take_gold(); break; case 6: if(u.uluck + rn2(5) < 0) { You_feel("your luck is changing."); change_luck(1); } else makewish(); break; case 7: { register int cnt = rnd(10); pline("A voice echoes:"); verbalize("Thy audience hath been summoned, %s!", flags.female ? "Dame" : "Sire"); while(cnt--) (void) makemon(courtmon(), u.ux, u.uy, NO_MM_FLAGS); break; } case 8: pline("A voice echoes:"); verbalize("By thy Imperious order, %s...", flags.female ? "Dame" : "Sire"); do_genocide(5); /* REALLY|ONTHRONE, see do_genocide() */ break; case 9: pline("A voice echoes:"); verbalize("A curse upon thee for sitting upon this most holy throne!"); if (Luck > 0) { make_blinded(Blinded + rn1(100,250),TRUE); } else rndcurse(); break; case 10: if (Luck < 0 || (HSee_invisible & INTRINSIC)) { if (level.flags.nommap) { pline( "A terrible drone fills your head!"); make_confused(HConfusion + rnd(30), FALSE); } else { pline("An image forms in your mind."); do_mapping(); } } else { Your("vision becomes clear."); HSee_invisible |= FROMOUTSIDE; newsym(u.ux, u.uy); } break; case 11: if (Luck < 0) { You_feel("threatened."); aggravate(); } else { You_feel("a wrenching sensation."); tele(); /* teleport him */ } break; case 12: You("are granted an insight!"); if (invent) { /* rn2(5) agrees w/seffects() */ identify_pack(rn2(5)); } break; case 13: Your("mind turns into a pretzel!"); make_confused(HConfusion + rn1(7,16),FALSE); break; default: impossible("throne effect"); break; } } else { if (is_prince(youmonst.data)) You_feel("very comfortable here."); else You_feel("somehow out of place..."); } if (!rn2(3) && IS_THRONE(levl[u.ux][u.uy].typ)) { /* may have teleported */ levl[u.ux][u.uy].typ = ROOM; pline_The("throne vanishes in a puff of logic."); newsym(u.ux,u.uy); } } else if (lays_eggs(youmonst.data)) { struct obj *uegg; if (!flags.female) { pline("Males can't lay eggs!"); return 0; } if (u.uhunger < (int)objects[EGG].oc_nutrition) { You("don't have enough energy to lay an egg."); return 0; } uegg = mksobj(EGG, FALSE, FALSE); uegg->spe = 1; uegg->quan = 1; uegg->owt = weight(uegg); uegg->corpsenm = egg_type_from_parent(u.umonnum, FALSE); uegg->known = uegg->dknown = 1; attach_egg_hatch_timeout(uegg); You("lay an egg."); dropy(uegg); stackobj(uegg); morehungry((int)objects[EGG].oc_nutrition); } else if (u.uswallow) There("are no seats in here!"); else pline("Having fun sitting on the %s?", surface(u.ux,u.uy)); return(1); }
STATIC_OVL void obj_timer_checks(struct obj *otmp, xchar x, xchar y, int force) /* 0 = no force so do checks, <0 = force off, >0 force on */ { long tleft = 0L; short action = ROT_CORPSE; boolean restart_timer = FALSE; boolean on_floor = (otmp->where == OBJ_FLOOR); boolean buried = (otmp->where == OBJ_BURIED); /* Check for corpses just placed on or in ice */ if (otmp->otyp == CORPSE && (on_floor || buried) && is_ice(x,y)) { tleft = stop_timer(action, (genericptr_t)otmp); if (tleft == 0L) { action = REVIVE_MON; tleft = stop_timer(action, (genericptr_t)otmp); } if (tleft != 0L) { long age; tleft = tleft - monstermoves; /* mark the corpse as being on ice */ ON_ICE(otmp) = 1; #ifdef DEBUG_EFFECTS pline("%s is now on ice at %d,%d.", The(xname(otmp)),x,y); #endif /* Adjust the time remaining */ tleft *= ROT_ICE_ADJUSTMENT; restart_timer = TRUE; /* Adjust the age; must be same as in obj_ice_age() */ age = monstermoves - otmp->age; otmp->age = monstermoves - (age * ROT_ICE_ADJUSTMENT); } } /* Check for corpses coming off ice */ else if ((force < 0) || (otmp->otyp == CORPSE && ON_ICE(otmp) && ((on_floor && !is_ice(x,y)) || !on_floor))) { tleft = stop_timer(action, (genericptr_t)otmp); if (tleft == 0L) { action = REVIVE_MON; tleft = stop_timer(action, (genericptr_t)otmp); } if (tleft != 0L) { long age; tleft = tleft - monstermoves; ON_ICE(otmp) = 0; #ifdef DEBUG_EFFECTS pline("%s is no longer on ice at %d,%d.", The(xname(otmp)),x,y); #endif /* Adjust the remaining time */ tleft /= ROT_ICE_ADJUSTMENT; restart_timer = TRUE; /* Adjust the age */ age = monstermoves - otmp->age; otmp->age = otmp->age + (age / ROT_ICE_ADJUSTMENT); } } /* now re-start the timer with the appropriate modifications */ if (restart_timer) (void) start_timer(tleft, TIMER_OBJECT, action, (genericptr_t)otmp); }
static void break_armor(void) { struct obj *otmp; if (breakarm(youmonst.data)) { if ((otmp = uarm) != 0) { if (donning(otmp)) cancel_don(); pline("You break out of your armor!"); exercise(A_STR, FALSE); Armor_gone(); useup(otmp); } if ((otmp = uarmc) != 0) { if (otmp->oartifact) { pline("Your %s falls off!", cloak_simple_name(otmp)); Cloak_off(); dropx(otmp); } else { pline("Your %s tears apart!", cloak_simple_name(otmp)); Cloak_off(); useup(otmp); } } if (uarmu) { pline("Your shirt rips to shreds!"); useup(uarmu); } } else if (sliparm(youmonst.data)) { if (((otmp = uarm) != 0) && (racial_exception(&youmonst, otmp) < 1)) { if (donning(otmp)) cancel_don(); pline("Your armor falls around you!"); Armor_gone(); dropx(otmp); } if ((otmp = uarmc) != 0) { if (is_whirly(youmonst.data)) pline("Your %s falls, unsupported!", cloak_simple_name(otmp)); else pline("You shrink out of your %s!", cloak_simple_name(otmp)); Cloak_off(); dropx(otmp); } if ((otmp = uarmu) != 0) { if (is_whirly(youmonst.data)) pline("You seep right through your shirt!"); else pline("You become much too small for your shirt!"); setworn(NULL, otmp->owornmask & W_ARMU); dropx(otmp); } } if (has_horns(youmonst.data)) { if ((otmp = uarmh) != 0) { if (is_flimsy(otmp) && !donning(otmp)) { char hornbuf[BUFSZ], yourbuf[BUFSZ]; /* Future possiblities: This could damage/destroy helmet */ sprintf(hornbuf, "horn%s", plur(num_horns(youmonst.data))); pline("Your %s %s through %s %s.", hornbuf, vtense(hornbuf, "pierce"), shk_your(yourbuf, otmp), xname(otmp)); } else { if (donning(otmp)) cancel_don(); pline("Your helmet falls to the %s!", surface(u.ux, u.uy)); Helmet_off(); dropx(otmp); } } } if (nohands(youmonst.data) || verysmall(youmonst.data)) { if ((otmp = uarmg) != 0) { if (donning(otmp)) cancel_don(); /* Drop weapon along with gloves */ pline("You drop your gloves%s!", uwep ? " and weapon" : ""); drop_weapon(0); Gloves_off(); dropx(otmp); } if ((otmp = uarms) != 0) { pline("You can no longer hold your shield!"); Shield_off(); dropx(otmp); } if ((otmp = uarmh) != 0) { if (donning(otmp)) cancel_don(); pline("Your helmet falls to the %s!", surface(u.ux, u.uy)); Helmet_off(); dropx(otmp); } } if (nohands(youmonst.data) || verysmall(youmonst.data) || slithy(youmonst.data) || youmonst.data->mlet == S_CENTAUR) { if ((otmp = uarmf) != 0) { if (donning(otmp)) cancel_don(); if (is_whirly(youmonst.data)) pline("Your boots fall away!"); else pline("Your boots %s off your feet!", verysmall(youmonst.data) ? "slide" : "are pushed"); Boots_off(); dropx(otmp); } } }
char *doname(struct obj *obj) { char prefix[PREFIX]; char *bp = xname(obj); if(obj->quan != 1) { sprintf(prefix, "%d ", obj->quan); } else { strcpy(prefix, "a "); } switch(obj->olet) { case AMULET_SYM: if(strncmp(bp, "cheap ", 6) != 0) { strcpy(prefix, "the "); } break; case ARMOR_SYM: if((obj->owornmask & W_ARMOR) != 0) { strcat(bp, " (being worn)"); } if(obj->known != 0) { strcat(prefix, sitoa((obj->spe - 10) + objects[obj->otyp].a_ac)); strcat(prefix, " "); } break; case WEAPON_SYM: if(obj->known != 0) { strcat(prefix, sitoa(obj->spe)); strcat(prefix, " "); } break; case WAND_SYM: if(obj->known) { sprintf(eos(bp), " (%d)", obj->spe); } break; case RING_SYM: if((obj->owornmask & W_RINGR) != 0) { strcat(bp, " (on right hand)"); } if((obj->owornmask & W_RINGL) != 0) { strcat(bp, " (on left hand)"); } if((obj->known != 0) && ((objects[obj->otyp].bits & SPEC) != 0)) { strcat(prefix, sitoa(obj->spe)); strcat(prefix, " "); } break; } if((obj->owornmask & W_WEP) != 0) { strcat(bp, " (weapon in hand)"); } if(obj->unpaid != 0) { strcat(bp, " (unpaid)"); } if((strcmp(prefix, "a ") == 0) && (index(vowels, *bp) != 0)) { strcpy(prefix, "an "); } bp = strprepend(bp, prefix); return bp; }