1: /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2: /* hack.wield.c - version 1.0.3 */
3:
4: #include "hack.h"
5: extern struct obj zeroobj;
6:
7: setuwep(obj) register struct obj *obj; {
8: setworn(obj, W_WEP);
9: }
10:
11: dowield()
12: {
13: register struct obj *wep;
14: register int res = 0;
15:
16: multi = 0;
17: if(!(wep = getobj("#-)", "wield"))) /* nothing */;
18: else if(uwep == wep)
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) {
24: if(uwep == 0){
25: pline("You are already empty handed.");
26: } else {
27: setuwep((struct obj *) 0);
28: res++;
29: pline("You are empty handed.");
30: }
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!");
35: else {
36: setuwep(wep);
37: res++;
38: if(uwep->cursed)
39: pline("The %s %s to your hand!",
40: aobjnam(uwep, "weld"),
41: (uwep->quan == 1) ? "itself" : "themselves"); /* a3 */
42: else prinv(uwep);
43: }
44: return(res);
45: }
46:
47: corrode_weapon(){
48: if(!uwep || uwep->olet != WEAPON_SYM) return; /* %% */
49: if(uwep->rustfree)
50: pline("Your %s not affected.", aobjnam(uwep, "are"));
51: else {
52: pline("Your %s!", aobjnam(uwep, "corrode"));
53: uwep->spe--;
54: }
55: }
56:
57: chwepon(otmp,amount)
58: register struct obj *otmp;
59: register amount;
60: {
61: register char *color = (amount < 0) ? "black" : "green";
62: register char *time;
63: if(!uwep || uwep->olet != WEAPON_SYM) {
64: strange_feeling(otmp,
65: (amount > 0) ? "Your hands twitch."
66: : "Your hands itch.");
67: return(0);
68: }
69:
70: if(uwep->otyp == WORM_TOOTH && amount > 0) {
71: uwep->otyp = CRYSKNIFE;
72: pline("Your weapon seems sharper now.");
73: uwep->cursed = 0;
74: return(1);
75: }
76:
77: if(uwep->otyp == CRYSKNIFE && amount < 0) {
78: uwep->otyp = WORM_TOOTH;
79: pline("Your weapon looks duller now.");
80: return(1);
81: }
82:
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 */
89: useup(uwep);
90: return(1);
91: }
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);
96: uwep->spe += amount;
97: if(amount > 0) uwep->cursed = 0;
98: return(1);
99: }
Defined functions
setuwep
defined in line
7; used 16 times