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)) {
491 Sprintf(qbuf, "You are wielding %ld %s. Ready %ld of them?",
492 uwep->quan, simpleonames(uwep), uwep->quan - 1L);
494 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",
495 uwep->quan, simpleonames(uwep), uwep->quan - 1L);
501 /* leave 1 wielded, split rest off and put into quiver */
502 newquiver = splitobj(uwep, uwep->quan - 1L);
503 finish_splitting = TRUE;
509 Strcpy(qbuf, "Ready all of them instead?");
511 Strcpy(qbuf, "
\91ã
\82í
\82è
\82É
\82±
\82ê
\82ç
\91S
\95\94\82ð
\8f\80\94õ
\82·
\82é
\81H");
513 boolean use_plural = (is_plural(uwep) || pair_of(uwep));
516 Sprintf(qbuf, "You are wielding %s. Ready %s instead?",
517 !use_plural ? "that" : "those",
518 !use_plural ? "it" : "them");
519 #else /*
\95s
\8e©
\91R
\82¾
\82¯
\82Ç
\82Æ
\82è
\82 \82¦
\82¸
\82±
\82ê
\82Å
\82æ
\82µ
\82Æ
\82·
\82é */
520 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");
523 /* require confirmation to ready the main weapon */
524 if (ynq(qbuf) != 'y') {
525 (void) Shk_Your(qbuf, uwep); /* replace qbuf[] contents */
527 pline("%s%s %s wielded.", qbuf,
528 simpleonames(uwep), otense(uwep, "remain"));
530 pline("%s%s
\82ð
\91\95\94õ
\82µ
\82½
\82Ü
\82Ü
\82É
\82µ
\82½
\81D", qbuf,
535 /* quivering main weapon, so no longer wielding it */
536 setuwep((struct obj *) 0);
539 } else if (newquiver == uswapwep) {
540 if (uswapwep->quan > 1L && inv_cnt(FALSE) < 52
541 && splittable(uswapwep)) {
543 Sprintf(qbuf, "%s %ld %s. Ready %ld of them?",
544 u.twoweap ? "You are dual wielding"
545 : "Your alternate weapon is",
546 uswapwep->quan, simpleonames(uswapwep),
547 uswapwep->quan - 1L);
548 #else /*TODO:
\93ñ
\93\81\97¬
\82Ì
\82Æ
\82«
\82Í
\82©
\82È
\82è
\95s
\8e©
\91R */
549 Sprintf(qbuf, "%s %ld %s
\82¾
\81D
\82»
\82Ì
\82¤
\82¿%ld
\82ð
\8f\80\94õ
\82·
\82é
\81H",
550 u.twoweap ? "
\82 \82È
\82½
\82ª
\82»
\82ê
\82¼
\82ê
\91\95\94õ
\82µ
\82Ä
\82¢
\82é
\82Ì
\82Í"
551 : "
\82 \82È
\82½
\82Ì
\97\
\94õ
\82Ì
\95\90\8aí
\82Í",
552 uswapwep->quan, simpleonames(uswapwep),
553 uswapwep->quan - 1L);
559 /* leave 1 alt-wielded, split rest off and put into quiver */
560 newquiver = splitobj(uswapwep, uswapwep->quan - 1L);
561 finish_splitting = TRUE;
567 Strcpy(qbuf, "Ready all of them instead?");
569 Strcpy(qbuf, "
\91ã
\82í
\82è
\82É
\82±
\82ê
\82ç
\91S
\95\94\82ð
\8f\80\94õ
\82·
\82é
\81H");
571 boolean use_plural = (is_plural(uswapwep) || pair_of(uswapwep));
574 Sprintf(qbuf, "%s your %s weapon. Ready %s instead?",
575 !use_plural ? "That is" : "Those are",
576 u.twoweap ? "second" : "alternate",
577 !use_plural ? "it" : "them");
579 Sprintf(qbuf, "
\82»
\82ê
\82Í%s
\95\90\8aí
\82¾
\81D
\91ã
\82í
\82è
\82É
\82»
\82ê
\82ð
\8f\80\94õ
\82·
\82é
\81H",
580 u.twoweap ? "
\93ñ
\94Ô
\96Ú
\82Ì" : "
\97\
\94õ
\82Ì");
583 /* require confirmation to ready the alternate weapon */
584 if (ynq(qbuf) != 'y') {
585 (void) Shk_Your(qbuf, uswapwep); /* replace qbuf[] contents */
587 pline("%s%s %s %s.", qbuf,
588 simpleonames(uswapwep), otense(uswapwep, "remain"),
589 u.twoweap ? "wielded" : "as secondary weapon");
591 pline("%s%s
\82ð%s
\82Ü
\82Ü
\82É
\82µ
\82½
\81D", qbuf,
592 simpleonames(uswapwep),
593 u.twoweap ? "
\91\95\94õ
\82µ
\82½" : "
\93ñ
\94Ô
\96Ú
\82Ì
\95\90\8aí
\82Ì");
597 /* quivering alternate weapon, so no more uswapwep */
598 setuswapwep((struct obj *) 0);
603 if (finish_splitting) {
605 newquiver->nomerge = 1;
607 newquiver->nomerge = 0;
609 /* place item in quiver before printing so that inventory feedback
610 includes "(at the ready)" */
612 prinv((char *) 0, newquiver, 0L);
614 /* quiver is a convenience slot and manipulating it ordinarily
615 consumes no time, but unwielding primary or secondary weapon
616 should take time (perhaps we're adjacent to a rust monster
617 or disenchanter and want to hit it immediately, but not with
618 something we're wielding that's vulnerable to its damage) */
622 You("are now empty %s.", body_part(HANDED));
624 You("
\95\90\8aí
\82ð
\8e\9d\82½
\82È
\82
\82È
\82Á
\82½
\81D");
626 } else if (was_twoweap && !u.twoweap) {
628 You("are no longer wielding two weapons at once.");
630 You("
\93ñ
\93\81\97¬
\82ð
\82â
\82ß
\82½
\81D");
636 /* used for #rub and for applying pick-axe, whip, grappling hook or polearm */
638 wield_tool(obj, verb)
640 const char *verb; /* "rub",&c */
648 return TRUE; /* nothing to do if already wielding it */
656 more_than_1 = (obj->quan > 1L || strstri(what, "pair of ") != 0
657 || strstri(what, "s of ") != 0);
660 if (obj->owornmask & (W_ARMOR | W_ACCESSORY)) {
662 You_cant("%s %s while wearing %s.", verb, yname(obj),
663 more_than_1 ? "them" : "it");
665 pline("
\90g
\82É
\82Â
\82¯
\82½
\82Ü
\82Ü
\82Å
\82Í%s
\82Í
\8eg
\82¦
\82È
\82¢
\81D", yname(obj));
672 const char *hand = body_part(HAND);
675 hand = makeplural(hand);
676 if (strstri(what, "pair of ") != 0)
679 "Since your weapon is welded to your %s, you cannot %s %s %s.",
680 hand, verb, more_than_1 ? "those" : "that", xname(obj));
682 pline("
\95\90\8aí
\82ð
\8eè
\82É
\82µ
\82Ä
\82¢
\82é
\82Ì
\82Å
\81C%s
\82ð
\8eg
\82¦
\82È
\82¢
\81D", xname(obj));
686 You_cant("do that.");
688 pline("
\82»
\82ê
\82Í
\82Å
\82«
\82È
\82¢
\81D");
692 if (cantwield(youmonst.data)) {
694 You_cant("hold %s strongly enough.", more_than_1 ? "them" : "it");
696 You("
\82»
\82ê
\82ð
\8e\9d\82Â
\82Ù
\82Ç
\97Í
\82ª
\82È
\82¢
\81D");
700 if (uarms && bimanual(obj)) {
702 You("cannot %s a two-handed %s while wearing a shield.", verb,
703 (obj->oclass == WEAPON_CLASS) ? "weapon" : "tool");
705 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",
706 (obj->oclass == WEAPON_CLASS) ? "
\95\90\8aí" : "
\93¹
\8bï");
712 setuqwep((struct obj *) 0);
713 if (uswapwep == obj) {
714 (void) doswapweapon();
715 /* doswapweapon might fail */
719 struct obj *oldwep = uwep;
722 You("now wield %s.", doname(obj));
724 You("%s
\82ð
\91\95\94õ
\82µ
\82½
\81D", doname(obj));
726 if (flags.pushweapon && oldwep && uwep != oldwep)
730 return FALSE; /* rewielded old object after dying */
731 /* applying weapon or tool that gets wielded ends two-weapon combat */
734 if (obj->oclass != WEAPON_CLASS)
744 #define NOT_WEAPON(obj) (!is_weptool(obj) && obj->oclass != WEAPON_CLASS)
745 if (!could_twoweap(youmonst.data)) {
748 You_cant("use two weapons in your current form.");
750 pline("
\8c»
\8dÝ
\82Ì
\8ep
\82Å
\82Í
\93ñ
\93\81\97¬
\82Í
\8eg
\82¦
\82È
\82¢
\81D");
753 pline("%s aren't able to use two weapons at once.",
755 pline("%s
\82Í
\93ñ
\82Â
\82Ì
\95\90\8aí
\82ð
\93¯
\8e\9e\82É
\88µ
\82¦
\82È
\82¢
\81D",
756 makeplural((flags.female && urole.name.f) ? urole.name.f
758 } else if (!uwep || !uswapwep)
760 Your("%s%s%s empty.", uwep ? "left " : uswapwep ? "right " : "",
761 body_part(HAND), (!uwep && !uswapwep) ? "s are" : " is");
763 Your("%s%s
\82Í
\8bó
\82Á
\82Û
\82¾
\81D", uwep ? "
\8d¶
\82Ì" : uswapwep ? "
\89E
\82Ì" : "",
766 else if (NOT_WEAPON(uwep) || NOT_WEAPON(uswapwep)) {
767 otmp = NOT_WEAPON(uwep) ? uwep : uswapwep;
769 pline("%s %s.", Yname2(otmp),
770 is_plural(otmp) ? "aren't weapons" : "isn't a weapon");
772 pline("%s
\82Í
\95\90\8aí
\82¶
\82á
\82È
\82¢
\81D", Yname2(otmp));
774 } else if (bimanual(uwep) || bimanual(uswapwep)) {
775 otmp = bimanual(uwep) ? uwep : uswapwep;
777 pline("%s isn't one-handed.", Yname2(otmp));
779 pline("%s
\82Í
\95Ð
\8eè
\8e\9d\82¿
\82Ì
\95\90\8aí
\82¶
\82á
\82È
\82¢
\81D", Yname2(otmp));
782 You_cant("use two weapons while wearing a shield.");
784 You("
\8f\82\82ð
\8e\9d\82Á
\82Ä
\82¢
\82é
\8aÔ
\82Í
\97¼
\8eè
\8e\9d\82¿
\82Å
\82«
\82È
\82¢
\81D");
785 else if (uswapwep->oartifact)
787 pline("%s being held second to another weapon!",
788 Yobjnam2(uswapwep, "resist"));
790 pline("%s
\82Í
\97\
\94õ
\82Ì
\95\90\8aí
\82Æ
\82µ
\82Ä
\88µ
\82í
\82ê
\82é
\82±
\82Æ
\82ð
\8b\91\82ñ
\82¾
\81I",
793 else if (uswapwep->otyp == CORPSE && cant_wield_corpse(uswapwep)) {
794 /* [Note: NOT_WEAPON() check prevents ever getting here...] */
795 ; /* must be life-saved to reach here; return FALSE */
796 } else if (Glib || uswapwep->cursed) {
798 uswapwep->bknown = TRUE;
809 struct obj *obj = uswapwep;
811 /* Avoid trashing makeplural's static buffer */
812 Strcpy(str, makeplural(body_part(HAND)));
814 pline("%s from your %s!", Yobjnam2(obj, "slip"), str);
816 You("%s
\82ð
\97\8e\82µ
\82Ä
\82µ
\82Ü
\82Á
\82½
\81I", xname(obj));
823 /* You can always toggle it off */
826 You("switch to your primary weapon.");
828 You("
\88ê
\82Â
\82Ì
\95\90\8aí
\82Å
\90í
\93¬
\82·
\82é
\82±
\82Æ
\82É
\82µ
\82½
\81D");
834 /* May we use two weapons? */
835 if (can_twoweapon()) {
838 You("begin two-weapon combat.");
840 You("
\93ñ
\93\81\97¬
\82Å
\90í
\93¬
\82·
\82é
\82±
\82Æ
\82É
\82µ
\82½
\81D");
843 return (rnd(20) > ACURR(A_DEX));
848 /*** Functions to empty a given slot ***/
849 /* These should be used only when the item can't be put back in
850 * the slot by life saving. Proper usage includes:
851 * 1. The item has been eaten, stolen, burned away, or rotted away.
852 * 2. Making an item disappear for a bones pile.
858 if (artifact_light(uwep) && uwep->lamplit) {
859 end_burn(uwep, FALSE);
862 pline("%s shining.", Tobjnam(uwep, "stop"));
864 pline("%s
\82Í
\8bP
\82«
\82ð
\8e~
\82ß
\82½
\81D", xname(uwep));
866 setworn((struct obj *) 0, W_WEP);
876 setworn((struct obj *) 0, W_SWAPWEP);
885 setworn((struct obj *) 0, W_QUIVER);
895 You("can no longer use two weapons at once.");
897 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");
905 chwepon(otmp, amount)
906 register struct obj *otmp;
909 const char *color = hcolor((amount < 0) ? NH_BLACK : NH_BLUE);
910 const char *xtime, *wepname = "";
912 int otyp = STRANGE_OBJECT;
914 if (!uwep || (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep))) {
917 if (amount >= 0 && uwep && will_weld(uwep)) { /* cursed tin opener */
919 Sprintf(buf, "%s with %s aura.",
920 Yobjnam2(uwep, "glow"), an(hcolor(NH_AMBER)));
921 uwep->bknown = !Hallucination;
923 /* cursed tin opener is wielded in right hand */
924 Sprintf(buf, "Your right %s tingles.", body_part(HAND));
930 Sprintf(buf, "Your %s %s.", makeplural(body_part(HAND)),
931 (amount >= 0) ? "twitch" : "itch");
933 Sprintf(buf, "
\82 \82È
\82½
\82Ì%s
\82Í%s
\81D", makeplural(body_part(HAND)),
934 (amount >= 0) ? "
\82Ð
\82«
\82Â
\82Á
\82½" : "
\83\80\83Y
\83\80\83Y
\82µ
\82½");
937 strange_feeling(otmp, buf); /* pline()+docall()+useup() */
938 exercise(A_DEX, (boolean) (amount >= 0));
942 if (otmp && otmp->oclass == SCROLL_CLASS)
945 if (uwep->otyp == WORM_TOOTH && amount >= 0) {
946 multiple = (uwep->quan > 1L);
947 /* order: message, transformation, shop handling */
949 Your("%s %s much sharper now.", simpleonames(uwep),
950 multiple ? "fuse, and become" : "is");
952 Your("%s
\82Í%s
\82æ
\82è
\89s
\82³
\82ð
\91\9d\82µ
\82½
\82æ
\82¤
\82¾
\81D", simpleonames(uwep),
953 multiple ? "
\97Z
\8d\87\82µ
\82Ä
\81C" : "");
955 uwep->otyp = CRYSKNIFE;
956 uwep->oerodeproof = 0;
959 uwep->owt = weight(uwep);
963 /* update shop bill to reflect new higher value */
965 alter_cost(uwep, 0L);
966 if (otyp != STRANGE_OBJECT)
971 } else if (uwep->otyp == CRYSKNIFE && amount < 0) {
972 multiple = (uwep->quan > 1L);
973 /* order matters: message, shop handling, transformation */
975 Your("%s %s much duller now.", simpleonames(uwep),
976 multiple ? "fuse, and become" : "is");
978 Your("%s
\82Í%s
\82æ
\82è
\93Ý
\82
\82È
\82Á
\82Ä
\82µ
\82Ü
\82Á
\82½
\82æ
\82¤
\82¾
\81D", simpleonames(uwep),
979 multiple ? "
\97Z
\8d\87\82µ
\82Ä
\81C" : "");
981 costly_alteration(uwep, COST_DEGRD); /* DECHNT? other? */
982 uwep->otyp = WORM_TOOTH;
983 uwep->oerodeproof = 0;
986 uwep->owt = weight(uwep);
988 if (otyp != STRANGE_OBJECT && otmp->bknown)
996 wepname = ONAME(uwep);
997 if (amount < 0 && uwep->oartifact && restrict_name(uwep, wepname)) {
1000 pline("%s %s.", Yobjnam2(uwep, "faintly glow"), color);
1002 Your("%s
\82Í
\82í
\82¸
\82©
\82É%s
\8bP
\82¢
\82½
\81D", xname(uwep),jconj_adj(color));
1005 /* there is a (soft) upper and lower limit to uwep->spe */
1006 if (((uwep->spe > 5 && amount >= 0) || (uwep->spe < -5 && amount < 0))
1010 pline("%s %s for a while and then %s.",
1011 Yobjnam2(uwep, "violently glow"), color,
1012 otense(uwep, "evaporate"));
1014 Your("%s
\82Í
\82µ
\82Î
\82ç
\82
\8c\83\82µ
\82%s
\8bP
\82«
\81C
\8fö
\94
\82µ
\82½
\81D",
1015 xname(uwep), jconj_adj(color));
1019 pline("%s.", Yobjnam2(uwep, "evaporate"));
1021 Your("%s
\82Í
\8fö
\94
\82µ
\82½
\81D", xname(uwep));
1023 useupall(uwep); /* let all of them disappear */
1028 xtime = (amount * amount == 1) ? "moment" : "while";
1030 xtime = (amount*amount == 1) ? "
\88ê
\8fu" : "
\82µ
\82Î
\82ç
\82
\82Ì
\8aÔ";
1032 pline("%s %s for a %s.",
1033 Yobjnam2(uwep, amount == 0 ? "violently glow" : "glow"), color,
1036 Your("%s
\82Í%s%s%s
\8bP
\82¢
\82½
\81D",
1037 xname(uwep), xtime, jconj_adj(color),
1038 amount == 0 ? "
\8c\83\82µ
\82" : "");
1040 if (otyp != STRANGE_OBJECT && uwep->known
1041 && (amount > 0 || (amount < 0 && otmp->bknown)))
1045 costly_alteration(uwep, COST_DECHNT);
1046 uwep->spe += amount;
1050 /* update shop bill to reflect new higher price */
1052 alter_cost(uwep, 0L);
1056 * Enchantment, which normally improves a weapon, has an
1057 * addition adverse reaction on Magicbane whose effects are
1058 * spe dependent. Give an obscure clue here.
1060 if (uwep->oartifact == ART_MAGICBANE && uwep->spe >= 0) {
1062 Your("right %s %sches!", body_part(HAND),
1063 (((amount > 1) && (uwep->spe > 1)) ? "flin" : "it"));
1065 Your("
\89E%s
\82Í%s
\81I",
1067 (((amount > 1) && (uwep->spe > 1)) ? "
\82Ð
\82è
\82Ð
\82è
\82µ
\82½" : "
\83\80\83Y
\83\80\83Y
\82µ
\82½"));
1071 /* an elven magic clue, cookie@keebler */
1072 /* elven weapons vibrate warningly when enchanted beyond a limit */
1074 && (is_elven_weapon(uwep) || uwep->oartifact || !rn2(7)))
1076 pline("%s unexpectedly.", Yobjnam2(uwep, "suddenly vibrate"));
1078 Your("%s
\82Í
\93Ë
\91R
\90k
\82¦
\82¾
\82µ
\82½
\81D", xname(uwep));
1085 register struct obj *obj;
1087 if (obj && obj == uwep && will_weld(obj)) {
1096 register struct obj *obj;
1100 savewornmask = obj->owornmask;
1102 pline("%s welded to your %s!", Yobjnam2(obj, "are"),
1103 bimanual(obj) ? (const char *) makeplural(body_part(HAND))
1106 You("%s
\82ð%s
\82É
\8d\
\82¦
\82½
\81I", xname(obj), body_part(HAND));
1108 obj->owornmask = savewornmask;
1111 /* test whether monster's wielded weapon is stuck to hand/paw/whatever */
1116 /* caller is responsible for making sure this is a monster's item */
1117 if (obj && (obj->owornmask & W_WEP) && will_weld(obj))