-
Notifications
You must be signed in to change notification settings - Fork 1
/
armor.c
97 lines (85 loc) · 2.02 KB
/
armor.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
armor.c - This file contains misc functions for dealing with armor
UltraRogue
Copyright (C) 1985 Herb Chong
All rights reserved.
Based on "Advanced Rogue"
Copyright (C) 1982, 1984, 1985 Michael Morgan, Ken Dalka and AT&T
All rights reserved.
Based on "Rogue: Exploring the Dungeons of Doom"
Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
All rights reserved.
See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <curses.h>
#include "rogue.h"
/*
* wear:
* The player wants to wear something, so let him/her put it on.
*/
void
wear(void)
{
register struct linked_list *item;
register struct object *obj;
if (cur_armor != NULL)
{
addmsg("You are already wearing some");
if (!terse)
addmsg(". You'll have to take it off first");
addmsg("!");
endmsg();
after = FALSE;
return;
}
/* What does player want to wear? */
if ((item = get_item("wear", ARMOR)) == NULL)
return;
obj = (struct object *) ldata(item);
if (obj->o_type != ARMOR) {
msg("You can't wear that!");
return;
}
waste_time();
addmsg(terse ? "W" : "You are now w");
msg("earing %s.", armors[obj->o_which].a_name);
cur_armor = obj;
obj->o_flags |= ISKNOW;
}
/*
* take_off:
* Get the armor off of the players back
*/
void
take_off(void)
{
register struct object *obj;
if ((obj = cur_armor) == NULL)
{
msg("%s wearing armor!", terse ? "Not" : "You aren't");
return;
}
if (!dropcheck(cur_armor))
return;
cur_armor = NULL;
addmsg(terse ? "Was" : "You used to be");
msg(" wearing %c) %s.", pack_char(obj), inv_name(obj, TRUE));
if (on(player, STUMBLER)) {
msg("Your foot feels a lot better now.");
turn_off(player, STUMBLER);
}
}
/*
* waste_time:
* Do nothing but let other things happen
*/
void
waste_time(void)
{
if (inwhgt) /* if from wghtchk then done */
return;
do_daemons(BEFORE);
do_fuses(BEFORE);
do_daemons(AFTER);
do_fuses(AFTER);
}