1 /* omega copyright (C) by Laurence Raphael Brothers, 1987,1988,1989 */
2 /* effect1.c */
3
4 #include "glob.h"
5
6
7 /* enchant */
enchant(delta)8 void enchant(delta)
9 int delta;
10 {
11 int i,used = FALSE;
12 long change_cash;
13
14 if (delta < 0) {
15 i = random_item();
16 if (i == ABORT || Player.possessions[i]->usef == I_NOTHING ||
17 Player.possessions[i]->usef == I_NO_OP ||
18 Player.possessions[i]->usef == I_NORMAL_ARMOR ||
19 Player.possessions[i]->usef == I_NORMAL_WEAPON ||
20 Player.possessions[i]->usef == I_NORMAL_SHIELD ||
21 Player.possessions[i]->objchar == FOOD ||
22 Player.possessions[i]->objchar == MISSILEWEAPON) {
23 print1("You feel fortunate.");
24 morewait();
25 }
26 else if (Player.possessions[i]->blessing < 0 ||
27 (Player.possessions[i]->objchar == ARTIFACT && random_range(3))) {
28 if (Player.possessions[i]->uniqueness == COMMON)
29 print1("Your ");
30 nprint1(itemid(Player.possessions[i]));
31 nprint1(" glows, but the glow flickers out...");
32 morewait();
33 }
34 else {
35 used = (Player.possessions[i]->used);
36 if (used) {
37 Player.possessions[i]->used = FALSE;
38 item_use(Player.possessions[i]);
39 }
40 if (Player.possessions[i]->uniqueness == COMMON)
41 print1("Your ");
42 nprint1(itemid(Player.possessions[i]));
43 nprint1(" radiates an aura of mundanity!");
44 morewait();
45 Player.possessions[i]->plus = 0;
46 Player.possessions[i]->charge = -1;
47 Player.possessions[i]->usef = I_NOTHING;
48 if (used) {
49 Player.possessions[i]->used = TRUE;
50 item_use(Player.possessions[i]);
51 }
52 }
53 }
54 else {
55 i = getitem(CASH);
56 if (i == ABORT) {
57 print1("You feel unlucky.");
58 morewait();
59 }
60 else if (i == CASHVALUE) {
61 print1("You enchant your money.... What a concept!");
62 change_cash = Player.cash*(random_range(7) - 3)/6;
63 if (change_cash > 0) print2("Seems to have been a good idea!");
64 else print2("Maybe it wasn't such a good idea....");
65 Player.cash += change_cash;
66 morewait();
67 }
68 else if (Player.possessions[i]->objchar == ARTIFACT) {
69 if (Player.possessions[i]->usef !=
70 Objects[Player.possessions[i]->id].usef) {
71 print1("It re-acquires its magical aura!");
72 Player.possessions[i]->usef = Objects[Player.possessions[i]->id].usef;
73 }
74 else {
75 print1("The enchantment spell enfolds the ");
76 nprint1(itemid(Player.possessions[i]));
77 print2("and the potent enchantment of the Artifact causes a backlash!");
78 morewait();
79 clearmsg();
80 manastorm(Player.x,Player.y,Player.possessions[i]->level*5);
81 }
82 }
83 else {
84 if (Player.possessions[i]->plus > random_range(20)+1) {
85 print1("Uh-oh, the force of the enchantment was too much!");
86 print2("There is a loud explosion!");
87 morewait();
88 manastorm(Player.x,Player.y,Player.possessions[i]->plus*5);
89 dispose_lost_objects(1,Player.possessions[i]);
90 }
91 else {
92 used = (Player.possessions[i]->used);
93 if (used) {
94 setgamestatus(SUPPRESS_PRINTING);
95 Player.possessions[i]->used = FALSE;
96 item_use(Player.possessions[i]);
97 resetgamestatus(SUPPRESS_PRINTING);
98 }
99 print1("The item shines!");
100 morewait();
101 Player.possessions[i]->plus += delta+1;
102 if (Player.possessions[i]->charge > -1)
103 Player.possessions[i]->charge +=
104 ((delta+1) * (random_range(10) + 1));
105 if (used) {
106 setgamestatus(SUPPRESS_PRINTING);
107 Player.possessions[i]->used = TRUE;
108 item_use(Player.possessions[i]);
109 resetgamestatus(SUPPRESS_PRINTING);
110 }
111 }
112 }
113 calc_melee();
114 }
115 }
116
117 /* bless */
bless(blessing)118 void bless(blessing)
119 int blessing;
120 {
121 int index,used;
122
123 if (blessing < 0) {
124 index = random_item();
125 if (index == ABORT) {
126 print1("You feel fortunate.");
127 morewait();
128 }
129 else {
130 print1("A foul odor arises from ");
131 if (Player.possessions[index]->uniqueness == COMMON)
132 nprint1("your ");
133 nprint1(itemid(Player.possessions[index]));
134 morewait();
135 used = (Player.possessions[index]->used);
136 if (used) {
137 setgamestatus(SUPPRESS_PRINTING);
138 Player.possessions[index]->used = FALSE;
139 item_use(Player.possessions[index]);
140 resetgamestatus(SUPPRESS_PRINTING);
141 }
142 Player.possessions[index]->blessing -= 2;
143 if (Player.possessions[index]->blessing < 0)
144 Player.possessions[index]->plus =
145 abs(Player.possessions[index]->plus) - 1;
146 if (used) {
147 setgamestatus(SUPPRESS_PRINTING);
148 Player.possessions[index]->used = TRUE;
149 item_use(Player.possessions[index]);
150 resetgamestatus(SUPPRESS_PRINTING);
151 }
152 }
153 }
154 else {
155 index = getitem(NULL_ITEM);
156 if (index == CASHVALUE) {
157 print1("Blessing your money has no effect.");
158 morewait();
159 }
160 else if (index != ABORT) {
161 used = (Player.possessions[index]->used == TRUE);
162 if (used) {
163 setgamestatus(SUPPRESS_PRINTING);
164 Player.possessions[index]->used = FALSE;
165 item_use(Player.possessions[index]);
166 resetgamestatus(SUPPRESS_PRINTING);
167 }
168 print1("A pure white light surrounds the item... ");
169 if (Player.possessions[index]->blessing < 0-(blessing+1)) {
170 print2("which is evil enough to resist the effect of the blessing!");
171 morewait();
172 }
173 else if (Player.possessions[index]->blessing < -1) {
174 print2("which disintegrates under the influence of the holy aura!");
175 morewait();
176 Player.itemweight -= Player.possessions[index]->weight;
177 dispose_lost_objects(1,Player.possessions[index]);
178 }
179 else if (Player.possessions[index]->blessing < blessing+1) {
180 print2("which now seems affected by afflatus!");
181 morewait();
182 Player.possessions[index]->blessing++;
183 Player.possessions[index]->plus =
184 abs(Player.possessions[index]->plus)+1;
185 }
186 else {
187 print2("The hierolux fades without any appreciable effect....");
188 morewait();
189 }
190 if (used && (Player.possessions[index] != NULL)) {
191 setgamestatus(SUPPRESS_PRINTING);
192 Player.possessions[index]->used = TRUE;
193 item_use(Player.possessions[index]);
194 resetgamestatus(SUPPRESS_PRINTING);
195 }
196 }
197 }
198 calc_melee();
199 }
200
201
202
heal(amount)203 void heal(amount)
204 int amount;
205 {
206 if (amount > -1) {
207 mprint("You feel better.");
208 if (Player.hp < Player.maxhp + amount)
209 {
210 Player.hp += random_range(10*amount)+1;
211 if (Player.hp > Player.maxhp)
212 Player.hp = Player.maxhp + amount;
213 }
214 Player.status[BLINDED] = 0;
215 }
216 else {
217 mprint("You feel unwell.");
218 Player.hp -= random_range(10*abs(amount)+1);
219 if (Player.hp < 0)
220 p_death("magical disruption");
221 }
222 dataprint();
223 }
224
225
fbolt(fx,fy,tx,ty,hit,dmg)226 void fbolt(fx,fy,tx,ty,hit,dmg)
227 int fx,fy,tx,ty,hit,dmg;
228 {
229 bolt(fx,fy,tx,ty,hit,dmg,FLAME);
230 }
231
lbolt(fx,fy,tx,ty,hit,dmg)232 void lbolt(fx,fy,tx,ty,hit,dmg)
233 int fx,fy,tx,ty,hit,dmg;
234 {
235 bolt(fx,fy,tx,ty,hit,dmg,ELECTRICITY);
236 }
237
238 /* Added 12/30/98 DG */
icebolt(fx,fy,tx,ty,hit,dmg)239 void icebolt(fx,fy,tx,ty,hit,dmg)
240 int fx,fy,tx,ty,hit,dmg;
241 {
242 bolt(fx,fy,tx,ty,hit,dmg,COLD);
243 }
244
nbolt(fx,fy,tx,ty,hit,dmg)245 void nbolt(fx,fy,tx,ty,hit,dmg)
246 int fx,fy,tx,ty,hit,dmg;
247 {
248 bolt(fx,fy,tx,ty,hit,dmg,NORMAL_DAMAGE);
249 }
250
251
252 /* from f to t */
bolt(fx,fy,tx,ty,hit,dmg,dtype)253 void bolt(fx,fy,tx,ty,hit,dmg,dtype)
254 int fx,fy,tx,ty,hit,dmg,dtype;
255 {
256 int xx,yy;
257 struct monster *target;
258 Symbol boltchar;
259 xx = fx; yy = fy;
260
261 switch(dtype) {
262 case FLAME:boltchar=('*' | CLR(LIGHT_RED));break;
263 case ELECTRICITY:boltchar = ('^' | CLR(LIGHT_BLUE));break;
264 case NORMAL_DAMAGE:boltchar = ('!' | CLR(BROWN));break;
265 case COLD:boltchar=('o' | CLR(WHITE));break;
266 default:assert(FALSE); /* this should never happen, right? WDT */
267 }
268 clearmsg();
269
270 do_los(boltchar,&xx,&yy,tx,ty);
271
272 if ((xx == Player.x) && (yy == Player.y)) {
273 if (Player.status[DEFLECTION] > 0)
274 mprint("The bolt just missed you!");
275 else {
276 switch (dtype) {
277 case FLAME:
278 mprint("You were blasted by a firebolt!");
279 p_damage(random_range(dmg),dtype,"a firebolt");
280 break;
281 case ELECTRICITY:
282 mprint("You were zapped by lightning!");
283 p_damage(random_range(dmg),dtype,"a bolt of lightning");
284 break;
285 case NORMAL_DAMAGE:
286 mprint("You were hit by a missile!");
287 p_damage(random_range(dmg),dtype,"a missile");
288 break;
289 case COLD:
290 mprint("You were hit by an icicle!");
291 p_damage(random_range(dmg),dtype,"an icicle");
292 break;
293 }
294 }
295 }
296 else if (NULL != (target = Level->site[xx][yy].creature)) {
297 if (hitp(hit,target->ac)) {
298 if (target->uniqueness == COMMON) {
299 strcpy(Str1,"The ");
300 strcat(Str1,target->monstring);
301 }
302 else strcpy(Str1,target->monstring);
303 switch (dtype) {
304 /* WDT: these sentances really ought to be livened up. Especially
305 * in full verbose mode. */
306 case FLAME:strcat(Str1," was blasted by a firebolt!");break;
307 case ELECTRICITY:strcat(Str1," was zapped by lightning!");break;
308 case NORMAL_DAMAGE:strcat(Str1," was hit by a missile!"); break;
309 case COLD:strcat(Str1," was hit by an icicle!"); break;
310 }
311 mprint(Str1);
312 m_status_set(target,HOSTILE);
313 m_damage(target,random_range(dmg),dtype);
314 }
315 else {
316 if (target->uniqueness == COMMON) {
317 strcpy(Str1,"The ");
318 strcat(Str1,target->monstring);
319 }
320 else strcpy(Str1,target->monstring);
321 switch (dtype) {
322 case FLAME:strcat(Str1," was missed by a firebolt!");break;
323 case ELECTRICITY:strcat(Str1," was missed by lightning!");break;
324 case NORMAL_DAMAGE:strcat(Str1," was missed by a missile!"); break;
325 case COLD:strcat(Str1," was missed by a flying icicle!"); break;
326 }
327 mprint(Str1);
328 }
329 }
330 else if (Level->site[xx][yy].locchar == HEDGE)
331 if (Level->site[xx][yy].p_locf != L_TRIFID) {
332 if ((dtype == FLAME)||(dtype == ELECTRICITY)) {
333 mprint("The hedge is blasted away!");
334 Level->site[xx][yy].p_locf = L_NO_OP;
335 Level->site[xx][yy].locchar = FLOOR;
336 plotspot(xx, yy, TRUE);
337 lset(xx, yy, CHANGED);
338 }
339 else mprint("The hedge is unaffected.");
340 }
341 else mprint("The trifid absorbs the energy and laughs!");
342 else if (Level->site[xx][yy].locchar == WATER)
343 if (dtype == FLAME) {
344 mprint("The water is vaporised!");
345 Level->site[xx][yy].p_locf = L_NO_OP;
346 Level->site[xx][yy].locchar = FLOOR;
347 lset(xx, yy, CHANGED);
348 }
349 }
350
351
lball(fx,fy,tx,ty,dmg)352 void lball(fx,fy,tx,ty,dmg)
353 int fx,fy,tx,ty,dmg;
354 {
355 ball(fx,fy,tx,ty,dmg,ELECTRICITY);
356 }
357
manastorm(x,y,dmg)358 void manastorm(x,y,dmg)
359 int x,y,dmg;
360 {
361 ball(x,y,x,y,dmg,UNSTOPPABLE);
362 }
363
snowball(fx,fy,tx,ty,dmg)364 void snowball(fx,fy,tx,ty,dmg)
365 int fx,fy,tx,ty,dmg;
366 {
367 ball(fx,fy,tx,ty,dmg,COLD);
368 }
369
fball(fx,fy,tx,ty,dmg)370 void fball(fx,fy,tx,ty,dmg)
371 int fx,fy,tx,ty,dmg;
372 {
373 ball(fx,fy,tx,ty,dmg,FLAME);
374 }
375
376
377 /* from f to t */
ball(fx,fy,tx,ty,dmg,dtype)378 void ball(fx,fy,tx,ty,dmg,dtype)
379 int fx,fy,tx,ty,dmg,dtype;
380 {
381 int xx,yy,ex,ey,i;
382 struct monster *target;
383 Symbol expchar=('@' | CLR(LIGHT_PURPLE));
384
385 xx = fx; yy = fy;
386
387 switch(dtype){
388 case FLAME:expchar=('*' | CLR(LIGHT_RED));break;
389 case COLD:expchar=('o' | CLR(WHITE));break;
390 case ELECTRICITY:expchar=('^' | CLR(LIGHT_BLUE));break;
391 }
392
393 do_los(expchar,&xx,&yy,tx,ty);
394 draw_explosion(expchar,xx,yy);
395 for(i=0;i<9;i++) {
396 ex = xx + Dirs[0][i];
397 ey = yy + Dirs[1][i];
398
399 if ((ex == Player.x) && (ey == Player.y)) {
400 switch(dtype) {
401 case FLAME:mprint("You were blasted by a fireball!");
402 p_damage(random_range(dmg),FLAME,"a fireball");
403 break;
404 case COLD:mprint("You were blasted by a snowball!");
405 p_damage(random_range(dmg),COLD,"a snowball");
406 break;
407 case ELECTRICITY:mprint("You were blasted by ball lightning!");
408 p_damage(random_range(dmg),ELECTRICITY,"ball lightning");
409 break;
410 case UNSTOPPABLE:mprint("Oh No! Manastorm!");
411 p_damage(random_range(dmg),UNSTOPPABLE,"a manastorm!");
412 break;
413 }
414 }
415 if (NULL != (target = Level->site[ex][ey].creature)) {
416 if (los_p(Player.x,Player.y,target->x,target->y)) {
417 if (target->uniqueness == COMMON) {
418 strcpy(Str1,"The ");
419 strcat(Str1,target->monstring);
420 }
421 else strcpy(Str1,target->monstring);
422 switch(dtype) {
423 case FLAME:strcat(Str1," was zorched by a fireball!"); break;
424 case COLD:strcat(Str1," was blasted by a snowball!"); break;
425 case ELECTRICITY:strcat(Str1," was zapped by ball lightning!");break;
426 case UNSTOPPABLE:strcat(Str1," was nuked by a manastorm!");break;
427 }
428 mprint(Str1);
429 }
430 m_status_set(target,HOSTILE);
431 m_damage(target,random_range(dmg),dtype);
432 }
433 if (Level->site[ex][ey].locchar == HEDGE)
434 if (Level->site[ex][ey].p_locf != L_TRIFID) {
435 if ((dtype == FLAME)||(dtype == ELECTRICITY)) {
436 mprint("The hedge is blasted away!");
437 Level->site[ex][ey].p_locf = L_NO_OP;
438 Level->site[ex][ey].locchar = FLOOR;
439 plotspot(ex,ey,TRUE);
440 lset(ex, ey, CHANGED);
441 }
442 else mprint("The hedge is unaffected.");
443 }
444 else mprint("The trifid absorbs the energy and laughs!");
445 else if (Level->site[ex][ey].locchar == WATER)
446 if (dtype == FLAME) {
447 mprint("The water is vaporised!");
448 Level->site[ex][ey].p_locf = L_NO_OP;
449 Level->site[ex][ey].locchar = FLOOR;
450 plotspot(ex,ey,TRUE);
451 lset(ex, ey, CHANGED);
452 }
453 }
454 }
455
456
457
458
mondet(blessing)459 void mondet(blessing)
460 int blessing;
461 {
462 pml ml;
463 for (ml=Level->mlist;ml!=NULL;ml=ml->next)
464 if (ml->m->hp > 0) /* FIXED 12/30/98 DG */
465 if (blessing > -1)
466 plotmon(ml->m);
467 else
468 putspot(random_range(WIDTH), random_range(LENGTH),
469 Monsters[random_range(NUMMONSTERS)].monchar);
470 levelrefresh();
471 morewait();
472 show_screen();
473 }
474
475
objdet(blessing)476 void objdet(blessing)
477 int blessing;
478 {
479 int i,j;
480 for (i=0;i<WIDTH;i++)
481 for (j=0;j<LENGTH;j++)
482 if (Level->site[i][j].things != NULL) {
483 if (blessing < 0)
484 putspot(random_range(WIDTH),
485 random_range(LENGTH),
486 Level->site[i][j].things->thing->objchar);
487 else putspot(i,j,Level->site[i][j].things->thing->objchar);
488 }
489 levelrefresh();
490 morewait();
491 show_screen();
492 }
493
identify(blessing)494 void identify(blessing)
495 int blessing;
496 {
497 int index;
498
499 clearmsg();
500
501 if (blessing == 0) {
502 print1("Identify:");
503 index = getitem(NULL_ITEM);
504 if (index == CASHVALUE) print3("Your money is really money.");
505 else if (index == ABORT)
506 setgamestatus(SKIP_MONSTERS);
507 else {
508 if (Player.possessions[index]->objchar == FOOD)
509 Player.possessions[index]->known = 1;
510 else {
511 Player.possessions[index]->known = 2;
512 Objects[Player.possessions[index]->id].known = 1;
513 }
514 print1("Identified: ");
515 mprint(itemid(Player.possessions[index]));
516 }
517 }
518 else if (blessing < 0) {
519 print2("You feel forgetful.");
520 for (index=0;index<MAXITEMS;index++)
521 if (Player.possessions[index] != NULL) {
522 Player.possessions[index]->known = 0;
523 Objects[Player.possessions[index]->id].known = 0;
524 }
525 }
526 else {
527 print2("You feel encyclopaedic.");
528 for (index=0;index<MAXITEMS;index++)
529 if (Player.possessions[index] != NULL) {
530 if (Player.possessions[index]->objchar == FOOD)
531 Player.possessions[index]->known = 1;
532 else {
533 Player.possessions[index]->known = 2;
534 Objects[Player.possessions[index]->id].known = 1;
535 }
536 }
537 for (index=0;index<Player.packptr;index++)
538 if (Player.pack[index] != NULL) {
539 if (Player.pack[index]->objchar == FOOD)
540 Player.pack[index]->known = 1;
541 else {
542 Player.pack[index]->known = 2;
543 Objects[Player.pack[index]->id].known = 1;
544 }
545 }
546 }
547 calc_melee();
548 }
549
550
551
552
553 /* returns index of random item, ABORT if player carrying none */
random_item()554 int random_item()
555 {
556 int item = ABORT,tries=0;
557 int number = 0;
558
559 for(tries=0; tries<MAXITEMS; tries++)
560 if (Player.possessions[tries] != NULL) {
561 number++;
562 if (random_range(number) == 0)
563 item = tries;
564 }
565 return(item);
566 }
567
568
569 /* various kinds of wishes */
wish(blessing)570 void wish(blessing)
571 int blessing;
572 {
573 int i;
574 char wishstr[80];
575 clearmsg();
576 print1("What do you wish for? ");
577 if (blessing < 0)
578 deathprint();
579 else
580 strcpy(wishstr,msgscanstring());
581 if (blessing < 0 || strcmp(wishstr,"Death")==0) {
582 print2("As you wish, so shall it be.");
583 p_death("a deathwish");
584 }
585 if (strcmp(wishstr,"Power")==0) {
586 print2("You feel a sudden surge of energy");
587 Player.mana=calcmana()*10;
588 }
589 else if (strcmp(wishstr,"Skill")==0) {
590 print2("You feel more competent.");
591 if (gamestatusp(CHEATED))
592 gain_experience(10000);
593 else
594 gain_experience(min(10000,Player.xp));
595 }
596 else if (strcmp(wishstr,"Wealth")==0) {
597 print2("You are submerged in shower of gold pieces!");
598 Player.cash += 10000;
599 }
600 else if (strcmp(wishstr,"Balance")==0) {
601 print2("You feel neutral.");
602 Player.alignment = 0;
603 }
604 else if (strcmp(wishstr,"Chaos")==0) {
605 print2("You feel chaotic.");
606 Player.alignment -= 25;
607 }
608 else if (strcmp(wishstr,"Law")==0) {
609 print2("You feel lawful.");
610 Player.alignment += 25;
611 }
612 else if (strcmp(wishstr,"Location")==0)
613 strategic_teleport(1);
614 else if (strcmp(wishstr,"Knowledge")==0) {
615 print2("You feel more knowledgeable.");
616 i = random_range(NUMSPELLS);
617 if (Spells[i].known)
618 Spells[i].powerdrain =
619 (max(1,Spells[i].powerdrain/2));
620 else Spells[i].known = TRUE;
621 }
622 else if (strcmp(wishstr,"Health")==0) {
623 print2("You feel vigorous");
624 Player.hp = max( Player.hp, Player.maxhp);
625 Player.status[DISEASED] = 0;
626 Player.status[POISONED] = 0;
627 }
628 else if (strcmp(wishstr,"Destruction")==0)
629 annihilate(gamestatusp(CHEATED));
630 else if (strcmp(wishstr,"Acquisition")==0)
631 acquire(gamestatusp(CHEATED));
632 else if (strcmp(wishstr,"Summoning")==0)
633 summon(gamestatusp(CHEATED),-1);
634 else if (strcmp(wishstr,"Stats") == 0 && gamestatusp(CHEATED))
635 {
636 Player.str = Player.maxstr = Player.con = Player.maxcon =
637 Player.agi = Player.maxagi = Player.dex = Player.maxdex =
638 Player.iq = Player.maxiq = Player.pow = Player.maxpow = 200;
639 calc_melee();
640 }
641 else print2("You feel stupid.");
642 dataprint();
643 showflags();
644 }
645
646 /* gain for an item */
acquire(blessing)647 void acquire(blessing)
648 int blessing;
649 {
650 char otype;
651 int index,id = ABORT;
652 pob newthing;
653
654 if (blessing < 0) {
655 index = random_item();
656 if (index == ABORT)
657 mprint("You feel fortunate.");
658 else {
659 print1("Smoke drifts out of your pack.... ");
660 print2("Destroyed: ");
661 nprint2(itemid(Player.possessions[index]));
662 morewait();
663 dispose_lost_objects(1,Player.possessions[index]);
664 }
665 }
666 else {
667 newthing = ((pob) checkmalloc(sizeof(objtype)));
668 newthing->id = -1;
669 if (gamestatusp(CHEATED))
670 print1("Acquire which kind of item: !?][}{)/=%%\\& ");
671 else
672 print1("Acquire which kind of item: !?][}{)/=%%\\ ");
673 otype = mgetc();
674 switch (otype) {
675 case (POTION&0xff):
676 if (blessing > 0)
677 id = itemlist(POTIONID,NUMPOTIONS);
678 else
679 id = random_range(NUMPOTIONS);
680 if (id < 0) print2("You feel stupid.");
681 else make_potion(newthing,id);
682 break;
683 case (SCROLL&0xff):
684 if (blessing > 0)
685 id = itemlist(SCROLLID,NUMSCROLLS);
686 else
687 id = random_range(NUMSCROLLS);
688 if (id < 0) print2("You feel stupid.");
689 else make_scroll(newthing,id);
690 break;
691 case (RING&0xff):
692 if (blessing > 0)
693 id = itemlist(RINGID,NUMRINGS);
694 else
695 id = random_range(NUMRINGS);
696 if (id < 0) print2("You feel stupid.");
697 else make_ring(newthing,id);
698 break;
699 case (STICK&0xff):
700 if (blessing > 0)
701 id = itemlist(STICKID,NUMSTICKS);
702 else
703 id = random_range(NUMSTICKS);
704 if (id < 0) print2("You feel stupid.");
705 else make_stick(newthing,id);
706 break;
707 case (ARMOR&0xff):
708 if (blessing > 0)
709 id = itemlist(ARMORID,NUMARMOR);
710 else
711 id = random_range(NUMARMOR);
712 if (id < 0) print2("You feel stupid.");
713 else make_armor(newthing,id);
714 break;
715 case (SHIELD&0xff):
716 if (blessing > 0)
717 id = itemlist(SHIELDID,NUMSHIELDS);
718 else
719 id = random_range(NUMSHIELDS);
720 if (id < 0) print2("You feel stupid.");
721 else make_shield(newthing,id);
722 break;
723 case (WEAPON&0xff):
724 if (blessing > 0)
725 id = itemlist(WEAPONID,NUMWEAPONS);
726 else
727 id = random_range(NUMWEAPONS);
728 if (id < 0) print2("You feel stupid.");
729 else make_weapon(newthing,id);
730 break;
731 case (BOOTS&0xff):
732 if (blessing > 0)
733 id = itemlist(BOOTID,NUMBOOTS);
734 else
735 id = random_range(NUMBOOTS);
736 if (id < 0) print2("You feel stupid.");
737 else make_boots(newthing,id);
738 break;
739 case (CLOAK&0xff):
740 if (blessing > 0)
741 id = itemlist(CLOAKID,NUMCLOAKS);
742 else
743 id = random_range(NUMCLOAKS);
744 if (id < 0) print2("You feel stupid.");
745 else make_cloak(newthing,id);
746 break;
747 case (FOOD&0xff):
748 if (blessing > 0)
749 id = itemlist(FOODID,NUMFOODS);
750 else
751 id = random_range(NUMFOODS);
752 if (id < 0) print2("You feel stupid.");
753 else make_food(newthing,id);
754 break;
755 case (THING&0xff):
756 if (blessing > 0)
757 id = itemlist(THINGID,NUMTHINGS);
758 else
759 id = random_range(NUMTHINGS);
760 if (id < 0) print2("You feel stupid.");
761 else make_thing(newthing,id);
762 break;
763 case (ARTIFACT&0xff):
764 if (gamestatusp(CHEATED))
765 id = itemlist(ARTIFACTID,NUMARTIFACTS);
766 else
767 id = -1;
768 if (id < 0) print2("You feel stupid.");
769 else make_artifact(newthing,id);
770 break;
771 default:
772 print2("You feel stupid.");
773 }
774 xredraw();
775 if (id != ABORT) {
776 if (blessing > 0) {
777 newthing->known = 2;
778 Objects[id].known = 1;
779 }
780 newthing->used = FALSE;
781 gain_item(newthing);
782 }
783 }
784 }
785