OSDN Git Service

[Refactor] #38997 aggravate_monsters() にplayer_type * 引数を追加 / Added player_type ...
[hengband/hengband.git] / src / mspells3.c
1 /*!
2  * @file mspells3.c
3  * @brief 青魔法の処理実装 / Blue magic
4  * @date 2014/01/15
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 #include "core.h"
15 #include "util.h"
16
17 #include "floor.h"
18 #include "grid.h"
19 #include "spells-summon.h"
20 #include "avatar.h"
21 #include "spells-status.h"
22 #include "cmd-spell.h"
23 #include "player-status.h"
24 #include "monster-spell.h"
25 #include "monster-status.h"
26 #include "spells.h"
27 #include "cmd-basic.h"
28 #include "player-effects.h"
29 #include "targeting.h"
30 #include "view-mainwindow.h"
31
32 #define pseudo_plev() (((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 130) /*!< モンスター魔法をプレイヤーが使用する場合の換算レベル */
33
34
35  /*!
36   * @brief 青魔法テーブル
37   * @details
38   * level,  smana,  %fail,  manedam,  %manefail,  use_stat, name
39   */
40 const monster_power monster_powers[MAX_MONSPELLS] =
41 {
42 #ifdef JP
43 {  1,   1,  10,    0,  15, A_CON,  "叫ぶ"},
44 { 10,   4,  35,   89,  40, A_INT,  "何か"},
45 { 40,  35,  85,    0,  40, A_INT,  "魔力消去"},
46 { 35,  30,  80,  800,  70, A_STR,  "ロケット"},
47 {  5,   1,  20,   18,  15, A_DEX,  "射撃"},
48 { 10,   4,  35,   89,  40, A_INT,  "何か"},
49 { 10,   4,  35,   89,  40, A_INT,  "何か"},
50 { 10,   4,  35,   89,  40, A_INT,  "何か"},
51 { 20,  15,  55, 1600,  95, A_CON,  "酸のブレス"},
52 { 20,  15,  55, 1600,  95, A_CON,  "電撃のブレス"},
53 { 20,  15,  55, 1600,  95, A_CON,  "炎のブレス"},
54 { 20,  15,  55, 1600,  95, A_CON,  "冷気のブレス"},
55 { 20,  15,  55,  800,  95, A_CON,  "毒のブレス"},
56 { 20,  15,  70,  550,  95, A_CON,  "地獄のブレス"},
57 { 20,  16,  70,  400,  95, A_CON,  "閃光のブレス"},
58 { 20,  16,  70,  400,  95, A_CON,  "暗黒のブレス"},
59 { 20,  20,  70,  450,  95, A_CON,  "混乱のブレス"},
60 { 20,  20,  70,  450,  95, A_CON,  "轟音のブレス"},
61 { 20,  20,  70,  600,  95, A_CON,  "カオスのブレス"},
62 { 20,  16,  70,  500,  95, A_CON,  "劣化のブレス"},
63 { 30,  25,  80,  250,  95, A_CON,  "因果混乱のブレス"},
64 { 35,  18,  80,  150,  95, A_CON,  "時間逆転のブレス"},
65 { 30,  25,  80,  200,  95, A_CON,  "遅鈍のブレス"},
66 { 30,  28,  90,  200,  95, A_CON,  "重力のブレス"},
67 { 20,  15,  70,  500,  95, A_CON,  "破片のブレス"},
68 { 35,  15,  80,  150,  95, A_CON,  "プラズマのブレス"},
69 { 30,  18,  70,  200,  95, A_CON,  "フォースのブレス"},
70 { 30,  28,  80,  250,  95, A_CON,  "魔力のブレス"},
71 { 25,  20,  95,  320,  80, A_INT,  "放射能球"},
72 { 25,  15,  70,  800,  95, A_CON,  "放射性廃棄物のブレス"},
73 { 30,  32,  85,  400,  80, A_INT,  "純ログルス"},
74 { 35,  40,  95,  150,  95, A_CON,  "分解のブレス"},
75 { 18,  13,  55,  630,  80, A_INT,  "アシッド・ボール"},
76 { 14,  10,  45,  316,  60, A_INT,  "サンダー・ボール"},
77 { 20,  14,  60,  720,  80, A_INT,  "ファイア・ボール"},
78 { 15,  11,  50,  320,  60, A_INT,  "アイス・ボール"},
79 {  5,   3,  40,   48,  20, A_INT,  "悪臭雲"},
80 { 25,  18,  70,  350,  80, A_INT,  "地獄球"},
81 { 30,  22,  75,  350,  80, A_INT,  "ウォーター・ボール"},
82 { 44,  45,  85,  550,  95, A_INT,  "魔力の嵐"},
83 { 40,  42,  90,  550,  95, A_INT,  "暗黒の嵐"},
84 { 10,   5,  50,    0,  25, A_INT,  "魔力吸収"},
85 { 25,  10,  60,    0,  30, A_INT,  "精神攻撃"},
86 { 30,  14,  65,    0,  30, A_INT,  "脳攻撃"},
87 {  3,   1,  25,   24,  20, A_INT,  "軽傷"},
88 { 12,   2,  35,   64,  25, A_INT,  "重傷"},
89 { 22,   6,  50,  150,  30, A_INT,  "致命傷"},
90 { 32,  10,  70,  225,  35, A_INT,  "秘孔を突く"},
91 { 13,   7,  40,  178,  40, A_INT,  "アシッド・ボルト"},
92 { 10,   5,  35,  130,  35, A_INT,  "サンダー・ボルト"},
93 { 15,   9,  50,  210,  45, A_INT,  "ファイア・ボルト"},
94 { 12,   6,  35,  162,  40, A_INT,  "アイス・ボルト"},
95 { 40,  42,  90,  550,  95, A_INT,  "スター・バースト"},
96 { 25,  17,  60,  255,  60, A_INT,  "地獄の矢"},
97 { 25,  20,  65,  250,  60, A_INT,  "ウォーター・ボルト"},
98 { 25,  24,  90,  400,  80, A_INT,  "魔力の矢"},
99 { 25,  20,  80,  216,  60, A_INT,  "プラズマ・ボルト"},
100 { 25,  16,  60,  186,  60, A_INT,  "極寒の矢"},
101 {  3,   1,  25,   12,  20, A_INT,  "マジック・ミサイル"},
102 {  5,   3,  35,    0,  20, A_INT,  "恐慌"},
103 { 10,   5,  40,    0,  20, A_INT,  "盲目"},
104 { 10,   5,  40,    0,  20, A_INT,  "パニック・モンスター"},
105 { 10,   5,  40,    0,  20, A_INT,  "スロウ・モンスター"},
106 { 10,   5,  40,    0,  20, A_INT,  "スリープ・モンスター"},
107 { 20,  10,  70,    0,  40, A_INT,  "スピード"},
108 { 45, 120,  95,    0,  60, A_INT,  "破滅の手"},
109 { 20,  15,  70,    0,  20, A_WIS,  "体力回復"},
110 { 45,  65,  80,    0,  60, A_INT,  "無傷の球"},
111 {  5,   1,  30,    0,  20, A_INT,  "ショート・テレポート"},
112 { 15,   8,  40,    0,  30, A_INT,  "テレポート"},
113 { 40, 999,  99,    0,  80, A_INT,  "ザ・ワールド"},
114 {  1,   0,   0,    0,  15, A_INT,  "何か"},
115 { 15,   8,  50,    0,  30, A_INT,  "引きよせる"},
116 { 20,  13,  80,    0,  30, A_INT,  "テレポート・アウェイ"},
117 { 30,  40,  95,    0,  40, A_INT,  "テレポート・レベル"},
118 { 35,  30,  80,  350,  70, A_INT,  "光の剣"},
119 {  5,   1,  20,    0,  15, A_INT,  "暗闇"},
120 {  5,   1,  20,    0,  15, A_DEX,  "トラップ創造"},
121 { 15,   3,  40,    0,  30, A_INT,  "記憶喪失"},
122 { 30,  30,  70,    0,  40, A_INT,  "死者復活"},
123 { 40,  70,  85,    0,  45, A_INT,  "援軍を呼ぶ"},
124 { 45,  90,  90,    0,  50, A_INT,  "サイバーデーモンの召喚"},
125 { 25,  20,  65,    0,  30, A_INT,  "モンスターの召喚"},
126 { 35,  30,  75,    0,  40, A_INT,  "複数のモンスターの召喚"},
127 { 25,  25,  65,    0,  25, A_INT,  "アリの召喚"},
128 { 25,  20,  60,    0,  25, A_INT,  "蜘蛛の召喚"},
129 { 35,  26,  75,    0,  40, A_INT,  "ハウンドの召喚"},
130 { 30,  23,  70,    0,  35, A_INT,  "ヒドラの召喚"},
131 { 40,  50,  85,    0,  40, A_INT,  "天使の召喚"},
132 { 35,  50,  80,    0,  35, A_INT,  "デーモンの召喚"},
133 { 30,  30,  75,    0,  35, A_INT,  "アンデッドの召喚"},
134 { 39,  70,  80,    0,  40, A_INT,  "ドラゴンの召喚"},
135 { 43,  85,  85,    0,  45, A_INT,  "上級アンデッドの召喚"},
136 { 46,  90,  85,    0,  45, A_INT,  "古代ドラゴンの召喚"},
137 { 48, 120,  90,    0,  50, A_INT,  "アンバーの王族の召喚"},
138 { 50, 150,  95,    0,  50, A_INT,  "ユニークモンスターの召喚"},
139 #else
140 {  1,   1,  10,    0,  15, A_CON,  "shriek"},
141 { 10,   4,  35,   89,  40, A_INT,  "something"},
142 { 40,  35,  85,    0,  40, A_INT,  "dispel-magic"},
143 { 35,  30,  80,  800,  70, A_STR,  "rocket"},
144 {  2,   1,  15,   10,  15, A_DEX,  "arrow"},
145 {  5,   2,  20,   18,  20, A_DEX,  "arrows"},
146 { 12,   3,  25,   30,  25, A_DEX,  "missile"},
147 { 16,   4,  30,   42,  30, A_DEX,  "missiles"},
148 { 20,  15,  55, 1600,  95, A_CON,  "breath acid"},
149 { 20,  15,  55, 1600,  95, A_CON,  "breath lightning"},
150 { 20,  15,  55, 1600,  95, A_CON,  "breath fire"},
151 { 20,  15,  55, 1600,  95, A_CON,  "breath cold"},
152 { 20,  15,  55,  800,  95, A_CON,  "breath poison"},
153 { 20,  15,  70,  550,  95, A_CON,  "breath nether"},
154 { 20,  16,  70,  400,  95, A_CON,  "breath light"},
155 { 20,  16,  70,  400,  95, A_CON,  "breath dark"},
156 { 20,  20,  70,  450,  95, A_CON,  "breath confusion"},
157 { 20,  20,  70,  450,  95, A_CON,  "breath sound"},
158 { 20,  20,  70,  600,  95, A_CON,  "breath chaos"},
159 { 20,  16,  70,  500,  95, A_CON,  "breath disenchantment"},
160 { 30,  25,  80,  250,  95, A_CON,  "breath nexus"},
161 { 35,  18,  80,  150,  95, A_CON,  "breath time"},
162 { 30,  25,  80,  200,  95, A_CON,  "breath inertia"},
163 { 30,  28,  90,  200,  95, A_CON,  "breath gravity"},
164 { 20,  15,  70,  500,  95, A_CON,  "breath shards"},
165 { 35,  15,  80,  150,  95, A_CON,  "breath plasma"},
166 { 30,  18,  70,  200,  95, A_CON,  "breath force"},
167 { 30,  28,  80,  250,  95, A_CON,  "breath mana"},
168 { 25,  20,  95,  320,  80, A_INT,  "nuke ball"},
169 { 25,  15,  70,  800,  95, A_CON,  "breath nuke"},
170 { 30,  32,  85,  400,  80, A_INT,  "raw Logrus"},
171 { 35,  40,  95,  150,  95, A_CON,  "breath disintegrate"},
172 { 18,  13,  55,  630,  80, A_INT,  "acid ball"},
173 { 14,  10,  45,  316,  60, A_INT,  "lightning ball"},
174 { 20,  14,  60,  720,  80, A_INT,  "fire ball"},
175 { 15,  11,  50,  320,  60, A_INT,  "frost ball"},
176 {  5,   3,  40,   48,  20, A_INT,  "stinking cloud"},
177 { 25,  18,  70,  350,  80, A_INT,  "nether ball"},
178 { 30,  22,  75,  350,  80, A_INT,  "water ball"},
179 { 44,  45,  85,  550,  95, A_INT,  "mana storm"},
180 { 40,  42,  90,  550,  95, A_INT,  "darkness storm"},
181 { 10,   5,  50,    0,  25, A_INT,  "drain mana"},
182 { 25,  10,  60,    0,  30, A_INT,  "mind blast"},
183 { 30,  14,  65,    0,  30, A_INT,  "brain smash"},
184 {  3,   1,  25,   24,  20, A_INT,  "cause light wounds"},
185 { 12,   2,  35,   64,  25, A_INT,  "cause serious wounds"},
186 { 22,   6,  50,  150,  30, A_INT,  "cause critical wounds"},
187 { 32,  10,  70,  225,  35, A_INT,  "cause mortal wounds"},
188 { 13,   7,  40,  178,  40, A_INT,  "acid bolt"},
189 { 10,   5,  35,  130,  35, A_INT,  "lightning bolt"},
190 { 15,   9,  50,  210,  45, A_INT,  "fire bolt"},
191 { 12,   6,  35,  162,  40, A_INT,  "frost bolt"},
192 { 40,  42,  90,  550,  95, A_INT,  "starburst"},
193 { 25,  17,  60,  255,  60, A_INT,  "nether bolt"},
194 { 25,  20,  65,  250,  60, A_INT,  "water bolt"},
195 { 25,  24,  90,  400,  80, A_INT,  "mana bolt"},
196 { 25,  20,  80,  216,  60, A_INT,  "plasma bolt"},
197 { 25,  16,  60,  186,  60, A_INT,  "ice bolt"},
198 {  3,   1,  25,   12,  20, A_INT,  "magic missile"},
199 {  5,   3,  35,    0,  20, A_INT,  "scare"},
200 { 10,   5,  40,    0,  20, A_INT,  "blind"},
201 { 10,   5,  40,    0,  20, A_INT,  "confuse"},
202 { 10,   5,  40,    0,  20, A_INT,  "slow"},
203 { 10,   5,  40,    0,  20, A_INT,  "sleep"},
204 { 20,  10,  70,    0,  40, A_INT,  "speed"},
205 { 45, 120,  95,    0,  60, A_INT,  "the Hand of Doom"},
206 { 20,  15,  70,    0,  20, A_WIS,  "heal-self"},
207 { 45,  65,  80,    0,  60, A_INT,  "make invulnerable"},
208 {  5,   1,  30,    0,  20, A_INT,  "blink-self"},
209 { 15,   8,  40,    0,  30, A_INT,  "teleport-self"},
210 { 40, 999,  99,    0,  80, A_INT,  "The world"},
211 {  1,   0,   0,    0,  15, A_INT,  "something"},
212 { 15,   8,  50,    0,  30, A_INT,  "teleport to"},
213 { 20,  13,  80,    0,  30, A_INT,  "teleport away"},
214 { 30,  40,  95,    0,  40, A_INT,  "teleport level"},
215 { 35,  30,  80,  350,  70, A_INT,  "psycho-spear"},
216 {  5,   1,  20,    0,  15, A_INT,  "create darkness"},
217 {  5,   1,  20,    0,  15, A_DEX,  "create traps"},
218 { 15,   3,  40,    0,  30, A_INT,  "cause amnesia"},
219 { 30,  30,  70,    0,  40, A_INT,  "raise dead"},
220 { 40,  70,  85,    0,  45, A_INT,  "summon aid"},
221 { 45,  90,  90,    0,  50, A_INT,  "summon Cyberdemons"},
222 { 25,  20,  65,    0,  30, A_INT,  "summon a monster"},
223 { 35,  30,  75,    0,  40, A_INT,  "summon monsters"},
224 { 25,  25,  65,    0,  25, A_INT,  "summon ants"},
225 { 25,  20,  60,    0,  25, A_INT,  "summon spiders"},
226 { 35,  26,  75,    0,  40, A_INT,  "summon hounds"},
227 { 30,  23,  70,    0,  35, A_INT,  "summon hydras"},
228 { 40,  50,  85,    0,  40, A_INT,  "summon an angel"},
229 { 35,  50,  80,    0,  35, A_INT,  "summon a daemon"},
230 { 30,  30,  75,    0,  35, A_INT,  "summon an undead"},
231 { 39,  70,  80,    0,  40, A_INT,  "summon a dragon"},
232 { 43,  85,  85,    0,  45, A_INT,  "summon Greater Undead"},
233 { 46,  90,  85,    0,  45, A_INT,  "summon Ancient Dragon"},
234 { 48, 120,  90,    0,  50, A_INT,  "summon Lords of Amber"},
235 { 50, 150,  95,    0,  50, A_INT,  "summon Unique Monsters"},
236 #endif
237
238 };
239
240 /*!
241  * @brief モンスター魔法名テーブル
242  */
243 const concptr monster_powers_short[MAX_MONSPELLS] = {
244 #ifdef JP
245
246         "叫ぶ", "何か", "魔力消去", "ロケット", "射撃", "何か", "何か", "何か",
247         "酸", "電撃", "火炎", "冷気", "毒", "地獄", "閃光", "暗黒",
248         "混乱", "轟音", "カオス", "劣化", "因果混乱", "時間逆転", "遅鈍", "重力",
249         "破片", "プラズマ", "フォース", "魔力", "放射能球", "放射性廃棄物", "純ログルス", "分解",
250
251         "酸", "電撃", "火炎", "冷気", "悪臭雲", "地獄球", "ウォーター", "魔力の嵐",
252         "暗黒の嵐", "魔力吸収", "精神攻撃", "脳攻撃", "軽傷", "重傷", "致命傷", "秘孔を突く",
253         "酸", "電撃", "火炎", "冷気", "スターバースト", "地獄の矢", "ウォーター", "魔力の矢",
254         "プラズマ", "極寒", "マジックミサイル", "恐慌", "盲目", "混乱", "減速", "睡眠",
255
256         "加速", "破滅の手", "体力回復", "無傷の球", "ショートテレポート", "テレポート", "時を止める", "何か",
257         "引きよせる", "テレポートアウェイ", "テレポートレベル", "光の剣", "暗闇", "トラップ創造", "記憶喪失", "死者復活",
258         "援軍", "サイバーデーモン", "モンスター", "複数のモンスター", "蟻", "蜘蛛", "ハウンド", "ヒドラ",
259         "天使", "悪魔", "アンデッド", "ドラゴン", "上級アンデッド", "古代ドラゴン", "アンバーの王族", "ユニーク"
260
261 #else
262
263         "Shriek", "Something", "Dispel-magic", "Rocket", "Arrow", "Arrows", "Missile", "Missiles",
264         "Acid", "Lightning", "Fire", "Cold", "Poison", "Nether", "Light", "Dark",
265         "Confusion", "Sound", "Chaos", "Disenchantment", "Nexus", "Time", "Inertia", "Gravity",
266         "Shards", "Plasma", "Force", "Mana", "Nuke", "Nuke", "Logrus", "Disintergrate",
267
268         "Acid", "Lightning", "Fire", "Frost", "Stinking Cloud", "Nether", "Water", "Mana storm",
269         "Darkness storm", "Drain mana", "Mind blast", "Brain smash", "Cause Light Wound", "Cause Serious Wound", "Cause Critical Wound", "Cause Mortal Wound",
270         "Acid", "Lightning", "Fire", "Frost", "Starburst", "Nether", "Water", "Mana",
271         "Plasm", "Ice", "Magic missile", "Scare", "Blind", "Confuse", "Slow", "Sleep",
272
273         "Speed", "Hand of doom", "Heal-self", "Invulnerable", "Blink", "Teleport", "The world", "Something",
274         "Teleport to", "Teleport away", "Teleport level", "Psycho-spear", "Create darkness", "Create traps", "Amnesia", "Raise dead",
275         "Aid", "Cyberdeamons", "A monster", "Monsters", "Ants", "Spiders", "Hounds", "Hydras",
276         "Angel", "Daemon", "Undead", "Dragon", "Greater Undead", "Ancient Dragon", "Lords of Amber", "Unique monsters"
277
278 #endif
279 };
280
281
282
283 /*!
284 * @brief 文字列に青魔導師の呪文の攻撃力を加える
285 * @param SPELL_NUM 呪文番号
286 * @param plev プレイヤーレベル
287 * @param msg 表示する文字列
288 * @param tmp 返すメッセージを格納する配列
289 * @return なし
290 */
291 void set_bluemage_damage(int SPELL_NUM, PLAYER_LEVEL plev, concptr msg, char* tmp)
292 {
293     int base_damage = monspell_bluemage_damage(SPELL_NUM, plev, BASE_DAM);
294     int dice_num = monspell_bluemage_damage(SPELL_NUM, plev, DICE_NUM);
295     int dice_side = monspell_bluemage_damage(SPELL_NUM, plev, DICE_SIDE);
296     int dice_mult = monspell_bluemage_damage(SPELL_NUM, plev, DICE_MULT);
297     int dice_div = monspell_bluemage_damage(SPELL_NUM, plev, DICE_DIV);
298     char dmg_str[80];
299     dice_to_string(base_damage, dice_num, dice_side, dice_mult, dice_div, dmg_str);
300     sprintf(tmp, " %s %s", msg, dmg_str);
301 }
302
303 /*!
304  * @brief 受け取ったモンスター魔法のIDに応じて青魔法の効果情報をまとめたフォーマットを返す
305  * @param p 情報を返す文字列参照ポインタ
306  * @param power モンスター魔法のID
307  * @return なし
308  */
309 static void learned_info(char *p, int power)
310 {
311         PLAYER_LEVEL plev = pseudo_plev();
312
313         strcpy(p, "");
314
315         switch (power)
316         {
317                 case MS_SHRIEK:
318                 case MS_XXX1:
319                 case MS_XXX2:
320                 case MS_XXX3:
321                 case MS_XXX4:
322                 case MS_SCARE:
323                 case MS_BLIND:
324                 case MS_CONF:
325                 case MS_SLOW:
326                 case MS_SLEEP:
327                 case MS_HAND_DOOM:
328                 case MS_WORLD:
329                 case MS_SPECIAL:
330                 case MS_TELE_TO:
331                 case MS_TELE_AWAY:
332                 case MS_TELE_LEVEL:
333                 case MS_DARKNESS:
334                 case MS_MAKE_TRAP:
335                 case MS_FORGET:
336                 case MS_S_KIN:
337                 case MS_S_CYBER:
338                 case MS_S_MONSTER:
339                 case MS_S_MONSTERS:
340                 case MS_S_ANT:
341                 case MS_S_SPIDER:
342                 case MS_S_HOUND:
343                 case MS_S_HYDRA:
344                 case MS_S_ANGEL:
345                 case MS_S_DEMON:
346                 case MS_S_UNDEAD:
347                 case MS_S_DRAGON:
348                 case MS_S_HI_UNDEAD:
349                 case MS_S_HI_DRAGON:
350                 case MS_S_AMBERITE:
351                 case MS_S_UNIQUE:
352                         break;
353         case MS_BALL_MANA:
354         case MS_BALL_DARK:
355         case MS_STARBURST: 
356             set_bluemage_damage((power), plev, KWD_DAM, p); break;
357                 case MS_DISPEL:
358                         break;
359         case MS_ROCKET:
360         case MS_SHOOT:
361         case MS_BR_ACID:
362         case MS_BR_ELEC:
363         case MS_BR_FIRE:
364         case MS_BR_COLD:
365         case MS_BR_POIS:
366         case MS_BR_NUKE: 
367         case MS_BR_NEXUS:
368         case MS_BR_TIME:
369         case MS_BR_GRAVITY:
370         case MS_BR_MANA:
371         case MS_BR_NETHER:
372         case MS_BR_LITE:
373         case MS_BR_DARK:
374         case MS_BR_CONF:
375         case MS_BR_SOUND:
376         case MS_BR_CHAOS:
377         case MS_BR_DISEN:
378         case MS_BR_SHARDS:
379         case MS_BR_PLASMA:
380         case MS_BR_INERTIA:
381         case MS_BR_FORCE:
382         case MS_BR_DISI:
383         case MS_BALL_NUKE:
384         case MS_BALL_CHAOS:
385         case MS_BALL_ACID:
386         case MS_BALL_ELEC:
387         case MS_BALL_FIRE:
388         case MS_BALL_COLD:
389         case MS_BALL_POIS:
390         case MS_BALL_NETHER:
391         case MS_BALL_WATER:
392             set_bluemage_damage((power), plev, KWD_DAM, p); break;
393         case MS_DRAIN_MANA:
394             set_bluemage_damage((power), plev, KWD_HEAL, p); break;
395         case MS_MIND_BLAST:
396         case MS_BRAIN_SMASH:
397         case MS_CAUSE_1:
398         case MS_CAUSE_2:
399         case MS_CAUSE_3:
400         case MS_CAUSE_4:
401         case MS_BOLT_ACID:
402         case MS_BOLT_ELEC:
403         case MS_BOLT_FIRE:
404         case MS_BOLT_COLD:
405         case MS_BOLT_NETHER:
406         case MS_BOLT_WATER:
407         case MS_BOLT_MANA:
408         case MS_BOLT_PLASMA:
409         case MS_BOLT_ICE: 
410         case MS_MAGIC_MISSILE: 
411             set_bluemage_damage((power), plev, KWD_DAM, p); break;
412                 case MS_SPEED:
413                         sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
414                         break;
415         case MS_HEAL:
416             set_bluemage_damage((power), plev, KWD_HEAL, p); break;
417                 case MS_INVULNER:
418                         sprintf(p, " %sd7+7", KWD_DURATION);
419                         break;
420                 case MS_BLINK:
421                         sprintf(p, " %s10", KWD_SPHERE);
422                         break;
423                 case MS_TELEPORT:
424                         sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
425                         break;
426         case MS_PSY_SPEAR:
427             set_bluemage_damage((power), plev, KWD_DAM, p); break;
428                         break;
429                 case MS_RAISE_DEAD:
430                         sprintf(p, " %s5", KWD_SPHERE);
431                         break;
432                 default:
433                         break;
434         }
435 }
436
437
438 /*!
439  * @brief 使用可能な青魔法を選択する /
440  * Allow user to choose a imitation.
441  * @param sn 選択したモンスター攻撃ID、キャンセルの場合-1、不正な選択の場合-2を返す
442  * @return 発動可能な魔法を選択した場合TRUE、キャンセル処理か不正な選択が行われた場合FALSEを返す。
443  * @details
444  * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
445  * If the user hits escape, returns FALSE, and set '*sn' to -1\n
446  * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n
447  *\n
448  * The "prompt" should be "cast", "recite", or "study"\n
449  * The "known" should be TRUE for cast/pray, FALSE for study\n
450  *\n
451  * nb: This function has a (trivial) display bug which will be obvious\n
452  * when you run it. It's probably easy to fix but I haven't tried,\n
453  * sorry.\n
454  */
455 static bool get_learned_power(SPELL_IDX *sn)
456 {
457         int             i = 0;
458         int             num = 0;
459         TERM_LEN y = 1;
460         TERM_LEN x = 18;
461         PERCENTAGE minfail = 0;
462         PLAYER_LEVEL plev = p_ptr->lev;
463         PERCENTAGE chance = 0;
464         int             ask = TRUE, mode = 0;
465         int             spellnum[MAX_MONSPELLS];
466         char            ch;
467         char            choice;
468         char            out_val[160];
469         char            comment[80];
470         BIT_FLAGS f4 = 0L, f5 = 0L, f6 = 0L;
471         concptr p = _("魔法", "magic");
472         COMMAND_CODE code;
473         monster_power   spell;
474         bool            flag, redraw;
475         int menu_line = (use_menu ? 1 : 0);
476
477         /* Assume cancelled */
478         *sn = (-1);
479
480         flag = FALSE;
481         redraw = FALSE;
482
483         /* Get the spell, if available */
484         
485         if (repeat_pull(&code))
486         {
487                 *sn = (SPELL_IDX)code;
488                 return (TRUE);
489         }
490
491         if (use_menu)
492         {
493                 screen_save();
494
495                 while(!mode)
496                 {
497                         prt(format(_(" %s ボルト", " %s bolt"), (menu_line == 1) ? _("》", "> ") : "  "), 2, 14);
498                         prt(format(_(" %s ボール", " %s ball"), (menu_line == 2) ? _("》", "> ") : "  "), 3, 14);
499                         prt(format(_(" %s ブレス", " %s breath"), (menu_line == 3) ? _("》", "> ") : "  "), 4, 14);
500                         prt(format(_(" %s 召喚", " %s sommoning"), (menu_line == 4) ? _("》", "> ") : "  "), 5, 14);
501                         prt(format(_(" %s その他", " %s others"), (menu_line == 5) ? _("》", "> ") : "  "), 6, 14);
502                         prt(_("どの種類の魔法を使いますか?", "use which type of magic? "), 0, 0);
503
504                         choice = inkey();
505                         switch(choice)
506                         {
507                         case ESCAPE:
508                         case 'z':
509                         case 'Z':
510                                 screen_load();
511                                 return FALSE;
512                         case '2':
513                         case 'j':
514                         case 'J':
515                                 menu_line++;
516                                 break;
517                         case '8':
518                         case 'k':
519                         case 'K':
520                                 menu_line+= 4;
521                                 break;
522                         case '\r':
523                         case 'x':
524                         case 'X':
525                                 mode = menu_line;
526                                 break;
527                         }
528                         if (menu_line > 5) menu_line -= 5;
529                 }
530                 screen_load();
531         }
532         else
533         {
534         sprintf(comment, _("[A]ボルト, [B]ボール, [C]ブレス, [D]召喚, [E]その他:", "[A] bolt, [B] ball, [C] breath, [D] summoning, [E] others:"));
535         while (TRUE)
536         {
537                 if (!get_com(comment, &ch, TRUE))
538                 {
539                         return FALSE;
540                 }
541                 if (ch == 'A' || ch == 'a')
542                 {
543                         mode = 1;
544                         break;
545                 }
546                 if (ch == 'B' || ch == 'b')
547                 {
548                         mode = 2;
549                         break;
550                 }
551                 if (ch == 'C' || ch == 'c')
552                 {
553                         mode = 3;
554                         break;
555                 }
556                 if (ch == 'D' || ch == 'd')
557                 {
558                         mode = 4;
559                         break;
560                 }
561                 if (ch == 'E' || ch == 'e')
562                 {
563                         mode = 5;
564                         break;
565                 }
566         }
567         }
568
569         set_rf_masks(&f4, &f5, &f6, mode);
570
571         for (i = 0, num = 0; i < 32; i++)
572         {
573                 if ((0x00000001 << i) & f4) spellnum[num++] = i;
574         }
575         for (; i < 64; i++)
576         {
577                 if ((0x00000001 << (i - 32)) & f5) spellnum[num++] = i;
578         }
579         for (; i < 96; i++)
580         {
581                 if ((0x00000001 << (i - 64)) & f6) spellnum[num++] = i;
582         }
583         for (i = 0; i < num; i++)
584         {
585                 if (p_ptr->magic_num2[spellnum[i]])
586                 {
587                         if (use_menu) menu_line = i+1;
588                         break;
589                 }
590         }
591         if (i == num)
592         {
593                 msg_print(_("その種類の魔法は覚えていない!", "You don't know any spell of this type."));
594                 return (FALSE);
595         }
596
597         /* Build a prompt (accept all spells) */
598         (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sを唱えますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
599                 I2A(0), I2A(num - 1), p);
600
601         if (use_menu) screen_save();
602
603         choice= (always_show_list || use_menu) ? ESCAPE:1 ;
604         while (!flag)
605         {
606                 if(choice==ESCAPE) choice = ' '; 
607                 else if( !get_com(out_val, &choice, TRUE) )break; 
608
609                 if (use_menu && choice != ' ')
610                 {
611                         switch(choice)
612                         {
613                                 case '0':
614                                 {
615                                         screen_load();
616                                         return (FALSE);
617                                 }
618
619                                 case '8':
620                                 case 'k':
621                                 case 'K':
622                                 {
623                                         do
624                                         {
625                                                 menu_line += (num-1);
626                                                 if (menu_line > num) menu_line -= num;
627                                         } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
628                                         break;
629                                 }
630
631                                 case '2':
632                                 case 'j':
633                                 case 'J':
634                                 {
635                                         do
636                                         {
637                                                 menu_line++;
638                                                 if (menu_line > num) menu_line -= num;
639                                         } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
640                                         break;
641                                 }
642
643                                 case '6':
644                                 case 'l':
645                                 case 'L':
646                                 {
647                                         menu_line=num;
648                                         while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line--;
649                                         break;
650                                 }
651
652                                 case '4':
653                                 case 'h':
654                                 case 'H':
655                                 {
656                                         menu_line=1;
657                                         while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line++;
658                                         break;
659                                 }
660
661                                 case 'x':
662                                 case 'X':
663                                 case '\r':
664                                 {
665                                         i = menu_line - 1;
666                                         ask = FALSE;
667                                         break;
668                                 }
669                         }
670                 }
671                 /* Request redraw */
672                 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
673                 {
674                         /* Show the list */
675                         if (!redraw || use_menu)
676                         {
677                                 char psi_desc[80];
678                                 redraw = TRUE;
679                                 if (!use_menu) screen_save();
680
681                                 /* Display a list of spells */
682                                 prt("", y, x);
683                                 put_str(_("名前", "Name"), y, x + 5);
684                                 put_str(_("MP 失率 効果", "SP Fail Info"), y, x + 33);
685
686
687                                 /* Dump the spells */
688                                 for (i = 0; i < num; i++)
689                                 {
690                                         int need_mana;
691
692                                         prt("", y + i + 1, x);
693                                         if (!p_ptr->magic_num2[spellnum[i]]) continue;
694
695                                         /* Access the spell */
696                                         spell = monster_powers[spellnum[i]];
697
698                                         chance = spell.fail;
699
700                                         /* Reduce failure rate by "effective" level adjustment */
701                                         if (plev > spell.level) chance -= 3 * (plev - spell.level);
702                                         else chance += (spell.level - plev);
703
704                                         /* Reduce failure rate by INT/WIS adjustment */
705                                         chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
706
707                                         chance = mod_spell_chance_1(p_ptr, chance);
708
709                                         need_mana = mod_need_mana(monster_powers[spellnum[i]].smana, 0, REALM_NONE);
710
711                                         /* Not enough mana to cast */
712                                         if (need_mana > p_ptr->csp)
713                                         {
714                                                 chance += 5 * (need_mana - p_ptr->csp);
715                                         }
716
717                                         /* Extract the minimum failure rate */
718                                         minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
719
720                                         /* Minimum failure rate */
721                                         if (chance < minfail) chance = minfail;
722
723                                         /* Stunning makes spells harder */
724                                         if (p_ptr->stun > 50) chance += 25;
725                                         else if (p_ptr->stun) chance += 15;
726
727                                         /* Always a 5 percent chance of working */
728                                         if (chance > 95) chance = 95;
729
730                                         chance = mod_spell_chance_2(p_ptr, chance);
731
732                                         /* Get info */
733                                         learned_info(comment, spellnum[i]);
734
735                                         if (use_menu)
736                                         {
737                                                 if (i == (menu_line-1)) strcpy(psi_desc, _("  》", "  > "));
738                                                 else strcpy(psi_desc, "    ");
739                                         }
740                                         else sprintf(psi_desc, "  %c)", I2A(i));
741
742                                         /* Dump the spell --(-- */
743                                         strcat(psi_desc, format(" %-26s %3d %3d%%%s",
744                                                 spell.name, need_mana,
745                                                 chance, comment));
746                                         prt(psi_desc, y + i + 1, x);
747                                 }
748
749                                 /* Clear the bottom line */
750                                 if (y < 22) prt("", y + i + 1, x);
751                         }
752
753                         /* Hide the list */
754                         else
755                         {
756                                 /* Hide list */
757                                 redraw = FALSE;
758                                 screen_load();
759                         }
760
761                         /* Redo asking */
762                         continue;
763                 }
764
765                 if (!use_menu)
766                 {
767                         /* Note verify */
768                         ask = isupper(choice);
769
770                         /* Lowercase */
771                         if (ask) choice = (char)tolower(choice);
772
773                         /* Extract request */
774                         i = (islower(choice) ? A2I(choice) : -1);
775                 }
776
777                 /* Totally Illegal */
778                 if ((i < 0) || (i >= num) || !p_ptr->magic_num2[spellnum[i]])
779                 {
780                         bell();
781                         continue;
782                 }
783
784                 /* Save the spell index */
785                 spell = monster_powers[spellnum[i]];
786
787                 /* Verify it */
788                 if (ask)
789                 {
790                         char tmp_val[160];
791
792                         /* Prompt */
793                         (void) strnfmt(tmp_val, 78, _("%sの魔法を唱えますか?", "Use %s? "), monster_powers[spellnum[i]].name);
794
795                         /* Belay that order */
796                         if (!get_check(tmp_val)) continue;
797                 }
798
799                 /* Stop the loop */
800                 flag = TRUE;
801         }
802         if (redraw) screen_load();
803
804         p_ptr->window |= (PW_SPELL);
805         handle_stuff();
806
807         /* Abort if needed */
808         if (!flag) return (FALSE);
809
810         /* Save the choice */
811         (*sn) = spellnum[i];
812
813         repeat_push((COMMAND_CODE)spellnum[i]);
814
815         /* Success */
816         return (TRUE);
817 }
818
819
820 /*!
821  * @brief 青魔法の発動 /
822  * do_cmd_cast calls this function if the player's class is 'blue-mage'.
823  * @param spell 発動するモンスター攻撃のID
824  * @param success TRUEは成功時、FALSEは失敗時の処理を行う
825  * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
826  */
827 static bool cast_learned_spell(player_type *caster_ptr, int spell, bool success)
828 {
829         DIRECTION dir;
830         PLAYER_LEVEL plev = pseudo_plev();
831         PLAYER_LEVEL summon_lev = caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev/2);
832         HIT_POINT damage = 0;
833         bool pet = success;
834         bool no_trump = FALSE;
835         BIT_FLAGS p_mode, u_mode = 0L, g_mode;
836
837         if (pet)
838         {
839                 p_mode = PM_FORCE_PET;
840                 g_mode = 0;
841         }
842         else
843         {
844                 p_mode = PM_NO_PET;
845                 g_mode = PM_ALLOW_GROUP;
846         }
847
848         if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE;
849
850         /* spell code */
851         switch (spell)
852         {
853         case MS_SHRIEK:
854         msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
855                 aggravate_monsters(caster_ptr, 0);
856                 break;
857         case MS_XXX1:
858                 break;
859         case MS_DISPEL:
860         {
861                 MONSTER_IDX m_idx;
862
863                 if (!target_set(TARGET_KILL)) return FALSE;
864                 m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
865                 if (!m_idx) break;
866                 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
867                 if (!projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
868                 dispel_monster_status(m_idx);
869                 break;
870         }
871         case MS_ROCKET:
872                 if (!get_aim_dir(&dir)) return FALSE;
873                 
874         msg_print(_("ロケットを発射した。", "You fire a rocket."));
875         damage = monspell_bluemage_damage((MS_ROCKET), plev, DAM_ROLL);
876                 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
877                 break;
878         case MS_SHOOT:
879         {
880                 if (!get_aim_dir(&dir)) return FALSE;
881                 
882         msg_print(_("矢を放った。", "You fire an arrow."));
883         damage = monspell_bluemage_damage((MS_SHOOT), plev, DAM_ROLL);
884                 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
885                 break;
886         }
887         case MS_XXX2:
888                 break;
889         case MS_XXX3:
890                 break;
891         case MS_XXX4:
892                 break;
893         case MS_BR_ACID:
894                 if (!get_aim_dir(&dir)) return FALSE;
895
896         msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
897         damage = monspell_bluemage_damage((MS_BR_ACID), plev, DAM_ROLL);
898                 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 40 ? 3 : 2));
899                 break;
900         case MS_BR_ELEC:
901                 if (!get_aim_dir(&dir)) return FALSE;
902
903         msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
904         damage = monspell_bluemage_damage((MS_BR_ELEC), plev, DAM_ROLL);
905                 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 40 ? 3 : 2));
906                 break;
907         case MS_BR_FIRE:
908                 if (!get_aim_dir(&dir)) return FALSE;
909
910         msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
911         damage = monspell_bluemage_damage((MS_BR_FIRE), plev, DAM_ROLL);
912                 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 40 ? 3 : 2));
913                 break;
914         case MS_BR_COLD:
915         if (!get_aim_dir(&dir)) return FALSE;
916
917         msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
918         damage = monspell_bluemage_damage((MS_BR_COLD), plev, DAM_ROLL);
919                 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 40 ? 3 : 2));
920                 break;
921         case MS_BR_POIS:
922         if (!get_aim_dir(&dir)) return FALSE;
923
924         msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
925         damage = monspell_bluemage_damage((MS_BR_POIS), plev, DAM_ROLL);
926                 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 40 ? 3 : 2));
927                 break;
928         case MS_BR_NETHER:
929         if (!get_aim_dir(&dir)) return FALSE;
930
931         msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
932         damage = monspell_bluemage_damage((MS_BR_NETHER), plev, DAM_ROLL);
933                 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 40 ? 3 : 2));
934                 break;
935         case MS_BR_LITE:
936                 if (!get_aim_dir(&dir)) return FALSE;
937
938         msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
939         damage = monspell_bluemage_damage((MS_BR_LITE), plev, DAM_ROLL);
940                 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 40 ? 3 : 2));
941                 break;
942         case MS_BR_DARK:
943                 if (!get_aim_dir(&dir)) return FALSE;
944
945         msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
946         damage = monspell_bluemage_damage((MS_BR_DARK), plev, DAM_ROLL);
947                 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 40 ? 3 : 2));
948                 break;
949         case MS_BR_CONF:
950                 if (!get_aim_dir(&dir)) return FALSE;
951
952         msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
953         damage = monspell_bluemage_damage((MS_BR_CONF), plev, DAM_ROLL);
954                 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 40 ? 3 : 2));
955                 break;
956         case MS_BR_SOUND:
957                 if (!get_aim_dir(&dir)) return FALSE;
958
959         msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
960         damage = monspell_bluemage_damage((MS_BR_SOUND), plev, DAM_ROLL);
961                 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 40 ? 3 : 2));
962                 break;
963         case MS_BR_CHAOS:
964                 if (!get_aim_dir(&dir)) return FALSE;
965
966         msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
967         damage = monspell_bluemage_damage((MS_BR_CHAOS), plev, DAM_ROLL);
968                 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 40 ? 3 : 2));
969                 break;
970         case MS_BR_DISEN:
971                 if (!get_aim_dir(&dir)) return FALSE;
972
973         msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
974         damage = monspell_bluemage_damage((MS_BR_DISEN), plev, DAM_ROLL);
975                 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 40 ? 3 : 2));
976                 break;
977         case MS_BR_NEXUS:
978                 if (!get_aim_dir(&dir)) return FALSE;
979
980         msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
981         damage = monspell_bluemage_damage((MS_BR_NEXUS), plev, DAM_ROLL);
982                 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 40 ? 3 : 2));
983                 break;
984         case MS_BR_TIME:
985                 if (!get_aim_dir(&dir)) return FALSE;
986
987         msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
988         damage = monspell_bluemage_damage((MS_BR_TIME), plev, DAM_ROLL);
989                 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 40 ? 3 : 2));
990                 break;
991         case MS_BR_INERTIA:
992                 if (!get_aim_dir(&dir)) return FALSE;
993
994         msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
995         damage = monspell_bluemage_damage((MS_BR_INERTIA), plev, DAM_ROLL);
996                 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 40 ? 3 : 2));
997                 break;
998         case MS_BR_GRAVITY:
999                 if (!get_aim_dir(&dir)) return FALSE;
1000
1001         msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
1002         damage = monspell_bluemage_damage((MS_BR_GRAVITY), plev, DAM_ROLL);
1003                 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 40 ? 3 : 2));
1004                 break;
1005         case MS_BR_SHARDS:
1006         if (!get_aim_dir(&dir)) return FALSE;
1007
1008         msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
1009         damage = monspell_bluemage_damage((MS_BR_SHARDS), plev, DAM_ROLL);
1010                 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 40 ? 3 : 2));
1011                 break;
1012         case MS_BR_PLASMA:
1013         if (!get_aim_dir(&dir)) return FALSE;
1014
1015         msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
1016         damage = monspell_bluemage_damage((MS_BR_PLASMA), plev, DAM_ROLL);
1017                 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 40 ? 3 : 2));
1018                 break;
1019         case MS_BR_FORCE:
1020         if (!get_aim_dir(&dir)) return FALSE;
1021
1022         msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
1023         damage = monspell_bluemage_damage((MS_BR_FORCE), plev, DAM_ROLL);
1024                 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 40 ? 3 : 2));
1025                 break;
1026         case MS_BR_MANA:
1027                 if (!get_aim_dir(&dir)) return FALSE;
1028
1029         msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
1030         damage = monspell_bluemage_damage((MS_BR_MANA), plev, DAM_ROLL);
1031                 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 40 ? 3 : 2));
1032                 break;
1033         case MS_BALL_NUKE:
1034                 if (!get_aim_dir(&dir)) return FALSE;
1035
1036         msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
1037         damage = monspell_bluemage_damage((MS_BALL_NUKE), plev, DAM_ROLL);
1038                 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
1039                 break;
1040         case MS_BR_NUKE:
1041                 if (!get_aim_dir(&dir)) return FALSE;
1042
1043         msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
1044         damage = monspell_bluemage_damage((MS_BR_NUKE), plev, DAM_ROLL);
1045                 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 40 ? 3 : 2));
1046                 break;
1047         case MS_BALL_CHAOS:
1048                 if (!get_aim_dir(&dir)) return FALSE;
1049
1050         msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
1051         damage = monspell_bluemage_damage((MS_BALL_CHAOS), plev, DAM_ROLL);
1052                 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
1053                 break;
1054         case MS_BR_DISI:
1055                 if (!get_aim_dir(&dir)) return FALSE;
1056
1057         msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
1058         damage = monspell_bluemage_damage((MS_BR_DISI), plev, DAM_ROLL);
1059                 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 40 ? 3 : 2));
1060                 break;
1061         case MS_BALL_ACID:
1062                 if (!get_aim_dir(&dir)) return FALSE;
1063
1064         msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
1065         damage = monspell_bluemage_damage((MS_BALL_ACID), plev, DAM_ROLL);
1066                 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
1067                 break;
1068         case MS_BALL_ELEC:
1069         if (!get_aim_dir(&dir)) return FALSE;
1070
1071         msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
1072         damage = monspell_bluemage_damage((MS_BALL_ELEC), plev, DAM_ROLL);
1073                 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
1074                 break;
1075         case MS_BALL_FIRE:
1076                 if (!get_aim_dir(&dir)) return FALSE;
1077
1078         msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
1079         damage = monspell_bluemage_damage((MS_BALL_FIRE), plev, DAM_ROLL);
1080                 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
1081                 break;
1082         case MS_BALL_COLD:
1083         if (!get_aim_dir(&dir)) return FALSE;
1084
1085         msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
1086         damage = monspell_bluemage_damage((MS_BALL_COLD), plev, DAM_ROLL);
1087                 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
1088                 break;
1089         case MS_BALL_POIS:
1090                 if (!get_aim_dir(&dir)) return FALSE;
1091
1092         msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
1093         damage = monspell_bluemage_damage((MS_BALL_POIS), plev, DAM_ROLL);
1094                 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
1095                 break;
1096         case MS_BALL_NETHER:
1097         if (!get_aim_dir(&dir)) return FALSE;
1098
1099         msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
1100         damage = monspell_bluemage_damage((MS_BALL_NETHER), plev, DAM_ROLL);
1101                 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
1102                 break;
1103         case MS_BALL_WATER:
1104                 if (!get_aim_dir(&dir)) return FALSE;
1105
1106         msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
1107         damage = monspell_bluemage_damage((MS_BALL_WATER), plev, DAM_ROLL);
1108                 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
1109                 break;
1110         case MS_BALL_MANA:
1111         if (!get_aim_dir(&dir)) return FALSE;
1112
1113         msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
1114         damage = monspell_bluemage_damage((MS_BALL_MANA), plev, DAM_ROLL);
1115                 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
1116                 break;
1117         case MS_BALL_DARK:
1118                 if (!get_aim_dir(&dir)) return FALSE;
1119
1120         msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
1121         damage = monspell_bluemage_damage((MS_BALL_DARK), plev, DAM_ROLL);
1122                 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
1123                 break;
1124         case MS_DRAIN_MANA:
1125                 if (!get_aim_dir(&dir)) return FALSE;
1126
1127         damage = monspell_bluemage_damage((MS_DRAIN_MANA), plev, DAM_ROLL);
1128         fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, damage, 0);
1129                 break;
1130         case MS_MIND_BLAST:
1131                 if (!get_aim_dir(&dir)) return FALSE;
1132
1133         damage = monspell_bluemage_damage((MS_MIND_BLAST), plev, DAM_ROLL);
1134                 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
1135                 break;
1136         case MS_BRAIN_SMASH:
1137         if (!get_aim_dir(&dir)) return FALSE;
1138
1139         damage = monspell_bluemage_damage((MS_BRAIN_SMASH), plev, DAM_ROLL);
1140                 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
1141                 break;
1142         case MS_CAUSE_1:
1143                 if (!get_aim_dir(&dir)) return FALSE;
1144
1145         damage = monspell_bluemage_damage((MS_CAUSE_1), plev, DAM_ROLL);
1146                 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
1147                 break;
1148         case MS_CAUSE_2:
1149                 if (!get_aim_dir(&dir)) return FALSE;
1150
1151         damage = monspell_bluemage_damage((MS_CAUSE_2), plev, DAM_ROLL);
1152                 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
1153                 break;
1154         case MS_CAUSE_3:
1155                 if (!get_aim_dir(&dir)) return FALSE;
1156
1157         damage = monspell_bluemage_damage((MS_CAUSE_3), plev, DAM_ROLL);
1158                 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
1159                 break;
1160         case MS_CAUSE_4:
1161                 if (!get_aim_dir(&dir)) return FALSE;
1162
1163         damage = monspell_bluemage_damage((MS_CAUSE_4), plev, DAM_ROLL);
1164                 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
1165                 break;
1166         case MS_BOLT_ACID:
1167                 if (!get_aim_dir(&dir)) return FALSE;
1168
1169         msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
1170         damage = monspell_bluemage_damage((MS_BOLT_ACID), plev, DAM_ROLL);
1171         fire_bolt(caster_ptr, GF_ACID, dir, damage);
1172                 break;
1173         case MS_BOLT_ELEC:
1174                 if (!get_aim_dir(&dir)) return FALSE;
1175
1176         msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
1177         damage = monspell_bluemage_damage((MS_BOLT_ELEC), plev, DAM_ROLL);
1178                 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
1179                 break;
1180         case MS_BOLT_FIRE:
1181                 if (!get_aim_dir(&dir)) return FALSE;
1182
1183         msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
1184         damage = monspell_bluemage_damage((MS_BOLT_FIRE), plev, DAM_ROLL);
1185                 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
1186                 break;
1187         case MS_BOLT_COLD:
1188                 if (!get_aim_dir(&dir)) return FALSE;
1189
1190         msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
1191         damage = monspell_bluemage_damage((MS_BOLT_COLD), plev, DAM_ROLL);
1192                 fire_bolt(caster_ptr, GF_COLD, dir, damage);
1193                 break;
1194         case MS_STARBURST:
1195                 if (!get_aim_dir(&dir)) return FALSE;
1196
1197         msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
1198         damage = monspell_bluemage_damage((MS_STARBURST), plev, DAM_ROLL);
1199                 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
1200                 break;
1201         case MS_BOLT_NETHER:
1202                 if (!get_aim_dir(&dir)) return FALSE;
1203
1204         msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
1205         damage = monspell_bluemage_damage((MS_BOLT_NETHER), plev, DAM_ROLL);
1206                 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
1207                 break;
1208         case MS_BOLT_WATER:
1209                 if (!get_aim_dir(&dir)) return FALSE;
1210
1211         msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
1212         damage = monspell_bluemage_damage((MS_BOLT_WATER), plev, DAM_ROLL);
1213                 fire_bolt(caster_ptr, GF_WATER, dir, damage);
1214                 break;
1215         case MS_BOLT_MANA:
1216                 if (!get_aim_dir(&dir)) return FALSE;
1217
1218         msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
1219         damage = monspell_bluemage_damage((MS_BOLT_MANA), plev, DAM_ROLL);
1220                 fire_bolt(caster_ptr, GF_MANA, dir, damage);
1221                 break;
1222         case MS_BOLT_PLASMA:
1223                 if (!get_aim_dir(&dir)) return FALSE;
1224
1225         msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
1226         damage = monspell_bluemage_damage((MS_BOLT_PLASMA), plev, DAM_ROLL);
1227                 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
1228                 break;
1229         case MS_BOLT_ICE:
1230                 if (!get_aim_dir(&dir)) return FALSE;
1231
1232         msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
1233         damage = monspell_bluemage_damage((MS_BOLT_ICE), plev, DAM_ROLL);
1234                 fire_bolt(caster_ptr, GF_ICE, dir, damage);
1235                 break;
1236         case MS_MAGIC_MISSILE:
1237                 if (!get_aim_dir(&dir)) return FALSE;
1238
1239         msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
1240         damage = monspell_bluemage_damage((MS_MAGIC_MISSILE), plev, DAM_ROLL);
1241                 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
1242                 break;
1243         case MS_SCARE:
1244                 if (!get_aim_dir(&dir)) return FALSE;
1245
1246         msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
1247                 fear_monster(dir, plev+10);
1248                 break;
1249         case MS_BLIND:
1250                 if (!get_aim_dir(&dir)) return FALSE;
1251                 confuse_monster(dir, plev * 2);
1252                 break;
1253         case MS_CONF:
1254                 if (!get_aim_dir(&dir)) return FALSE;
1255
1256         msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
1257                 confuse_monster(dir, plev * 2);
1258                 break;
1259         case MS_SLOW:
1260                 if (!get_aim_dir(&dir)) return FALSE;
1261                 slow_monster(dir, plev);
1262                 break;
1263         case MS_SLEEP:
1264                 if (!get_aim_dir(&dir)) return FALSE;
1265                 sleep_monster(dir, plev);
1266                 break;
1267         case MS_SPEED:
1268                 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
1269                 break;
1270         case MS_HAND_DOOM:
1271         {
1272                 if (!get_aim_dir(&dir)) return FALSE;
1273
1274         msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
1275                 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, plev * 3, 0);
1276                 break;
1277         }
1278         case MS_HEAL:
1279         msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
1280                 (void)hp_player(caster_ptr, plev*4);
1281                 (void)set_stun(caster_ptr, 0);
1282                 (void)set_cut(caster_ptr,0);
1283                 break;
1284         case MS_INVULNER:
1285         msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
1286                 (void)set_invuln(caster_ptr, randint1(4) + 4, FALSE);
1287                 break;
1288         case MS_BLINK:
1289                 teleport_player(caster_ptr, 10, 0L);
1290                 break;
1291         case MS_TELEPORT:
1292                 teleport_player(caster_ptr, plev * 5, 0L);
1293                 break;
1294         case MS_WORLD:
1295                 (void)time_walk(caster_ptr);
1296                 break;
1297         case MS_SPECIAL:
1298                 break;
1299         case MS_TELE_TO:
1300         {
1301                 monster_type *m_ptr;
1302                 monster_race *r_ptr;
1303                 GAME_TEXT m_name[MAX_NLEN];
1304
1305                 if (!target_set(TARGET_KILL)) return FALSE;
1306                 if (!caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
1307                 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
1308                 if (!projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
1309                 m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
1310                 r_ptr = &r_info[m_ptr->r_idx];
1311                 monster_desc(m_name, m_ptr, 0);
1312                 if (r_ptr->flagsr & RFR_RES_TELE)
1313                 {
1314                         if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
1315                         {
1316                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1317                 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
1318                                 break;
1319                         }
1320                         else if (r_ptr->level > randint1(100))
1321                         {
1322                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1323                 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
1324                                 break;
1325                         }
1326                 }
1327         msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
1328                 teleport_monster_to(caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE);
1329                 break;
1330         }
1331         case MS_TELE_AWAY:
1332                 if (!get_aim_dir(&dir)) return FALSE;
1333
1334                 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, 100);
1335                 break;
1336
1337         case MS_TELE_LEVEL:
1338                 return teleport_level_other(caster_ptr);
1339                 break;
1340
1341         case MS_PSY_SPEAR:
1342                 if (!get_aim_dir(&dir)) return FALSE;
1343
1344         msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
1345         damage = monspell_bluemage_damage((MS_PSY_SPEAR), plev, DAM_ROLL);
1346                 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
1347                 break;
1348         case MS_DARKNESS:
1349
1350         msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
1351                 (void)unlite_area(10, 3);
1352                 break;
1353         case MS_MAKE_TRAP:
1354                 if (!target_set(TARGET_KILL)) return FALSE;
1355
1356         msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
1357                 trap_creation(caster_ptr, target_row, target_col);
1358                 break;
1359         case MS_FORGET:
1360         msg_print(_("しかし何も起きなかった。", "Nothing happen."));
1361                 break;
1362     case MS_RAISE_DEAD:
1363         msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
1364                 (void)animate_dead(0, caster_ptr->y, caster_ptr->x);
1365                 break;
1366         case MS_S_KIN:
1367         {
1368                 int k;
1369
1370         msg_print(_("援軍を召喚した。", "You summon minions."));
1371                 for (k = 0;k < 1; k++)
1372                 {
1373                         if (summon_kin_player(summon_lev, caster_ptr->y, caster_ptr->x, (pet ? PM_FORCE_PET : 0L)))
1374                         {
1375                                 if (!pet) msg_print(_("召喚された仲間は怒っている!", "Summoned fellows are angry!"));
1376                         }
1377                         else
1378                         {
1379                                 no_trump = TRUE;
1380                         }
1381                 }
1382                 break;
1383         }
1384         case MS_S_CYBER:
1385         {
1386                 int k;
1387
1388         msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!"));
1389                 for (k = 0 ;k < 1 ; k++)
1390                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_CYBER, p_mode))
1391                         {
1392                 if (!pet)
1393                     msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!"));
1394                         }
1395                         else
1396                         {
1397                                 no_trump = TRUE;
1398                         }
1399                 break;
1400         }
1401         case MS_S_MONSTER:
1402         {
1403                 int k;
1404         msg_print(_("仲間を召喚した。", "You summon help."));
1405                 for (k = 0;k < 1; k++)
1406                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, 0, p_mode))
1407                         {
1408                 if (!pet)
1409                     msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!"));
1410                         }
1411                         else
1412                         {
1413                                 no_trump = TRUE;
1414                         }
1415                 break;
1416         }
1417         case MS_S_MONSTERS:
1418         {
1419                 int k;
1420         msg_print(_("モンスターを召喚した!", "You summon monsters!"));
1421                 for (k = 0;k < plev / 15 + 2; k++)
1422                         if(summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, 0, (p_mode | u_mode)))
1423                         {
1424                 if (!pet)
1425                     msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!"));
1426                         }
1427                         else
1428                         {
1429                                 no_trump = TRUE;
1430                         }
1431                 break;
1432         }
1433         case MS_S_ANT:
1434         {
1435                 int k;
1436         msg_print(_("アリを召喚した。", "You summon ants."));
1437                 for (k = 0; k < 1; k++)
1438                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode)))
1439                         {
1440                 if (!pet)
1441                     msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!"));
1442                         }
1443                         else
1444                         {
1445                                 no_trump = TRUE;
1446                         }
1447                 break;
1448         }
1449         case MS_S_SPIDER:
1450         {
1451                 int k;
1452         msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
1453                 for (k = 0;k < 1; k++)
1454                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode)))
1455                         {
1456                 if (!pet)
1457                     msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!"));
1458                         }
1459                         else
1460                         {
1461                                 no_trump = TRUE;
1462                         }
1463                 break;
1464         }
1465         case MS_S_HOUND:
1466         {
1467                 int k;
1468         msg_print(_("ハウンドを召喚した。", "You summon hounds."));
1469                 for (k = 0;k < 1; k++)
1470                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode)))
1471                         {
1472                 if (!pet)
1473                     msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!"));
1474                         }
1475                         else
1476                         {
1477                                 no_trump = TRUE;
1478                         }
1479                 break;
1480         }
1481         case MS_S_HYDRA:
1482         {
1483                 int k;
1484         msg_print(_("ヒドラを召喚した。", "You summon a hydras."));
1485                 for (k = 0;k < 1; k++)
1486                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HYDRA, (g_mode | p_mode)))
1487                         {
1488                 if (!pet)
1489                     msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!"));
1490                         }
1491                         else
1492                         {
1493                                 no_trump = TRUE;
1494                         }
1495                 break;
1496         }
1497         case MS_S_ANGEL:
1498         {
1499                 int k;
1500         msg_print(_("天使を召喚した!", "You summon an angel!"));
1501                 for (k = 0;k < 1; k++)
1502                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_ANGEL, (g_mode | p_mode)))
1503                         {
1504                 if (!pet)
1505                     msg_print(_("召喚された天使は怒っている!", "Summoned angels are angry!"));
1506                         }
1507                         else
1508                         {
1509                                 no_trump = TRUE;
1510                         }
1511                 break;
1512         }
1513         case MS_S_DEMON:
1514         {
1515                 int k;
1516         msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
1517                 for (k = 0;k < 1; k++)
1518                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_DEMON, (g_mode | p_mode)))
1519                         {
1520                 if (!pet)
1521                     msg_print(_("召喚されたデーモンは怒っている!", "Summoned demons are angry!"));
1522                         }
1523                         else
1524                         {
1525                                 no_trump = TRUE;
1526                         }
1527                 break;
1528         }
1529         case MS_S_UNDEAD:
1530         {
1531                 int k;
1532         msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
1533                 for (k = 0;k < 1; k++)
1534                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode)))
1535                         {
1536                 if (!pet)
1537                     msg_print(_("召喚されたアンデッドは怒っている!", "Summoned undeads are angry!"));
1538                         }
1539                         else
1540                         {
1541                                 no_trump = TRUE;
1542                         }
1543                 break;
1544         }
1545         case MS_S_DRAGON:
1546         {
1547                 int k;
1548         msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
1549                 for (k = 0;k < 1; k++)
1550                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_DRAGON, (g_mode | p_mode)))
1551                         {
1552                 if (!pet)
1553                     msg_print(_("召喚されたドラゴンは怒っている!", "Summoned dragons are angry!"));
1554                         }
1555                         else
1556                         {
1557                                 no_trump = TRUE;
1558                         }
1559                 break;
1560         }
1561         case MS_S_HI_UNDEAD:
1562         {
1563                 int k;
1564         msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!"));
1565                 for (k = 0;k < 1; k++)
1566                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode)))
1567                         {
1568                 if (!pet)
1569                     msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
1570                         }
1571                         else
1572                         {
1573                                 no_trump = TRUE;
1574                         }
1575                 break;
1576         }
1577         case MS_S_HI_DRAGON:
1578         {
1579                 int k;
1580         msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!"));
1581                 for (k = 0;k < 1; k++)
1582                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode)))
1583                         {
1584                 if (!pet)
1585                     msg_print(_("召喚された古代ドラゴンは怒っている!", "Summoned ancient dragons are angry!"));
1586                         }
1587                         else
1588                         {
1589                                 no_trump = TRUE;
1590                         }
1591                 break;
1592         }
1593         case MS_S_AMBERITE:
1594         {
1595                 int k;
1596         msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!"));
1597                 for (k = 0;k < 1; k++)
1598                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode)))
1599                         {
1600                 if (!pet)
1601                     msg_print(_("召喚されたアンバーの王族は怒っている!", "Summoned Lords of Amber are angry!"));
1602                         }
1603                         else
1604                         {
1605                                 no_trump = TRUE;
1606                         }
1607                 break;
1608         }
1609         case MS_S_UNIQUE:
1610         {
1611                 int k, count = 0;
1612                 msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!"));
1613                 for (k = 0;k < 1; k++)
1614                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1615                         {
1616                                 count++;
1617                                 if (!pet)
1618                                         msg_print(_("召喚されたユニーク・モンスターは怒っている!", "Summoned special opponents are angry!"));
1619                         }
1620                 for (k = count;k < 1; k++)
1621                         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1622                         {
1623                                 count++;
1624                                 if (!pet)
1625                                         msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
1626                         }
1627                 if (!count)
1628                 {
1629                         no_trump = TRUE;
1630                 }
1631                 break;
1632         }
1633         default:
1634                 msg_print("hoge?");
1635         }
1636         if (no_trump)
1637     {
1638         msg_print(_("何も現れなかった。", "No one have appeared."));
1639         }
1640
1641         return TRUE;
1642 }
1643
1644 /*!
1645  * @brief 青魔法コマンドのメインルーチン /
1646  * do_cmd_cast calls this function if the player's class is 'Blue-Mage'.
1647  * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1648  */
1649 bool do_cmd_cast_learned(void)
1650 {
1651         SPELL_IDX n = 0;
1652         PERCENTAGE chance;
1653         PERCENTAGE minfail = 0;
1654         PLAYER_LEVEL plev = p_ptr->lev;
1655         monster_power spell;
1656         bool cast;
1657         MANA_POINT need_mana;
1658
1659         if (cmd_limit_confused(p_ptr)) return FALSE;
1660
1661         if (!get_learned_power(&n)) return FALSE;
1662
1663         spell = monster_powers[n];
1664
1665         need_mana = mod_need_mana(spell.smana, 0, REALM_NONE);
1666
1667         /* Verify "dangerous" spells */
1668         if (need_mana > p_ptr->csp)
1669         {
1670                 /* Warning */
1671                 msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
1672
1673                 if (!over_exert) return FALSE;
1674
1675                 /* Verify */
1676                 if (!get_check(_("それでも挑戦しますか? ", "Attempt it anyway? "))) return FALSE;
1677         }
1678
1679         /* Spell failure chance */
1680         chance = spell.fail;
1681
1682         /* Reduce failure rate by "effective" level adjustment */
1683         if (plev > spell.level) chance -= 3 * (plev - spell.level);
1684         else chance += (spell.level - plev);
1685
1686         /* Reduce failure rate by INT/WIS adjustment */
1687         chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
1688
1689         chance = mod_spell_chance_1(p_ptr, chance);
1690
1691         /* Not enough mana to cast */
1692         if (need_mana > p_ptr->csp)
1693         {
1694                 chance += 5 * (need_mana - p_ptr->csp);
1695         }
1696
1697         /* Extract the minimum failure rate */
1698         minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
1699
1700         /* Minimum failure rate */
1701         if (chance < minfail) chance = minfail;
1702
1703         /* Stunning makes spells harder */
1704         if (p_ptr->stun > 50) chance += 25;
1705         else if (p_ptr->stun) chance += 15;
1706
1707         /* Always a 5 percent chance of working */
1708         if (chance > 95) chance = 95;
1709
1710         chance = mod_spell_chance_2(p_ptr, chance);
1711
1712         /* Failed spell */
1713         if (randint0(100) < chance)
1714         {
1715                 if (flush_failure) flush();
1716                 msg_print(_("魔法をうまく唱えられなかった。", "You failed to concentrate hard enough!"));
1717
1718                 sound(SOUND_FAIL);
1719
1720                 if (n >= MS_S_KIN)
1721                         cast = cast_learned_spell(p_ptr, n, FALSE);
1722         }
1723         else
1724         {
1725                 sound(SOUND_ZAP);
1726                 cast = cast_learned_spell(p_ptr, n, TRUE);
1727                 if (!cast) return FALSE;
1728         }
1729
1730         /* Sufficient mana */
1731         if (need_mana <= p_ptr->csp)
1732         {
1733                 /* Use some mana */
1734                 p_ptr->csp -= need_mana;
1735         }
1736         else
1737         {
1738                 int oops = need_mana;
1739
1740                 /* No mana left */
1741                 p_ptr->csp = 0;
1742                 p_ptr->csp_frac = 0;
1743
1744                 msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
1745
1746                 /* Hack -- Bypass free action */
1747                 (void)set_paralyzed(p_ptr, p_ptr->paralyzed + randint1(5 * oops + 1));
1748
1749                 chg_virtue(p_ptr, V_KNOWLEDGE, -10);
1750
1751                 /* Damage CON (possibly permanently) */
1752                 if (randint0(100) < 50)
1753                 {
1754                         bool perm = (randint0(100) < 25);
1755
1756                         msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
1757
1758                         /* Reduce constitution */
1759                         (void)dec_stat(p_ptr, A_CON, 15 + randint1(10), perm);
1760                 }
1761         }
1762
1763         take_turn(p_ptr, 100);
1764
1765         p_ptr->redraw |= (PR_MANA);
1766         p_ptr->window |= (PW_PLAYER | PW_SPELL);
1767
1768         return TRUE;
1769 }
1770
1771 /*!
1772  * @brief 青魔法のラーニング判定と成功した場合のラーニング処理
1773  * @param monspell ラーニングを試みるモンスター攻撃のID
1774  * @return なし
1775  */
1776 void learn_spell(int monspell)
1777 {
1778         if (p_ptr->action != ACTION_LEARN) return;
1779         if (monspell < 0) return;
1780         if (p_ptr->magic_num2[monspell]) return;
1781         if (p_ptr->confused || p_ptr->blind || p_ptr->image || p_ptr->stun || p_ptr->paralyzed) return;
1782         if (randint1(p_ptr->lev + 70) > monster_powers[monspell].level + 40)
1783         {
1784                 p_ptr->magic_num2[monspell] = 1;
1785                 msg_format(_("%sを学習した!", "You have learned %s!"), monster_powers[monspell].name);
1786                 gain_exp(p_ptr, monster_powers[monspell].level * monster_powers[monspell].smana);
1787
1788                 sound(SOUND_STUDY);
1789
1790                 p_ptr->new_mane = TRUE;
1791                 p_ptr->redraw |= (PR_STATE);
1792         }
1793 }
1794
1795
1796 /*!
1797  * @brief モンスター特殊能力のフラグ配列から特定条件の魔法だけを抜き出す処理
1798  * Extract monster spells mask for the given mode
1799  * @param f4 モンスター特殊能力の4番目のフラグ配列
1800  * @param f5 モンスター特殊能力の5番目のフラグ配列
1801  * @param f6 モンスター特殊能力の6番目のフラグ配列
1802  * @param mode 抜き出したい条件
1803  * @return なし
1804  */
1805 /*
1806  */
1807 void set_rf_masks(BIT_FLAGS *f4, BIT_FLAGS *f5, BIT_FLAGS *f6, BIT_FLAGS mode)
1808 {
1809         switch (mode)
1810         {
1811                 case MONSPELL_TYPE_BOLT:
1812                         *f4 = ((RF4_BOLT_MASK | RF4_BEAM_MASK) & ~(RF4_ROCKET));
1813                         *f5 = RF5_BOLT_MASK | RF5_BEAM_MASK;
1814                         *f6 = RF6_BOLT_MASK | RF6_BEAM_MASK;
1815                         break;
1816
1817                 case MONSPELL_TYPE_BALL:
1818                         *f4 = (RF4_BALL_MASK & ~(RF4_BREATH_MASK));
1819                         *f5 = (RF5_BALL_MASK & ~(RF5_BREATH_MASK));
1820                         *f6 = (RF6_BALL_MASK & ~(RF6_BREATH_MASK));
1821                         break;
1822
1823                 case MONSPELL_TYPE_BREATH:
1824                         *f4 = RF4_BREATH_MASK;
1825                         *f5 = RF5_BREATH_MASK;
1826                         *f6 = RF6_BREATH_MASK;
1827                         break;
1828
1829                 case MONSPELL_TYPE_SUMMON:
1830                         *f4 = RF4_SUMMON_MASK;
1831                         *f5 = RF5_SUMMON_MASK;
1832                         *f6 = RF6_SUMMON_MASK;
1833                         break;
1834
1835                 case MONSPELL_TYPE_OTHER:
1836                         *f4 = RF4_ATTACK_MASK & ~(RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_INDIRECT_MASK);
1837                         *f5 = RF5_ATTACK_MASK & ~(RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_INDIRECT_MASK);
1838                         *f6 = RF6_ATTACK_MASK & ~(RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | RF6_INDIRECT_MASK);
1839                         break;
1840         }
1841
1842         return;
1843 }