1 /* NetHack 3.6 wield.c $NHDT-Date: 1496959480 2017/06/08 22:04:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.54 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Robert Patrick Rankin, 2009. */
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-2016 */
9 /* JNetHack may be freely redistributed. See license for details. */
13 /* KMH -- Differences between the three weapon slots.
15 * The main weapon (uwep):
16 * 1. Is filled by the (w)ield command.
17 * 2. Can be filled with any type of item.
18 * 3. May be carried in one or both hands.
19 * 4. Is used as the melee weapon and as the launcher for
21 * 5. Only conveys intrinsics when it is a weapon, weapon-tool,
23 * 6. Certain cursed items will weld to the hand and cannot be
24 * unwielded or dropped. See erodeable_wep() and will_weld()
25 * below for the list of which items apply.
27 * The secondary weapon (uswapwep):
28 * 1. Is filled by the e(x)change command, which swaps this slot
29 * with the main weapon. If the "pushweapon" option is set,
30 * the (w)ield command will also store the old weapon in the
32 * 2. Can be filled with anything that will fit in the main weapon
33 * slot; that is, any type of item.
34 * 3. Is usually NOT considered to be carried in the hands.
35 * That would force too many checks among the main weapon,
36 * second weapon, shield, gloves, and rings; and it would
37 * further be complicated by bimanual weapons. A special
38 * exception is made for two-weapon combat.
39 * 4. Is used as the second weapon for two-weapon combat, and as
40 * a convenience to swap with the main weapon.
41 * 5. Never conveys intrinsics.
42 * 6. Cursed items never weld (see #3 for reasons), but they also
43 * prevent two-weapon combat.
45 * The quiver (uquiver):
46 * 1. Is filled by the (Q)uiver command.
47 * 2. Can be filled with any type of item.
48 * 3. Is considered to be carried in a special part of the pack.
49 * 4. Is used as the item to throw with the (f)ire command.
50 * This is a convenience over the normal (t)hrow command.
51 * 5. Never conveys intrinsics.
52 * 6. Cursed items never weld; their effect is handled by the normal
54 * 7. The autoquiver option will fill it with something deemed
55 * suitable if (f)ire is used when it's empty.
57 * No item may be in more than one of these slots.
60 STATIC_DCL boolean FDECL(cant_wield_corpse, (struct obj *));
61 STATIC_DCL int FDECL(ready_weapon, (struct obj *));
63 /* used by will_weld() */
64 /* probably should be renamed */
65 #define erodeable_wep(optr) \
66 ((optr)->oclass == WEAPON_CLASS || is_weptool(optr) \
67 || (optr)->otyp == HEAVY_IRON_BALL || (optr)->otyp == IRON_CHAIN)
69 /* used by welded(), and also while wielding */
70 #define will_weld(optr) \
71 ((optr)->cursed && (erodeable_wep(optr) || (optr)->otyp == TIN_OPENER))
73 /*** Functions that place a given item in a slot ***/
74 /* Proper usage includes:
75 * 1. Initializing the slot during character generation or a
77 * 2. Setting the slot due to a player's actions.
78 * 3. If one of the objects in the slot are split off, these
79 * functions can be used to put the remainder back in the slot.
80 * 4. Putting an item that was thrown and returned back into the slot.
81 * 5. Emptying the slot, by passing a null object. NEVER pass
84 * If the item is being moved from another slot, it is the caller's
85 * responsibility to handle that. It's also the caller's responsibility
86 * to print the appropriate messages.
90 register struct obj *obj;
92 struct obj *olduwep = uwep;
95 return; /* necessary to not set unweapon */
96 /* This message isn't printed in the caller because it happens
97 * *whenever* Sunsword is unwielded, from whatever cause.
100 if (uwep == obj && artifact_light(olduwep) && olduwep->lamplit) {
101 end_burn(olduwep, FALSE);
104 pline("%s shining.", Tobjnam(olduwep, "stop"));
106 pline("%s
\82Í
\8bP
\82«
\82ð
\8e~
\82ß
\82½
\81D", xname(olduwep));
109 && ((uwep && uwep->oartifact == ART_OGRESMASHER)
110 || (olduwep && olduwep->oartifact == ART_OGRESMASHER)))
112 /* Note: Explicitly wielding a pick-axe will not give a "bashing"
113 * message. Wielding one via 'a'pplying it will.
114 * 3.2.2: Wielding arbitrary objects will give bashing message too.
117 unweapon = (obj->oclass == WEAPON_CLASS)
118 ? is_launcher(obj) || is_ammo(obj) || is_missile(obj)
119 || (is_pole(obj) && !u.usteed)
120 : !is_weptool(obj) && !is_wet_towel(obj);
122 unweapon = TRUE; /* for "bare hands" message */
127 cant_wield_corpse(obj)
132 if (uarmg || obj->otyp != CORPSE || !touch_petrifies(&mons[obj->corpsenm])
136 /* Prevent wielding cockatrice when not wearing gloves --KAA */
138 You("wield %s in your bare %s.",
139 corpse_xname(obj, (const char *) 0, CXN_PFX_THE),
140 makeplural(body_part(HAND)));
142 You("%s
\82ð%s
\82É
\82µ
\82½
\81D",
143 corpse_xname(obj, (const char *) 0, CXN_PFX_THE),
147 Sprintf(kbuf, "wielding %s bare-handed", killer_xname(obj));
149 Sprintf(kbuf, "%s
\82ð
\91f
\8eè
\82Å
\8eè
\82É
\82µ
\82Ä", killer_xname(obj));
158 /* Separated function so swapping works easily */
165 You("are empty %s.", body_part(HANDED));
167 You("%s
\82ð
\8bó
\82¯
\82½
\81D", body_part(HAND));
168 setuwep((struct obj *) 0);
172 You("are already empty %s.", body_part(HANDED));
174 You("
\89½
\82à%s
\82É
\82µ
\82Ä
\82¢
\82È
\82¢
\81I", body_part(HAND));
175 } else if (wep->otyp == CORPSE && cant_wield_corpse(wep)) {
176 /* hero must have been life-saved to get here; use a turn */
177 res++; /* corpse won't be wielded */
178 } else if (uarms && bimanual(wep)) {
180 You("cannot wield a two-handed %s while wearing a shield.",
181 is_sword(wep) ? "sword" : wep->otyp == BATTLE_AXE ? "axe"
184 pline("
\8f\82\82ð
\91\95\94õ
\82µ
\82Ä
\82¢
\82é
\82Æ
\82«
\82É
\97¼
\8eè
\8e\9d\82¿
\82Ì%s
\82ð
\91\95\94õ
\82Å
\82«
\82È
\82¢
\81D",
185 is_sword(wep) ? "
\8c\95" : wep->otyp == BATTLE_AXE ? "
\95\80"
188 } else if (!retouch_object(&wep, FALSE)) {
189 res++; /* takes a turn even though it doesn't get wielded */
191 /* Weapon WILL be wielded after this point */
193 if (will_weld(wep)) {
194 #if 0 /*JP*//*
\8eg
\82í
\82È
\82¢*/
195 const char *tmp = xname(wep), *thestr = "The ";
197 if (strncmp(tmp, thestr, 4) && !strncmp(The(tmp), thestr, 4))
203 pline("%s%s %s to your %s!", tmp, aobjnam(wep, "weld"),
204 (wep->quan == 1L) ? "itself" : "themselves", /* a3 */
205 bimanual(wep) ? (const char *) makeplural(body_part(HAND))
208 pline("%s
\82Í
\8f\9f\8eè
\82É
\82 \82È
\82½
\82Ì%s
\82É
\91\95\94õ
\82³
\82ê
\82½
\81D",
209 xname(wep), body_part(HAND));
213 /* The message must be printed before setuwep (since
214 * you might die and be revived from changing weapons),
215 * and the message must be before the death message and
216 * Lifesaved rewielding. Yet we want the message to
217 * say "weapon in hand", thus this kludge.
218 * [That comment is obsolete. It dates from the days (3.0)
219 * when unwielding Firebrand could cause hero to be burned
220 * to death in Hell due to loss of fire resistance.
221 * "Lifesaved re-wielding or re-wearing" is ancient history.]
223 long dummy = wep->owornmask;
225 wep->owornmask |= W_WEP;
226 prinv((char *) 0, wep, 0L);
227 wep->owornmask = dummy;
231 /* KMH -- Talking artifacts are finally implemented */
234 if (artifact_light(wep) && !wep->lamplit) {
235 begin_burn(wep, FALSE);
238 pline("%s to shine %s!", Tobjnam(wep, "begin"),
239 arti_light_description(wep));
241 pline("%s
\82Í%s
\8bP
\82«
\82Í
\82¶
\82ß
\82½
\81I", xname(wep),
242 arti_light_description(wep));
246 /* we'll get back to this someday, but it's not balanced yet */
247 if (Race_if(PM_ELF) && !wep->oartifact
248 && objects[wep->otyp].oc_material == IRON) {
249 /* Elves are averse to wielding cold iron */
251 You("have an uneasy feeling about wielding cold iron.");
253 You("
\97â
\82½
\82¢
\93S
\82ð
\91\95\94õ
\82·
\82é
\82±
\82Æ
\82É
\95s
\88À
\82È
\8bC
\8e\9d\82É
\82È
\82Á
\82½.");
258 struct monst *this_shkp;
260 if ((this_shkp = shop_keeper(inside_shop(u.ux, u.uy)))
261 != (struct monst *) 0) {
263 pline("%s says \"You be careful with my %s!\"",
264 shkname(this_shkp), xname(wep));
266 pline("%s
\82Í
\8fq
\82×
\82½
\81u%s
\82Ì
\88µ
\82¢
\82Í
\8bC
\82ð
\82Â
\82¯
\82Ä
\82
\82ê
\82æ
\81I
\81v",
267 shkname(this_shkp), xname(wep));
277 register struct obj *obj;
279 setworn(obj, W_QUIVER);
285 register struct obj *obj;
287 setworn(obj, W_SWAPWEP);
291 /*** Commands to change particular slot(s) ***/
293 static NEARDATA const char wield_objs[] = {
294 ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, TOOL_CLASS, 0
296 static NEARDATA const char ready_objs[] = {
297 ALLOW_COUNT, COIN_CLASS, ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, 0
299 static NEARDATA const char bullets[] = { /* (note: different from dothrow.c) */
300 ALLOW_COUNT, COIN_CLASS, ALL_CLASSES, ALLOW_NONE,
301 GEM_CLASS, WEAPON_CLASS, 0
307 register struct obj *wep, *oldwep;
310 /* May we attempt this? */
312 if (cantwield(youmonst.data)) {
314 pline("Don't be ridiculous!");
316 pline("
\82Î
\82©
\82Î
\82©
\82µ
\82¢
\81I");
320 /* Prompt for a new weapon */
321 if (!(wep = getobj(wield_objs, "wield")))
324 else if (wep == uwep) {
326 You("are already wielding that!");
328 You("
\82à
\82¤
\82»
\82ê
\82ð%s
\82É
\82µ
\82Ä
\82¢
\82é
\81I", body_part(HAND));
329 if (is_weptool(wep) || is_wet_towel(wep))
330 unweapon = FALSE; /* [see setuwep()] */
332 } else if (welded(uwep)) {
334 /* previously interrupted armor removal mustn't be resumed */
339 /* Handle no object, or object in other slot */
341 wep = (struct obj *) 0;
342 else if (wep == uswapwep)
343 return doswapweapon();
344 else if (wep == uquiver)
345 setuqwep((struct obj *) 0);
346 else if (wep->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) {
348 You("cannot wield that!");
350 You("
\82»
\82ê
\82ð
\91\95\94õ
\82Å
\82«
\82È
\82¢
\81I");
354 /* Set your new primary weapon */
356 result = ready_weapon(wep);
357 if (flags.pushweapon && oldwep && uwep != oldwep)
367 register struct obj *oldwep, *oldswap;
370 /* May we attempt this? */
372 if (cantwield(youmonst.data)) {
374 pline("Don't be ridiculous!");
376 pline("
\82Î
\82©
\82Î
\82©
\82µ
\82¢
\81I");
384 /* Unwield your current secondary weapon */
387 setuswapwep((struct obj *) 0);
389 /* Set your new primary weapon */
390 result = ready_weapon(oldswap);
392 /* Set your new secondary weapon */
393 if (uwep == oldwep) {
394 /* Wield failed for some reason */
395 setuswapwep(oldswap);
399 prinv((char *) 0, uswapwep, 0L);
402 You("have no secondary weapon readied.");
404 You("
\97\
\94õ
\82Ì
\95\90\8aí
\82Ì
\97p
\88Ó
\82ð
\82â
\82ß
\82½
\81D");
407 if (u.twoweap && !can_twoweapon())
417 struct obj *newquiver;
418 const char *quivee_types;
420 boolean finish_splitting = FALSE,
421 was_uwep = FALSE, was_twoweap = u.twoweap;
423 /* Since the quiver isn't in your hands, don't check cantwield(), */
424 /* will_weld(), touch_petrifies(), etc. */
426 /* forget last splitobj() before calling getobj() with ALLOW_COUNT */
427 context.objsplit.child_oid = context.objsplit.parent_oid = 0;
429 /* Prompt for a new quiver: "What do you want to ready?"
430 (Include gems/stones as likely candidates if either primary
431 or secondary weapon is a sling.) */
432 quivee_types = (uslinging()
434 && objects[uswapwep->otyp].oc_skill == P_SLING))
437 newquiver = getobj(quivee_types, "ready");
442 } else if (newquiver == &zeroobj) { /* no object */
443 /* Explicitly nothing */
446 You("now have no ammunition readied.");
448 pline("
\91\95\93U
\82·
\82é
\82½
\82ß
\82Ì
\96î
\92e
\82ª
\82È
\82
\82È
\82Á
\82½
\81D");
449 /* skip 'quivering: prinv()' */
450 setuqwep((struct obj *) 0);
453 You("already have no ammunition readied!");
455 pline("
\91\95\93U
\82·
\82é
\82½
\82ß
\82Ì
\96î
\92e
\82ª
\82È
\82¢
\81D");
458 } else if (newquiver->o_id == context.objsplit.child_oid) {
459 /* if newquiver is the result of supplying a count to getobj()
460 we don't want to split something already in the quiver;
461 for any other item, we need to give it its own inventory slot */
462 if (uquiver && uquiver->o_id == context.objsplit.parent_oid) {
463 unsplitobj(newquiver);
464 goto already_quivered;
466 finish_splitting = TRUE;
467 } else if (newquiver == uquiver) {
470 pline("That ammunition is already readied!");
472 pline("
\82à
\82¤
\91\95\93U
\82³
\82ê
\82Ä
\82¢
\82é
\81I");
474 } else if (newquiver->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) {
476 You("cannot ready that!");
478 You("
\82»
\82ê
\82Í
\8eg
\82¦
\82È
\82¢
\81I");
480 } else if (newquiver == uwep) {
481 int weld_res = !uwep->bknown;
485 reset_remarm(); /* same as dowield() */
488 /* offer to split stack if wielding more than 1 */
489 if (uwep->quan > 1L && inv_cnt(FALSE) < 52 && splittable(uwep)) {
490 Sprintf(qbuf, "You are wielding %ld %s. Ready %ld of them?",
491 uwep->quan, simpleonames(uwep), uwep->quan - 1L);
496 /* leave 1 wielded, split rest off and put into quiver */
497 newquiver = splitobj(uwep, uwep->quan - 1L);
498 finish_splitting = TRUE;
503 Strcpy(qbuf, "Ready all of them instead?");
505 boolean use_plural = (is_plural(uwep) || pair_of(uwep));
507 Sprintf(qbuf, "You are wielding %s. Ready %s instead?",
508 !use_plural ? "that" : "those",
509 !use_plural ? "it" : "them");
511 /* require confirmation to ready the main weapon */
512 if (ynq(qbuf) != 'y') {
513 (void) Shk_Your(qbuf, uwep); /* replace qbuf[] contents */
514 pline("%s%s %s wielded.", qbuf,
515 simpleonames(uwep), otense(uwep, "remain"));
518 /* quivering main weapon, so no longer wielding it */
519 setuwep((struct obj *) 0);
522 } else if (newquiver == uswapwep) {
523 if (uswapwep->quan > 1L && inv_cnt(FALSE) < 52
524 && splittable(uswapwep)) {
525 Sprintf(qbuf, "%s %ld %s. Ready %ld of them?",
526 u.twoweap ? "You are dual wielding"
527 : "Your alternate weapon is",
528 uswapwep->quan, simpleonames(uswapwep),
529 uswapwep->quan - 1L);
534 /* leave 1 alt-wielded, split rest off and put into quiver */
535 newquiver = splitobj(uswapwep, uswapwep->quan - 1L);
536 finish_splitting = TRUE;
541 Strcpy(qbuf, "Ready all of them instead?");
543 boolean use_plural = (is_plural(uswapwep) || pair_of(uswapwep));
545 Sprintf(qbuf, "%s your %s weapon. Ready %s instead?",
546 !use_plural ? "That is" : "Those are",
547 u.twoweap ? "second" : "alternate",
548 !use_plural ? "it" : "them");
550 /* require confirmation to ready the alternate weapon */
551 if (ynq(qbuf) != 'y') {
552 (void) Shk_Your(qbuf, uswapwep); /* replace qbuf[] contents */
553 pline("%s%s %s %s.", qbuf,
554 simpleonames(uswapwep), otense(uswapwep, "remain"),
555 u.twoweap ? "wielded" : "as secondary weapon");
558 /* quivering alternate weapon, so no more uswapwep */
559 setuswapwep((struct obj *) 0);
564 if (finish_splitting) {
566 newquiver->nomerge = 1;
568 newquiver->nomerge = 0;
570 /* place item in quiver before printing so that inventory feedback
571 includes "(at the ready)" */
573 prinv((char *) 0, newquiver, 0L);
575 /* quiver is a convenience slot and manipulating it ordinarily
576 consumes no time, but unwielding primary or secondary weapon
577 should take time (perhaps we're adjacent to a rust monster
578 or disenchanter and want to hit it immediately, but not with
579 something we're wielding that's vulnerable to its damage) */
582 You("are now empty %s.", body_part(HANDED));
584 } else if (was_twoweap && !u.twoweap) {
585 You("are no longer wielding two weapons at once.");
591 /* used for #rub and for applying pick-axe, whip, grappling hook or polearm */
593 wield_tool(obj, verb)
595 const char *verb; /* "rub",&c */
603 return TRUE; /* nothing to do if already wielding it */
611 more_than_1 = (obj->quan > 1L || strstri(what, "pair of ") != 0
612 || strstri(what, "s of ") != 0);
615 if (obj->owornmask & (W_ARMOR | W_ACCESSORY)) {
617 You_cant("%s %s while wearing %s.", verb, yname(obj),
618 more_than_1 ? "them" : "it");
620 pline("
\90g
\82É
\82Â
\82¯
\82½
\82Ü
\82Ü
\82Å
\82Í%s
\82Í
\8eg
\82¦
\82È
\82¢
\81D", yname(obj));
627 const char *hand = body_part(HAND);
630 hand = makeplural(hand);
631 if (strstri(what, "pair of ") != 0)
634 "Since your weapon is welded to your %s, you cannot %s %s %s.",
635 hand, verb, more_than_1 ? "those" : "that", xname(obj));
637 pline("
\95\90\8aí
\82ð
\8eè
\82É
\82µ
\82Ä
\82¢
\82é
\82Ì
\82Å
\81C%s
\82ð
\8eg
\82¦
\82È
\82¢
\81D", xname(obj));
641 You_cant("do that.");
643 pline("
\82»
\82ê
\82Í
\82Å
\82«
\82È
\82¢
\81D");
647 if (cantwield(youmonst.data)) {
649 You_cant("hold %s strongly enough.", more_than_1 ? "them" : "it");
651 You("
\82»
\82ê
\82ð
\8e\9d\82Â
\82Ù
\82Ç
\97Í
\82ª
\82È
\82¢
\81D");
655 if (uarms && bimanual(obj)) {
657 You("cannot %s a two-handed %s while wearing a shield.", verb,
658 (obj->oclass == WEAPON_CLASS) ? "weapon" : "tool");
660 pline("
\8f\82\82ð
\91\95\94õ
\82µ
\82½
\82Ü
\82Ü
\97¼
\8eè
\8e\9d\82¿
\82Ì%s
\82ð
\91\95\94õ
\82Å
\82«
\82È
\82¢
\81D",
661 (obj->oclass == WEAPON_CLASS) ? "
\95\90\8aí" : "
\93¹
\8bï");
667 setuqwep((struct obj *) 0);
668 if (uswapwep == obj) {
669 (void) doswapweapon();
670 /* doswapweapon might fail */
674 struct obj *oldwep = uwep;
677 You("now wield %s.", doname(obj));
679 You("%s
\82ð
\91\95\94õ
\82µ
\82½
\81D", doname(obj));
681 if (flags.pushweapon && oldwep && uwep != oldwep)
685 return FALSE; /* rewielded old object after dying */
686 /* applying weapon or tool that gets wielded ends two-weapon combat */
689 if (obj->oclass != WEAPON_CLASS)
699 #define NOT_WEAPON(obj) (!is_weptool(obj) && obj->oclass != WEAPON_CLASS)
700 if (!could_twoweap(youmonst.data)) {
703 You_cant("use two weapons in your current form.");
705 pline("
\8c»
\8dÝ
\82Ì
\8ep
\82Å
\82Í
\93ñ
\93\81\97¬
\82Í
\8eg
\82¦
\82È
\82¢
\81D");
708 pline("%s aren't able to use two weapons at once.",
710 pline("%s
\82Í
\93ñ
\82Â
\82Ì
\95\90\8aí
\82ð
\93¯
\8e\9e\82É
\88µ
\82¦
\82È
\82¢
\81D",
711 makeplural((flags.female && urole.name.f) ? urole.name.f
713 } else if (!uwep || !uswapwep)
715 Your("%s%s%s empty.", uwep ? "left " : uswapwep ? "right " : "",
716 body_part(HAND), (!uwep && !uswapwep) ? "s are" : " is");
718 Your("%s%s
\82Í
\8bó
\82Á
\82Û
\82¾
\81D", uwep ? "
\8d¶
\82Ì" : uswapwep ? "
\89E
\82Ì" : "",
721 else if (NOT_WEAPON(uwep) || NOT_WEAPON(uswapwep)) {
722 otmp = NOT_WEAPON(uwep) ? uwep : uswapwep;
724 pline("%s %s.", Yname2(otmp),
725 is_plural(otmp) ? "aren't weapons" : "isn't a weapon");
727 pline("%s
\82Í
\95\90\8aí
\82¶
\82á
\82È
\82¢
\81D", Yname2(otmp));
729 } else if (bimanual(uwep) || bimanual(uswapwep)) {
730 otmp = bimanual(uwep) ? uwep : uswapwep;
732 pline("%s isn't one-handed.", Yname2(otmp));
734 pline("%s
\82Í
\95Ð
\8eè
\8e\9d\82¿
\82Ì
\95\90\8aí
\82¶
\82á
\82È
\82¢
\81D", Yname2(otmp));
737 You_cant("use two weapons while wearing a shield.");
739 You("
\8f\82\82ð
\8e\9d\82Á
\82Ä
\82¢
\82é
\8aÔ
\82Í
\97¼
\8eè
\8e\9d\82¿
\82Å
\82«
\82È
\82¢
\81D");
740 else if (uswapwep->oartifact)
742 pline("%s being held second to another weapon!",
743 Yobjnam2(uswapwep, "resist"));
745 pline("%s
\82Í
\97\
\94õ
\82Ì
\95\90\8aí
\82Æ
\82µ
\82Ä
\88µ
\82í
\82ê
\82é
\82±
\82Æ
\82ð
\8b\91\82ñ
\82¾
\81I",
748 else if (uswapwep->otyp == CORPSE && cant_wield_corpse(uswapwep)) {
749 /* [Note: NOT_WEAPON() check prevents ever getting here...] */
750 ; /* must be life-saved to reach here; return FALSE */
751 } else if (Glib || uswapwep->cursed) {
753 uswapwep->bknown = TRUE;
764 struct obj *obj = uswapwep;
766 /* Avoid trashing makeplural's static buffer */
767 Strcpy(str, makeplural(body_part(HAND)));
769 pline("%s from your %s!", Yobjnam2(obj, "slip"), str);
771 You("%s
\82ð
\97\8e\82µ
\82Ä
\82µ
\82Ü
\82Á
\82½
\81I", xname(obj));
778 /* You can always toggle it off */
781 You("switch to your primary weapon.");
783 You("
\88ê
\82Â
\82Ì
\95\90\8aí
\82Å
\90í
\93¬
\82·
\82é
\82±
\82Æ
\82É
\82µ
\82½
\81D");
789 /* May we use two weapons? */
790 if (can_twoweapon()) {
793 You("begin two-weapon combat.");
795 You("
\93ñ
\93\81\97¬
\82Å
\90í
\93¬
\82·
\82é
\82±
\82Æ
\82É
\82µ
\82½
\81D");
798 return (rnd(20) > ACURR(A_DEX));
803 /*** Functions to empty a given slot ***/
804 /* These should be used only when the item can't be put back in
805 * the slot by life saving. Proper usage includes:
806 * 1. The item has been eaten, stolen, burned away, or rotted away.
807 * 2. Making an item disappear for a bones pile.
813 if (artifact_light(uwep) && uwep->lamplit) {
814 end_burn(uwep, FALSE);
817 pline("%s shining.", Tobjnam(uwep, "stop"));
819 pline("%s
\82Í
\8bP
\82«
\82ð
\8e~
\82ß
\82½
\81D", xname(uwep));
821 setworn((struct obj *) 0, W_WEP);
831 setworn((struct obj *) 0, W_SWAPWEP);
840 setworn((struct obj *) 0, W_QUIVER);
850 You("can no longer use two weapons at once.");
852 You("
\82à
\82¤
\82Q
\82Â
\82Ì
\95\90\8aí
\82ð
\93¯
\8e\9e\82É
\8eg
\97p
\82·
\82é
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81D");
860 chwepon(otmp, amount)
861 register struct obj *otmp;
864 const char *color = hcolor((amount < 0) ? NH_BLACK : NH_BLUE);
865 const char *xtime, *wepname = "";
867 int otyp = STRANGE_OBJECT;
869 if (!uwep || (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep))) {
872 if (amount >= 0 && uwep && will_weld(uwep)) { /* cursed tin opener */
874 Sprintf(buf, "%s with %s aura.",
875 Yobjnam2(uwep, "glow"), an(hcolor(NH_AMBER)));
876 uwep->bknown = !Hallucination;
878 /* cursed tin opener is wielded in right hand */
879 Sprintf(buf, "Your right %s tingles.", body_part(HAND));
885 Sprintf(buf, "Your %s %s.", makeplural(body_part(HAND)),
886 (amount >= 0) ? "twitch" : "itch");
888 Sprintf(buf, "
\82 \82È
\82½
\82Ì%s
\82Í%s
\81D", makeplural(body_part(HAND)),
889 (amount >= 0) ? "
\82Ð
\82«
\82Â
\82Á
\82½" : "
\83\80\83Y
\83\80\83Y
\82µ
\82½");
892 strange_feeling(otmp, buf); /* pline()+docall()+useup() */
893 exercise(A_DEX, (boolean) (amount >= 0));
897 if (otmp && otmp->oclass == SCROLL_CLASS)
900 if (uwep->otyp == WORM_TOOTH && amount >= 0) {
901 multiple = (uwep->quan > 1L);
902 /* order: message, transformation, shop handling */
904 Your("%s %s much sharper now.", simpleonames(uwep),
905 multiple ? "fuse, and become" : "is");
907 Your("%s
\82Í%s
\82æ
\82è
\89s
\82³
\82ð
\91\9d\82µ
\82½
\82æ
\82¤
\82¾
\81D", simpleonames(uwep),
908 multiple ? "
\97Z
\8d\87\82µ
\82Ä
\81C" : "");
910 uwep->otyp = CRYSKNIFE;
911 uwep->oerodeproof = 0;
914 uwep->owt = weight(uwep);
918 /* update shop bill to reflect new higher value */
920 alter_cost(uwep, 0L);
921 if (otyp != STRANGE_OBJECT)
926 } else if (uwep->otyp == CRYSKNIFE && amount < 0) {
927 multiple = (uwep->quan > 1L);
928 /* order matters: message, shop handling, transformation */
930 Your("%s %s much duller now.", simpleonames(uwep),
931 multiple ? "fuse, and become" : "is");
933 Your("%s
\82Í%s
\82æ
\82è
\93Ý
\82
\82È
\82Á
\82Ä
\82µ
\82Ü
\82Á
\82½
\82æ
\82¤
\82¾
\81D", simpleonames(uwep),
934 multiple ? "
\97Z
\8d\87\82µ
\82Ä
\81C" : "");
936 costly_alteration(uwep, COST_DEGRD); /* DECHNT? other? */
937 uwep->otyp = WORM_TOOTH;
938 uwep->oerodeproof = 0;
941 uwep->owt = weight(uwep);
943 if (otyp != STRANGE_OBJECT && otmp->bknown)
951 wepname = ONAME(uwep);
952 if (amount < 0 && uwep->oartifact && restrict_name(uwep, wepname)) {
955 pline("%s %s.", Yobjnam2(uwep, "faintly glow"), color);
957 Your("%s
\82Í
\82í
\82¸
\82©
\82É%s
\8bP
\82¢
\82½
\81D", xname(uwep),jconj_adj(color));
960 /* there is a (soft) upper and lower limit to uwep->spe */
961 if (((uwep->spe > 5 && amount >= 0) || (uwep->spe < -5 && amount < 0))
965 pline("%s %s for a while and then %s.",
966 Yobjnam2(uwep, "violently glow"), color,
967 otense(uwep, "evaporate"));
969 Your("%s
\82Í
\82µ
\82Î
\82ç
\82
\8c\83\82µ
\82%s
\8bP
\82«
\81C
\8fö
\94
\82µ
\82½
\81D",
970 xname(uwep), jconj_adj(color));
974 pline("%s.", Yobjnam2(uwep, "evaporate"));
976 Your("%s
\82Í
\8fö
\94
\82µ
\82½
\81D", xname(uwep));
978 useupall(uwep); /* let all of them disappear */
983 xtime = (amount * amount == 1) ? "moment" : "while";
985 xtime = (amount*amount == 1) ? "
\88ê
\8fu" : "
\82µ
\82Î
\82ç
\82
\82Ì
\8aÔ";
987 pline("%s %s for a %s.",
988 Yobjnam2(uwep, amount == 0 ? "violently glow" : "glow"), color,
991 Your("%s
\82Í%s%s%s
\8bP
\82¢
\82½
\81D",
992 xname(uwep), xtime, jconj_adj(color),
993 amount == 0 ? "
\8c\83\82µ
\82" : "");
995 if (otyp != STRANGE_OBJECT && uwep->known
996 && (amount > 0 || (amount < 0 && otmp->bknown)))
1000 costly_alteration(uwep, COST_DECHNT);
1001 uwep->spe += amount;
1005 /* update shop bill to reflect new higher price */
1007 alter_cost(uwep, 0L);
1011 * Enchantment, which normally improves a weapon, has an
1012 * addition adverse reaction on Magicbane whose effects are
1013 * spe dependent. Give an obscure clue here.
1015 if (uwep->oartifact == ART_MAGICBANE && uwep->spe >= 0) {
1017 Your("right %s %sches!", body_part(HAND),
1018 (((amount > 1) && (uwep->spe > 1)) ? "flin" : "it"));
1020 Your("
\89E%s
\82Í%s
\81I",
1022 (((amount > 1) && (uwep->spe > 1)) ? "
\82Ð
\82è
\82Ð
\82è
\82µ
\82½" : "
\83\80\83Y
\83\80\83Y
\82µ
\82½"));
1026 /* an elven magic clue, cookie@keebler */
1027 /* elven weapons vibrate warningly when enchanted beyond a limit */
1029 && (is_elven_weapon(uwep) || uwep->oartifact || !rn2(7)))
1031 pline("%s unexpectedly.", Yobjnam2(uwep, "suddenly vibrate"));
1033 Your("%s
\82Í
\93Ë
\91R
\90k
\82¦
\82¾
\82µ
\82½
\81D", xname(uwep));
1040 register struct obj *obj;
1042 if (obj && obj == uwep && will_weld(obj)) {
1051 register struct obj *obj;
1055 savewornmask = obj->owornmask;
1057 pline("%s welded to your %s!", Yobjnam2(obj, "are"),
1058 bimanual(obj) ? (const char *) makeplural(body_part(HAND))
1061 You("%s
\82ð%s
\82É
\8d\
\82¦
\82½
\81I", xname(obj), body_part(HAND));
1063 obj->owornmask = savewornmask;
1066 /* test whether monster's wielded weapon is stuck to hand/paw/whatever */
1071 /* caller is responsible for making sure this is a monster's item */
1072 if (obj && (obj->owornmask & W_WEP) && will_weld(obj))