1 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 /* hack.wield.c - version 1.0.3 */
5 extern struct obj zeroobj;
7 setuwep(obj) register struct obj *obj; {
13 register struct obj *wep;
17 if(!(wep = getobj("#-)", "wield"))) /* nothing */;
19 pline("You are already wielding that!");
20 else if(uwep && uwep->cursed)
21 pline("The %s welded to your hand!",
22 aobjnam(uwep, "are"));
23 else if(wep == &zeroobj) {
25 pline("You are already empty handed.");
27 setuwep((struct obj *) 0);
29 pline("You are empty handed.");
31 } else if(uarms && wep->otyp == TWO_HANDED_SWORD)
32 pline("You cannot wield a two-handed sword and wear a shield.");
33 else if(wep->owornmask & (W_ARMOR | W_RING))
34 pline("You cannot wield that!");
39 pline("The %s %s to your hand!",
40 aobjnam(uwep, "weld"),
41 (uwep->quan == 1) ? "itself" : "themselves"); /* a3 */
48 if(!uwep || uwep->olet != WEAPON_SYM) return; /* %% */
50 pline("Your %s not affected.", aobjnam(uwep, "are"));
52 pline("Your %s!", aobjnam(uwep, "corrode"));
58 register struct obj *otmp;
61 register char *color = (amount < 0) ? "black" : "green";
63 if(!uwep || uwep->olet != WEAPON_SYM) {
65 (amount > 0) ? "Your hands twitch."
66 : "Your hands itch.");
70 if(uwep->otyp == WORM_TOOTH && amount > 0) {
71 uwep->otyp = CRYSKNIFE;
72 pline("Your weapon seems sharper now.");
77 if(uwep->otyp == CRYSKNIFE && amount < 0) {
78 uwep->otyp = WORM_TOOTH;
79 pline("Your weapon looks duller now.");
83 /* there is a (soft) upper limit to uwep->spe */
84 if(amount > 0 && uwep->spe > 5 && rn2(3)) {
85 pline("Your %s violently green for a while and then evaporate%s.",
86 aobjnam(uwep, "glow"), plur(uwep->quan));
87 while(uwep) /* let all of them disappear */
88 /* note: uwep->quan = 1 is nogood if unpaid */
92 if(!rn2(6)) amount *= 2;
93 time = (amount*amount == 1) ? "moment" : "while";
94 pline("Your %s %s for a %s.",
95 aobjnam(uwep, "glow"), color, time);
97 if(amount > 0) uwep->cursed = 0;