root/trunk/src/effects.c

Revision 979, 34.9 kB (checked in by takkaria, 2 months ago)

Implement the mushroom of sprinting.
Forget about making a potion of mutations.
Add a potion type for the potion of dragon breath.

  • Property svn:eol-style set to native
Line 
1 /*
2  * File: effects.c
3  * Purpose: Big switch statement for every effect in the game
4  *
5  * Copyright (c) 2007 Andrew Sidwell
6  *
7  * This work is free software; you can redistribute it and/or modify it
8  * under the terms of either:
9  *
10  * a) the GNU General Public License as published by the Free Software
11  *    Foundation, version 2, or
12  *
13  * b) the "Angband licence":
14  *    This software may be copied and distributed for educational, research,
15  *    and not for profit purposes provided that this copyright and statement
16  *    are included in all such copies.  Other copyrights may also apply.
17  */
18 #include "angband.h"
19 #include "effects.h"
20
21
22 /*
23  * Entries for spell/activation descriptions
24  */
25 typedef struct
26 {
27         u16b index;          /* Effect index */
28         bool aim;            /* Whether the effect requires aiming */
29         const char *desc;    /* Effect description */
30 } info_entry;
31
32 /*
33  * Useful things about effects.
34  */
35 static const info_entry effects[] =
36 {
37         #define EFFECT(x, y, z)    { EF_##x, y, z },
38         #include "list-effects.h"
39         #undef EFFECT
40 };
41
42
43 /*
44  * Utility functions
45  */
46 bool effect_aim(effect_type effect)
47 {
48         if (effect < 1 || effect > EF_MAX)
49                 return FALSE;
50
51         return effects[effect].aim;
52 }
53
54 const char *effect_desc(effect_type effect)
55 {
56         if (effect < 1 || effect > EF_MAX)
57                 return FALSE;
58
59         return effects[effect].desc;
60 }
61
62 bool effect_obvious(effect_type effect)
63 {
64         if (effect == EF_IDENTIFY)
65                 return TRUE;
66
67         return FALSE;
68 }
69
70
71 /*
72  * The "wonder" effect.
73  *
74  * Returns TRUE if the effect is evident.
75  */
76 static bool spell_wonder(int dir, int die, int beam)
77 {
78 /* This spell should become more useful (more
79    controlled) as the player gains experience levels.
80    Thus, add 1/5 of the player's level to the die roll.
81    This eliminates the worst effects later on, while
82    keeping the results quite random.  It also allows
83    some potent effects only at high level. */
84
85         bool visible = FALSE;
86         int py = p_ptr->py;
87         int px = p_ptr->px;
88         int plev = p_ptr->lev;
89
90         if (die > 100)
91         {
92                 /* above 100 the effect is always visible */
93                 msg_print("You feel a surge of power!");
94                 visible = TRUE;
95         }
96
97         if (die < 8) visible = clone_monster(dir);
98         else if (die < 14) visible = speed_monster(dir);
99         else if (die < 26) visible = heal_monster(dir);
100         else if (die < 31) visible = poly_monster(dir);
101         else if (die < 36)
102                 visible = fire_bolt_or_beam(beam - 10, GF_MISSILE, dir,
103                                             damroll(3 + ((plev - 1) / 5), 4));
104         else if (die < 41) visible = confuse_monster(dir, plev);
105         else if (die < 46) visible = fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
106         else if (die < 51) visible = lite_line(dir);
107         else if (die < 56)
108                 visible = fire_beam(GF_ELEC, dir, damroll(3+((plev-5)/6), 6));
109         else if (die < 61)
110                 visible = fire_bolt_or_beam(beam-10, GF_COLD, dir,
111                                             damroll(5+((plev-5)/4), 8));
112         else if (die < 66)
113                 visible = fire_bolt_or_beam(beam, GF_ACID, dir,
114                                             damroll(6+((plev-5)/4), 8));
115         else if (die < 71)
116                 visible = fire_bolt_or_beam(beam, GF_FIRE, dir,
117                                             damroll(8+((plev-5)/4), 8));
118         else if (die < 76) visible = drain_life(dir, 75);
119         else if (die < 81) visible = fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
120         else if (die < 86) visible = fire_ball(GF_ACID, dir, 40 + plev, 2);
121         else if (die < 91) visible = fire_ball(GF_ICE, dir, 70 + plev, 3);
122         else if (die < 96) visible = fire_ball(GF_FIRE, dir, 80 + plev, 3);
123         /* above 100 'visible' is already true */
124         else if (die < 101) drain_life(dir, 100 + plev);
125         else if (die < 104) earthquake(py, px, 12);
126         else if (die < 106) destroy_area(py, px, 15, TRUE);
127         else if (die < 108) banishment();
128         else if (die < 110) dispel_monsters(120);
129         else /* RARE */
130         {
131                 dispel_monsters(150);
132                 slow_monsters();
133                 sleep_monsters();
134                 hp_player(300);
135         }
136
137         return visible;
138 }
139
140
141
142
143 /*
144  * Do an effect, given an object.
145  */
146 bool effect_do(effect_type effect, bool *ident, bool aware, int dir, int beam)
147 {
148         int py = p_ptr->py;
149         int px = p_ptr->px;
150
151         if (effect < 1 || effect > EF_MAX)
152         {
153                 msg_print("Bad effect passed to do_effect().  Please report this bug.");
154                 return FALSE;
155         }
156
157         switch (effect)
158         {
159                 case EF_POISON:
160                 {
161                         if (!(p_ptr->resist_pois || p_ptr->timed[TMD_OPP_POIS]))
162                         {
163                                 if (inc_timed(TMD_POISONED, damroll(2, 7) + 10))
164                                         *ident = TRUE;
165                         }
166
167                         return TRUE;
168                 }
169
170                 case EF_BLIND:
171                 {
172                         if (!p_ptr->resist_blind && inc_timed(TMD_BLIND, damroll(4, 25) + 75))
173                                 *ident = TRUE;
174
175                         return TRUE;
176                 }
177
178                 case EF_SCARE:
179                 {
180                         if (!p_ptr->resist_fear && inc_timed(TMD_AFRAID, randint0(10) + 10))
181                                 *ident = TRUE;
182
183                         return TRUE;
184                 }
185
186                 case EF_CONFUSE:
187                 {
188                         if (!p_ptr->resist_confu && inc_timed(TMD_CONFUSED, damroll(4, 5) + 10))
189                                 *ident = TRUE;
190
191                         return TRUE;
192                 }
193
194                 case EF_HALLUC:
195                 {
196                         if (!p_ptr->resist_chaos && inc_timed(TMD_IMAGE, randint0(250) + 250))
197                                 *ident = TRUE;
198
199                         return TRUE;
200                 }
201
202                 case EF_PARALYZE:
203                 {
204                         if (!p_ptr->free_act && inc_timed(TMD_PARALYZED, randint0(5) + 5))
205                                 *ident = TRUE;
206
207                         return TRUE;
208                 }
209
210                 case EF_SLOW:
211                 {
212                         if (inc_timed(TMD_SLOW, randint1(25) + 15)) *ident = TRUE;
213                         return TRUE;
214                 }
215
216                 case EF_CURE_POISON:
217                 {
218                         if (clear_timed(TMD_POISONED)) *ident = TRUE;
219                         return TRUE;
220                 }
221
222                 case EF_CURE_BLINDNESS:
223                 {
224                         if (clear_timed(TMD_BLIND)) *ident = TRUE;
225                         return TRUE;
226                 }
227
228                 case EF_CURE_PARANOIA:
229                 {
230                         if (clear_timed(TMD_AFRAID)) *ident = TRUE;
231                         return TRUE;
232                 }
233
234                 case EF_CURE_CONFUSION:
235                 {
236                         if (clear_timed(TMD_CONFUSED)) *ident = TRUE;
237                         return TRUE;
238                 }
239
240                 case EF_CURE_MIND:
241                 {
242                         if (clear_timed(TMD_CONFUSED)) *ident = TRUE;
243                         if (clear_timed(TMD_AFRAID)) *ident = TRUE;
244                         if (clear_timed(TMD_IMAGE)) *ident = TRUE;
245                         if (!p_ptr->resist_confu && inc_timed(TMD_OPP_CONF, damroll(4, 10)))
246                         return TRUE;
247                 }
248
249                 case EF_CURE_BODY:
250                 {
251                         if (clear_timed(TMD_STUN)) *ident = TRUE;
252                         if (clear_timed(TMD_CUT)) *ident = TRUE;
253                         if (clear_timed(TMD_POISONED)) *ident = TRUE;
254                         if (clear_timed(TMD_BLIND)) *ident = TRUE;
255                         return TRUE;
256                 }
257
258
259                 case EF_CURE_LIGHT:
260                 {
261                         if (heal_player(15, 15)) *ident = TRUE;
262                         if (clear_timed(TMD_BLIND)) *ident = TRUE;
263                         if (dec_timed(TMD_CUT, 20)) *ident = TRUE;
264                         if (dec_timed(TMD_CONFUSED, 20)) *ident = TRUE;
265
266                         return TRUE;
267                 }
268
269                 case EF_CURE_SERIOUS:
270                 {
271                         if (heal_player(20, 25)) *ident = TRUE;
272                         if (clear_timed(TMD_CUT)) *ident = TRUE;
273                         if (clear_timed(TMD_BLIND)) *ident = TRUE;
274                         if (clear_timed(TMD_CONFUSED)) *ident = TRUE;
275
276                         return TRUE;
277                 }
278
279                 case EF_CURE_CRITICAL:
280                 {
281                         if (heal_player(25, 30)) *ident = TRUE;
282                         if (clear_timed(TMD_BLIND)) *ident = TRUE;
283                         if (clear_timed(TMD_CONFUSED)) *ident = TRUE;
284                         if (clear_timed(TMD_POISONED)) *ident = TRUE;
285                         if (clear_timed(TMD_STUN)) *ident = TRUE;
286                         if (clear_timed(TMD_CUT)) *ident = TRUE;
287                         if (clear_timed(TMD_AMNESIA)) *ident = TRUE;
288
289                         return TRUE;
290                 }
291
292                 case EF_CURE_FULL:
293                 {
294                         if (hp_player(300)) *ident = TRUE;
295                         if (clear_timed(TMD_BLIND)) *ident = TRUE;
296                         if (clear_timed(TMD_CONFUSED)) *ident = TRUE;
297                         if (clear_timed(TMD_POISONED)) *ident = TRUE;
298                         if (clear_timed(TMD_STUN)) *ident = TRUE;
299                         if (clear_timed(TMD_CUT)) *ident = TRUE;
300                         if (clear_timed(TMD_AMNESIA)) *ident = TRUE;
301                         return TRUE;
302                 }
303
304                 case EF_CURE_FULL2:
305                 {
306                         if (hp_player(1200)) *ident = TRUE;
307                         if (clear_timed(TMD_BLIND)) *ident = TRUE;
308                         if (clear_timed(TMD_CONFUSED)) *ident = TRUE;
309                         if (clear_timed(TMD_POISONED)) *ident = TRUE;
310                         if (clear_timed(TMD_STUN)) *ident = TRUE;
311                         if (clear_timed(TMD_CUT)) *ident = TRUE;
312                         if (clear_timed(TMD_AMNESIA)) *ident = TRUE;
313                         return TRUE;
314                 }
315
316                 case EF_CURE_TEMP:
317                 {
318                         if (clear_timed(TMD_BLIND)) *ident = TRUE;
319                         if (clear_timed(TMD_POISONED)) *ident = TRUE;
320                         if (clear_timed(TMD_CONFUSED)) *ident = TRUE;
321                         if (clear_timed(TMD_STUN)) *ident = TRUE;
322                         if (clear_timed(TMD_CUT)) *ident = TRUE;
323                         return TRUE;
324                 }
325
326                 case EF_HEAL1:
327                 {
328                         if (hp_player(500)) *ident = TRUE;
329                         if (clear_timed(TMD_CUT)) *ident = TRUE;
330                         return TRUE;
331                 }
332
333                 case EF_HEAL2:
334                 {
335                         if (hp_player(1000)) *ident = TRUE;
336                         if (clear_timed(TMD_CUT)) *ident = TRUE;
337                         return TRUE;
338                 }
339
340                 case EF_HEAL3:
341                 {
342                         if (hp_player(500)) *ident = TRUE;
343                         if (clear_timed(TMD_STUN)) *ident = TRUE;
344                         if (clear_timed(TMD_CUT)) *ident = TRUE;
345                         return TRUE;
346                 }
347
348
349                 case EF_GAIN_EXP:
350                 {
351                         if (p_ptr->exp < PY_MAX_EXP)
352                         {
353                                 s32b ee = (p_ptr->exp / 2) + 10;
354                                 if (ee > 100000L) ee = 100000L;
355                                 msg_print("You feel more experienced.");
356                                 gain_exp(ee);
357                                 *ident = TRUE;
358                         }
359                         return TRUE;
360                 }
361
362                 case EF_LOSE_EXP:
363                 {
364                         if (!p_ptr->hold_life && (p_ptr->exp > 0))
365                         {
366                                 msg_print("You feel your memories fade.");
367                                 lose_exp(p_ptr->exp / 4);
368                                 *ident = TRUE;
369                         }
370                         return TRUE;
371                 }
372
373                 case EF_RESTORE_EXP:
374                 {
375                         if (restore_level()) *ident = TRUE;
376                         return TRUE;
377                 }
378
379                 case EF_RESTORE_MANA:
380                 {
381                         if (p_ptr->csp < p_ptr->msp)
382                         {
383                                 p_ptr->csp = p_ptr->msp;
384                                 p_ptr->csp_frac = 0;
385                                 msg_print("Your feel your head clear.");
386                                 p_ptr->redraw |= (PR_MANA);
387                                 *ident = TRUE;
388                         }
389                         return TRUE;
390                 }
391
392                 case EF_GAIN_STR:
393                 case EF_GAIN_INT:
394                 case EF_GAIN_WIS:
395                 case EF_GAIN_DEX:
396                 case EF_GAIN_CON:
397                 case EF_GAIN_CHR:
398                 {
399                         int stat = effect - EF_GAIN_STR;
400                         if (do_inc_stat(stat)) *ident = TRUE;
401                         return TRUE;
402                 }
403
404                 case EF_GAIN_ALL:
405                 {
406                         if (do_inc_stat(A_STR)) *ident = TRUE;
407                         if (do_inc_stat(A_INT)) *ident = TRUE;
408                         if (do_inc_stat(A_WIS)) *ident = TRUE;
409                         if (do_inc_stat(A_DEX)) *ident = TRUE;
410                         if (do_inc_stat(A_CON)) *ident = TRUE;
411                         if (do_inc_stat(A_CHR)) *ident = TRUE;
412                         return TRUE;
413                 }
414
415                 case EF_BRAWN:
416                 {
417                         /* Pick a random stat to decrease other than strength */
418                         int stat = randint0(A_MAX-1) + 1;
419                        
420                         if (!do_dec_stat(stat, TRUE)) return FALSE;
421                         if (do_inc_stat(A_STR)) *ident = TRUE;
422                         return TRUE;
423                 }
424
425                 case EF_INTELLECT:
426                 {
427                         /* Pick a random stat to decrease other than intelligence */
428                         int stat = randint0(A_MAX-1);
429                         if (stat >= A_INT) stat++;
430                        
431                         if (!do_dec_stat(stat, TRUE)) return FALSE;
432                         if (do_inc_stat(A_INT)) *ident = TRUE;
433                         return TRUE;
434                 }
435
436                 case EF_CONTEMPLATION:
437                 {
438                         /* Pick a random stat to decrease other than wisdom */
439                         int stat = randint0(A_MAX-1);
440                         if (stat >= A_WIS) stat++;
441                        
442                         if (!do_dec_stat(stat, TRUE)) return FALSE;
443                         if (do_inc_stat(A_WIS)) *ident = TRUE;
444                         return TRUE;
445                 }
446
447                 case EF_TOUGHNESS:
448                 {
449                         /* Pick a random stat to decrease other than constitution */
450                         int stat = randint0(A_MAX-1);
451                         if (stat >= A_CON) stat++;
452                        
453                         if (!do_dec_stat(stat, TRUE)) return FALSE;
454                         if (do_inc_stat(A_CON)) *ident = TRUE;
455                         return TRUE;
456                 }
457
458                 case EF_NIMBLENESS:
459                 {
460                         /* Pick a random stat to decrease other than dexterity */
461                         int stat = randint0(A_MAX-1);
462                         if (stat >= A_DEX) stat++;
463                        
464                         if (!do_dec_stat(stat, TRUE)) return FALSE;
465                         if (do_inc_stat(A_DEX)) *ident = TRUE;
466                         return TRUE;
467                 }
468
469                 case EF_PLEASING:
470                 {
471                         /* Pick a random stat to decrease other than charisma */
472                         int stat = randint0(A_MAX-1);
473                        
474                         if (!do_dec_stat(stat, TRUE)) return FALSE;
475                         if (do_inc_stat(A_CHR)) *ident = TRUE;
476                         return TRUE;
477                 }
478
479                 case EF_LOSE_STR:
480                 case EF_LOSE_INT:
481                 case EF_LOSE_WIS:
482                 case EF_LOSE_DEX:
483                 case EF_LOSE_CON:
484                 case EF_LOSE_CHR:
485                 {
486                         int stat = effect - EF_LOSE_STR;
487
488                         take_hit(damroll(5, 5), "stat drain");
489                         (void)do_dec_stat(stat, FALSE);
490                         *ident = TRUE;
491
492                         return TRUE;
493                 }
494
495                 case EF_LOSE_CON2:
496                 {
497                         take_hit(damroll(10, 10), "poisonous food");
498                         (void)do_dec_stat(A_CON, FALSE);
499                         *ident = TRUE;
500
501                         return TRUE;
502                 }
503
504                 case EF_RESTORE_STR:
505                 case EF_RESTORE_INT:
506                 case EF_RESTORE_WIS:
507                 case EF_RESTORE_DEX:
508                 case EF_RESTORE_CON:
509                 case EF_RESTORE_CHR:
510                 {
511                         int stat = effect - EF_RESTORE_STR;
512                         if (do_res_stat(stat)) *ident = TRUE;
513                         return TRUE;
514                 }
515
516                 case EF_CURE_NONORLYBIG:
517                 {
518                         msg_print("You feel life flow through your body!");
519                         restore_level();
520                         (void)clear_timed(TMD_POISONED);
521                         (void)clear_timed(TMD_BLIND);
522                         (void)clear_timed(TMD_CONFUSED);
523                         (void)clear_timed(TMD_IMAGE);
524                         (void)clear_timed(TMD_STUN);
525                         (void)clear_timed(TMD_CUT);
526                         (void)clear_timed(TMD_AMNESIA);
527
528                         /* Recalculate max. hitpoints */
529                         update_stuff();
530
531                         hp_player(5000);
532
533                         *ident = TRUE;
534
535                         /* Now restore all */
536                 }
537
538                 case EF_RESTORE_ALL:
539                 {
540                         if (do_res_stat(A_STR)) *ident = TRUE;
541                         if (do_res_stat(A_INT)) *ident = TRUE;
542                         if (do_res_stat(A_WIS)) *ident = TRUE;
543                         if (do_res_stat(A_DEX)) *ident = TRUE;
544                         if (do_res_stat(A_CON)) *ident = TRUE;
545                         if (do_res_stat(A_CHR)) *ident = TRUE;
546                         return TRUE;
547                 }
548
549                 case EF_RESTORE_ST_LEV:
550                 {
551                         if (restore_level()) *ident = TRUE;
552                         if (do_res_stat(A_STR)) *ident = TRUE;
553                         if (do_res_stat(A_INT)) *ident = TRUE;
554                         if (do_res_stat(A_WIS)) *ident = TRUE;
555                         if (do_res_stat(A_DEX)) *ident = TRUE;
556                         if (do_res_stat(A_CON)) *ident = TRUE;
557                         if (do_res_stat(A_CHR)) *ident = TRUE;
558                         return TRUE;
559                 }
560
561
562                 case EF_TMD_INFRA:
563                 {
564                         if (inc_timed(TMD_SINFRA, 100 + damroll(4, 25))) *ident = TRUE;
565                         return TRUE;
566                 }
567
568                 case EF_TMD_SINVIS:
569                 {
570                         if (clear_timed(TMD_BLIND)) *ident = TRUE;
571                         if (inc_timed(TMD_SINVIS, 12 + damroll(2, 6))) *ident = TRUE;
572                         return TRUE;
573                 }
574
575                 case EF_TMD_ESP:
576                 {
577                         if (clear_timed(TMD_BLIND)) *ident = TRUE;
578                         if (inc_timed(TMD_TELEPATHY, 12 + damroll(6, 6))) *ident = TRUE;
579                         return TRUE;
580                 }
581
582
583                 case EF_ENLIGHTENMENT:
584                 {
585                         msg_print("An image of your surroundings forms in your mind...");
586                         wiz_lite();
587                         *ident = TRUE;
588                         return TRUE;
589                 }
590
591
592                 case EF_ENLIGHTENMENT2:
593                 {
594                         msg_print("You begin to feel more enlightened...");
595                         message_flush();
596                         wiz_lite();
597                         (void)do_inc_stat(A_INT);
598                         (void)do_inc_stat(A_WIS);
599                         (void)detect_traps(TRUE);
600                         (void)detect_doorstairs(TRUE);
601                         (void)detect_treasure(TRUE);
602                         identify_pack();
603                         self_knowledge(TRUE);
604                         *ident = TRUE;
605                         return TRUE;
606                 }
607
608                 case EF_SELF_KNOW:
609                 {
610                         msg_print("You begin to know yourself a little better...");
611                         message_flush();
612                         self_knowledge(TRUE);
613                         *ident = TRUE;
614                         return TRUE;
615                 }
616
617
618                 case EF_HERO:
619                 {
620                         if (hp_player(10)) *ident = TRUE;
621                         if (clear_timed(TMD_AFRAID)) *ident = TRUE;
622                         if (inc_timed(TMD_HERO, randint1(25) + 25)) *ident = TRUE;
623                         return TRUE;
624                 }
625
626                 case EF_SHERO:
627                 {
628                         if (hp_player(30)) *ident = TRUE;
629                         if (clear_timed(TMD_AFRAID)) *ident = TRUE;
630                         if (inc_timed(TMD_SHERO, randint1(25) + 25)) *ident = TRUE;
631                         return TRUE;
632                 }
633
634
635                 case EF_RESIST_ACID:
636                 {
637                         if (inc_timed(TMD_OPP_ACID, randint1(10) + 10))
638                                 *ident = TRUE;
639                         return TRUE;
640                 }
641
642                 case EF_RESIST_ELEC:
643                 {
644                         if (inc_timed(TMD_OPP_ELEC, randint1(10) + 10))
645                                 *ident = TRUE;
646                         return TRUE;
647                 }
648
649                 case EF_RESIST_FIRE:
650                 {
651                         if (inc_timed(TMD_OPP_FIRE, randint1(10) + 10))
652                                 *ident = TRUE;
653                         return TRUE;
654                 }
655
656                 case EF_RESIST_COLD:
657                 {
658                         if (inc_timed(TMD_OPP_COLD, randint1(10) + 10))
659                                 *ident = TRUE;
660                         return TRUE;
661                 }
662
663                 case EF_RESIST_POIS:
664                 {
665                         if (inc_timed(TMD_OPP_POIS, randint1(10) + 10))
666                                 *ident = TRUE;
667                         return TRUE;
668                 }
669
670                 case EF_RESIST_ALL:
671                 {
672                         if (inc_timed(TMD_OPP_ACID, randint1(20) + 20)) *ident = TRUE;
673                         if (inc_timed(TMD_OPP_ELEC, randint1(20) + 20)) *ident = TRUE;
674                         if (inc_timed(TMD_OPP_FIRE, randint1(20) + 20)) *ident = TRUE;
675                         if (inc_timed(TMD_OPP_COLD, randint1(20) + 20)) *ident = TRUE;
676                         if (inc_timed(TMD_OPP_POIS, randint1(20) + 20)) *ident = TRUE;
677                         return TRUE;
678                 }
679
680                 case EF_DETECT_TREASURE:
681                 {
682                         if (detect_treasure(aware)) *ident = TRUE;
683                         return TRUE;
684                 }
685
686                 case EF_DETECT_TRAP:
687                 {
688                         if (detect_traps(aware)) *ident = TRUE;
689                         return TRUE;
690                 }
691
692                 case EF_DETECT_DOORSTAIR:
693                 {
694                         if (detect_doorstairs(aware)) *ident = TRUE;
695                         return TRUE;
696                 }
697
698                 case EF_DETECT_INVIS:
699                 {
700                         if (detect_monsters_invis(aware)) *ident = TRUE;
701                         return TRUE;
702                 }
703
704                 case EF_DETECT_EVIL:
705                 {
706                         if (detect_monsters_evil(aware)) *ident = TRUE;
707                         return TRUE;
708                 }
709
710                 case EF_DETECT_ALL:
711                 {
712                         if (detect_all(aware)) *ident = TRUE;
713                         return TRUE;
714                 }
715
716
717                 case EF_ENCHANT_TOHIT:
718                 {
719                         *ident = TRUE;
720                         if (!enchant_spell(1, 0, 0)) return FALSE;
721                         return TRUE;
722                 }
723
724                 case EF_ENCHANT_TODAM:
725                 {
726                         *ident = TRUE;
727                         if (!enchant_spell(0, 1, 0)) return FALSE;
728                         return TRUE;
729                 }
730
731                 case EF_ENCHANT_WEAPON:
732                 {
733                         *ident = TRUE;
734                         if (!enchant_spell(randint1(3), randint1(3), 0)) return FALSE;
735                         return TRUE;
736                 }
737
738                 case EF_ENCHANT_ARMOR:
739                 {
740                         if (!enchant_spell(0, 0, 1)) return FALSE;
741                         *ident = TRUE;
742                         return TRUE;
743                 }
744
745                 case EF_ENCHANT_ARMOR2:
746                 {
747                         *ident = TRUE;
748                         if (!enchant_spell(0, 0, randint1(3) + 2)) return FALSE;
749                         return TRUE;
750                 }
751
752                 case EF_IDENTIFY:
753                 {
754                         *ident = TRUE;
755                         if (!ident_spell()) return FALSE;
756                         return TRUE;
757                 }
758
759                 case EF_REMOVE_CURSE:
760                 {
761                         if (remove_curse())
762                         {
763                                 if (!p_ptr->timed[TMD_BLIND])
764                                         msg_print("The air around your body glows blue for a moment...");
765                                 else
766                                         msg_print("You feel as if someone is watching over you.");
767
768                                 *ident = TRUE;
769                         }
770                         return TRUE;
771                 }
772
773                 case EF_REMOVE_CURSE2:
774                 {
775