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
16 #include "spells-summon.h"
18 #include "spells-status.h"
19 #include "cmd-spell.h"
20 #include "player-status.h"
21 #include "monster-spell.h"
22 #include "monster-status.h"
24 #include "cmd-basic.h"
25 #include "player-effects.h"
27 #define pseudo_plev() (((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 130) /*!< モンスター魔法をプレイヤーが使用する場合の換算レベル */
33 * level, smana, %fail, manedam, %manefail, use_stat, name
35 const monster_power monster_powers[MAX_MONSPELLS] =
38 { 1, 1, 10, 0, 15, A_CON, "叫ぶ"},
39 { 10, 4, 35, 89, 40, A_INT, "何か"},
40 { 40, 35, 85, 0, 40, A_INT, "魔力消去"},
41 { 35, 30, 80, 800, 70, A_STR, "ロケット"},
42 { 5, 1, 20, 18, 15, A_DEX, "射撃"},
43 { 10, 4, 35, 89, 40, A_INT, "何か"},
44 { 10, 4, 35, 89, 40, A_INT, "何か"},
45 { 10, 4, 35, 89, 40, A_INT, "何か"},
46 { 20, 15, 55, 1600, 95, A_CON, "酸のブレス"},
47 { 20, 15, 55, 1600, 95, A_CON, "電撃のブレス"},
48 { 20, 15, 55, 1600, 95, A_CON, "炎のブレス"},
49 { 20, 15, 55, 1600, 95, A_CON, "冷気のブレス"},
50 { 20, 15, 55, 800, 95, A_CON, "毒のブレス"},
51 { 20, 15, 70, 550, 95, A_CON, "地獄のブレス"},
52 { 20, 16, 70, 400, 95, A_CON, "閃光のブレス"},
53 { 20, 16, 70, 400, 95, A_CON, "暗黒のブレス"},
54 { 20, 20, 70, 450, 95, A_CON, "混乱のブレス"},
55 { 20, 20, 70, 450, 95, A_CON, "轟音のブレス"},
56 { 20, 20, 70, 600, 95, A_CON, "カオスのブレス"},
57 { 20, 16, 70, 500, 95, A_CON, "劣化のブレス"},
58 { 30, 25, 80, 250, 95, A_CON, "因果混乱のブレス"},
59 { 35, 18, 80, 150, 95, A_CON, "時間逆転のブレス"},
60 { 30, 25, 80, 200, 95, A_CON, "遅鈍のブレス"},
61 { 30, 28, 90, 200, 95, A_CON, "重力のブレス"},
62 { 20, 15, 70, 500, 95, A_CON, "破片のブレス"},
63 { 35, 15, 80, 150, 95, A_CON, "プラズマのブレス"},
64 { 30, 18, 70, 200, 95, A_CON, "フォースのブレス"},
65 { 30, 28, 80, 250, 95, A_CON, "魔力のブレス"},
66 { 25, 20, 95, 320, 80, A_INT, "放射能球"},
67 { 25, 15, 70, 800, 95, A_CON, "放射性廃棄物のブレス"},
68 { 30, 32, 85, 400, 80, A_INT, "純ログルス"},
69 { 35, 40, 95, 150, 95, A_CON, "分解のブレス"},
70 { 18, 13, 55, 630, 80, A_INT, "アシッド・ボール"},
71 { 14, 10, 45, 316, 60, A_INT, "サンダー・ボール"},
72 { 20, 14, 60, 720, 80, A_INT, "ファイア・ボール"},
73 { 15, 11, 50, 320, 60, A_INT, "アイス・ボール"},
74 { 5, 3, 40, 48, 20, A_INT, "悪臭雲"},
75 { 25, 18, 70, 350, 80, A_INT, "地獄球"},
76 { 30, 22, 75, 350, 80, A_INT, "ウォーター・ボール"},
77 { 44, 45, 85, 550, 95, A_INT, "魔力の嵐"},
78 { 40, 42, 90, 550, 95, A_INT, "暗黒の嵐"},
79 { 10, 5, 50, 0, 25, A_INT, "魔力吸収"},
80 { 25, 10, 60, 0, 30, A_INT, "精神攻撃"},
81 { 30, 14, 65, 0, 30, A_INT, "脳攻撃"},
82 { 3, 1, 25, 24, 20, A_INT, "軽傷"},
83 { 12, 2, 35, 64, 25, A_INT, "重傷"},
84 { 22, 6, 50, 150, 30, A_INT, "致命傷"},
85 { 32, 10, 70, 225, 35, A_INT, "秘孔を突く"},
86 { 13, 7, 40, 178, 40, A_INT, "アシッド・ボルト"},
87 { 10, 5, 35, 130, 35, A_INT, "サンダー・ボルト"},
88 { 15, 9, 50, 210, 45, A_INT, "ファイア・ボルト"},
89 { 12, 6, 35, 162, 40, A_INT, "アイス・ボルト"},
90 { 40, 42, 90, 550, 95, A_INT, "スター・バースト"},
91 { 25, 17, 60, 255, 60, A_INT, "地獄の矢"},
92 { 25, 20, 65, 250, 60, A_INT, "ウォーター・ボルト"},
93 { 25, 24, 90, 400, 80, A_INT, "魔力の矢"},
94 { 25, 20, 80, 216, 60, A_INT, "プラズマ・ボルト"},
95 { 25, 16, 60, 186, 60, A_INT, "極寒の矢"},
96 { 3, 1, 25, 12, 20, A_INT, "マジック・ミサイル"},
97 { 5, 3, 35, 0, 20, A_INT, "恐慌"},
98 { 10, 5, 40, 0, 20, A_INT, "盲目"},
99 { 10, 5, 40, 0, 20, A_INT, "パニック・モンスター"},
100 { 10, 5, 40, 0, 20, A_INT, "スロウ・モンスター"},
101 { 10, 5, 40, 0, 20, A_INT, "スリープ・モンスター"},
102 { 20, 10, 70, 0, 40, A_INT, "スピード"},
103 { 45, 120, 95, 0, 60, A_INT, "破滅の手"},
104 { 20, 15, 70, 0, 20, A_WIS, "体力回復"},
105 { 45, 65, 80, 0, 60, A_INT, "無傷の球"},
106 { 5, 1, 30, 0, 20, A_INT, "ショート・テレポート"},
107 { 15, 8, 40, 0, 30, A_INT, "テレポート"},
108 { 40, 999, 99, 0, 80, A_INT, "ザ・ワールド"},
109 { 1, 0, 0, 0, 15, A_INT, "何か"},
110 { 15, 8, 50, 0, 30, A_INT, "引きよせる"},
111 { 20, 13, 80, 0, 30, A_INT, "テレポート・アウェイ"},
112 { 30, 40, 95, 0, 40, A_INT, "テレポート・レベル"},
113 { 35, 30, 80, 350, 70, A_INT, "光の剣"},
114 { 5, 1, 20, 0, 15, A_INT, "暗闇"},
115 { 5, 1, 20, 0, 15, A_DEX, "トラップ創造"},
116 { 15, 3, 40, 0, 30, A_INT, "記憶喪失"},
117 { 30, 30, 70, 0, 40, A_INT, "死者復活"},
118 { 40, 70, 85, 0, 45, A_INT, "援軍を呼ぶ"},
119 { 45, 90, 90, 0, 50, A_INT, "サイバーデーモンの召喚"},
120 { 25, 20, 65, 0, 30, A_INT, "モンスターの召喚"},
121 { 35, 30, 75, 0, 40, A_INT, "複数のモンスターの召喚"},
122 { 25, 25, 65, 0, 25, A_INT, "アリの召喚"},
123 { 25, 20, 60, 0, 25, A_INT, "蜘蛛の召喚"},
124 { 35, 26, 75, 0, 40, A_INT, "ハウンドの召喚"},
125 { 30, 23, 70, 0, 35, A_INT, "ヒドラの召喚"},
126 { 40, 50, 85, 0, 40, A_INT, "天使の召喚"},
127 { 35, 50, 80, 0, 35, A_INT, "デーモンの召喚"},
128 { 30, 30, 75, 0, 35, A_INT, "アンデッドの召喚"},
129 { 39, 70, 80, 0, 40, A_INT, "ドラゴンの召喚"},
130 { 43, 85, 85, 0, 45, A_INT, "上級アンデッドの召喚"},
131 { 46, 90, 85, 0, 45, A_INT, "古代ドラゴンの召喚"},
132 { 48, 120, 90, 0, 50, A_INT, "アンバーの王族の召喚"},
133 { 50, 150, 95, 0, 50, A_INT, "ユニークモンスターの召喚"},
135 { 1, 1, 10, 0, 15, A_CON, "shriek"},
136 { 10, 4, 35, 89, 40, A_INT, "something"},
137 { 40, 35, 85, 0, 40, A_INT, "dispel-magic"},
138 { 35, 30, 80, 800, 70, A_STR, "rocket"},
139 { 2, 1, 15, 10, 15, A_DEX, "arrow"},
140 { 5, 2, 20, 18, 20, A_DEX, "arrows"},
141 { 12, 3, 25, 30, 25, A_DEX, "missile"},
142 { 16, 4, 30, 42, 30, A_DEX, "missiles"},
143 { 20, 15, 55, 1600, 95, A_CON, "breath acid"},
144 { 20, 15, 55, 1600, 95, A_CON, "breath lightning"},
145 { 20, 15, 55, 1600, 95, A_CON, "breath fire"},
146 { 20, 15, 55, 1600, 95, A_CON, "breath cold"},
147 { 20, 15, 55, 800, 95, A_CON, "breath poison"},
148 { 20, 15, 70, 550, 95, A_CON, "breath nether"},
149 { 20, 16, 70, 400, 95, A_CON, "breath light"},
150 { 20, 16, 70, 400, 95, A_CON, "breath dark"},
151 { 20, 20, 70, 450, 95, A_CON, "breath confusion"},
152 { 20, 20, 70, 450, 95, A_CON, "breath sound"},
153 { 20, 20, 70, 600, 95, A_CON, "breath chaos"},
154 { 20, 16, 70, 500, 95, A_CON, "breath disenchantment"},
155 { 30, 25, 80, 250, 95, A_CON, "breath nexus"},
156 { 35, 18, 80, 150, 95, A_CON, "breath time"},
157 { 30, 25, 80, 200, 95, A_CON, "breath inertia"},
158 { 30, 28, 90, 200, 95, A_CON, "breath gravity"},
159 { 20, 15, 70, 500, 95, A_CON, "breath shards"},
160 { 35, 15, 80, 150, 95, A_CON, "breath plasma"},
161 { 30, 18, 70, 200, 95, A_CON, "breath force"},
162 { 30, 28, 80, 250, 95, A_CON, "breath mana"},
163 { 25, 20, 95, 320, 80, A_INT, "nuke ball"},
164 { 25, 15, 70, 800, 95, A_CON, "breath nuke"},
165 { 30, 32, 85, 400, 80, A_INT, "raw Logrus"},
166 { 35, 40, 95, 150, 95, A_CON, "breath disintegrate"},
167 { 18, 13, 55, 630, 80, A_INT, "acid ball"},
168 { 14, 10, 45, 316, 60, A_INT, "lightning ball"},
169 { 20, 14, 60, 720, 80, A_INT, "fire ball"},
170 { 15, 11, 50, 320, 60, A_INT, "frost ball"},
171 { 5, 3, 40, 48, 20, A_INT, "stinking cloud"},
172 { 25, 18, 70, 350, 80, A_INT, "nether ball"},
173 { 30, 22, 75, 350, 80, A_INT, "water ball"},
174 { 44, 45, 85, 550, 95, A_INT, "mana storm"},
175 { 40, 42, 90, 550, 95, A_INT, "darkness storm"},
176 { 10, 5, 50, 0, 25, A_INT, "drain mana"},
177 { 25, 10, 60, 0, 30, A_INT, "mind blast"},
178 { 30, 14, 65, 0, 30, A_INT, "brain smash"},
179 { 3, 1, 25, 24, 20, A_INT, "cause light wounds"},
180 { 12, 2, 35, 64, 25, A_INT, "cause serious wounds"},
181 { 22, 6, 50, 150, 30, A_INT, "cause critical wounds"},
182 { 32, 10, 70, 225, 35, A_INT, "cause mortal wounds"},
183 { 13, 7, 40, 178, 40, A_INT, "acid bolt"},
184 { 10, 5, 35, 130, 35, A_INT, "lightning bolt"},
185 { 15, 9, 50, 210, 45, A_INT, "fire bolt"},
186 { 12, 6, 35, 162, 40, A_INT, "frost bolt"},
187 { 40, 42, 90, 550, 95, A_INT, "starburst"},
188 { 25, 17, 60, 255, 60, A_INT, "nether bolt"},
189 { 25, 20, 65, 250, 60, A_INT, "water bolt"},
190 { 25, 24, 90, 400, 80, A_INT, "mana bolt"},
191 { 25, 20, 80, 216, 60, A_INT, "plasma bolt"},
192 { 25, 16, 60, 186, 60, A_INT, "ice bolt"},
193 { 3, 1, 25, 12, 20, A_INT, "magic missile"},
194 { 5, 3, 35, 0, 20, A_INT, "scare"},
195 { 10, 5, 40, 0, 20, A_INT, "blind"},
196 { 10, 5, 40, 0, 20, A_INT, "confuse"},
197 { 10, 5, 40, 0, 20, A_INT, "slow"},
198 { 10, 5, 40, 0, 20, A_INT, "sleep"},
199 { 20, 10, 70, 0, 40, A_INT, "speed"},
200 { 45, 120, 95, 0, 60, A_INT, "the Hand of Doom"},
201 { 20, 15, 70, 0, 20, A_WIS, "heal-self"},
202 { 45, 65, 80, 0, 60, A_INT, "make invulnerable"},
203 { 5, 1, 30, 0, 20, A_INT, "blink-self"},
204 { 15, 8, 40, 0, 30, A_INT, "teleport-self"},
205 { 40, 999, 99, 0, 80, A_INT, "The world"},
206 { 1, 0, 0, 0, 15, A_INT, "something"},
207 { 15, 8, 50, 0, 30, A_INT, "teleport to"},
208 { 20, 13, 80, 0, 30, A_INT, "teleport away"},
209 { 30, 40, 95, 0, 40, A_INT, "teleport level"},
210 { 35, 30, 80, 350, 70, A_INT, "psycho-spear"},
211 { 5, 1, 20, 0, 15, A_INT, "create darkness"},
212 { 5, 1, 20, 0, 15, A_DEX, "create traps"},
213 { 15, 3, 40, 0, 30, A_INT, "cause amnesia"},
214 { 30, 30, 70, 0, 40, A_INT, "raise dead"},
215 { 40, 70, 85, 0, 45, A_INT, "summon aid"},
216 { 45, 90, 90, 0, 50, A_INT, "summon Cyberdemons"},
217 { 25, 20, 65, 0, 30, A_INT, "summon a monster"},
218 { 35, 30, 75, 0, 40, A_INT, "summon monsters"},
219 { 25, 25, 65, 0, 25, A_INT, "summon ants"},
220 { 25, 20, 60, 0, 25, A_INT, "summon spiders"},
221 { 35, 26, 75, 0, 40, A_INT, "summon hounds"},
222 { 30, 23, 70, 0, 35, A_INT, "summon hydras"},
223 { 40, 50, 85, 0, 40, A_INT, "summon an angel"},
224 { 35, 50, 80, 0, 35, A_INT, "summon a daemon"},
225 { 30, 30, 75, 0, 35, A_INT, "summon an undead"},
226 { 39, 70, 80, 0, 40, A_INT, "summon a dragon"},
227 { 43, 85, 85, 0, 45, A_INT, "summon Greater Undead"},
228 { 46, 90, 85, 0, 45, A_INT, "summon Ancient Dragon"},
229 { 48, 120, 90, 0, 50, A_INT, "summon Lords of Amber"},
230 { 50, 150, 95, 0, 50, A_INT, "summon Unique Monsters"},
236 * @brief モンスター魔法名テーブル
238 const concptr monster_powers_short[MAX_MONSPELLS] = {
241 "叫ぶ", "何か", "魔力消去", "ロケット", "射撃", "何か", "何か", "何か",
242 "酸", "電撃", "火炎", "冷気", "毒", "地獄", "閃光", "暗黒",
243 "混乱", "轟音", "カオス", "劣化", "因果混乱", "時間逆転", "遅鈍", "重力",
244 "破片", "プラズマ", "フォース", "魔力", "放射能球", "放射性廃棄物", "純ログルス", "分解",
246 "酸", "電撃", "火炎", "冷気", "悪臭雲", "地獄球", "ウォーター", "魔力の嵐",
247 "暗黒の嵐", "魔力吸収", "精神攻撃", "脳攻撃", "軽傷", "重傷", "致命傷", "秘孔を突く",
248 "酸", "電撃", "火炎", "冷気", "スターバースト", "地獄の矢", "ウォーター", "魔力の矢",
249 "プラズマ", "極寒", "マジックミサイル", "恐慌", "盲目", "混乱", "減速", "睡眠",
251 "加速", "破滅の手", "体力回復", "無傷の球", "ショートテレポート", "テレポート", "時を止める", "何か",
252 "引きよせる", "テレポートアウェイ", "テレポートレベル", "光の剣", "暗闇", "トラップ創造", "記憶喪失", "死者復活",
253 "援軍", "サイバーデーモン", "モンスター", "複数のモンスター", "蟻", "蜘蛛", "ハウンド", "ヒドラ",
254 "天使", "悪魔", "アンデッド", "ドラゴン", "上級アンデッド", "古代ドラゴン", "アンバーの王族", "ユニーク"
258 "Shriek", "Something", "Dispel-magic", "Rocket", "Arrow", "Arrows", "Missile", "Missiles",
259 "Acid", "Lightning", "Fire", "Cold", "Poison", "Nether", "Light", "Dark",
260 "Confusion", "Sound", "Chaos", "Disenchantment", "Nexus", "Time", "Inertia", "Gravity",
261 "Shards", "Plasma", "Force", "Mana", "Nuke", "Nuke", "Logrus", "Disintergrate",
263 "Acid", "Lightning", "Fire", "Frost", "Stinking Cloud", "Nether", "Water", "Mana storm",
264 "Darkness storm", "Drain mana", "Mind blast", "Brain smash", "Cause Light Wound", "Cause Serious Wound", "Cause Critical Wound", "Cause Mortal Wound",
265 "Acid", "Lightning", "Fire", "Frost", "Starburst", "Nether", "Water", "Mana",
266 "Plasm", "Ice", "Magic missile", "Scare", "Blind", "Confuse", "Slow", "Sleep",
268 "Speed", "Hand of doom", "Heal-self", "Invulnerable", "Blink", "Teleport", "The world", "Something",
269 "Teleport to", "Teleport away", "Teleport level", "Psycho-spear", "Create darkness", "Create traps", "Amnesia", "Raise dead",
270 "Aid", "Cyberdeamons", "A monster", "Monsters", "Ants", "Spiders", "Hounds", "Hydras",
271 "Angel", "Daemon", "Undead", "Dragon", "Greater Undead", "Ancient Dragon", "Lords of Amber", "Unique monsters"
279 * @brief 文字列に青魔導師の呪文の攻撃力を加える
280 * @param SPELL_NUM 呪文番号
281 * @param plev プレイヤーレベル
283 * @param tmp 返すメッセージを格納する配列
286 void set_bluemage_damage(int SPELL_NUM, PLAYER_LEVEL plev, concptr msg, char* tmp)
288 int base_damage = monspell_bluemage_damage(SPELL_NUM, plev, BASE_DAM);
289 int dice_num = monspell_bluemage_damage(SPELL_NUM, plev, DICE_NUM);
290 int dice_side = monspell_bluemage_damage(SPELL_NUM, plev, DICE_SIDE);
291 int dice_mult = monspell_bluemage_damage(SPELL_NUM, plev, DICE_MULT);
292 int dice_div = monspell_bluemage_damage(SPELL_NUM, plev, DICE_DIV);
294 dice_to_string(base_damage, dice_num, dice_side, dice_mult, dice_div, dmg_str);
295 sprintf(tmp, " %s %s", msg, dmg_str);
299 * @brief 受け取ったモンスター魔法のIDに応じて青魔法の効果情報をまとめたフォーマットを返す
300 * @param p 情報を返す文字列参照ポインタ
301 * @param power モンスター魔法のID
304 static void learned_info(char *p, int power)
306 PLAYER_LEVEL plev = pseudo_plev();
351 set_bluemage_damage((power), plev, KWD_DAM, p); break;
387 set_bluemage_damage((power), plev, KWD_DAM, p); break;
389 set_bluemage_damage((power), plev, KWD_HEAL, p); break;
405 case MS_MAGIC_MISSILE:
406 set_bluemage_damage((power), plev, KWD_DAM, p); break;
408 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
411 set_bluemage_damage((power), plev, KWD_HEAL, p); break;
413 sprintf(p, " %sd7+7", KWD_DURATION);
416 sprintf(p, " %s10", KWD_SPHERE);
419 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
422 set_bluemage_damage((power), plev, KWD_DAM, p); break;
425 sprintf(p, " %s5", KWD_SPHERE);
434 * @brief 使用可能な青魔法を選択する /
435 * Allow user to choose a imitation.
436 * @param sn 選択したモンスター攻撃ID、キャンセルの場合-1、不正な選択の場合-2を返す
437 * @return 発動可能な魔法を選択した場合TRUE、キャンセル処理か不正な選択が行われた場合FALSEを返す。
439 * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
440 * If the user hits escape, returns FALSE, and set '*sn' to -1\n
441 * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n
443 * The "prompt" should be "cast", "recite", or "study"\n
444 * The "known" should be TRUE for cast/pray, FALSE for study\n
446 * nb: This function has a (trivial) display bug which will be obvious\n
447 * when you run it. It's probably easy to fix but I haven't tried,\n
450 static bool get_learned_power(SPELL_IDX *sn)
456 PERCENTAGE minfail = 0;
457 PLAYER_LEVEL plev = p_ptr->lev;
458 PERCENTAGE chance = 0;
459 int ask = TRUE, mode = 0;
460 int spellnum[MAX_MONSPELLS];
465 BIT_FLAGS f4 = 0L, f5 = 0L, f6 = 0L;
466 concptr p = _("魔法", "magic");
470 int menu_line = (use_menu ? 1 : 0);
472 /* Assume cancelled */
475 /* Nothing chosen yet */
481 /* Get the spell, if available */
483 if (repeat_pull(&code))
485 *sn = (SPELL_IDX)code;
495 prt(format(_(" %s ボルト", " %s bolt"), (menu_line == 1) ? _("》", "> ") : " "), 2, 14);
496 prt(format(_(" %s ボール", " %s ball"), (menu_line == 2) ? _("》", "> ") : " "), 3, 14);
497 prt(format(_(" %s ブレス", " %s breath"), (menu_line == 3) ? _("》", "> ") : " "), 4, 14);
498 prt(format(_(" %s 召喚", " %s sommoning"), (menu_line == 4) ? _("》", "> ") : " "), 5, 14);
499 prt(format(_(" %s その他", " %s others"), (menu_line == 5) ? _("》", "> ") : " "), 6, 14);
500 prt(_("どの種類の魔法を使いますか?", "use which type of magic? "), 0, 0);
526 if (menu_line > 5) menu_line -= 5;
532 sprintf(comment, _("[A]ボルト, [B]ボール, [C]ブレス, [D]召喚, [E]その他:", "[A] bolt, [B] ball, [C] breath, [D] summoning, [E] others:"));
535 if (!get_com(comment, &ch, TRUE))
539 if (ch == 'A' || ch == 'a')
544 if (ch == 'B' || ch == 'b')
549 if (ch == 'C' || ch == 'c')
554 if (ch == 'D' || ch == 'd')
559 if (ch == 'E' || ch == 'e')
567 set_rf_masks(&f4, &f5, &f6, mode);
569 for (i = 0, num = 0; i < 32; i++)
571 if ((0x00000001 << i) & f4) spellnum[num++] = i;
575 if ((0x00000001 << (i - 32)) & f5) spellnum[num++] = i;
579 if ((0x00000001 << (i - 64)) & f6) spellnum[num++] = i;
581 for (i = 0; i < num; i++)
583 if (p_ptr->magic_num2[spellnum[i]])
585 if (use_menu) menu_line = i+1;
591 msg_print(_("その種類の魔法は覚えていない!", "You don't know any spell of this type."));
595 /* Build a prompt (accept all spells) */
596 (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sを唱えますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
597 I2A(0), I2A(num - 1), p);
599 if (use_menu) screen_save();
601 choice= (always_show_list || use_menu) ? ESCAPE:1 ;
604 if(choice==ESCAPE) choice = ' ';
605 else if( !get_com(out_val, &choice, TRUE) )break;
607 if (use_menu && choice != ' ')
623 menu_line += (num-1);
624 if (menu_line > num) menu_line -= num;
625 } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
636 if (menu_line > num) menu_line -= num;
637 } while(!p_ptr->magic_num2[spellnum[menu_line-1]]);
646 while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line--;
655 while(!p_ptr->magic_num2[spellnum[menu_line-1]]) menu_line++;
670 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
673 if (!redraw || use_menu)
677 if (!use_menu) screen_save();
679 /* Display a list of spells */
681 put_str(_("名前", "Name"), y, x + 5);
682 put_str(_("MP 失率 効果", "SP Fail Info"), y, x + 33);
685 /* Dump the spells */
686 for (i = 0; i < num; i++)
690 prt("", y + i + 1, x);
691 if (!p_ptr->magic_num2[spellnum[i]]) continue;
693 /* Access the spell */
694 spell = monster_powers[spellnum[i]];
698 /* Reduce failure rate by "effective" level adjustment */
699 if (plev > spell.level) chance -= 3 * (plev - spell.level);
700 else chance += (spell.level - plev);
702 /* Reduce failure rate by INT/WIS adjustment */
703 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
705 chance = mod_spell_chance_1(chance);
707 need_mana = mod_need_mana(monster_powers[spellnum[i]].smana, 0, REALM_NONE);
709 /* Not enough mana to cast */
710 if (need_mana > p_ptr->csp)
712 chance += 5 * (need_mana - p_ptr->csp);
715 /* Extract the minimum failure rate */
716 minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
718 /* Minimum failure rate */
719 if (chance < minfail) chance = minfail;
721 /* Stunning makes spells harder */
722 if (p_ptr->stun > 50) chance += 25;
723 else if (p_ptr->stun) chance += 15;
725 /* Always a 5 percent chance of working */
726 if (chance > 95) chance = 95;
728 chance = mod_spell_chance_2(chance);
731 learned_info(comment, spellnum[i]);
735 if (i == (menu_line-1)) strcpy(psi_desc, _(" 》", " > "));
736 else strcpy(psi_desc, " ");
738 else sprintf(psi_desc, " %c)", I2A(i));
740 /* Dump the spell --(-- */
741 strcat(psi_desc, format(" %-26s %3d %3d%%%s",
742 spell.name, need_mana,
744 prt(psi_desc, y + i + 1, x);
747 /* Clear the bottom line */
748 if (y < 22) prt("", y + i + 1, x);
766 ask = isupper(choice);
769 if (ask) choice = (char)tolower(choice);
771 /* Extract request */
772 i = (islower(choice) ? A2I(choice) : -1);
775 /* Totally Illegal */
776 if ((i < 0) || (i >= num) || !p_ptr->magic_num2[spellnum[i]])
782 /* Save the spell index */
783 spell = monster_powers[spellnum[i]];
791 (void) strnfmt(tmp_val, 78, _("%sの魔法を唱えますか?", "Use %s? "), monster_powers[spellnum[i]].name);
793 /* Belay that order */
794 if (!get_check(tmp_val)) continue;
800 if (redraw) screen_load();
802 p_ptr->window |= (PW_SPELL);
805 /* Abort if needed */
806 if (!flag) return (FALSE);
808 /* Save the choice */
811 repeat_push((COMMAND_CODE)spellnum[i]);
820 * do_cmd_cast calls this function if the player's class is 'blue-mage'.
821 * @param spell 発動するモンスター攻撃のID
822 * @param success TRUEは成功時、FALSEは失敗時の処理を行う
823 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
825 static bool cast_learned_spell(int spell, bool success)
828 PLAYER_LEVEL plev = pseudo_plev();
829 PLAYER_LEVEL summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2);
830 HIT_POINT damage = 0;
832 bool no_trump = FALSE;
833 BIT_FLAGS p_mode, u_mode = 0L, g_mode;
837 p_mode = PM_FORCE_PET;
843 g_mode = PM_ALLOW_GROUP;
846 if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE;
852 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
853 aggravate_monsters(0);
861 if (!target_set(TARGET_KILL)) return FALSE;
862 m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
864 if (!player_has_los_bold(target_row, target_col)) break;
865 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
866 dispel_monster_status(m_idx);
870 if (!get_aim_dir(&dir)) return FALSE;
872 msg_print(_("ロケットを発射した。", "You fire a rocket."));
873 damage = monspell_bluemage_damage((MS_ROCKET), plev, DAM_ROLL);
874 fire_rocket(GF_ROCKET, dir, damage, 2);
878 if (!get_aim_dir(&dir)) return FALSE;
880 msg_print(_("矢を放った。", "You fire an arrow."));
881 damage = monspell_bluemage_damage((MS_SHOOT), plev, DAM_ROLL);
882 fire_bolt(GF_ARROW, dir, damage);
892 if (!get_aim_dir(&dir)) return FALSE;
894 msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
895 damage = monspell_bluemage_damage((MS_BR_ACID), plev, DAM_ROLL);
896 fire_breath(GF_ACID, dir, damage, (plev > 40 ? 3 : 2));
899 if (!get_aim_dir(&dir)) return FALSE;
901 msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
902 damage = monspell_bluemage_damage((MS_BR_ELEC), plev, DAM_ROLL);
903 fire_breath(GF_ELEC, dir, damage, (plev > 40 ? 3 : 2));
906 if (!get_aim_dir(&dir)) return FALSE;
908 msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
909 damage = monspell_bluemage_damage((MS_BR_FIRE), plev, DAM_ROLL);
910 fire_breath(GF_FIRE, dir, damage, (plev > 40 ? 3 : 2));
913 if (!get_aim_dir(&dir)) return FALSE;
915 msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
916 damage = monspell_bluemage_damage((MS_BR_COLD), plev, DAM_ROLL);
917 fire_breath(GF_COLD, dir, damage, (plev > 40 ? 3 : 2));
920 if (!get_aim_dir(&dir)) return FALSE;
922 msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
923 damage = monspell_bluemage_damage((MS_BR_POIS), plev, DAM_ROLL);
924 fire_breath(GF_POIS, dir, damage, (plev > 40 ? 3 : 2));
927 if (!get_aim_dir(&dir)) return FALSE;
929 msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
930 damage = monspell_bluemage_damage((MS_BR_NETHER), plev, DAM_ROLL);
931 fire_breath(GF_NETHER, dir, damage, (plev > 40 ? 3 : 2));
934 if (!get_aim_dir(&dir)) return FALSE;
936 msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
937 damage = monspell_bluemage_damage((MS_BR_LITE), plev, DAM_ROLL);
938 fire_breath(GF_LITE, dir, damage, (plev > 40 ? 3 : 2));
941 if (!get_aim_dir(&dir)) return FALSE;
943 msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
944 damage = monspell_bluemage_damage((MS_BR_DARK), plev, DAM_ROLL);
945 fire_breath(GF_DARK, dir, damage, (plev > 40 ? 3 : 2));
948 if (!get_aim_dir(&dir)) return FALSE;
950 msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
951 damage = monspell_bluemage_damage((MS_BR_CONF), plev, DAM_ROLL);
952 fire_breath(GF_CONFUSION, dir, damage, (plev > 40 ? 3 : 2));
955 if (!get_aim_dir(&dir)) return FALSE;
957 msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
958 damage = monspell_bluemage_damage((MS_BR_SOUND), plev, DAM_ROLL);
959 fire_breath(GF_SOUND, dir, damage, (plev > 40 ? 3 : 2));
962 if (!get_aim_dir(&dir)) return FALSE;
964 msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
965 damage = monspell_bluemage_damage((MS_BR_CHAOS), plev, DAM_ROLL);
966 fire_breath(GF_CHAOS, dir, damage, (plev > 40 ? 3 : 2));
969 if (!get_aim_dir(&dir)) return FALSE;
971 msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
972 damage = monspell_bluemage_damage((MS_BR_DISEN), plev, DAM_ROLL);
973 fire_breath(GF_DISENCHANT, dir, damage, (plev > 40 ? 3 : 2));
976 if (!get_aim_dir(&dir)) return FALSE;
978 msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
979 damage = monspell_bluemage_damage((MS_BR_NEXUS), plev, DAM_ROLL);
980 fire_breath(GF_NEXUS, dir, damage, (plev > 40 ? 3 : 2));
983 if (!get_aim_dir(&dir)) return FALSE;
985 msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
986 damage = monspell_bluemage_damage((MS_BR_TIME), plev, DAM_ROLL);
987 fire_breath(GF_TIME, dir, damage, (plev > 40 ? 3 : 2));
990 if (!get_aim_dir(&dir)) return FALSE;
992 msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
993 damage = monspell_bluemage_damage((MS_BR_INERTIA), plev, DAM_ROLL);
994 fire_breath(GF_INERTIAL, dir, damage, (plev > 40 ? 3 : 2));
997 if (!get_aim_dir(&dir)) return FALSE;
999 msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
1000 damage = monspell_bluemage_damage((MS_BR_GRAVITY), plev, DAM_ROLL);
1001 fire_breath(GF_GRAVITY, dir, damage, (plev > 40 ? 3 : 2));
1004 if (!get_aim_dir(&dir)) return FALSE;
1006 msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
1007 damage = monspell_bluemage_damage((MS_BR_SHARDS), plev, DAM_ROLL);
1008 fire_breath(GF_SHARDS, dir, damage, (plev > 40 ? 3 : 2));
1011 if (!get_aim_dir(&dir)) return FALSE;
1013 msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
1014 damage = monspell_bluemage_damage((MS_BR_PLASMA), plev, DAM_ROLL);
1015 fire_breath(GF_PLASMA, dir, damage, (plev > 40 ? 3 : 2));
1018 if (!get_aim_dir(&dir)) return FALSE;
1020 msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
1021 damage = monspell_bluemage_damage((MS_BR_FORCE), plev, DAM_ROLL);
1022 fire_breath(GF_FORCE, dir, damage, (plev > 40 ? 3 : 2));
1025 if (!get_aim_dir(&dir)) return FALSE;
1027 msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
1028 damage = monspell_bluemage_damage((MS_BR_MANA), plev, DAM_ROLL);
1029 fire_breath(GF_MANA, dir, damage, (plev > 40 ? 3 : 2));
1032 if (!get_aim_dir(&dir)) return FALSE;
1034 msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
1035 damage = monspell_bluemage_damage((MS_BALL_NUKE), plev, DAM_ROLL);
1036 fire_ball(GF_NUKE, dir, damage, 2);
1039 if (!get_aim_dir(&dir)) return FALSE;
1041 msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
1042 damage = monspell_bluemage_damage((MS_BR_NUKE), plev, DAM_ROLL);
1043 fire_breath(GF_NUKE, dir, damage, (plev > 40 ? 3 : 2));
1046 if (!get_aim_dir(&dir)) return FALSE;
1048 msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
1049 damage = monspell_bluemage_damage((MS_BALL_CHAOS), plev, DAM_ROLL);
1050 fire_ball(GF_CHAOS, dir, damage, 4);
1053 if (!get_aim_dir(&dir)) return FALSE;
1055 msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
1056 damage = monspell_bluemage_damage((MS_BR_DISI), plev, DAM_ROLL);
1057 fire_breath(GF_DISINTEGRATE, dir, damage, (plev > 40 ? 3 : 2));
1060 if (!get_aim_dir(&dir)) return FALSE;
1062 msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
1063 damage = monspell_bluemage_damage((MS_BALL_ACID), plev, DAM_ROLL);
1064 fire_ball(GF_ACID, dir, damage, 2);
1067 if (!get_aim_dir(&dir)) return FALSE;
1069 msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
1070 damage = monspell_bluemage_damage((MS_BALL_ELEC), plev, DAM_ROLL);
1071 fire_ball(GF_ELEC, dir, damage, 2);
1074 if (!get_aim_dir(&dir)) return FALSE;
1076 msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
1077 damage = monspell_bluemage_damage((MS_BALL_FIRE), plev, DAM_ROLL);
1078 fire_ball(GF_FIRE, dir, damage, 2);
1081 if (!get_aim_dir(&dir)) return FALSE;
1083 msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
1084 damage = monspell_bluemage_damage((MS_BALL_COLD), plev, DAM_ROLL);
1085 fire_ball(GF_COLD, dir, damage, 2);
1088 if (!get_aim_dir(&dir)) return FALSE;
1090 msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
1091 damage = monspell_bluemage_damage((MS_BALL_POIS), plev, DAM_ROLL);
1092 fire_ball(GF_POIS, dir, damage, 2);
1094 case MS_BALL_NETHER:
1095 if (!get_aim_dir(&dir)) return FALSE;
1097 msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
1098 damage = monspell_bluemage_damage((MS_BALL_NETHER), plev, DAM_ROLL);
1099 fire_ball(GF_NETHER, dir, damage, 2);
1102 if (!get_aim_dir(&dir)) return FALSE;
1104 msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
1105 damage = monspell_bluemage_damage((MS_BALL_WATER), plev, DAM_ROLL);
1106 fire_ball(GF_WATER, dir, damage, 4);
1109 if (!get_aim_dir(&dir)) return FALSE;
1111 msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
1112 damage = monspell_bluemage_damage((MS_BALL_MANA), plev, DAM_ROLL);
1113 fire_ball(GF_MANA, dir, damage, 4);
1116 if (!get_aim_dir(&dir)) return FALSE;
1118 msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
1119 damage = monspell_bluemage_damage((MS_BALL_DARK), plev, DAM_ROLL);
1120 fire_ball(GF_DARK, dir, damage, 4);
1123 if (!get_aim_dir(&dir)) return FALSE;
1125 damage = monspell_bluemage_damage((MS_DRAIN_MANA), plev, DAM_ROLL);
1126 fire_ball_hide(GF_DRAIN_MANA, dir, damage, 0);
1129 if (!get_aim_dir(&dir)) return FALSE;
1131 damage = monspell_bluemage_damage((MS_MIND_BLAST), plev, DAM_ROLL);
1132 fire_ball_hide(GF_MIND_BLAST, dir, damage, 0);
1134 case MS_BRAIN_SMASH:
1135 if (!get_aim_dir(&dir)) return FALSE;
1137 damage = monspell_bluemage_damage((MS_BRAIN_SMASH), plev, DAM_ROLL);
1138 fire_ball_hide(GF_BRAIN_SMASH, dir, damage, 0);
1141 if (!get_aim_dir(&dir)) return FALSE;
1143 damage = monspell_bluemage_damage((MS_CAUSE_1), plev, DAM_ROLL);
1144 fire_ball_hide(GF_CAUSE_1, dir, damage, 0);
1147 if (!get_aim_dir(&dir)) return FALSE;
1149 damage = monspell_bluemage_damage((MS_CAUSE_2), plev, DAM_ROLL);
1150 fire_ball_hide(GF_CAUSE_2, dir, damage, 0);
1153 if (!get_aim_dir(&dir)) return FALSE;
1155 damage = monspell_bluemage_damage((MS_CAUSE_3), plev, DAM_ROLL);
1156 fire_ball_hide(GF_CAUSE_3, dir, damage, 0);
1159 if (!get_aim_dir(&dir)) return FALSE;
1161 damage = monspell_bluemage_damage((MS_CAUSE_4), plev, DAM_ROLL);
1162 fire_ball_hide(GF_CAUSE_4, dir, damage, 0);
1165 if (!get_aim_dir(&dir)) return FALSE;
1167 msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
1168 damage = monspell_bluemage_damage((MS_BOLT_ACID), plev, DAM_ROLL);
1169 fire_bolt(GF_ACID, dir, damage);
1172 if (!get_aim_dir(&dir)) return FALSE;
1174 msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
1175 damage = monspell_bluemage_damage((MS_BOLT_ELEC), plev, DAM_ROLL);
1176 fire_bolt(GF_ELEC, dir, damage);
1179 if (!get_aim_dir(&dir)) return FALSE;
1181 msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
1182 damage = monspell_bluemage_damage((MS_BOLT_FIRE), plev, DAM_ROLL);
1183 fire_bolt(GF_FIRE, dir, damage);
1186 if (!get_aim_dir(&dir)) return FALSE;
1188 msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
1189 damage = monspell_bluemage_damage((MS_BOLT_COLD), plev, DAM_ROLL);
1190 fire_bolt(GF_COLD, dir, damage);
1193 if (!get_aim_dir(&dir)) return FALSE;
1195 msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
1196 damage = monspell_bluemage_damage((MS_STARBURST), plev, DAM_ROLL);
1197 fire_ball(GF_LITE, dir, damage, 4);
1199 case MS_BOLT_NETHER:
1200 if (!get_aim_dir(&dir)) return FALSE;
1202 msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
1203 damage = monspell_bluemage_damage((MS_BOLT_NETHER), plev, DAM_ROLL);
1204 fire_bolt(GF_NETHER, dir, damage);
1207 if (!get_aim_dir(&dir)) return FALSE;
1209 msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
1210 damage = monspell_bluemage_damage((MS_BOLT_WATER), plev, DAM_ROLL);
1211 fire_bolt(GF_WATER, dir, damage);
1214 if (!get_aim_dir(&dir)) return FALSE;
1216 msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
1217 damage = monspell_bluemage_damage((MS_BOLT_MANA), plev, DAM_ROLL);
1218 fire_bolt(GF_MANA, dir, damage);
1220 case MS_BOLT_PLASMA:
1221 if (!get_aim_dir(&dir)) return FALSE;
1223 msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
1224 damage = monspell_bluemage_damage((MS_BOLT_PLASMA), plev, DAM_ROLL);
1225 fire_bolt(GF_PLASMA, dir, damage);
1228 if (!get_aim_dir(&dir)) return FALSE;
1230 msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
1231 damage = monspell_bluemage_damage((MS_BOLT_ICE), plev, DAM_ROLL);
1232 fire_bolt(GF_ICE, dir, damage);
1234 case MS_MAGIC_MISSILE:
1235 if (!get_aim_dir(&dir)) return FALSE;
1237 msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
1238 damage = monspell_bluemage_damage((MS_MAGIC_MISSILE), plev, DAM_ROLL);
1239 fire_bolt(GF_MISSILE, dir, damage);
1242 if (!get_aim_dir(&dir)) return FALSE;
1244 msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
1245 fear_monster(dir, plev+10);
1248 if (!get_aim_dir(&dir)) return FALSE;
1249 confuse_monster(dir, plev * 2);
1252 if (!get_aim_dir(&dir)) return FALSE;
1254 msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
1255 confuse_monster(dir, plev * 2);
1258 if (!get_aim_dir(&dir)) return FALSE;
1259 slow_monster(dir, plev);
1262 if (!get_aim_dir(&dir)) return FALSE;
1263 sleep_monster(dir, plev);
1266 (void)set_fast(randint1(20 + plev) + plev, FALSE);
1270 if (!get_aim_dir(&dir)) return FALSE;
1272 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
1273 fire_ball_hide(GF_HAND_DOOM, dir, plev * 3, 0);
1277 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
1278 (void)hp_player(plev*4);
1283 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
1284 (void)set_invuln(randint1(4) + 4, FALSE);
1287 teleport_player(10, 0L);
1290 teleport_player(plev * 5, 0L);
1293 (void)time_walk(p_ptr);
1299 monster_type *m_ptr;
1300 monster_race *r_ptr;
1301 GAME_TEXT m_name[MAX_NLEN];
1303 if (!target_set(TARGET_KILL)) return FALSE;
1304 if (!current_floor_ptr->grid_array[target_row][target_col].m_idx) break;
1305 if (!player_has_los_bold(target_row, target_col)) break;
1306 if (!projectable(p_ptr->y, p_ptr->x, target_row, target_col)) break;
1307 m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[target_row][target_col].m_idx];
1308 r_ptr = &r_info[m_ptr->r_idx];
1309 monster_desc(m_name, m_ptr, 0);
1310 if (r_ptr->flagsr & RFR_RES_TELE)
1312 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
1314 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1315 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
1318 else if (r_ptr->level > randint1(100))
1320 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1321 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
1325 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
1326 teleport_monster_to(current_floor_ptr->grid_array[target_row][target_col].m_idx, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
1330 if (!get_aim_dir(&dir)) return FALSE;
1332 (void)fire_beam(GF_AWAY_ALL, dir, 100);
1336 return teleport_level_other(p_ptr);
1340 if (!get_aim_dir(&dir)) return FALSE;
1342 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
1343 damage = monspell_bluemage_damage((MS_PSY_SPEAR), plev, DAM_ROLL);
1344 (void)fire_beam(GF_PSY_SPEAR, dir, damage);
1348 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
1349 (void)unlite_area(10, 3);
1352 if (!target_set(TARGET_KILL)) return FALSE;
1354 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
1355 trap_creation(target_row, target_col);
1358 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
1361 msg_print(_("死者復活の呪文を唱えた。", "You cast a animate dead."));
1362 (void)animate_dead(0, p_ptr->y, p_ptr->x);
1368 msg_print(_("援軍を召喚した。", "You summon minions."));
1369 for (k = 0;k < 1; k++)
1371 if (summon_kin_player(summon_lev, p_ptr->y, p_ptr->x, (pet ? PM_FORCE_PET : 0L)))
1373 if (!pet) msg_print(_("召喚された仲間は怒っている!", "Summoned fellows are angry!"));
1386 msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!"));
1387 for (k = 0 ;k < 1 ; k++)
1388 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_CYBER, p_mode, '\0'))
1391 msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!"));
1402 msg_print(_("仲間を召喚した。", "You summon help."));
1403 for (k = 0;k < 1; k++)
1404 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, p_mode, '\0'))
1407 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!"));
1418 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
1419 for (k = 0;k < plev / 15 + 2; k++)
1420 if(summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, 0, (p_mode | u_mode), '\0'))
1423 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!"));
1434 msg_print(_("アリを召喚した。", "You summon ants."));
1435 for (k = 0; k < 1; k++)
1436 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode), '\0'))
1439 msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!"));
1450 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
1451 for (k = 0;k < 1; k++)
1452 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode), '\0'))
1455 msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!"));
1466 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
1467 for (k = 0;k < 1; k++)
1468 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode), '\0'))
1471 msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!"));
1482 msg_print(_("ヒドラを召喚した。", "You summon a hydras."));
1483 for (k = 0;k < 1; k++)
1484 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HYDRA, (g_mode | p_mode), '\0'))
1487 msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!"));
1498 msg_print(_("天使を召喚した!", "You summon an angel!"));
1499 for (k = 0;k < 1; k++)
1500 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_ANGEL, (g_mode | p_mode), '\0'))
1503 msg_print(_("召喚された天使は怒っている!", "Summoned angels are angry!"));
1514 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
1515 for (k = 0;k < 1; k++)
1516 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DEMON, (g_mode | p_mode), '\0'))
1519 msg_print(_("召喚されたデーモンは怒っている!", "Summoned demons are angry!"));
1530 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
1531 for (k = 0;k < 1; k++)
1532 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode), '\0'))
1535 msg_print(_("召喚されたアンデッドは怒っている!", "Summoned undeads are angry!"));
1546 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
1547 for (k = 0;k < 1; k++)
1548 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_DRAGON, (g_mode | p_mode), '\0'))
1551 msg_print(_("召喚されたドラゴンは怒っている!", "Summoned dragons are angry!"));
1559 case MS_S_HI_UNDEAD:
1562 msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!"));
1563 for (k = 0;k < 1; k++)
1564 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode), '\0'))
1567 msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
1575 case MS_S_HI_DRAGON:
1578 msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!"));
1579 for (k = 0;k < 1; k++)
1580 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode), '\0'))
1583 msg_print(_("召喚された古代ドラゴンは怒っている!", "Summoned ancient dragons are angry!"));
1594 msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!"));
1595 for (k = 0;k < 1; k++)
1596 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode), '\0'))
1599 msg_print(_("召喚されたアンバーの王族は怒っている!", "Summoned Lords of Amber are angry!"));
1610 msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!"));
1611 for (k = 0;k < 1; k++)
1612 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE), '\0'))
1616 msg_print(_("召喚されたユニーク・モンスターは怒っている!", "Summoned special opponents are angry!"));
1618 for (k = count;k < 1; k++)
1619 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE), '\0'))
1623 msg_print(_("召喚された上級アンデッドは怒っている!", "Summoned greater undeads are angry!"));
1636 msg_print(_("何も現れなかった。", "No one have appeared."));
1643 * @brief 青魔法コマンドのメインルーチン /
1644 * do_cmd_cast calls this function if the player's class is 'Blue-Mage'.
1645 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1647 bool do_cmd_cast_learned(void)
1651 PERCENTAGE minfail = 0;
1652 PLAYER_LEVEL plev = p_ptr->lev;
1653 monster_power spell;
1655 MANA_POINT need_mana;
1657 if (cmd_limit_confused(p_ptr)) return FALSE;
1659 if (!get_learned_power(&n)) return FALSE;
1661 spell = monster_powers[n];
1663 need_mana = mod_need_mana(spell.smana, 0, REALM_NONE);
1665 /* Verify "dangerous" spells */
1666 if (need_mana > p_ptr->csp)
1669 msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
1671 if (!over_exert) return FALSE;
1674 if (!get_check(_("それでも挑戦しますか? ", "Attempt it anyway? "))) return FALSE;
1677 /* Spell failure chance */
1678 chance = spell.fail;
1680 /* Reduce failure rate by "effective" level adjustment */
1681 if (plev > spell.level) chance -= 3 * (plev - spell.level);
1682 else chance += (spell.level - plev);
1684 /* Reduce failure rate by INT/WIS adjustment */
1685 chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[A_INT]] - 1);
1687 chance = mod_spell_chance_1(chance);
1689 /* Not enough mana to cast */
1690 if (need_mana > p_ptr->csp)
1692 chance += 5 * (need_mana - p_ptr->csp);
1695 /* Extract the minimum failure rate */
1696 minfail = adj_mag_fail[p_ptr->stat_ind[A_INT]];
1698 /* Minimum failure rate */
1699 if (chance < minfail) chance = minfail;
1701 /* Stunning makes spells harder */
1702 if (p_ptr->stun > 50) chance += 25;
1703 else if (p_ptr->stun) chance += 15;
1705 /* Always a 5 percent chance of working */
1706 if (chance > 95) chance = 95;
1708 chance = mod_spell_chance_2(chance);
1711 if (randint0(100) < chance)
1713 if (flush_failure) flush();
1714 msg_print(_("魔法をうまく唱えられなかった。", "You failed to concentrate hard enough!"));
1719 cast = cast_learned_spell(n, FALSE);
1724 cast = cast_learned_spell(n, TRUE);
1725 if (!cast) return FALSE;
1728 /* Sufficient mana */
1729 if (need_mana <= p_ptr->csp)
1732 p_ptr->csp -= need_mana;
1736 int oops = need_mana;
1740 p_ptr->csp_frac = 0;
1742 msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
1744 /* Hack -- Bypass free action */
1745 (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
1747 chg_virtue(V_KNOWLEDGE, -10);
1749 /* Damage CON (possibly permanently) */
1750 if (randint0(100) < 50)
1752 bool perm = (randint0(100) < 25);
1754 msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
1756 /* Reduce constitution */
1757 (void)dec_stat(A_CON, 15 + randint1(10), perm);
1761 take_turn(p_ptr, 100);
1763 p_ptr->redraw |= (PR_MANA);
1764 p_ptr->window |= (PW_PLAYER | PW_SPELL);
1770 * @brief 青魔法のラーニング判定と成功した場合のラーニング処理
1771 * @param monspell ラーニングを試みるモンスター攻撃のID
1774 void learn_spell(int monspell)
1776 if (p_ptr->action != ACTION_LEARN) return;
1777 if (monspell < 0) return;
1778 if (p_ptr->magic_num2[monspell]) return;
1779 if (p_ptr->confused || p_ptr->blind || p_ptr->image || p_ptr->stun || p_ptr->paralyzed) return;
1780 if (randint1(p_ptr->lev + 70) > monster_powers[monspell].level + 40)
1782 p_ptr->magic_num2[monspell] = 1;
1783 msg_format(_("%sを学習した!", "You have learned %s!"), monster_powers[monspell].name);
1784 gain_exp(monster_powers[monspell].level * monster_powers[monspell].smana);
1789 p_ptr->redraw |= (PR_STATE);
1795 * @brief モンスター特殊能力のフラグ配列から特定条件の魔法だけを抜き出す処理
1796 * Extract monster spells mask for the given mode
1797 * @param f4 モンスター特殊能力の4番目のフラグ配列
1798 * @param f5 モンスター特殊能力の5番目のフラグ配列
1799 * @param f6 モンスター特殊能力の6番目のフラグ配列
1800 * @param mode 抜き出したい条件
1805 void set_rf_masks(BIT_FLAGS *f4, BIT_FLAGS *f5, BIT_FLAGS *f6, BIT_FLAGS mode)
1809 case MONSPELL_TYPE_BOLT:
1810 *f4 = ((RF4_BOLT_MASK | RF4_BEAM_MASK) & ~(RF4_ROCKET));
1811 *f5 = RF5_BOLT_MASK | RF5_BEAM_MASK;
1812 *f6 = RF6_BOLT_MASK | RF6_BEAM_MASK;
1815 case MONSPELL_TYPE_BALL:
1816 *f4 = (RF4_BALL_MASK & ~(RF4_BREATH_MASK));
1817 *f5 = (RF5_BALL_MASK & ~(RF5_BREATH_MASK));
1818 *f6 = (RF6_BALL_MASK & ~(RF6_BREATH_MASK));
1821 case MONSPELL_TYPE_BREATH:
1822 *f4 = RF4_BREATH_MASK;
1823 *f5 = RF5_BREATH_MASK;
1824 *f6 = RF6_BREATH_MASK;
1827 case MONSPELL_TYPE_SUMMON:
1828 *f4 = RF4_SUMMON_MASK;
1829 *f5 = RF5_SUMMON_MASK;
1830 *f6 = RF6_SUMMON_MASK;
1833 case MONSPELL_TYPE_OTHER:
1834 *f4 = RF4_ATTACK_MASK & ~(RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_INDIRECT_MASK);
1835 *f5 = RF5_ATTACK_MASK & ~(RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_INDIRECT_MASK);
1836 *f6 = RF6_ATTACK_MASK & ~(RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | RF6_INDIRECT_MASK);