3 /* Purpose: Mindcrafter code */
6 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research, and
9 * not for profit purposes provided that this copyright and statement are
10 * included in all such copies.
17 mind_power mind_powers[5] =
21 /* Level gained, cost, %fail, name */
24 { 2, 1, 20, "¿À·Ð¹¶·â"},
25 { 3, 2, 25, "¼¡¸µ¤Î½Ö¤"},
26 { 7, 6, 35, "µõ¶õ¤Î¸¸±Æ"},
27 { 9, 7, 50, "Àº¿À»ÙÇÛ"},
28 { 11, 7, 30, "Ç°Æ°¾×·âÃÆ"},
29 { 13, 12, 50, "³»²½"},
30 { 15, 12, 60, "¥µ¥¤¥³¥á¥È¥ê¡¼"},
31 { 18, 10, 45, "Àº¿ÀÇÈÆ°"},
32 { 23, 15, 50, "¥¢¥É¥ì¥Ê¥ê¥ó¡¦¥É¡¼¥Ô¥ó¥°"},
33 { 26, 28, 60, "¥Æ¥ì¥¥Í¥·¥¹"},
34 { 28, 10, 40, "¥µ¥¤¥¥Ã¥¯¡¦¥É¥ì¥¤¥ó"},
35 { 35, 35, 75, "¸÷¤Î·õ"},
36 { 45,150, 85, "´°Á´¤ÊÀ¤³¦"},
45 { 1, 1, 15, "Precognition"},
46 { 2, 1, 20, "Neural Blast"},
47 { 3, 2, 25, "Minor Displacement"},
48 { 7, 6, 35, "Major Displacement"},
49 { 9, 7, 50, "Domination"},
50 { 11, 7, 30, "Pulverise"},
51 { 13, 12, 50, "Character Armour"},
52 { 15, 12, 60, "Psychometry" },
53 { 18, 10, 45, "Mind Wave" },
54 { 23, 15, 50, "Adrenaline Channeling"},
55 { 26, 28, 60, "Telekinesis"},
56 { 28, 10, 40, "Psychic Drain"},
57 { 35, 35, 75, "Psycho-Spear"},
58 { 45,150, 85, "The World"},
73 /* Level gained, cost, %fail, name */
77 { 5, 6, 35, "Éñ¶õ½Ñ"},
78 { 8, 5, 40, "¥«¥á¥Ï¥áÇÈ"},
79 { 10, 7, 45, "ÂÐËâË¡Ëɸæ"},
81 { 17, 17, 50, "ŻƮµ¤"},
82 { 20, 20, 50, "¾×ÇÈ"},
83 { 23, 18, 55, "×Âζ"},
84 { 25, 30, 70, "¤¤¤Æ¤Ä¤¯ÇÈÆ°"},
85 { 28, 26, 50, "¸¸Î´"},
86 { 32, 35, 65, "Îû¹ö²Ð±ê"},
87 { 38, 42, 75, "Ķ¥«¥á¥Ï¥áÇÈ"},
88 { 44, 50, 80, "¸÷®°ÜÆ°"},
97 { 1, 1, 15, "Small Force Ball"},
98 { 3, 3, 30, "Flash Light"},
99 { 5, 6, 35, "Flying Technique"},
100 { 8, 5, 40, "Kamehameha"},
101 { 10, 7, 45, "Magic Resistance"},
102 { 13, 5, 60, "Improve Force"},
103 { 17, 17, 50, "Aura of Force"},
104 { 20, 20, 50, "Shock Power"},
105 { 23, 18, 55, "Large Force Ball"},
106 { 25, 30, 70, "Dispel Magic"},
107 { 28, 26, 50, "Summon Ghost"},
108 { 32, 35, 65, "Exploding Frame"},
109 { 38, 42, 75, "Super Kamehameha"},
110 { 44, 50, 80, "Light Speed"},
125 /* Level gained, cost, %fail, name */
127 { 8, 5, 40, "»¦µ¤´¶ÃÎ"},
128 { 15, 20, 0, "ÆÍ·â"},
129 { 20, 15, 0, "¥È¥é¥Ã¥×Ê´ºÕ"},
130 { 25, 20, 60, "ÃÏ¿Ì"},
131 { 30, 80, 75, "³§»¦¤·"},
149 { 8, 5, 40, "Detect Atmosphere of Menace"},
150 { 15, 20, 0, "Charge"},
151 { 20, 15, 0, "Smash a Trap"},
152 { 25, 20, 60, "Quake"},
153 { 30, 80, 75, "Massacre"},
177 /* Level gained, cost, %fail, name */
179 { 1, 1, 15, "¿¿¸«¤Î¶À"},
180 { 1, 2, 40, "¶ÀÀ¸À®"},
181 { 2, 2, 20, "¸÷¤Î¤·¤º¤¯"},
182 { 3, 2, 20, "ÏĤó¤À¶À"},
183 { 5, 3, 35, "Á®¸÷¶À"},
184 { 6, 5, 35, "×Ǥ¨¤ë¶À"},
186 { 10, 5, 30, "Èù¿Ð±£¤ì"},
187 { 12, 12, 30, "ÄÉÊü¤Î¶À"},
188 { 15, 15, 30, "¶ÀºÕ¤"},
189 { 19, 13, 30, "ºÅ̲¶À"},
190 { 23, 18, 50, "¥·¡¼¥«¡¼¥ì¥¤"},
192 { 25, 20, 40, "¶À¤ÎÉõ°õ"},
193 { 27, 30, 60, "¿å¶À¤Î½â"},
194 { 29, 30, 60, "¥¹¡¼¥Ñ¡¼¥ì¥¤"},
195 { 31, 35, 60, "¸¸ÏǤθ÷"},
196 { 33, 50, 80, "¶À¤Î¹ñ"},
198 { 36, 30, 80, "¶ÀÈ´¤±"},
199 { 38, 40, 70, "µ¢´Ô¤Î¶À"},
200 { 40, 50, 55, "±Æʬ¿È"},
201 { 43, 55, 70, "ÉõËâ·ë³¦"},
202 { 46, 70, 75, "¥é¥Õ¥Î¡¼¥ë¤Î¶À"},
204 { 1, 1, 15, "Mirror of Seeing"},
205 { 1, 2, 40, "Making a Mirror"},
206 { 2, 2, 20, "Drip of Light"},
207 { 3, 2, 20, "Warped Mirror"},
208 { 5, 3, 35, "Mirror of Light"},
209 { 6, 5, 35, "Mirror of Wandering"},
211 { 10, 5, 30, "Robe of Dust"},
212 { 12, 12, 30, "Banishing Mirror"},
213 { 15, 15, 30, "Mirror Clashing"},
214 { 19, 13, 30, "Mirror Sleeping"},
215 { 23, 18, 50, "Seeker Ray"},
217 { 25, 20, 40, "Seal of Mirror"},
218 { 27, 30, 60, "Shield of Water"},
219 { 29, 30, 60, "Super Ray"},
220 { 31, 35, 60, "Illusion Light"},
221 { 33, 50, 80, "Mirror Shift"},
223 { 36, 30, 80, "Mirror Tunnel"},
224 { 38, 40, 70, "Mirror of Recall"},
225 { 40, 50, 55, "Multi-Shadow"},
226 { 43, 55, 70, "Binding Field"},
227 { 46, 70, 75, "Mirror of Ruffnor"},
235 /* Level gained, cost, %fail, name */
237 { 1, 1, 20, "°Å°ÇÀ¸À®"},
238 { 2, 2, 25, "¼þÊÕÄ´ºº"},
239 { 3, 3, 25, "ÍÕ±£¤ì"},
240 { 5, 3, 30, "ÊѤï¤ê¿È"},
241 { 7, 8, 35, "¹âÈô¤Ó"},
242 { 8, 10, 35, "°ì·âΥæ"},
243 { 10, 10, 40, "¶âÇû¤ê"},
244 { 12, 12, 70, "¸Å¤Î¸ýÅÁ"},
245 { 15, 10, 50, "Éâ±À"},
246 { 17, 12, 45, "²ÐÆÛ"},
247 { 18, 20, 40, "Æþ¿È"},
248 { 20, 5, 50, "ȬÊý¼ê΢·õ"},
249 { 22, 15, 55, "º¿³ù"},
250 { 25, 32, 60, "±ì¶Ì"},
251 { 28, 32, 60, "ž¿È"},
252 { 30, 30, 70, "Çúȯ¤ÎÌæ¾Ï"},
253 { 32, 40, 40, "ÅÚÆÛ"},
254 { 34, 35, 50, "̸±£¤ì"},
255 { 38, 40, 60, "Îû¹ö²Ð±ê"},
256 { 41, 50, 55, "ʬ¿È"},
259 { 1, 1, 20, "Create Darkness"},
260 { 2, 2, 25, "Detect Near"},
261 { 3, 3, 25, "Hide in Leafs"},
262 { 5, 3, 30, "Kawarimi"},
263 { 7, 8, 35, "Absconding"},
264 { 8, 10, 35, "Hit and Away"},
265 { 10, 10, 40, "Bind Monster"},
266 { 12, 12, 70, "Ancient Knowledge"},
267 { 15, 10, 50, "Floating"},
268 { 17, 12, 45, "Hide in Flame"},
269 { 18, 20, 40, "Nyusin"},
270 { 20, 5, 50, "Syuriken Spreading"},
271 { 22, 15, 55, "Chain Hook"},
272 { 25, 32, 60, "Smoke Ball"},
273 { 28, 32, 60, "Swap Position"},
274 { 30, 30, 70, "Glyph of Explosion"},
275 { 32, 40, 40, "Hide in Mud"},
276 { 34, 35, 50, "Hide in Mist"},
277 { 38, 40, 60, "Rengoku-Kaen"},
278 { 41, 50, 55, "Bunshin"},
287 void mindcraft_info(char *p, int use_mind, int power)
290 cptr s_dam = "»½ý:";
291 cptr s_dur = "´ü´Ö:";
292 cptr s_range = "ÈÏ°Ï:";
296 cptr s_range = "range ";
298 int plev = p_ptr->lev;
304 case MIND_MINDCRAFTER:
308 case 1: sprintf(p, " %s%dd%d", s_dam, 3 + ((plev - 1) / 4), 3 + plev/15); break;
309 case 2: sprintf(p, " %s10", s_range); break;
310 case 3: sprintf(p, " %s%d", s_range, plev * 5); break;
312 case 5: sprintf(p, " %s%dd8", s_dam, 8 + ((plev - 5) / 4)); break;
313 case 6: sprintf(p, " %s%d", s_dur, plev); break;
315 case 8: sprintf(p, (plev < 25 ? " %s%d" : " %sd%d"), s_dam, (plev < 25 ? plev * 3 / 2 : plev * ((plev - 5) / 10 + 1))); break;
316 case 9: sprintf(p, " %s10+d%d", s_dur, plev * 3 / 2); break;
318 case 10: sprintf(p, " ºÇÂç½ÅÎÌ:%d.%dkg", lbtokg1(plev * 15),lbtokg2(plev * 15)); break;
320 case 10: sprintf(p, " max wgt %d", plev * 15); break;
322 case 11: sprintf(p, " %s%dd6", s_dam, plev / 2); break;
323 case 12: sprintf(p, " %sd%d+%d", s_dam, plev * 3, plev * 3); break;
325 case 13: sprintf(p, " ¹ÔÆ°:%d²ó", (p_ptr->csp + 100-p_ptr->energy_need - 50)/100); break;
327 case 13: sprintf(p, " %d acts.", (p_ptr->csp + 100-p_ptr->energy_need - 50)/100); break;
333 int boost = p_ptr->magic_num1[0];
335 if (heavy_armor()) boost /= 2;
339 case 0: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5) + boost / 12); break;
341 case 2: sprintf(p, " %s%d+d30", s_dur, 30 + boost / 5); break;
342 case 3: sprintf(p, " %s%dd5", s_dam, 5 + ((plev - 1) / 5) + boost / 10); break;
343 case 4: sprintf(p, " %s%d+d20", s_dur, 20 + boost / 5); break;
345 case 6: sprintf(p, " %s%d+d%d", s_dur, 15 + boost / 7, plev / 2); break;
346 case 7: sprintf(p, " %s%dd8", s_dam, 8 + ((plev - 5) / 5) + boost / 12); break;
347 case 8: sprintf(p, " %s10d6+%d", s_dam, plev * 3 / 2 + boost * 3 / 5); break;
350 case 10: sprintf(p, " ºÇÂç%dɤ", 1+boost/100); break;
352 case 10: sprintf(p, " max %d", 1+boost/100); break;
354 case 11: sprintf(p, " %s%d", s_dam, 100 + plev + boost); break;
355 case 12: sprintf(p, " %s%dd15", s_dam, 10 + plev / 2 + boost * 3 / 10); break;
357 case 13: sprintf(p, " ¹ÔÆ°:%d+d16²ó", 16+boost/20); break;
359 case 13: sprintf(p, " %d+d16 acts", 16+boost/20); break;
363 case MIND_MIRROR_MASTER:
369 case 2: sprintf(p, " %s%dd4", s_dam, 3 + ((plev - 1) / 5) ); break;
370 case 3: sprintf(p, " %s10", s_range); break;
372 case 5: sprintf(p, " %s%d", s_range, plev *5); break;
373 case 6: sprintf(p, " %s20+d20", s_dur); break;
375 case 8: sprintf(p, " %s%dd8", s_dam, 8+((plev -5)/4) ); break;
377 case 10: sprintf(p, " %s%dd8", s_dam, 11+(plev-5)/4 ); break;
379 case 12: sprintf(p, " %s20+d20", s_dur); break;
380 case 13: sprintf(p, " %s150+d%d", s_dam, plev*2 ); break;
383 case 16: sprintf(p, " %s%d", s_range, plev/2 +10); break;
385 case 18: sprintf(p, " %s6+d6", s_dur); break;
386 case 19: sprintf(p, " %s%d", s_dam, plev*11+5 ); break;
387 case 20: sprintf(p, " %s4+d4", s_dur); break;
397 case 2: sprintf(p, " %s10", s_range); break;
399 case 4: sprintf(p, " %s%d", s_range , plev *5); break;
400 case 5: sprintf(p, " %s30", s_range); break;
403 case 8: sprintf(p, " %s20+d20", s_dur); break;
404 case 9: sprintf(p, " %s%d", s_dam, (50+plev)/2 ); break;
411 case 16: sprintf(p, " %s%d+d%d", s_dur, plev/2, plev/2); break;
412 case 17: sprintf(p, " %s%d*3", s_dam, (75+plev*2/3)/2 ); break;
413 case 18: sprintf(p, " %s%dd10", s_dam, 6+plev/8 ); break;
414 case 19: sprintf(p, " %s6+d6", s_dur); break;
423 * Allow user to choose a mindcrafter power.
425 * If a valid spell is chosen, saves it in '*sn' and returns TRUE
426 * If the user hits escape, returns FALSE, and set '*sn' to -1
427 * If there are no legal choices, returns FALSE, and sets '*sn' to -2
429 * The "prompt" should be "cast", "recite", or "study"
430 * The "known" should be TRUE for cast/pray, FALSE for study
432 * nb: This function has a (trivial) display bug which will be obvious
433 * when you run it. It's probably easy to fix but I haven't tried,
436 static int get_mind_power(int *sn, bool only_browse)
443 int plev = p_ptr->lev;
452 mind_power *mind_ptr;
455 int menu_line = (use_menu ? 1 : 0);
457 switch(p_ptr->pclass)
459 case CLASS_MINDCRAFTER:
461 use_mind = MIND_MINDCRAFTER;
469 case CLASS_FORCETRAINER:
479 case CLASS_BERSERKER:
481 use_mind = MIND_BERSERKER;
489 case CLASS_MIRROR_MASTER:
491 use_mind = MIND_MIRROR_MASTER;
501 use_mind = MIND_NINJUTSU;
520 mind_ptr = &mind_powers[use_mind];
522 /* Assume cancelled */
525 #ifdef ALLOW_REPEAT /* TNB */
527 /* Get the spell, if available */
530 /* Verify the spell */
531 if (mind_ptr->info[*sn].min_lev <= plev)
538 #endif /* ALLOW_REPEAT -- TNB */
540 /* Nothing chosen yet */
546 for (i = 0; i < MAX_MIND_POWERS; i++)
548 if (mind_ptr->info[i].min_lev <= plev)
554 /* Build a prompt (accept all spells) */
558 (void) strnfmt(out_val, 78, "(%^s %c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤Ë¤Ä¤¤¤ÆÃΤê¤Þ¤¹¤«¡©",
560 (void) strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
562 p, I2A(0), I2A(num - 1), p);
567 (void) strnfmt(out_val, 78, "(%^s %c-%c, '*'¤Ç°ìÍ÷, ESC) ¤É¤Î%s¤ò»È¤¤¤Þ¤¹¤«¡©",
569 (void)strnfmt(out_val, 78, "(%^ss %c-%c, *=List, ESC=exit) Use which %s? ",
571 p, I2A(0), I2A(num - 1), p);
574 if (use_menu && !only_browse) screen_save();
575 /* Get a spell from the user */
577 choice= (always_show_list || use_menu) ? ESCAPE:1 ;
580 if(choice==ESCAPE) choice = ' ';
581 else if( !get_com(out_val, &choice, TRUE) )break;
583 if (use_menu && choice != ' ')
589 if (!only_browse) screen_load();
598 menu_line += (num - 1);
620 if (menu_line > num) menu_line -= num;
623 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
626 if (!redraw || use_menu)
634 /* Save the screen */
635 if (!only_browse && !use_menu) screen_save();
637 /* Display a list of spells */
640 put_str("̾Á°", y, x + 5);
642 put_str("Name", y, x + 5);
646 put_str(format("Lv %s ¼ºÎ¨ ¸ú²Ì", ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU)) ? "HP" : "MP"), y, x + 35);
648 put_str(format("Lv %s Fail Info", ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU)) ? "HP" : "MP"), y, x + 35);
650 has_weapon[0] = buki_motteruka(INVEN_RARM);
651 has_weapon[1] = buki_motteruka(INVEN_LARM);
653 /* Dump the spells */
654 for (i = 0; i < MAX_MIND_POWERS; i++)
658 /* Access the spell */
659 spell = mind_ptr->info[i];
661 if (spell.min_lev > plev) break;
665 mana_cost = spell.mana_cost;
669 /* Reduce failure rate by "effective" level adjustment */
670 chance -= 3 * (plev - spell.min_lev);
672 /* Reduce failure rate by INT/WIS adjustment */
673 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
675 if (use_mind == MIND_KI)
677 if (heavy_armor()) chance += 20;
678 if (p_ptr->icky_wield[0]) chance += 20;
679 else if (has_weapon[0]) chance += 10;
680 if (p_ptr->icky_wield[1]) chance += 20;
681 else if (has_weapon[1]) chance += 10;
685 for (j = 0; j < p_ptr->magic_num1[0] / 50; j++)
686 mana_cost += (j+1) * 3 / 2;
690 /* Not enough mana to cast */
691 if ((use_mind != MIND_BERSERKER) && (use_mind != MIND_NINJUTSU) && (mana_cost > p_ptr->csp))
693 chance += 5 * (mana_cost - p_ptr->csp);
696 chance += p_ptr->to_m_chance;
698 /* Extract the minimum failure rate */
699 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
701 /* Minimum failure rate */
702 if (chance < minfail) chance = minfail;
704 /* Stunning makes spells harder */
705 if (p_ptr->stun > 50) chance += 25;
706 else if (p_ptr->stun) chance += 15;
708 if (use_mind == MIND_KI)
710 if (heavy_armor()) chance += 5;
711 if (p_ptr->icky_wield[0]) chance += 5;
712 if (p_ptr->icky_wield[1]) chance += 5;
714 /* Always a 5 percent chance of working */
715 if (chance > 95) chance = 95;
719 mindcraft_info(comment, use_mind, i);
724 if (i == (menu_line-1)) strcpy(psi_desc, " ¡Õ ");
726 if (i == (menu_line-1)) strcpy(psi_desc, " > ");
728 else strcpy(psi_desc, " ");
731 sprintf(psi_desc, " %c) ",I2A(i));
732 /* Dump the spell --(-- */
734 format("%-30s%2d %4d%s %3d%%%s",
735 spell.name, spell.min_lev, mana_cost,
737 (((use_mind == MIND_MINDCRAFTER) && (i == 13)) ? "¡Á" : " "),
739 (((use_mind == MIND_MINDCRAFTER) && (i == 13)) ? "~ " : " "),
742 prt(psi_desc, y + i + 1, x);
745 /* Clear the bottom line */
746 prt("", y + i + 1, x);
750 else if (!only_browse)
755 /* Restore the screen */
766 ask = isupper(choice);
769 if (ask) choice = tolower(choice);
771 /* Extract request */
772 i = (islower(choice) ? A2I(choice) : -1);
775 /* Totally Illegal */
776 if ((i < 0) || (i >= num))
782 /* Save the spell index */
783 spell = mind_ptr->info[i];
792 (void) strnfmt(tmp_val, 78, "%s¤ò»È¤¤¤Þ¤¹¤«¡©", spell.name);
794 (void)strnfmt(tmp_val, 78, "Use %s? ", spell.name);
798 /* Belay that order */
799 if (!get_check(tmp_val)) continue;
806 /* Restore the screen */
807 if (redraw && !only_browse) screen_load();
813 p_ptr->window |= (PW_SPELL);
819 /* Abort if needed */
820 if (!flag) return (FALSE);
822 /* Save the choice */
825 #ifdef ALLOW_REPEAT /* TNB */
829 #endif /* ALLOW_REPEAT -- TNB */
837 * do_cmd_cast calls this function if the player's class
840 static bool cast_mindcrafter_spell(int spell)
844 int plev = p_ptr->lev;
852 chg_virtue(V_KNOWLEDGE, 1);
853 chg_virtue(V_ENLIGHTEN, 1);
854 wiz_lite(FALSE, FALSE);
857 map_area(DETECT_RAD_MAP);
861 b = detect_monsters_normal(DETECT_RAD_DEFAULT);
862 if (plev > 14) b |= detect_monsters_invis(DETECT_RAD_DEFAULT);
864 b |= detect_traps(DETECT_RAD_DEFAULT, TRUE);
865 b |= detect_doors(DETECT_RAD_DEFAULT);
870 b = detect_all(DETECT_RAD_DEFAULT);
873 if ((plev > 24) && (plev < 40))
874 set_tim_esp(plev, FALSE);
877 if (!b) msg_print("°ÂÁ´¤Êµ¤¤¬¤¹¤ë¡£");
879 if (!b) msg_print("You feel safe.");
885 if (!get_aim_dir(&dir)) return FALSE;
887 if (randint1(100) < plev * 2)
888 fire_beam(GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)));
890 fire_ball(GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)), 0);
898 teleport_player(plev * 5);
904 if (!get_aim_dir(&dir)) return FALSE;
906 fire_ball(GF_DOMINATION, dir, plev, 0);
910 charm_monsters(plev * 2);
914 /* Fist of Force --- not 'true' TK */
915 if (!get_aim_dir(&dir)) return FALSE;
917 fire_ball(GF_TELEKINESIS, dir, damroll(8 + ((plev - 5) / 4), 8),
918 (plev > 20 ? (plev - 20) / 8 + 1 : 0));
921 /* Character Armour */
922 set_shield(plev, FALSE);
923 if (plev > 14) set_oppose_acid(plev, FALSE);
924 if (plev > 19) set_oppose_fire(plev, FALSE);
925 if (plev > 24) set_oppose_cold(plev, FALSE);
926 if (plev > 29) set_oppose_elec(plev, FALSE);
927 if (plev > 34) set_oppose_pois(plev, FALSE);
932 return psychometry();
934 return ident_spell(FALSE);
939 msg_print("Àº¿À¤òDZ¤¸¶Ê¤²¤ëÇÈÆ°¤òȯÀ¸¤µ¤»¤¿¡ª");
941 msg_print("Mind-warping forces emanate from your brain!");
945 project(0, 2 + plev / 10, py, px,
946 (plev * 3), GF_PSI, PROJECT_KILL, -1);
948 (void)mindblast_monsters(randint1(plev * ((plev - 5) / 10 + 1)));
956 * Only heal when Adrenalin Channeling is not active. We check
957 * that by checking if the player isn't fast and 'heroed' atm.
959 if (!p_ptr->fast || !p_ptr->hero)
964 b = 10 + randint1((plev * 3) / 2);
967 (void)set_fast(b, FALSE);
971 if (!get_aim_dir(&dir)) return FALSE;
973 fetch(dir, plev * 15, FALSE);
978 if (!get_aim_dir(&dir)) return FALSE;
980 b = damroll(plev / 2, 6);
982 /* This is always a radius-0 ball now */
983 if (fire_ball(GF_PSI_DRAIN, dir, b, 0))
984 p_ptr->energy_need += randint1(150);
988 if (!get_aim_dir(&dir)) return FALSE;
990 fire_beam(GF_PSY_SPEAR, dir, randint1(plev*3)+plev*3);
997 msg_print("´û¤Ë»þ¤Ï»ß¤Þ¤Ã¤Æ¤¤¤ë¡£");
999 msg_print("Time is already stopped.");
1003 world_player = TRUE;
1005 msg_print("¡Ö»þ¤è¡ª¡×");
1007 msg_print("You yell 'Time!'");
1012 p_ptr->energy_need -= 1000 + (100 + p_ptr->csp - 50)*TURNS_PER_TICK/10;
1015 p_ptr->redraw |= (PR_MAP);
1017 /* Update monsters */
1018 p_ptr->update |= (PU_MONSTERS);
1021 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1028 msg_print("¤Ê¤Ë¡©");
1040 * do_cmd_cast calls this function if the player's class
1041 * is 'ForceTrainer'.
1043 static bool cast_force_spell(int spell)
1046 int plev = p_ptr->lev;
1047 int boost = p_ptr->magic_num1[0];
1049 if (heavy_armor()) boost /= 2;
1055 if (!get_aim_dir(&dir)) return FALSE;
1056 fire_ball(GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5) + boost / 12, 4), 0);
1059 (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
1062 set_tim_ffall(randint1(30) + 30 + boost / 5, FALSE);
1065 project_length = plev / 8 + 3;
1066 if (!get_aim_dir(&dir)) return FALSE;
1068 fire_beam(GF_MISSILE, dir, damroll(5 + ((plev - 1) / 5) + boost / 10, 5));
1071 set_resist_magic(randint1(20) + 20 + boost / 5, FALSE);
1075 msg_print("µ¤¤òÎý¤Ã¤¿¡£");
1077 msg_print("You improved the Force.");
1079 p_ptr->magic_num1[0] += (70 + plev);
1080 p_ptr->update |= (PU_BONUS);
1081 if (randint1(p_ptr->magic_num1[0]) > (plev * 4 + 120))
1084 msg_print("µ¤¤¬Ë½Áö¤·¤¿¡ª");
1086 msg_print("The Force exploded!");
1088 fire_ball(GF_MANA, 0, p_ptr->magic_num1[0] / 2, 10);
1090 take_hit(DAMAGE_LOSELIFE, p_ptr->magic_num1[0] / 2, "µ¤¤Î˽Áö", -1);
1092 take_hit(DAMAGE_LOSELIFE, p_ptr->magic_num1[0] / 2, "Explosion of the Force", -1);
1098 set_tim_sh_touki(randint1(plev / 2) + 15 + boost / 7, FALSE);
1104 if (!get_aim_dir(&dir)) return FALSE;
1108 dam = damroll(8 + ((plev - 5) / 4) + boost / 12, 8);
1109 fire_beam(GF_MISSILE, dir, dam);
1110 if (cave[y][x].m_idx)
1115 int m_idx = cave[y][x].m_idx;
1116 monster_type *m_ptr = &m_list[m_idx];
1119 monster_desc(m_name, m_ptr, 0);
1121 if (randint1(r_info[m_ptr->r_idx].level * 3 / 2) > randint0(dam / 2) + dam/2)
1124 msg_format("%s¤ÏÈô¤Ð¤µ¤ì¤Ê¤«¤Ã¤¿¡£", m_name);
1126 msg_format("%^s was not blown away.", m_name);
1131 for (i = 0; i < 5; i++)
1135 if (cave_empty_bold(y, x))
1142 if ((ty != oy) || (tx != ox))
1145 msg_format("%s¤ò¿á¤Èô¤Ð¤·¤¿¡ª", m_name);
1147 msg_format("You blow %s away!", m_name);
1149 cave[oy][ox].m_idx = 0;
1150 cave[ty][tx].m_idx = m_idx;
1154 update_mon(m_idx, TRUE);
1163 if (!get_aim_dir(&dir)) return FALSE;
1164 fire_ball(GF_MISSILE, dir, damroll(10, 6) + plev * 3 / 2 + boost * 3 / 5, (plev < 30) ? 2 : 3);
1168 monster_type *m_ptr;
1171 if (!target_set(TARGET_KILL)) return FALSE;
1172 if (!cave[target_row][target_col].m_idx) break;
1173 if (!los(py, px, target_row, target_col)) break;
1174 m_ptr = &m_list[cave[target_row][target_col].m_idx];
1175 monster_desc(m_name, m_ptr, 0);
1176 if (m_ptr->invulner)
1178 m_ptr->invulner = 0;
1180 msg_format("%s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ï¤Ê¤¤¡£", m_name);
1182 msg_format("%^s is no longer invulnerable.", m_name);
1189 msg_format("%s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1191 msg_format("%^s is no longer fast.", m_name);
1198 msg_format("%s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
1200 msg_format("%^s is no longer slow.", m_name);
1203 p_ptr->redraw |= (PR_HEALTH);
1204 if (p_ptr->riding == cave[target_row][target_col].m_idx) p_ptr->redraw |= (PR_UHEALTH);
1211 bool success = FALSE;
1213 for (i = 0; i < 1 + boost/100; i++)
1214 if (summon_specific(-1, py, px, plev, SUMMON_PHANTOM, PM_FORCE_PET))
1219 msg_print("¸æÍѤǤ´¤¶¤¤¤Þ¤¹¤¬¡¢¸æ¼ç¿ÍÍÍ¡©");
1221 msg_print("'Your wish, master?'");
1227 msg_print("²¿¤â¸½¤ì¤Ê¤«¤Ã¤¿¡£");
1229 msg_print("Nothing happen.");
1235 fire_ball(GF_FIRE, 0, 200 + (2 * plev) + boost * 2, 10);
1238 if (!get_aim_dir(&dir)) return FALSE;
1240 fire_beam(GF_MANA, dir, damroll(10 + (plev / 2) + boost * 3 / 10, 15));
1243 set_lightspeed(randint1(16) + 16 + boost / 20, FALSE);
1247 msg_print("¤Ê¤Ë¡©");
1253 p_ptr->magic_num1[0] = 0;
1254 p_ptr->update |= (PU_BONUS);
1260 /* calculate mirrors */
1261 static int number_of_mirrors( void )
1265 for( x=0 ; x < cur_wid ; x++ ){
1266 for( y=0 ; y < cur_hgt ; y++ ){
1267 if (is_mirror_grid(&cave[y][x])) val++;
1273 static bool cast_mirror_spell(int spell)
1276 int plev = p_ptr->lev;
1283 /* mirror of seeing */
1285 tmp = is_mirror_grid(&cave[py][px]) ? 4 : 0;
1286 if( plev + tmp > 4)detect_monsters_normal(DETECT_RAD_DEFAULT);
1287 if( plev + tmp > 18 )detect_monsters_invis(DETECT_RAD_DEFAULT);
1288 if( plev + tmp > 28 )set_tim_esp(plev,FALSE);
1289 if( plev + tmp > 38 )map_area(DETECT_RAD_MAP);
1290 if( tmp == 0 && plev < 5 ){
1292 msg_print("¶À¤¬¤Ê¤¯¤Æ½¸Ãæ¤Ç¤¤Ê¤«¤Ã¤¿¡ª");
1294 msg_print("You need a mirror to concentrate!");
1300 if( number_of_mirrors() < 4 + plev/10 ){
1305 msg_format("¤³¤ì°Ê¾å¶À¤ÏÀ©¸æ¤Ç¤¤Ê¤¤¡ª");
1307 msg_format("There are too many mirrors to control!");
1312 if (!get_aim_dir(&dir)) return FALSE;
1313 if ( plev > 9 && is_mirror_grid(&cave[py][px]) ) {
1314 fire_beam(GF_LITE, dir,damroll(3+((plev-1)/5),4));
1317 fire_bolt(GF_LITE, dir,damroll(3+((plev-1)/5),4));
1322 teleport_player(10);
1324 /* mirror of light */
1326 (void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
1328 /* mirror of wandering */
1330 teleport_player(plev * 5);
1334 set_dustrobe(20+randint1(20),FALSE);
1336 /* banishing mirror */
1338 if (!get_aim_dir(&dir)) return FALSE;
1339 (void)fire_beam(GF_AWAY_ALL, dir , plev);
1341 /* mirror clashing */
1343 if (!get_aim_dir(&dir)) return FALSE;
1344 fire_ball(GF_SHARDS, dir, damroll(8 + ((plev - 5) / 4), 8),
1345 (plev > 20 ? (plev - 20) / 8 + 1 : 0));
1347 /* mirror sleeping */
1349 for(x=0;x<cur_wid;x++){
1350 for(y=0;y<cur_hgt;y++){
1351 if (is_mirror_grid(&cave[y][x])) {
1352 project(0,2,y,x,plev,GF_OLD_SLEEP,(PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP|PROJECT_NO_HANGEKI),-1);
1359 if (!get_aim_dir(&dir)) return FALSE;
1360 fire_beam(GF_SEEKER,dir, damroll(11+(plev-5)/4,8));
1362 /* seal of mirror */
1364 seal_of_mirror(plev*4+100);
1366 /* shield of water */
1368 tmp = 20+randint1(20);
1369 set_shield(tmp, FALSE);
1370 if( plev > 31 )set_tim_reflect(tmp, FALSE);
1371 if( plev > 39 )set_resist_magic(tmp,FALSE);
1375 if (!get_aim_dir(&dir)) return FALSE;
1376 fire_beam(GF_SUPER_RAY,dir, 150+randint1(2*plev));
1378 /* illusion light */
1380 tmp = is_mirror_grid(&cave[py][px]) ? 4 : 3;
1382 stun_monsters(plev*tmp);
1383 confuse_monsters(plev*tmp);
1384 turn_monsters(plev*tmp);
1385 stun_monsters(plev*tmp);
1386 stasis_monsters(plev*tmp);
1390 if( !is_mirror_grid(&cave[py][px]) ){
1392 msg_print("¶À¤Î¹ñ¤Î¾ì½ê¤¬¤ï¤«¤é¤Ê¤¤¡ª");
1394 msg_print("You cannot find out where is the world of mirror!");
1403 msg_print("¶À¤ÎÀ¤³¦¤òÄ̤êÈ´¤±¡Ä ");
1405 msg_print("Go through the world of mirror...");
1407 return dimension_door();
1408 /* mirror of recall */
1410 if(!word_of_recall())return FALSE;
1414 set_multishadow(6+randint1(6),FALSE);
1419 if( !binding_field(plev*11+5) )msg_print("ŬÅö¤Ê¶À¤òÁª¤Ù¤Ê¤«¤Ã¤¿¡ª");
1421 if( !binding_field(plev*11+5) )msg_print("You were not able to choose suitable mirrors!");
1424 /* mirror of Ruffnor */
1426 (void)set_invuln(randint1(4)+4,FALSE);
1430 msg_print("¤Ê¤Ë¡©");
1436 p_ptr->magic_num1[0] = 0;
1443 * do_cmd_cast calls this function if the player's class
1446 static bool cast_berserk_spell(int spell)
1455 detect_monsters_mind(DETECT_RAD_DEFAULT);
1462 msg_print("¾èÇÏÃæ¤Ë¤Ï̵Íý¤À¡£");
1464 msg_print("You cannot do it when riding.");
1469 if (!get_rep_dir2(&dir)) return FALSE;
1471 if (dir == 5) return FALSE;
1475 if (!cave[y][x].m_idx)
1478 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
1480 msg_print("There is no monster.");
1487 if (!player_can_enter(cave[y][x].feat) || is_trap(cave[y][x].feat))
1493 if (player_can_enter(cave[y][x].feat) && !is_trap(cave[y][x].feat) && !cave[y][x].m_idx)
1499 /* Save the old location */
1503 /* Move the player */
1509 /* Redraw the old spot */
1512 /* Redraw the new spot */
1515 /* Check for new panel (redraw map) */
1519 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW);
1521 /* Update the monsters */
1522 p_ptr->update |= (PU_DISTANCE);
1525 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1527 /* Handle stuff XXX XXX XXX */
1534 if (!get_rep_dir2(&dir)) return FALSE;
1537 move_player(dir, easy_disarm, TRUE);
1541 earthquake(py, px, 8+randint0(5));
1546 monster_type *m_ptr;
1548 for (dir = 0; dir < 8; dir++)
1550 y = py + ddy_ddd[dir];
1551 x = px + ddx_ddd[dir];
1552 c_ptr = &cave[y][x];
1554 /* Get the monster */
1555 m_ptr = &m_list[c_ptr->m_idx];
1557 /* Hack -- attack monsters */
1558 if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
1565 msg_print("¤Ê¤Ë¡©");
1577 * do_cmd_cast calls this function if the player's class
1580 static bool cast_ninja_spell(int spell)
1584 int plev = p_ptr->lev;
1590 (void)unlite_area(0, 3);
1595 wiz_lite(FALSE, TRUE);
1597 detect_monsters_normal(DETECT_RAD_DEFAULT);
1600 detect_traps(DETECT_RAD_DEFAULT, TRUE);
1601 detect_doors(DETECT_RAD_DEFAULT);
1602 detect_stairs(DETECT_RAD_DEFAULT);
1606 detect_objects_normal(DETECT_RAD_DEFAULT);
1611 teleport_player(10);
1612 if (cave[py][px].info & (CAVE_GLOW | CAVE_MNLT)) set_superstealth(FALSE);
1613 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
1618 if (!(p_ptr->special_defense & NINJA_KAWARIMI))
1621 msg_print("Ũ¤Î¹¶·â¤ËÂФ·¤ÆÉÒ´¶¤Ë¤Ê¤Ã¤¿¡£");
1623 msg_print("You are now prepare to evade any attacks.");
1626 p_ptr->special_defense |= NINJA_KAWARIMI;
1627 p_ptr->redraw |= (PR_STATUS);
1633 teleport_player(p_ptr->lev*5);
1634 if (cave[py][px].info & (CAVE_GLOW | CAVE_MNLT)) set_superstealth(FALSE);
1635 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
1640 if (!get_rep_dir(&dir, FALSE)) return FALSE;
1643 if (cave[y][x].m_idx)
1646 if (randint0(p_ptr->skill_dis) < 7)
1648 msg_print("¤¦¤Þ¤¯Æ¨¤²¤é¤ì¤Ê¤«¤Ã¤¿¡£");
1650 msg_print("You failed to run away.");
1654 teleport_player(30);
1655 if (cave[py][px].info & (CAVE_GLOW | CAVE_MNLT)) set_superstealth(FALSE);
1656 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
1662 msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£");
1664 msg_print("You don't see any monster in this direction");
1673 if (!get_aim_dir(&dir)) return FALSE;
1674 (void)stasis_monster(dir);
1678 return ident_spell(FALSE);
1681 set_tim_ffall(randint1(20) + 20, FALSE);
1684 fire_ball(GF_FIRE, 0, 50+plev, plev/10+2);
1685 teleport_player(30);
1686 if (cave[py][px].info & (CAVE_GLOW | CAVE_MNLT)) set_superstealth(FALSE);
1687 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
1688 set_oppose_fire(plev, FALSE);
1692 if (!get_aim_dir(&dir)) return FALSE;
1693 project_hook(GF_ATTACK, dir, HISSATSU_NYUSIN, PROJECT_STOP | PROJECT_KILL);
1699 for (i = 0; i < 8; i++)
1703 for (slot = 0; slot < INVEN_PACK; slot++)
1705 if (inventory[slot].tval == TV_SPIKE) break;
1707 if (slot == INVEN_PACK)
1710 if (!i) msg_print("¤¯¤µ¤Ó¤ò»ý¤Ã¤Æ¤¤¤Ê¤¤¡£");
1711 else msg_print("¤¯¤µ¤Ó¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
1713 if (!i) msg_print("You have no Iron Spikes.");
1714 else msg_print("You have no more Iron Spikes.");
1719 /* Gives a multiplier of 2 at first, up to 3 at 40th */
1720 do_cmd_throw_aux(1, FALSE, slot);
1728 monster_type *m_ptr;
1736 if (!target_set(TARGET_KILL)) return FALSE;
1737 m_idx = cave[target_row][target_col].m_idx;
1739 if (!player_has_los_bold(target_row, target_col)) break;
1740 m_ptr = &m_list[m_idx];
1741 monster_desc(m_name, m_ptr, 0);
1743 msg_format("%s¤ò°ú¤Ìᤷ¤¿¡£", m_name);
1745 msg_format("You pull back %s.", m_name);
1748 path_n = project_path(path_g, MAX_RANGE, target_row, target_col, py, px, 0);
1749 ty = target_row, tx = target_col;
1750 for (i = 1; i < path_n; i++)
1752 int ny = GRID_Y(path_g[i]);
1753 int nx = GRID_X(path_g[i]);
1754 cave_type *c_ptr = &cave[ny][nx];
1756 if (in_bounds(ny, nx) && cave_empty_bold(ny, nx) &&
1757 !(c_ptr->info & CAVE_OBJECT) &&
1758 !(c_ptr->feat >= FEAT_PATTERN_START &&
1759 c_ptr->feat <= FEAT_PATTERN_XTRA2))
1765 /* Update the old location */
1766 cave[target_row][target_col].m_idx = 0;
1768 /* Update the new location */
1769 cave[ty][tx].m_idx = m_idx;
1771 /* Move the monster */
1775 /* Wake the monster up */
1778 /* Update the monster (new location) */
1779 update_mon(m_idx, TRUE);
1781 /* Redraw the old grid */
1782 lite_spot(target_row, target_col);
1784 /* Redraw the new grid */
1787 p_ptr->update |= (PU_MON_LITE);
1792 if (!get_aim_dir(&dir)) return FALSE;
1793 fire_ball(GF_OLD_CONF, dir, plev*3, 3);
1796 project_length = -1;
1797 if (!get_aim_dir(&dir))
1804 (void)teleport_swap(dir);
1810 (void)set_kabenuke(randint1(plev/2) + plev/2, FALSE);
1811 set_oppose_acid(plev, FALSE);
1814 fire_ball(GF_POIS, 0, 75+plev*2/3, plev/5+2);
1815 fire_ball(GF_OLD_DRAIN, 0, 75+plev*2/3, plev/5+2);
1816 fire_ball(GF_CONFUSION, 0, 75+plev*2/3, plev/5+2);
1817 teleport_player(30);
1818 if (cave[py][px].info & (CAVE_GLOW | CAVE_MNLT)) set_superstealth(FALSE);
1819 else if (p_ptr->cur_lite <= 0) set_superstealth(TRUE);
1824 int num = damroll(3, 9);
1826 for (k = 0; k < num; k++)
1828 int typ = one_in_(2) ? GF_FIRE : one_in_(3) ? GF_NETHER : GF_PLASMA;
1829 int attempts = 1000;
1833 scatter(&y, &x, py, px, 4, 0);
1835 if ((y != py) || (x != px)) break;
1837 project(0, 0, y, x, damroll(6 + plev / 8, 10), typ,
1838 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL), -1);
1843 set_multishadow(6+randint1(6), FALSE);
1847 msg_print("¤Ê¤Ë¡©");
1859 * do_cmd_cast calls this function if the player's class
1862 void do_cmd_mind(void)
1867 int plev = p_ptr->lev;
1868 int old_csp = p_ptr->csp;
1871 int use_mind, mana_cost;
1875 bool on_mirror = FALSE;
1877 /* not if confused */
1878 if (p_ptr->confused)
1881 msg_print("º®Í𤷤Ƥ¤¤Æ½¸Ãæ¤Ç¤¤Ê¤¤¡ª");
1883 msg_print("You are too confused!");
1890 if (!get_mind_power(&n, FALSE)) return;
1893 switch(p_ptr->pclass)
1895 case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;p = "Àº¿À";break;
1896 case CLASS_FORCETRAINER: use_mind = MIND_KI;p = "µ¤";break;
1897 case CLASS_BERSERKER: use_mind = MIND_BERSERKER;p = "Åܤê";break;
1898 case CLASS_MIRROR_MASTER: use_mind = MIND_MIRROR_MASTER;p = "¶ÀËâË¡";break;
1899 case CLASS_NINJA: use_mind = MIND_NINJUTSU;p = "Àº¿À";break;
1900 default: use_mind = 0;p = "ĶǽÎÏ";break;
1903 switch(p_ptr->pclass)
1905 case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
1906 case CLASS_FORCETRAINER: use_mind = MIND_KI;break;
1907 case CLASS_BERSERKER: use_mind = MIND_BERSERKER;break;
1908 case CLASS_MIRROR_MASTER: use_mind = MIND_MIRROR_MASTER;break;
1909 case CLASS_NINJA: use_mind = MIND_NINJUTSU;break;
1910 default: use_mind = 0;break;
1913 spell = mind_powers[use_mind].info[n];
1915 /* Spell failure chance */
1916 chance = spell.fail;
1918 mana_cost = spell.mana_cost;
1919 if (use_mind == MIND_KI)
1921 if (heavy_armor()) chance += 20;
1922 if (p_ptr->icky_wield[0]) chance += 20;
1923 else if (buki_motteruka(INVEN_RARM)) chance += 10;
1924 if (p_ptr->icky_wield[1]) chance += 20;
1925 else if (buki_motteruka(INVEN_LARM)) chance += 10;
1929 for (j = 0; j < p_ptr->magic_num1[0] / 50; j++)
1930 mana_cost += (j+1) * 3 / 2;
1934 /* Verify "dangerous" spells */
1935 if ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU))
1937 if (mana_cost > p_ptr->chp)
1940 msg_print("£È£Ð¤¬Â¤ê¤Þ¤»¤ó¡£");
1942 msg_print("You do not have enough hp to use this power.");
1947 else if (mana_cost > p_ptr->csp)
1951 msg_print("£Í£Ð¤¬Â¤ê¤Þ¤»¤ó¡£");
1953 msg_print("You do not have enough mana to use this power.");
1957 if (!over_exert) return;
1961 if (!get_check("¤½¤ì¤Ç¤âÄ©À路¤Þ¤¹¤«? ")) return;
1963 if (!get_check("Attempt it anyway? ")) return;
1970 /* Reduce failure rate by "effective" level adjustment */
1971 chance -= 3 * (plev - spell.min_lev);
1973 chance += p_ptr->to_m_chance;
1975 /* Reduce failure rate by INT/WIS adjustment */
1976 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
1978 /* Not enough mana to cast */
1979 if ((mana_cost > p_ptr->csp) && (use_mind != MIND_BERSERKER) && (use_mind != MIND_NINJUTSU))
1981 chance += 5 * (mana_cost - p_ptr->csp);
1984 /* Extract the minimum failure rate */
1985 minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
1987 /* Minimum failure rate */
1988 if (chance < minfail) chance = minfail;
1990 /* Stunning makes spells harder */
1991 if (p_ptr->stun > 50) chance += 25;
1992 else if (p_ptr->stun) chance += 15;
1994 if (use_mind == MIND_KI)
1996 if (heavy_armor()) chance += 5;
1997 if (p_ptr->icky_wield[0]) chance += 5;
1998 if (p_ptr->icky_wield[1]) chance += 5;
2002 /* Always a 5 percent chance of working */
2003 if (chance > 95) chance = 95;
2006 if (randint0(100) < chance)
2008 if (flush_failure) flush();
2010 msg_format("%s¤Î½¸Ãæ¤Ë¼ºÇÔ¤·¤¿¡ª",p);
2012 msg_format("You failed to concentrate hard enough!");
2017 if ((use_mind != MIND_BERSERKER) && (use_mind != MIND_NINJUTSU))
2019 if ((use_mind == MIND_KI) && (n != 5) && p_ptr->magic_num1[0])
2022 msg_print("µ¤¤¬»¶¤Ã¤Æ¤·¤Þ¤Ã¤¿¡¥¡¥¡¥");
2024 msg_print("Your improved Force has gone away...");
2026 p_ptr->magic_num1[0] = 0;
2029 if (randint1(100) < (chance / 2))
2034 if( use_mind == MIND_MINDCRAFTER ){
2038 msg_print("¤Ê¤ó¤Æ¤³¤Ã¤¿¡ªÆ¬¤ÎÃ椬¿¿¤ÃÇò¤Ë¤Ê¤Ã¤¿¡ª");
2040 msg_print("Oh, no! Your mind has gone blank!");
2048 msg_print("´ñ̯¤Ê¸÷·Ê¤¬ÌܤÎÁ°¤ÇÍ٤äƤ¤¤ë...");
2050 msg_print("Weird visions seem to dance before your eyes...");
2053 set_image(p_ptr->image + 5 + randint1(10));
2058 msg_print("¤¢¤Ê¤¿¤ÎƬ¤Ïº®Í𤷤¿¡ª");
2060 msg_print("Your brain is addled!");
2063 set_confused(p_ptr->confused + randint1(8));
2067 set_stun(p_ptr->stun + randint1(8));
2073 msg_format("%s¤ÎÎϤ¬À©¸æ¤Ç¤¤Ê¤¤ÈÅή¤È¤Ê¤Ã¤Æ²òÊü¤µ¤ì¤¿¡ª", p);
2075 msg_print("Your mind unleashes its power in an uncontrollable storm!");
2078 project(1, 2 + plev / 10, py, px, plev * 2,
2079 GF_MANA, PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM, -1);
2080 p_ptr->csp = MAX(0, p_ptr->csp - plev * MAX(1, plev / 10));
2083 if( use_mind == MIND_MIRROR_MASTER ){
2086 /* Nothing has happen */
2091 msg_print("¶À¤ÎÀ¤³¦¤Î´³¾Ä¤ò¼õ¤±¤¿¡ª");
2093 msg_print("Weird visions seem to dance before your eyes...");
2095 teleport_player(10);
2101 msg_print("¤Þ¤ï¤ê¤Î¤â¤Î¤¬¥¥é¥¥éµ±¤¤¤Æ¤¤¤ë¡ª");
2103 msg_print("Your brain is addled!");
2106 set_image(p_ptr->image + 5 + randint1(10));
2112 msg_format("%s¤ÎÎϤ¬À©¸æ¤Ç¤¤Ê¤¤ÈÅή¤È¤Ê¤Ã¤Æ²òÊü¤µ¤ì¤¿¡ª", p);
2114 msg_print("Your mind unleashes its power in an uncontrollable storm!");
2117 project(1, 2 + plev / 10, py, px, plev * 2,
2118 GF_MANA, PROJECT_JUMP | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM, -1);
2119 p_ptr->csp = MAX(0, p_ptr->csp - plev * MAX(1, plev / 10));
2131 case MIND_MINDCRAFTER:
2132 /* Cast the spell */
2133 cast = cast_mindcrafter_spell(n);
2136 /* Cast the spell */
2137 cast = cast_force_spell(n);
2139 case MIND_BERSERKER:
2140 /* Cast the spell */
2141 cast = cast_berserk_spell(n);
2143 case MIND_MIRROR_MASTER:
2144 /* Cast the spell */
2145 if( is_mirror_grid(&cave[py][px]) )on_mirror = TRUE;
2146 cast = cast_mirror_spell(n);
2149 /* Cast the spell */
2150 cast = cast_ninja_spell(n);
2154 msg_format("Ææ¤ÎǽÎÏ:%d, %d",use_mind, n);
2156 msg_format("Mystery power:%d, %d",use_mind, n);
2167 /* teleport from mirror costs small energy */
2168 if( on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER )
2170 if( n==3 || n==5 || n==7 || n==16 )energy_use = 50;
2173 if ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU))
2176 take_hit(DAMAGE_USELIFE, mana_cost, "²áÅ٤ν¸Ãæ", -1);
2178 take_hit(DAMAGE_USELIFE, mana_cost, "concentrating too hard", -1);
2181 p_ptr->redraw |= (PR_HP);
2184 /* Sufficient mana */
2185 else if (mana_cost <= old_csp)
2188 p_ptr->csp -= mana_cost;
2191 if (p_ptr->csp < 0) p_ptr->csp = 0;
2193 if ((use_mind == MIND_MINDCRAFTER) && (n == 13))
2197 p_ptr->csp_frac = 0;
2201 /* Over-exert the player */
2204 int oops = mana_cost - old_csp;
2207 if ((p_ptr->csp - mana_cost) < 0) p_ptr->csp_frac = 0;
2208 p_ptr->csp = MAX(0, p_ptr->csp - mana_cost);
2212 msg_format("%s¤ò½¸Ã椷¤¹¤®¤Æµ¤¤ò¼º¤Ã¤Æ¤·¤Þ¤Ã¤¿¡ª",p);
2214 msg_print("You faint from the effort!");
2218 /* Hack -- Bypass free action */
2219 (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
2221 /* Damage WIS (possibly permanently) */
2222 if (randint0(100) < 50)
2224 bool perm = (randint0(100) < 25);
2228 msg_print("¼«Ê¬¤ÎÀº¿À¤ò¹¶·â¤·¤Æ¤·¤Þ¤Ã¤¿¡ª");
2230 msg_print("You have damaged your mind!");
2234 /* Reduce constitution */
2235 (void)dec_stat(A_WIS, 15 + randint1(10), perm);
2240 p_ptr->redraw |= (PR_MANA);
2243 p_ptr->window |= (PW_PLAYER);
2244 p_ptr->window |= (PW_SPELL);
2249 * do_cmd_cast calls this function if the player's class
2252 void do_cmd_mind_browse(void)
2259 if (p_ptr->pclass == CLASS_MINDCRAFTER) use_mind = MIND_MINDCRAFTER;
2260 else if (p_ptr->pclass == CLASS_FORCETRAINER) use_mind = MIND_KI;
2261 else if (p_ptr->pclass == CLASS_BERSERKER) use_mind = MIND_BERSERKER;
2262 else if (p_ptr->pclass == CLASS_NINJA) use_mind = MIND_NINJUTSU;
2263 else if (p_ptr->pclass == CLASS_MIRROR_MASTER)
2264 use_mind = MIND_MIRROR_MASTER;
2271 if (!get_mind_power(&n, TRUE))
2277 /* Clear lines, position cursor (really should use strlen here) */
2278 Term_erase(12, 21, 255);
2279 Term_erase(12, 20, 255);
2280 Term_erase(12, 19, 255);
2281 Term_erase(12, 18, 255);
2282 Term_erase(12, 17, 255);
2283 Term_erase(12, 16, 255);
2285 roff_to_buf(mind_tips[use_mind][n], 62, temp, sizeof(temp));
2286 for(j=0, line = 17;temp[j];j+=(1+strlen(&temp[j])))
2288 prt(&temp[j], line, 15);
2293 case MIND_MIRROR_MASTER:
2296 prt("²¿¤«¥¡¼¤ò²¡¤·¤Æ²¼¤µ¤¤¡£",0,0);
2298 prt("Hit any key.",0,0);