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