1 /* NetHack 3.6 sit.c $NHDT-Date: 1458341129 2016/03/18 22:45:29 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.53 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
9 /* take away the hero's money */
13 struct obj
*otmp
, *nobj
;
16 for (otmp
= invent
; otmp
; otmp
= nobj
) {
18 if (otmp
->oclass
== COIN_CLASS
) {
20 remove_worn_item(otmp
, FALSE
);
25 You_feel("a strange sensation.");
27 You("notice you have no money!");
36 static const char sit_message
[] = "sit on the %s.";
37 register struct trap
*trap
= t_at(u
.ux
, u
.uy
);
38 register int typ
= levl
[u
.ux
][u
.uy
].typ
;
41 You("are already sitting on %s.", mon_nam(u
.usteed
));
44 if (u
.uundetected
&& is_hider(youmonst
.data
) && u
.umonnum
!= PM_TRAPPER
)
45 u
.uundetected
= 0; /* no longer on the ceiling */
47 if (!can_reach_floor(FALSE
)) {
49 There("are no seats in here!");
51 You("tumble in place.");
53 You("are sitting on air.");
55 } else if (u
.ustuck
&& !sticks(youmonst
.data
)) {
56 /* holding monster is next to hero rather than beneath, but
57 hero is in no condition to actually sit at has/her own spot */
58 if (humanoid(u
.ustuck
->data
))
59 pline("%s won't offer %s lap.", Monnam(u
.ustuck
), mhis(u
.ustuck
));
61 pline("%s has no lap.", Monnam(u
.ustuck
));
63 } else if (is_pool(u
.ux
, u
.uy
) && !Underwater
) { /* water walking */
67 if (OBJ_AT(u
.ux
, u
.uy
)
68 /* ensure we're not standing on the precipice */
69 && !uteetering_at_seen_pit(trap
)) {
70 register struct obj
*obj
;
72 obj
= level
.objects
[u
.ux
][u
.uy
];
73 if (youmonst
.data
->mlet
== S_DRAGON
&& obj
->oclass
== COIN_CLASS
) {
74 You("coil up around your %shoard.",
75 (obj
->quan
+ money_cnt(invent
) < u
.ulevel
* 1000) ? "meager "
78 You("sit on %s.", the(xname(obj
)));
79 if (!(Is_box(obj
) || objects
[obj
->otyp
].oc_material
== CLOTH
))
80 pline("It's not very comfortable...");
82 } else if (trap
!= 0 || (u
.utrap
&& (u
.utraptype
>= TT_LAVA
))) {
84 exercise(A_WIS
, FALSE
); /* you're getting stuck longer */
85 if (u
.utraptype
== TT_BEARTRAP
) {
86 You_cant("sit down with your %s in the bear trap.",
89 } else if (u
.utraptype
== TT_PIT
) {
90 if (trap
&& trap
->ttyp
== SPIKED_PIT
) {
91 You("sit down on a spike. Ouch!");
92 losehp(Half_physical_damage
? rn2(2) : 1,
93 "sitting on an iron spike", KILLED_BY
);
94 exercise(A_STR
, FALSE
);
96 You("sit down in the pit.");
98 } else if (u
.utraptype
== TT_WEB
) {
99 You("sit in the spider web and get entangled further!");
100 u
.utrap
+= rn1(10, 5);
101 } else if (u
.utraptype
== TT_LAVA
) {
102 /* Must have fire resistance or they'd be dead already */
103 You("sit in the %s!", hliquid("lava"));
107 losehp(d(2, 10), "sitting in lava",
108 KILLED_BY
); /* lava damage */
109 } else if (u
.utraptype
== TT_INFLOOR
110 || u
.utraptype
== TT_BURIEDBALL
) {
111 You_cant("maneuver to sit!");
118 } else if (Underwater
|| Is_waterlevel(&u
.uz
)) {
119 if (Is_waterlevel(&u
.uz
))
120 There("are no cushions floating nearby.");
122 You("sit down on the muddy bottom.");
123 } else if (is_pool(u
.ux
, u
.uy
)) {
125 You("sit in the %s.", hliquid("water"));
126 if (!rn2(10) && uarm
)
127 (void) water_damage(uarm
, "armor", TRUE
);
128 if (!rn2(10) && uarmf
&& uarmf
->otyp
!= WATER_WALKING_BOOTS
)
129 (void) water_damage(uarm
, "armor", TRUE
);
130 } else if (IS_SINK(typ
)) {
131 You(sit_message
, defsyms
[S_sink
].explanation
);
132 Your("%s gets wet.", humanoid(youmonst
.data
) ? "rump" : "underside");
133 } else if (IS_ALTAR(typ
)) {
134 You(sit_message
, defsyms
[S_altar
].explanation
);
135 altar_wrath(u
.ux
, u
.uy
);
136 } else if (IS_GRAVE(typ
)) {
137 You(sit_message
, defsyms
[S_grave
].explanation
);
138 } else if (typ
== STAIRS
) {
139 You(sit_message
, "stairs");
140 } else if (typ
== LADDER
) {
141 You(sit_message
, "ladder");
142 } else if (is_lava(u
.ux
, u
.uy
)) {
143 /* must be WWalking */
144 You(sit_message
, hliquid("lava"));
146 if (likes_lava(youmonst
.data
)) {
147 pline_The("%s feels warm.", hliquid("lava"));
150 pline_The("%s burns you!", hliquid("lava"));
151 losehp(d((Fire_resistance
? 2 : 10), 10), /* lava damage */
152 "sitting on lava", KILLED_BY
);
153 } else if (is_ice(u
.ux
, u
.uy
)) {
154 You(sit_message
, defsyms
[S_ice
].explanation
);
155 if (!Cold_resistance
)
156 pline_The("ice feels cold.");
157 } else if (typ
== DRAWBRIDGE_DOWN
) {
158 You(sit_message
, "drawbridge");
159 } else if (IS_THRONE(typ
)) {
160 You(sit_message
, defsyms
[S_throne
].explanation
);
164 (void) adjattrib(rn2(A_MAX
), -rn1(4, 3), FALSE
);
165 losehp(rnd(10), "cursed throne", KILLED_BY_AN
);
168 (void) adjattrib(rn2(A_MAX
), 1, FALSE
);
171 pline("A%s electric shock shoots through your body!",
172 (Shock_resistance
) ? "n" : " massive");
173 losehp(Shock_resistance
? rnd(6) : rnd(30), "electric chair",
175 exercise(A_CON
, FALSE
);
178 You_feel("much, much better!");
180 if (u
.mh
>= (u
.mhmax
- 5))
184 if (u
.uhp
>= (u
.uhpmax
- 5))
188 make_blinded(0L, TRUE
);
189 make_sick(0L, (char *) 0, FALSE
, SICK_ALL
);
197 if (u
.uluck
+ rn2(5) < 0) {
198 You_feel("your luck is changing.");
207 /* Magical voice not affected by deafness */
208 pline("A voice echoes:");
209 verbalize("Thy audience hath been summoned, %s!",
210 flags
.female
? "Dame" : "Sire");
212 (void) makemon(courtmon(), u
.ux
, u
.uy
, NO_MM_FLAGS
);
216 /* Magical voice not affected by deafness */
217 pline("A voice echoes:");
218 verbalize("By thine Imperious order, %s...",
219 flags
.female
? "Dame" : "Sire");
220 do_genocide(5); /* REALLY|ONTHRONE, see do_genocide() */
223 /* Magical voice not affected by deafness */
224 pline("A voice echoes:");
226 "A curse upon thee for sitting upon this most holy throne!");
228 make_blinded(Blinded
+ rn1(100, 250), TRUE
);
229 change_luck((Luck
> 1) ? -rnd(2) : -1);
234 if (Luck
< 0 || (HSee_invisible
& INTRINSIC
)) {
235 if (level
.flags
.nommap
) {
236 pline("A terrible drone fills your head!");
237 make_confused((HConfusion
& TIMEOUT
) + (long) rnd(30),
240 pline("An image forms in your mind.");
244 Your("vision becomes clear.");
245 HSee_invisible
|= FROMOUTSIDE
;
251 You_feel("threatened.");
254 You_feel("a wrenching sensation.");
255 tele(); /* teleport him */
259 You("are granted an insight!");
261 /* rn2(5) agrees w/seffects() */
262 identify_pack(rn2(5), FALSE
);
266 Your("mind turns into a pretzel!");
267 make_confused((HConfusion
& TIMEOUT
) + (long) rn1(7, 16),
271 impossible("throne effect");
275 if (is_prince(youmonst
.data
))
276 You_feel("very comfortable here.");
278 You_feel("somehow out of place...");
281 if (!rn2(3) && IS_THRONE(levl
[u
.ux
][u
.uy
].typ
)) {
282 /* may have teleported */
283 levl
[u
.ux
][u
.uy
].typ
= ROOM
;
284 pline_The("throne vanishes in a puff of logic.");
287 } else if (lays_eggs(youmonst
.data
)) {
291 pline("%s can't lay eggs!",
293 ? "You may think you are a platypus, but a male still"
296 } else if (u
.uhunger
< (int) objects
[EGG
].oc_nutrition
) {
297 You("don't have enough energy to lay an egg.");
301 uegg
= mksobj(EGG
, FALSE
, FALSE
);
304 uegg
->owt
= weight(uegg
);
305 /* this sets hatch timers if appropriate */
306 set_corpsenm(uegg
, egg_type_from_parent(u
.umonnum
, FALSE
));
307 uegg
->known
= uegg
->dknown
= 1;
311 morehungry((int) objects
[EGG
].oc_nutrition
);
313 pline("Having fun sitting on the %s?", surface(u
.ux
, u
.uy
));
318 /* curse a few inventory items at random! */
325 static const char mal_aura
[] = "feel a malignant aura surround %s.";
327 if (uwep
&& (uwep
->oartifact
== ART_MAGICBANE
) && rn2(20)) {
328 You(mal_aura
, "the magic-absorbing blade");
333 shieldeff(u
.ux
, u
.uy
);
334 You(mal_aura
, "you");
337 for (otmp
= invent
; otmp
; otmp
= otmp
->nobj
) {
338 /* gold isn't subject to being cursed or blessed */
339 if (otmp
->oclass
== COIN_CLASS
)
344 for (cnt
= rnd(6 / ((!!Antimagic
) + (!!Half_spell_damage
) + 1));
347 for (otmp
= invent
; otmp
; otmp
= otmp
->nobj
) {
349 if (otmp
->oclass
== COIN_CLASS
)
352 break; /* found the target */
354 /* the !otmp case should never happen; picking an already
355 cursed item happens--avoid "resists" message in that case */
356 if (!otmp
|| otmp
->cursed
)
357 continue; /* next target */
359 if (otmp
->oartifact
&& spec_ability(otmp
, SPFX_INTEL
)
361 pline("%s!", Tobjnam(otmp
, "resist"));
373 /* treat steed's saddle as extended part of hero's inventory */
374 if (u
.usteed
&& !rn2(4) && (otmp
= which_armor(u
.usteed
, W_SADDLE
)) != 0
375 && !otmp
->cursed
) { /* skip if already cursed */
381 pline("%s %s.", Yobjnam2(otmp
, "glow"),
382 hcolor(otmp
->cursed
? NH_BLACK
: (const char *) "brown"));
388 /* remove a random INTRINSIC ability */
394 if (HFire_resistance
& INTRINSIC
) {
395 HFire_resistance
&= ~INTRINSIC
;
400 if (HTeleportation
& INTRINSIC
) {
401 HTeleportation
&= ~INTRINSIC
;
402 You_feel("less jumpy.");
406 if (HPoison_resistance
& INTRINSIC
) {
407 HPoison_resistance
&= ~INTRINSIC
;
408 You_feel("a little sick!");
412 if (HTelepat
& INTRINSIC
) {
413 HTelepat
&= ~INTRINSIC
;
414 if (Blind
&& !Blind_telepat
)
415 see_monsters(); /* Can't sense mons anymore! */
416 Your("senses fail!");
420 if (HCold_resistance
& INTRINSIC
) {
421 HCold_resistance
&= ~INTRINSIC
;
426 if (HInvis
& INTRINSIC
) {
427 HInvis
&= ~INTRINSIC
;
428 You_feel("paranoid.");
432 if (HSee_invisible
& INTRINSIC
) {
433 HSee_invisible
&= ~INTRINSIC
;
434 You("%s!", Hallucination
? "tawt you taw a puttie tat"
435 : "thought you saw something");
439 if (HFast
& INTRINSIC
) {
445 if (HStealth
& INTRINSIC
) {
446 HStealth
&= ~INTRINSIC
;
451 /* intrinsic protection is just disabled, not set back to 0 */
452 if (HProtection
& INTRINSIC
) {
453 HProtection
&= ~INTRINSIC
;
454 You_feel("vulnerable.");
458 if (HAggravate_monster
& INTRINSIC
) {
459 HAggravate_monster
&= ~INTRINSIC
;
460 You_feel("less attractive.");