d5d13c77fcad89bc22708112548357cb2a885497
3 * Special wizard commands (some of which are also non-wizard commands
4 * under strange circumstances)
6 * @(#)wizard.c 3.8 (Berkeley) 6/3/81
8 * Rogue: Exploring the Dungeons of Doom
9 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
10 * All rights reserved.
12 * See the file LICENSE.TXT for full copyright and licensing information.
22 * What a certin object is
27 register struct object
*obj
;
28 register struct linked_list
*item
;
30 if ((item
= get_item("identify", 0)) == NULL
)
32 obj
= (struct object
*) ldata(item
);
36 s_know
[obj
->o_which
] = TRUE
;
37 if (s_guess
[obj
->o_which
])
39 free(s_guess
[obj
->o_which
]);
40 s_guess
[obj
->o_which
] = NULL
;
43 p_know
[obj
->o_which
] = TRUE
;
44 if (p_guess
[obj
->o_which
])
46 free(p_guess
[obj
->o_which
]);
47 p_guess
[obj
->o_which
] = NULL
;
50 ws_know
[obj
->o_which
] = TRUE
;
51 obj
->o_flags
|= ISKNOW
;
52 if (ws_guess
[obj
->o_which
])
54 free(ws_guess
[obj
->o_which
]);
55 ws_guess
[obj
->o_which
] = NULL
;
59 obj
->o_flags
|= ISKNOW
;
61 r_know
[obj
->o_which
] = TRUE
;
62 obj
->o_flags
|= ISKNOW
;
63 if (r_guess
[obj
->o_which
])
65 free(r_guess
[obj
->o_which
]);
66 r_guess
[obj
->o_which
] = NULL
;
69 msg(inv_name(obj
, FALSE
));
74 * Wizard command for getting anything he wants
79 register struct linked_list
*item
;
80 register struct object
*obj
;
81 register char ch
, bless
;
83 item
= new_item(sizeof *obj
);
84 obj
= (struct object
*) ldata(item
);
85 msg("Type of item: ");
86 obj
->o_type
= readchar(cw
);
88 msg("Which %c do you want? (0-f)", obj
->o_type
);
89 obj
->o_which
= (isdigit((ch
= readchar(cw
))) ? ch
- '0' : ch
- 'a' + 10);
93 if (obj
->o_type
== WEAPON
|| obj
->o_type
== ARMOR
)
95 msg("Blessing? (+,-,n)");
98 if (obj
->o_type
== WEAPON
)
100 init_weapon(obj
, obj
->o_which
);
102 obj
->o_hplus
-= rnd(3)+1;
103 obj
->o_flags
|= ISCURSED
;
106 obj
->o_hplus
+= rnd(3)+1;
110 obj
->o_ac
= a_class
[obj
->o_which
];
112 obj
->o_ac
+= rnd(3)+1;
113 obj
->o_flags
|= ISCURSED
;
116 obj
->o_ac
-= rnd(3)+1;
119 else if (obj
->o_type
== RING
)
120 switch (obj
->o_which
)
126 msg("Blessing? (+,-,n)");
127 bless
= readchar(cw
);
130 obj
->o_flags
|= ISCURSED
;
131 obj
->o_ac
= (bless
== '-' ? -1 : rnd(2) + 1);
133 else if (obj
->o_type
== STICK
)
135 add_pack(item
, FALSE
);
140 * Bamf the hero someplace else
149 mvwaddch(cw
, hero
.y
, hero
.x
, mvwinch(stdscr
, hero
.y
, hero
.x
));
153 rnd_pos(&rooms
[rm
], &hero
);
154 } until(winat(hero
.y
, hero
.x
) == FLOOR
);
157 mvwaddch(cw
, hero
.y
, hero
.x
, PLAYER
);
159 * turn off ISHELD in case teleportation was done while fighting
162 if (on(player
, ISHELD
)) {
163 player
.t_flags
&= ~ISHELD
;
165 strcpy(monsters
['F'-'A'].m_stats
.s_dmg
, "000d0");
169 flush_type(); /* flush typeahead */
175 * see if user knows password
180 register char *sp
, c
;
181 char buf
[80], *xcrypt();
183 msg("Wizard's Password:");
186 while ((c
= readchar(cw
)) != '\n' && c
!= '\r' && c
!= '\033')
187 if (c
== md_killchar())
189 else if (c
== md_erasechar() && sp
> buf
)
196 return (strcmp(PASSWD
, xcrypt(buf
, "mT")) == 0);