Mercurial > hg > early-roguelike
comparison xrogue/player.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 player.c - functions for dealing with special player abilities | |
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 See the file LICENSE.TXT for full copyright and licensing information. | |
13 */ | |
14 | |
15 #include <ctype.h> | |
16 #include <curses.h> | |
17 #include "rogue.h" | |
18 | |
19 /* | |
20 * affect: | |
21 * cleric affecting undead | |
22 */ | |
23 | |
24 affect() | |
25 { | |
26 register struct linked_list *item; | |
27 register struct thing *tp; | |
28 register char *mname; | |
29 bool see; | |
30 coord new_pos; | |
31 int lvl; | |
32 | |
33 if (!(player.t_ctype == C_CLERIC || | |
34 (player.t_ctype == C_PALADIN && pstats.s_lvl > 4) || | |
35 cur_relic[HEIL_ANKH] != 0)) { | |
36 msg("You cannot affect undead."); | |
37 return; | |
38 } | |
39 | |
40 new_pos.y = hero.y + player.t_newpos.y; | |
41 new_pos.x = hero.x + player.t_newpos.x; | |
42 | |
43 if (cansee(new_pos.y, new_pos.x)) see = TRUE; | |
44 else see = FALSE; | |
45 | |
46 /* Anything there? */ | |
47 if (new_pos.y < 0 || new_pos.y > lines-3 || | |
48 new_pos.x < 0 || new_pos.x > cols-1 || | |
49 mvwinch(mw, new_pos.y, new_pos.x) == ' ') { | |
50 msg("Nothing to affect."); | |
51 return; | |
52 } | |
53 | |
54 if ((item = find_mons(new_pos.y, new_pos.x)) == 0) { | |
55 debug("Affect what @ %d,%d?", new_pos.y, new_pos.x); | |
56 return; | |
57 } | |
58 tp = THINGPTR(item); | |
59 mname = monster_name(tp); | |
60 | |
61 if (on(player, ISINVIS) && off(*tp, CANSEE)) { | |
62 msg("%s%s cannot see you", see ? "The " : "It", | |
63 see ? mname : ""); | |
64 return; | |
65 } | |
66 | |
67 if (off(*tp, TURNABLE) || on(*tp, WASTURNED)) | |
68 goto annoy; | |
69 turn_off(*tp, TURNABLE); | |
70 | |
71 lvl = pstats.s_lvl; | |
72 if (player.t_ctype == C_PALADIN && cur_relic[HEIL_ANKH] == 0) { | |
73 lvl -= 4; | |
74 } | |
75 /* Can cleric kill it? */ | |
76 if (lvl >= 3 * tp->t_stats.s_lvl) { | |
77 unsigned long test; /* For overflow check */ | |
78 | |
79 msg("You have destroyed %s%s.", see ? "the " : "it", see ? mname : ""); | |
80 test = pstats.s_exp + tp->t_stats.s_exp; | |
81 | |
82 /* Be sure there is no overflow before increasing experience */ | |
83 if (test > pstats.s_exp) pstats.s_exp = test; | |
84 killed(item, FALSE, TRUE, TRUE); | |
85 check_level(); | |
86 return; | |
87 } | |
88 | |
89 /* Can cleric turn it? */ | |
90 if (rnd(100) + 1 > | |
91 (100 * ((2 * tp->t_stats.s_lvl) - lvl)) / lvl) { | |
92 unsigned long test; /* Overflow test */ | |
93 | |
94 /* Make the monster flee */ | |
95 turn_on(*tp, WASTURNED); /* No more fleeing after this */ | |
96 turn_on(*tp, ISFLEE); | |
97 runto(tp, &hero); | |
98 | |
99 /* Disrupt it */ | |
100 dsrpt_monster(tp, TRUE, TRUE); | |
101 | |
102 /* Let player know */ | |
103 msg("You have turned %s%s.", see ? "the " : "it", see ? mname : ""); | |
104 | |
105 /* get points for turning monster -- but check overflow first */ | |
106 test = pstats.s_exp + tp->t_stats.s_exp/2; | |
107 if (test > pstats.s_exp) pstats.s_exp = test; | |
108 check_level(); | |
109 | |
110 /* If monster was suffocating, stop it */ | |
111 if (on(*tp, DIDSUFFOCATE)) { | |
112 turn_off(*tp, DIDSUFFOCATE); | |
113 extinguish(suffocate); | |
114 } | |
115 | |
116 /* If monster held us, stop it */ | |
117 if (on(*tp, DIDHOLD) && (--hold_count == 0)) | |
118 turn_off(player, ISHELD); | |
119 turn_off(*tp, DIDHOLD); | |
120 | |
121 /* It is okay to turn tail */ | |
122 tp->t_oldpos = tp->t_pos; | |
123 | |
124 return; | |
125 } | |
126 | |
127 /* Otherwise -- no go */ | |
128 annoy: | |
129 if (see && tp->t_stats.s_intel > 16) | |
130 msg("%s laughs at you...", prname(mname, TRUE)); | |
131 else | |
132 msg("You do not affect %s%s.", see ? "the " : "it", see ? mname : ""); | |
133 | |
134 /* Annoy monster */ | |
135 if (off(*tp, ISFLEE)) runto(tp, &hero); | |
136 } | |
137 | |
138 /* | |
139 * the cleric asks his deity for a spell | |
140 */ | |
141 | |
142 pray() | |
143 { | |
144 register int num_prayers, prayer_ability, which_prayer; | |
145 | |
146 which_prayer = num_prayers = prayer_ability = 0; | |
147 | |
148 if (player.t_ctype != C_CLERIC && player.t_ctype != C_PALADIN && | |
149 cur_relic[HEIL_ANKH] == 0) { | |
150 msg("You are not permitted to pray."); | |
151 return; | |
152 } | |
153 if (cur_misc[WEAR_CLOAK] != NULL && | |
154 cur_misc[WEAR_CLOAK]->o_which == MM_R_POWERLESS) { | |
155 msg("You can't seem to pray!"); | |
156 return; | |
157 } | |
158 | |
159 prayer_ability = pstats.s_lvl * pstats.s_wisdom - 5; | |
160 if (player.t_ctype != C_CLERIC) | |
161 prayer_ability /= 2; | |
162 | |
163 if (cur_relic[HEIL_ANKH]) prayer_ability += 75; | |
164 | |
165 if (player.t_action != C_PRAY) { | |
166 num_prayers = 0; | |
167 | |
168 /* Get the number of avilable prayers */ | |
169 if (pstats.s_wisdom > 16) | |
170 num_prayers += pstats.s_wisdom - 16; | |
171 | |
172 num_prayers += pstats.s_lvl; | |
173 if (cur_relic[HEIL_ANKH]) | |
174 num_prayers += pstats.s_wisdom - 18; | |
175 | |
176 if (player.t_ctype != C_CLERIC) | |
177 num_prayers /= 2; | |
178 | |
179 if (num_prayers > MAXPRAYERS) | |
180 num_prayers = MAXPRAYERS; | |
181 if (num_prayers < 1) { | |
182 msg("You are not permitted to pray yet."); | |
183 return; | |
184 } | |
185 | |
186 /* Prompt for prayer */ | |
187 if (pick_spell( cleric_spells, | |
188 prayer_ability, | |
189 num_prayers, | |
190 pray_time, | |
191 "offer", | |
192 "prayer")) | |
193 player.t_action = C_PRAY; | |
194 | |
195 return; | |
196 } | |
197 | |
198 /* We've waited our required praying time. */ | |
199 which_prayer = player.t_selection; | |
200 player.t_selection = 0; | |
201 player.t_action = A_NIL; | |
202 | |
203 if (cleric_spells[which_prayer].s_cost + pray_time > prayer_ability) { | |
204 msg("Your prayer fails."); | |
205 return; | |
206 } | |
207 | |
208 msg("Your prayer has been granted. "); | |
209 | |
210 if (cleric_spells[which_prayer].s_type == TYP_POTION) | |
211 quaff( cleric_spells[which_prayer].s_which, | |
212 NULL, | |
213 cleric_spells[which_prayer].s_flag, | |
214 FALSE); | |
215 else if (cleric_spells[which_prayer].s_type == TYP_SCROLL) | |
216 read_scroll( cleric_spells[which_prayer].s_which, | |
217 cleric_spells[which_prayer].s_flag, | |
218 FALSE); | |
219 else if (cleric_spells[which_prayer].s_type == TYP_STICK) { | |
220 if (!player_zap(cleric_spells[which_prayer].s_which, | |
221 cleric_spells[which_prayer].s_flag)) { | |
222 after = FALSE; | |
223 return; | |
224 } | |
225 } | |
226 pray_time += cleric_spells[which_prayer].s_cost; | |
227 } | |
228 | |
229 /* | |
230 * the magician is going to try and cast a spell | |
231 */ | |
232 | |
233 cast() | |
234 { | |
235 register int spell_ability, which_spell, num_spells; | |
236 | |
237 if (player.t_ctype != C_MAGICIAN && player.t_ctype != C_RANGER) { | |
238 msg("You are not permitted to cast spells."); | |
239 return; | |
240 } | |
241 if (cur_misc[WEAR_CLOAK] != NULL && | |
242 cur_misc[WEAR_CLOAK]->o_which == MM_R_POWERLESS) { | |
243 msg("You can't seem to cast spells!"); | |
244 return; | |
245 } | |
246 spell_ability = pstats.s_lvl * pstats.s_intel - 5; | |
247 if (player.t_ctype != C_MAGICIAN) | |
248 spell_ability /= 2; | |
249 | |
250 if (player.t_action != C_CAST) { | |
251 /* | |
252 * Get the number of avilable spells | |
253 */ | |
254 num_spells = 0; | |
255 if (pstats.s_intel > 16) | |
256 num_spells += pstats.s_intel - 16; | |
257 | |
258 num_spells += pstats.s_lvl; | |
259 if (player.t_ctype != C_MAGICIAN) | |
260 num_spells /= 2; | |
261 if (num_spells > MAXSPELLS) | |
262 num_spells = MAXSPELLS; | |
263 if (num_spells < 1) { | |
264 msg("You are not allowed to cast spells yet."); | |
265 return; | |
266 } | |
267 | |
268 /* prompt for spell */ | |
269 if (pick_spell( magic_spells, | |
270 spell_ability, | |
271 num_spells, | |
272 spell_power, | |
273 "cast", | |
274 "spell")) | |
275 player.t_action = C_CAST; | |
276 return; | |
277 } | |
278 | |
279 /* We've waited our required casting time. */ | |
280 which_spell = player.t_selection; | |
281 player.t_selection = 0; | |
282 player.t_action = A_NIL; | |
283 | |
284 if ((spell_power + magic_spells[which_spell].s_cost) > spell_ability) { | |
285 msg("Your attempt fails."); | |
286 return; | |
287 } | |
288 | |
289 msg("Your spell is successful. "); | |
290 | |
291 if (magic_spells[which_spell].s_type == TYP_POTION) | |
292 quaff( magic_spells[which_spell].s_which, | |
293 NULL, | |
294 magic_spells[which_spell].s_flag, | |
295 FALSE); | |
296 else if (magic_spells[which_spell].s_type == TYP_SCROLL) | |
297 read_scroll( magic_spells[which_spell].s_which, | |
298 magic_spells[which_spell].s_flag, | |
299 FALSE); | |
300 else if (magic_spells[which_spell].s_type == TYP_STICK) { | |
301 if (!player_zap(magic_spells[which_spell].s_which, | |
302 magic_spells[which_spell].s_flag)) { | |
303 after = FALSE; | |
304 return; | |
305 } | |
306 } | |
307 spell_power += magic_spells[which_spell].s_cost; | |
308 } | |
309 | |
310 /* | |
311 * the druid asks his deity for a spell | |
312 */ | |
313 | |
314 chant() | |
315 { | |
316 register int num_chants, chant_ability, which_chant; | |
317 | |
318 which_chant = num_chants = chant_ability = 0; | |
319 | |
320 if (player.t_ctype != C_DRUID && player.t_ctype != C_MONK) { | |
321 msg("You are not permitted to chant."); | |
322 return; | |
323 } | |
324 if (cur_misc[WEAR_CLOAK] != NULL && | |
325 cur_misc[WEAR_CLOAK]->o_which == MM_R_POWERLESS) { | |
326 msg("You can't seem to chant!"); | |
327 return; | |
328 } | |
329 chant_ability = pstats.s_lvl * pstats.s_wisdom - 5; | |
330 if (player.t_ctype != C_DRUID) | |
331 chant_ability /= 2; | |
332 | |
333 if (player.t_action != C_CHANT) { | |
334 num_chants = 0; | |
335 | |
336 /* Get the number of avilable chants */ | |
337 if (pstats.s_wisdom > 16) | |
338 num_chants += pstats.s_wisdom - 16; | |
339 | |
340 num_chants += pstats.s_lvl; | |
341 | |
342 if (player.t_ctype != C_DRUID) | |
343 num_chants /= 2; | |
344 | |
345 if (num_chants > MAXCHANTS) | |
346 num_chants = MAXCHANTS; | |
347 | |
348 if (num_chants < 1) { | |
349 msg("You are not permitted to chant yet."); | |
350 return; | |
351 } | |
352 | |
353 /* Prompt for chant */ | |
354 if (pick_spell( druid_spells, | |
355 chant_ability, | |
356 num_chants, | |
357 chant_time, | |
358 "sing", | |
359 "chant")) | |
360 player.t_action = C_CHANT; | |
361 | |
362 return; | |
363 } | |
364 | |
365 /* We've waited our required chanting time. */ | |
366 which_chant = player.t_selection; | |
367 player.t_selection = 0; | |
368 player.t_action = A_NIL; | |
369 | |
370 if (druid_spells[which_chant].s_cost + chant_time > chant_ability) { | |
371 msg("Your chant fails."); | |
372 return; | |
373 } | |
374 | |
375 msg("Your chant has been granted. "); | |
376 | |
377 if (druid_spells[which_chant].s_type == TYP_POTION) | |
378 quaff( druid_spells[which_chant].s_which, | |
379 NULL, | |
380 druid_spells[which_chant].s_flag, | |
381 FALSE); | |
382 else if (druid_spells[which_chant].s_type == TYP_SCROLL) | |
383 read_scroll( druid_spells[which_chant].s_which, | |
384 druid_spells[which_chant].s_flag, | |
385 FALSE); | |
386 else if (druid_spells[which_chant].s_type == TYP_STICK) { | |
387 if (!player_zap(druid_spells[which_chant].s_which, | |
388 druid_spells[which_chant].s_flag)) { | |
389 after = FALSE; | |
390 return; | |
391 } | |
392 } | |
393 chant_time += druid_spells[which_chant].s_cost; | |
394 } | |
395 | |
396 /* Constitution bonus */ | |
397 | |
398 const_bonus() /* Hit point adjustment for changing levels */ | |
399 { | |
400 register int bonus; | |
401 if (pstats.s_const > 9 && pstats.s_const < 18) | |
402 bonus = 0; | |
403 else if (pstats.s_const >= 18 && pstats.s_const < 20) | |
404 bonus = 1; | |
405 else if (pstats.s_const >= 20 && pstats.s_const < 26) | |
406 bonus = 2; | |
407 else if (pstats.s_const >= 26 && pstats.s_const < 36) | |
408 bonus = 3; | |
409 else if (pstats.s_const >= 36) | |
410 bonus = 4; | |
411 else if (pstats.s_const > 7) | |
412 bonus = -1; | |
413 else | |
414 bonus = -2; | |
415 switch(player.t_ctype) { | |
416 case C_FIGHTER: bonus = min(bonus, 11); | |
417 when C_RANGER: bonus = min(bonus, 9); | |
418 when C_PALADIN: bonus = min(bonus, 9); | |
419 when C_MAGICIAN: bonus = min(bonus, 8); | |
420 when C_CLERIC: bonus = min(bonus, 8); | |
421 when C_THIEF: bonus = min(bonus, 10); | |
422 when C_ASSASSIN: bonus = min(bonus, 10); | |
423 when C_DRUID: bonus = min(bonus, 8); | |
424 when C_MONK: bonus = min(bonus, 9); | |
425 otherwise: bonus = min(bonus, 7); | |
426 } | |
427 return(bonus); | |
428 } | |
429 | |
430 /* | |
431 * Give away slime-molds to monsters. If monster is friendly, | |
432 * it will give you a "regular" food ration in return. You have | |
433 * to give a slime-mold to Alteran (a unique monster) in order to | |
434 * get the special "Card of Alteran" quest item. There's no other | |
435 * way to get this artifact and remain alive. | |
436 */ | |
437 | |
438 give(th) | |
439 register struct thing *th; | |
440 { | |
441 /* | |
442 * Find any monster within one space of you | |
443 */ | |
444 struct linked_list *ll; | |
445 struct object *lb; | |
446 register int x,y; | |
447 register struct linked_list *mon = NULL; | |
448 bool gotone = FALSE; | |
449 | |
450 if (levtype != POSTLEV) { /* no monsters at trading post */ | |
451 for (x = hero.x-1; x <= hero.x+1; x++) { | |
452 for (y = hero.y-1; y <= hero.y+1; y++) { | |
453 if (y < 1 || x < 0 || y > lines - 3 || x > cols - 1) | |
454 continue; | |
455 if (isalpha(mvwinch(mw, y, x))) { | |
456 if ((mon = find_mons(y, x)) != NULL) { | |
457 gotone = TRUE; /* found a monster to give away to */ | |
458 th = THINGPTR(mon); | |
459 } | |
460 } | |
461 } | |
462 } | |
463 } | |
464 if (gotone) { | |
465 if ((ll=get_item(pack, "give away", ALL, FALSE, FALSE)) != NULL) { | |
466 lb = OBJPTR(ll); | |
467 mpos = 0; | |
468 switch(lb->o_type) { | |
469 case FOOD: | |
470 switch (lb->o_which) { | |
471 case E_SLIMEMOLD: /* only slime-molds for now */ | |
472 if (on(*th, CANSELL)) { /* quartermaster */ | |
473 msg("%s laughs at you. "); | |
474 return; | |
475 } | |
476 if ((on(*th, ISFRIENDLY) || off(*th, ISMEAN)) && | |
477 off(*th, ISUNIQUE) && off(*th, CANSELL)) { | |
478 turn_on(*th, ISRUN); /* we want him awake */ | |
479 msg("%s accepts and promptly eats your gift of food. --More--", prname(monster_name(th), TRUE)); | |
480 wait_for(' '); | |
481 del_pack(ll); /* delete slime-mold */ | |
482 /* and add a food ration */ | |
483 create_obj(FALSE, FOOD, E_RATION); | |
484 msg("%s gives you food in return and nods off to sleep. ", prname(monster_name(th), TRUE)); | |
485 turn_off(*th, ISRUN); /* put him to sleep */ | |
486 return; | |
487 } | |
488 else if (on(*th, CARRYCARD) && on(*th, ISUNIQUE)) { | |
489 /* Now you get the Card of Alteran */ | |
490 msg("%s gives you a strange rectangular card. --More--", prname(monster_name(th), TRUE)); | |
491 wait_for(' '); | |
492 del_pack(ll); /* get rid of slime-mold */ | |
493 create_obj(FALSE, RELIC, ALTERAN_CARD); | |
494 msg("%s bids you farewell. ", prname(monster_name(th), TRUE)); | |
495 killed(mon, FALSE, FALSE, FALSE); | |
496 return; | |
497 } | |
498 else if (on(*th, ISUNIQUE) && off(*th, ISMEAN)) { | |
499 /* Dragons */ | |
500 msg("%s is set free by your generosity. ", prname(monster_name(th), TRUE)); | |
501 del_pack(ll); /* get rid of it */ | |
502 /* just let him roam around */ | |
503 turn_on(*th, ISRUN); | |
504 if (on(*th, ISFLEE)) turn_off(*th, ISFLEE); | |
505 runto(th, &player); | |
506 th->t_action = A_NIL; | |
507 return; | |
508 } | |
509 else if (on(*th, ISRUN) && off(*th, ISUNIQUE)) { | |
510 /* if NOT sleeping and not a unique */ | |
511 switch (rnd(2)) { | |
512 case 0: msg("%s ignores you. ", prname(monster_name(th), TRUE)); | |
513 when 1: { | |
514 msg("%s nips at your hand. ", prname(monster_name(th), TRUE)); | |
515 if (rnd(100) < 10) { | |
516 del_pack(ll); /* delete it */ | |
517 if (off(*th, ISMEAN)) { | |
518 msg("The slime-mold makes %s sleepy. ", prname(monster_name(th), TRUE)); | |
519 /* put him to sleep */ | |
520 turn_off(*th, ISRUN); | |
521 return; | |
522 } | |
523 else { | |
524 switch (rnd(2)) { | |
525 case 0: msg("%s's eyes roll back. ", prname(monster_name(th), TRUE)); | |
526 when 1: msg("%s becomes wanderlust. ", prname(monster_name(th), TRUE)); | |
527 } | |
528 /* just let him roam around */ | |
529 turn_on(*th, ISRUN); | |
530 if (on(*th, ISFLEE)) | |
531 turn_off(*th, ISFLEE); | |
532 runto(th, &player); | |
533 th->t_action = A_NIL; | |
534 return; | |
535 } | |
536 } | |
537 } | |
538 } | |
539 } | |
540 else { | |
541 msg("%s's mouth waters. ", prname(monster_name(th), TRUE)); | |
542 /* this wakes him up */ | |
543 if (off(*th, ISUNIQUE)) turn_on(*th, ISRUN); | |
544 return; | |
545 } | |
546 otherwise: | |
547 switch (rnd(3)) { /* mention food (hint hint) */ | |
548 case 0: msg("You cannot give away the %s! ", foods[lb->o_which].mi_name); | |
549 when 1: msg("The %s looks rancid! ", foods[lb->o_which].mi_name); | |
550 when 2: msg("You change your mind. "); | |
551 } | |
552 return; | |
553 } | |
554 otherwise: | |
555 switch (rnd(3)) { /* do not mention other items */ | |
556 case 0: msg("You feel foolish. "); | |
557 when 1: msg("You change your mind. "); | |
558 when 2: msg("%s ignores you. ", prname(monster_name(th), TRUE)); | |
559 } | |
560 | |
561 return; | |
562 } | |
563 } | |
564 } | |
565 else msg("Your efforts are futile. "); | |
566 return; | |
567 } | |
568 | |
569 /* | |
570 * Frighten a monster. Useful for the 'good' characters. | |
571 */ | |
572 | |
573 fright(th) | |
574 register struct thing *th; | |
575 { | |
576 /* | |
577 * Find any monster within one space of you | |
578 */ | |
579 register int x,y; | |
580 register struct linked_list *mon; | |
581 bool gotone = FALSE; | |
582 | |
583 if (levtype != POSTLEV) { /* no monsters at trading post */ | |
584 for (x = hero.x-1; x <= hero.x+1; x++) { | |
585 for (y = hero.y-1; y <= hero.y+1; y++) { | |
586 if (y < 1 || x < 0 || y > lines - 3 || x > cols - 1) | |
587 continue; | |
588 if (isalpha(mvwinch(mw, y, x))) { | |
589 if ((mon = find_mons(y, x)) != NULL) { | |
590 gotone = TRUE; /* found a monster to give away to */ | |
591 th = THINGPTR(mon); | |
592 } | |
593 } | |
594 } | |
595 } | |
596 } | |
597 if (gotone) { /* If 'good' character or is wearing a ring of fear */ | |
598 if (player.t_ctype == C_RANGER || player.t_ctype == C_PALADIN || | |
599 player.t_ctype == C_MONK || ISWEARING(R_FEAR) != 0) { | |
600 | |
601 player.t_action = A_NIL; | |
602 player.t_no_move = movement(&player); | |
603 switch (player.t_ctype) { | |
604 case C_FIGHTER: /* loss of strength */ | |
605 pstats.s_str--; | |
606 if (pstats.s_str < 3) pstats.s_str = 3; | |
607 when C_RANGER: /* loss of charisma */ | |
608 case C_PALADIN: | |
609 pstats.s_charisma--; | |
610 if (pstats.s_charisma < 3) pstats.s_charisma = 3; | |
611 when C_CLERIC: /* loss of wisdom */ | |
612 case C_DRUID: | |
613 pstats.s_wisdom--; | |
614 if (pstats.s_wisdom < 3) pstats.s_wisdom = 3; | |
615 when C_MAGICIAN: /* loss of wisdom intelligence */ | |
616 pstats.s_intel--; | |
617 if (pstats.s_intel < 3) pstats.s_intel = 3; | |
618 when C_THIEF: /* loss of dexterity */ | |
619 case C_ASSASSIN: | |
620 pstats.s_dext--; | |
621 if (pstats.s_dext < 3) pstats.s_dext = 3; | |
622 when C_MONK: /* loss of constitution */ | |
623 pstats.s_const--; | |
624 if (pstats.s_const < 3) pstats.s_const = 3; | |
625 otherwise: /* this msg can induce great fear */ | |
626 msg("You miss. "); | |
627 } | |
628 | |
629 /* Cause a panic. Good thru level 16. */ | |
630 if (level < 17) { | |
631 msg("You wave your arms and yell! "); | |
632 do_panic(th->t_index); | |
633 pstats.s_hpt -= (pstats.s_hpt/2)+1; | |
634 if (pstats.s_hpt < 25) msg("You heart quivers... "); | |
635 if (pstats.s_hpt < 1) { | |
636 msg("Your heart stops!! --More--"); | |
637 wait_for(' '); | |
638 pstats.s_hpt = -1; | |
639 death(D_FRIGHT); | |
640 } | |
641 return; | |
642 } | |
643 else { | |
644 /* He can't do it after level 16 */ | |
645 switch (rnd(20)) { | |
646 case 0: case 2: | |
647 msg("You stamp your foot!! "); | |
648 when 4: case 8: | |
649 msg("%s laughs at you! ",prname(monster_name(th),TRUE)); | |
650 when 10: case 12: | |
651 msg("You forget what you are doing? "); | |
652 otherwise: | |
653 msg(nothing); | |
654 } | |
655 return; | |
656 } | |
657 } | |
658 else { | |
659 switch (rnd(25)) { | |
660 case 0: case 2: case 4: | |
661 msg("You motion angrily! "); | |
662 when 6: case 8: case 10: | |
663 msg("You can't frighten anything. "); | |
664 when 12: case 14: case 16: | |
665 msg("Your puff up your face. "); | |
666 otherwise: | |
667 msg(nothing); | |
668 } | |
669 return; | |
670 } | |
671 } | |
672 else { | |
673 msg("There is nothing to fear but fear itself. "); | |
674 return; | |
675 } | |
676 } | |
677 | |
678 /* Routines for thieves */ | |
679 | |
680 /* | |
681 * gsense: Sense gold | |
682 */ | |
683 | |
684 gsense() | |
685 { | |
686 /* Thief & assassin can do this, but fighter & ranger can later */ | |
687 if (player.t_ctype == C_THIEF || player.t_ctype == C_ASSASSIN || | |
688 ((player.t_ctype == C_FIGHTER || player.t_ctype == C_RANGER) && | |
689 pstats.s_lvl >= 12)) { | |
690 read_scroll(S_GFIND, NULL, FALSE); | |
691 } | |
692 else msg("You seem to have no gold sense."); | |
693 return; | |
694 } | |
695 | |
696 /* | |
697 * xsense: Sense traps | |
698 */ | |
699 | |
700 xsense() | |
701 { | |
702 /* Only thief can do this, but assassin, fighter, & monk can later */ | |
703 if (player.t_ctype == C_THIEF || ((player.t_ctype == C_ASSASSIN || | |
704 player.t_ctype == C_FIGHTER || player.t_ctype == C_MONK) && | |
705 pstats.s_lvl >= 14)) { | |
706 read_scroll(S_FINDTRAPS, NULL, FALSE); | |
707 } | |
708 else msg("You seem not to be able to sense traps."); | |
709 return; | |
710 } | |
711 | |
712 /* | |
713 * steal: | |
714 * Steal in direction given in delta | |
715 */ | |
716 | |
717 steal() | |
718 { | |
719 register struct linked_list *item; | |
720 register struct thing *tp; | |
721 register char *mname; | |
722 coord new_pos; | |
723 int thief_bonus = -50; | |
724 bool isinvisible = FALSE; | |
725 | |
726 | |
727 /* let the fighter steal after level 15 */ | |
728 if (player.t_ctype == C_FIGHTER && pstats.s_lvl < 15) { | |
729 msg(nothing); | |
730 return; | |
731 } | |
732 else if (player.t_ctype != C_THIEF && | |
733 player.t_ctype != C_ASSASSIN && | |
734 player.t_ctype != C_FIGHTER) { | |
735 msg("Only thieves and assassins can steal."); | |
736 return; | |
737 } | |
738 if (on(player, ISBLIND)) { | |
739 msg("You can't see anything."); | |
740 return; | |
741 } | |
742 | |
743 new_pos.y = hero.y + player.t_newpos.y; | |
744 new_pos.x = hero.x + player.t_newpos.x; | |
745 | |
746 /* Anything there? */ | |
747 if (new_pos.y < 0 || new_pos.y > lines-3 || | |
748 new_pos.x < 0 || new_pos.x > cols-1 || | |
749 mvwinch(mw, new_pos.y, new_pos.x) == ' ') { | |
750 msg("Nothing to steal from."); | |
751 return; | |
752 } | |
753 | |
754 if ((item = find_mons(new_pos.y, new_pos.x)) == NULL) | |
755 debug("Steal from what @ %d,%d?", new_pos.y, new_pos.x); | |
756 tp = THINGPTR(item); | |
757 if (on(*tp, ISSTONE)) { | |
758 msg ("You can't steal from stone!"); | |
759 return; | |
760 } | |
761 | |
762 if (on(*tp, ISFLEE)) { | |
763 msg("You can't get your hand in anywhere! "); | |
764 return; | |
765 } | |
766 | |
767 isinvisible = invisible(tp); | |
768 if (isinvisible) mname = "creature"; | |
769 else mname = monster_name(tp); | |
770 | |
771 /* Can player steal something unnoticed? */ | |
772 if (player.t_ctype == C_THIEF) thief_bonus = 9; | |
773 if (player.t_ctype == C_ASSASSIN) thief_bonus = 6; | |
774 if (player.t_ctype == C_FIGHTER) thief_bonus = 3; | |
775 if (on(*tp, ISUNIQUE)) thief_bonus -= 15; | |
776 if (isinvisible) thief_bonus -= 20; | |
777 if (on(*tp, ISINWALL) && off(player, CANINWALL)) thief_bonus -= 50; | |
778 | |
779 if (on(*tp, ISHELD) || tp->t_action == A_FREEZE || | |
780 rnd(100) < | |
781 (thief_bonus + 2*dex_compute() + 5*pstats.s_lvl - | |
782 5*(tp->t_stats.s_lvl - 3))) { | |
783 register struct linked_list *s_item, *pack_ptr; | |
784 int count = 0; | |
785 unsigned long test; /* Overflow check */ | |
786 | |
787 s_item = NULL; /* Start stolen goods out as nothing */ | |
788 | |
789 /* Find a good item to take */ | |
790 for (pack_ptr=tp->t_pack; pack_ptr != NULL; pack_ptr=next(pack_ptr)) | |
791 if ((OBJPTR(pack_ptr))->o_type != RELIC && | |
792 pack_ptr != tp->t_using && /* Monster can't be using it */ | |
793 rnd(++count) == 0) | |
794 s_item = pack_ptr; | |
795 | |
796 /* | |
797 * Find anything? | |
798 */ | |
799 if (s_item == NULL) { | |
800 msg("%s apparently has nothing to steal.", prname(mname, TRUE)); | |
801 return; | |
802 } | |
803 | |
804 /* Take it from monster */ | |
805 if (tp->t_pack) detach(tp->t_pack, s_item); | |
806 | |
807 /* Recalculate the monster's encumberance */ | |
808 updpack(TRUE, tp); | |
809 | |
810 /* Give it to player */ | |
811 if (add_pack(s_item, FALSE) == FALSE) { | |
812 (OBJPTR(s_item))->o_pos = hero; | |
813 fall(s_item, TRUE); | |
814 } | |
815 | |
816 /* Get points for stealing -- but first check for overflow */ | |
817 test = pstats.s_exp + tp->t_stats.s_exp/2; | |
818 if (test > pstats.s_exp) pstats.s_exp = test; | |
819 | |
820 /* | |
821 * Do adjustments if player went up a level | |
822 */ | |
823 check_level(); | |
824 } | |
825 | |
826 else { | |
827 msg("Your attempt fails."); | |
828 | |
829 /* Annoy monster (maybe) */ | |
830 if (rnd(40) >= dex_compute() + thief_bonus) { | |
831 /* | |
832 * If this is a charmed creature, there is a chance it | |
833 * will become uncharmed. | |
834 */ | |
835 if (on(*tp, ISCHARMED) && save(VS_MAGIC, tp, 0)) { | |
836 msg("The eyes of %s turn clear.", prname(mname, FALSE)); | |
837 turn_off(*tp, ISCHARMED); | |
838 } | |
839 if (on(*tp, CANSELL)) { | |
840 turn_off(*tp, CANSELL); | |
841 tp->t_action = A_NIL; | |
842 tp->t_movement = 0; | |
843 if (rnd(100) < 50) /* make him steal something */ | |
844 turn_on(*tp, STEALMAGIC); | |
845 else | |
846 turn_on(*tp, STEALGOLD); | |
847 if (!isinvisible) | |
848 msg("%s looks insulted.", prname(mname, TRUE)); | |
849 } | |
850 runto(tp, &hero); | |
851 } | |
852 } | |
853 } | |
854 | |
855 /* | |
856 * Take charmed monsters with you via up or down commands. | |
857 */ | |
858 | |
859 take_with() | |
860 { | |
861 register struct thing *tp; | |
862 register struct linked_list *item; | |
863 struct linked_list *nitem; | |
864 register int t; | |
865 | |
866 t = 0; | |
867 for (item = mlist; item != NULL; item = nitem) { | |
868 nitem = next(item); | |
869 t++; | |
870 if (t > 5) break; | |
871 tp = THINGPTR(item); | |
872 if (on(*tp, ISCHARMED)) { | |
873 monsters[tp->t_index].m_normal = TRUE; | |
874 turn_on(*tp, ISELSEWHERE); | |
875 detach(mlist, item); | |
876 attach(tlist, item); /* remember him next level */ | |
877 check_residue(tp); | |
878 continue; | |
879 } | |
880 } | |
881 } | |
882 | |
883 /* | |
884 * this routine lets the player pick the spell that they | |
885 * want to cast regardless of character class | |
886 */ | |
887 | |
888 pick_spell(spells, ability, num_spells, power, prompt, type) | |
889 struct spells spells[]; /* spell list */ | |
890 int ability; /* spell ability */ | |
891 int num_spells; /* number of spells that can be cast */ | |
892 int power; /* spell power */ | |
893 const char *prompt; /* prompt for spell list */ | |
894 const char *type; /* type of thing--> spell, prayer, chant */ | |
895 { | |
896 bool nohw = FALSE; | |
897 register int i; | |
898 int curlen, | |
899 maxlen = 0, | |
900 dummy = 0, | |
901 which_spell, | |
902 spell_left; | |
903 if (cur_misc[WEAR_CLOAK] != NULL && | |
904 cur_misc[WEAR_CLOAK]->o_which == MM_R_POWERLESS) { | |
905 msg("You can't seem to start a %s!", type); | |
906 return(FALSE); | |
907 } | |
908 | |
909 /* Prompt for spells */ | |
910 msg("Which %s are you %sing? (* for list): ", type, prompt); | |
911 | |
912 which_spell = (int) (wgetch(cw) - 'a'); | |
913 msg(""); /* Get rid of the prompt */ | |
914 if (which_spell == (int) ESC - (int) 'a') { | |
915 after = FALSE; | |
916 return(FALSE); | |
917 } | |
918 if (which_spell >= 0 && which_spell < num_spells) nohw = TRUE; | |
919 | |
920 else if (slow_invent) { | |
921 register char c; | |
922 | |
923 nohw = TRUE; | |
924 do { | |
925 for (i=0; i<num_spells; i++) { | |
926 msg(""); | |
927 mvwaddch(msgw, 0, 0, '['); | |
928 waddch(msgw, (char) ((int) 'a' + i)); | |
929 wprintw(msgw, "] A %s of ", type); | |
930 if (spells[i].s_type == TYP_POTION) | |
931 waddstr(msgw, p_magic[spells[i].s_which].mi_name); | |
932 else if (spells[i].s_type == TYP_SCROLL) | |
933 waddstr(msgw, s_magic[spells[i].s_which].mi_name); | |
934 else if (spells[i].s_type == TYP_STICK) | |
935 waddstr(msgw, ws_magic[spells[i].s_which].mi_name); | |
936 waddstr(msgw, morestr); | |
937 wclrtobot(msgw); | |
938 clearok(msgw, FALSE); | |
939 draw(msgw); | |
940 do { | |
941 c = wgetch(cw); | |
942 } while (c != ' ' && c != ESC); | |
943 if (c == ESC) | |
944 break; | |
945 } | |
946 msg(""); | |
947 wmove(msgw, 0, 0); | |
948 wprintw(msgw, "Which %s are you %sing? ", type, prompt); | |
949 clearok(msgw, FALSE); | |
950 draw(msgw); | |
951 | |
952 which_spell = (int) (wgetch(cw) - 'a'); | |
953 } while (which_spell != (int) (ESC - 'a') && | |
954 (which_spell < 0 || which_spell >= num_spells)); | |
955 | |
956 if (which_spell == (int) (ESC - 'a')) { | |
957 mpos = 0; | |
958 msg(""); | |
959 after = FALSE; | |
960 return(FALSE); | |
961 } | |
962 } | |
963 else { | |
964 /* Now display the possible spells */ | |
965 wclear(hw); | |
966 touchwin(hw); | |
967 wmove(hw, 2, 0); | |
968 wprintw(hw, " Cost %c%s", toupper(*type),type+1); | |
969 mvwaddstr(hw, 3, 0, | |
970 "-----------------------------------------------"); | |
971 maxlen = 47; /* Maximum width of header */ | |
972 | |
973 for (i=0; i<num_spells; i++) { | |
974 sprintf(prbuf, "[%c] %3d A %s of ", | |
975 (char) ((int) 'a' + i), spells[i].s_cost, type); | |
976 if (spells[i].s_type == TYP_POTION) | |
977 strcat(prbuf, p_magic[spells[i].s_which].mi_name); | |
978 else if (spells[i].s_type == TYP_SCROLL) | |
979 strcat(prbuf, s_magic[spells[i].s_which].mi_name); | |
980 else if (spells[i].s_type == TYP_STICK) | |
981 strcat(prbuf, ws_magic[spells[i].s_which].mi_name); | |
982 mvwaddstr(hw, i+4, 0, prbuf); | |
983 | |
984 /* Get the length of the line */ | |
985 getyx(hw, dummy, curlen); | |
986 if (maxlen < curlen) maxlen = curlen; | |
987 } | |
988 | |
989 spell_left = ability - power; | |
990 if (spell_left < 0) { | |
991 spell_left = 0; | |
992 if (spell_left < -20) power = ability + 20; | |
993 } | |
994 sprintf(prbuf, "[Current %s power = %d]", type, spell_left); | |
995 | |
996 mvwaddstr(hw, 0, 0, prbuf); | |
997 wprintw(hw, " Which %s are you %sing? ", type, prompt); | |
998 getyx(hw, dummy, curlen); | |
999 if (maxlen < curlen) maxlen = curlen; | |
1000 | |
1001 /* Should we overlay? */ | |
1002 if (menu_overlay && num_spells + 3 < lines - 3) { | |
1003 over_win(cw, hw, num_spells + 5, maxlen + 3, 0, curlen, NULL); | |
1004 } | |
1005 else draw(hw); | |
1006 } | |
1007 | |
1008 if (!nohw) { | |
1009 which_spell = (int) (wgetch(cw) - 'a'); | |
1010 while (which_spell < 0 || which_spell >= num_spells) { | |
1011 if (which_spell == (int) ESC - (int) 'a') { | |
1012 after = FALSE; | |
1013 | |
1014 /* Restore the screen */ | |
1015 if (num_spells + 3 < lines / 2) { | |
1016 clearok(cw, FALSE); | |
1017 touchwin(cw); | |
1018 } | |
1019 else restscr(cw); | |
1020 return(FALSE); | |
1021 } | |
1022 wmove(hw, 0, 0); | |
1023 wclrtoeol(hw); | |
1024 wprintw(hw, "Please enter one of the listed %ss. ", type); | |
1025 getyx(hw, dummy, curlen); | |
1026 if (maxlen < curlen) maxlen = curlen; | |
1027 | |
1028 /* Should we overlay? */ | |
1029 if (menu_overlay && num_spells + 3 < lines - 3) { | |
1030 over_win(cw, hw, num_spells + 5, maxlen + 3, | |
1031 0, curlen, NULL); | |
1032 } | |
1033 else draw(hw); | |
1034 | |
1035 which_spell = (int) (wgetch(cw) - 'a'); | |
1036 } | |
1037 } | |
1038 | |
1039 /* Now restore the screen if we have to */ | |
1040 if (!nohw) { | |
1041 if (num_spells + 3 < lines / 2) { | |
1042 touchwin(cw); | |
1043 clearok(cw, FALSE); | |
1044 } | |
1045 else { | |
1046 restscr(cw); | |
1047 } | |
1048 } | |
1049 | |
1050 if (spells[which_spell].s_type == TYP_STICK && | |
1051 need_dir(STICK, spells[which_spell].s_which)) { | |
1052 if (!get_dir(&player.t_newpos)) { | |
1053 after = FALSE; | |
1054 return(FALSE); | |
1055 } | |
1056 } | |
1057 player.t_selection = which_spell; | |
1058 player.t_no_move = (which_spell/3 + 1) * movement(&player); | |
1059 | |
1060 spell_left = dummy; /* hack to stop IRIX complaint about dummy */ | |
1061 /* not being used. */ | |
1062 return(TRUE); | |
1063 } | |
1064 | |
1065 /* | |
1066 * opt_player: | |
1067 * Let the player know what's happening with himself | |
1068 */ | |
1069 | |
1070 opt_player() | |
1071 { | |
1072 int i = 1; /* initialize counters */ | |
1073 int j = 2; | |
1074 | |
1075 wclear(hw); | |
1076 wmove(hw, 0, 0); | |
1077 wprintw(hw, "Current player effects:"); | |
1078 wmove(hw, 2, 0); | |
1079 | |
1080 /* Print a list of what is happening. | |
1081 * If longer than 16 lines, make it two columns. | |
1082 * Currently, a maximum of 32 (out of 39) "effects" | |
1083 * can be happening all at once to a player. | |
1084 */ | |
1085 | |
1086 /* 1 - Sense gold */ | |
1087 if (player.t_ctype == C_THIEF || player.t_ctype == C_ASSASSIN || | |
1088 ((player.t_ctype == C_FIGHTER || player.t_ctype == C_RANGER) && | |
1089 pstats.s_lvl >= 12)) { | |
1090 wprintw(hw, "You can sense gold\n"); | |
1091 i++; | |
1092 } | |
1093 /* 2 - Sense traps */ | |
1094 if (player.t_ctype == C_THIEF || ((player.t_ctype == C_ASSASSIN || | |
1095 player.t_ctype == C_FIGHTER || player.t_ctype == C_MONK) && | |
1096 pstats.s_lvl >= 14)) { | |
1097 wprintw(hw, "You can sense traps\n"); | |
1098 i++; | |
1099 } | |
1100 /* 3 - Steal */ | |
1101 if (player.t_ctype == C_THIEF || player.t_ctype == C_ASSASSIN || | |
1102 (player.t_ctype == C_FIGHTER && pstats.s_lvl >= 15)) { | |
1103 wprintw(hw, "You can steal\n"); | |
1104 i++; | |
1105 } | |
1106 /* 4 - Cast spells */ | |
1107 if (player.t_ctype == C_MAGICIAN || | |
1108 (player.t_ctype == C_RANGER && pstats.s_lvl > 1)) { | |
1109 wprintw(hw, "You can cast spells\n"); | |
1110 i++; | |
1111 } | |
1112 /* 5 - Make chants */ | |
1113 if (player.t_ctype == C_DRUID || | |
1114 (player.t_ctype == C_MONK && pstats.s_lvl > 1)) { | |
1115 wprintw(hw, "You can chant\n"); | |
1116 i++; | |
1117 } | |
1118 /* 6 - Give prayers */ | |
1119 if (cur_relic[HEIL_ANKH] != 0 || player.t_ctype == C_CLERIC || | |
1120 (player.t_ctype == C_PALADIN && pstats.s_lvl > 1)) { | |
1121 wprintw(hw, "You can pray\n"); | |
1122 i++; | |
1123 } | |
1124 /* 7 - Affect the undead */ | |
1125 if (cur_relic[HEIL_ANKH] != 0 || player.t_ctype == C_CLERIC || | |
1126 (player.t_ctype == C_PALADIN && pstats.s_lvl > 4)) { | |
1127 wprintw(hw, "You can affect the undead\n"); | |
1128 i++; | |
1129 } | |
1130 /* 8 - Cause fear */ | |
1131 if (ISWEARING(R_FEAR) != 0 || ((player.t_ctype == C_RANGER || | |
1132 player.t_ctype == C_PALADIN || player.t_ctype == C_MONK) && | |
1133 pstats.s_lvl > 1)) { | |
1134 wprintw(hw, "You are fearful\n"); | |
1135 i++; | |
1136 } | |
1137 /* 9 - Confuse monster */ | |
1138 if (on(player, CANHUH) != 0) { | |
1139 wprintw(hw, "You have multi-colored hands\n"); | |
1140 i++; | |
1141 } | |
1142 /* 10 - Confused yourself */ | |
1143 if (on(player, ISHUH) != 0) { | |
1144 wprintw(hw, "You are confused\n"); | |
1145 i++; | |
1146 } /* really ISHUH or ISCLEAR */ | |
1147 /* 11 - Clear thought */ | |
1148 if (on(player, ISCLEAR) != 0) { | |
1149 wprintw(hw, "You are clear headed\n"); | |
1150 i++; | |
1151 } | |
1152 /* 12 - Slow */ | |
1153 if (on(player, ISSLOW) != 0) { | |
1154 wprintw(hw, "You are moving slow\n"); | |
1155 i++; | |
1156 } /* really ISSLOW or ISHASTE */ | |
1157 /* 13 - Haste */ | |
1158 if (on(player, ISHASTE) != 0) { | |
1159 wprintw(hw, "You are moving fast\n"); | |
1160 i++; | |
1161 } | |
1162 /* 14 - Flying */ | |
1163 if (on(player, ISFLY) != 0) { | |
1164 wprintw(hw, "You are flying\n"); | |
1165 i++; | |
1166 } | |
1167 /* 15 - Blind */ | |
1168 if (on(player, ISBLIND) != 0) { | |
1169 wprintw(hw, "You are blind\n"); | |
1170 i++; | |
1171 } /* really ISBLIND or CANSEE */ | |
1172 /* 16 - Extra sight */ | |
1173 if (on(player, CANSEE) != 0) { | |
1174 wprintw(hw, "You have extra sight\n"); | |
1175 i++; | |
1176 } | |
1177 /* 17 - Invisibility */ | |
1178 if (on(player, ISINVIS) != 0) { | |
1179 /* Okay, start a second column of effects to the screen. */ | |
1180 if (i > 16) { | |
1181 mvwaddstr(hw, j, 37, "You are invisible"); | |
1182 j++; | |
1183 } | |
1184 else { | |
1185 wprintw(hw, "You are invisible\n"); | |
1186 i++; | |
1187 } | |
1188 } | |
1189 /* 18 - Regeneration and vampiric regen */ | |
1190 if (ISWEARING(R_VAMPREGEN) != 0 || ISWEARING(R_REGEN) != 0) { | |
1191 if (i > 16) { | |
1192 mvwaddstr(hw, j, 37, "You have regenerative powers"); | |
1193 j++; | |
1194 } | |
1195 else { | |
1196 wprintw(hw, "You have regenerative powers\n"); | |
1197 i++; | |
1198 } | |
1199 } | |
1200 /* 19 - Phasing */ | |
1201 if (on(player, CANINWALL) != 0) { | |
1202 if (i > 16) { | |
1203 mvwaddstr(hw, j, 37, "You can walk through walls"); | |
1204 j++; | |
1205 } | |
1206 else { | |
1207 wprintw(hw, "You can walk through walls\n"); | |
1208 i++; | |
1209 } | |
1210 } | |
1211 /* 20 - Skill (good or bad, it won't last) */ | |
1212 if (find_slot(unskill) != 0) { | |
1213 if (i > 16) { | |
1214 mvwaddstr(hw, j, 37, "You feel skillful"); | |
1215 j++; | |
1216 } | |
1217 else { | |
1218 wprintw(hw, "You feel skillful\n"); | |
1219 i++; | |
1220 } | |
1221 } | |
1222 /* 21 - Stealthy */ | |
1223 if (ISWEARING(R_STEALTH) != 0) { | |
1224 if (i > 16) { | |
1225 mvwaddstr(hw, j, 37, "You have stealth"); | |
1226 j++; | |
1227 } | |
1228 else { | |
1229 wprintw(hw, "You have stealth\n"); | |
1230 i++; | |
1231 } | |
1232 } | |
1233 /* 22 - Alertness */ | |
1234 if (ISWEARING(R_ALERT) != 0) { | |
1235 if (i > 16) { | |
1236 mvwaddstr(hw, j, 37, "You are awake and alert"); | |
1237 j++; | |
1238 } | |
1239 else { | |
1240 wprintw(hw, "You are awake and alert\n"); | |
1241 i++; | |
1242 } | |
1243 } | |
1244 /* 23 - Free action */ | |
1245 if (ISWEARING(R_FREEDOM) != 0) { | |
1246 if (i > 16) { | |
1247 mvwaddstr(hw, j, 37, "You feel free"); | |
1248 j++; | |
1249 } | |
1250 else { | |
1251 wprintw(hw, "You feel free\n"); | |
1252 i++; | |
1253 } | |
1254 } | |
1255 /* 24 - Heroism */ | |
1256 if (ISWEARING(R_HEROISM) != 0) { | |
1257 if (i > 16) { | |
1258 mvwaddstr(hw, j, 37, "You are brave"); | |
1259 j++; | |
1260 } | |
1261 else { | |
1262 wprintw(hw, "You are brave\n"); | |
1263 i++; | |
1264 } | |
1265 } | |
1266 /* 25 - Ice protection */ | |
1267 if (on(player, NOCOLD) != 0) { | |
1268 if (i > 16) { | |
1269 mvwaddstr(hw, j, 37, "You are protected from ice"); | |
1270 j++; | |
1271 } | |
1272 else { | |
1273 wprintw(hw, "You are protected from ice\n"); | |
1274 i++; | |
1275 } | |
1276 } | |
1277 /* 26 - Fire protection */ | |
1278 if (on(player, NOFIRE) != 0) { | |
1279 if (i > 16) { | |
1280 mvwaddstr(hw, j, 37, "You are protected from fire"); | |
1281 j++; | |
1282 } | |
1283 else { | |
1284 wprintw(hw, "You are protected from fire\n"); | |
1285 i++; | |
1286 } | |
1287 } | |
1288 /* 27 - Lightning protection */ | |
1289 if (on(player, NOBOLT) != 0) { | |
1290 if (i > 16) { | |
1291 mvwaddstr(hw, j, 37, "You are protected from lightning"); | |
1292 j++; | |
1293 } | |
1294 else { | |
1295 wprintw(hw, "You are protected from lightning\n"); | |
1296 i++; | |
1297 } | |
1298 } | |
1299 /* 28 - Gas protection */ | |
1300 if (on(player, NOGAS) != 0) { | |
1301 if (i > 16) { | |
1302 mvwaddstr(hw, j, 37, "You are protected from gas"); | |
1303 j++; | |
1304 } | |
1305 else { | |
1306 wprintw(hw, "You are protected from gas\n"); | |
1307 i++; | |
1308 } | |
1309 } | |
1310 /* 29 - Acid protection */ | |
1311 if (on(player, NOACID) != 0) { | |
1312 if (i > 16) { | |
1313 mvwaddstr(hw, j, 37, "You are protected from acid"); | |
1314 j++; | |
1315 } | |
1316 else { | |
1317 wprintw(hw, "You are protected from acid\n"); | |
1318 i++; | |
1319 } | |
1320 } | |
1321 /* 30 - Breath protection */ | |
1322 if (cur_relic[YENDOR_AMULET] != 0) { | |
1323 if (i > 16) { | |
1324 mvwaddstr(hw, j, 37, "You are protected from monster breath"); | |
1325 j++; | |
1326 } | |
1327 else { | |
1328 wprintw(hw, "You are protected from monster breath\n"); | |
1329 i++; | |
1330 } /* really only YENDOR or STONEBONES */ | |
1331 } | |
1332 /* 31 - Magic missile protection */ | |
1333 if (cur_relic[STONEBONES_AMULET] != 0) { | |
1334 if (i > 16) { | |
1335 mvwaddstr(hw, j, 37, "You are protected from magic missiles"); | |
1336 j++; | |
1337 } | |
1338 else { | |
1339 wprintw(hw, "You are protected from magic missiles\n"); | |
1340 i++; | |
1341 } | |
1342 } | |
1343 /* 32 - Sustain health */ | |
1344 if (ISWEARING(R_HEALTH) != 0 && (off(player, HASDISEASE) && | |
1345 off(player, HASINFEST) && off(player, DOROT))) { | |
1346 if (i > 16) { /* he's really healthy */ | |
1347 mvwaddstr(hw, j, 37, "You are in good health"); | |
1348 j++; | |
1349 } | |
1350 else { | |
1351 wprintw(hw, "You are in good health\n"); | |
1352 i++; | |
1353 } | |
1354 } | |
1355 /* 33 - Being held */ | |
1356 if (on(player, ISHELD) != 0) { | |
1357 if (i > 16) { | |
1358 mvwaddstr(hw, j, 37, "You are being held"); | |
1359 j++; | |
1360 } | |
1361 else { | |
1362 wprintw(hw, "You are being held\n"); | |
1363 i++; | |
1364 } | |
1365 } | |
1366 /* 34 - Stinks */ | |
1367 if (on(player, HASSTINK) != 0) { | |
1368 if (i > 16) { | |
1369 mvwaddstr(hw, j, 37, "You are affronted by a bad smell"); | |
1370 j++; | |
1371 } | |
1372 else { | |
1373 wprintw(hw, "You are affronted by a bad smell\n"); | |
1374 i++; | |
1375 } | |
1376 } | |
1377 /* 35 - Any attribute that is down */ | |
1378 if (pstats.s_intel < max_stats.s_intel || | |
1379 pstats.s_str < max_stats.s_str || | |
1380 pstats.s_wisdom < max_stats.s_wisdom || | |
1381 pstats.s_dext < max_stats.s_dext || | |
1382 pstats.s_const < max_stats.s_const || | |
1383 pstats.s_charisma < max_stats.s_charisma) { | |
1384 if (i > 16) { | |
1385 mvwaddstr(hw, j, 37, "You are afflicted"); | |
1386 j++; | |
1387 } | |
1388 else { | |
1389 wprintw(hw, "You are afflicted\n"); | |
1390 i++; | |
1391 } | |
1392 } | |
1393 /* 36 - Diseased */ | |
1394 if (on(player, HASDISEASE) != 0) { | |
1395 if (i > 16) { | |
1396 mvwaddstr(hw, j, 37, "You have a disease"); | |
1397 j++; | |
1398 } | |
1399 else { | |
1400 wprintw(hw, "You have a disease\n"); | |
1401 i++; | |
1402 } | |
1403 } | |
1404 /* 37 - Infested */ | |
1405 if (on(player, HASINFEST) != 0) { | |
1406 if (i > 16) { | |
1407 mvwaddstr(hw, j, 37, "You have an infestation"); | |
1408 j++; | |
1409 } | |
1410 else { | |
1411 wprintw(hw, "You have an infestation\n"); | |
1412 i++; | |
1413 } | |
1414 } | |
1415 /* 38 - Body rot */ | |
1416 if (on(player, DOROT) != 0) { | |
1417 if (i > 16) { | |
1418 mvwaddstr(hw, j, 37, "You have body rot"); | |
1419 j++; | |
1420 } | |
1421 else { | |
1422 wprintw(hw, "You have body rot\n"); | |
1423 i++; | |
1424 } | |
1425 } | |
1426 /* 39 - Dancing */ | |
1427 if (on(player, ISDANCE) != 0) { | |
1428 if (i > 16) { | |
1429 mvwaddstr(hw, j, 37, "You are a dancing fool"); | |
1430 j++; | |
1431 } | |
1432 else { | |
1433 wprintw(hw, "You are a dancing fool\n"); | |
1434 i++; | |
1435 } | |
1436 } | |
1437 if (i == 1) { | |
1438 wclear(hw); | |
1439 msg("No player effects. "); | |
1440 return; | |
1441 } | |
1442 else { | |
1443 if (i > 1 && i < 17) { | |
1444 j = 39; | |
1445 if (menu_overlay) { /* Print the list. */ | |
1446 wmove(hw, i+2, 0); | |
1447 wprintw(hw, spacemsg); | |
1448 over_win(cw, hw, i+3, j, i+2, 27, NULL); | |
1449 } | |
1450 else { | |
1451 wmove(hw, i+2, 0); | |
1452 wprintw(hw, spacemsg); | |
1453 draw(hw); | |
1454 } | |
1455 } | |
1456 else { | |
1457 i = 17; | |
1458 if (menu_overlay) { /* Print the list. */ | |
1459 wmove(hw, i+2, 0); | |
1460 wprintw(hw, spacemsg); | |
1461 if (j > 2) j = 78; | |
1462 else j = 39; | |
1463 over_win(cw, hw, i+3, j, i+2, 27, NULL); | |
1464 } | |
1465 else { | |
1466 wmove(hw, i+2, 0); | |
1467 wprintw(hw, spacemsg); | |
1468 draw(hw); | |
1469 } | |
1470 } | |
1471 wait_for(' '); | |
1472 wclear(hw); | |
1473 status(FALSE); | |
1474 touchwin(cw); | |
1475 return; | |
1476 } | |
1477 } | |
1478 |