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 $ */
6 extern struct obj zeroobj;
8 setuwep(obj) struct obj *obj; {
18 if(!(wep = getobj("#-)", "wield"))) /* nothing */;
20 pline("You are already wielding that!");
21 else if(uwep && uwep->cursed)
22 pline("The %s welded to your hand!",
23 aobjnam(uwep, "are"));
24 else if(wep == &zeroobj) {
26 pline("You are already empty handed.");
28 setuwep((struct obj *) 0);
30 pline("You are empty handed.");
32 } else if(uarms && wep->otyp == TWO_HANDED_SWORD)
33 pline("You cannot wield a two-handed sword and wear a shield.");
34 else if(wep->owornmask & (W_ARMOR | W_RING))
35 pline("You cannot wield that!");
40 pline("The %s %s to your hand!",
41 aobjnam(uwep, "weld"),
42 (uwep->quan == 1) ? "itself" : "themselves"); /* a3 */
49 if(!uwep || uwep->olet != WEAPON_SYM) return; /* %% */
51 pline("Your %s not affected.", aobjnam(uwep, "are"));
53 pline("Your %s!", aobjnam(uwep, "corrode"));
62 char *color = (amount < 0) ? "black" : "green";
64 if(!uwep || uwep->olet != WEAPON_SYM) {
66 (amount > 0) ? "Your hands twitch."
67 : "Your hands itch.");
71 if(uwep->otyp == WORM_TOOTH && amount > 0) {
72 uwep->otyp = CRYSKNIFE;
73 pline("Your weapon seems sharper now.");
78 if(uwep->otyp == CRYSKNIFE && amount < 0) {
79 uwep->otyp = WORM_TOOTH;
80 pline("Your weapon looks duller now.");
84 /* there is a (soft) upper limit to uwep->spe */
85 if(amount > 0 && uwep->spe > 5 && rn2(3)) {
86 pline("Your %s violently green for a while and then evaporate%s.",
87 aobjnam(uwep, "glow"), plur(uwep->quan));
88 while(uwep) /* let all of them disappear */
89 /* note: uwep->quan = 1 is nogood if unpaid */
93 if(!rn2(6)) amount *= 2;
94 time = (amount*amount == 1) ? "moment" : "while";
95 pline("Your %s %s for a %s.",
96 aobjnam(uwep, "glow"), color, time);
98 if(amount > 0) uwep->cursed = 0;