1 /* NetHack 3.6 ball.c $NHDT-Date: 1450402033 2015/12/18 01:27:13 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.29 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) David Cohrs, 2006. */
4 /* NetHack may be freely redistributed. See license for details. */
6 /* JNetHack Copyright */
7 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
8 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2018 */
9 /* JNetHack may be freely redistributed. See license for details. */
12 * =============================================================*/
16 STATIC_DCL int NDECL(bc_order);
17 STATIC_DCL void NDECL(litter);
26 pline("Startled, you drop the iron ball.");
28 pline("
\8bÁ
\82¢
\82Ä
\82 \82È
\82½
\82Í
\93S
\8b\85\82ð
\97\8e\82µ
\82½
\81D");
30 setuwep((struct obj *) 0);
31 if (uswapwep == uball)
32 setuswapwep((struct obj *) 0);
34 setuqwep((struct obj *) 0);
46 gets_hit = (((uball->ox != u.ux) || (uball->oy != u.uy))
47 && ((uwep == uball) ? FALSE : (boolean) rn2(5)));
52 pline_The("iron ball falls on your %s.", body_part(HEAD));
54 pline("
\93S
\8b\85\82Í
\82 \82È
\82½
\82Ì%s
\82Ì
\8fã
\82É
\97\8e\82¿
\82½
\81D", body_part(HEAD));
56 if (is_metallic(uarmh)) {
58 pline("Fortunately, you are wearing a hard helmet.");
60 pline("
\8dK
\89^
\82É
\82à
\81C
\82 \82È
\82½
\82Í
\8cÅ
\82¢
\8a\95\82ð
\90g
\82É
\82Â
\82¯
\82Ä
\82¢
\82½
\81D");
62 } else if (flags.verbose)
64 pline("%s does not protect you.", Yname2(uarmh));
66 Your("%s
\82Å
\82Í
\8eç
\82ê
\82È
\82¢
\81D", xname(uarmh));
69 losehp(Maybe_Half_Phys(dmg), "crunched in the head by an iron ball",
72 losehp(Maybe_Half_Phys(dmg), "
\93S
\8b\85\82Å
\93ª
\82ð
\91Å
\82Á
\82Ä", KILLED_BY);
78 * To make this work, we have to mess with the hero's mind. The rules for
81 * 1. If the hero can see them, fine.
82 * 2. If the hero can't see either, it isn't seen.
83 * 3. If either is felt it is seen.
84 * 4. If either is felt and moved, it disappears.
86 * If the hero can see, then when a move is done, the ball and chain are
87 * first picked up, the positions under them are corrected, then they
88 * are moved after the hero moves. Not too bad.
90 * If the hero is blind, then she can "feel" the ball and/or chain at any
91 * time. However, when the hero moves, the felt ball and/or chain become
92 * unfelt and whatever was felt "under" the ball&chain appears. Pretty
93 * nifty, but it requires that the ball&chain "remember" what was under
94 * them --- i.e. they pick-up glyphs when they are felt and drop them when
95 * moved (and felt). When swallowed, the ball&chain are pulled completely
96 * off of the dungeon, but are still on the object chain. They are placed
97 * under the hero when she is expelled.
102 * int u.bglyph glyph under the ball
103 * int u.cglyph glyph under the chain
104 * int u.bc_felt mask for ball/chain being felt
105 * #define BC_BALL 0x01 bit mask in u.bc_felt for ball
106 * #define BC_CHAIN 0x02 bit mask in u.bc_felt for chain
107 * int u.bc_order ball & chain order
109 * u.bc_felt is also manipulated in display.c and read.c, the others only
110 * in this file. None of these variables are valid unless the player is
114 /* values for u.bc_order */
115 #define BCPOS_DIFFER 0 /* ball & chain at different positions */
116 #define BCPOS_CHAIN 1 /* chain on top of ball */
117 #define BCPOS_BALL 2 /* ball on top of chain */
120 * Place the ball & chain under the hero. Make sure that the ball & chain
121 * variables are set (actually only needed when blind, but what the heck).
122 * It is assumed that when this is called, the ball and chain are NOT
123 * attached to the object list.
125 * Should not be called while swallowed except on waterlevel.
130 if (!uchain || !uball) {
131 impossible("Where are your ball and chain?");
135 (void) flooreffects(uchain, u.ux, u.uy, ""); /* chain might rust */
137 if (carried(uball)) /* the ball is carried */
138 u.bc_order = BCPOS_DIFFER;
140 /* ball might rust -- already checked when carried */
141 (void) flooreffects(uball, u.ux, u.uy, "");
142 place_object(uball, u.ux, u.uy);
143 u.bc_order = BCPOS_CHAIN;
146 place_object(uchain, u.ux, u.uy);
148 u.bglyph = u.cglyph = levl[u.ux][u.uy].glyph; /* pick up glyph */
157 if (Is_waterlevel(&u.uz)) {
158 /* we need to proceed with the removal from the floor
159 * so that movebubbles() processing will disregard it as
160 * intended. Ignore all the vision stuff.
163 obj_extract_self(uball);
164 obj_extract_self(uchain);
166 /* ball&chain not unplaced while swallowed */
170 if (!carried(uball)) {
171 obj_extract_self(uball);
172 if (Blind && (u.bc_felt & BC_BALL)) /* drop glyph */
173 levl[uball->ox][uball->oy].glyph = u.bglyph;
175 newsym(uball->ox, uball->oy);
177 obj_extract_self(uchain);
178 if (Blind && (u.bc_felt & BC_CHAIN)) /* drop glyph */
179 levl[uchain->ox][uchain->oy].glyph = u.cglyph;
181 newsym(uchain->ox, uchain->oy);
182 u.bc_felt = 0; /* feel nothing */
186 * Return the stacking of the hero's ball & chain. This assumes that the
187 * hero is being punished.
194 if (uchain->ox != uball->ox || uchain->oy != uball->oy || carried(uball)
198 for (obj = level.objects[uball->ox][uball->oy]; obj;
199 obj = obj->nexthere) {
205 impossible("bc_order: ball&chain not in same location!");
212 * The hero is either about to go blind or already blind and just punished.
213 * Set up the ball and chain variables so that the ball and chain are "felt".
216 set_bc(already_blind)
219 int ball_on_floor = !carried(uball);
221 u.bc_order = bc_order(); /* get the order */
222 u.bc_felt = ball_on_floor ? BC_BALL | BC_CHAIN : BC_CHAIN; /* felt */
224 if (already_blind || u.uswallow) {
225 u.cglyph = u.bglyph = levl[u.ux][u.uy].glyph;
230 * Since we can still see, remove the ball&chain and get the glyph that
231 * would be beneath them. Then put the ball&chain back. This is pretty
232 * disgusting, but it will work.
234 remove_object(uchain);
236 remove_object(uball);
238 newsym(uchain->ox, uchain->oy);
239 u.cglyph = levl[uchain->ox][uchain->oy].glyph;
241 if (u.bc_order == BCPOS_DIFFER) { /* different locations */
242 place_object(uchain, uchain->ox, uchain->oy);
243 newsym(uchain->ox, uchain->oy);
245 newsym(uball->ox, uball->oy); /* see under ball */
246 u.bglyph = levl[uball->ox][uball->oy].glyph;
247 place_object(uball, uball->ox, uball->oy);
248 newsym(uball->ox, uball->oy); /* restore ball */
252 if (u.bc_order == BCPOS_CHAIN) {
253 place_object(uball, uball->ox, uball->oy);
254 place_object(uchain, uchain->ox, uchain->oy);
256 place_object(uchain, uchain->ox, uchain->oy);
257 place_object(uball, uball->ox, uball->oy);
259 newsym(uball->ox, uball->oy);
266 * Move the ball and chain. This is called twice for every move. The first
267 * time to pick up the ball and chain before the move, the second time to
268 * place the ball and chain after the move. If the ball is carried, this
269 * function should never have BC_BALL as part of its control.
271 * Should not be called while swallowed.
274 move_bc(before, control, ballx, bally, chainx, chainy)
276 xchar ballx, bally, chainx, chainy; /* only matter !before */
280 * The hero is blind. Time to work hard. The ball and chain that
281 * are attached to the hero are very special. The hero knows that
282 * they are attached, so when they move, the hero knows that they
283 * aren't at the last position remembered. This is complicated
284 * by the fact that the hero can "feel" the surrounding locations
285 * at any time, hence, making one or both of them show up again.
286 * So, we have to keep track of which is felt at any one time and
290 if ((control & BC_CHAIN) && (control & BC_BALL)) {
292 * Both ball and chain moved. If felt, drop glyph.
294 if (u.bc_felt & BC_BALL)
295 levl[uball->ox][uball->oy].glyph = u.bglyph;
296 if (u.bc_felt & BC_CHAIN)
297 levl[uchain->ox][uchain->oy].glyph = u.cglyph;
300 /* Pick up glyph at new location. */
301 u.bglyph = levl[ballx][bally].glyph;
302 u.cglyph = levl[chainx][chainy].glyph;
304 movobj(uball, ballx, bally);
305 movobj(uchain, chainx, chainy);
306 } else if (control & BC_BALL) {
307 if (u.bc_felt & BC_BALL) {
308 if (u.bc_order == BCPOS_DIFFER) { /* ball by itself */
309 levl[uball->ox][uball->oy].glyph = u.bglyph;
310 } else if (u.bc_order == BCPOS_BALL) {
311 if (u.bc_felt & BC_CHAIN) { /* know chain is there */
312 map_object(uchain, 0);
314 levl[uball->ox][uball->oy].glyph = u.bglyph;
317 u.bc_felt &= ~BC_BALL; /* no longer feel the ball */
320 /* Pick up glyph at new position. */
321 u.bglyph = (ballx != chainx || bally != chainy)
322 ? levl[ballx][bally].glyph
325 movobj(uball, ballx, bally);
326 } else if (control & BC_CHAIN) {
327 if (u.bc_felt & BC_CHAIN) {
328 if (u.bc_order == BCPOS_DIFFER) {
329 levl[uchain->ox][uchain->oy].glyph = u.cglyph;
330 } else if (u.bc_order == BCPOS_CHAIN) {
331 if (u.bc_felt & BC_BALL) {
332 map_object(uball, 0);
334 levl[uchain->ox][uchain->oy].glyph = u.cglyph;
337 u.bc_felt &= ~BC_CHAIN;
339 /* Pick up glyph at new position. */
340 u.cglyph = (ballx != chainx || bally != chainy)
341 ? levl[chainx][chainy].glyph
344 movobj(uchain, chainx, chainy);
347 u.bc_order = bc_order(); /* reset the order */
352 * The hero is not blind. To make this work correctly, we need to
353 * pick up the ball and chain before the hero moves, then put them
354 * in their new positions after the hero moves.
359 * Neither ball nor chain is moving, so remember which was
360 * on top until !before. Use the variable u.bc_order
361 * since it is only valid when blind.
363 u.bc_order = bc_order();
366 remove_object(uchain);
367 newsym(uchain->ox, uchain->oy);
368 if (!carried(uball)) {
369 remove_object(uball);
370 newsym(uball->ox, uball->oy);
373 int on_floor = !carried(uball);
375 if ((control & BC_CHAIN)
376 || (!control && u.bc_order == BCPOS_CHAIN)) {
377 /* If the chain moved or nothing moved & chain on top. */
379 place_object(uball, ballx, bally);
380 place_object(uchain, chainx, chainy); /* chain on top */
382 place_object(uchain, chainx, chainy);
384 place_object(uball, ballx, bally);
387 newsym(chainx, chainy);
389 newsym(ballx, bally);
394 /* return TRUE if the caller needs to place the ball and chain down again
396 * Should not be called while swallowed. Should be called before movement,
397 * because we might want to move the ball or chain to the hero's old
400 * It is called if we are moving. It is also called if we are teleporting
401 * *if* the ball doesn't move and we thus must drag the chain. It is not
402 * called for ordinary teleportation.
404 * allow_drag is only used in the ugly special case where teleporting must
405 * drag the chain, while an identical-looking movement must drag both the ball
409 drag_ball(x, y, bc_control, ballx, bally, chainx, chainy, cause_delay,
413 xchar *ballx, *bally, *chainx, *chainy;
414 boolean *cause_delay;
417 struct trap *t = (struct trap *) 0;
418 boolean already_in_rock;
422 *chainx = uchain->ox;
423 *chainy = uchain->oy;
425 *cause_delay = FALSE;
427 if (dist2(x, y, uchain->ox, uchain->oy) <= 2) { /* nothing moved */
428 move_bc(1, *bc_control, *ballx, *bally, *chainx, *chainy);
432 /* only need to move the chain? */
433 if (carried(uball) || distmin(x, y, uball->ox, uball->oy) <= 2) {
434 xchar oldchainx = uchain->ox, oldchainy = uchain->oy;
435 *bc_control = BC_CHAIN;
436 move_bc(1, *bc_control, *ballx, *bally, *chainx, *chainy);
437 if (carried(uball)) {
438 /* move chain only if necessary */
439 if (distmin(x, y, uchain->ox, uchain->oy) > 1) {
445 #define CHAIN_IN_MIDDLE(chx, chy) \
446 (distmin(x, y, chx, chy) <= 1 \
447 && distmin(chx, chy, uball->ox, uball->oy) <= 1)
448 #define IS_CHAIN_ROCK(x, y) \
449 (IS_ROCK(levl[x][y].typ) \
450 || (IS_DOOR(levl[x][y].typ) \
451 && (levl[x][y].doormask & (D_CLOSED | D_LOCKED))))
452 /* Don't ever move the chain into solid rock. If we have to, then instead
453 * undo the move_bc() and jump to the drag ball code. Note that this also
454 * means the "cannot carry and drag" message will not appear, since unless we
455 * moved at least two squares there is no possibility of the chain position
456 * being in solid rock.
458 #define SKIP_TO_DRAG \
460 *chainx = oldchainx; \
461 *chainy = oldchainy; \
462 move_bc(0, *bc_control, *ballx, *bally, *chainx, *chainy); \
465 if (IS_CHAIN_ROCK(u.ux, u.uy) || IS_CHAIN_ROCK(*chainx, *chainy)
466 || IS_CHAIN_ROCK(uball->ox, uball->oy))
467 already_in_rock = TRUE;
469 already_in_rock = FALSE;
471 switch (dist2(x, y, uball->ox, uball->oy)) {
472 /* two spaces diagonal from ball, move chain inbetween */
474 *chainx = (uball->ox + x) / 2;
475 *chainy = (uball->oy + y) / 2;
476 if (IS_CHAIN_ROCK(*chainx, *chainy) && !already_in_rock)
480 /* player is distance 2/1 from ball; move chain to one of the
487 xchar tempx, tempy, tempx2, tempy2;
489 /* find position closest to current position of chain */
490 /* no effect if current position is already OK */
491 if (abs(x - uball->ox) == 1) {
494 tempy = tempy2 = (uball->oy + y) / 2;
496 tempx = tempx2 = (uball->ox + x) / 2;
500 if (IS_CHAIN_ROCK(tempx, tempy) && !IS_CHAIN_ROCK(tempx2, tempy2)
501 && !already_in_rock) {
503 /* Avoid pathological case *if* not teleporting:
505 * _X move northeast -----> X@
508 if (dist2(u.ux, u.uy, uball->ox, uball->oy) == 5
509 && dist2(x, y, tempx, tempy) == 1)
511 /* Avoid pathological case *if* not teleporting:
513 * _X move east -----> X_
516 if (dist2(u.ux, u.uy, uball->ox, uball->oy) == 4
517 && dist2(x, y, tempx, tempy) == 2)
522 } else if (!IS_CHAIN_ROCK(tempx, tempy)
523 && IS_CHAIN_ROCK(tempx2, tempy2) && !already_in_rock) {
525 if (dist2(u.ux, u.uy, uball->ox, uball->oy) == 5
526 && dist2(x, y, tempx2, tempy2) == 1)
528 if (dist2(u.ux, u.uy, uball->ox, uball->oy) == 4
529 && dist2(x, y, tempx2, tempy2) == 2)
534 } else if (IS_CHAIN_ROCK(tempx, tempy)
535 && IS_CHAIN_ROCK(tempx2, tempy2) && !already_in_rock) {
537 } else if (dist2(tempx, tempy, uchain->ox, uchain->oy)
538 < dist2(tempx2, tempy2, uchain->ox, uchain->oy)
539 || ((dist2(tempx, tempy, uchain->ox, uchain->oy)
540 == dist2(tempx2, tempy2, uchain->ox, uchain->oy))
551 /* ball is two spaces horizontal or vertical from player; move*/
552 /* chain inbetween *unless* current chain position is OK */
554 if (CHAIN_IN_MIDDLE(uchain->ox, uchain->oy))
556 *chainx = (x + uball->ox) / 2;
557 *chainy = (y + uball->oy) / 2;
558 if (IS_CHAIN_ROCK(*chainx, *chainy) && !already_in_rock)
562 /* ball is one space diagonal from player. Check for the
563 * following special case:
565 * _ moving southwest becomes @_
567 * (This will also catch teleporting that happens to resemble
568 * this case, but oh well.) Otherwise fall through.
571 if (dist2(x, y, uball->ox, uball->oy) == 2
572 && dist2(x, y, uchain->ox, uchain->oy) == 4) {
577 if (IS_CHAIN_ROCK(*chainx, *chainy) && !already_in_rock)
584 /* do nothing if possible */
585 if (CHAIN_IN_MIDDLE(uchain->ox, uchain->oy))
587 /* otherwise try to drag chain to player's old position */
588 if (CHAIN_IN_MIDDLE(u.ux, u.uy)) {
593 /* otherwise use player's new position (they must have
594 teleported, for this to happen) */
600 impossible("bad chain movement");
604 #undef CHAIN_IN_MIDDLE
610 if (near_capacity() > SLT_ENCUMBER && dist2(x, y, u.ux, u.uy) <= 2) {
612 You("cannot %sdrag the heavy iron ball.",
613 invent ? "carry all that and also " : "");
615 You("%s
\8fd
\82¢
\93S
\8b\85\82ð
\82Ð
\82«
\82¸
\82é
\82±
\82Æ
\82ª
\82Å
\82«
\82È
\82¢
\81D",
616 invent ? "
\82»
\82ê
\82¾
\82¯
\82Ì
\89×
\95¨
\82ð
\8e\9d\82Á
\82½
\82Ü
\82Ü" : "");
622 if ((is_pool(uchain->ox, uchain->oy)
623 /* water not mere continuation of previous water */
624 && (levl[uchain->ox][uchain->oy].typ == POOL
625 || !is_pool(uball->ox, uball->oy)
626 || levl[uball->ox][uball->oy].typ == POOL))
627 || ((t = t_at(uchain->ox, uchain->oy))
628 && (t->ttyp == PIT || t->ttyp == SPIKED_PIT || t->ttyp == HOLE
629 || t->ttyp == TRAPDOOR))) {
632 You_feel("a tug from the iron ball.");
634 You("
\93S
\8b\85\82É
\88ø
\82Á
\82Ï
\82ç
\82ê
\82½
\81D");
638 struct monst *victim;
641 You("are jerked back by the iron ball!");
643 You("
\93S
\8b\85\82É
\82®
\82¢
\82Æ
\88ø
\82Á
\82Ï
\82ç
\82ê
\82½
\81I");
644 if ((victim = m_at(uchain->ox, uchain->oy)) != 0) {
646 int dieroll = rnd(20);
648 tmp = -2 + Luck + find_mac(victim);
649 tmp += omon_adj(victim, uball, TRUE);
652 (void) hmon(victim, uball, HMON_DRAGGED, dieroll);
654 miss(xname(uball), victim);
656 } /* now check again in case mon died */
657 if (!m_at(uchain->ox, uchain->oy)) {
660 newsym(u.ux0, u.uy0);
664 *bc_control = BC_BALL;
665 move_bc(1, *bc_control, *ballx, *bally, *chainx, *chainy);
668 move_bc(0, *bc_control, *ballx, *bally, *chainx, *chainy);
674 *bc_control = BC_BALL | BC_CHAIN;
676 move_bc(1, *bc_control, *ballx, *bally, *chainx, *chainy);
677 if (dist2(x, y, u.ux, u.uy) > 2) {
678 /* Awful case: we're still in range of the ball, so we thought we
679 * could only move the chain, but it turned out that the target
680 * square for the chain was rock, so we had to drag it instead.
681 * But we can't drag it either, because we teleported and are more
682 * than one square from our old position. Revert to the teleport
685 *ballx = *chainx = x;
686 *bally = *chainy = y;
688 xchar newchainx = u.ux, newchainy = u.uy;
691 * Generally, chain moves to hero's previous location and ball
692 * moves to chain's previous location, except that we try to
693 * keep the chain directly between the hero and the ball. But,
694 * take the simple approach if the hero's previous location or
695 * the potential between location is inaccessible.
697 if (dist2(x, y, uchain->ox, uchain->oy) == 4
698 && !IS_CHAIN_ROCK(newchainx, newchainy)) {
699 newchainx = (x + uchain->ox) / 2;
700 newchainy = (y + uchain->oy) / 2;
701 if (IS_CHAIN_ROCK(newchainx, newchainy)) {
702 /* don't let chain move to inaccessible location */
721 * The punished hero drops or throws her iron ball. If the hero is
722 * blind, we must reset the order and glyph. Check for side effects.
723 * This routine expects the ball to be already placed.
725 * Should not be called while swallowed.
733 u.bc_order = bc_order();
735 u.bglyph = (u.bc_order) ? u.cglyph : levl[x][y].glyph;
738 if (x != u.ux || y != u.uy) {
741 const char *pullmsg = "The ball pulls you out of the %s!";
743 const char *pullmsg = "
\93S
\8b\85\82Í%s
\82©
\82ç
\82 \82È
\82½
\82ð
\88ø
\82Á
\82Ï
\82è
\8fo
\82µ
\82½
\81I";
745 if (u.utrap && u.utraptype != TT_INFLOOR
746 && u.utraptype != TT_BURIEDBALL) {
747 switch (u.utraptype) {
750 pline(pullmsg, "pit");
752 pline(pullmsg, "
\97\8e\82µ
\8c\8a");
756 pline(pullmsg, "web");
758 pline(pullmsg, "
\82
\82à
\82Ì
\91\83");
760 pline_The("web is destroyed!");
762 pline("
\82
\82à
\82Ì
\91\83\82Í
\82±
\82í
\82ê
\82½
\81I");
763 deltrap(t_at(u.ux, u.uy));
767 pline(pullmsg, hliquid("lava"));
769 pline(pullmsg, hliquid("
\97n
\8aâ"));
772 register long side = rn2(3) ? LEFT_SIDE : RIGHT_SIDE;
774 pline(pullmsg, "bear trap");
776 pline(pullmsg, "
\8cF
\82Ìã©");
777 set_wounded_legs(side, rn1(1000, 500));
780 Your("%s %s is severely damaged.",
781 (side == LEFT_SIDE) ? "left" : "right",
784 Your("%s%s
\82Í
\82Ð
\82Ç
\82¢
\8f\9d\82ð
\95\89\82Á
\82½
\81D",
785 (side == LEFT_SIDE) ? "
\8d¶" : "
\89E",
789 losehp(Maybe_Half_Phys(2),
790 "leg damage from being pulled out of a bear trap",
793 losehp(Maybe_Half_Phys(2),
794 "
\8cF
\82Ìã©
\82©
\82ç
\94²
\82¯
\82æ
\82¤
\82Æ
\91«
\82ð
\88ø
\82Á
\82Ï
\82Á
\82Ä",
802 fill_pit(u.ux, u.uy);
807 if (!Levitation && !MON_AT(x, y) && !u.utrap
810 && (t->ttyp == PIT || t->ttyp == SPIKED_PIT
811 || t->ttyp == TRAPDOOR || t->ttyp == HOLE)))) {
818 vision_full_recalc = 1; /* hero has moved, recalculate vision later */
821 /* drop glyph under the chain */
822 if (u.bc_felt & BC_CHAIN)
823 levl[uchain->ox][uchain->oy].glyph = u.cglyph;
824 u.bc_felt = 0; /* feel nothing */
825 /* pick up new glyph */
826 u.cglyph = (u.bc_order) ? u.bglyph : levl[u.ux][u.uy].glyph;
828 movobj(uchain, u.ux, u.uy); /* has a newsym */
830 u.bc_order = bc_order();
832 newsym(u.ux0, u.uy0); /* clean up old position */
833 if (u.ux0 != u.ux || u.uy0 != u.uy) {
843 struct obj *otmp = invent, *nextobj;
844 int capacity = weight_cap();
847 nextobj = otmp->nobj;
848 if ((otmp != uball) && (rnd(capacity) <= (int) otmp->owt)) {
849 if (canletgo(otmp, "")) {
851 pline("%s you down the stairs.", Yobjnam2(otmp, "follow"));
853 You("%s
\82Æ
\88ê
\8f\8f\82É
\8aK
\92i
\82ð
\8d~
\82è
\82½
\81D", xname(otmp));
865 uchar dragchance = 3;
868 * Assume that the ball falls forward if:
870 * a) the character is wielding it, or
871 * b) the character has both hands available to hold it (i.e. is
872 * not wielding any weapon), or
873 * c) (perhaps) it falls forward out of his non-weapon hand
875 forward = carried(uball) && (uwep == uball || !uwep || !rn2(3));
879 You("lose your grip on the iron ball.");
881 You("
\93S
\8b\85\82ð
\8eè
\82©
\82ç
\97\8e\82µ
\82Ä
\82µ
\82Ü
\82Á
\82½
\81D");
883 cls(); /* previous level is still displayed although you
884 went down the stairs. Avoids bug C343-20 */
889 pline_The("iron ball drags you downstairs!");
891 You("
\93S
\8b\85\82É
\82æ
\82Á
\82Ä
\8aK
\92i
\82ð
\82±
\82ë
\82ª
\82è
\97\8e\82¿
\82½
\81I");
892 losehp(Maybe_Half_Phys(rnd(6)),
894 "dragged downstairs by an iron ball", NO_KILLER_PREFIX);
896 "
\93S
\8b\85\82É
\82æ
\82è
\8aK
\92i
\82ð
\82±
\82ë
\82ª
\82è
\97\8e\82¿
\82Ä", KILLED_BY);
902 pline_The("iron ball smacks into you!");
904 pline("
\93S
\8b\85\82Í
\82 \82È
\82½
\82É
\83S
\83c
\83\93\82Æ
\82Ô
\82Â
\82©
\82Á
\82½
\81I");
906 losehp(Maybe_Half_Phys(rnd(20)), "iron ball collision",
908 losehp(Maybe_Half_Phys(rnd(20)), "
\93S
\8b\85\82Ì
\8fÕ
\93Ë
\82Å",
910 exercise(A_STR, FALSE);
913 if ((int) dragchance >= rnd(6)) {
915 pline_The("iron ball drags you downstairs!");
917 You("
\93S
\8b\85\82É
\82æ
\82Á
\82Ä
\8aK
\92i
\82ð
\82±
\82ë
\82ª
\82è
\97\8e\82¿
\82½
\81I");
918 losehp(Maybe_Half_Phys(rnd(3)),
920 "dragged downstairs by an iron ball", NO_KILLER_PREFIX);
922 "
\93S
\8b\85\82É
\82æ
\82è
\8aK
\92i
\82ð
\82±
\82ë
\82ª
\82è
\97\8e\82¿
\82Ä", KILLED_BY);
923 exercise(A_STR, FALSE);