1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.wield.c - version 1.0.3 */
3 /* $FreeBSD: src/games/hack/hack.wield.c,v 1.4 1999/11/16 10:26:38 marcel Exp $ */
4 /* $DragonFly: src/games/hack/hack.wield.c,v 1.3 2005/05/22 03:37:05 y0netan1 Exp $ */
7 extern struct obj zeroobj;
9 setuwep(obj) struct obj *obj; {
19 if(!(wep = getobj("#-)", "wield"))) /* nothing */;
21 pline("You are already wielding that!");
22 else if(uwep && uwep->cursed)
23 pline("The %s welded to your hand!",
24 aobjnam(uwep, "are"));
25 else if(wep == &zeroobj) {
27 pline("You are already empty handed.");
29 setuwep((struct obj *) 0);
31 pline("You are empty handed.");
33 } else if(uarms && wep->otyp == TWO_HANDED_SWORD)
34 pline("You cannot wield a two-handed sword and wear a shield.");
35 else if(wep->owornmask & (W_ARMOR | W_RING))
36 pline("You cannot wield that!");
41 pline("The %s %s to your hand!",
42 aobjnam(uwep, "weld"),
43 (uwep->quan == 1) ? "itself" : "themselves"); /* a3 */
50 if(!uwep || uwep->olet != WEAPON_SYM) return; /* %% */
52 pline("Your %s not affected.", aobjnam(uwep, "are"));
54 pline("Your %s!", aobjnam(uwep, "corrode"));
63 const char *color = (amount < 0) ? "black" : "green";
66 if(!uwep || uwep->olet != WEAPON_SYM) {
68 (amount > 0) ? "Your hands twitch."
69 : "Your hands itch.");
73 if(uwep->otyp == WORM_TOOTH && amount > 0) {
74 uwep->otyp = CRYSKNIFE;
75 pline("Your weapon seems sharper now.");
80 if(uwep->otyp == CRYSKNIFE && amount < 0) {
81 uwep->otyp = WORM_TOOTH;
82 pline("Your weapon looks duller now.");
86 /* there is a (soft) upper limit to uwep->spe */
87 if(amount > 0 && uwep->spe > 5 && rn2(3)) {
88 pline("Your %s violently green for a while and then evaporate%s.",
89 aobjnam(uwep, "glow"), plur(uwep->quan));
90 while(uwep) /* let all of them disappear */
91 /* note: uwep->quan = 1 is nogood if unpaid */
95 if(!rn2(6)) amount *= 2;
96 time = (amount*amount == 1) ? "moment" : "while";
97 pline("Your %s %s for a %s.",
98 aobjnam(uwep, "glow"), color, time);
100 if(amount > 0) uwep->cursed = 0;