OSDN Git Service

change potion un-id desc
[jnethack/source.git] / src / wield.c
1 /* NetHack 3.6  wield.c $NHDT-Date: 1446887539 2015/11/07 09:12:19 $  $NHDT-Branch: master $:$NHDT-Revision: 1.47 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 /* JNetHack Copyright */
6 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
7 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016            */
8 /* JNetHack may be freely redistributed.  See license for details. */
9
10 #include "hack.h"
11
12 /* KMH -- Differences between the three weapon slots.
13  *
14  * The main weapon (uwep):
15  * 1.  Is filled by the (w)ield command.
16  * 2.  Can be filled with any type of item.
17  * 3.  May be carried in one or both hands.
18  * 4.  Is used as the melee weapon and as the launcher for
19  *     ammunition.
20  * 5.  Only conveys intrinsics when it is a weapon, weapon-tool,
21  *     or artifact.
22  * 6.  Certain cursed items will weld to the hand and cannot be
23  *     unwielded or dropped.  See erodeable_wep() and will_weld()
24  *     below for the list of which items apply.
25  *
26  * The secondary weapon (uswapwep):
27  * 1.  Is filled by the e(x)change command, which swaps this slot
28  *     with the main weapon.  If the "pushweapon" option is set,
29  *     the (w)ield command will also store the old weapon in the
30  *     secondary slot.
31  * 2.  Can be filled with anything that will fit in the main weapon
32  *     slot; that is, any type of item.
33  * 3.  Is usually NOT considered to be carried in the hands.
34  *     That would force too many checks among the main weapon,
35  *     second weapon, shield, gloves, and rings; and it would
36  *     further be complicated by bimanual weapons.  A special
37  *     exception is made for two-weapon combat.
38  * 4.  Is used as the second weapon for two-weapon combat, and as
39  *     a convenience to swap with the main weapon.
40  * 5.  Never conveys intrinsics.
41  * 6.  Cursed items never weld (see #3 for reasons), but they also
42  *     prevent two-weapon combat.
43  *
44  * The quiver (uquiver):
45  * 1.  Is filled by the (Q)uiver command.
46  * 2.  Can be filled with any type of item.
47  * 3.  Is considered to be carried in a special part of the pack.
48  * 4.  Is used as the item to throw with the (f)ire command.
49  *     This is a convenience over the normal (t)hrow command.
50  * 5.  Never conveys intrinsics.
51  * 6.  Cursed items never weld; their effect is handled by the normal
52  *     throwing code.
53  * 7.  The autoquiver option will fill it with something deemed
54  *     suitable if (f)ire is used when it's empty.
55  *
56  * No item may be in more than one of these slots.
57  */
58
59 STATIC_DCL boolean FDECL(cant_wield_corpse, (struct obj *));
60 STATIC_DCL int FDECL(ready_weapon, (struct obj *));
61
62 /* used by will_weld() */
63 /* probably should be renamed */
64 #define erodeable_wep(optr)                             \
65     ((optr)->oclass == WEAPON_CLASS || is_weptool(optr) \
66      || (optr)->otyp == HEAVY_IRON_BALL || (optr)->otyp == IRON_CHAIN)
67
68 /* used by welded(), and also while wielding */
69 #define will_weld(optr) \
70     ((optr)->cursed && (erodeable_wep(optr) || (optr)->otyp == TIN_OPENER))
71
72 /*** Functions that place a given item in a slot ***/
73 /* Proper usage includes:
74  * 1.  Initializing the slot during character generation or a
75  *     restore.
76  * 2.  Setting the slot due to a player's actions.
77  * 3.  If one of the objects in the slot are split off, these
78  *     functions can be used to put the remainder back in the slot.
79  * 4.  Putting an item that was thrown and returned back into the slot.
80  * 5.  Emptying the slot, by passing a null object.  NEVER pass
81  *     zeroobj!
82  *
83  * If the item is being moved from another slot, it is the caller's
84  * responsibility to handle that.  It's also the caller's responsibility
85  * to print the appropriate messages.
86  */
87 void
88 setuwep(obj)
89 register struct obj *obj;
90 {
91     struct obj *olduwep = uwep;
92
93     if (obj == uwep)
94         return; /* necessary to not set unweapon */
95     /* This message isn't printed in the caller because it happens
96      * *whenever* Sunsword is unwielded, from whatever cause.
97      */
98     setworn(obj, W_WEP);
99     if (uwep == obj && artifact_light(olduwep) && olduwep->lamplit) {
100         end_burn(olduwep, FALSE);
101         if (!Blind)
102 /*JP
103             pline("%s shining.", Tobjnam(olduwep, "stop"));
104 */
105             pline("%s\82Í\8bP\82«\82ð\8e~\82ß\82½\81D", xname(olduwep));
106     }
107     /* Note: Explicitly wielding a pick-axe will not give a "bashing"
108      * message.  Wielding one via 'a'pplying it will.
109      * 3.2.2:  Wielding arbitrary objects will give bashing message too.
110      */
111     if (obj) {
112         unweapon = (obj->oclass == WEAPON_CLASS)
113                        ? is_launcher(obj) || is_ammo(obj) || is_missile(obj)
114                              || (is_pole(obj) && !u.usteed)
115                        : !is_weptool(obj) && !is_wet_towel(obj);
116     } else
117         unweapon = TRUE; /* for "bare hands" message */
118     update_inventory();
119 }
120
121 STATIC_OVL boolean
122 cant_wield_corpse(obj)
123 struct obj *obj;
124 {
125     char kbuf[BUFSZ];
126
127     if (uarmg || obj->otyp != CORPSE || !touch_petrifies(&mons[obj->corpsenm])
128         || Stone_resistance)
129         return FALSE;
130
131     /* Prevent wielding cockatrice when not wearing gloves --KAA */
132 #if 0 /*JP*/
133     You("wield %s in your bare %s.",
134         corpse_xname(obj, (const char *) 0, CXN_PFX_THE),
135         makeplural(body_part(HAND)));
136 #else
137     You("%s\82ð%s\82É\82µ\82½\81D",
138         corpse_xname(obj, (const char *) 0, CXN_PFX_THE),
139         body_part(HAND));
140 #endif
141 /*JP
142     Sprintf(kbuf, "wielding %s bare-handed", killer_xname(obj));
143 */
144     Sprintf(kbuf, "%s\82ð\91f\8eè\82Å\8eè\82É\82µ\82Ä", killer_xname(obj));
145     instapetrify(kbuf);
146     return TRUE;
147 }
148
149 STATIC_OVL int
150 ready_weapon(wep)
151 struct obj *wep;
152 {
153     /* Separated function so swapping works easily */
154     int res = 0;
155
156     if (!wep) {
157         /* No weapon */
158         if (uwep) {
159 /*JP
160             You("are empty %s.", body_part(HANDED));
161 */
162             You("%s\82ð\8bó\82¯\82½\81D", body_part(HAND));
163             setuwep((struct obj *) 0);
164             res++;
165         } else
166 /*JP
167             You("are already empty %s.", body_part(HANDED));
168 */
169             You("\89½\82à%s\82É\82µ\82Ä\82¢\82È\82¢\81I", body_part(HAND));
170     } else if (wep->otyp == CORPSE && cant_wield_corpse(wep)) {
171         /* hero must have been life-saved to get here; use a turn */
172         res++; /* corpse won't be wielded */
173     } else if (uarms && bimanual(wep)) {
174 #if 0 /*JP*/
175         You("cannot wield a two-handed %s while wearing a shield.",
176             is_sword(wep) ? "sword" : wep->otyp == BATTLE_AXE ? "axe"
177                                                               : "weapon");
178 #else
179         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",
180               is_sword(wep) ? "\8c\95" : wep->otyp == BATTLE_AXE ? "\95\80"
181                                                              : "\95\90\8aí");
182 #endif
183     } else if (!retouch_object(&wep, FALSE)) {
184         res++; /* takes a turn even though it doesn't get wielded */
185     } else {
186         /* Weapon WILL be wielded after this point */
187         res++;
188         if (will_weld(wep)) {
189 #if 0 /*JP*//*\8eg\82í\82È\82¢*/
190             const char *tmp = xname(wep), *thestr = "The ";
191
192             if (strncmp(tmp, thestr, 4) && !strncmp(The(tmp), thestr, 4))
193                 tmp = thestr;
194             else
195                 tmp = "";
196 #endif
197 #if 0 /*JP*/
198             pline("%s%s %s to your %s!", tmp, aobjnam(wep, "weld"),
199                   (wep->quan == 1L) ? "itself" : "themselves", /* a3 */
200                   bimanual(wep) ? (const char *) makeplural(body_part(HAND))
201                                 : body_part(HAND));
202 #else
203             pline("%s\82Í\8f\9f\8eè\82É\82 \82È\82½\82Ì%s\82É\91\95\94õ\82³\82ê\82½\81D",
204                   xname(wep), body_part(HAND));
205 #endif
206             wep->bknown = TRUE;
207         } else {
208             /* The message must be printed before setuwep (since
209              * you might die and be revived from changing weapons),
210              * and the message must be before the death message and
211              * Lifesaved rewielding.  Yet we want the message to
212              * say "weapon in hand", thus this kludge.
213              */
214             long dummy = wep->owornmask;
215
216             wep->owornmask |= W_WEP;
217             prinv((char *) 0, wep, 0L);
218             wep->owornmask = dummy;
219         }
220         setuwep(wep);
221
222         /* KMH -- Talking artifacts are finally implemented */
223         arti_speak(wep);
224
225         if (artifact_light(wep) && !wep->lamplit) {
226             begin_burn(wep, FALSE);
227             if (!Blind)
228 #if 0 /*JP*/
229                 pline("%s to shine %s!", Tobjnam(wep, "begin"),
230                       arti_light_description(wep));
231 #else
232                 pline("%s\82Í%s\8bP\82«\82Í\82\82ß\82½\81I", xname(wep),
233                       arti_light_description(wep));
234 #endif
235         }
236 #if 0
237         /* we'll get back to this someday, but it's not balanced yet */
238         if (Race_if(PM_ELF) && !wep->oartifact
239             && objects[wep->otyp].oc_material == IRON) {
240             /* Elves are averse to wielding cold iron */
241             You("have an uneasy feeling about wielding cold iron.");
242             change_luck(-1);
243         }
244 #endif
245         if (wep->unpaid) {
246             struct monst *this_shkp;
247
248             if ((this_shkp = shop_keeper(inside_shop(u.ux, u.uy)))
249                 != (struct monst *) 0) {
250 #if 0 /*JP*/
251                 pline("%s says \"You be careful with my %s!\"",
252                       shkname(this_shkp), xname(wep));
253 #else
254                 pline("%s\82Í\8fq\82×\82½\81u%s\82Ì\88µ\82¢\82Í\8bC\82ð\82Â\82¯\82Ä\82­\82ê\82æ\81I\81v",
255                       shkname(this_shkp), xname(wep));
256 #endif
257             }
258         }
259     }
260     return res;
261 }
262
263 void
264 setuqwep(obj)
265 register struct obj *obj;
266 {
267     setworn(obj, W_QUIVER);
268     update_inventory();
269 }
270
271 void
272 setuswapwep(obj)
273 register struct obj *obj;
274 {
275     setworn(obj, W_SWAPWEP);
276     update_inventory();
277 }
278
279 /*** Commands to change particular slot(s) ***/
280
281 static NEARDATA const char wield_objs[] = { ALL_CLASSES, ALLOW_NONE,
282                                             WEAPON_CLASS, TOOL_CLASS, 0 };
283 static NEARDATA const char ready_objs[] = { COIN_CLASS, ALL_CLASSES,
284                                             ALLOW_NONE, WEAPON_CLASS, 0 };
285 static NEARDATA const char bullets[] = /* (note: different from dothrow.c) */
286     { COIN_CLASS, ALL_CLASSES, ALLOW_NONE, GEM_CLASS, WEAPON_CLASS, 0 };
287
288 int
289 dowield()
290 {
291     register struct obj *wep, *oldwep;
292     int result;
293
294     /* May we attempt this? */
295     multi = 0;
296     if (cantwield(youmonst.data)) {
297 /*JP
298         pline("Don't be ridiculous!");
299 */
300         pline("\82Î\82©\82Î\82©\82µ\82¢\81I");
301         return 0;
302     }
303
304     /* Prompt for a new weapon */
305     if (!(wep = getobj(wield_objs, "wield")))
306         /* Cancelled */
307         return 0;
308     else if (wep == uwep) {
309 /*JP
310         You("are already wielding that!");
311 */
312         You("\82à\82¤\82»\82ê\82ð%s\82É\82µ\82Ä\82¢\82é\81I", body_part(HAND));
313         if (is_weptool(wep) || is_wet_towel(wep))
314             unweapon = FALSE; /* [see setuwep()] */
315         return 0;
316     } else if (welded(uwep)) {
317         weldmsg(uwep);
318         /* previously interrupted armor removal mustn't be resumed */
319         reset_remarm();
320         return 0;
321     }
322
323     /* Handle no object, or object in other slot */
324     if (wep == &zeroobj)
325         wep = (struct obj *) 0;
326     else if (wep == uswapwep)
327         return doswapweapon();
328     else if (wep == uquiver)
329         setuqwep((struct obj *) 0);
330     else if (wep->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) {
331 /*JP
332         You("cannot wield that!");
333 */
334         You("\82»\82ê\82ð\91\95\94õ\82Å\82«\82È\82¢\81I");
335         return 0;
336     }
337
338     /* Set your new primary weapon */
339     oldwep = uwep;
340     result = ready_weapon(wep);
341     if (flags.pushweapon && oldwep && uwep != oldwep)
342         setuswapwep(oldwep);
343     untwoweapon();
344
345     return result;
346 }
347
348 int
349 doswapweapon()
350 {
351     register struct obj *oldwep, *oldswap;
352     int result = 0;
353
354     /* May we attempt this? */
355     multi = 0;
356     if (cantwield(youmonst.data)) {
357 /*JP
358         pline("Don't be ridiculous!");
359 */
360         pline("\82Î\82©\82Î\82©\82µ\82¢\81I");
361         return 0;
362     }
363     if (welded(uwep)) {
364         weldmsg(uwep);
365         return 0;
366     }
367
368     /* Unwield your current secondary weapon */
369     oldwep = uwep;
370     oldswap = uswapwep;
371     setuswapwep((struct obj *) 0);
372
373     /* Set your new primary weapon */
374     result = ready_weapon(oldswap);
375
376     /* Set your new secondary weapon */
377     if (uwep == oldwep)
378         /* Wield failed for some reason */
379         setuswapwep(oldswap);
380     else {
381         setuswapwep(oldwep);
382         if (uswapwep)
383             prinv((char *) 0, uswapwep, 0L);
384         else
385 /*JP
386             You("have no secondary weapon readied.");
387 */
388             You("\97\\94õ\82Ì\95\90\8aí\82Ì\97p\88Ó\82ð\82â\82ß\82½\81D");
389     }
390
391     if (u.twoweap && !can_twoweapon())
392         untwoweapon();
393
394     return result;
395 }
396
397 int
398 dowieldquiver()
399 {
400     register struct obj *newquiver;
401     const char *quivee_types =
402         (uslinging()
403          || (uswapwep && objects[uswapwep->otyp].oc_skill == P_SLING))
404             ? bullets
405             : ready_objs;
406
407     /* Since the quiver isn't in your hands, don't check cantwield(), */
408     /* will_weld(), touch_petrifies(), etc. */
409     multi = 0;
410
411     /* Prompt for a new quiver */
412     if (!(newquiver = getobj(quivee_types, "ready")))
413         /* Cancelled */
414         return 0;
415
416     /* Handle no object, or object in other slot */
417     /* Any type is okay, since we give no intrinsics anyways */
418     if (newquiver == &zeroobj) {
419         /* Explicitly nothing */
420         if (uquiver) {
421 /*JP
422             You("now have no ammunition readied.");
423 */
424             pline("\91\95\93U\82·\82é\82½\82ß\82Ì\96î\92e\82ª\82È\82­\82È\82Á\82½\81D");
425             setuqwep(newquiver = (struct obj *) 0);
426         } else {
427 /*JP
428             You("already have no ammunition readied!");
429 */
430             pline("\91\95\93U\82·\82é\82½\82ß\82Ì\96î\92e\82ª\82È\82¢\81D");
431             return 0;
432         }
433     } else if (newquiver == uquiver) {
434 /*JP
435         pline("That ammunition is already readied!");
436 */
437         pline("\82à\82¤\91\95\93U\82³\82ê\82Ä\82¢\82é\81I");
438         return 0;
439     } else if (newquiver == uwep) {
440         /* Prevent accidentally readying the main weapon */
441 #if 0 /*JP*/
442         pline("%s already being used as a weapon!",
443               !is_plural(uwep) ? "That is" : "They are");
444 #else
445         pline("\82à\82¤\95\90\8aí\82Æ\82µ\82Ä\8eg\82í\82ê\82Ä\82¢\82é\81I");
446 #endif
447         return 0;
448     } else if (newquiver->owornmask & (W_ARMOR | W_ACCESSORY | W_SADDLE)) {
449 /*JP
450         You("cannot ready that!");
451 */
452         You("\82»\82ê\82Í\8eg\82¦\82È\82¢\81I");
453         return 0;
454     } else {
455         long dummy;
456
457         /* Check if it's the secondary weapon */
458         if (newquiver == uswapwep) {
459             setuswapwep((struct obj *) 0);
460             untwoweapon();
461         }
462
463         /* Okay to put in quiver; print it */
464         dummy = newquiver->owornmask;
465         newquiver->owornmask |= W_QUIVER;
466         prinv((char *) 0, newquiver, 0L);
467         newquiver->owornmask = dummy;
468     }
469
470     /* Finally, place it in the quiver */
471     setuqwep(newquiver);
472     /* Take no time since this is a convenience slot */
473     return 0;
474 }
475
476 /* used for #rub and for applying pick-axe, whip, grappling hook or polearm */
477 boolean
478 wield_tool(obj, verb)
479 struct obj *obj;
480 const char *verb; /* "rub",&c */
481 {
482     const char *what;
483     boolean more_than_1;
484
485     if (obj == uwep)
486         return TRUE; /* nothing to do if already wielding it */
487
488 #if 0 /*JP*/
489     if (!verb)
490         verb = "wield";
491 #endif
492     what = xname(obj);
493 #if 0 /*JP*/
494     more_than_1 = (obj->quan > 1L || strstri(what, "pair of ") != 0
495                    || strstri(what, "s of ") != 0);
496 #endif
497
498     if (obj->owornmask & (W_ARMOR | W_ACCESSORY)) {
499 #if 0 /*JP*/
500         You_cant("%s %s while wearing %s.", verb, yname(obj),
501                  more_than_1 ? "them" : "it");
502 #else
503         pline("\90g\82É\82Â\82¯\82½\82Ü\82Ü\82Å\82Í%s\82Í\8eg\82¦\82È\82¢\81D", yname(obj));
504 #endif
505         return FALSE;
506     }
507     if (welded(uwep)) {
508         if (flags.verbose) {
509 #if 0 /*JP*/
510             const char *hand = body_part(HAND);
511
512             if (bimanual(uwep))
513                 hand = makeplural(hand);
514             if (strstri(what, "pair of ") != 0)
515                 more_than_1 = FALSE;
516             pline(
517                "Since your weapon is welded to your %s, you cannot %s %s %s.",
518                   hand, verb, more_than_1 ? "those" : "that", xname(obj));
519 #else
520             pline("\95\90\8aí\82ð\8eè\82É\82µ\82Ä\82¢\82é\82Ì\82Å\81C%s\82ð\8eg\82¦\82È\82¢\81D", xname(obj));
521 #endif
522         } else {
523 /*JP
524             You_cant("do that.");
525 */
526             pline("\82»\82ê\82Í\82Å\82«\82È\82¢\81D");
527         }
528         return FALSE;
529     }
530     if (cantwield(youmonst.data)) {
531 /*JP
532         You_cant("hold %s strongly enough.", more_than_1 ? "them" : "it");
533 */
534         You("\82»\82ê\82ð\8e\9d\82Â\82Ù\82Ç\97Í\82ª\82È\82¢\81D");
535         return FALSE;
536     }
537     /* check shield */
538     if (uarms && bimanual(obj)) {
539 #if 0 /*JP*/
540         You("cannot %s a two-handed %s while wearing a shield.", verb,
541             (obj->oclass == WEAPON_CLASS) ? "weapon" : "tool");
542 #else
543         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",
544               (obj->oclass == WEAPON_CLASS) ? "\95\90\8aí" : "\93¹\8bï");
545 #endif
546         return FALSE;
547     }
548
549     if (uquiver == obj)
550         setuqwep((struct obj *) 0);
551     if (uswapwep == obj) {
552         (void) doswapweapon();
553         /* doswapweapon might fail */
554         if (uswapwep == obj)
555             return FALSE;
556     } else {
557         struct obj *oldwep = uwep;
558
559 /*JP
560         You("now wield %s.", doname(obj));
561 */
562         You("%s\82ð\91\95\94õ\82µ\82½\81D", doname(obj));
563         setuwep(obj);
564         if (flags.pushweapon && oldwep && uwep != oldwep)
565             setuswapwep(oldwep);
566     }
567     if (uwep != obj)
568         return FALSE; /* rewielded old object after dying */
569     /* applying weapon or tool that gets wielded ends two-weapon combat */
570     if (u.twoweap)
571         untwoweapon();
572     if (obj->oclass != WEAPON_CLASS)
573         unweapon = TRUE;
574     return TRUE;
575 }
576
577 int
578 can_twoweapon()
579 {
580     struct obj *otmp;
581
582 #define NOT_WEAPON(obj) (!is_weptool(obj) && obj->oclass != WEAPON_CLASS)
583     if (!could_twoweap(youmonst.data)) {
584         if (Upolyd)
585 /*JP
586             You_cant("use two weapons in your current form.");
587 */
588             pline("\8c»\8dÝ\82Ì\8ep\82Å\82Í\93ñ\93\81\97¬\82Í\8eg\82¦\82È\82¢\81D");
589         else
590 /*JP
591             pline("%s aren't able to use two weapons at once.",
592 */
593             pline("%s\82Í\93ñ\82Â\82Ì\95\90\8aí\82ð\93¯\8e\9e\82É\88µ\82¦\82È\82¢\81D",
594                   makeplural((flags.female && urole.name.f) ? urole.name.f
595                                                             : urole.name.m));
596     } else if (!uwep || !uswapwep)
597 #if 0 /*JP*/
598         Your("%s%s%s empty.", uwep ? "left " : uswapwep ? "right " : "",
599              body_part(HAND), (!uwep && !uswapwep) ? "s are" : " is");
600 #else
601         Your("%s%s\82Í\8bó\82Á\82Û\82¾\81D", uwep ? "\8d\82Ì" : uswapwep ? "\89E\82Ì" : "",
602              body_part(HAND));
603 #endif
604     else if (NOT_WEAPON(uwep) || NOT_WEAPON(uswapwep)) {
605         otmp = NOT_WEAPON(uwep) ? uwep : uswapwep;
606 #if 0 /*JP*/
607         pline("%s %s.", Yname2(otmp),
608               is_plural(otmp) ? "aren't weapons" : "isn't a weapon");
609 #else
610         pline("%s\82Í\95\90\8aí\82\82á\82È\82¢\81D", Yname2(otmp));
611 #endif
612     } else if (bimanual(uwep) || bimanual(uswapwep)) {
613         otmp = bimanual(uwep) ? uwep : uswapwep;
614 /*JP
615         pline("%s isn't one-handed.", Yname2(otmp));
616 */
617         pline("%s\82Í\95Ð\8eè\8e\9d\82¿\82Ì\95\90\8aí\82\82á\82È\82¢\81D", Yname2(otmp));
618     } else if (uarms)
619 /*JP
620         You_cant("use two weapons while wearing a shield.");
621 */
622         You("\8f\82\82ð\8e\9d\82Á\82Ä\82¢\82é\8aÔ\82Í\97¼\8eè\8e\9d\82¿\82Å\82«\82È\82¢\81D");
623     else if (uswapwep->oartifact)
624 #if 0 /*JP*/
625         pline("%s being held second to another weapon!",
626               Yobjnam2(uswapwep, "resist"));
627 #else
628         pline("%s\82Í\97\\94õ\82Ì\95\90\8aí\82Æ\82µ\82Ä\88µ\82í\82ê\82é\82±\82Æ\82ð\8b\91\82ñ\82¾\81I",
629               Yname2(uswapwep));
630 #endif
631     else if (uswapwep->otyp == CORPSE && cant_wield_corpse(uswapwep)) {
632         /* [Note: NOT_WEAPON() check prevents ever getting here...] */
633         ; /* must be life-saved to reach here; return FALSE */
634     } else if (Glib || uswapwep->cursed) {
635         if (!Glib)
636             uswapwep->bknown = TRUE;
637         drop_uswapwep();
638     } else
639         return TRUE;
640     return FALSE;
641 }
642
643 void
644 drop_uswapwep()
645 {
646     char str[BUFSZ];
647     struct obj *obj = uswapwep;
648
649     /* Avoid trashing makeplural's static buffer */
650     Strcpy(str, makeplural(body_part(HAND)));
651 /*JP
652     pline("%s from your %s!", Yobjnam2(obj, "slip"), str);
653 */
654     You("%s\82ð\97\8e\82µ\82Ä\82µ\82Ü\82Á\82½\81I", xname(obj));
655     dropx(obj);
656 }
657
658 int
659 dotwoweapon()
660 {
661     /* You can always toggle it off */
662     if (u.twoweap) {
663 /*JP
664         You("switch to your primary weapon.");
665 */
666         You("\88ê\82Â\82Ì\95\90\8aí\82Å\90í\93¬\82·\82é\82±\82Æ\82É\82µ\82½\81D");
667         u.twoweap = 0;
668         update_inventory();
669         return 0;
670     }
671
672     /* May we use two weapons? */
673     if (can_twoweapon()) {
674         /* Success! */
675 /*JP
676         You("begin two-weapon combat.");
677 */
678         You("\93ñ\93\81\97¬\82Å\90í\93¬\82·\82é\82±\82Æ\82É\82µ\82½\81D");
679         u.twoweap = 1;
680         update_inventory();
681         return (rnd(20) > ACURR(A_DEX));
682     }
683     return 0;
684 }
685
686 /*** Functions to empty a given slot ***/
687 /* These should be used only when the item can't be put back in
688  * the slot by life saving.  Proper usage includes:
689  * 1.  The item has been eaten, stolen, burned away, or rotted away.
690  * 2.  Making an item disappear for a bones pile.
691  */
692 void
693 uwepgone()
694 {
695     if (uwep) {
696         if (artifact_light(uwep) && uwep->lamplit) {
697             end_burn(uwep, FALSE);
698             if (!Blind)
699 /*JP
700                 pline("%s shining.", Tobjnam(uwep, "stop"));
701 */
702                 pline("%s\82Í\8bP\82«\82ð\8e~\82ß\82½\81D", xname(uwep));
703         }
704         setworn((struct obj *) 0, W_WEP);
705         unweapon = TRUE;
706         update_inventory();
707     }
708 }
709
710 void
711 uswapwepgone()
712 {
713     if (uswapwep) {
714         setworn((struct obj *) 0, W_SWAPWEP);
715         update_inventory();
716     }
717 }
718
719 void
720 uqwepgone()
721 {
722     if (uquiver) {
723         setworn((struct obj *) 0, W_QUIVER);
724         update_inventory();
725     }
726 }
727
728 void
729 untwoweapon()
730 {
731     if (u.twoweap) {
732 /*JP
733         You("can no longer use two weapons at once.");
734 */
735         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");
736         u.twoweap = FALSE;
737         update_inventory();
738     }
739     return;
740 }
741
742 int
743 chwepon(otmp, amount)
744 register struct obj *otmp;
745 register int amount;
746 {
747     const char *color = hcolor((amount < 0) ? NH_BLACK : NH_BLUE);
748     const char *xtime, *wepname = "";
749     boolean multiple;
750     int otyp = STRANGE_OBJECT;
751
752     if (!uwep || (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep))) {
753         char buf[BUFSZ];
754
755 #if 0 /*JP*/
756         Sprintf(buf, "Your %s %s.", makeplural(body_part(HAND)),
757                 (amount >= 0) ? "twitch" : "itch");
758 #else
759         Sprintf(buf, "\82 \82È\82½\82Ì%s\82Í%s\81D", makeplural(body_part(HAND)),
760                 (amount >= 0) ? "\82Ð\82«\82Â\82Á\82½" : "\83\80\83Y\83\80\83Y\82µ\82½");
761 #endif
762         strange_feeling(otmp, buf);
763         exercise(A_DEX, (boolean) (amount >= 0));
764         return 0;
765     }
766
767     if (otmp && otmp->oclass == SCROLL_CLASS)
768         otyp = otmp->otyp;
769
770     if (uwep->otyp == WORM_TOOTH && amount >= 0) {
771         multiple = (uwep->quan > 1L);
772         /* order: message, transformation, shop handling */
773 #if 0 /*JP*/
774         Your("%s %s much sharper now.", simpleonames(uwep),
775              multiple ? "fuse, and become" : "is");
776 #else
777         Your("%s\82Í%s\82æ\82è\89s\82³\82ð\91\9d\82µ\82½\82æ\82¤\82¾\81D", simpleonames(uwep),
778              multiple ? "\97Z\8d\87\82µ\82Ä\81C" : "");
779 #endif
780         uwep->otyp = CRYSKNIFE;
781         uwep->oerodeproof = 0;
782         if (multiple) {
783             uwep->quan = 1L;
784             uwep->owt = weight(uwep);
785         }
786         if (uwep->cursed)
787             uncurse(uwep);
788         /* update shop bill to reflect new higher value */
789         if (uwep->unpaid)
790             alter_cost(uwep, 0L);
791         if (otyp != STRANGE_OBJECT)
792             makeknown(otyp);
793         if (multiple)
794             encumber_msg();
795         return 1;
796     } else if (uwep->otyp == CRYSKNIFE && amount < 0) {
797         multiple = (uwep->quan > 1L);
798         /* order matters: message, shop handling, transformation */
799 #if 0 /*JP*/
800         Your("%s %s much duller now.", simpleonames(uwep),
801              multiple ? "fuse, and become" : "is");
802 #else
803         Your("%s\82Í%s\82æ\82è\93Ý\82­\82È\82Á\82Ä\82µ\82Ü\82Á\82½\82æ\82¤\82¾\81D", simpleonames(uwep),
804              multiple ? "\97Z\8d\87\82µ\82Ä\81C" : "");
805 #endif
806         costly_alteration(uwep, COST_DEGRD); /* DECHNT? other? */
807         uwep->otyp = WORM_TOOTH;
808         uwep->oerodeproof = 0;
809         if (multiple) {
810             uwep->quan = 1L;
811             uwep->owt = weight(uwep);
812         }
813         if (otyp != STRANGE_OBJECT && otmp->bknown)
814             makeknown(otyp);
815         if (multiple)
816             encumber_msg();
817         return 1;
818     }
819
820     if (has_oname(uwep))
821         wepname = ONAME(uwep);
822     if (amount < 0 && uwep->oartifact && restrict_name(uwep, wepname)) {
823         if (!Blind)
824 /*JP
825             pline("%s %s.", Yobjnam2(uwep, "faintly glow"), color);
826 */
827             Your("%s\82Í\82í\82¸\82©\82É%s\8bP\82¢\82½\81D", xname(uwep),jconj_adj(color));
828         return 1;
829     }
830     /* there is a (soft) upper and lower limit to uwep->spe */
831     if (((uwep->spe > 5 && amount >= 0) || (uwep->spe < -5 && amount < 0))
832         && rn2(3)) {
833         if (!Blind)
834 #if 0 /*JP*/
835             pline("%s %s for a while and then %s.",
836                   Yobjnam2(uwep, "violently glow"), color,
837                   otense(uwep, "evaporate"));
838 #else
839             Your("%s\82Í\82µ\82Î\82ç\82­\8c\83\82µ\82­%s\8bP\82«\81C\8fö\94­\82µ\82½\81D",
840                  xname(uwep), jconj_adj(color));
841 #endif
842         else
843 /*JP
844             pline("%s.", Yobjnam2(uwep, "evaporate"));
845 */
846             Your("%s\82Í\8fö\94­\82µ\82½\81D", xname(uwep));
847
848         useupall(uwep); /* let all of them disappear */
849         return 1;
850     }
851     if (!Blind) {
852 /*JP
853         xtime = (amount * amount == 1) ? "moment" : "while";
854 */
855         xtime = (amount*amount == 1) ? "\88ê\8fu" : "\82µ\82Î\82ç\82­\82Ì\8aÔ";
856 #if 0 /*JP*/
857         pline("%s %s for a %s.",
858               Yobjnam2(uwep, amount == 0 ? "violently glow" : "glow"), color,
859               xtime);
860 #else
861         Your("%s\82Í%s%s%s\8bP\82¢\82½\81D",
862              xname(uwep), xtime, jconj_adj(color), 
863              amount == 0 ? "\8c\83\82µ\82­" : "");
864 #endif
865         if (otyp != STRANGE_OBJECT && uwep->known
866             && (amount > 0 || (amount < 0 && otmp->bknown)))
867             makeknown(otyp);
868     }
869     if (amount < 0)
870         costly_alteration(uwep, COST_DECHNT);
871     uwep->spe += amount;
872     if (amount > 0) {
873         if (uwep->cursed)
874             uncurse(uwep);
875         /* update shop bill to reflect new higher price */
876         if (uwep->unpaid)
877             alter_cost(uwep, 0L);
878     }
879
880     /*
881      * Enchantment, which normally improves a weapon, has an
882      * addition adverse reaction on Magicbane whose effects are
883      * spe dependent.  Give an obscure clue here.
884      */
885     if (uwep->oartifact == ART_MAGICBANE && uwep->spe >= 0) {
886 #if 0 /*JP*/
887         Your("right %s %sches!", body_part(HAND),
888              (((amount > 1) && (uwep->spe > 1)) ? "flin" : "it"));
889 #else
890         Your("\89E%s\82Í%s\81I",
891              body_part(HAND),
892              (((amount > 1) && (uwep->spe > 1)) ? "\82Ð\82è\82Ð\82è\82µ\82½" : "\83\80\83Y\83\80\83Y\82µ\82½"));
893 #endif
894     }
895
896     /* an elven magic clue, cookie@keebler */
897     /* elven weapons vibrate warningly when enchanted beyond a limit */
898     if ((uwep->spe > 5)
899         && (is_elven_weapon(uwep) || uwep->oartifact || !rn2(7)))
900 /*JP
901         pline("%s unexpectedly.", Yobjnam2(uwep, "suddenly vibrate"));
902 */
903         Your("%s\82Í\93Ë\91R\90k\82¦\82¾\82µ\82½\81D", xname(uwep));
904
905     return 1;
906 }
907
908 int
909 welded(obj)
910 register struct obj *obj;
911 {
912     if (obj && obj == uwep && will_weld(obj)) {
913         obj->bknown = TRUE;
914         return 1;
915     }
916     return 0;
917 }
918
919 void
920 weldmsg(obj)
921 register struct obj *obj;
922 {
923     long savewornmask;
924
925     savewornmask = obj->owornmask;
926 #if 0 /*JP*/
927     pline("%s welded to your %s!", Yobjnam2(obj, "are"),
928           bimanual(obj) ? (const char *) makeplural(body_part(HAND))
929                         : body_part(HAND));
930 #else
931     You("%s\82ð%s\82É\8d\\82¦\82½\81I", xname(obj), body_part(HAND));
932 #endif
933     obj->owornmask = savewornmask;
934 }
935
936 /* test whether monster's wielded weapon is stuck to hand/paw/whatever */
937 boolean
938 mwelded(obj)
939 struct obj *obj;
940 {
941     /* caller is responsible for making sure this is a monster's item */
942     if (obj && (obj->owornmask & W_WEP) && will_weld(obj))
943         return TRUE;
944     return FALSE;
945 }
946
947 /*wield.c*/