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
18 #include "spells-summon.h"
20 #include "spells-status.h"
21 #include "cmd-spell.h"
22 #include "player-status.h"
23 #include "monster-spell.h"
24 #include "monster-status.h"
26 #include "cmd-basic.h"
27 #include "player-effects.h"
28 #include "targeting.h"
30 #define pseudo_plev() (((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 130) /*!< モンスター魔法をプレイヤーが使用する場合の換算レベル */
36 * level, smana, %fail, manedam, %manefail, use_stat, name
38 const monster_power monster_powers[MAX_MONSPELLS] =
41 { 1, 1, 10, 0, 15, A_CON, "叫ぶ"},
42 { 10, 4, 35, 89, 40, A_INT, "何か"},
43 { 40, 35, 85, 0, 40, A_INT, "魔力消去"},
44 { 35, 30, 80, 800, 70, A_STR, "ロケット"},
45 { 5, 1, 20, 18, 15, A_DEX, "射撃"},
46 { 10, 4, 35, 89, 40, A_INT, "何か"},
47 { 10, 4, 35, 89, 40, A_INT, "何か"},
48 { 10, 4, 35, 89, 40, A_INT, "何か"},
49 { 20, 15, 55, 1600, 95, A_CON, "酸のブレス"},
50 { 20, 15, 55, 1600, 95, A_CON, "電撃のブレス"},
51 { 20, 15, 55, 1600, 95, A_CON, "炎のブレス"},
52 { 20, 15, 55, 1600, 95, A_CON, "冷気のブレス"},
53 { 20, 15, 55, 800, 95, A_CON, "毒のブレス"},
54 { 20, 15, 70, 550, 95, A_CON, "地獄のブレス"},
55 { 20, 16, 70, 400, 95, A_CON, "閃光のブレス"},
56 { 20, 16, 70, 400, 95, A_CON, "暗黒のブレス"},
57 { 20, 20, 70, 450, 95, A_CON, "混乱のブレス"},
58 { 20, 20, 70, 450, 95, A_CON, "轟音のブレス"},
59 { 20, 20, 70, 600, 95, A_CON, "カオスのブレス"},
60 { 20, 16, 70, 500, 95, A_CON, "劣化のブレス"},
61 { 30, 25, 80, 250, 95, A_CON, "因果混乱のブレス"},
62 { 35, 18, 80, 150, 95, A_CON, "時間逆転のブレス"},
63 { 30, 25, 80, 200, 95, A_CON, "遅鈍のブレス"},
64 { 30, 28, 90, 200, 95, A_CON, "重力のブレス"},
65 { 20, 15, 70, 500, 95, A_CON, "破片のブレス"},
66 { 35, 15, 80, 150, 95, A_CON, "プラズマのブレス"},
67 { 30, 18, 70, 200, 95, A_CON, "フォースのブレス"},
68 { 30, 28, 80, 250, 95, A_CON, "魔力のブレス"},
69 { 25, 20, 95, 320, 80, A_INT, "放射能球"},
70 { 25, 15, 70, 800, 95, A_CON, "放射性廃棄物のブレス"},
71 { 30, 32, 85, 400, 80, A_INT, "純ログルス"},
72 { 35, 40, 95, 150, 95, A_CON, "分解のブレス"},
73 { 18, 13, 55, 630, 80, A_INT, "アシッド・ボール"},
74 { 14, 10, 45, 316, 60, A_INT, "サンダー・ボール"},
75 { 20, 14, 60, 720, 80, A_INT, "ファイア・ボール"},
76 { 15, 11, 50, 320, 60, A_INT, "アイス・ボール"},
77 { 5, 3, 40, 48, 20, A_INT, "悪臭雲"},
78 { 25, 18, 70, 350, 80, A_INT, "地獄球"},
79 { 30, 22, 75, 350, 80, A_INT, "ウォーター・ボール"},
80 { 44, 45, 85, 550, 95, A_INT, "魔力の嵐"},
81 { 40, 42, 90, 550, 95, A_INT, "暗黒の嵐"},
82 { 10, 5, 50, 0, 25, A_INT, "魔力吸収"},
83 { 25, 10, 60, 0, 30, A_INT, "精神攻撃"},
84 { 30, 14, 65, 0, 30, A_INT, "脳攻撃"},
85 { 3, 1, 25, 24, 20, A_INT, "軽傷"},
86 { 12, 2, 35, 64, 25, A_INT, "重傷"},
87 { 22, 6, 50, 150, 30, A_INT, "致命傷"},
88 { 32, 10, 70, 225, 35, A_INT, "秘孔を突く"},
89 { 13, 7, 40, 178, 40, A_INT, "アシッド・ボルト"},
90 { 10, 5, 35, 130, 35, A_INT, "サンダー・ボルト"},
91 { 15, 9, 50, 210, 45, A_INT, "ファイア・ボルト"},
92 { 12, 6, 35, 162, 40, A_INT, "アイス・ボルト"},
93 { 40, 42, 90, 550, 95, A_INT, "スター・バースト"},
94 { 25, 17, 60, 255, 60, A_INT, "地獄の矢"},
95 { 25, 20, 65, 250, 60, A_INT, "ウォーター・ボルト"},
96 { 25, 24, 90, 400, 80, A_INT, "魔力の矢"},
97 { 25, 20, 80, 216, 60, A_INT, "プラズマ・ボルト"},
98 { 25, 16, 60, 186, 60, A_INT, "極寒の矢"},
99 { 3, 1, 25, 12, 20, A_INT, "マジック・ミサイル"},
100 { 5, 3, 35, 0, 20, A_INT, "恐慌"},
101 { 10, 5, 40, 0, 20, A_INT, "盲目"},
102 { 10, 5, 40, 0, 20, A_INT, "パニック・モンスター"},
103 { 10, 5, 40, 0, 20, A_INT, "スロウ・モンスター"},
104 { 10, 5, 40, 0, 20, A_INT, "スリープ・モンスター"},
105 { 20, 10, 70, 0, 40, A_INT, "スピード"},
106 { 45, 120, 95, 0, 60, A_INT, "破滅の手"},
107 { 20, 15, 70, 0, 20, A_WIS, "体力回復"},
108 { 45, 65, 80, 0, 60, A_INT, "無傷の球"},
109 { 5, 1, 30, 0, 20, A_INT, "ショート・テレポート"},
110 { 15, 8, 40, 0, 30, A_INT, "テレポート"},
111 { 40, 999, 99, 0, 80, A_INT, "ザ・ワールド"},
112 { 1, 0, 0, 0, 15, A_INT, "何か"},
113 { 15, 8, 50, 0, 30, A_INT, "引きよせる"},
114 { 20, 13, 80, 0, 30, A_INT, "テレポート・アウェイ"},
115 { 30, 40, 95, 0, 40, A_INT, "テレポート・レベル"},
116 { 35, 30, 80, 350, 70, A_INT, "光の剣"},
117 { 5, 1, 20, 0, 15, A_INT, "暗闇"},
118 { 5, 1, 20, 0, 15, A_DEX, "トラップ創造"},
119 { 15, 3, 40, 0, 30, A_INT, "記憶喪失"},
120 { 30, 30, 70, 0, 40, A_INT, "死者復活"},
121 { 40, 70, 85, 0, 45, A_INT, "援軍を呼ぶ"},
122 { 45, 90, 90, 0, 50, A_INT, "サイバーデーモンの召喚"},
123 { 25, 20, 65, 0, 30, A_INT, "モンスターの召喚"},
124 { 35, 30, 75, 0, 40, A_INT, "複数のモンスターの召喚"},
125 { 25, 25, 65, 0, 25, A_INT, "アリの召喚"},
126 { 25, 20, 60, 0, 25, A_INT, "蜘蛛の召喚"},
127 { 35, 26, 75, 0, 40, A_INT, "ハウンドの召喚"},
128 { 30, 23, 70, 0, 35, A_INT, "ヒドラの召喚"},
129 { 40, 50, 85, 0, 40, A_INT, "天使の召喚"},
130 { 35, 50, 80, 0, 35, A_INT, "デーモンの召喚"},
131 { 30, 30, 75, 0, 35, A_INT, "アンデッドの召喚"},
132 { 39, 70, 80, 0, 40, A_INT, "ドラゴンの召喚"},
133 { 43, 85, 85, 0, 45, A_INT, "上級アンデッドの召喚"},
134 { 46, 90, 85, 0, 45, A_INT, "古代ドラゴンの召喚"},
135 { 48, 120, 90, 0, 50, A_INT, "アンバーの王族の召喚"},
136 { 50, 150, 95, 0, 50, A_INT, "ユニークモンスターの召喚"},
138 { 1, 1, 10, 0, 15, A_CON, "shriek"},
139 { 10, 4, 35, 89, 40, A_INT, "something"},
140 { 40, 35, 85, 0, 40, A_INT, "dispel-magic"},
141 { 35, 30, 80, 800, 70, A_STR, "rocket"},
142 { 2, 1, 15, 10, 15, A_DEX, "arrow"},
143 { 5, 2, 20, 18, 20, A_DEX, "arrows"},
144 { 12, 3, 25, 30, 25, A_DEX, "missile"},
145 { 16, 4, 30, 42, 30, A_DEX, "missiles"},
146 { 20, 15, 55, 1600, 95, A_CON, "breath acid"},
147 { 20, 15, 55, 1600, 95, A_CON, "breath lightning"},
148 { 20, 15, 55, 1600, 95, A_CON, "breath fire"},
149 { 20, 15, 55, 1600, 95, A_CON, "breath cold"},
150 { 20, 15, 55, 800, 95, A_CON, "breath poison"},
151 { 20, 15, 70, 550, 95, A_CON, "breath nether"},
152 { 20, 16, 70, 400, 95, A_CON, "breath light"},
153 { 20, 16, 70, 400, 95, A_CON, "breath dark"},
154 { 20, 20, 70, 450, 95, A_CON, "breath confusion"},
155 { 20, 20, 70, 450, 95, A_CON, "breath sound"},
156 { 20, 20, 70, 600, 95, A_CON, "breath chaos"},
157 { 20, 16, 70, 500, 95, A_CON, "breath disenchantment"},
158 { 30, 25, 80, 250, 95, A_CON, "breath nexus"},
159 { 35, 18, 80, 150, 95, A_CON, "breath time"},
160 { 30, 25, 80, 200, 95, A_CON, "breath inertia"},
161 { 30, 28, 90, 200, 95, A_CON, "breath gravity"},
162 { 20, 15, 70, 500, 95, A_CON, "breath shards"},
163 { 35, 15, 80, 150, 95, A_CON, "breath plasma"},
164 { 30, 18, 70, 200, 95, A_CON, "breath force"},
165 { 30, 28, 80, 250, 95, A_CON, "breath mana"},
166 { 25, 20, 95, 320, 80, A_INT, "nuke ball"},
167 { 25, 15, 70, 800, 95, A_CON, "breath nuke"},
168 { 30, 32, 85, 400, 80, A_INT, "raw Logrus"},
169 { 35, 40, 95, 150, 95, A_CON, "breath disintegrate"},
170 { 18, 13, 55, 630, 80, A_INT, "acid ball"},
171 { 14, 10, 45, 316, 60, A_INT, "lightning ball"},
172 { 20, 14, 60, 720, 80, A_INT, "fire ball"},
173 { 15, 11, 50, 320, 60, A_INT, "frost ball"},
174 { 5, 3, 40, 48, 20, A_INT, "stinking cloud"},
175 { 25, 18, 70, 350, 80, A_INT, "nether ball"},
176 { 30, 22, 75, 350, 80, A_INT, "water ball"},
177 { 44, 45, 85, 550, 95, A_INT, "mana storm"},
178 { 40, 42, 90, 550, 95, A_INT, "darkness storm"},
179 { 10, 5, 50, 0, 25, A_INT, "drain mana"},
180 { 25, 10, 60, 0, 30, A_INT, "mind blast"},
181 { 30, 14, 65, 0, 30, A_INT, "brain smash"},
182 { 3, 1, 25, 24, 20, A_INT, "cause light wounds"},
183 { 12, 2, 35, 64, 25, A_INT, "cause serious wounds"},
184 { 22, 6, 50, 150, 30, A_INT, "cause critical wounds"},
185 { 32, 10, 70, 225, 35, A_INT, "cause mortal wounds"},
186 { 13, 7, 40, 178, 40, A_INT, "acid bolt"},
187 { 10, 5, 35, 130, 35, A_INT, "lightning bolt"},
188 { 15, 9, 50, 210, 45, A_INT, "fire bolt"},
189 { 12, 6, 35, 162, 40, A_INT, "frost bolt"},
190 { 40, 42, 90, 550, 95, A_INT, "starburst"},
191 { 25, 17, 60, 255, 60, A_INT, "nether bolt"},
192 { 25, 20, 65, 250, 60, A_INT, "water bolt"},
193 { 25, 24, 90, 400, 80, A_INT, "mana bolt"},
194 { 25, 20, 80, 216, 60, A_INT, "plasma bolt"},
195 { 25, 16, 60, 186, 60, A_INT, "ice bolt"},
196 { 3, 1, 25, 12, 20, A_INT, "magic missile"},
197 { 5, 3, 35, 0, 20, A_INT, "scare"},
198 { 10, 5, 40, 0, 20, A_INT, "blind"},
199 { 10, 5, 40, 0, 20, A_INT, "confuse"},
200 { 10, 5, 40, 0, 20, A_INT, "slow"},
201 { 10, 5, 40, 0, 20, A_INT, "sleep"},
202 { 20, 10, 70, 0, 40, A_INT, "speed"},
203 { 45, 120, 95, 0, 60, A_INT, "the Hand of Doom"},
204 { 20, 15, 70, 0, 20, A_WIS, "heal-self"},
205 { 45, 65, 80, 0, 60, A_INT, "make invulnerable"},
206 { 5, 1, 30, 0, 20, A_INT, "blink-self"},
207 { 15, 8, 40, 0, 30, A_INT, "teleport-self"},
208 { 40, 999, 99, 0, 80, A_INT, "The world"},
209 { 1, 0, 0, 0, 15, A_INT, "something"},
210 { 15, 8, 50, 0, 30, A_INT, "teleport to"},
211 { 20, 13, 80, 0, 30, A_INT, "teleport away"},
212 { 30, 40, 95, 0, 40, A_INT, "teleport level"},
213 { 35, 30, 80, 350, 70, A_INT, "psycho-spear"},
214 { 5, 1, 20, 0, 15, A_INT, "create darkness"},
215 { 5, 1, 20, 0, 15, A_DEX, "create traps"},
216 { 15, 3, 40, 0, 30, A_INT, "cause amnesia"},
217 { 30, 30, 70, 0, 40, A_INT, "raise dead"},
218 { 40, 70, 85, 0, 45, A_INT, "summon aid"},
219 { 45, 90, 90, 0, 50, A_INT, "summon Cyberdemons"},
220 { 25, 20, 65, 0, 30, A_INT, "summon a monster"},
221 { 35, 30, 75, 0, 40, A_INT, "summon monsters"},
222 { 25, 25, 65, 0, 25, A_INT, "summon ants"},
223 { 25, 20, 60, 0, 25, A_INT, "summon spiders"},
224 { 35, 26, 75, 0, 40, A_INT, "summon hounds"},
225 { 30, 23, 70, 0, 35, A_INT, "summon hydras"},
226 { 40, 50, 85, 0, 40, A_INT, "summon an angel"},
227 { 35, 50, 80, 0, 35, A_INT, "summon a daemon"},
228 { 30, 30, 75, 0, 35, A_INT, "summon an undead"},
229 { 39, 70, 80, 0, 40, A_INT, "summon a dragon"},
230 { 43, 85, 85, 0, 45, A_INT, "summon Greater Undead"},
231 { 46, 90, 85, 0, 45, A_INT, "summon Ancient Dragon"},
232 { 48, 120, 90, 0, 50, A_INT, "summon Lords of Amber"},
233 { 50, 150, 95, 0, 50, A_INT, "summon Unique Monsters"},
239 * @brief モンスター魔法名テーブル
241 const concptr monster_powers_short[MAX_MONSPELLS] = {
244 "叫ぶ", "何か", "魔力消去", "ロケット", "射撃", "何か", "何か", "何か",
245 "酸", "電撃", "火炎", "冷気", "毒", "地獄", "閃光", "暗黒",
246 "混乱", "轟音", "カオス", "劣化", "因果混乱", "時間逆転", "遅鈍", "重力",
247 "破片", "プラズマ", "フォース", "魔力", "放射能球", "放射性廃棄物", "純ログルス", "分解",
249 "酸", "電撃", "火炎", "冷気", "悪臭雲", "地獄球", "ウォーター", "魔力の嵐",
250 "暗黒の嵐", "魔力吸収", "精神攻撃", "脳攻撃", "軽傷", "重傷", "致命傷", "秘孔を突く",
251 "酸", "電撃", "火炎", "冷気", "スターバースト", "地獄の矢", "ウォーター", "魔力の矢",
252 "プラズマ", "極寒", "マジックミサイル", "恐慌", "盲目", "混乱", "減速", "睡眠",
254 "加速", "破滅の手", "体力回復", "無傷の球", "ショートテレポート", "テレポート", "時を止める", "何か",
255 "引きよせる", "テレポートアウェイ", "テレポートレベル", "光の剣", "暗闇", "トラップ創造", "記憶喪失", "死者復活",
256 "援軍", "サイバーデーモン", "モンスター", "複数のモンスター", "蟻", "蜘蛛", "ハウンド", "ヒドラ",
257 "天使", "悪魔", "アンデッド", "ドラゴン", "上級アンデッド", "古代ドラゴン", "アンバーの王族", "ユニーク"
261 "Shriek", "Something", "Dispel-magic", "Rocket", "Arrow", "Arrows", "Missile", "Missiles",
262 "Acid", "Lightning", "Fire", "Cold", "Poison", "Nether", "Light", "Dark",
263 "Confusion", "Sound", "Chaos", "Disenchantment", "Nexus", "Time", "Inertia", "Gravity",
264 "Shards", "Plasma", "Force", "Mana", "Nuke", "Nuke", "Logrus", "Disintergrate",
266 "Acid", "Lightning", "Fire", "Frost", "Stinking Cloud", "Nether", "Water", "Mana storm",
267 "Darkness storm", "Drain mana", "Mind blast", "Brain smash", "Cause Light Wound", "Cause Serious Wound", "Cause Critical Wound", "Cause Mortal Wound",
268 "Acid", "Lightning", "Fire", "Frost", "Starburst", "Nether", "Water", "Mana",
269 "Plasm", "Ice", "Magic missile", "Scare", "Blind", "Confuse", "Slow", "Sleep",
271 "Speed", "Hand of doom", "Heal-self", "Invulnerable", "Blink", "Teleport", "The world", "Something",
272 "Teleport to", "Teleport away", "Teleport level", "Psycho-spear", "Create darkness", "Create traps", "Amnesia", "Raise dead",
273 "Aid", "Cyberdeamons", "A monster", "Monsters", "Ants", "Spiders", "Hounds", "Hydras",
274 "Angel", "Daemon", "Undead", "Dragon", "Greater Undead", "Ancient Dragon", "Lords of Amber", "Unique monsters"
282 * @brief 文字列に青魔導師の呪文の攻撃力を加える
283 * @param SPELL_NUM 呪文番号
284 * @param plev プレイヤーレベル
286 * @param tmp 返すメッセージを格納する配列
289 void set_bluemage_damage(int SPELL_NUM, PLAYER_LEVEL plev, concptr msg, char* tmp)
291 int base_damage = monspell_bluemage_damage(SPELL_NUM, plev, BASE_DAM);
292 int dice_num = monspell_bluemage_damage(SPELL_NUM, plev, DICE_NUM);
293 int dice_side = monspell_bluemage_damage(SPELL_NUM, plev, DICE_SIDE);
294 int dice_mult = monspell_bluemage_damage(SPELL_NUM, plev, DICE_MULT);
295 int dice_div = monspell_bluemage_damage(SPELL_NUM, plev, DICE_DIV);
297 dice_to_string(base_damage, dice_num, dice_side, dice_mult, dice_div, dmg_str);
298 sprintf(tmp, " %s %s", msg, dmg_str);
302 * @brief 受け取ったモンスター魔法のIDに応じて青魔法の効果情報をまとめたフォーマットを返す
303 * @param p 情報を返す文字列参照ポインタ
304 * @param power モンスター魔法のID
307 static void learned_info(char *p, int power)
309 PLAYER_LEVEL plev = pseudo_plev();
354 set_bluemage_damage((power), plev, KWD_DAM, p); break;
390 set_bluemage_damage((power), plev, KWD_DAM, p); break;
392 set_bluemage_damage((power), plev, KWD_HEAL, p); break;
408 case MS_MAGIC_MISSILE:
409 set_bluemage_damage((power), plev, KWD_DAM, p); break;
411 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
414 set_bluemage_damage((power), plev, KWD_HEAL, p); break;
416 sprintf(p, " %sd7+7", KWD_DURATION);
419 sprintf(p, " %s10", KWD_SPHERE);
422 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
425 set_bluemage_damage((power), plev, KWD_DAM, p); break;
428 sprintf(p, " %s5", KWD_SPHERE);
437 * @brief 使用可能な青魔法を選択する /
438 * Allow user to choose a imitation.
439 * @param sn 選択したモンスター攻撃ID、キャンセルの場合-1、不正な選択の場合-2を返す
440 * @return 発動可能な魔法を選択した場合TRUE、キャンセル処理か不正な選択が行われた場合FALSEを返す。
442 * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
443 * If the user hits escape, returns FALSE, and set '*sn' to -1\n
444 * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n
446 * The "prompt" should be "cast", "recite", or "study"\n
447 * The "known" should be TRUE for cast/pray, FALSE for study\n
449 * nb: This function has a (trivial) display bug which will be obvious\n
450 * when you run it. It's probably easy to fix but I haven't tried,\n
453 static bool get_learned_power(SPELL_IDX *sn)
459 PERCENTAGE minfail = 0;
460 PLAYER_LEVEL plev = p_ptr->lev;
461 PERCENTAGE chance = 0;
462 int ask = TRUE, mode = 0;
463 int spellnum[MAX_MONSPELLS];
468 BIT_FLAGS f4 = 0L, f5 = 0L, f6 = 0L;
469 concptr p = _("魔法", "magic");
473 int menu_line = (use_menu ? 1 : 0);
475 /* Assume cancelled */
478 /* Nothing chosen yet */
484 /* Get the spell, if available */
486 if (repeat_pull(&code))
488 *sn = (SPELL_IDX)code;
498 prt(format(_(" %s ボルト", " %s bolt"), (menu_line == 1) ? _("》", "> ") : " "), 2, 14);
499 prt(format(_(" %s ボール", " %s ball"), (menu_line == 2) ? _("》", "> ") : " "), 3, 14);
500 prt(format(_(" %s ブレス", " %s breath"), (menu_line == 3) ? _("》", "> ") : " "), 4, 14);
501 prt(format(_(" %s 召喚", " %s sommoning"), (menu_line == 4) ? _("》", "> ") : " "), 5, 14);
502 prt(format(_(" %s その他", " %s others"), (menu_line == 5) ? _("》", "> ") : " "), 6, 14);
503 prt(_("どの種類の魔法を使いますか?", "use which type of magic? "), 0, 0);
529 if (menu_line > 5) menu_line -= 5;
535 sprintf(comment, _("[A]ボルト, [B]ボール, [C]ブレス, [D]召喚, [E]その他:", "[A] bolt, [B] ball, [C] breath, [D] summoning, [E] others:"));
538 if (!get_com(comment, &ch, TRUE))
542 if (ch == 'A' || ch == 'a')
547 if (ch == 'B' || ch == 'b')
552 if (ch == 'C' || ch == 'c')
557 if (ch == 'D' || ch == 'd')
562 if (ch == 'E' || ch == 'e')
570 set_rf_masks(&f4, &f5, &f6, mode);
572 for (i = 0, num = 0; i < 32; i++)
574 if ((0x00000001 << i) & f4) spellnum[num++] = i;
578 if ((0x00000001 << (i - 32)) & f5) spellnum[num++] = i;
582 if ((0x00000001 << (i - 64)) & f6) spellnum[num++] = i;
584 for (i = 0; i < num; i++)
586 if (p_ptr->magic_num2[spellnum[i]])
588 if (use_menu) menu_line = i+1;
594 msg_print(_("その種類の魔法は覚えていない!", "You don't know any spell of this type."));
598 /* Build a prompt (accept all spells) */
599 (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sを唱えますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
600 I2A(0), I2A(num - 1), p);
602 if (use_menu) screen_save();
604 choice= (always_show_list || use_menu) ? ESCAPE:1 ;
607 if(choice==ESCAPE) choice = ' ';
608 else if( !get_com(out_val, &choice, TRUE) )break;
610 if (use_menu && choice != ' ')
626 menu_line += (num-1);
627 if (menu_line > num) menu_line -= num;
628 } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
639 if (menu_line > num) menu_line -= num;
640 } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
649 while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line--;
658 while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line++;
673 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
676 if (!redraw || use_menu)
680 if (!use_menu) screen_save();
682 /* Display a list of spells */
684 put_str(_("名前", "Name"), y, x + 5);
685 put_str(_("MP 失率 効果", "SP Fail Info"), y, x + 33);
688 /* Dump the spells */
689 for (i = 0; i < num; i++)
693 prt("", y + i + 1, x);
694 if (!p_ptr->magic_num2[spellnum[i]]) continue;
696 /* Access the spell */
697 spell = monster_powers[spellnum[i]];
701 /* Reduce failure rate by "effective" level adjustment */
702 if (plev > spell.level) chance -= 3 * (plev - spell.level);
703 else chance += (spell.level - plev);
705 /* Reduce failure rate by INT/WIS adjustment */
706 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
708 chance = mod_spell_chance_1(chance);
710 need_mana = mod_need_mana(monster_powers[spellnum[i]].smana, 0, REALM_NONE);
712 /* Not enough mana to cast */
713 if (need_mana > p_ptr->csp)
715 chance += 5 * (need_mana - p_ptr->csp);
718 /* Extract the minimum failure rate */
719 minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
721 /* Minimum failure rate */
722 if (chance < minfail) chance = minfail;
724 /* Stunning makes spells harder */
725 if (p_ptr->stun > 50) chance += 25;
726 else if (p_ptr->stun) chance += 15;
728 /* Always a 5 percent chance of working */
729 if (chance > 95) chance = 95;
731 chance = mod_spell_chance_2(chance);
734 learned_info(comment, spellnum[i]);
738 if (i == (menu_line-1)) strcpy(psi_desc, _(" 》", " > "));
739 else strcpy(psi_desc, " ");
741 else sprintf(psi_desc, " %c)", I2A(i));
743 /* Dump the spell --(-- */
744 strcat(psi_desc, format(" %-26s %3d %3d%%%s",
745 spell.name, need_mana,
747 prt(psi_desc, y + i + 1, x);
750 /* Clear the bottom line */
751 if (y < 22) prt("", y + i + 1, x);
769 ask = isupper(choice);
772 if (ask) choice = (char)tolower(choice);
774 /* Extract request */
775 i = (islower(choice) ? A2I(choice) : -1);
778 /* Totally Illegal */
779 if ((i < 0) || (i >= num) || !p_ptr->magic_num2[spellnum[i]])
785 /* Save the spell index */
786 spell = monster_powers[spellnum[i]];
794 (void) strnfmt(tmp_val, 78, _("%sの魔法を唱えますか?", "Use %s? "), monster_powers[spellnum[i]].name);
796 /* Belay that order */
797 if (!get_check(tmp_val)) continue;
803 if (redraw) screen_load();
805 p_ptr->window |= (PW_SPELL);
808 /* Abort if needed */
809 if (!flag) return (FALSE);
811 /* Save the choice */
814 repeat_push((COMMAND_CODE)spellnum[i]);
823 * do_cmd_cast calls this function if the player's class is 'blue-mage'.
824 * @param spell 発動するモンスター攻撃のID
825 * @param success TRUEは成功時、FALSEは失敗時の処理を行う
826 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
828 static bool cast_learned_spell(int spell, bool success)
831 PLAYER_LEVEL plev = pseudo_plev();
832 PLAYER_LEVEL summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2);
833 HIT_POINT damage = 0;
835 bool no_trump = FALSE;
836 BIT_FLAGS p_mode, u_mode = 0L, g_mode;
840 p_mode = PM_FORCE_PET;
846 g_mode = PM_ALLOW_GROUP;
849 if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE;
855 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
856 aggravate_monsters(0);
864 if (!target_set(TARGET_KILL)) return FALSE;
865 m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
867 if (!player_has_los_bold(target_row, target_col)) break;
868 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
869 dispel_monster_status(m_idx);
873 if (!get_aim_dir(&dir)) return FALSE;
875 msg_print(_("ロケットを発射した。", "You fire a rocket."));
876 damage = monspell_bluemage_damage((MS_ROCKET), plev, DAM_ROLL);
877 fire_rocket(GF_ROCKET, dir, damage, 2);
881 if (!get_aim_dir(&dir)) return FALSE;
883 msg_print(_("矢を放った。", "You fire an arrow."));
884 damage = monspell_bluemage_damage((MS_SHOOT), plev, DAM_ROLL);
885 fire_bolt(GF_ARROW, dir, damage);
895 if (!get_aim_dir(&dir)) return FALSE;
897 msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
898 damage = monspell_bluemage_damage((MS_BR_ACID), plev, DAM_ROLL);
899 fire_breath(GF_ACID, dir, damage, (plev > 40 ? 3 : 2));
902 if (!get_aim_dir(&dir)) return FALSE;
904 msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
905 damage = monspell_bluemage_damage((MS_BR_ELEC), plev, DAM_ROLL);
906 fire_breath(GF_ELEC, dir, damage, (plev > 40 ? 3 : 2));
909 if (!get_aim_dir(&dir)) return FALSE;
911 msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
912 damage = monspell_bluemage_damage((MS_BR_FIRE), plev, DAM_ROLL);
913 fire_breath(GF_FIRE, dir, damage, (plev > 40 ? 3 : 2));
916 if (!get_aim_dir(&dir)) return FALSE;
918 msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
919 damage = monspell_bluemage_damage((MS_BR_COLD), plev, DAM_ROLL);
920 fire_breath(GF_COLD, dir, damage, (plev > 40 ? 3 : 2));
923 if (!get_aim_dir(&dir)) return FALSE;
925 msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
926 damage = monspell_bluemage_damage((MS_BR_POIS), plev, DAM_ROLL);
927 fire_breath(GF_POIS, dir, damage, (plev > 40 ? 3 : 2));
930 if (!get_aim_dir(&dir)) return FALSE;
932 msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
933 damage = monspell_bluemage_damage((MS_BR_NETHER), plev, DAM_ROLL);
934 fire_breath(GF_NETHER, dir, damage, (plev > 40 ? 3 : 2));
937 if (!get_aim_dir(&dir)) return FALSE;
939 msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
940 damage = monspell_bluemage_damage((MS_BR_LITE), plev, DAM_ROLL);
941 fire_breath(GF_LITE, dir, damage, (plev > 40 ? 3 : 2));
944 if (!get_aim_dir(&dir)) return FALSE;
946 msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
947 damage = monspell_bluemage_damage((MS_BR_DARK), plev, DAM_ROLL);
948 fire_breath(GF_DARK, dir, damage, (plev > 40 ? 3 : 2));
951 if (!get_aim_dir(&dir)) return FALSE;
953 msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
954 damage = monspell_bluemage_damage((MS_BR_CONF), plev, DAM_ROLL);
955 fire_breath(GF_CONFUSION, dir, damage, (plev > 40 ? 3 : 2));
958 if (!get_aim_dir(&dir)) return FALSE;
960 msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
961 damage = monspell_bluemage_damage((MS_BR_SOUND), plev, DAM_ROLL);
962 fire_breath(GF_SOUND, dir, damage, (plev > 40 ? 3 : 2));
965 if (!get_aim_dir(&dir)) return FALSE;
967 msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
968 damage = monspell_bluemage_damage((MS_BR_CHAOS), plev, DAM_ROLL);
969 fire_breath(GF_CHAOS, dir, damage, (plev > 40 ? 3 : 2));
972 if (!get_aim_dir(&dir)) return FALSE;
974 msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
975 damage = monspell_bluemage_damage((MS_BR_DISEN), plev, DAM_ROLL);
976 fire_breath(GF_DISENCHANT, dir, damage, (plev > 40 ? 3 : 2));
979 if (!get_aim_dir(&dir)) return FALSE;
981 msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
982 damage = monspell_bluemage_damage((MS_BR_NEXUS), plev, DAM_ROLL);
983 fire_breath(GF_NEXUS, dir, damage, (plev > 40 ? 3 : 2));
986 if (!get_aim_dir(&dir)) return FALSE;
988 msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
989 damage = monspell_bluemage_damage((MS_BR_TIME), plev, DAM_ROLL);
990 fire_breath(GF_TIME, dir, damage, (plev > 40 ? 3 : 2));
993 if (!get_aim_dir(&dir)) return FALSE;
995 msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
996 damage = monspell_bluemage_damage((MS_BR_INERTIA), plev, DAM_ROLL);
997 fire_breath(GF_INERTIAL, dir, damage, (plev > 40 ? 3 : 2));
1000 if (!get_aim_dir(&dir)) return FALSE;
1002 msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
1003 damage = monspell_bluemage_damage((MS_BR_GRAVITY), plev, DAM_ROLL);
1004 fire_breath(GF_GRAVITY, dir, damage, (plev > 40 ? 3 : 2));
1007 if (!get_aim_dir(&dir)) return FALSE;
1009 msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
1010 damage = monspell_bluemage_damage((MS_BR_SHARDS), plev, DAM_ROLL);
1011 fire_breath(GF_SHARDS, dir, damage, (plev > 40 ? 3 : 2));
1014 if (!get_aim_dir(&dir)) return FALSE;
1016 msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
1017 damage = monspell_bluemage_damage((MS_BR_PLASMA), plev, DAM_ROLL);
1018 fire_breath(GF_PLASMA, dir, damage, (plev > 40 ? 3 : 2));
1021 if (!get_aim_dir(&dir)) return FALSE;
1023 msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
1024 damage = monspell_bluemage_damage((MS_BR_FORCE), plev, DAM_ROLL);
1025 fire_breath(GF_FORCE, dir, damage, (plev > 40 ? 3 : 2));
1028 if (!get_aim_dir(&dir)) return FALSE;
1030 msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
1031 damage = monspell_bluemage_damage((MS_BR_MANA), plev, DAM_ROLL);
1032 fire_breath(GF_MANA, dir, damage, (plev > 40 ? 3 : 2));
1035 if (!get_aim_dir(&dir)) return FALSE;
1037 msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
1038 damage = monspell_bluemage_damage((MS_BALL_NUKE), plev, DAM_ROLL);
1039 fire_ball(GF_NUKE, dir, damage, 2);
1042 if (!get_aim_dir(&dir)) return FALSE;
1044 msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
1045 damage = monspell_bluemage_damage((MS_BR_NUKE), plev, DAM_ROLL);
1046 fire_breath(GF_NUKE, dir, damage, (plev > 40 ? 3 : 2));
1049 if (!get_aim_dir(&dir)) return FALSE;
1051 msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
1052 damage = monspell_bluemage_damage((MS_BALL_CHAOS), plev, DAM_ROLL);
1053 fire_ball(GF_CHAOS, dir, damage, 4);
1056 if (!get_aim_dir(&dir)) return FALSE;
1058 msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
1059 damage = monspell_bluemage_damage((MS_BR_DISI), plev, DAM_ROLL);
1060 fire_breath(GF_DISINTEGRATE, dir, damage, (plev > 40 ? 3 : 2));
1063 if (!get_aim_dir(&dir)) return FALSE;
1065 msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
1066 damage = monspell_bluemage_damage((MS_BALL_ACID), plev, DAM_ROLL);
1067 fire_ball(GF_ACID, dir, damage, 2);
1070 if (!get_aim_dir(&dir)) return FALSE;
1072 msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
1073 damage = monspell_bluemage_damage((MS_BALL_ELEC), plev, DAM_ROLL);
1074 fire_ball(GF_ELEC, dir, damage, 2);
1077 if (!get_aim_dir(&dir)) return FALSE;
1079 msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
1080 damage = monspell_bluemage_damage((MS_BALL_FIRE), plev, DAM_ROLL);
1081 fire_ball(GF_FIRE, dir, damage, 2);
1084 if (!get_aim_dir(&dir)) return FALSE;
1086 msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
1087 damage = monspell_bluemage_damage((MS_BALL_COLD), plev, DAM_ROLL);
1088 fire_ball(GF_COLD, dir, damage, 2);
1091 if (!get_aim_dir(&dir)) return FALSE;
1093 msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
1094 damage = monspell_bluemage_damage((MS_BALL_POIS), plev, DAM_ROLL);
1095 fire_ball(GF_POIS, dir, damage, 2);
1097 case MS_BALL_NETHER:
1098 if (!get_aim_dir(&dir)) return FALSE;
1100 msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
1101 damage = monspell_bluemage_damage((MS_BALL_NETHER), plev, DAM_ROLL);
1102 fire_ball(GF_NETHER, dir, damage, 2);
1105 if (!get_aim_dir(&dir)) return FALSE;
1107 msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
1108 damage = monspell_bluemage_damage((MS_BALL_WATER), plev, DAM_ROLL);
1109 fire_ball(GF_WATER, dir, damage, 4);
1112 if (!get_aim_dir(&dir)) return FALSE;
1114 msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
1115 damage = monspell_bluemage_damage((MS_BALL_MANA), plev, DAM_ROLL);
1116 fire_ball(GF_MANA, dir, damage, 4);
1119 if (!get_aim_dir(&dir)) return FALSE;
1121 msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
1122 damage = monspell_bluemage_damage((MS_BALL_DARK), plev, DAM_ROLL);
1123 fire_ball(GF_DARK, dir, damage, 4);
1126 if (!get_aim_dir(&dir)) return FALSE;
1128 damage = monspell_bluemage_damage((MS_DRAIN_MANA), plev, DAM_ROLL);
1129 fire_ball_hide(GF_DRAIN_MANA, dir, damage, 0);
1132 if (!get_aim_dir(&dir)) return FALSE;
1134 damage = monspell_bluemage_damage((MS_MIND_BLAST), plev, DAM_ROLL);
1135 fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
1137 case MS_BRAIN_SMASH:
1138 if (!get_aim_dir(&dir)) return FALSE;
1140 damage = monspell_bluemage_damage((MS_BRAIN_SMASH), plev, DAM_ROLL);
1141 fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
1144 if (!get_aim_dir(&dir)) return FALSE;
1146 damage = monspell_bluemage_damage((MS_CAUSE_1), plev, DAM_ROLL);
1147 fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
1150 if (!get_aim_dir(&dir)) return FALSE;
1152 damage = monspell_bluemage_damage((MS_CAUSE_2), plev, DAM_ROLL);
1153 fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
1156 if (!get_aim_dir(&dir)) return FALSE;
1158 damage = monspell_bluemage_damage((MS_CAUSE_3), plev, DAM_ROLL);
1159 fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
1162 if (!get_aim_dir(&dir)) return FALSE;
1164 damage = monspell_bluemage_damage((MS_CAUSE_4), plev, DAM_ROLL);
1165 fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
1168 if (!get_aim_dir(&dir)) return FALSE;
1170 msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
1171 damage = monspell_bluemage_damage((MS_BOLT_ACID), plev, DAM_ROLL);
1172 fire_bolt(GF_ACID, dir, damage);
1175 if (!get_aim_dir(&dir)) return FALSE;
1177 msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
1178 damage = monspell_bluemage_damage((MS_BOLT_ELEC), plev, DAM_ROLL);
1179 fire_bolt(GF_ELEC, dir, damage);
1182 if (!get_aim_dir(&dir)) return FALSE;
1184 msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
1185 damage = monspell_bluemage_damage((MS_BOLT_FIRE), plev, DAM_ROLL);
1186 fire_bolt(GF_FIRE, dir, damage);
1189 if (!get_aim_dir(&dir)) return FALSE;
1191 msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
1192 damage = monspell_bluemage_damage((MS_BOLT_COLD), plev, DAM_ROLL);
1193 fire_bolt(GF_COLD, dir, damage);
1196 if (!get_aim_dir(&dir)) return FALSE;
1198 msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
1199 damage = monspell_bluemage_damage((MS_STARBURST), plev, DAM_ROLL);
1200 fire_ball(GF_LITE, dir, damage, 4);
1202 case MS_BOLT_NETHER:
1203 if (!get_aim_dir(&dir)) return FALSE;
1205 msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
1206 damage = monspell_bluemage_damage((MS_BOLT_NETHER), plev, DAM_ROLL);
1207 fire_bolt(GF_NETHER, dir, damage);
1210 if (!get_aim_dir(&dir)) return FALSE;
1212 msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
1213 damage = monspell_bluemage_damage((MS_BOLT_WATER), plev, DAM_ROLL);
1214 fire_bolt(GF_WATER, dir, damage);
1217 if (!get_aim_dir(&dir)) return FALSE;
1219 msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
1220 damage = monspell_bluemage_damage((MS_BOLT_MANA), plev, DAM_ROLL);
1221 fire_bolt(GF_MANA, dir, damage);
1223 case MS_BOLT_PLASMA:
1224 if (!get_aim_dir(&dir)) return FALSE;
1226 msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
1227 damage = monspell_bluemage_damage((MS_BOLT_PLASMA), plev, DAM_ROLL);
1228 fire_bolt(GF_PLASMA, dir, damage);
1231 if (!get_aim_dir(&dir)) return FALSE;
1233 msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
1234 damage = monspell_bluemage_damage((MS_BOLT_ICE), plev, DAM_ROLL);
1235 fire_bolt(GF_ICE, dir, damage);
1237 case MS_MAGIC_MISSILE:
1238 if (!get_aim_dir(&dir)) return FALSE;
1240 msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
1241 damage = monspell_bluemage_damage((MS_MAGIC_MISSILE), plev, DAM_ROLL);
1242 fire_bolt(GF_MISSILE, dir, damage);
1245 if (!get_aim_dir(&dir)) return FALSE;
1247 msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
1248 fear_monster(dir, plev+10);
1251 if (!get_aim_dir(&dir)) return FALSE;
1252 confuse_monster(dir, plev * 2);
1255 if (!get_aim_dir(&dir)) return FALSE;
1257 msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
1258 confuse_monster(dir, plev * 2);
1261 if (!get_aim_dir(&dir)) return FALSE;
1262 slow_monster(dir, plev);
1265 if (!get_aim_dir(&dir)) return FALSE;
1266 sleep_monster(dir, plev);
1269 (void)set_fast(randint1(20 + plev) + plev, FALSE);
1273 if (!get_aim_dir(&dir)) return FALSE;
1275 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
1276 fire_ball_hide(GF_HAND_DOOM, dir, plev * 3, 0);
1280 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
1281 (void)hp_player(plev*4);
1286 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
1287 (void)set_invuln(randint1(4) + 4, FALSE);
1290 teleport_player(10, 0L);
1293 teleport_player(plev * 5, 0L);
1296 (void)time_walk(p_ptr);
1302 monster_type *m_ptr;
1303 monster_race *r_ptr;
1304 GAME_TEXT m_name[MAX_NLEN];
1306 if (!target_set(TARGET_KILL)) return FALSE;
1307 if (!current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
1308 if (!player_has_los_bold(target_row, target_col)) break;
1309 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
1310 m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx];
1311 r_ptr = &r_info[m_ptr->r_idx];
1312 monster_desc(m_name, m_ptr, 0);
1313 if (r_ptr->flagsr & RFR_RES_TELE)
1315 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
1317 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1318 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
1321 else if (r_ptr->level > randint1(100))
1323 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1324 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
1328 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
1329 teleport_monster_to(current_floor_ptr->grid_array[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
1333 if (!get_aim_dir(&dir)) return FALSE;
1335 (void)fire_beam(GF_AWAY_ALL, dir, 100);
1339 return teleport_level_other(p_ptr);
1343 if (!get_aim_dir(&dir)) return FALSE;
1345 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
1346 damage = monspell_bluemage_damage((MS_PSY_SPEAR), plev, DAM_ROLL);
1347 (void)fire_beam(GF_PSY_SPEAR, dir, damage);
1351 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
1352 (void)unlite_area(10, 3);
1355 if (!target_set(TARGET_KILL)) return FALSE;
1357 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
1358 trap_creation(target_row, target_col);
1361 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
1364 msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
1365 (void)animate_dead(0, p_ptr->y, p_ptr->x);
1371 msg_print(_("援軍を召喚した。", "You summon minions."));
1372 for (k = 0;k < 1; k++)
1374 if (summon_kin_player(summon_lev, p_ptr->y, p_ptr->x, (pet ? PM_FORCE_PET : 0L)))
1376 if (!pet) msg_print(_("召喚された仲間は怒っている!", "Summoned fellows are angry!"));
1389 msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!"));
1390 for (k = 0 ;k < 1 ; k++)
1391 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_CYBER, p_mode))
1394 msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!"));
1405 msg_print(_("仲間を召喚した。", "You summon help."));
1406 for (k = 0;k < 1; k++)
1407 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, p_mode))
1410 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!"));
1421 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
1422 for (k = 0;k < plev / 15 + 2; k++)
1423 if(summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, (p_mode | u_mode)))
1426 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!"));
1437 msg_print(_("アリを召喚した。", "You summon ants."));
1438 for (k = 0; k < 1; k++)
1439 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode)))
1442 msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!"));
1453 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
1454 for (k = 0;k < 1; k++)
1455 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode)))
1458 msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!"));
1469 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
1470 for (k = 0;k < 1; k++)
1471 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode)))
1474 msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!"));
1485 msg_print(_("ヒドラを召喚した。", "You summon a hydras."));
1486 for (k = 0;k < 1; k++)
1487 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HYDRA, (g_mode | p_mode)))
1490 msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!"));
1501 msg_print(_("天使を召喚した!", "You summon an angel!"));
1502 for (k = 0;k < 1; k++)
1503 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANGEL, (g_mode | p_mode)))
1506 msg_print(_("召喚された天使は怒っている!", "Summoned angels are angry!"));
1517 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
1518 for (k = 0;k < 1; k++)
1519 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DEMON, (g_mode | p_mode)))
1522 msg_print(_("召喚されたデーモンは怒っている!", "Summoned demons are angry!"));
1533 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
1534 for (k = 0;k < 1; k++)
1535 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode)))
1538 msg_print(_("召喚されたアンデッドは怒っている!", "Summoned undeads are angry!"));
1549 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
1550 for (k = 0;k < 1; k++)
1551 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DRAGON, (g_mode | p_mode)))
1554 msg_print(_("召喚されたドラゴンは怒っている!", "Summoned dragons are angry!"));
1562 case MS_S_HI_UNDEAD:
1565 msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!"));
1566 for (k = 0;k < 1; k++)
1567 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode)))
1570 msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
1578 case MS_S_HI_DRAGON:
1581 msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!"));
1582 for (k = 0;k < 1; k++)
1583 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode)))
1586 msg_print(_("召喚された古代ドラゴンは怒っている!", "Summoned ancient dragons are angry!"));
1597 msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!"));
1598 for (k = 0;k < 1; k++)
1599 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode)))
1602 msg_print(_("召喚されたアンバーの王族は怒っている!", "Summoned Lords of Amber are angry!"));
1613 msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!"));
1614 for (k = 0;k < 1; k++)
1615 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1619 msg_print(_("召喚されたユニーク・モンスターは怒っている!", "Summoned special opponents are angry!"));
1621 for (k = count;k < 1; k++)
1622 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1626 msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
1639 msg_print(_("何も現れなかった。", "No one have appeared."));
1646 * @brief 青魔法コマンドのメインルーチン /
1647 * do_cmd_cast calls this function if the player's class is 'Blue-Mage'.
1648 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1650 bool do_cmd_cast_learned(void)
1654 PERCENTAGE minfail = 0;
1655 PLAYER_LEVEL plev = p_ptr->lev;
1656 monster_power spell;
1658 MANA_POINT need_mana;
1660 if (cmd_limit_confused(p_ptr)) return FALSE;
1662 if (!get_learned_power(&n)) return FALSE;
1664 spell = monster_powers[n];
1666 need_mana = mod_need_mana(spell.smana, 0, REALM_NONE);
1668 /* Verify "dangerous" spells */
1669 if (need_mana > p_ptr->csp)
1672 msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
1674 if (!over_exert) return FALSE;
1677 if (!get_check(_("それでも挑戦しますか? ", "Attempt it anyway? "))) return FALSE;
1680 /* Spell failure chance */
1681 chance = spell.fail;
1683 /* Reduce failure rate by "effective" level adjustment */
1684 if (plev > spell.level) chance -= 3 * (plev - spell.level);
1685 else chance += (spell.level - plev);
1687 /* Reduce failure rate by INT/WIS adjustment */
1688 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
1690 chance = mod_spell_chance_1(chance);
1692 /* Not enough mana to cast */
1693 if (need_mana > p_ptr->csp)
1695 chance += 5 * (need_mana - p_ptr->csp);
1698 /* Extract the minimum failure rate */
1699 minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
1701 /* Minimum failure rate */
1702 if (chance < minfail) chance = minfail;
1704 /* Stunning makes spells harder */
1705 if (p_ptr->stun > 50) chance += 25;
1706 else if (p_ptr->stun) chance += 15;
1708 /* Always a 5 percent chance of working */
1709 if (chance > 95) chance = 95;
1711 chance = mod_spell_chance_2(chance);
1714 if (randint0(100) < chance)
1716 if (flush_failure) flush();
1717 msg_print(_("魔法をうまく唱えられなかった。", "You failed to concentrate hard enough!"));
1722 cast = cast_learned_spell(n, FALSE);
1727 cast = cast_learned_spell(n, TRUE);
1728 if (!cast) return FALSE;
1731 /* Sufficient mana */
1732 if (need_mana <= p_ptr->csp)
1735 p_ptr->csp -= need_mana;
1739 int oops = need_mana;
1743 p_ptr->csp_frac = 0;
1745 msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
1747 /* Hack -- Bypass free action */
1748 (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
1750 chg_virtue(V_KNOWLEDGE, -10);
1752 /* Damage CON (possibly permanently) */
1753 if (randint0(100) < 50)
1755 bool perm = (randint0(100) < 25);
1757 msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
1759 /* Reduce constitution */
1760 (void)dec_stat(A_CON, 15 + randint1(10), perm);
1764 take_turn(p_ptr, 100);
1766 p_ptr->redraw |= (PR_MANA);
1767 p_ptr->window |= (PW_PLAYER | PW_SPELL);
1773 * @brief 青魔法のラーニング判定と成功した場合のラーニング処理
1774 * @param monspell ラーニングを試みるモンスター攻撃のID
1777 void learn_spell(int monspell)
1779 if (p_ptr->action != ACTION_LEARN) return;
1780 if (monspell < 0) return;
1781 if (p_ptr->magic_num2[monspell]) return;
1782 if (p_ptr->confused || p_ptr->blind || p_ptr->image || p_ptr->stun || p_ptr->paralyzed) return;
1783 if (randint1(p_ptr->lev + 70) > monster_powers[monspell].level + 40)
1785 p_ptr->magic_num2[monspell] = 1;
1786 msg_format(_("%sを学習した!", "You have learned %s!"), monster_powers[monspell].name);
1787 gain_exp(monster_powers[monspell].level * monster_powers[monspell].smana);
1792 p_ptr->redraw |= (PR_STATE);
1798 * @brief モンスター特殊能力のフラグ配列から特定条件の魔法だけを抜き出す処理
1799 * Extract monster spells mask for the given mode
1800 * @param f4 モンスター特殊能力の4番目のフラグ配列
1801 * @param f5 モンスター特殊能力の5番目のフラグ配列
1802 * @param f6 モンスター特殊能力の6番目のフラグ配列
1803 * @param mode 抜き出したい条件
1808 void set_rf_masks(BIT_FLAGS *f4, BIT_FLAGS *f5, BIT_FLAGS *f6, BIT_FLAGS mode)
1812 case MONSPELL_TYPE_BOLT:
1813 *f4 = ((RF4_BOLT_MASK | RF4_BEAM_MASK) & ~(RF4_ROCKET));
1814 *f5 = RF5_BOLT_MASK | RF5_BEAM_MASK;
1815 *f6 = RF6_BOLT_MASK | RF6_BEAM_MASK;
1818 case MONSPELL_TYPE_BALL:
1819 *f4 = (RF4_BALL_MASK & ~(RF4_BREATH_MASK));
1820 *f5 = (RF5_BALL_MASK & ~(RF5_BREATH_MASK));
1821 *f6 = (RF6_BALL_MASK & ~(RF6_BREATH_MASK));
1824 case MONSPELL_TYPE_BREATH:
1825 *f4 = RF4_BREATH_MASK;
1826 *f5 = RF5_BREATH_MASK;
1827 *f6 = RF6_BREATH_MASK;
1830 case MONSPELL_TYPE_SUMMON:
1831 *f4 = RF4_SUMMON_MASK;
1832 *f5 = RF5_SUMMON_MASK;
1833 *f6 = RF6_SUMMON_MASK;
1836 case MONSPELL_TYPE_OTHER:
1837 *f4 = RF4_ATTACK_MASK & ~(RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_INDIRECT_MASK);
1838 *f5 = RF5_ATTACK_MASK & ~(RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_INDIRECT_MASK);
1839 *f6 = RF6_ATTACK_MASK & ~(RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | RF6_INDIRECT_MASK);