1 /* omega copyright (C) 1987,1988,1989 by Laurence Raphael Brothers */
2 /* itemf3.c */
3
4 /* mostly artifact and stick functions */
5
6 #include "glob.h"
7
8 /* amulet of the planes */
i_planes(o)9 void i_planes(o)
10 pob o;
11 {
12 if (Player.mana < 1) print1("The amulet spits some multicolored sparks.");
13 else {
14 print1("You focus mana into the amulet....");
15 Player.mana = max(0,Player.mana-100);
16 dataprint();
17 morewait();
18 strategic_teleport(1);
19 }
20 }
21
22
23 /* the sceptre of high magic */
i_sceptre(o)24 void i_sceptre(o)
25 pob o;
26 {
27 if (HiMagicUse == Date)
28 print1("The Sceptre makes a sort of dull 'thut' noise.");
29 else if (Current_Environment == E_CIRCLE || Current_Environment == E_ASTRAL)
30 {
31 HiMagicUse = Date; /* WDT: this looks like it's a good place to use
32 * the batteries. */
33 print1("The Sceptre warps strangely for a second, and then subsides.");
34 morewait();
35 print2("You smell ozone."); /* WDT: explain the battery use. */
36 }
37 else {
38 HiMagicUse = Date;
39 print1("With a shriek of tearing aether, a magic portal appears!");
40 print2("Step through? [yn] ");
41 if (ynq()=='y') change_environment(E_COURT);
42 print1("The sceptre seems to subside. You hear a high whine, as of");
43 print2("capacitors beginning to recharge.");
44 morewait();
45 }
46 }
47
48
49 /* the star gem */
i_stargem(o)50 void i_stargem(o)
51 pob o;
52 {
53 if (StarGemUse == Date) {
54 print1("The Star Gem glints weakly as if to say:");
55 print2("'You have used me overmuch.'");
56 print3("and it vanishes a puff of regret.");
57 Objects[o->id].uniqueness = UNIQUE_UNMADE;
58 /* it's now out there, somewhere */
59 dispose_lost_objects(1,o);
60 }
61 else {
62 StarGemUse = Date;
63 if (o->blessing < 1) {
64 print1("The Star Gem shines brightly and emits a musical tone.");
65 print2("You see a dark cloud roil away from it.");
66 morewait();
67 o->blessing = 10;
68 }
69 print1("The star gem flares with golden light!");
70 morewait();
71 if (Player.status[ILLUMINATION] < 1000) {
72 print1("Interesting, you seem to be permanently accompanied");
73 print2("by a friendly lambent glow....");
74 morewait();
75 Player.status[ILLUMINATION] = 1500;
76 }
77 print1("You suddenly find yourself whisked away by some unknown force!");
78 morewait();
79 setgamestatus(COMPLETED_ASTRAL);
80 change_environment(E_COUNTRYSIDE);
81 Player.x = 61;
82 Player.y = 3;
83 screencheck(3);
84 drawvision(Player.x,Player.y);
85 locprint("Star Peak");
86 Country[Player.x][Player.y].current_terrain_type =
87 Country[Player.x][Player.y].base_terrain_type;
88 c_set(Player.x, Player.y, CHANGED);
89 print2("The Star Gem's brilliance seems to fade.");
90 }
91 }
92
93
94 /* wand of fear */
i_fear(o)95 void i_fear(o)
96 pob o;
97 {
98 int x=Player.x,y=Player.y;
99 Objects[o->id].known = 1;
100 o->known = max(1,o->known);
101 setspot(&x,&y);
102 if (o->blessing < 0) {
103 x = Player.x;
104 y = Player.y;
105 }
106 inflict_fear(x,y);
107 }
108
109
110
i_juggernaut(o)111 void i_juggernaut(o)
112 pob o;
113 {
114 int d,x=Player.x,y=Player.y;
115 int seen = 1, not_seen = 0;
116 int tunneled = 0;
117
118 print1("You activate the Juggernaut of Karnak!");
119 if (! o->known) {
120 print2("Uh, oh, it's coming this way!");
121 p_death("the Juggernaut of Karnak");
122 }
123 else {
124 d = getdir();
125 if (d == ABORT)
126 print2("You deactivate the Juggernaut before it escapes.");
127 else {
128 print1("Vroom! ");
129 while (inbounds(x+Dirs[0][d],y+Dirs[1][d])) {
130 x+=Dirs[0][d];
131 y+=Dirs[1][d];
132 if (!view_unblocked(x, y) || offscreen(y))
133 seen = 0;
134 if (Level->site[x][y].locchar == WALL)
135 tunneled++;
136 if (Level->site[x][y].locchar != WATER &&
137 Level->site[x][y].locchar != VOID_CHAR &&
138 Level->site[x][y].locchar != ABYSS &&
139 Level->site[x][y].locchar != SPACE &&
140 Level->site[x][y].locchar != LAVA)
141 {
142 Level->site[x][y].locchar = FLOOR;
143 Level->site[x][y].p_locf = L_NO_OP;
144 }
145 lreset(x, y, SECRET);
146 lset(x, y, CHANGED);
147 if (Level->site[x][y].creature != NULL) {
148 if (seen)
149 nprint1("Splat! ");
150 else
151 not_seen++;
152 setgamestatus(SUPPRESS_PRINTING);
153 m_death(Level->site[x][y].creature);
154 resetgamestatus(SUPPRESS_PRINTING);
155 }
156 plotspot(x, y, FALSE);
157 omshowcursor(x, y);
158 }
159 if (not_seen > 6)
160 print2("You hear many distant screams...");
161 else if (not_seen > 3)
162 print2("You hear several distant screams...");
163 else if (not_seen > 1)
164 print2("You hear a couple of distant screams...");
165 else if (not_seen == 1)
166 print2("You hear a distant scream...");
167 gain_experience(1000);
168 dispose_lost_objects(1,o);
169 Level->tunnelled += tunneled - 1;
170 tunnelcheck();
171 }
172 }
173 }
174
175
i_symbol(o)176 void i_symbol(o)
177 pob o;
178 {
179 int i;
180 if (! o->known)
181 print1("Nothing seems to happen.");
182 /* if o->charge != 17, then symbol was stolen from own high priest! */
183 else if ((o->aux != Player.patron) || (o->charge != 17)){
184 print1("You invoke the deity...");
185 print2("...who for some reason seems rather annoyed at you...");
186 print3("You are enveloped in Godsfire!");
187 morewait();
188 for(;Player.hp>1;Player.hp--) {
189 dataprint();
190 morewait();
191 for(i=0;i<MAXITEMS;i++)
192 if (Player.possessions[i] != NULL)
193 dispose_lost_objects(Player.possessions[i]->number,
194 Player.possessions[i]);
195 Player.mana = 0;
196 }
197 }
198 else if (SymbolUseHour == hour()) {
199 print1("Your deity frowns upon this profligate use of power...");
200 print2("Shazam! A bolt of Godsfire! Your symbol shatters!");
201 dispose_lost_objects(1,o);
202 Player.hp = 1;
203 dataprint();
204 }
205 else {
206 print1("A mystic flow of theurgic energy courses through your body!");
207 SymbolUseHour = hour();
208 cleanse(1);
209 heal(10);
210 Player.mana = max(Player.mana,calcmana());
211 }
212 }
213
214
215
i_crystal(o)216 void i_crystal(o)
217 pob o;
218 {
219 if (!o->known) print1("You can't figure out how to activate this orb.");
220 else {
221 print1("You gaze into your crystal ball.");
222 if (ViewHour == hour()) print2("All you get is Gilligan's Island reruns.");
223 else if ((o->blessing<0) || (Player.iq+Player.level < random_range(30))) {
224 ViewHour = hour();
225 print2("Weird interference patterns from the crystal fog your mind....");
226 amnesia();
227 }
228 else {
229 ViewHour = hour();
230 print2("You sense the presence of life...");
231 mondet(1);
232 morewait();
233 print2("You sense the presence of objects...");
234 objdet(1);
235 morewait();
236 print2("You begin to see visions of things beyond your ken....");
237 hint();
238 }
239 }
240 }
241
i_antioch(o)242 void i_antioch(o)
243 pob o;
244 {
245 int x=Player.x,y=Player.y;
246 int count;
247 if (!o->known){
248 print1("Ka-Boom!");
249 print2("You seem to have annihilated yourself.");
250 p_death("the Holy Hand-Grenade of Antioch");
251 }
252 else {
253 print1("Bring out the Holy Hand-Grenade of Antioch!");
254 setspot(&x,&y);
255 print2("Ok, you pull the pin.....");
256 morewait();
257 print1("What do you count up to? ");
258 count = (int) parsenum();
259 if ((count < 3)&&(Level->site[x][y].creature!=NULL)) {
260 print1("`Three shall be the number of thy counting....");
261 print2("And the number of thy counting shall be three.'");
262 print3("Your target picks up the grenade and throws it back!");
263 morewait();
264 clearmsg();
265 print1("Ka-Boom!");
266 p_death("the Holy Hand-Grenade of Antioch");
267 }
268 else if (count>3) {
269 print1("`Three shall be the number of thy counting.");
270 print2("And the number of thy counting shall be three.'");
271 morewait();
272 clearmsg();
273 print1("Ka-Boom!");
274 p_death("the Holy Hand-Grenade of Antioch");
275 }
276 else {
277 print1("Ka-Boom!");
278 gain_experience(1000);
279 Level->site[x][y].locchar = TRAP;
280 Level->site[x][y].p_locf = L_TRAP_DOOR;
281 lset(x, y, CHANGED);
282 if (Level->site[x][y].creature != NULL) {
283 m_death(Level->site[x][y].creature);
284 print2("You are covered with gore.");
285 }
286 Level->site[x][y].things = NULL;
287 }
288 }
289 dispose_lost_objects(1,o);
290 }
291
i_kolwynia(o)292 void i_kolwynia(o)
293 pob o;
294 {
295 int i;
296 if (! o->known) {
297 print1("You destroy youself with a mana storm. How sad.");
298 p_death("Kolwynia, The Key That Was Lost");
299 }
300 else {
301 gain_experience(5000);
302 print1("You seem to have gained complete mastery of magic.");
303 Player.pow = Player.maxpow = 2*Player.maxpow;
304 for(i=0;i<NUMSPELLS;i++)
305 Spells[i].known = TRUE;
306 }
307 dispose_lost_objects(1,o);
308 }
309
i_enchantment(o)310 void i_enchantment(o)
311 pob o;
312 {
313 char response;
314 if (ZapHour == hour())
315 print1("The staff doesn't seem to have recharged yet.");
316 else if (! o->known) {
317 ZapHour = hour();
318 print1("You blast the staff backwards....");
319 dispel(-1);
320 }
321 else {
322 ZapHour = hour();
323 print1("Zap with white or black end [wb] ");
324 do response = (char) mcigetc();
325 while ((response != 'w') && (response != 'b'));
326 print2("The staff discharges!");
327 if (response == 'w') enchant(o->blessing*2+1);
328 else dispel(o->blessing);
329 }
330 }
331
i_helm(o)332 void i_helm(o)
333 pob o;
334 {
335 if (HelmHour == hour())
336 print1("The helm doesn't seem to have recharged yet.");
337 else if (! o->known) {
338 HelmHour = hour();
339 print1("You put the helm on backwards....");
340 p_teleport(-1);
341 }
342 else {
343 HelmHour = hour();
344 print1("Your environment fades.... and rematerializes.");
345 p_teleport(o->blessing);
346 }
347 }
348
349
i_death(o)350 void i_death(o)
351 pob o;
352 {
353 clearmsg();
354 print1("Bad move...");
355 p_death("the Potion of Death");
356 }
357
i_life(o)358 void i_life(o)
359 pob o;
360 {
361 clearmsg();
362 print1("Good move.");
363 Player.hp = Player.maxhp = 2 * Player.maxhp;
364 dispose_lost_objects(1,o);
365 }
366
367
368
369 /* f = fire, w = water, e = earth, a = air, m = mastery */
orbcheck(element)370 int orbcheck(element)
371 char element;
372 {
373 char response;
374 print1("The orb begins to glow with increasing intensity!");
375 print2("You have the feeling you need to do something more....");
376 morewait();
377 print1("Burn it in fire [f] ");
378 print2("Douse it with water [w] ");
379 morewait();
380 print1("Smash it against the earth [e] ");
381 print2("Toss is through the air [a] ");
382 morewait();
383 print1("Mix the above actions, doing them in sequence [m] ");
384 do {
385 print2("Which one [f,w,e,a,m] ");
386 response = (char) mcigetc();
387 } while ((response != 'f') &&
388 (response != 'w') &&
389 (response != 'e') &&
390 (response != 'a') &&
391 (response != 'm'));
392 return(response == element);
393 }
394
395 /* orb functions */
i_orbfire(o)396 void i_orbfire(o)
397 pob o;
398 {
399 if (! orbcheck('f')) {
400 print1("Bad choice!");
401 print2("The Orb of Fire blasts you!");
402 fball(Player.x,Player.y,Player.x,Player.y,250);
403 o->known = 1;
404 }
405 else {
406 print1("The Orb of Fire flares a brilliant red!");
407 Spells[S_FIREBOLT].known = TRUE;
408 gain_experience(10000);
409 Player.immunity[FLAME]+=100;
410 print2("You feel fiery!");
411 o->plus = 100;
412 o->blessing = 100;
413 i_firebolt(o);
414 }
415 *o = Objects[ARTIFACTID+5];
416 }
417
418
i_orbwater(o)419 void i_orbwater(o)
420 pob o;
421 {
422 if (! orbcheck('w')) {
423 print1("A serious mistake!");
424 print2("The Orb of Water blasts you!");
425 heal(-250);
426 o->known = 1;
427 }
428 else {
429 print1("The Orb of Water pulses a deep green!");
430 Spells[S_DISRUPT].known = TRUE;
431 Player.immunity[POISON]+=100;
432 gain_experience(10000);
433 print2("You feel wet!");
434 o->plus = 100;
435 o->blessing = 100;
436 i_disrupt(o);
437 }
438 *o = Objects[ARTIFACTID+5];
439 }
440
441
442
443
444
445
i_orbearth(o)446 void i_orbearth(o)
447 pob o;
448 {
449 int i;
450 if (! orbcheck('e')) {
451 print1("What a maroon!");
452 print2("The Orb of Earth blasts you!");
453 Player.con -= 10;
454 if (Player.con < 3)
455 p_death("congestive heart failure");
456 else {
457 print3("Your possessions disintegrate!");
458 for (i=0;i<MAXITEMS;i++)
459 if (Player.possessions[i] != NULL)
460 dispose_lost_objects(Player.possessions[i]->number,
461 Player.possessions[i]);
462 for (i=0;i<MAXPACK;i++)
463 if (Player.pack[i] != NULL) {
464 free((char *) Player.pack[i]);
465 Player.pack[i] = NULL;
466 }
467 Player.packptr = 0;
468 o->known = 1;
469 }
470 }
471 else {
472 print1("The Orb of Earth emanates a brownish aura!");
473 Spells[S_DISINTEGRATE].known = TRUE;
474 gain_experience(10000);
475 Player.immunity[NEGENERGY]+=100;
476 print2("You feel earthy!");
477 o->plus = 100;
478 o->blessing = 100;
479 i_disintegrate(o);
480 }
481 *o = Objects[ARTIFACTID+5];
482 }
483
484
i_orbair(o)485 void i_orbair(o)
486 pob o;
487 {
488 if (! orbcheck('a')) {
489 print1("You lose!");
490 print2("The Orb of Air blasts you!");
491 lball(Player.x,Player.y,Player.x,Player.y,100);
492 o->known = 1;
493 }
494 else {
495 print1("The Orb of Air flashes blue!");
496 Spells[S_LBALL].known = TRUE; /* lball */
497 gain_experience(10000);
498 print2("You feel airy!");
499 Player.immunity[ELECTRICITY]+=100;
500 o->plus = 100;
501 o->blessing = 100;
502 i_invisible(o);
503 i_lbolt(o);
504 }
505 *o = Objects[ARTIFACTID+5];
506 }
507
508
i_orbmastery(o)509 void i_orbmastery(o)
510 pob o;
511 {
512
513 if (! orbcheck('m')) {
514 print1("A fatal error!");
515 print2("The Orb of Mastery blasts you to cinders!");
516 p_death("playing with the Orb of Mastery");
517 o->known = 1;
518 }
519 else if ((find_and_remove_item(ARTIFACTID+1,-1)) &&
520 (find_and_remove_item(ARTIFACTID+2,-1)) &&
521 (find_and_remove_item(ARTIFACTID+3,-1)) &&
522 (find_and_remove_item(ARTIFACTID+4,-1))) {
523 print1("The Orb of Mastery radiates rainbow colors!");
524 print2("You feel godlike.");
525 Player.iq = Player.maxiq = 2 * Player.maxiq;
526 Player.pow = Player.maxpow = 2 * Player.maxpow;
527 Player.str = Player.maxstr = 2 * Player.maxstr;
528 Player.dex = Player.maxdex = 2 * Player.maxdex;
529 Player.con = Player.maxcon = 2 * Player.maxcon;
530 Player.agi = Player.maxagi = 2 * Player.maxagi;
531 dataprint();
532 morewait();
533 print1("You have been imbued with a cosmic power....");
534 morewait();
535 wish(1);
536 morewait();
537 clearmsg();
538 print2("You feel much more experienced.");
539 gain_experience(20000);
540 *o = Objects[ARTIFACTID+5];
541 }
542 else {
543 print1("The Orb of Mastery's power is unbalanced!");
544 print2("The Orb of Mastery blasts you to cinders!");
545 p_death("playing with the Orb of Mastery");
546 }
547 }
548
549
i_orbdead(o)550 void i_orbdead(o)
551 pob o;
552 {
553 int i;
554 print1("The burnt-out orb drains all your energy!");
555 for(i=0;i<NUMSPELLS;i++)
556 Spells[i].known = FALSE;
557 print2("You feel not at all like a mage.");
558 for(i=0;i<MAXITEMS;i++) {
559 if (Player.possessions[i] != NULL) {
560 Player.possessions[i]->plus = 0;
561 if (Player.possessions[i]->usef > 100)
562 Player.possessions[i]->usef = I_NOTHING;
563 }
564 }
565 print3("A storm of mundanity surounds you!");
566 level_drain(Player.level-1,"a Burnt-out Orb");
567 Player.mana = 0;
568 Player.pow -= 10;
569 }
570
571
572
i_dispel(o)573 void i_dispel(o)
574 pob o;
575 {
576 dispel((o->blessing > -1) ? o->blessing+random_range(3): o->blessing);
577 }
578
579
580 /* stick functions */
581
582
583 /* wand of apportation */
i_apport(o)584 void i_apport(o)
585 pob o;
586 {
587 o->known = max(1,o->known);
588 Objects[o->id].known = 1;
589 apport(o->blessing);
590 }
591
592 /* staff of firebolts */
i_firebolt(o)593 void i_firebolt(o)
594 pob o;
595 {
596 int x=Player.x,y=Player.y;
597 o->known = max(1,o->known);
598 Objects[o->id].known = 1;
599 setspot(&x,&y);
600 if (o->blessing < 0) {
601 x = Player.x;
602 y = Player.y;
603 }
604 fbolt(Player.x,Player.y,x,y,Player.dex*2+Player.level,75);
605 }
606
607
i_disintegrate(o)608 void i_disintegrate(o)
609 pob o;
610 {
611 int x=Player.x,y=Player.y;
612 o->known = max(1,o->known);
613 Objects[o->id].known = 1;
614 setspot(&x,&y);
615 if (o->blessing < 0) {
616 x = Player.x;
617 y = Player.y;
618 }
619 disintegrate(x,y);
620 }
621
i_disrupt(o)622 void i_disrupt(o)
623 pob o;
624 {
625 int x=Player.x,y=Player.y;
626 o->known = max(1,o->known);
627 Objects[o->id].known = 1;
628 setspot(&x,&y);
629 if (o->blessing < 0) {
630 x = Player.x;
631 y = Player.y;
632 }
633 disrupt(x,y,100);
634 }
635
636
637 /* staff of lightning bolts */
i_lbolt(o)638 void i_lbolt(o)
639 pob o;
640 {
641 int x=Player.x,y=Player.y;
642 o->known = max(1,o->known);
643 Objects[o->id].known = 1;
644 setspot(&x,&y);
645 if (o->blessing < 0) {
646 x = Player.x;
647 y = Player.y;
648 }
649 lbolt(Player.x,Player.y,x,y,Player.dex*2+Player.level,75);
650 }
651
652 /* wand of magic missiles */
i_missile(o)653 void i_missile(o)
654 pob o;
655 {
656 int x=Player.x,y=Player.y;
657 o->known = max(1,o->known);
658 Objects[o->id].known = 1;
659 setspot(&x,&y);
660 if (o->blessing < 0) {
661 x = Player.x;
662 y = Player.y;
663 }
664 nbolt(Player.x,Player.y,x,y,Player.dex*2+Player.level,20);
665 }
666
667 /* wand of fire balls */
i_fireball(o)668 void i_fireball(o)
669 pob o;
670 {
671 int x=Player.x,y=Player.y;
672 Objects[o->id].known = 1;
673 o->known = max(1,o->known);
674 setspot(&x,&y);
675 if (o->blessing < 0) {
676 x = Player.x;
677 y = Player.y;
678 }
679 fball(Player.x,Player.y,x,y,35);
680 }
681
682
683 /* wand of snowballs */
i_snowball(o)684 void i_snowball(o)
685 pob o;
686 {
687 int x=Player.x,y=Player.y;
688 Objects[o->id].known = 1;
689 o->known = max(1,o->known);
690 setspot(&x,&y);
691 if (o->blessing < 0) {
692 x = Player.x;
693 y = Player.y;
694 }
695 snowball(Player.x,Player.y,x,y,20);
696 }
697
698 /* wand of lightning balls */
i_lball(o)699 void i_lball(o)
700 pob o;
701 {
702 int x=Player.x,y=Player.y;
703 Objects[o->id].known = 1;
704 o->known = max(1,o->known);
705 setspot(&x,&y);
706 if (o->blessing < 0) {
707 x = Player.x;
708 y = Player.y;
709 }
710 lball(Player.x,Player.y,x,y,50);
711 }
712
713 /* staff of sleep */
i_sleep_other(o)714 void i_sleep_other(o)
715 pob o;
716 {
717 Objects[o->id].known = 1;
718 o->known = max(1,o->known);
719 sleep_monster(o->blessing);
720 }
721
722 /* rod of summoning */
723 /* rod of summoning now always summons as if cursed */
i_summon(o)724 void i_summon(o)
725 pob o;
726 {
727 Objects[o->id].known = 1;
728 o->known = max(1,o->known);
729 summon(-1,-1);
730 }
731
i_hide(o)732 void i_hide(o)
733 pob o;
734 {
735 int x=Player.x,y=Player.y;
736 Objects[o->id].known = 1;
737 o->known = max(1,o->known);
738 setspot(&x,&y);
739 hide(x,y);
740 }
741
i_polymorph(o)742 void i_polymorph(o)
743 pob o;
744 {
745 Objects[o->id].known = 1;
746 o->known = max(1,o->known);
747 polymorph(o->blessing);
748 }
749