1 /* NetHack 3.6 wield.c $NHDT-Date: 1559670611 2019/06/04 17:50:11 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.59 $ */
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-2022 */
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 */
126 cant_wield_corpse(obj)
131 if (uarmg || obj->otyp != CORPSE || !touch_petrifies(&mons[obj->corpsenm])
135 /* Prevent wielding cockatrice when not wearing gloves --KAA */
137 You("wield %s in your bare %s.",
138 corpse_xname(obj, (const char *) 0, CXN_PFX_THE),
139 makeplural(body_part(HAND)));
141 You("%s
\82ð%s
\82É
\82µ
\82½
\81D",
142 corpse_xname(obj, (const char *) 0, CXN_PFX_THE),
146 Sprintf(kbuf, "wielding %s bare-handed", killer_xname(obj));
148 Sprintf(kbuf, "%s
\82ð
\91f
\8eè
\82Å
\8eè
\82É
\82µ
\82Ä", killer_xname(obj));
157 /* Separated function so swapping works easily */
164 You("are empty %s.", body_part(HANDED));
166 You("%s
\82ð
\8bó
\82¯
\82½
\81D", body_part(HAND));
167 setuwep((struct obj *) 0);
171 You("are already empty %s.", body_part(HANDED));
173 You("
\89½
\82à%s
\82É
\82µ
\82Ä
\82¢
\82È
\82¢
\81I", body_part(HAND));
174 } else if (wep->otyp == CORPSE && cant_wield_corpse(wep)) {
175 /* hero must have been life-saved to get here; use a turn */
176 res++; /* corpse won't be wielded */
177 } else if (uarms && bimanual(wep)) {
179 You("cannot wield a two-handed %s while wearing a shield.",
180 is_sword(wep) ? "sword" : wep->otyp == BATTLE_AXE ? "axe"
183 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",
184 is_sword(wep) ? "
\8c\95" : wep->otyp == BATTLE_AXE ? "
\95\80"
187 } else if (!retouch_object(&wep, FALSE)) {
188 res++; /* takes a turn even though it doesn't get wielded */
190 /* Weapon WILL be wielded after this point */
192 if (will_weld(wep)) {
193 #if 0 /*JP*//*
\8eg
\82í
\82È
\82¢*/
194 const char *tmp = xname(wep), *thestr = "The ";
196 if (strncmp(tmp, thestr, 4) && !strncmp(The(tmp), thestr, 4))
202 pline("%s%s %s to your %s!", tmp, aobjnam(wep, "weld"),
203 (wep->quan == 1L) ? "itself" : "themselves", /* a3 */
204 bimanual(wep) ? (const char *) makeplural(body_part(HAND))
207 pline("%s
\82Í
\8f\9f\8eè
\82É
\82 \82È
\82½
\82Ì%s
\82É
\91\95\94õ
\82³
\82ê
\82½
\81D",
208 xname(wep), body_part(HAND));
212 /* The message must be printed before setuwep (since
213 * you might die and be revived from changing weapons),
214 * and the message must be before the death message and
215 * Lifesaved rewielding. Yet we want the message to
216 * say "weapon in hand", thus this kludge.
217 * [That comment is obsolete. It dates from the days (3.0)
218 * when unwielding Firebrand could cause hero to be burned
219 * to death in Hell due to loss of fire resistance.
220 * "Lifesaved re-wielding or re-wearing" is ancient history.]
222 long dummy = wep->owornmask;
224 wep->owornmask |= W_WEP;
225 if (wep->otyp == AKLYS && (wep->owornmask & W_WEP) != 0)
227 You("secure the tether.");
229 You("
\82Ð
\82à
\82ð
\82µ
\82Á
\82©
\82è
\82Æ
\8cÅ
\92è
\82µ
\82½
\81D");
230 prinv((char *) 0, wep, 0L);
231 wep->owornmask = dummy;
235 /* KMH -- Talking artifacts are finally implemented */
238 if (artifact_light(wep) && !wep->lamplit) {
239 begin_burn(wep, FALSE);
242 pline("%s to shine %s!", Tobjnam(wep, "begin"),
243 arti_light_description(wep));
245 pline("%s
\82Í%s
\8bP
\82«
\82Í
\82¶
\82ß
\82½
\81I", xname(wep),
246 arti_light_description(wep));
250 /* we'll get back to this someday, but it's not balanced yet */
251 if (Race_if(PM_ELF) && !wep->oartifact
252 && objects[wep->otyp].oc_material == IRON) {
253 /* Elves are averse to wielding cold iron */
255 You("have an uneasy feeling about wielding cold iron.");
257 You("
\97â
\82½
\82¢
\93S
\82ð
\91\95\94õ
\82·
\82é
\82±
\82Æ
\82É
\95s
\88À
\82È
\8bC
\8e\9d\82É
\82È
\82Á
\82½.");
262 struct monst *this_shkp;
264 if ((this_shkp = shop_keeper(inside_shop(u.ux, u.uy)))
265 != (struct monst *) 0) {
267 pline("%s says \"You be careful with my %s!\"",
268 shkname(this_shkp), xname(wep));
270 pline("%s
\82Í
\8fq
\82×
\82½
\81u%s
\82Ì
\88µ
\82¢
\82Í
\8bC
\82ð
\82Â
\82¯
\82Ä
\82
\82ê
\82æ
\81I
\81v",
271 shkname(this_shkp), xname(wep));
281 register struct obj *obj;
283 setworn(obj, W_QUIVER);
284 /* no extra handling needed; this used to include a call to
285 update_inventory() but that's already performed by setworn() */
291 register struct obj *obj;
293 setworn(obj, W_SWAPWEP);
297 /*** Commands to change particular slot(s) ***/
299 static NEARDATA const char wield_objs[] = {
300 ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, TOOL_CLASS, 0
302 static NEARDATA const char ready_objs[] = {
303 ALLOW_COUNT, COIN_CLASS, ALL_CLASSES, ALLOW_NONE, WEAPON_CLASS, 0
305 static NEARDATA const char bullets[] = { /* (note: different from dothrow.c) */
306 ALLOW_COUNT, COIN_CLASS, ALL_CLASSES, ALLOW_NONE,
307 GEM_CLASS, WEAPON_CLASS, 0
313 register struct obj *wep, *oldwep;
316 /* May we attempt this? */
318 if (cantwield(youmonst.data)) {
320 pline("Don't be ridiculous!");
322 pline("
\82Î
\82©
\82Î
\82©
\82µ
\82¢
\81I");
326 /* Prompt for a new weapon */
327 if (!(wep = getobj(wield_objs, "wield")))
330 else if (wep == uwep) {
332 You("are already wielding that!");
334 You("
\82à
\82¤
\82»
\82ê
\82ð%s
\82É
\82µ
\82Ä
\82¢
\82é
\81I", body_part(HAND));
335 if (is_weptool(wep) || is_wet_towel(wep))
336 unweapon = FALSE; /* [see setuwep()] */
338 } else if (welded(uwep)) {
340 /* previously interrupted armor removal mustn't be resumed */
345 /* Handle no object, or object in other slot */
347 wep = (struct obj *) 0;
348 else if (wep == uswapwep)
349 return doswapweapon();
350 else if (wep == uquiver)
351 setuqwep((struct obj *) 0);
352 else if (wep->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) {
354 You("cannot wield that!");
356 You("
\82»
\82ê
\82ð
\91\95\94õ
\82Å
\82«
\82È
\82¢
\81I");
360 /* Set your new primary weapon */
362 result = ready_weapon(wep);
363 if (flags.pushweapon && oldwep && uwep != oldwep)
373 register struct obj *oldwep, *oldswap;
376 /* May we attempt this? */
378 if (cantwield(youmonst.data)) {
380 pline("Don't be ridiculous!");
382 pline("
\82Î
\82©
\82Î
\82©
\82µ
\82¢
\81I");
390 /* Unwield your current secondary weapon */
393 setuswapwep((struct obj *) 0);
395 /* Set your new primary weapon */
396 result = ready_weapon(oldswap);
398 /* Set your new secondary weapon */
399 if (uwep == oldwep) {
400 /* Wield failed for some reason */
401 setuswapwep(oldswap);
405 prinv((char *) 0, uswapwep, 0L);
408 You("have no secondary weapon readied.");
410 You("
\97\
\94õ
\82Ì
\95\90\8aí
\82Ì
\97p
\88Ó
\82ð
\82â
\82ß
\82½
\81D");
413 if (u.twoweap && !can_twoweapon())
423 struct obj *newquiver;
424 const char *quivee_types;
426 boolean finish_splitting = FALSE,
427 was_uwep = FALSE, was_twoweap = u.twoweap;
429 /* Since the quiver isn't in your hands, don't check cantwield(), */
430 /* will_weld(), touch_petrifies(), etc. */
432 /* forget last splitobj() before calling getobj() with ALLOW_COUNT */
433 context.objsplit.child_oid = context.objsplit.parent_oid = 0;
435 /* Prompt for a new quiver: "What do you want to ready?"
436 (Include gems/stones as likely candidates if either primary
437 or secondary weapon is a sling.) */
438 quivee_types = (uslinging()
440 && objects[uswapwep->otyp].oc_skill == P_SLING))
443 newquiver = getobj(quivee_types, "ready");
448 } else if (newquiver == &zeroobj) { /* no object */
449 /* Explicitly nothing */
452 You("now have no ammunition readied.");
454 pline("
\91\95\93U
\82·
\82é
\82½
\82ß
\82Ì
\96î
\92e
\82ª
\82È
\82
\82È
\82Á
\82½
\81D");
455 /* skip 'quivering: prinv()' */
456 setuqwep((struct obj *) 0);
459 You("already have no ammunition readied!");
461 pline("
\91\95\93U
\82·
\82é
\82½
\82ß
\82Ì
\96î
\92e
\82ª
\82È
\82¢
\81D");
464 } else if (newquiver->o_id == context.objsplit.child_oid) {
465 /* if newquiver is the result of supplying a count to getobj()
466 we don't want to split something already in the quiver;
467 for any other item, we need to give it its own inventory slot */
468 if (uquiver && uquiver->o_id == context.objsplit.parent_oid) {
469 unsplitobj(newquiver);
470 goto already_quivered;
472 finish_splitting = TRUE;
473 } else if (newquiver == uquiver) {
476 pline("That ammunition is already readied!");
478 pline("
\82à
\82¤
\91\95\93U
\82³
\82ê
\82Ä
\82¢
\82é
\81I");
480 } else if (newquiver->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) {
482 You("cannot ready that!");
484 You("
\82»
\82ê
\82Í
\8eg
\82¦
\82È
\82¢
\81I");
486 } else if (newquiver == uwep) {
487 int weld_res = !uwep->bknown;
491 reset_remarm(); /* same as dowield() */
494 /* offer to split stack if wielding more than 1 */
495 if (uwep->quan > 1L && inv_cnt(FALSE) < 52 && splittable(uwep)) {
497 Sprintf(qbuf, "You are wielding %ld %s. Ready %ld of them?",
498 uwep->quan, simpleonames(uwep), uwep->quan - 1L);
500 Sprintf(qbuf, "
\82 \82È
\82½
\82Í%ld%s
\82Ì%s
\82ð
\91\95\94õ
\82µ
\82Ä
\82¢
\82é
\81D
\82»
\82Ì
\82¤
\82¿%ld%s
\82ð
\8f\80\94õ
\82·
\82é
\81H",
501 uwep->quan, numeral(uwep), simpleonames(uwep),
502 uwep->quan - 1L, numeral(uwep));
508 /* leave 1 wielded, split rest off and put into quiver */
509 newquiver = splitobj(uwep, uwep->quan - 1L);
510 finish_splitting = TRUE;
516 Strcpy(qbuf, "Ready all of them instead?");
518 Strcpy(qbuf, "
\91ã
\82í
\82è
\82É
\82±
\82ê
\82ç
\91S
\95\94\82ð
\8f\80\94õ
\82·
\82é
\81H");
521 boolean use_plural = (is_plural(uwep) || pair_of(uwep));
523 Sprintf(qbuf, "You are wielding %s. Ready %s instead?",
524 !use_plural ? "that" : "those",
525 !use_plural ? "it" : "them");
526 #else /*
\95s
\8e©
\91R
\82¾
\82¯
\82Ç
\82Æ
\82è
\82 \82¦
\82¸
\82±
\82ê
\82Å
\82æ
\82µ
\82Æ
\82·
\82é */
527 Strcpy(qbuf, "
\82 \82È
\82½
\82Í
\82»
\82ê
\82ð
\91\95\94õ
\82µ
\82Ä
\82¢
\82é
\81D
\91ã
\82í
\82è
\82É
\82»
\82ê
\82ð
\8f\80\94õ
\82·
\82é
\81H");
530 /* require confirmation to ready the main weapon */
531 if (ynq(qbuf) != 'y') {
532 (void) Shk_Your(qbuf, uwep); /* replace qbuf[] contents */
534 pline("%s%s %s wielded.", qbuf,
535 simpleonames(uwep), otense(uwep, "remain"));
537 pline("%s%s
\82ð
\91\95\94õ
\82µ
\82½
\82Ü
\82Ü
\82É
\82µ
\82½
\81D", qbuf,
542 /* quivering main weapon, so no longer wielding it */
543 setuwep((struct obj *) 0);
546 } else if (newquiver == uswapwep) {
547 if (uswapwep->quan > 1L && inv_cnt(FALSE) < 52
548 && splittable(uswapwep)) {
550 Sprintf(qbuf, "%s %ld %s. Ready %ld of them?",
551 u.twoweap ? "You are dual wielding"
552 : "Your alternate weapon is",
553 uswapwep->quan, simpleonames(uswapwep),
554 uswapwep->quan - 1L);
556 Sprintf(qbuf, "
\82 \82È
\82½%s
\82Í%ld%s
\82Ì%s
\82¾
\81D
\82»
\82Ì
\82¤
\82¿%ld%s
\82ð
\8f\80\94õ
\82·
\82é
\81H",
557 u.twoweap ? "
\82ª
\93ñ
\93\81\97¬
\82Å
\91\95\94õ
\82µ
\82Ä
\82¢
\82é
\82Ì"
558 : "
\82Ì
\97\
\94õ
\82Ì
\95\90\8aí",
559 uswapwep->quan, numeral(uswapwep), simpleonames(uswapwep),
560 uswapwep->quan - 1L, numeral(uswapwep));
566 /* leave 1 alt-wielded, split rest off and put into quiver */
567 newquiver = splitobj(uswapwep, uswapwep->quan - 1L);
568 finish_splitting = TRUE;
574 Strcpy(qbuf, "Ready all of them instead?");
576 Strcpy(qbuf, "
\91ã
\82í
\82è
\82É
\82±
\82ê
\82ç
\91S
\95\94\82ð
\8f\80\94õ
\82·
\82é
\81H");
579 boolean use_plural = (is_plural(uswapwep) || pair_of(uswapwep));
581 Sprintf(qbuf, "%s your %s weapon. Ready %s instead?",
582 !use_plural ? "That is" : "Those are",
583 u.twoweap ? "second" : "alternate",
584 !use_plural ? "it" : "them");
586 Sprintf(qbuf, "
\82»
\82ê
\82Í%s
\95\90\8aí
\82¾
\81D
\91ã
\82í
\82è
\82É
\82»
\82ê
\82ð
\8f\80\94õ
\82·
\82é
\81H",
587 u.twoweap ? "
\93ñ
\94Ô
\96Ú
\82Ì" : "
\97\
\94õ
\82Ì");
590 /* require confirmation to ready the alternate weapon */
591 if (ynq(qbuf) != 'y') {
592 (void) Shk_Your(qbuf, uswapwep); /* replace qbuf[] contents */
594 pline("%s%s %s %s.", qbuf,
595 simpleonames(uswapwep), otense(uswapwep, "remain"),
596 u.twoweap ? "wielded" : "as secondary weapon");
598 pline("%s%s
\82ð%s
\82Ü
\82Ü
\82É
\82µ
\82½
\81D", qbuf,
599 simpleonames(uswapwep),
600 u.twoweap ? "
\91\95\94õ
\82µ
\82½" : "
\93ñ
\94Ô
\96Ú
\82Ì
\95\90\8aí
\82Ì");
604 /* quivering alternate weapon, so no more uswapwep */
605 setuswapwep((struct obj *) 0);
610 if (finish_splitting) {
612 newquiver->nomerge = 1;
614 newquiver->nomerge = 0;
616 /* place item in quiver before printing so that inventory feedback
617 includes "(at the ready)" */
619 prinv((char *) 0, newquiver, 0L);
621 /* quiver is a convenience slot and manipulating it ordinarily
622 consumes no time, but unwielding primary or secondary weapon
623 should take time (perhaps we're adjacent to a rust monster
624 or disenchanter and want to hit it immediately, but not with
625 something we're wielding that's vulnerable to its damage) */
629 You("are now empty %s.", body_part(HANDED));
631 You("
\95\90\8aí
\82ð
\8e\9d\82½
\82È
\82
\82È
\82Á
\82½
\81D");
633 } else if (was_twoweap && !u.twoweap) {
635 You("are no longer wielding two weapons at once.");
637 You("
\93ñ
\93\81\97¬
\82ð
\82â
\82ß
\82½
\81D");
643 /* used for #rub and for applying pick-axe, whip, grappling hook or polearm */
645 wield_tool(obj, verb)
647 const char *verb; /* "rub",&c */
655 return TRUE; /* nothing to do if already wielding it */
661 more_than_1 = (obj->quan > 1L || strstri(what, "pair of ") != 0
662 || strstri(what, "s of ") != 0);
665 if (obj->owornmask & (W_ARMOR | W_ACCESSORY)) {
667 You_cant("%s %s while wearing %s.", verb, yname(obj),
668 more_than_1 ? "them" : "it");
670 pline("
\90g
\82É
\82Â
\82¯
\82½
\82Ü
\82Ü
\82Å
\82Í%s
\82Í
\8eg
\82¦
\82È
\82¢
\81D", yname(obj));
677 const char *hand = body_part(HAND);
680 hand = makeplural(hand);
681 if (strstri(what, "pair of ") != 0)
684 "Since your weapon is welded to your %s, you cannot %s %s %s.",
685 hand, verb, more_than_1 ? "those" : "that", xname(obj));
687 pline("
\95\90\8aí
\82ð
\8eè
\82É
\82µ
\82Ä
\82¢
\82é
\82Ì
\82Å
\81C%s
\82ð
\8eg
\82¦
\82È
\82¢
\81D", xname(obj));
691 You_cant("do that.");
693 pline("
\82»
\82ê
\82Í
\82Å
\82«
\82È
\82¢
\81D");
697 if (cantwield(youmonst.data)) {
699 You_cant("hold %s strongly enough.", more_than_1 ? "them" : "it");
701 You("
\82»
\82ê
\82ð
\8e\9d\82Â
\82Ù
\82Ç
\97Í
\82ª
\82È
\82¢
\81D");
705 if (uarms && bimanual(obj)) {
707 You("cannot %s a two-handed %s while wearing a shield.", verb,
708 (obj->oclass == WEAPON_CLASS) ? "weapon" : "tool");
710 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",
711 (obj->oclass == WEAPON_CLASS) ? "
\95\90\8aí" : "
\93¹
\8bï");
717 setuqwep((struct obj *) 0);
718 if (uswapwep == obj) {
719 (void) doswapweapon();
720 /* doswapweapon might fail */
724 struct obj *oldwep = uwep;
726 if (will_weld(obj)) {
727 /* hope none of ready_weapon()'s early returns apply here... */
728 (void) ready_weapon(obj);
731 You("now wield %s.", doname(obj));
733 You("%s
\82ð
\91\95\94õ
\82µ
\82½
\81D", doname(obj));
736 if (flags.pushweapon && oldwep && uwep != oldwep)
740 return FALSE; /* rewielded old object after dying */
741 /* applying weapon or tool that gets wielded ends two-weapon combat */
744 if (obj->oclass != WEAPON_CLASS)
754 #define NOT_WEAPON(obj) (!is_weptool(obj) && obj->oclass != WEAPON_CLASS)
755 if (!could_twoweap(youmonst.data)) {
758 You_cant("use two weapons in your current form.");
760 pline("
\8c»
\8dÝ
\82Ì
\8ep
\82Å
\82Í
\93ñ
\93\81\97¬
\82Í
\8eg
\82¦
\82È
\82¢
\81D");
763 pline("%s aren't able to use two weapons at once.",
765 pline("%s
\82Í
\93ñ
\82Â
\82Ì
\95\90\8aí
\82ð
\93¯
\8e\9e\82É
\88µ
\82¦
\82È
\82¢
\81D",
766 makeplural((flags.female && urole.name.f) ? urole.name.f
768 } else if (!uwep || !uswapwep)
770 Your("%s%s%s empty.", uwep ? "left " : uswapwep ? "right " : "",
771 body_part(HAND), (!uwep && !uswapwep) ? "s are" : " is");
773 Your("%s%s
\82Í
\8bó
\82Á
\82Û
\82¾
\81D", uwep ? "
\8d¶
\82Ì" : uswapwep ? "
\89E
\82Ì" : "",
776 else if (NOT_WEAPON(uwep) || NOT_WEAPON(uswapwep)) {
777 otmp = NOT_WEAPON(uwep) ? uwep : uswapwep;
779 pline("%s %s.", Yname2(otmp),
780 is_plural(otmp) ? "aren't weapons" : "isn't a weapon");
782 pline("%s
\82Í
\95\90\8aí
\82¶
\82á
\82È
\82¢
\81D", Yname2(otmp));
784 } else if (bimanual(uwep) || bimanual(uswapwep)) {
785 otmp = bimanual(uwep) ? uwep : uswapwep;
787 pline("%s isn't one-handed.", Yname2(otmp));
789 pline("%s
\82Í
\95Ð
\8eè
\8e\9d\82¿
\82Ì
\95\90\8aí
\82¶
\82á
\82È
\82¢
\81D", Yname2(otmp));
792 You_cant("use two weapons while wearing a shield.");
794 You("
\8f\82\82ð
\8e\9d\82Á
\82Ä
\82¢
\82é
\8aÔ
\82Í
\97¼
\8eè
\8e\9d\82¿
\82Å
\82«
\82È
\82¢
\81D");
795 else if (uswapwep->oartifact)
797 pline("%s being held second to another weapon!",
798 Yobjnam2(uswapwep, "resist"));
800 pline("%s
\82Í
\97\
\94õ
\82Ì
\95\90\8aí
\82Æ
\82µ
\82Ä
\88µ
\82í
\82ê
\82é
\82±
\82Æ
\82ð
\8b\91\82ñ
\82¾
\81I",
803 else if (uswapwep->otyp == CORPSE && cant_wield_corpse(uswapwep)) {
804 /* [Note: NOT_WEAPON() check prevents ever getting here...] */
805 ; /* must be life-saved to reach here; return FALSE */
806 } else if (Glib || uswapwep->cursed) {
808 set_bknown(uswapwep, 1);
819 struct obj *obj = uswapwep;
821 /* Avoid trashing makeplural's static buffer */
822 Strcpy(str, makeplural(body_part(HAND)));
824 pline("%s from your %s!", Yobjnam2(obj, "slip"), str);
826 You("%s
\82ð
\97\8e\82µ
\82Ä
\82µ
\82Ü
\82Á
\82½
\81I", xname(obj));
833 /* You can always toggle it off */
836 You("switch to your primary weapon.");
838 You("
\88ê
\82Â
\82Ì
\95\90\8aí
\82Å
\90í
\93¬
\82·
\82é
\82±
\82Æ
\82É
\82µ
\82½
\81D");
844 /* May we use two weapons? */
845 if (can_twoweapon()) {
848 You("begin two-weapon combat.");
850 You("
\93ñ
\93\81\97¬
\82Å
\90í
\93¬
\82·
\82é
\82±
\82Æ
\82É
\82µ
\82½
\81D");
853 return (rnd(20) > ACURR(A_DEX));
858 /*** Functions to empty a given slot ***/
859 /* These should be used only when the item can't be put back in
860 * the slot by life saving. Proper usage includes:
861 * 1. The item has been eaten, stolen, burned away, or rotted away.
862 * 2. Making an item disappear for a bones pile.
868 if (artifact_light(uwep) && uwep->lamplit) {
869 end_burn(uwep, FALSE);
872 pline("%s shining.", Tobjnam(uwep, "stop"));
874 pline("%s
\82Í
\8bP
\82«
\82ð
\8e~
\82ß
\82½
\81D", xname(uwep));
876 setworn((struct obj *) 0, W_WEP);
886 setworn((struct obj *) 0, W_SWAPWEP);
895 setworn((struct obj *) 0, W_QUIVER);
905 You("can no longer use two weapons at once.");
907 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");
915 chwepon(otmp, amount)
916 register struct obj *otmp;
919 const char *color = hcolor_adv((amount < 0) ? NH_BLACK : NH_BLUE);
920 const char *xtime, *wepname = "";
922 int otyp = STRANGE_OBJECT;
924 if (!uwep || (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep))) {
927 if (amount >= 0 && uwep && will_weld(uwep)) { /* cursed tin opener */
930 Sprintf(buf, "%s with %s aura.",
931 Yobjnam2(uwep, "glow"), an(hcolor(NH_AMBER)));
933 Sprintf(buf, "%s
\82Í%s
\83I
\81[
\83\89\82É
\82Â
\82Â
\82Ü
\82ê
\82½
\81D",
934 xname(uwep), hcolor(NH_AMBER));
936 uwep->bknown = !Hallucination; /* ok to bypass set_bknown() */
938 /* cursed tin opener is wielded in right hand */
940 Sprintf(buf, "Your right %s tingles.", body_part(HAND));
942 Sprintf(buf, "
\82 \82È
\82½
\82Ì
\89E%s
\82Í
\82¿
\82
\82¿
\82
\82µ
\82½
\81D", body_part(HAND));
948 Sprintf(buf, "Your %s %s.", makeplural(body_part(HAND)),
949 (amount >= 0) ? "twitch" : "itch");
951 Sprintf(buf, "
\82 \82È
\82½
\82Ì%s
\82Í%s
\81D", makeplural(body_part(HAND)),
952 (amount >= 0) ? "
\82Ð
\82«
\82Â
\82Á
\82½" : "
\83\80\83Y
\83\80\83Y
\82µ
\82½");
955 strange_feeling(otmp, buf); /* pline()+docall()+useup() */
956 exercise(A_DEX, (boolean) (amount >= 0));
960 if (otmp && otmp->oclass == SCROLL_CLASS)
963 if (uwep->otyp == WORM_TOOTH && amount >= 0) {
964 multiple = (uwep->quan > 1L);
965 /* order: message, transformation, shop handling */
967 Your("%s %s much sharper now.", simpleonames(uwep),
968 multiple ? "fuse, and become" : "is");
970 Your("%s
\82Í%s
\82æ
\82è
\89s
\82³
\82ð
\91\9d\82µ
\82½
\82æ
\82¤
\82¾
\81D", simpleonames(uwep),
971 multiple ? "
\97Z
\8d\87\82µ
\82Ä
\81C" : "");
973 uwep->otyp = CRYSKNIFE;
974 uwep->oerodeproof = 0;
977 uwep->owt = weight(uwep);
981 /* update shop bill to reflect new higher value */
983 alter_cost(uwep, 0L);
984 if (otyp != STRANGE_OBJECT)
989 } else if (uwep->otyp == CRYSKNIFE && amount < 0) {
990 multiple = (uwep->quan > 1L);
991 /* order matters: message, shop handling, transformation */
993 Your("%s %s much duller now.", simpleonames(uwep),
994 multiple ? "fuse, and become" : "is");
996 Your("%s
\82Í%s
\82æ
\82è
\93Ý
\82
\82È
\82Á
\82Ä
\82µ
\82Ü
\82Á
\82½
\82æ
\82¤
\82¾
\81D", simpleonames(uwep),
997 multiple ? "
\97Z
\8d\87\82µ
\82Ä
\81C" : "");
999 costly_alteration(uwep, COST_DEGRD); /* DECHNT? other? */
1000 uwep->otyp = WORM_TOOTH;
1001 uwep->oerodeproof = 0;
1004 uwep->owt = weight(uwep);
1006 if (otyp != STRANGE_OBJECT && otmp->bknown)
1013 if (has_oname(uwep))
1014 wepname = ONAME(uwep);
1015 if (amount < 0 && uwep->oartifact && restrict_name(uwep, wepname)) {
1018 pline("%s %s.", Yobjnam2(uwep, "faintly glow"), color);
1020 Your("%s
\82Í
\82í
\82¸
\82©
\82É%s
\8bP
\82¢
\82½
\81D", xname(uwep), color);
1023 /* there is a (soft) upper and lower limit to uwep->spe */
1024 if (((uwep->spe > 5 && amount >= 0) || (uwep->spe < -5 && amount < 0))
1028 pline("%s %s for a while and then %s.",
1029 Yobjnam2(uwep, "violently glow"), color,
1030 otense(uwep, "evaporate"));
1032 Your("%s
\82Í
\82µ
\82Î
\82ç
\82
\8c\83\82µ
\82%s
\8bP
\82«
\81C
\8fö
\94
\82µ
\82½
\81D",
1033 xname(uwep), color);
1037 pline("%s.", Yobjnam2(uwep, "evaporate"));
1039 Your("%s
\82Í
\8fö
\94
\82µ
\82½
\81D", xname(uwep));
1041 useupall(uwep); /* let all of them disappear */
1046 xtime = (amount * amount == 1) ? "moment" : "while";
1048 xtime = (amount*amount == 1) ? "
\88ê
\8fu" : "
\82µ
\82Î
\82ç
\82
\82Ì
\8aÔ";
1050 pline("%s %s for a %s.",
1051 Yobjnam2(uwep, amount == 0 ? "violently glow" : "glow"), color,
1054 Your("%s
\82Í%s%s%s
\8bP
\82¢
\82½
\81D",
1055 xname(uwep), xtime, color,
1056 amount == 0 ? "
\8c\83\82µ
\82" : "");
1058 if (otyp != STRANGE_OBJECT && uwep->known
1059 && (amount > 0 || (amount < 0 && otmp->bknown)))
1063 costly_alteration(uwep, COST_DECHNT);
1064 uwep->spe += amount;
1068 /* update shop bill to reflect new higher price */
1070 alter_cost(uwep, 0L);
1074 * Enchantment, which normally improves a weapon, has an
1075 * addition adverse reaction on Magicbane whose effects are
1076 * spe dependent. Give an obscure clue here.
1078 if (uwep->oartifact == ART_MAGICBANE && uwep->spe >= 0) {
1080 Your("right %s %sches!", body_part(HAND),
1081 (((amount > 1) && (uwep->spe > 1)) ? "flin" : "it"));
1083 Your("
\89E%s
\82Í%s
\81I",
1085 (((amount > 1) && (uwep->spe > 1)) ? "
\82Ð
\82è
\82Ð
\82è
\82µ
\82½" : "
\83\80\83Y
\83\80\83Y
\82µ
\82½"));
1089 /* an elven magic clue, cookie@keebler */
1090 /* elven weapons vibrate warningly when enchanted beyond a limit */
1092 && (is_elven_weapon(uwep) || uwep->oartifact || !rn2(7)))
1094 pline("%s unexpectedly.", Yobjnam2(uwep, "suddenly vibrate"));
1096 Your("%s
\82Í
\93Ë
\91R
\90k
\82¦
\82¾
\82µ
\82½
\81D", xname(uwep));
1103 register struct obj *obj;
1105 if (obj && obj == uwep && will_weld(obj)) {
1114 register struct obj *obj;
1118 savewornmask = obj->owornmask;
1120 pline("%s welded to your %s!", Yobjnam2(obj, "are"),
1121 bimanual(obj) ? (const char *) makeplural(body_part(HAND))
1124 You("%s
\82ð%s
\82É
\8d\
\82¦
\82½
\81I", xname(obj), body_part(HAND));
1126 obj->owornmask = savewornmask;
1129 /* test whether monster's wielded weapon is stuck to hand/paw/whatever */
1134 /* caller is responsible for making sure this is a monster's item */
1135 if (obj && (obj->owornmask & W_WEP) && will_weld(obj))