OSDN Git Service

Extend features of tiling. (separation of Cell size and Tile size / add offset position.)
[hengband/hengband.git] / src / hissatsu.c
1 /*!
2  * @file hissatsu.c
3  * @brief ·õ½Ñ¤Î¼ÂÁõ / Blade arts
4  * @date 2014/01/17
5  * @author
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
7  * This software may be copied and distributed for educational, research,\n
8  * and not for profit purposes provided that this copyright and statement\n
9  * are included in all such copies.  Other copyrights may also apply.\n
10  * 2014 Deskull rearranged comment for Doxygen.\n
11  */
12
13 #include "angband.h"
14
15 #define TECHNIC_HISSATSU (REALM_HISSATSU - MIN_TECHNIC)
16
17
18 /*!
19  * @brief »ÈÍѲÄǽ¤Ê·õ½Ñ¤òÁªÂò¤¹¤ë /
20  * Allow user to choose a blade arts.
21  * @param sn ÁªÂò¤·¤¿Æü쵻ǽID¡¢¥­¥ã¥ó¥»¥ë¤Î¾ì¹ç-1¡¢ÉÔÀµ¤ÊÁªÂò¤Î¾ì¹ç-2¤òÊÖ¤¹
22  * @return È¯Æ°²Äǽ¤ÊËâË¡¤òÁªÂò¤·¤¿¾ì¹çTRUE¡¢¥­¥ã¥ó¥»¥ë½èÍý¤«ÉÔÀµ¤ÊÁªÂò¤¬¹Ô¤ï¤ì¤¿¾ì¹çFALSE¤òÊÖ¤¹¡£
23  * @details
24  * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
25  * If the user hits escape, returns FALSE, and set '*sn' to -1\n
26  * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n
27  *\n
28  * The "prompt" should be "cast", "recite", or "study"\n
29  * The "known" should be TRUE for cast/pray, FALSE for study\n
30  *\n
31  * nb: This function has a (trivial) display bug which will be obvious\n
32  * when you run it. It's probably easy to fix but I haven't tried,\n
33  * sorry.\n
34  */
35 static int get_hissatsu_power(int *sn)
36 {
37         int             i, j = 0;
38         int             num = 0;
39         int             y = 1;
40         int             x = 15;
41         int             plev = p_ptr->lev;
42         int             ask = TRUE;
43         char            choice;
44         char            out_val[160];
45         char sentaku[32];
46 #ifdef JP
47 cptr            p = "ɬ»¦·õ";
48 #else
49         cptr            p = "special attack";
50 #endif
51
52         magic_type spell;
53         bool            flag, redraw;
54         int menu_line = (use_menu ? 1 : 0);
55
56         /* Assume cancelled */
57         *sn = (-1);
58
59 #ifdef ALLOW_REPEAT /* TNB */
60
61         /* Get the spell, if available */
62         if (repeat_pull(sn))
63         {
64                 /* Verify the spell */
65                 if (technic_info[TECHNIC_HISSATSU][*sn].slevel <= plev)
66                 {
67                         /* Success */
68                         return (TRUE);
69                 }
70         }
71
72 #endif /* ALLOW_REPEAT -- TNB */
73
74         /* Nothing chosen yet */
75         flag = FALSE;
76
77         /* No redraw yet */
78         redraw = FALSE;
79
80         for (i = 0; i < 32; i++)
81         {
82                 if (technic_info[TECHNIC_HISSATSU][i].slevel <= PY_MAX_LEVEL)
83                 {
84                         sentaku[num] = i;
85                         num++;
86                 }
87         }
88
89         /* Build a prompt (accept all spells) */
90         (void) strnfmt(out_val, 78, 
91 #ifdef JP
92                        "(%^s %c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤ò»È¤¤¤Þ¤¹¤«¡©",
93 #else
94                        "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
95 #endif
96                        p, I2A(0), "abcdefghijklmnopqrstuvwxyz012345"[num-1], p);
97
98         if (use_menu) screen_save();
99
100         /* Get a spell from the user */
101
102         choice= always_show_list ? ESCAPE:1 ;
103         while (!flag)
104         {
105                 if(choice==ESCAPE) choice = ' '; 
106                 else if( !get_com(out_val, &choice, FALSE) )break;
107
108                 if (use_menu && choice != ' ')
109                 {
110                         switch(choice)
111                         {
112                                 case '0':
113                                 {
114                                         screen_load();
115                                         return (FALSE);
116                                 }
117
118                                 case '8':
119                                 case 'k':
120                                 case 'K':
121                                 {
122                                         do
123                                         {
124                                                 menu_line += 31;
125                                                 if (menu_line > 32) menu_line -= 32;
126                                         } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
127                                         break;
128                                 }
129
130                                 case '2':
131                                 case 'j':
132                                 case 'J':
133                                 {
134                                         do
135                                         {
136                                                 menu_line++;
137                                                 if (menu_line > 32) menu_line -= 32;
138                                         } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
139                                         break;
140                                 }
141
142                                 case '4':
143                                 case 'h':
144                                 case 'H':
145                                 case '6':
146                                 case 'l':
147                                 case 'L':
148                                 {
149                                         bool reverse = FALSE;
150                                         if ((choice == '4') || (choice == 'h') || (choice == 'H')) reverse = TRUE;
151                                         if (menu_line > 16)
152                                         {
153                                                 menu_line -= 16;
154                                                 reverse = TRUE;
155                                         }
156                                         else menu_line+=16;
157                                         while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))))
158                                         {
159                                                 if (reverse)
160                                                 {
161                                                         menu_line--;
162                                                         if (menu_line < 2) reverse = FALSE;
163                                                 }
164                                                 else
165                                                 {
166                                                         menu_line++;
167                                                         if (menu_line > 31) reverse = TRUE;
168                                                 }
169                                         }
170                                         break;
171                                 }
172
173                                 case 'x':
174                                 case 'X':
175                                 case '\r':
176                                 case '\n':
177                                 {
178                                         i = menu_line - 1;
179                                         ask = FALSE;
180                                         break;
181                                 }
182                         }
183                 }
184                 /* Request redraw */
185                 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
186                 {
187                         /* Show the list */
188                         if (!redraw || use_menu)
189                         {
190                                 char psi_desc[80];
191                                 int line;
192
193                                 /* Show list */
194                                 redraw = TRUE;
195
196                                 /* Save the screen */
197                                 if (!use_menu) screen_save();
198
199                                 /* Display a list of spells */
200                                 prt("", y, x);
201 #ifdef JP
202 put_str("̾Á°              Lv  MP      Ì¾Á°              Lv  MP ", y, x + 5);
203 #else
204 put_str("name              Lv  SP      name              Lv  SP ", y, x + 5);
205 #endif
206                                 prt("", y+1, x);
207                                 /* Dump the spells */
208                                 for (i = 0, line = 0; i < 32; i++)
209                                 {
210                                         spell = technic_info[TECHNIC_HISSATSU][i];
211
212                                         if (spell.slevel > PY_MAX_LEVEL) continue;
213                                         line++;
214                                         if (!(p_ptr->spell_learned1 >> i)) break;
215
216                                         /* Access the spell */
217                                         if (spell.slevel > plev)   continue;
218                                         if (!(p_ptr->spell_learned1 & (1L << i))) continue;
219                                         if (use_menu)
220                                         {
221                                                 if (i == (menu_line-1))
222 #ifdef JP
223                                                         strcpy(psi_desc, "  ¡Õ");
224 #else
225                                                         strcpy(psi_desc, "  > ");
226 #endif
227                                                 else strcpy(psi_desc, "    ");
228                                                 
229                                         }
230                                         else
231                                         {
232                                                 char letter;
233                                                 if (line <= 26)
234                                                         letter = I2A(line-1);
235                                                 else
236                                                         letter = '0' + line - 27;
237                                                 sprintf(psi_desc, "  %c)",letter);
238                                         }
239
240                                         /* Dump the spell --(-- */
241                                         strcat(psi_desc, format(" %-18s%2d %3d",
242                                                 do_spell(REALM_HISSATSU, i, SPELL_NAME),
243                                                 spell.slevel, spell.smana));
244                                         prt(psi_desc, y + (line%17) + (line >= 17), x+(line/17)*30);
245                                         prt("", y + (line%17) + (line >= 17) + 1, x+(line/17)*30);
246                                 }
247                         }
248
249                         /* Hide the list */
250                         else
251                         {
252                                 /* Hide list */
253                                 redraw = FALSE;
254
255                                 /* Restore the screen */
256                                 screen_load();
257                         }
258
259                         /* Redo asking */
260                         continue;
261                 }
262
263                 if (!use_menu)
264                 {
265                         if (isalpha(choice))
266                         {
267                                 /* Note verify */
268                                 ask = (isupper(choice));
269
270                                 /* Lowercase */
271                                 if (ask) choice = tolower(choice);
272
273                                 /* Extract request */
274                                 i = (islower(choice) ? A2I(choice) : -1);
275                         }
276                         else
277                         {
278                                 ask = FALSE; /* Can't uppercase digits */
279
280                                 i = choice - '0' + 26;
281                         }
282                 }
283
284                 /* Totally Illegal */
285                 if ((i < 0) || (i >= 32) || !(p_ptr->spell_learned1 & (1 << sentaku[i])))
286                 {
287                         bell();
288                         continue;
289                 }
290
291                 j = sentaku[i];
292
293                 /* Verify it */
294                 if (ask)
295                 {
296                         char tmp_val[160];
297
298                         /* Prompt */
299 #ifdef JP
300                         (void) strnfmt(tmp_val, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡©", do_spell(REALM_HISSATSU, j, SPELL_NAME));
301 #else
302                         (void)strnfmt(tmp_val, 78, "Use %s? ", do_spell(REALM_HISSATSU, j, SPELL_NAME));
303 #endif
304
305
306                         /* Belay that order */
307                         if (!get_check(tmp_val)) continue;
308                 }
309
310                 /* Stop the loop */
311                 flag = TRUE;
312         }
313
314         /* Restore the screen */
315         if (redraw) screen_load();
316
317         /* Show choices */
318         p_ptr->window |= (PW_SPELL);
319
320         /* Window stuff */
321         window_stuff();
322
323
324         /* Abort if needed */
325         if (!flag) return (FALSE);
326
327         /* Save the choice */
328         (*sn) = j;
329
330 #ifdef ALLOW_REPEAT /* TNB */
331
332         repeat_push(*sn);
333
334 #endif /* ALLOW_REPEAT -- TNB */
335
336         /* Success */
337         return (TRUE);
338 }
339
340
341 /*!
342  * @brief ·õ½Ñ¥³¥Þ¥ó¥É¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó
343  * @return ¤Ê¤·
344  */
345 void do_cmd_hissatsu(void)
346 {
347         int             n = 0;
348         magic_type      spell;
349
350
351         /* not if confused */
352         if (p_ptr->confused)
353         {
354 #ifdef JP
355 msg_print("º®Í𤷤Ƥ¤¤Æ½¸Ãæ¤Ç¤­¤Ê¤¤¡ª");
356 #else
357                 msg_print("You are too confused!");
358 #endif
359
360                 return;
361         }
362         if (!buki_motteruka(INVEN_RARM) && !buki_motteruka(INVEN_LARM))
363         {
364                 if (flush_failure) flush();
365 #ifdef JP
366 msg_print("Éð´ï¤ò»ý¤¿¤Ê¤¤¤Èɬ»¦µ»¤Ï»È¤¨¤Ê¤¤¡ª");
367 #else
368                 msg_print("You need to wield a weapon!");
369 #endif
370
371                 return;
372         }
373         if (!p_ptr->spell_learned1)
374         {
375 #ifdef JP
376 msg_print("²¿¤âµ»¤òÃΤé¤Ê¤¤¡£");
377 #else
378                 msg_print("You don't know any special attacks.");
379 #endif
380
381                 return;
382         }
383
384         if (p_ptr->special_defense & KATA_MASK)
385         {
386                 set_action(ACTION_NONE);
387         }
388
389         /* get power */
390         if (!get_hissatsu_power(&n)) return;
391
392         spell = technic_info[TECHNIC_HISSATSU][n];
393
394         /* Verify "dangerous" spells */
395         if (spell.smana > p_ptr->csp)
396         {
397                 if (flush_failure) flush();
398                 /* Warning */
399 #ifdef JP
400 msg_print("£Í£Ð¤¬Â­¤ê¤Þ¤»¤ó¡£");
401 #else
402                 msg_print("You do not have enough mana to use this power.");
403 #endif
404                 msg_print(NULL);
405                 return;
406         }
407
408         sound(SOUND_ZAP);
409
410         /* Cast the spell */
411         if (!do_spell(REALM_HISSATSU, n, SPELL_CAST)) return;
412
413         /* Take a turn */
414         energy_use = 100;
415
416         /* Use some mana */
417         p_ptr->csp -= spell.smana;
418
419         /* Limit */
420         if (p_ptr->csp < 0) p_ptr->csp = 0;
421
422         /* Redraw mana */
423         p_ptr->redraw |= (PR_MANA);
424
425         /* Window stuff */
426         p_ptr->window |= (PW_PLAYER);
427         p_ptr->window |= (PW_SPELL);
428 }
429
430
431 /*!
432  * @brief ·õ½Ñ¥³¥Þ¥ó¥É¤Î³Ø½¬
433  * @return ¤Ê¤·
434  */
435 void do_cmd_gain_hissatsu(void)
436 {
437         int item, i, j;
438
439         object_type *o_ptr;
440         cptr q, s;
441
442         bool gain = FALSE;
443
444         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
445         {
446                 set_action(ACTION_NONE);
447         }
448
449         if (p_ptr->blind || no_lite())
450         {
451 #ifdef JP
452 msg_print("Ìܤ¬¸«¤¨¤Ê¤¤¡ª");
453 #else
454                 msg_print("You cannot see!");
455 #endif
456
457                 return;
458         }
459
460         if (p_ptr->confused)
461         {
462 #ifdef JP
463 msg_print("º®Í𤷤Ƥ¤¤ÆÆɤá¤Ê¤¤¡ª");
464 #else
465                 msg_print("You are too confused!");
466 #endif
467
468                 return;
469         }
470
471         if (!(p_ptr->new_spells))
472         {
473 #ifdef JP
474 msg_print("¿·¤·¤¤É¬»¦µ»¤ò³Ð¤¨¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡ª");
475 #else
476                 msg_print("You cannot learn any new special attacks!");
477 #endif
478
479                 return;
480         }
481
482 #ifdef JP
483         if( p_ptr->new_spells < 10 ){
484                 msg_format("¤¢¤È %d ¤Ä¤Îɬ»¦µ»¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells);
485         }else{
486                 msg_format("¤¢¤È %d ¸Ä¤Îɬ»¦µ»¤ò³Ø¤Ù¤ë¡£", p_ptr->new_spells);
487         }
488 #else
489         msg_format("You can learn %d new special attack%s.", p_ptr->new_spells,
490                 (p_ptr->new_spells == 1?"":"s"));
491 #endif
492
493         item_tester_tval = TV_HISSATSU_BOOK;
494
495         /* Get an item */
496 #ifdef JP
497 q = "¤É¤Î½ñ¤«¤é³Ø¤Ó¤Þ¤¹¤«? ";
498 #else
499         q = "Study which book? ";
500 #endif
501
502 #ifdef JP
503 s = "Æɤá¤ë½ñ¤¬¤Ê¤¤¡£";
504 #else
505         s = "You have no books that you can read.";
506 #endif
507
508         if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
509
510         /* Get the item (in the pack) */
511         if (item >= 0)
512         {
513                 o_ptr = &inventory[item];
514         }
515
516         /* Get the item (on the floor) */
517         else
518         {
519                 o_ptr = &o_list[0 - item];
520         }
521
522         for (i = o_ptr->sval * 8; i < o_ptr->sval * 8 + 8; i++)
523         {
524                 if (p_ptr->spell_learned1 & (1L << i)) continue;
525                 if (technic_info[TECHNIC_HISSATSU][i].slevel > p_ptr->lev) continue;
526
527                 p_ptr->spell_learned1 |= (1L << i);
528                 p_ptr->spell_worked1 |= (1L << i);
529 #ifdef JP
530                 msg_format("%s¤Îµ»¤ò³Ð¤¨¤¿¡£", do_spell(REALM_HISSATSU, i, SPELL_NAME));
531 #else
532                 msg_format("You have learned the special attack of %s.", do_spell(REALM_HISSATSU, i, SPELL_NAME));
533 #endif
534                 for (j = 0; j < 64; j++)
535                 {
536                         /* Stop at the first empty space */
537                         if (p_ptr->spell_order[j] == 99) break;
538                 }
539                 p_ptr->spell_order[j] = i;
540                 gain = TRUE;
541         }
542
543         /* No gain ... */
544         if (!gain)
545 #ifdef JP
546                 msg_print("²¿¤â³Ð¤¨¤é¤ì¤Ê¤«¤Ã¤¿¡£");
547 #else
548                 msg_print("You were not able to learn any special attacks.");
549 #endif
550
551         /* Take a turn */
552         else
553                 energy_use = 100;
554
555         p_ptr->update |= (PU_SPELLS);
556 }
557
558
559 /*!
560  * @brief ·õ½Ñ¤Î¥¹¥ì¥¤ÇÜΨ·×»»¤ò¹Ô¤¦ /
561  * Calcurate magnification of hissatsu technics
562  * @param mult ·õ½Ñ¤Î¥¹¥ì¥¤¸ú²Ì°ÊÁ°¤Ë»»½Ð¤·¤Æ¤¤¤ë¿Í×ÁǤÎÇÜΨ(/10ÇÜ)
563  * @param flgs ·õ½Ñ¤Ë»ÈÍѤ¹¤ëÉð´ï¤Î¥¹¥ì¥¤¥Õ¥é¥°ÇÛÎó
564  * @param m_ptr ÌÜɸ¤È¤Ê¤ë¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
565  * @param mode ·õ½Ñ¤Î¥¹¥ì¥¤·¿ID
566  * @return ¥¹¥ì¥¤¤ÎÇÜΨ(/10ÇÜ)
567  */
568 s16b mult_hissatsu(int mult, u32b *flgs, monster_type *m_ptr, int mode)
569 {
570         monster_race *r_ptr = &r_info[m_ptr->r_idx];
571
572         /* Burning Strike (Fire) */
573         if (mode == HISSATSU_FIRE)
574         {
575                 /* Notice immunity */
576                 if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
577                 {
578                         if (is_original_ap_and_seen(m_ptr))
579                         {
580                                 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
581                         }
582                 }
583
584                 /* Otherwise, take the damage */
585                 else if (have_flag(flgs, TR_BRAND_FIRE))
586                 {
587                         if (r_ptr->flags3 & RF3_HURT_FIRE)
588                         {
589                                 if (mult < 70) mult = 70;
590                                 if (is_original_ap_and_seen(m_ptr))
591                                 {
592                                         r_ptr->r_flags3 |= RF3_HURT_FIRE;
593                                 }
594                         }
595                         else if (mult < 35) mult = 35;
596                 }
597                 else
598                 {
599                         if (r_ptr->flags3 & RF3_HURT_FIRE)
600                         {
601                                 if (mult < 50) mult = 50;
602                                 if (is_original_ap_and_seen(m_ptr))
603                                 {
604                                         r_ptr->r_flags3 |= RF3_HURT_FIRE;
605                                 }
606                         }
607                         else if (mult < 25) mult = 25;
608                 }
609         }
610
611         /* Serpent's Tongue (Poison) */
612         if (mode == HISSATSU_POISON)
613         {
614                 /* Notice immunity */
615                 if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
616                 {
617                         if (is_original_ap_and_seen(m_ptr))
618                         {
619                                 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
620                         }
621                 }
622
623                 /* Otherwise, take the damage */
624                 else if (have_flag(flgs, TR_BRAND_POIS))
625                 {
626                         if (mult < 35) mult = 35;
627                 }
628                 else
629                 {
630                         if (mult < 25) mult = 25;
631                 }
632         }
633
634         /* Zammaken (Nonliving Evil) */
635         if (mode == HISSATSU_ZANMA)
636         {
637                 if (!monster_living(r_ptr) && (r_ptr->flags3 & RF3_EVIL))
638                 {
639                         if (mult < 15) mult = 25;
640                         else if (mult < 50) mult = MIN(50, mult+20);
641                 }
642         }
643
644         /* Rock Smash (Hurt Rock) */
645         if (mode == HISSATSU_HAGAN)
646         {
647                 if (r_ptr->flags3 & RF3_HURT_ROCK)
648                 {
649                         if (is_original_ap_and_seen(m_ptr))
650                         {
651                                 r_ptr->r_flags3 |= RF3_HURT_ROCK;
652                         }
653                         if (mult == 10) mult = 40;
654                         else if (mult < 60) mult = 60;
655                 }
656         }
657
658         /* Midare-Setsugekka (Cold) */
659         if (mode == HISSATSU_COLD)
660         {
661                 /* Notice immunity */
662                 if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
663                 {
664                         if (is_original_ap_and_seen(m_ptr))
665                         {
666                                 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
667                         }
668                 }
669                 /* Otherwise, take the damage */
670                 else if (have_flag(flgs, TR_BRAND_COLD))
671                 {
672                         if (r_ptr->flags3 & RF3_HURT_COLD)
673                         {
674                                 if (mult < 70) mult = 70;
675                                 if (is_original_ap_and_seen(m_ptr))
676                                 {
677                                         r_ptr->r_flags3 |= RF3_HURT_COLD;
678                                 }
679                         }
680                         else if (mult < 35) mult = 35;
681                 }
682                 else
683                 {
684                         if (r_ptr->flags3 & RF3_HURT_COLD)
685                         {
686                                 if (mult < 50) mult = 50;
687                                 if (is_original_ap_and_seen(m_ptr))
688                                 {
689                                         r_ptr->r_flags3 |= RF3_HURT_COLD;
690                                 }
691                         }
692                         else if (mult < 25) mult = 25;
693                 }
694         }
695
696         /* Lightning Eagle (Elec) */
697         if (mode == HISSATSU_ELEC)
698         {
699                 /* Notice immunity */
700                 if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
701                 {
702                         if (is_original_ap_and_seen(m_ptr))
703                         {
704                                 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
705                         }
706                 }
707
708                 /* Otherwise, take the damage */
709                 else if (have_flag(flgs, TR_BRAND_ELEC))
710                 {
711                         if (mult < 70) mult = 70;
712                 }
713                 else
714                 {
715                         if (mult < 50) mult = 50;
716                 }
717         }
718
719         /* Bloody Maelstrom */
720         if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && monster_living(r_ptr))
721         {
722                 int tmp = MIN(100, MAX(10, p_ptr->cut / 10));
723                 if (mult < tmp) mult = tmp;
724         }
725
726         /* Keiun-Kininken */
727         if (mode == HISSATSU_UNDEAD)
728         {
729                 if (r_ptr->flags3 & RF3_UNDEAD)
730                 {
731                         if (is_original_ap_and_seen(m_ptr))
732                         {
733                                 r_ptr->r_flags3 |= RF3_UNDEAD;
734                         }
735                         if (mult == 10) mult = 70;
736                         else if (mult < 140) mult = MIN(140, mult+60);
737                 }
738                 if (mult == 10) mult = 40;
739                 else if (mult < 60) mult = MIN(60, mult+30);
740         }
741
742         if (mult > 150) mult = 150;
743
744         return mult;
745 }