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-2020 */
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ð
\91\95\94õ
\82µ
\82Ä
\82¢
\82é
\81D
\82»
\82Ì
\82¤
\82¿ %ld
\82ð
\8f\80\94õ
\82·
\82é
\81H",
501 uwep->quan, simpleonames(uwep), uwep->quan - 1L);
507 /* leave 1 wielded, split rest off and put into quiver */
508 newquiver = splitobj(uwep, uwep->quan - 1L);
509 finish_splitting = TRUE;
515 Strcpy(qbuf, "Ready all of them instead?");
517 Strcpy(qbuf, "
\91ã
\82í
\82è
\82É
\82±
\82ê
\82ç
\91S
\95\94\82ð
\8f\80\94õ
\82·
\82é
\81H");
520 boolean use_plural = (is_plural(uwep) || pair_of(uwep));
522 Sprintf(qbuf, "You are wielding %s. Ready %s instead?",
523 !use_plural ? "that" : "those",
524 !use_plural ? "it" : "them");
525 #else /*
\95s
\8e©
\91R
\82¾
\82¯
\82Ç
\82Æ
\82è
\82 \82¦
\82¸
\82±
\82ê
\82Å
\82æ
\82µ
\82Æ
\82·
\82é */
526 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");
529 /* require confirmation to ready the main weapon */
530 if (ynq(qbuf) != 'y') {
531 (void) Shk_Your(qbuf, uwep); /* replace qbuf[] contents */
533 pline("%s%s %s wielded.", qbuf,
534 simpleonames(uwep), otense(uwep, "remain"));
536 pline("%s%s
\82ð
\91\95\94õ
\82µ
\82½
\82Ü
\82Ü
\82É
\82µ
\82½
\81D", qbuf,
541 /* quivering main weapon, so no longer wielding it */
542 setuwep((struct obj *) 0);
545 } else if (newquiver == uswapwep) {
546 if (uswapwep->quan > 1L && inv_cnt(FALSE) < 52
547 && splittable(uswapwep)) {
549 Sprintf(qbuf, "%s %ld %s. Ready %ld of them?",
550 u.twoweap ? "You are dual wielding"
551 : "Your alternate weapon is",
552 uswapwep->quan, simpleonames(uswapwep),
553 uswapwep->quan - 1L);
554 #else /*TODO:
\93ñ
\93\81\97¬
\82Ì
\82Æ
\82«
\82Í
\82©
\82È
\82è
\95s
\8e©
\91R */
555 Sprintf(qbuf, "%s %ld %s
\82¾
\81D
\82»
\82Ì
\82¤
\82¿%ld
\82ð
\8f\80\94õ
\82·
\82é
\81H",
556 u.twoweap ? "
\82 \82È
\82½
\82ª
\82»
\82ê
\82¼
\82ê
\91\95\94õ
\82µ
\82Ä
\82¢
\82é
\82Ì
\82Í"
557 : "
\82 \82È
\82½
\82Ì
\97\
\94õ
\82Ì
\95\90\8aí
\82Í",
558 uswapwep->quan, simpleonames(uswapwep),
559 uswapwep->quan - 1L);
565 /* leave 1 alt-wielded, split rest off and put into quiver */
566 newquiver = splitobj(uswapwep, uswapwep->quan - 1L);
567 finish_splitting = TRUE;
573 Strcpy(qbuf, "Ready all of them instead?");
575 Strcpy(qbuf, "
\91ã
\82í
\82è
\82É
\82±
\82ê
\82ç
\91S
\95\94\82ð
\8f\80\94õ
\82·
\82é
\81H");
578 boolean use_plural = (is_plural(uswapwep) || pair_of(uswapwep));
580 Sprintf(qbuf, "%s your %s weapon. Ready %s instead?",
581 !use_plural ? "That is" : "Those are",
582 u.twoweap ? "second" : "alternate",
583 !use_plural ? "it" : "them");
585 Sprintf(qbuf, "
\82»
\82ê
\82Í%s
\95\90\8aí
\82¾
\81D
\91ã
\82í
\82è
\82É
\82»
\82ê
\82ð
\8f\80\94õ
\82·
\82é
\81H",
586 u.twoweap ? "
\93ñ
\94Ô
\96Ú
\82Ì" : "
\97\
\94õ
\82Ì");
589 /* require confirmation to ready the alternate weapon */
590 if (ynq(qbuf) != 'y') {
591 (void) Shk_Your(qbuf, uswapwep); /* replace qbuf[] contents */
593 pline("%s%s %s %s.", qbuf,
594 simpleonames(uswapwep), otense(uswapwep, "remain"),
595 u.twoweap ? "wielded" : "as secondary weapon");
597 pline("%s%s
\82ð%s
\82Ü
\82Ü
\82É
\82µ
\82½
\81D", qbuf,
598 simpleonames(uswapwep),
599 u.twoweap ? "
\91\95\94õ
\82µ
\82½" : "
\93ñ
\94Ô
\96Ú
\82Ì
\95\90\8aí
\82Ì");
603 /* quivering alternate weapon, so no more uswapwep */
604 setuswapwep((struct obj *) 0);
609 if (finish_splitting) {
611 newquiver->nomerge = 1;
613 newquiver->nomerge = 0;
615 /* place item in quiver before printing so that inventory feedback
616 includes "(at the ready)" */
618 prinv((char *) 0, newquiver, 0L);
620 /* quiver is a convenience slot and manipulating it ordinarily
621 consumes no time, but unwielding primary or secondary weapon
622 should take time (perhaps we're adjacent to a rust monster
623 or disenchanter and want to hit it immediately, but not with
624 something we're wielding that's vulnerable to its damage) */
628 You("are now empty %s.", body_part(HANDED));
630 You("
\95\90\8aí
\82ð
\8e\9d\82½
\82È
\82
\82È
\82Á
\82½
\81D");
632 } else if (was_twoweap && !u.twoweap) {
634 You("are no longer wielding two weapons at once.");
636 You("
\93ñ
\93\81\97¬
\82ð
\82â
\82ß
\82½
\81D");
642 /* used for #rub and for applying pick-axe, whip, grappling hook or polearm */
644 wield_tool(obj, verb)
646 const char *verb; /* "rub",&c */
654 return TRUE; /* nothing to do if already wielding it */
660 more_than_1 = (obj->quan > 1L || strstri(what, "pair of ") != 0
661 || strstri(what, "s of ") != 0);
664 if (obj->owornmask & (W_ARMOR | W_ACCESSORY)) {
666 You_cant("%s %s while wearing %s.", verb, yname(obj),
667 more_than_1 ? "them" : "it");
669 pline("
\90g
\82É
\82Â
\82¯
\82½
\82Ü
\82Ü
\82Å
\82Í%s
\82Í
\8eg
\82¦
\82È
\82¢
\81D", yname(obj));
676 const char *hand = body_part(HAND);
679 hand = makeplural(hand);
680 if (strstri(what, "pair of ") != 0)
683 "Since your weapon is welded to your %s, you cannot %s %s %s.",
684 hand, verb, more_than_1 ? "those" : "that", xname(obj));
686 pline("
\95\90\8aí
\82ð
\8eè
\82É
\82µ
\82Ä
\82¢
\82é
\82Ì
\82Å
\81C%s
\82ð
\8eg
\82¦
\82È
\82¢
\81D", xname(obj));
690 You_cant("do that.");
692 pline("
\82»
\82ê
\82Í
\82Å
\82«
\82È
\82¢
\81D");
696 if (cantwield(youmonst.data)) {
698 You_cant("hold %s strongly enough.", more_than_1 ? "them" : "it");
700 You("
\82»
\82ê
\82ð
\8e\9d\82Â
\82Ù
\82Ç
\97Í
\82ª
\82È
\82¢
\81D");
704 if (uarms && bimanual(obj)) {
706 You("cannot %s a two-handed %s while wearing a shield.", verb,
707 (obj->oclass == WEAPON_CLASS) ? "weapon" : "tool");
709 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",
710 (obj->oclass == WEAPON_CLASS) ? "
\95\90\8aí" : "
\93¹
\8bï");
716 setuqwep((struct obj *) 0);
717 if (uswapwep == obj) {
718 (void) doswapweapon();
719 /* doswapweapon might fail */
723 struct obj *oldwep = uwep;
725 if (will_weld(obj)) {
726 /* hope none of ready_weapon()'s early returns apply here... */
727 (void) ready_weapon(obj);
730 You("now wield %s.", doname(obj));
732 You("%s
\82ð
\91\95\94õ
\82µ
\82½
\81D", doname(obj));
735 if (flags.pushweapon && oldwep && uwep != oldwep)
739 return FALSE; /* rewielded old object after dying */
740 /* applying weapon or tool that gets wielded ends two-weapon combat */
743 if (obj->oclass != WEAPON_CLASS)
753 #define NOT_WEAPON(obj) (!is_weptool(obj) && obj->oclass != WEAPON_CLASS)
754 if (!could_twoweap(youmonst.data)) {
757 You_cant("use two weapons in your current form.");
759 pline("
\8c»
\8dÝ
\82Ì
\8ep
\82Å
\82Í
\93ñ
\93\81\97¬
\82Í
\8eg
\82¦
\82È
\82¢
\81D");
762 pline("%s aren't able to use two weapons at once.",
764 pline("%s
\82Í
\93ñ
\82Â
\82Ì
\95\90\8aí
\82ð
\93¯
\8e\9e\82É
\88µ
\82¦
\82È
\82¢
\81D",
765 makeplural((flags.female && urole.name.f) ? urole.name.f
767 } else if (!uwep || !uswapwep)
769 Your("%s%s%s empty.", uwep ? "left " : uswapwep ? "right " : "",
770 body_part(HAND), (!uwep && !uswapwep) ? "s are" : " is");
772 Your("%s%s
\82Í
\8bó
\82Á
\82Û
\82¾
\81D", uwep ? "
\8d¶
\82Ì" : uswapwep ? "
\89E
\82Ì" : "",
775 else if (NOT_WEAPON(uwep) || NOT_WEAPON(uswapwep)) {
776 otmp = NOT_WEAPON(uwep) ? uwep : uswapwep;
778 pline("%s %s.", Yname2(otmp),
779 is_plural(otmp) ? "aren't weapons" : "isn't a weapon");
781 pline("%s
\82Í
\95\90\8aí
\82¶
\82á
\82È
\82¢
\81D", Yname2(otmp));
783 } else if (bimanual(uwep) || bimanual(uswapwep)) {
784 otmp = bimanual(uwep) ? uwep : uswapwep;
786 pline("%s isn't one-handed.", Yname2(otmp));
788 pline("%s
\82Í
\95Ð
\8eè
\8e\9d\82¿
\82Ì
\95\90\8aí
\82¶
\82á
\82È
\82¢
\81D", Yname2(otmp));
791 You_cant("use two weapons while wearing a shield.");
793 You("
\8f\82\82ð
\8e\9d\82Á
\82Ä
\82¢
\82é
\8aÔ
\82Í
\97¼
\8eè
\8e\9d\82¿
\82Å
\82«
\82È
\82¢
\81D");
794 else if (uswapwep->oartifact)
796 pline("%s being held second to another weapon!",
797 Yobjnam2(uswapwep, "resist"));
799 pline("%s
\82Í
\97\
\94õ
\82Ì
\95\90\8aí
\82Æ
\82µ
\82Ä
\88µ
\82í
\82ê
\82é
\82±
\82Æ
\82ð
\8b\91\82ñ
\82¾
\81I",
802 else if (uswapwep->otyp == CORPSE && cant_wield_corpse(uswapwep)) {
803 /* [Note: NOT_WEAPON() check prevents ever getting here...] */
804 ; /* must be life-saved to reach here; return FALSE */
805 } else if (Glib || uswapwep->cursed) {
807 set_bknown(uswapwep, 1);
818 struct obj *obj = uswapwep;
820 /* Avoid trashing makeplural's static buffer */
821 Strcpy(str, makeplural(body_part(HAND)));
823 pline("%s from your %s!", Yobjnam2(obj, "slip"), str);
825 You("%s
\82ð
\97\8e\82µ
\82Ä
\82µ
\82Ü
\82Á
\82½
\81I", xname(obj));
832 /* You can always toggle it off */
835 You("switch to your primary weapon.");
837 You("
\88ê
\82Â
\82Ì
\95\90\8aí
\82Å
\90í
\93¬
\82·
\82é
\82±
\82Æ
\82É
\82µ
\82½
\81D");
843 /* May we use two weapons? */
844 if (can_twoweapon()) {
847 You("begin two-weapon combat.");
849 You("
\93ñ
\93\81\97¬
\82Å
\90í
\93¬
\82·
\82é
\82±
\82Æ
\82É
\82µ
\82½
\81D");
852 return (rnd(20) > ACURR(A_DEX));
857 /*** Functions to empty a given slot ***/
858 /* These should be used only when the item can't be put back in
859 * the slot by life saving. Proper usage includes:
860 * 1. The item has been eaten, stolen, burned away, or rotted away.
861 * 2. Making an item disappear for a bones pile.
867 if (artifact_light(uwep) && uwep->lamplit) {
868 end_burn(uwep, FALSE);
871 pline("%s shining.", Tobjnam(uwep, "stop"));
873 pline("%s
\82Í
\8bP
\82«
\82ð
\8e~
\82ß
\82½
\81D", xname(uwep));
875 setworn((struct obj *) 0, W_WEP);
885 setworn((struct obj *) 0, W_SWAPWEP);
894 setworn((struct obj *) 0, W_QUIVER);
904 You("can no longer use two weapons at once.");
906 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");
914 chwepon(otmp, amount)
915 register struct obj *otmp;
918 const char *color = hcolor((amount < 0) ? NH_BLACK : NH_BLUE);
919 const char *xtime, *wepname = "";
921 int otyp = STRANGE_OBJECT;
923 if (!uwep || (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep))) {
926 if (amount >= 0 && uwep && will_weld(uwep)) { /* cursed tin opener */
929 Sprintf(buf, "%s with %s aura.",
930 Yobjnam2(uwep, "glow"), an(hcolor(NH_AMBER)));
932 Sprintf(buf, "%s
\82Í%s
\83I
\81[
\83\89\82É
\82Â
\82Â
\82Ü
\82ê
\82½
\81D",
933 xname(uwep), hcolor(NH_AMBER));
935 uwep->bknown = !Hallucination; /* ok to bypass set_bknown() */
937 /* cursed tin opener is wielded in right hand */
939 Sprintf(buf, "Your right %s tingles.", body_part(HAND));
941 Sprintf(buf, "
\82 \82È
\82½
\82Ì
\89E%s
\82Í
\82¿
\82
\82¿
\82
\82µ
\82½
\81D", body_part(HAND));
947 Sprintf(buf, "Your %s %s.", makeplural(body_part(HAND)),
948 (amount >= 0) ? "twitch" : "itch");
950 Sprintf(buf, "
\82 \82È
\82½
\82Ì%s
\82Í%s
\81D", makeplural(body_part(HAND)),
951 (amount >= 0) ? "
\82Ð
\82«
\82Â
\82Á
\82½" : "
\83\80\83Y
\83\80\83Y
\82µ
\82½");
954 strange_feeling(otmp, buf); /* pline()+docall()+useup() */
955 exercise(A_DEX, (boolean) (amount >= 0));
959 if (otmp && otmp->oclass == SCROLL_CLASS)
962 if (uwep->otyp == WORM_TOOTH && amount >= 0) {
963 multiple = (uwep->quan > 1L);
964 /* order: message, transformation, shop handling */
966 Your("%s %s much sharper now.", simpleonames(uwep),
967 multiple ? "fuse, and become" : "is");
969 Your("%s
\82Í%s
\82æ
\82è
\89s
\82³
\82ð
\91\9d\82µ
\82½
\82æ
\82¤
\82¾
\81D", simpleonames(uwep),
970 multiple ? "
\97Z
\8d\87\82µ
\82Ä
\81C" : "");
972 uwep->otyp = CRYSKNIFE;
973 uwep->oerodeproof = 0;
976 uwep->owt = weight(uwep);
980 /* update shop bill to reflect new higher value */
982 alter_cost(uwep, 0L);
983 if (otyp != STRANGE_OBJECT)
988 } else if (uwep->otyp == CRYSKNIFE && amount < 0) {
989 multiple = (uwep->quan > 1L);
990 /* order matters: message, shop handling, transformation */
992 Your("%s %s much duller now.", simpleonames(uwep),
993 multiple ? "fuse, and become" : "is");
995 Your("%s
\82Í%s
\82æ
\82è
\93Ý
\82
\82È
\82Á
\82Ä
\82µ
\82Ü
\82Á
\82½
\82æ
\82¤
\82¾
\81D", simpleonames(uwep),
996 multiple ? "
\97Z
\8d\87\82µ
\82Ä
\81C" : "");
998 costly_alteration(uwep, COST_DEGRD); /* DECHNT? other? */
999 uwep->otyp = WORM_TOOTH;
1000 uwep->oerodeproof = 0;
1003 uwep->owt = weight(uwep);
1005 if (otyp != STRANGE_OBJECT && otmp->bknown)
1012 if (has_oname(uwep))
1013 wepname = ONAME(uwep);
1014 if (amount < 0 && uwep->oartifact && restrict_name(uwep, wepname)) {
1017 pline("%s %s.", Yobjnam2(uwep, "faintly glow"), color);
1019 Your("%s
\82Í
\82í
\82¸
\82©
\82É%s
\8bP
\82¢
\82½
\81D", xname(uwep),jconj_adj(color));
1022 /* there is a (soft) upper and lower limit to uwep->spe */
1023 if (((uwep->spe > 5 && amount >= 0) || (uwep->spe < -5 && amount < 0))
1027 pline("%s %s for a while and then %s.",
1028 Yobjnam2(uwep, "violently glow"), color,
1029 otense(uwep, "evaporate"));
1031 Your("%s
\82Í
\82µ
\82Î
\82ç
\82
\8c\83\82µ
\82%s
\8bP
\82«
\81C
\8fö
\94
\82µ
\82½
\81D",
1032 xname(uwep), jconj_adj(color));
1036 pline("%s.", Yobjnam2(uwep, "evaporate"));
1038 Your("%s
\82Í
\8fö
\94
\82µ
\82½
\81D", xname(uwep));
1040 useupall(uwep); /* let all of them disappear */
1045 xtime = (amount * amount == 1) ? "moment" : "while";
1047 xtime = (amount*amount == 1) ? "
\88ê
\8fu" : "
\82µ
\82Î
\82ç
\82
\82Ì
\8aÔ";
1049 pline("%s %s for a %s.",
1050 Yobjnam2(uwep, amount == 0 ? "violently glow" : "glow"), color,
1053 Your("%s
\82Í%s%s%s
\8bP
\82¢
\82½
\81D",
1054 xname(uwep), xtime, jconj_adj(color),
1055 amount == 0 ? "
\8c\83\82µ
\82" : "");
1057 if (otyp != STRANGE_OBJECT && uwep->known
1058 && (amount > 0 || (amount < 0 && otmp->bknown)))
1062 costly_alteration(uwep, COST_DECHNT);
1063 uwep->spe += amount;
1067 /* update shop bill to reflect new higher price */
1069 alter_cost(uwep, 0L);
1073 * Enchantment, which normally improves a weapon, has an
1074 * addition adverse reaction on Magicbane whose effects are
1075 * spe dependent. Give an obscure clue here.
1077 if (uwep->oartifact == ART_MAGICBANE && uwep->spe >= 0) {
1079 Your("right %s %sches!", body_part(HAND),
1080 (((amount > 1) && (uwep->spe > 1)) ? "flin" : "it"));
1082 Your("
\89E%s
\82Í%s
\81I",
1084 (((amount > 1) && (uwep->spe > 1)) ? "
\82Ð
\82è
\82Ð
\82è
\82µ
\82½" : "
\83\80\83Y
\83\80\83Y
\82µ
\82½"));
1088 /* an elven magic clue, cookie@keebler */
1089 /* elven weapons vibrate warningly when enchanted beyond a limit */
1091 && (is_elven_weapon(uwep) || uwep->oartifact || !rn2(7)))
1093 pline("%s unexpectedly.", Yobjnam2(uwep, "suddenly vibrate"));
1095 Your("%s
\82Í
\93Ë
\91R
\90k
\82¦
\82¾
\82µ
\82½
\81D", xname(uwep));
1102 register struct obj *obj;
1104 if (obj && obj == uwep && will_weld(obj)) {
1113 register struct obj *obj;
1117 savewornmask = obj->owornmask;
1119 pline("%s welded to your %s!", Yobjnam2(obj, "are"),
1120 bimanual(obj) ? (const char *) makeplural(body_part(HAND))
1123 You("%s
\82ð%s
\82É
\8d\
\82¦
\82½
\81I", xname(obj), body_part(HAND));
1125 obj->owornmask = savewornmask;
1128 /* test whether monster's wielded weapon is stuck to hand/paw/whatever */
1133 /* caller is responsible for making sure this is a monster's item */
1134 if (obj && (obj->owornmask & W_WEP) && will_weld(obj))