3 * @brief 青魔法の処理実装 / Blue magic
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
19 #include "spells-summon.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"
27 #include "cmd-basic.h"
28 #include "player-effects.h"
29 #include "targeting.h"
30 #include "view-mainwindow.h"
32 #define pseudo_plev() (((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 130) /*!< モンスター魔法をプレイヤーが使用する場合の換算レベル */
38 * level, smana, %fail, manedam, %manefail, use_stat, name
40 const monster_power monster_powers[MAX_MONSPELLS] =
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, "ユニークモンスターの召喚"},
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"},
241 * @brief モンスター魔法名テーブル
243 const concptr monster_powers_short[MAX_MONSPELLS] = {
246 "叫ぶ", "何か", "魔力消去", "ロケット", "射撃", "何か", "何か", "何か",
247 "酸", "電撃", "火炎", "冷気", "毒", "地獄", "閃光", "暗黒",
248 "混乱", "轟音", "カオス", "劣化", "因果混乱", "時間逆転", "遅鈍", "重力",
249 "破片", "プラズマ", "フォース", "魔力", "放射能球", "放射性廃棄物", "純ログルス", "分解",
251 "酸", "電撃", "火炎", "冷気", "悪臭雲", "地獄球", "ウォーター", "魔力の嵐",
252 "暗黒の嵐", "魔力吸収", "精神攻撃", "脳攻撃", "軽傷", "重傷", "致命傷", "秘孔を突く",
253 "酸", "電撃", "火炎", "冷気", "スターバースト", "地獄の矢", "ウォーター", "魔力の矢",
254 "プラズマ", "極寒", "マジックミサイル", "恐慌", "盲目", "混乱", "減速", "睡眠",
256 "加速", "破滅の手", "体力回復", "無傷の球", "ショートテレポート", "テレポート", "時を止める", "何か",
257 "引きよせる", "テレポートアウェイ", "テレポートレベル", "光の剣", "暗闇", "トラップ創造", "記憶喪失", "死者復活",
258 "援軍", "サイバーデーモン", "モンスター", "複数のモンスター", "蟻", "蜘蛛", "ハウンド", "ヒドラ",
259 "天使", "悪魔", "アンデッド", "ドラゴン", "上級アンデッド", "古代ドラゴン", "アンバーの王族", "ユニーク"
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",
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",
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"
284 * @brief 文字列に青魔導師の呪文の攻撃力を加える
285 * @param SPELL_NUM 呪文番号
286 * @param plev プレイヤーレベル
288 * @param tmp 返すメッセージを格納する配列
291 void set_bluemage_damage(int SPELL_NUM, PLAYER_LEVEL plev, concptr msg, char* tmp)
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);
299 dice_to_string(base_damage, dice_num, dice_side, dice_mult, dice_div, dmg_str);
300 sprintf(tmp, " %s %s", msg, dmg_str);
304 * @brief 受け取ったモンスター魔法のIDに応じて青魔法の効果情報をまとめたフォーマットを返す
305 * @param p 情報を返す文字列参照ポインタ
306 * @param power モンスター魔法のID
309 static void learned_info(char *p, int power)
311 PLAYER_LEVEL plev = pseudo_plev();
356 set_bluemage_damage((power), plev, KWD_DAM, p); break;
392 set_bluemage_damage((power), plev, KWD_DAM, p); break;
394 set_bluemage_damage((power), plev, KWD_HEAL, p); break;
410 case MS_MAGIC_MISSILE:
411 set_bluemage_damage((power), plev, KWD_DAM, p); break;
413 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
416 set_bluemage_damage((power), plev, KWD_HEAL, p); break;
418 sprintf(p, " %sd7+7", KWD_DURATION);
421 sprintf(p, " %s10", KWD_SPHERE);
424 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
427 set_bluemage_damage((power), plev, KWD_DAM, p); break;
430 sprintf(p, " %s5", KWD_SPHERE);
439 * @brief 使用可能な青魔法を選択する /
440 * Allow user to choose a imitation.
441 * @param sn 選択したモンスター攻撃ID、キャンセルの場合-1、不正な選択の場合-2を返す
442 * @return 発動可能な魔法を選択した場合TRUE、キャンセル処理か不正な選択が行われた場合FALSEを返す。
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
448 * The "prompt" should be "cast", "recite", or "study"\n
449 * The "known" should be TRUE for cast/pray, FALSE for study\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
455 static bool get_learned_power(SPELL_IDX *sn)
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];
470 BIT_FLAGS f4 = 0L, f5 = 0L, f6 = 0L;
471 concptr p = _("魔法", "magic");
475 int menu_line = (use_menu ? 1 : 0);
477 /* Assume cancelled */
480 /* Nothing chosen yet */
486 /* Get the spell, if available */
488 if (repeat_pull(&code))
490 *sn = (SPELL_IDX)code;
500 prt(format(_(" %s ボルト", " %s bolt"), (menu_line == 1) ? _("》", "> ") : " "), 2, 14);
501 prt(format(_(" %s ボール", " %s ball"), (menu_line == 2) ? _("》", "> ") : " "), 3, 14);
502 prt(format(_(" %s ブレス", " %s breath"), (menu_line == 3) ? _("》", "> ") : " "), 4, 14);
503 prt(format(_(" %s 召喚", " %s sommoning"), (menu_line == 4) ? _("》", "> ") : " "), 5, 14);
504 prt(format(_(" %s その他", " %s others"), (menu_line == 5) ? _("》", "> ") : " "), 6, 14);
505 prt(_("どの種類の魔法を使いますか?", "use which type of magic? "), 0, 0);
531 if (menu_line > 5) menu_line -= 5;
537 sprintf(comment, _("[A]ボルト, [B]ボール, [C]ブレス, [D]召喚, [E]その他:", "[A] bolt, [B] ball, [C] breath, [D] summoning, [E] others:"));
540 if (!get_com(comment, &ch, TRUE))
544 if (ch == 'A' || ch == 'a')
549 if (ch == 'B' || ch == 'b')
554 if (ch == 'C' || ch == 'c')
559 if (ch == 'D' || ch == 'd')
564 if (ch == 'E' || ch == 'e')
572 set_rf_masks(&f4, &f5, &f6, mode);
574 for (i = 0, num = 0; i < 32; i++)
576 if ((0x00000001 << i) & f4) spellnum[num++] = i;
580 if ((0x00000001 << (i - 32)) & f5) spellnum[num++] = i;
584 if ((0x00000001 << (i - 64)) & f6) spellnum[num++] = i;
586 for (i = 0; i < num; i++)
588 if (p_ptr->magic_num2[spellnum[i]])
590 if (use_menu) menu_line = i+1;
596 msg_print(_("その種類の魔法は覚えていない!", "You don't know any spell of this type."));
600 /* Build a prompt (accept all spells) */
601 (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sを唱えますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
602 I2A(0), I2A(num - 1), p);
604 if (use_menu) screen_save();
606 choice= (always_show_list || use_menu) ? ESCAPE:1 ;
609 if(choice==ESCAPE) choice = ' ';
610 else if( !get_com(out_val, &choice, TRUE) )break;
612 if (use_menu && choice != ' ')
628 menu_line += (num-1);
629 if (menu_line > num) menu_line -= num;
630 } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
641 if (menu_line > num) menu_line -= num;
642 } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
651 while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line--;
660 while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line++;
675 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
678 if (!redraw || use_menu)
682 if (!use_menu) screen_save();
684 /* Display a list of spells */
686 put_str(_("名前", "Name"), y, x + 5);
687 put_str(_("MP 失率 効果", "SP Fail Info"), y, x + 33);
690 /* Dump the spells */
691 for (i = 0; i < num; i++)
695 prt("", y + i + 1, x);
696 if (!p_ptr->magic_num2[spellnum[i]]) continue;
698 /* Access the spell */
699 spell = monster_powers[spellnum[i]];
703 /* Reduce failure rate by "effective" level adjustment */
704 if (plev > spell.level) chance -= 3 * (plev - spell.level);
705 else chance += (spell.level - plev);
707 /* Reduce failure rate by INT/WIS adjustment */
708 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
710 chance = mod_spell_chance_1(chance);
712 need_mana = mod_need_mana(monster_powers[spellnum[i]].smana, 0, REALM_NONE);
714 /* Not enough mana to cast */
715 if (need_mana > p_ptr->csp)
717 chance += 5 * (need_mana - p_ptr->csp);
720 /* Extract the minimum failure rate */
721 minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
723 /* Minimum failure rate */
724 if (chance < minfail) chance = minfail;
726 /* Stunning makes spells harder */
727 if (p_ptr->stun > 50) chance += 25;
728 else if (p_ptr->stun) chance += 15;
730 /* Always a 5 percent chance of working */
731 if (chance > 95) chance = 95;
733 chance = mod_spell_chance_2(chance);
736 learned_info(comment, spellnum[i]);
740 if (i == (menu_line-1)) strcpy(psi_desc, _(" 》", " > "));
741 else strcpy(psi_desc, " ");
743 else sprintf(psi_desc, " %c)", I2A(i));
745 /* Dump the spell --(-- */
746 strcat(psi_desc, format(" %-26s %3d %3d%%%s",
747 spell.name, need_mana,
749 prt(psi_desc, y + i + 1, x);
752 /* Clear the bottom line */
753 if (y < 22) prt("", y + i + 1, x);
771 ask = isupper(choice);
774 if (ask) choice = (char)tolower(choice);
776 /* Extract request */
777 i = (islower(choice) ? A2I(choice) : -1);
780 /* Totally Illegal */
781 if ((i < 0) || (i >= num) || !p_ptr->magic_num2[spellnum[i]])
787 /* Save the spell index */
788 spell = monster_powers[spellnum[i]];
796 (void) strnfmt(tmp_val, 78, _("%sの魔法を唱えますか?", "Use %s? "), monster_powers[spellnum[i]].name);
798 /* Belay that order */
799 if (!get_check(tmp_val)) continue;
805 if (redraw) screen_load();
807 p_ptr->window |= (PW_SPELL);
810 /* Abort if needed */
811 if (!flag) return (FALSE);
813 /* Save the choice */
816 repeat_push((COMMAND_CODE)spellnum[i]);
825 * do_cmd_cast calls this function if the player's class is 'blue-mage'.
826 * @param spell 発動するモンスター攻撃のID
827 * @param success TRUEは成功時、FALSEは失敗時の処理を行う
828 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
830 static bool cast_learned_spell(int spell, bool success)
833 PLAYER_LEVEL plev = pseudo_plev();
834 PLAYER_LEVEL summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2);
835 HIT_POINT damage = 0;
837 bool no_trump = FALSE;
838 BIT_FLAGS p_mode, u_mode = 0L, g_mode;
842 p_mode = PM_FORCE_PET;
848 g_mode = PM_ALLOW_GROUP;
851 if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE;
857 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
858 aggravate_monsters(0);
866 if (!target_set(TARGET_KILL)) return FALSE;
867 m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
869 if (!player_has_los_bold(target_row, target_col)) break;
870 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
871 dispel_monster_status(m_idx);
875 if (!get_aim_dir(&dir)) return FALSE;
877 msg_print(_("ロケットを発射した。", "You fire a rocket."));
878 damage = monspell_bluemage_damage((MS_ROCKET), plev, DAM_ROLL);
879 fire_rocket(GF_ROCKET, dir, damage, 2);
883 if (!get_aim_dir(&dir)) return FALSE;
885 msg_print(_("矢を放った。", "You fire an arrow."));
886 damage = monspell_bluemage_damage((MS_SHOOT), plev, DAM_ROLL);
887 fire_bolt(GF_ARROW, dir, damage);
897 if (!get_aim_dir(&dir)) return FALSE;
899 msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
900 damage = monspell_bluemage_damage((MS_BR_ACID), plev, DAM_ROLL);
901 fire_breath(GF_ACID, dir, damage, (plev > 40 ? 3 : 2));
904 if (!get_aim_dir(&dir)) return FALSE;
906 msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
907 damage = monspell_bluemage_damage((MS_BR_ELEC), plev, DAM_ROLL);
908 fire_breath(GF_ELEC, dir, damage, (plev > 40 ? 3 : 2));
911 if (!get_aim_dir(&dir)) return FALSE;
913 msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
914 damage = monspell_bluemage_damage((MS_BR_FIRE), plev, DAM_ROLL);
915 fire_breath(GF_FIRE, dir, damage, (plev > 40 ? 3 : 2));
918 if (!get_aim_dir(&dir)) return FALSE;
920 msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
921 damage = monspell_bluemage_damage((MS_BR_COLD), plev, DAM_ROLL);
922 fire_breath(GF_COLD, dir, damage, (plev > 40 ? 3 : 2));
925 if (!get_aim_dir(&dir)) return FALSE;
927 msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
928 damage = monspell_bluemage_damage((MS_BR_POIS), plev, DAM_ROLL);
929 fire_breath(GF_POIS, dir, damage, (plev > 40 ? 3 : 2));
932 if (!get_aim_dir(&dir)) return FALSE;
934 msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
935 damage = monspell_bluemage_damage((MS_BR_NETHER), plev, DAM_ROLL);
936 fire_breath(GF_NETHER, dir, damage, (plev > 40 ? 3 : 2));
939 if (!get_aim_dir(&dir)) return FALSE;
941 msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
942 damage = monspell_bluemage_damage((MS_BR_LITE), plev, DAM_ROLL);
943 fire_breath(GF_LITE, dir, damage, (plev > 40 ? 3 : 2));
946 if (!get_aim_dir(&dir)) return FALSE;
948 msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
949 damage = monspell_bluemage_damage((MS_BR_DARK), plev, DAM_ROLL);
950 fire_breath(GF_DARK, dir, damage, (plev > 40 ? 3 : 2));
953 if (!get_aim_dir(&dir)) return FALSE;
955 msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
956 damage = monspell_bluemage_damage((MS_BR_CONF), plev, DAM_ROLL);
957 fire_breath(GF_CONFUSION, dir, damage, (plev > 40 ? 3 : 2));
960 if (!get_aim_dir(&dir)) return FALSE;
962 msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
963 damage = monspell_bluemage_damage((MS_BR_SOUND), plev, DAM_ROLL);
964 fire_breath(GF_SOUND, dir, damage, (plev > 40 ? 3 : 2));
967 if (!get_aim_dir(&dir)) return FALSE;
969 msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
970 damage = monspell_bluemage_damage((MS_BR_CHAOS), plev, DAM_ROLL);
971 fire_breath(GF_CHAOS, dir, damage, (plev > 40 ? 3 : 2));
974 if (!get_aim_dir(&dir)) return FALSE;
976 msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
977 damage = monspell_bluemage_damage((MS_BR_DISEN), plev, DAM_ROLL);
978 fire_breath(GF_DISENCHANT, dir, damage, (plev > 40 ? 3 : 2));
981 if (!get_aim_dir(&dir)) return FALSE;
983 msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
984 damage = monspell_bluemage_damage((MS_BR_NEXUS), plev, DAM_ROLL);
985 fire_breath(GF_NEXUS, dir, damage, (plev > 40 ? 3 : 2));
988 if (!get_aim_dir(&dir)) return FALSE;
990 msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
991 damage = monspell_bluemage_damage((MS_BR_TIME), plev, DAM_ROLL);
992 fire_breath(GF_TIME, dir, damage, (plev > 40 ? 3 : 2));
995 if (!get_aim_dir(&dir)) return FALSE;
997 msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
998 damage = monspell_bluemage_damage((MS_BR_INERTIA), plev, DAM_ROLL);
999 fire_breath(GF_INERTIAL, dir, damage, (plev > 40 ? 3 : 2));
1002 if (!get_aim_dir(&dir)) return FALSE;
1004 msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
1005 damage = monspell_bluemage_damage((MS_BR_GRAVITY), plev, DAM_ROLL);
1006 fire_breath(GF_GRAVITY, dir, damage, (plev > 40 ? 3 : 2));
1009 if (!get_aim_dir(&dir)) return FALSE;
1011 msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
1012 damage = monspell_bluemage_damage((MS_BR_SHARDS), plev, DAM_ROLL);
1013 fire_breath(GF_SHARDS, dir, damage, (plev > 40 ? 3 : 2));
1016 if (!get_aim_dir(&dir)) return FALSE;
1018 msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
1019 damage = monspell_bluemage_damage((MS_BR_PLASMA), plev, DAM_ROLL);
1020 fire_breath(GF_PLASMA, dir, damage, (plev > 40 ? 3 : 2));
1023 if (!get_aim_dir(&dir)) return FALSE;
1025 msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
1026 damage = monspell_bluemage_damage((MS_BR_FORCE), plev, DAM_ROLL);
1027 fire_breath(GF_FORCE, dir, damage, (plev > 40 ? 3 : 2));
1030 if (!get_aim_dir(&dir)) return FALSE;
1032 msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
1033 damage = monspell_bluemage_damage((MS_BR_MANA), plev, DAM_ROLL);
1034 fire_breath(GF_MANA, dir, damage, (plev > 40 ? 3 : 2));
1037 if (!get_aim_dir(&dir)) return FALSE;
1039 msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
1040 damage = monspell_bluemage_damage((MS_BALL_NUKE), plev, DAM_ROLL);
1041 fire_ball(GF_NUKE, dir, damage, 2);
1044 if (!get_aim_dir(&dir)) return FALSE;
1046 msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
1047 damage = monspell_bluemage_damage((MS_BR_NUKE), plev, DAM_ROLL);
1048 fire_breath(GF_NUKE, dir, damage, (plev > 40 ? 3 : 2));
1051 if (!get_aim_dir(&dir)) return FALSE;
1053 msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
1054 damage = monspell_bluemage_damage((MS_BALL_CHAOS), plev, DAM_ROLL);
1055 fire_ball(GF_CHAOS, dir, damage, 4);
1058 if (!get_aim_dir(&dir)) return FALSE;
1060 msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
1061 damage = monspell_bluemage_damage((MS_BR_DISI), plev, DAM_ROLL);
1062 fire_breath(GF_DISINTEGRATE, dir, damage, (plev > 40 ? 3 : 2));
1065 if (!get_aim_dir(&dir)) return FALSE;
1067 msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
1068 damage = monspell_bluemage_damage((MS_BALL_ACID), plev, DAM_ROLL);
1069 fire_ball(GF_ACID, dir, damage, 2);
1072 if (!get_aim_dir(&dir)) return FALSE;
1074 msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
1075 damage = monspell_bluemage_damage((MS_BALL_ELEC), plev, DAM_ROLL);
1076 fire_ball(GF_ELEC, dir, damage, 2);
1079 if (!get_aim_dir(&dir)) return FALSE;
1081 msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
1082 damage = monspell_bluemage_damage((MS_BALL_FIRE), plev, DAM_ROLL);
1083 fire_ball(GF_FIRE, dir, damage, 2);
1086 if (!get_aim_dir(&dir)) return FALSE;
1088 msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
1089 damage = monspell_bluemage_damage((MS_BALL_COLD), plev, DAM_ROLL);
1090 fire_ball(GF_COLD, dir, damage, 2);
1093 if (!get_aim_dir(&dir)) return FALSE;
1095 msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
1096 damage = monspell_bluemage_damage((MS_BALL_POIS), plev, DAM_ROLL);
1097 fire_ball(GF_POIS, dir, damage, 2);
1099 case MS_BALL_NETHER:
1100 if (!get_aim_dir(&dir)) return FALSE;
1102 msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
1103 damage = monspell_bluemage_damage((MS_BALL_NETHER), plev, DAM_ROLL);
1104 fire_ball(GF_NETHER, dir, damage, 2);
1107 if (!get_aim_dir(&dir)) return FALSE;
1109 msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
1110 damage = monspell_bluemage_damage((MS_BALL_WATER), plev, DAM_ROLL);
1111 fire_ball(GF_WATER, dir, damage, 4);
1114 if (!get_aim_dir(&dir)) return FALSE;
1116 msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
1117 damage = monspell_bluemage_damage((MS_BALL_MANA), plev, DAM_ROLL);
1118 fire_ball(GF_MANA, dir, damage, 4);
1121 if (!get_aim_dir(&dir)) return FALSE;
1123 msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
1124 damage = monspell_bluemage_damage((MS_BALL_DARK), plev, DAM_ROLL);
1125 fire_ball(GF_DARK, dir, damage, 4);
1128 if (!get_aim_dir(&dir)) return FALSE;
1130 damage = monspell_bluemage_damage((MS_DRAIN_MANA), plev, DAM_ROLL);
1131 fire_ball_hide(GF_DRAIN_MANA, dir, damage, 0);
1134 if (!get_aim_dir(&dir)) return FALSE;
1136 damage = monspell_bluemage_damage((MS_MIND_BLAST), plev, DAM_ROLL);
1137 fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
1139 case MS_BRAIN_SMASH:
1140 if (!get_aim_dir(&dir)) return FALSE;
1142 damage = monspell_bluemage_damage((MS_BRAIN_SMASH), plev, DAM_ROLL);
1143 fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
1146 if (!get_aim_dir(&dir)) return FALSE;
1148 damage = monspell_bluemage_damage((MS_CAUSE_1), plev, DAM_ROLL);
1149 fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
1152 if (!get_aim_dir(&dir)) return FALSE;
1154 damage = monspell_bluemage_damage((MS_CAUSE_2), plev, DAM_ROLL);
1155 fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
1158 if (!get_aim_dir(&dir)) return FALSE;
1160 damage = monspell_bluemage_damage((MS_CAUSE_3), plev, DAM_ROLL);
1161 fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
1164 if (!get_aim_dir(&dir)) return FALSE;
1166 damage = monspell_bluemage_damage((MS_CAUSE_4), plev, DAM_ROLL);
1167 fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
1170 if (!get_aim_dir(&dir)) return FALSE;
1172 msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
1173 damage = monspell_bluemage_damage((MS_BOLT_ACID), plev, DAM_ROLL);
1174 fire_bolt(GF_ACID, dir, damage);
1177 if (!get_aim_dir(&dir)) return FALSE;
1179 msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
1180 damage = monspell_bluemage_damage((MS_BOLT_ELEC), plev, DAM_ROLL);
1181 fire_bolt(GF_ELEC, dir, damage);
1184 if (!get_aim_dir(&dir)) return FALSE;
1186 msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
1187 damage = monspell_bluemage_damage((MS_BOLT_FIRE), plev, DAM_ROLL);
1188 fire_bolt(GF_FIRE, dir, damage);
1191 if (!get_aim_dir(&dir)) return FALSE;
1193 msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
1194 damage = monspell_bluemage_damage((MS_BOLT_COLD), plev, DAM_ROLL);
1195 fire_bolt(GF_COLD, dir, damage);
1198 if (!get_aim_dir(&dir)) return FALSE;
1200 msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
1201 damage = monspell_bluemage_damage((MS_STARBURST), plev, DAM_ROLL);
1202 fire_ball(GF_LITE, dir, damage, 4);
1204 case MS_BOLT_NETHER:
1205 if (!get_aim_dir(&dir)) return FALSE;
1207 msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
1208 damage = monspell_bluemage_damage((MS_BOLT_NETHER), plev, DAM_ROLL);
1209 fire_bolt(GF_NETHER, dir, damage);
1212 if (!get_aim_dir(&dir)) return FALSE;
1214 msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
1215 damage = monspell_bluemage_damage((MS_BOLT_WATER), plev, DAM_ROLL);
1216 fire_bolt(GF_WATER, dir, damage);
1219 if (!get_aim_dir(&dir)) return FALSE;
1221 msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
1222 damage = monspell_bluemage_damage((MS_BOLT_MANA), plev, DAM_ROLL);
1223 fire_bolt(GF_MANA, dir, damage);
1225 case MS_BOLT_PLASMA:
1226 if (!get_aim_dir(&dir)) return FALSE;
1228 msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
1229 damage = monspell_bluemage_damage((MS_BOLT_PLASMA), plev, DAM_ROLL);
1230 fire_bolt(GF_PLASMA, dir, damage);
1233 if (!get_aim_dir(&dir)) return FALSE;
1235 msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
1236 damage = monspell_bluemage_damage((MS_BOLT_ICE), plev, DAM_ROLL);
1237 fire_bolt(GF_ICE, dir, damage);
1239 case MS_MAGIC_MISSILE:
1240 if (!get_aim_dir(&dir)) return FALSE;
1242 msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
1243 damage = monspell_bluemage_damage((MS_MAGIC_MISSILE), plev, DAM_ROLL);
1244 fire_bolt(GF_MISSILE, dir, damage);
1247 if (!get_aim_dir(&dir)) return FALSE;
1249 msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
1250 fear_monster(dir, plev+10);
1253 if (!get_aim_dir(&dir)) return FALSE;
1254 confuse_monster(dir, plev * 2);
1257 if (!get_aim_dir(&dir)) return FALSE;
1259 msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
1260 confuse_monster(dir, plev * 2);
1263 if (!get_aim_dir(&dir)) return FALSE;
1264 slow_monster(dir, plev);
1267 if (!get_aim_dir(&dir)) return FALSE;
1268 sleep_monster(dir, plev);
1271 (void)set_fast(p_ptr, randint1(20 + plev) + plev, FALSE);
1275 if (!get_aim_dir(&dir)) return FALSE;
1277 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
1278 fire_ball_hide(GF_HAND_DOOM, dir, plev * 3, 0);
1282 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
1283 (void)hp_player(p_ptr, plev*4);
1284 (void)set_stun(p_ptr, 0);
1285 (void)set_cut(p_ptr,0);
1288 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
1289 (void)set_invuln(p_ptr, randint1(4) + 4, FALSE);
1292 teleport_player(10, 0L);
1295 teleport_player(plev * 5, 0L);
1298 (void)time_walk(p_ptr);
1304 monster_type *m_ptr;
1305 monster_race *r_ptr;
1306 GAME_TEXT m_name[MAX_NLEN];
1308 if (!target_set(TARGET_KILL)) return FALSE;
1309 if (!current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
1310 if (!player_has_los_bold(target_row, target_col)) break;
1311 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
1312 m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx];
1313 r_ptr = &r_info[m_ptr->r_idx];
1314 monster_desc(m_name, m_ptr, 0);
1315 if (r_ptr->flagsr & RFR_RES_TELE)
1317 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
1319 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1320 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
1323 else if (r_ptr->level > randint1(100))
1325 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1326 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
1330 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
1331 teleport_monster_to(current_floor_ptr->grid_array[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
1335 if (!get_aim_dir(&dir)) return FALSE;
1337 (void)fire_beam(GF_AWAY_ALL, dir, 100);
1341 return teleport_level_other(p_ptr);
1345 if (!get_aim_dir(&dir)) return FALSE;
1347 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
1348 damage = monspell_bluemage_damage((MS_PSY_SPEAR), plev, DAM_ROLL);
1349 (void)fire_beam(GF_PSY_SPEAR, dir, damage);
1353 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
1354 (void)unlite_area(10, 3);
1357 if (!target_set(TARGET_KILL)) return FALSE;
1359 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
1360 trap_creation(target_row, target_col);
1363 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
1366 msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
1367 (void)animate_dead(0, p_ptr->y, p_ptr->x);
1373 msg_print(_("援軍を召喚した。", "You summon minions."));
1374 for (k = 0;k < 1; k++)
1376 if (summon_kin_player(summon_lev, p_ptr->y, p_ptr->x, (pet ? PM_FORCE_PET : 0L)))
1378 if (!pet) msg_print(_("召喚された仲間は怒っている!", "Summoned fellows are angry!"));
1391 msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!"));
1392 for (k = 0 ;k < 1 ; k++)
1393 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_CYBER, p_mode))
1396 msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!"));
1407 msg_print(_("仲間を召喚した。", "You summon help."));
1408 for (k = 0;k < 1; k++)
1409 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, p_mode))
1412 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!"));
1423 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
1424 for (k = 0;k < plev / 15 + 2; k++)
1425 if(summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, (p_mode | u_mode)))
1428 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!"));
1439 msg_print(_("アリを召喚した。", "You summon ants."));
1440 for (k = 0; k < 1; k++)
1441 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode)))
1444 msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!"));
1455 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
1456 for (k = 0;k < 1; k++)
1457 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode)))
1460 msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!"));
1471 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
1472 for (k = 0;k < 1; k++)
1473 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode)))
1476 msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!"));
1487 msg_print(_("ヒドラを召喚した。", "You summon a hydras."));
1488 for (k = 0;k < 1; k++)
1489 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HYDRA, (g_mode | p_mode)))
1492 msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!"));
1503 msg_print(_("天使を召喚した!", "You summon an angel!"));
1504 for (k = 0;k < 1; k++)
1505 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANGEL, (g_mode | p_mode)))
1508 msg_print(_("召喚された天使は怒っている!", "Summoned angels are angry!"));
1519 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
1520 for (k = 0;k < 1; k++)
1521 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DEMON, (g_mode | p_mode)))
1524 msg_print(_("召喚されたデーモンは怒っている!", "Summoned demons are angry!"));
1535 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
1536 for (k = 0;k < 1; k++)
1537 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode)))
1540 msg_print(_("召喚されたアンデッドは怒っている!", "Summoned undeads are angry!"));
1551 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
1552 for (k = 0;k < 1; k++)
1553 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DRAGON, (g_mode | p_mode)))
1556 msg_print(_("召喚されたドラゴンは怒っている!", "Summoned dragons are angry!"));
1564 case MS_S_HI_UNDEAD:
1567 msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!"));
1568 for (k = 0;k < 1; k++)
1569 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode)))
1572 msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
1580 case MS_S_HI_DRAGON:
1583 msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!"));
1584 for (k = 0;k < 1; k++)
1585 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode)))
1588 msg_print(_("召喚された古代ドラゴンは怒っている!", "Summoned ancient dragons are angry!"));
1599 msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!"));
1600 for (k = 0;k < 1; k++)
1601 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode)))
1604 msg_print(_("召喚されたアンバーの王族は怒っている!", "Summoned Lords of Amber are angry!"));
1615 msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!"));
1616 for (k = 0;k < 1; k++)
1617 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1621 msg_print(_("召喚されたユニーク・モンスターは怒っている!", "Summoned special opponents are angry!"));
1623 for (k = count;k < 1; k++)
1624 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1628 msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
1641 msg_print(_("何も現れなかった。", "No one have appeared."));
1648 * @brief 青魔法コマンドのメインルーチン /
1649 * do_cmd_cast calls this function if the player's class is 'Blue-Mage'.
1650 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1652 bool do_cmd_cast_learned(void)
1656 PERCENTAGE minfail = 0;
1657 PLAYER_LEVEL plev = p_ptr->lev;
1658 monster_power spell;
1660 MANA_POINT need_mana;
1662 if (cmd_limit_confused(p_ptr)) return FALSE;
1664 if (!get_learned_power(&n)) return FALSE;
1666 spell = monster_powers[n];
1668 need_mana = mod_need_mana(spell.smana, 0, REALM_NONE);
1670 /* Verify "dangerous" spells */
1671 if (need_mana > p_ptr->csp)
1674 msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
1676 if (!over_exert) return FALSE;
1679 if (!get_check(_("それでも挑戦しますか? ", "Attempt it anyway? "))) return FALSE;
1682 /* Spell failure chance */
1683 chance = spell.fail;
1685 /* Reduce failure rate by "effective" level adjustment */
1686 if (plev > spell.level) chance -= 3 * (plev - spell.level);
1687 else chance += (spell.level - plev);
1689 /* Reduce failure rate by INT/WIS adjustment */
1690 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
1692 chance = mod_spell_chance_1(chance);
1694 /* Not enough mana to cast */
1695 if (need_mana > p_ptr->csp)
1697 chance += 5 * (need_mana - p_ptr->csp);
1700 /* Extract the minimum failure rate */
1701 minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
1703 /* Minimum failure rate */
1704 if (chance < minfail) chance = minfail;
1706 /* Stunning makes spells harder */
1707 if (p_ptr->stun > 50) chance += 25;
1708 else if (p_ptr->stun) chance += 15;
1710 /* Always a 5 percent chance of working */
1711 if (chance > 95) chance = 95;
1713 chance = mod_spell_chance_2(chance);
1716 if (randint0(100) < chance)
1718 if (flush_failure) flush();
1719 msg_print(_("魔法をうまく唱えられなかった。", "You failed to concentrate hard enough!"));
1724 cast = cast_learned_spell(n, FALSE);
1729 cast = cast_learned_spell(n, TRUE);
1730 if (!cast) return FALSE;
1733 /* Sufficient mana */
1734 if (need_mana <= p_ptr->csp)
1737 p_ptr->csp -= need_mana;
1741 int oops = need_mana;
1745 p_ptr->csp_frac = 0;
1747 msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
1749 /* Hack -- Bypass free action */
1750 (void)set_paralyzed(p_ptr, p_ptr->paralyzed + randint1(5 * oops + 1));
1752 chg_virtue(p_ptr, V_KNOWLEDGE, -10);
1754 /* Damage CON (possibly permanently) */
1755 if (randint0(100) < 50)
1757 bool perm = (randint0(100) < 25);
1759 msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
1761 /* Reduce constitution */
1762 (void)dec_stat(p_ptr, A_CON, 15 + randint1(10), perm);
1766 take_turn(p_ptr, 100);
1768 p_ptr->redraw |= (PR_MANA);
1769 p_ptr->window |= (PW_PLAYER | PW_SPELL);
1775 * @brief 青魔法のラーニング判定と成功した場合のラーニング処理
1776 * @param monspell ラーニングを試みるモンスター攻撃のID
1779 void learn_spell(int monspell)
1781 if (p_ptr->action != ACTION_LEARN) return;
1782 if (monspell < 0) return;
1783 if (p_ptr->magic_num2[monspell]) return;
1784 if (p_ptr->confused || p_ptr->blind || p_ptr->image || p_ptr->stun || p_ptr->paralyzed) return;
1785 if (randint1(p_ptr->lev + 70) > monster_powers[monspell].level + 40)
1787 p_ptr->magic_num2[monspell] = 1;
1788 msg_format(_("%sを学習した!", "You have learned %s!"), monster_powers[monspell].name);
1789 gain_exp(p_ptr, monster_powers[monspell].level * monster_powers[monspell].smana);
1793 p_ptr->new_mane = TRUE;
1794 p_ptr->redraw |= (PR_STATE);
1800 * @brief モンスター特殊能力のフラグ配列から特定条件の魔法だけを抜き出す処理
1801 * Extract monster spells mask for the given mode
1802 * @param f4 モンスター特殊能力の4番目のフラグ配列
1803 * @param f5 モンスター特殊能力の5番目のフラグ配列
1804 * @param f6 モンスター特殊能力の6番目のフラグ配列
1805 * @param mode 抜き出したい条件
1810 void set_rf_masks(BIT_FLAGS *f4, BIT_FLAGS *f5, BIT_FLAGS *f6, BIT_FLAGS mode)
1814 case MONSPELL_TYPE_BOLT:
1815 *f4 = ((RF4_BOLT_MASK | RF4_BEAM_MASK) & ~(RF4_ROCKET));
1816 *f5 = RF5_BOLT_MASK | RF5_BEAM_MASK;
1817 *f6 = RF6_BOLT_MASK | RF6_BEAM_MASK;
1820 case MONSPELL_TYPE_BALL:
1821 *f4 = (RF4_BALL_MASK & ~(RF4_BREATH_MASK));
1822 *f5 = (RF5_BALL_MASK & ~(RF5_BREATH_MASK));
1823 *f6 = (RF6_BALL_MASK & ~(RF6_BREATH_MASK));
1826 case MONSPELL_TYPE_BREATH:
1827 *f4 = RF4_BREATH_MASK;
1828 *f5 = RF5_BREATH_MASK;
1829 *f6 = RF6_BREATH_MASK;
1832 case MONSPELL_TYPE_SUMMON:
1833 *f4 = RF4_SUMMON_MASK;
1834 *f5 = RF5_SUMMON_MASK;
1835 *f6 = RF6_SUMMON_MASK;
1838 case MONSPELL_TYPE_OTHER:
1839 *f4 = RF4_ATTACK_MASK & ~(RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_INDIRECT_MASK);
1840 *f5 = RF5_ATTACK_MASK & ~(RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_INDIRECT_MASK);
1841 *f6 = RF6_ATTACK_MASK & ~(RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | RF6_INDIRECT_MASK);