1 /* SCCS Id: @(#)sit.c 3.4 2002/09/21 */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
13 You_feel("a strange sensation.");
15 You("notice you have no gold!");
20 struct obj *otmp, *nobj;
22 for (otmp = invent; otmp; otmp = nobj) {
24 if (otmp->oclass == COIN_CLASS) {
30 You_feel("a strange sensation.");
32 You("notice you have no money!");
41 static const char sit_message[] = "sit on the %s.";
42 register struct trap *trap;
43 register int typ = levl[u.ux][u.uy].typ;
48 You("are already sitting on %s.", mon_nam(u.usteed));
53 if(!can_reach_floor()) {
55 You("tumble in place.");
57 You("are sitting on air.");
59 } else if (is_pool(u.ux, u.uy) && !Underwater) { /* water walking */
63 if(OBJ_AT(u.ux, u.uy)) {
64 register struct obj *obj;
66 obj = level.objects[u.ux][u.uy];
67 You("sit on %s.", the(xname(obj)));
68 if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH))
69 pline("It's not very comfortable...");
71 } else if ((trap = t_at(u.ux, u.uy)) != 0 ||
72 (u.utrap && (u.utraptype >= TT_LAVA))) {
75 exercise(A_WIS, FALSE); /* you're getting stuck longer */
76 if(u.utraptype == TT_BEARTRAP) {
77 You_cant("sit down with your %s in the bear trap.", body_part(FOOT));
79 } else if(u.utraptype == TT_PIT) {
80 if(trap->ttyp == SPIKED_PIT) {
81 You("sit down on a spike. Ouch!");
82 losehp(1, "sitting on an iron spike", KILLED_BY);
83 exercise(A_STR, FALSE);
85 You("sit down in the pit.");
87 } else if(u.utraptype == TT_WEB) {
88 You("sit in the spider web and get entangled further!");
89 u.utrap += rn1(10, 5);
90 } else if(u.utraptype == TT_LAVA) {
91 /* Must have fire resistance or they'd be dead already */
92 You("sit in the lava!");
94 losehp(d(2,10), "sitting in lava", KILLED_BY);
95 } else if(u.utraptype == TT_INFLOOR) {
96 You_cant("maneuver to sit!");
103 } else if(Underwater || Is_waterlevel(&u.uz)) {
104 if (Is_waterlevel(&u.uz))
105 There("are no cushions floating nearby.");
107 You("sit down on the muddy bottom.");
108 } else if(is_pool(u.ux, u.uy)) {
110 You("sit in the water.");
111 if (!rn2(10) && uarm)
112 (void) rust_dmg(uarm, "armor", 1, TRUE, &youmonst);
113 if (!rn2(10) && uarmf && uarmf->otyp != WATER_WALKING_BOOTS)
114 (void) rust_dmg(uarm, "armor", 1, TRUE, &youmonst);
116 } else if(IS_SINK(typ)) {
118 You(sit_message, defsyms[S_sink].explanation);
119 Your("%s gets wet.", humanoid(youmonst.data) ? "rump" : "underside");
121 } else if(IS_ALTAR(typ)) {
123 You(sit_message, defsyms[S_altar].explanation);
124 altar_wrath(u.ux, u.uy);
126 } else if(IS_GRAVE(typ)) {
128 You(sit_message, defsyms[S_grave].explanation);
130 } else if(typ == STAIRS) {
132 You(sit_message, "stairs");
134 } else if(typ == LADDER) {
136 You(sit_message, "ladder");
138 } else if (is_lava(u.ux, u.uy)) {
140 /* must be WWalking */
141 You(sit_message, "lava");
143 if (likes_lava(youmonst.data)) {
144 pline_The("lava feels warm.");
147 pline_The("lava burns you!");
148 losehp(d((Fire_resistance ? 2 : 10), 10),
149 "sitting on lava", KILLED_BY);
151 } else if (is_ice(u.ux, u.uy)) {
153 You(sit_message, defsyms[S_ice].explanation);
154 if (!Cold_resistance) pline_The("ice feels cold.");
156 } else if (typ == DRAWBRIDGE_DOWN) {
158 You(sit_message, "drawbridge");
160 } else if(IS_THRONE(typ)) {
162 You(sit_message, defsyms[S_throne].explanation);
166 (void) adjattrib(rn2(A_MAX), -rn1(4,3), FALSE);
167 losehp(rnd(10), "cursed throne", KILLED_BY_AN);
170 (void) adjattrib(rn2(A_MAX), 1, FALSE);
173 pline("A%s electric shock shoots through your body!",
174 (Shock_resistance) ? "n" : " massive");
175 losehp(Shock_resistance ? rnd(6) : rnd(30),
176 "electric chair", KILLED_BY_AN);
177 exercise(A_CON, FALSE);
180 You_feel("much, much better!");
182 if (u.mh >= (u.mhmax - 5)) u.mhmax += 4;
185 if(u.uhp >= (u.uhpmax - 5)) u.uhpmax += 4;
187 make_blinded(0L,TRUE);
188 make_sick(0L, (char *) 0, FALSE, SICK_ALL);
196 if(u.uluck + rn2(5) < 0) {
197 You_feel("your luck is changing.");
203 register int cnt = rnd(10);
205 pline("A voice echoes:");
206 verbalize("Thy audience hath been summoned, %s!",
207 flags.female ? "Dame" : "Sire");
209 (void) makemon(courtmon(), u.ux, u.uy, NO_MM_FLAGS);
213 pline("A voice echoes:");
214 verbalize("By thy Imperious order, %s...",
215 flags.female ? "Dame" : "Sire");
216 do_genocide(5); /* REALLY|ONTHRONE, see do_genocide() */
219 pline("A voice echoes:");
220 verbalize("A curse upon thee for sitting upon this most holy throne!");
222 make_blinded(Blinded + rn1(100,250),TRUE);
226 if (Luck < 0 || (HSee_invisible & INTRINSIC)) {
227 if (level.flags.nommap) {
229 "A terrible drone fills your head!");
230 make_confused(HConfusion + rnd(30),
233 pline("An image forms in your mind.");
237 Your("vision becomes clear.");
238 HSee_invisible |= FROMOUTSIDE;
244 You_feel("threatened.");
248 You_feel("a wrenching sensation.");
249 tele(); /* teleport him */
253 You("are granted an insight!");
255 /* rn2(5) agrees w/seffects() */
256 identify_pack(rn2(5));
260 Your("mind turns into a pretzel!");
261 make_confused(HConfusion + rn1(7,16),FALSE);
263 default: impossible("throne effect");
267 if (is_prince(youmonst.data))
268 You_feel("very comfortable here.");
270 You_feel("somehow out of place...");
273 if (!rn2(3) && IS_THRONE(levl[u.ux][u.uy].typ)) {
274 /* may have teleported */
275 levl[u.ux][u.uy].typ = ROOM;
276 pline_The("throne vanishes in a puff of logic.");
280 } else if (lays_eggs(youmonst.data)) {
284 pline("Males can't lay eggs!");
288 if (u.uhunger < (int)objects[EGG].oc_nutrition) {
289 You("don't have enough energy to lay an egg.");
293 uegg = mksobj(EGG, FALSE, FALSE);
296 uegg->owt = weight(uegg);
297 uegg->corpsenm = egg_type_from_parent(u.umonnum, FALSE);
298 uegg->known = uegg->dknown = 1;
299 attach_egg_hatch_timeout(uegg);
303 morehungry((int)objects[EGG].oc_nutrition);
304 } else if (u.uswallow)
305 There("are no seats in here!");
307 pline("Having fun sitting on the %s?", surface(u.ux,u.uy));
312 rndcurse() /* curse a few inventory items at random! */
317 static const char mal_aura[] = "feel a malignant aura surround %s.";
319 if (uwep && (uwep->oartifact == ART_MAGICBANE) && rn2(20)) {
320 You(mal_aura, "the magic-absorbing blade");
325 shieldeff(u.ux, u.uy);
326 You(mal_aura, "you");
329 for (otmp = invent; otmp; otmp = otmp->nobj) {
331 /* gold isn't subject to being cursed or blessed */
332 if (otmp->oclass == COIN_CLASS) continue;
337 for (cnt = rnd(6/((!!Antimagic) + (!!Half_spell_damage) + 1));
340 for (otmp = invent; otmp; otmp = otmp->nobj) {
343 if (otmp->oclass == COIN_CLASS) continue;
345 if (--onum == 0) break; /* found the target */
347 /* the !otmp case should never happen; picking an already
348 cursed item happens--avoid "resists" message in that case */
349 if (!otmp || otmp->cursed) continue; /* next target */
351 if(otmp->oartifact && spec_ability(otmp, SPFX_INTEL) &&
353 pline("%s!", Tobjnam(otmp, "resist"));
366 /* treat steed's saddle as extended part of hero's inventory */
367 if (u.usteed && !rn2(4) &&
368 (otmp = which_armor(u.usteed, W_SADDLE)) != 0 &&
369 !otmp->cursed) { /* skip if already cursed */
376 s_suffix(upstart(y_monnam(u.usteed))),
377 aobjnam(otmp, "glow"),
378 hcolor(otmp->cursed ? NH_BLACK : (const char *)"brown"));
386 attrcurse() /* remove a random INTRINSIC ability */
389 case 1 : if (HFire_resistance & INTRINSIC) {
390 HFire_resistance &= ~INTRINSIC;
394 case 2 : if (HTeleportation & INTRINSIC) {
395 HTeleportation &= ~INTRINSIC;
396 You_feel("less jumpy.");
399 case 3 : if (HPoison_resistance & INTRINSIC) {
400 HPoison_resistance &= ~INTRINSIC;
401 You_feel("a little sick!");
404 case 4 : if (HTelepat & INTRINSIC) {
405 HTelepat &= ~INTRINSIC;
406 if (Blind && !Blind_telepat)
407 see_monsters(); /* Can't sense mons anymore! */
408 Your("senses fail!");
411 case 5 : if (HCold_resistance & INTRINSIC) {
412 HCold_resistance &= ~INTRINSIC;
416 case 6 : if (HInvis & INTRINSIC) {
417 HInvis &= ~INTRINSIC;
418 You_feel("paranoid.");
421 case 7 : if (HSee_invisible & INTRINSIC) {
422 HSee_invisible &= ~INTRINSIC;
423 You("%s!", Hallucination ? "tawt you taw a puttie tat"
424 : "thought you saw something");
427 case 8 : if (HFast & INTRINSIC) {
432 case 9 : if (HStealth & INTRINSIC) {
433 HStealth &= ~INTRINSIC;
437 case 10: if (HProtection & INTRINSIC) {
438 HProtection &= ~INTRINSIC;
439 You_feel("vulnerable.");
442 case 11: if (HAggravate_monster & INTRINSIC) {
443 HAggravate_monster &= ~INTRINSIC;
444 You_feel("less attractive.");