Mercurial > hg > early-roguelike
comparison xrogue/wear.c @ 133:e6179860cb76
Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
author | John "Elwin" Edwards |
---|---|
date | Tue, 21 Apr 2015 08:55:20 -0400 |
parents | |
children | ce0cf824c192 |
comparison
equal
deleted
inserted
replaced
124:d10fc4a065ac | 133:e6179860cb76 |
---|---|
1 /* | |
2 wear.c - functions for dealing with armor | |
3 | |
4 XRogue: Expeditions into the Dungeons of Doom | |
5 Copyright (C) 1991 Robert Pietkivitch | |
6 All rights reserved. | |
7 | |
8 Based on "Advanced Rogue" | |
9 Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T | |
10 All rights reserved. | |
11 | |
12 Based on "Rogue: Exploring the Dungeons of Doom" | |
13 Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman | |
14 All rights reserved. | |
15 | |
16 See the file LICENSE.TXT for full copyright and licensing information. | |
17 */ | |
18 | |
19 #include <curses.h> | |
20 #include "rogue.h" | |
21 | |
22 /* | |
23 * take_off: | |
24 * Get the armor off of the players back | |
25 */ | |
26 | |
27 take_off() | |
28 { | |
29 register struct object *obj; | |
30 register struct linked_list *item; | |
31 | |
32 /* It takes time to take things off */ | |
33 if (player.t_action != C_TAKEOFF) { | |
34 /* What does player want to take off? */ | |
35 if ((item = get_item(pack, "take off", REMOVABLE, FALSE, FALSE))==NULL) | |
36 return; | |
37 | |
38 obj = OBJPTR(item); | |
39 if (!is_current(obj)) { | |
40 msg("Not wearing %c) %s", pack_char(pack, obj),inv_name(obj, TRUE)); | |
41 return; | |
42 } | |
43 | |
44 player.t_using = item; /* Remember what it is */ | |
45 player.t_action = C_TAKEOFF; /* We are taking something off */ | |
46 | |
47 /* Cursed items take almost no time */ | |
48 if (obj->o_flags & ISCURSED) player.t_no_move = movement(&player); | |
49 else player.t_no_move = dress_units(item) * movement(&player); | |
50 return; | |
51 } | |
52 | |
53 /* We have waited our time, let's take off our item */ | |
54 item = player.t_using; | |
55 player.t_using = NULL; | |
56 player.t_action = A_NIL; | |
57 | |
58 obj = OBJPTR(item); | |
59 if (!is_current(obj)) { /* Just to be on the safe side */ | |
60 msg("Not wearing %c) %s", pack_char(pack, obj),inv_name(obj, TRUE)); | |
61 return; | |
62 } | |
63 | |
64 /* Can the player remove the item? */ | |
65 if (!dropcheck(obj)) return; | |
66 updpack(TRUE, &player); | |
67 | |
68 msg("Was wearing %c) %s", pack_char(pack, obj),inv_name(obj,TRUE)); | |
69 } | |
70 | |
71 /* | |
72 * wear: | |
73 * The player wants to wear something, so let him/her put it on. | |
74 */ | |
75 | |
76 wear() | |
77 { | |
78 register struct linked_list *item; | |
79 register struct object *obj; | |
80 register int i; | |
81 | |
82 /* It takes time to put things on */ | |
83 if (player.t_action != C_WEAR) { | |
84 /* What does player want to wear? */ | |
85 if ((item = get_item(pack, "wear", WEARABLE, FALSE, FALSE)) == NULL) | |
86 return; | |
87 | |
88 obj = OBJPTR(item); | |
89 | |
90 switch (obj->o_type) { | |
91 case ARMOR: | |
92 if (cur_armor != NULL) { | |
93 addmsg("You are already wearing armor"); | |
94 if (!terse) addmsg(". You'll have to take it off first."); | |
95 endmsg(); | |
96 after = FALSE; | |
97 return; | |
98 } | |
99 if (player.t_ctype == C_MONK) { | |
100 msg("Monks can't wear armor!"); | |
101 return; | |
102 } | |
103 if (cur_misc[WEAR_BRACERS] != NULL) { | |
104 msg("You can't wear armor with bracers of defense."); | |
105 return; | |
106 } | |
107 if (cur_misc[WEAR_CLOAK] != NULL || cur_relic[EMORI_CLOAK]) { | |
108 msg("You can't wear armor with a cloak."); | |
109 return; | |
110 } | |
111 if (player.t_ctype == C_THIEF && | |
112 (obj->o_which != LEATHER && | |
113 obj->o_which != STUDDED_LEATHER)) { | |
114 if (terse) msg("Thieves can't wear that type of armor."); | |
115 else | |
116 msg("Thieves can wear leather and studded leather armor."); | |
117 return; | |
118 } | |
119 if (player.t_ctype == C_ASSASSIN && | |
120 (obj->o_which != LEATHER && | |
121 obj->o_which != STUDDED_LEATHER)) { | |
122 if (terse) msg("Assassins can't wear that type of armor."); | |
123 else | |
124 msg("Assassins can wear leather and studded leather armor."); | |
125 return; | |
126 } | |
127 | |
128 when MM: | |
129 switch (obj->o_which) { | |
130 /* | |
131 * when wearing the boots of elvenkind the player will not | |
132 * set off any traps | |
133 */ | |
134 case MM_ELF_BOOTS: | |
135 if (cur_misc[WEAR_BOOTS] != NULL) { | |
136 msg("Already wearing a pair of boots. "); | |
137 return; | |
138 } | |
139 /* | |
140 * when wearing the boots of dancing the player will dance | |
141 * uncontrollably | |
142 */ | |
143 when MM_DANCE: | |
144 if (cur_misc[WEAR_BOOTS] != NULL) { | |
145 msg("Already wearing a pair of boots."); | |
146 return; | |
147 } | |
148 /* | |
149 * bracers give the hero protection in he same way armor does. | |
150 * they cannot be used with armor but can be used with cloaks | |
151 */ | |
152 when MM_BRACERS: | |
153 if (cur_misc[WEAR_BRACERS] != NULL) { | |
154 msg("Already wearing bracers."); | |
155 return; | |
156 } | |
157 else { | |
158 if (cur_armor != NULL) { | |
159 msg("You can't wear bracers of defense with armor."); | |
160 return; | |
161 } | |
162 } | |
163 | |
164 /* | |
165 * The robe (cloak) of powerlessness disallows any spell casting | |
166 */ | |
167 when MM_R_POWERLESS: | |
168 /* | |
169 * the cloak of displacement gives the hero an extra +2 on AC | |
170 * and saving throws. Cloaks cannot be used with armor. | |
171 */ | |
172 case MM_DISP: | |
173 /* | |
174 * the cloak of protection gives the hero +n on AC and saving | |
175 * throws with a max of +3 on saves | |
176 */ | |
177 case MM_PROTECT: | |
178 if (cur_misc[WEAR_CLOAK] != NULL || | |
179 cur_relic[EMORI_CLOAK]) { | |
180 msg("%slready wearing a cloak.", terse ? "A" | |
181 : "You are a"); | |
182 return; | |
183 } | |
184 else { | |
185 if (cur_armor != NULL) { | |
186 msg("You can't wear a cloak with armor."); | |
187 return; | |
188 } | |
189 } | |
190 /* | |
191 * the gauntlets of dexterity and ogre power give the hero | |
192 * a dexterity of 21, the gauntlets of fumbling cause the | |
193 * hero to drop his weapon. | |
194 */ | |
195 when MM_G_DEXTERITY: | |
196 case MM_G_OGRE: | |
197 case MM_FUMBLE: | |
198 if (cur_misc[WEAR_GAUNTLET] != NULL) { | |
199 msg("Already wearing a pair of gauntlets."); | |
200 return; | |
201 } | |
202 /* | |
203 * the jewel of attacks does an aggavate monster | |
204 */ | |
205 when MM_JEWEL: | |
206 if (cur_misc[WEAR_JEWEL] != NULL || | |
207 cur_relic[YENDOR_AMULET] || | |
208 cur_relic[STONEBONES_AMULET]) { | |
209 msg("Already wearing an amulet."); | |
210 return; | |
211 } | |
212 /* | |
213 * the necklace of adaption makes the hero immune to | |
214 * chlorine gas and acid breath. | |
215 */ | |
216 when MM_ADAPTION: | |
217 if (cur_misc[WEAR_NECKLACE] != NULL) { | |
218 msg("Already wearing a necklace."); | |
219 return; | |
220 } | |
221 /* | |
222 * the necklace of stragulation will try to strangle the | |
223 * hero to death | |
224 */ | |
225 when MM_STRANGLE: | |
226 if (cur_misc[WEAR_NECKLACE] != NULL) { | |
227 msg("Already wearing a necklace."); | |
228 return; | |
229 } | |
230 otherwise: | |
231 msg("What a strange item you have!"); | |
232 return; | |
233 } | |
234 | |
235 when RING: | |
236 if (cur_misc[WEAR_GAUNTLET] != NULL) { | |
237 msg ("You have to remove your gauntlets first!"); | |
238 return; | |
239 } | |
240 | |
241 /* Is there room to put the ring on */ | |
242 for (i=0; i<NUM_FINGERS; i++) | |
243 if (cur_ring[i] == NULL) { | |
244 break; | |
245 } | |
246 if (i == NUM_FINGERS) { /* Not enough fingers */ | |
247 if (terse) msg("Wearing enough rings."); | |
248 else msg("You are already wearing eight rings."); | |
249 return; | |
250 } | |
251 } | |
252 | |
253 player.t_using = item; /* Remember what it is */ | |
254 player.t_action = C_WEAR; /* We are taking something off */ | |
255 player.t_no_move = dress_units(item) * movement(&player); | |
256 return; | |
257 } | |
258 | |
259 /* We have waited our time, let's put on our item */ | |
260 item = player.t_using; | |
261 player.t_using = NULL; | |
262 player.t_action = A_NIL; | |
263 | |
264 obj = OBJPTR(item); | |
265 | |
266 switch (obj->o_type) { | |
267 case ARMOR: | |
268 obj->o_flags |= ISKNOW; | |
269 cur_armor = obj; | |
270 addmsg(terse ? "W" : "You are now w"); | |
271 msg("earing %s.", armors[obj->o_which].a_name); | |
272 | |
273 when MM: | |
274 switch (obj->o_which) { | |
275 /* | |
276 * when wearing the boots of elvenkind the player will not | |
277 * set off any traps | |
278 */ | |
279 case MM_ELF_BOOTS: | |
280 msg("Wearing %s",inv_name(obj,TRUE)); | |
281 cur_misc[WEAR_BOOTS] = obj; | |
282 /* | |
283 * when wearing the boots of dancing the player will dance | |
284 * uncontrollably | |
285 */ | |
286 when MM_DANCE: | |
287 msg("Wearing %s",inv_name(obj,TRUE)); | |
288 cur_misc[WEAR_BOOTS] = obj; | |
289 msg("You begin to dance uncontrollably!"); | |
290 turn_on(player, ISDANCE); | |
291 /* | |
292 * bracers give the hero protection in he same way armor does. | |
293 * they cannot be used with armor but can be used with cloaks | |
294 */ | |
295 when MM_BRACERS: | |
296 msg("wearing %s",inv_name(obj,TRUE)); | |
297 cur_misc[WEAR_BRACERS] = obj; | |
298 | |
299 /* | |
300 * The robe (cloak) of powerlessness disallows any spell casting | |
301 */ | |
302 when MM_R_POWERLESS: | |
303 /* | |
304 * the cloak of displacement gives the hero an extra +2 on AC | |
305 * and saving throws. Cloaks cannot be used with armor. | |
306 */ | |
307 case MM_DISP: | |
308 /* | |
309 * the cloak of protection gives the hero +n on AC and saving | |
310 * throws with a max of +3 on saves | |
311 */ | |
312 case MM_PROTECT: | |
313 msg("wearing %s",inv_name(obj,TRUE)); | |
314 cur_misc[WEAR_CLOAK] = obj; | |
315 /* | |
316 * the gauntlets of dexterity and ogre power give the hero | |
317 * a dexterity of 21, the gauntlets of fumbling cause the | |
318 * hero to drop his weapon. | |
319 */ | |
320 when MM_G_DEXTERITY: | |
321 case MM_G_OGRE: | |
322 case MM_FUMBLE: | |
323 msg("Wearing %s", inv_name(obj,TRUE)); | |
324 cur_misc[WEAR_GAUNTLET] = obj; | |
325 if (obj->o_which == MM_FUMBLE) | |
326 daemon(fumble, (VOID *)NULL, AFTER); | |
327 /* | |
328 * the jewel of attacks does an aggavate monster | |
329 */ | |
330 when MM_JEWEL: | |
331 msg("Wearing %s",inv_name(obj,TRUE)); | |
332 cur_misc[WEAR_JEWEL] = obj; | |
333 aggravate(TRUE, TRUE); /* affect all charactors */ | |
334 if (player.t_ctype == C_PALADIN || | |
335 player.t_ctype == C_RANGER || player.t_ctype == C_MONK) | |
336 msg("A chill runs down your spine! "); | |
337 | |
338 /* | |
339 * the necklace of adaption makes the hero immune to | |
340 * chlorine gas and acid | |
341 */ | |
342 when MM_ADAPTION: | |
343 msg("Wearing %s",inv_name(obj,TRUE)); | |
344 cur_misc[WEAR_NECKLACE] = obj; | |
345 turn_on(player, NOGAS); | |
346 turn_on(player, NOACID); | |
347 | |
348 /* | |
349 * the necklace of stragulation will try to strangle the | |
350 * hero to death | |
351 */ |