1 /* omega copyright (C) 1987,1988,1989 by Laurence Raphael Brothers */
2 /* itemf1.c */
3
4 /* various item functions: potions,scrolls,boots,cloaks,things,food */
5
6 #include "glob.h"
7
8
9 /* general item functions */
10
i_no_op(o)11 void i_no_op(o)
12 pob o;
13 {
14 }
15
i_nothing(o)16 void i_nothing(o)
17 pob o;
18 {
19 }
20
21
22 /* scroll functions */
23
i_knowledge(o)24 void i_knowledge(o)
25 pob o;
26 {
27 if (o->blessing > -1)
28 Objects[o->id].known = 1;
29 knowledge(o->blessing);
30 }
31
i_jane_t(o)32 void i_jane_t(o)
33 pob o;
34 {
35 int volume = random_range(6);
36 int i,j,k;
37 char v;
38
39 Objects[o->id].known = 1;
40 print1("Jane's Guide to the World's Treasures: ");
41 switch(volume) {
42 case 0:nprint1("SCROLLS");j = SCROLLID; k = POTIONID; break;
43 case 1:nprint1("POTIONS");j = POTIONID; k = WEAPONID; break;
44 case 2:nprint1("CLOAKS");j = CLOAKID; k = BOOTID; break;
45 case 3:nprint1("BOOTS");j = BOOTID; k = RINGID; break;
46 case 4:nprint1("RINGS");j = RINGID; k = STICKID; break;
47 case 5:nprint1("STICKS");j = STICKID; k = ARTIFACTID; break;
48 }
49 menuclear();
50 menuprint("You could probably now recognise:\n");
51 for(i=j;i<k;i++) {
52 Objects[i].known = 1;
53 v = Objects[i].truename[0];
54 if ((v >= 'A' && v <= 'Z') || volume == 3)
55 sprintf(Str1, " %s\n", Objects[i].truename);
56 else if (v == 'a' || v == 'e' || v == 'i' || v == 'o' || v == 'u')
57 sprintf(Str1, " an %s\n", Objects[i].truename);
58 else
59 sprintf(Str1, " a %s\n", Objects[i].truename);
60 menuprint(Str1);
61 }
62 showmenu();
63 morewait();
64 xredraw();
65 }
66
67
i_flux(o)68 void i_flux(o)
69 pob o;
70 {
71 if (o->blessing > -1)
72 Objects[o->id].known = 1;
73 flux(o->blessing);
74 }
75
76
77 /* enchantment */
i_enchant(o)78 void i_enchant(o)
79 pob o;
80 {
81 if (o->blessing > -1)
82 Objects[o->id].known = 1;
83 enchant(o->blessing < 0 ? -1-o->plus : o->plus+1);
84 }
85
86 /* scroll of clairvoyance */
i_clairvoyance(o)87 void i_clairvoyance(o)
88 struct object *o;
89 {
90 if (o->blessing > -1)
91 Objects[o->id].known = 1;
92 if (o->blessing < 0)
93 amnesia();
94 else clairvoyance(5+o->blessing*5);
95 }
96
97
98
i_acquire(o)99 void i_acquire(o)
100 pob o;
101 {
102 int blessing;
103
104 if (o->blessing > -1)
105 Objects[o->id].known = 1;
106 blessing = o->blessing;
107 *o = Objects[SCROLLID+0]; /* blank out the scroll */
108 acquire(blessing);
109 }
110
i_teleport(o)111 void i_teleport(o)
112 pob o;
113 {
114 if (o->blessing > -1)
115 Objects[o->id].known = 1;
116 p_teleport(o->blessing);
117 }
118
119
i_spells(o)120 void i_spells(o)
121 pob o;
122 {
123 if (o->blessing > -1)
124 Objects[o->id].known = 1;
125 mprint("A scroll of spells.");
126 morewait();
127 learnspell(o->blessing);
128 }
129
130
131
132 /* scroll of blessing */
i_bless(o)133 void i_bless(o)
134 pob o;
135 {
136 Objects[o->id].known = 1;
137 bless(o->blessing);
138 }
139
140 /* scroll of wishing */
i_wish(o)141 void i_wish(o)
142 pob o;
143 {
144 if (o->blessing > -1)
145 Objects[o->id].known = 1;
146 wish(o->blessing);
147 *o = Objects[SCROLLID+0]; /* blank out the scroll */
148 }
149
150 /* scroll of displacement */
i_displace(o)151 void i_displace(o)
152 pob o;
153 {
154 if (o->blessing > -1)
155 Objects[o->id].known = 1;
156 displace(o->blessing);
157 }
158
159
160 /* scroll of deflection */
i_deflect(o)161 void i_deflect(o)
162 pob o;
163 {
164 if (o->blessing > -1)
165 Objects[o->id].known = 1;
166 deflection(o->blessing);
167 }
168
169 /* scroll of identification */
i_id(o)170 void i_id(o)
171 pob o;
172 {
173 if (o->blessing > -1)
174 Objects[o->id].known = 1;
175 identify(o->blessing);
176 }
177
178 /* potion functions */
179
180 /* potion of healing */
i_heal(o)181 void i_heal(o)
182 pob o;
183 {
184 if (o->blessing > -1) {
185 Objects[o->id].known = 1;
186 heal(1+o->plus);
187 }
188 else heal(-1-abs(o->plus));
189 }
190
191 /* potion of monster detection */
i_mondet(o)192 void i_mondet(o)
193 pob o;
194 {
195 if (o->blessing > -1)
196 Objects[o->id].known = 1;
197 mondet(o->blessing);
198 }
199
200
201 /* potion of object detection */
i_objdet(o)202 void i_objdet(o)
203 pob o;
204 {
205
206 if (o->blessing > -1)
207 Objects[o->id].known = 1;
208 objdet(o->blessing);
209 }
210
211 /* potion of neutralize poison */
i_neutralize_poison(o)212 void i_neutralize_poison(o)
213 pob o;
214 {
215 if (o->blessing > -1) {
216 Objects[o->id].known = 1;
217 mprint("You feel vital!");
218 Player.status[POISONED] = 0;
219 }
220 else p_poison(random_range(20)+5);
221 }
222
223
224 /* potion of sleep */
i_sleep_self(o)225 void i_sleep_self(o)
226 pob o;
227 {
228 sleep_player(6);
229 Objects[o->id].known = 1;
230 }
231
232
233
234
235 /* potion of speed */
i_speed(o)236 void i_speed(o)
237 pob o;
238 {
239 if (o->blessing > -1)
240 Objects[o->id].known = 1;
241 haste(o->blessing);
242 }
243
244
245 /* potion of restoration */
i_restore(o)246 void i_restore(o)
247 pob o;
248 {
249 if (o->blessing > -1)
250 Objects[o->id].known = 1;
251 recover_stat(o->blessing);
252 }
253
i_augment(o)254 void i_augment(o)
255 pob o;
256 {
257 if (o->blessing > -1)
258 Objects[o->id].known = 1;
259 augment(o->blessing);
260 }
261
i_azoth(o)262 void i_azoth(o)
263 pob o;
264 {
265 if (o->plus < 0) {
266 mprint("The mercury was poisonous!");
267 p_poison(25);
268 }
269 else if (o->plus == 0) {
270 mprint("The partially enchanted azoth makes you sick!");
271 Player.con = ((int) (Player.con / 2));
272 calc_melee();
273 }
274 else if (o->blessing < 1) {
275 mprint("The unblessed azoth warps your soul!");
276 Player.pow = Player.maxpow = ((int) (Player.maxpow / 2));
277 level_drain(random_range(10),"cursed azoth");
278 }
279 else {
280 mprint("The azoth fills you with cosmic power!");
281 if (Player.str > Player.maxstr*2) {
282 mprint("The power rages out of control!");
283 p_death("overdose of azoth");
284 }
285 else {
286 heal(10);
287 cleanse(1);
288 Player.mana = calcmana()*3;
289 toggle_item_use(TRUE);
290 Player.str = (Player.maxstr++)*3;
291 toggle_item_use(FALSE);
292 }
293 }
294 }
295
i_regenerate(o)296 void i_regenerate(o)
297 pob o;
298 {
299 regenerate(o->blessing);
300 }
301
302
303
304
305
306 /* boots functions */
i_perm_speed(o)307 void i_perm_speed(o)
308 pob o;
309 {
310 if (o->blessing > -1) {
311 if (o->used) {
312 o->known = 2;
313 Objects[o->id].known = 1;
314 if (Player.status[SLOWED] > 0) {
315 Player.status[SLOWED] = 0;
316 }
317 mprint("The world slows down!");
318 Player.status[HASTED] += 1500;
319 }
320 else {
321 Player.status[HASTED] -= 1500;
322 if (Player.status[HASTED] < 1)
323 mprint("The world speeds up again.");
324 }
325 }
326 else {
327 if (o->used) {
328 if (Player.status[HASTED] > 0) {
329 Player.status[HASTED] = 0;
330 }
331 mprint("You feel slower.");
332 Player.status[SLOWED] += 1500;
333 }
334 else {
335 Player.status[SLOWED] -= 1500;
336 if (Player.status[SLOWED] < 1)
337 mprint("You feel quicker again.");
338 }
339 }
340 }
341
342 /* cloak functions */
i_perm_displace(o)343 void i_perm_displace(o)
344 pob o;
345 {
346 if (o->blessing > -1) {
347 if (o->used) {
348 mprint("You feel dislocated.");
349 Player.status[DISPLACED] += 1500;
350 }
351 else {
352 Player.status[DISPLACED] -= 1500;
353 if (Player.status[DISPLACED] < 1) {
354 mprint("You feel a sense of position.");
355 Player.status[DISPLACED] = 0;
356 }
357 }
358 }
359 else {
360 if (o->used) {
361 mprint("You have a forboding of bodily harm!");
362 Player.status[VULNERABLE] += 1500;
363 }
364 else {
365 Player.status[VULNERABLE] -= 1500;
366 if (Player.status[VULNERABLE] < 1) {
367 mprint("You feel less endangered.");
368 Player.status[VULNERABLE] = 0;
369 }
370 }
371 }
372 }
373
i_perm_negimmune(o)374 void i_perm_negimmune(o)
375 pob o;
376 {
377 if (o->blessing > -1) {
378 if (o->used) {
379 Player.immunity[NEGENERGY]++;
380 }
381 else Player.immunity[NEGENERGY]--;
382 }
383 else if (o->used)
384 level_drain(abs(o->blessing),"cursed cloak of level drain");
385 }
386
387 /* food functions */
388
389
i_food(o)390 void i_food(o)
391 pob o;
392 {
393 switch(random_range(5)) {
394 case 0: mprint("That tasted horrible!"); break;
395 case 1: mprint("Yum!"); break;
396 case 2: mprint("How nauseous!"); break;
397 case 3: mprint("Can I have some more? Please?"); break;
398 case 4: mprint("Your mouth feels like it is growing hair!"); break;
399 }
400 }
401
i_stim(o)402 void i_stim(o)
403 pob o;
404 {
405 mprint("You feel Hyper!");
406 i_speed(o);
407 Player.str +=3;
408 Player.con -=1;
409 calc_melee();
410 }
411
i_pow(o)412 void i_pow(o)
413 pob o;
414 {
415 mprint("You feel a surge of mystic power!");
416 Player.mana = 2 * calcmana();
417 }
418
i_poison_food(o)419 void i_poison_food(o)
420 pob o;
421 {
422 mprint("This food was contaminated with cyanide!");
423 p_poison(random_range(20)+5);
424 }
425
i_pepper_food(o)426 void i_pepper_food(o)
427 pob o;
428 {
429 mprint("You innocently start to chew the szechuan pepper.....");
430 morewait();
431 mprint("hot.");
432 morewait();
433 mprint("Hot.");
434 morewait();
435 mprint("Hot!");
436 morewait();
437 mprint("HOT!!!!!!");
438 morewait();
439 p_damage(1,UNSTOPPABLE,"a szechuan pepper");
440 mprint("Your sinuses melt and run out your ears.");
441 mprint("Your mouth and throat seem to be permanently on fire.");
442 mprint("You feel much more awake now....");
443 Player.immunity[SLEEP]++;
444 }
445
i_lembas(o)446 void i_lembas(o)
447 pob o;
448 {
449 heal(10);
450 cleanse(0);
451 Player.food = 40;
452 }
453
454
i_cure(o)455 void i_cure(o)
456 pob o;
457 {
458 cure(o->blessing);
459 }
460
i_immune(o)461 void i_immune(o)
462 pob o;
463 {
464 if (o->blessing > 0) {
465 mprint("You feel a sense of innoculation");
466 Player.immunity[INFECTION]++;
467 cure(o->blessing);
468 }
469 }
470
471
472
i_breathing(o)473 void i_breathing(o)
474 pob o;
475 {
476
477 if (o->blessing > -1)
478 Objects[o->id].known = 1;
479 breathe(o->blessing);
480 }
481
482
i_invisible(o)483 void i_invisible(o)
484 pob o;
485 {
486 if (o->blessing > -1)
487 Objects[o->id].known = 1;
488 invisible(o->blessing);
489 }
490
491
i_perm_invisible(o)492 void i_perm_invisible(o)
493 pob o;
494 {
495 if (o->blessing > -1)
496 Objects[o->id].known = 1;
497 if (o->used) {
498 if (o->blessing > -1) {
499 mprint("You feel transparent!");
500 Player.status[INVISIBLE] += 1500;
501 }
502 else {
503 mprint("You feel a forboding of bodily harm!");
504 Player.status[VULNERABLE] += 1500;
505 }
506 }
507 else {
508 if (o->blessing > -1) {
509 Player.status[INVISIBLE]-=1500;
510 if (Player.status[INVISIBLE] < 1) {
511 mprint("You feel opaque again.");
512 Player.status[INVISIBLE] = 0;
513 }
514 }
515 else {
516 Player.status[VULNERABLE] -= 1500;
517 if (Player.status[VULNERABLE] < 1) {
518 mprint("You feel less endangered now.");
519 Player.status[VULNERABLE] = 0;
520 }
521 }
522 }
523 }
524
525
i_warp(o)526 void i_warp(o)
527 pob o;
528 {
529 if (o->blessing > -1)
530 Objects[o->id].known = 1;
531 warp(o->blessing);
532 }
533
534
i_alert(o)535 void i_alert(o)
536 pob o;
537 {
538 if (o->blessing > -1) {
539 Objects[o->id].known = 1;
540 alert(o->blessing);
541 }
542 }
543
i_charge(o)544 void i_charge(o)
545 pob o;
546 {
547 int i;
548 if (o->blessing > -1)
549 Objects[o->id].known = 1;
550 mprint("A scroll of charging.");
551 mprint("Charge: ");
552 i = getitem(STICK);
553 if (i != ABORT) {
554 if (o->blessing < 0) {
555 mprint("The stick glows black!");
556 Player.possessions[i]->charge = 0;
557 }
558 else {
559 mprint("The stick glows blue!");
560 Player.possessions[i]->charge += (random_range(10)+1)*(o->blessing+1);
561 if (Player.possessions[i]->charge > 99)
562 Player.possessions[i]->charge = 99;
563 }
564 }
565 }
566
567
i_fear_resist(o)568 void i_fear_resist(o)
569 pob o;
570 {
571 if (o->blessing > -1) {
572 Objects[o->id].known = 1;
573 if (Player.status[AFRAID] > 0) {
574 mprint("You feel stauncher now.");
575 Player.status[AFRAID] = 0;
576 }
577 }
578 else if (! p_immune(FEAR)) {
579 mprint("You panic!");
580 Player.status[AFRAID]+=random_range(100);
581 }
582 }
583
584
585
586 /* use a thieves pick */
i_pick(o)587 void i_pick(o)
588 pob o;
589 {
590 int dir;
591 int ox,oy;
592 o->used = FALSE;
593 if ((! o->known) && (! Player.rank[THIEVES]))
594 mprint("You have no idea what do with a piece of twisted metal.");
595 else {
596 o->known = 1;
597 Objects[o->id].known = 1;
598 mprint("Pick lock:");
599 dir = getdir();
600 if (dir == ABORT)
601 resetgamestatus(SKIP_MONSTERS);
602 else {
603 ox = Player.x + Dirs[0][dir];
604 oy = Player.y + Dirs[1][dir];
605 if ((Level->site[ox][oy].locchar != CLOSED_DOOR) ||
606 loc_statusp(ox,oy,SECRET)) {
607 mprint("You can't unlock that!");
608 resetgamestatus(SKIP_MONSTERS);
609 }
610 else if (Level->site[ox][oy].aux == LOCKED) {
611 if (Level->depth == MaxDungeonLevels-1)
612 mprint("The lock is too complicated for you!!!");
613 else if (Level->depth*2 + random_range(50) <
614 Player.dex+Player.level+Player.rank[THIEVES]*10) {
615 mprint("You picked the lock!");
616 Level->site[ox][oy].aux = UNLOCKED;
617 lset(ox, oy, CHANGED);
618 gain_experience(max(3,Level->depth));
619 }
620 else mprint("You failed to pick the lock.");
621 }
622 else mprint("That door is already unlocked!");
623 }
624 }
625 }
626
627 /* use a magic key*/
i_key(o)628 void i_key(o)
629 pob o;
630 {
631 int dir;
632 int ox,oy;
633 o->used = FALSE;
634 mprint("Unlock door: ");
635 dir = getdir();
636 if (dir == ABORT)
637 resetgamestatus(SKIP_MONSTERS);
638 else {
639 ox = Player.x + Dirs[0][dir];
640 oy = Player.y + Dirs[1][dir];
641 if ((Level->site[ox][oy].locchar != CLOSED_DOOR) ||
642 loc_statusp(ox,oy,SECRET)) {
643 mprint("You can't unlock that!");
644 resetgamestatus(SKIP_MONSTERS);
645 }
646 else if (Level->site[ox][oy].aux == LOCKED) {
647 mprint("The lock clicks open!");
648 Level->site[ox][oy].aux = UNLOCKED;
649 lset(ox, oy, CHANGED);
650 o->blessing--;
651 if ((o->blessing<0)||(Level->depth == MaxDungeonLevels-1)) {
652 mprint("The key disintegrates!");
653 conform_lost_objects(1,o);
654 }
655 else
656 mprint("Your key glows faintly.");
657 }
658 else mprint("That door is already unlocked!");
659 }
660 }
661
i_corpse(o)662 void i_corpse(o)
663 pob o;
664 {
665 /* WDT HACK: there are some comments in this function which need
666 * to be backed up with assert(). */
667 /* object's charge holds the former monster id */
668 switch (o->charge) {
669 case MEND_PRIEST:
670 case ITIN_MERCH:
671 case GUARD:
672 case NPC:
673 case MERCHANT:
674 case ZERO_NPC:
675 case HISCORE_NPC:
676 case APPR_NINJA:
677 case SNEAK_THIEF:
678 case BRIGAND:
679 case GENIN:
680 case MAST_THIEF:
681 case CHUNIN:
682 case JONIN: /* cannibalism */
683 mprint("Yechh! How could you! You didn't even cook him, first!");
684 if (Player.alignment > 0) Player.food = 25;
685 Player.food += 8;
686 Player.alignment -=10;
687 foodcheck();
688 break;
689 case FNORD: /* fnord */
690 mprint("You feel illuminated!");
691 Player.iq++;
692 break;
693 case DENEBIAN: /* denebian slime devil */
694 mprint("I don't believe this. You ate Denebian Slime?");
695 mprint("You deserve a horrible wasting death, uncurable by any means!");
696 break;
697 case DRAGONETTE: /* can't get here... i_usef changed to I_FOOD */
698 mprint("Those dragon-steaks were fantastic!");
699 Player.food=24;
700 foodcheck();
701 break;
702 case BEHEMOTH:
703 mprint("You feel infinitely more virile now.");
704 Player.str = max(Player.str,Player.maxstr+10);
705 Player.food = 24;
706 foodcheck();
707 break;
708 case INVIS_SLAY:
709 mprint("Guess what? You're invisible.");
710 if (Player.status[INVISIBLE] < 1000) Player.status[INVISIBLE] = 666;
711 Player.food+=6;
712 foodcheck();
713 break;
714 case UNICORN:
715 mprint("You ATE a unicorn's horn?!?!?");
716 Player.immunity[POISON]=1000;
717 break;
718 case HORNET: /* can't get here... i_usef changed to I_POISON_FOOD */
719 case GRUNT:
720 case TSETSE: /* can't get here... i_usef changed to I_SLEEP_SELF */
721 case AGGRAVATOR:
722 case BLIPPER: /* can't get here... i_usef changed to I_TELEPORT */
723 case GOBLIN:
724 case GEEK:
725 case NIGHT_GAUNT: /* can't get here... i_usef changed to I_POISON_FOOD */
726 case TOVE:
727 case TASMANIAN:
728 case JUBJUB: /* can't get here... i_usef changed to I_FOOD */
729 case CATEAGLE:
730 mprint("Well, you forced it down. Not much nutrition, though.");
731 Player.food++;
732 foodcheck();
733 break;
734 case SEWER_RAT:
735 case PHANTASTICON: /* can't get here... i_usef changed to I_POISON_FOOD */
736 case EYE: /* can't get here... i_usef changed to I_CLAIRVOYANCE */
737 case NASTY: /* can't get here... i_usef changed to I_INVISIBLE */
738 case CATOBLEPAS:
739 case HAUNT: /* can't get here... i_usef changed to I_POISON_FOOD */
740 case ROUS:
741 case DEATHSTAR: /* can't get here... i_usef changed to I_POISON_FOOD */
742 case EATER:
743 mprint("Oh, yuck. The 'food' seems to be tainted.");
744 mprint("You feel very sick. You throw up.");
745 Player.food = min(Player.food, 4);
746 default: mprint("It proved completely inedible, but you tried anyhow.");
747 }
748 }
749
i_accuracy(o)750 void i_accuracy(o)
751 pob o;
752 {
753 o->known = 1;
754 Objects[o->id].known = 1;
755 accuracy(o->blessing);
756 }
757
i_perm_accuracy(o)758 void i_perm_accuracy(o)
759 pob o;
760 {
761 o->known = 1;
762 Objects[o->id].known = 1;
763 if ((o->used) && (o->blessing > -1)) {
764 Player.status[ACCURATE] += 1500;
765 mprint("You feel skillful and see bulls' eyes everywhere.");
766 }
767 else {
768 Player.status[ACCURATE] -= 1500;
769 if (Player.status[ACCURATE] < 1) {
770 Player.status[ACCURATE] = 0;
771 calc_melee();
772 mprint("Your vision blurs....");
773 }
774 }
775 }
776
i_hero(o)777 void i_hero(o)
778 pob o;
779 {
780 o->known = 1;
781 Objects[o->id].known = 1;
782 hero(o->blessing);
783 }
784
i_perm_hero(o)785 void i_perm_hero(o)
786 pob o;
787 {
788 o->known = 1;
789 Objects[o->id].known = 1;
790 if (o->used){
791 if (o->blessing > -1) {
792 Player.status[HERO] += 1500;
793 calc_melee();
794 mprint("You feel super!");
795 }
796 else {
797 Player.status[HERO] = 0;
798 calc_melee();
799 if (! Player.immunity[FEAR]) {
800 Player.status[AFRAID]+=1500;
801 mprint("You feel cowardly....");
802 }
803 }
804 }
805 else {
806 if (o->blessing > -1) {
807 Player.status[HERO] -= 1500;
808 if (Player.status[HERO] < 1) {
809 calc_melee();
810 mprint("You feel less super now.");
811 Player.status[HERO] = 0;
812 }
813 }
814 else {
815 Player.status[AFRAID] -= 1500;
816 if (Player.status[AFRAID] < 1) {
817 mprint("You finally conquer your fear.");
818 Player.status[AFRAID] = 0;
819 }
820 }
821 }
822 }
823
i_levitate(o)824 void i_levitate(o)
825 pob o;
826 {
827 o->known = 1;
828 Objects[o->id].known = 1;
829 levitate(o->blessing);
830 }
831
i_perm_levitate(o)832 void i_perm_levitate(o)
833 pob o;
834 {
835 o->known = 1;
836 Objects[o->id].known = 1;
837 if (o->blessing > -1) {
838 if (o->used) {
839 Player.status[LEVITATING] += 1400;
840 mprint("You start to float a few inches above the floor");
841 mprint("You find you can easily control your altitude");
842 }
843 else {
844 Player.status[LEVITATING] -= 1500;
845 if (Player.status[LEVITATING] < 1) {
846 Player.status[LEVITATING] = 0;
847 mprint("You sink to the floor.");
848 }
849 }
850 }
851 else i_perm_burden(o);
852 }
853
i_perm_protection(o)854 void i_perm_protection(o)
855 pob o;
856 {
857 if (o->used){
858 if (o->blessing > -1)
859 Player.status[PROTECTION] += abs(o->plus)+1;
860 else
861 Player.status[PROTECTION] -= abs(o->plus)+1;
862 }
863 else {
864 if (o->blessing > -1)
865 Player.status[PROTECTION] -= abs(o->plus)+1;
866 else
867 Player.status[PROTECTION] += abs(o->plus)+1;
868 }
869 calc_melee();
870 }
871
i_perm_agility(o)872 void i_perm_agility(o)
873 pob o;
874 {
875 o->known = 2;
876 Objects[o->id].known = 1;
877 if (o->used){
878 if (o->blessing > -1)
879 Player.agi += abs(o->plus)+1;
880 else
881 Player.agi -= abs(o->plus)+1;
882 }
883 else {
884 if (o->blessing > -1)
885 Player.agi -= abs(o->plus)+1;
886 else
887 Player.agi += abs(o->plus)+1;
888 }
889 calc_melee();
890 }
891
i_truesight(o)892 void i_truesight(o)
893 pob o;
894 {
895 o->known = 1;
896 Objects[o->id].known = 1;
897 truesight(o->blessing);
898 }
899
i_perm_truesight(o)900 void i_perm_truesight(o)
901 pob o;
902 {
903 o->known = 1;
904 Objects[o->id].known = 1;
905 if (o->used){
906 if (o->blessing > -1) {
907 Player.status[TRUESIGHT] += 1500;
908 mprint("You feel sharp!");
909 }
910 else {
911 Player.status[BLINDED] += 1500;
912 mprint("You've been blinded!");
913 }
914 }
915 else {
916 if (o->blessing > -1) {
917 Player.status[TRUESIGHT] -= 1500;
918 if (Player.status[TRUESIGHT] < 1) {
919 mprint("You feel less keen now.");
920 Player.status[TRUESIGHT] = 0;
921 }
922 }
923 else {
924 Player.status[BLINDED] -= 1500;
925 if (Player.status[BLINDED] < 1) {
926 mprint("You can see again!");
927 Player.status[BLINDED] = 0;
928 }
929 }
930 }
931 }
932
i_illuminate(o)933 void i_illuminate(o)
934 pob o;
935 {
936 o->known = 1;
937 Objects[o->id].known = 1;
938 illuminate(o->blessing);
939 }
940
i_perm_illuminate(o)941 void i_perm_illuminate(o)
942 pob o;
943 {
944 o->known = 1;
945 Objects[o->id].known = 1;
946 if (o->used)
947 Player.status[ILLUMINATION]+=1500;
948 else
949 Player.status[ILLUMINATION]=max(0,Player.status[ILLUMINATION]-1500);
950 }
951
952
953
954
i_trap(o)955 void i_trap(o)
956 pob o;
957 {
958 Objects[o->id].known = 1;
959
960 if ((Level->site[Player.x][Player.y].locchar != FLOOR) ||
961 (Level->site[Player.x][Player.y].p_locf != L_NO_OP))
962 mprint("Your attempt fails.");
963 else if (! o->known) {
964 mprint("Fiddling with the thing, you have a small accident....");
965 p_movefunction(o->aux);
966 }
967 else {
968 mprint("You successfully set a trap at your location.");
969 Level->site[Player.x][Player.y].p_locf = o->aux;
970 lset(Player.x, Player.y, CHANGED);
971 }
972 dispose_lost_objects(1,o);
973 }
974
975
i_raise_portcullis(o)976 void i_raise_portcullis(o)
977 pob o;
978 {
979 l_raise_portcullis();
980 mprint("The box beeps once and explodes in your hands!");
981 conform_lost_objects(1,o);
982 }
983
984