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
14 #include "core/stuff-handler.h"
16 #include "main/sound-definitions-table.h"
20 #include "spells-summon.h"
22 #include "spells-status.h"
23 #include "cmd-spell.h"
24 #include "player-status.h"
25 #include "monster-spell.h"
26 #include "monster-status.h"
27 #include "spell/spells-type.h"
28 #include "cmd-basic.h"
29 #include "player-effects.h"
30 #include "targeting.h"
31 #include "view/display-main-window.h"
34 * @brief モンスター魔法をプレイヤーが使用する場合の換算レベル
35 * @param caster_ptr プレーヤーへの参照ポインタ
38 PLAYER_LEVEL get_pseudo_monstetr_level(player_type *caster_ptr)
40 PLAYER_LEVEL monster_level = caster_ptr->lev + 40;
41 return (monster_level * monster_level - 1550) / 130;
48 * level, smana, %fail, manedam, %manefail, use_stat, name
50 const monster_power monster_powers[MAX_MONSPELLS] =
53 { 1, 1, 10, 0, 15, A_CON, "叫ぶ"},
54 { 10, 4, 35, 89, 40, A_INT, "何か"},
55 { 40, 35, 85, 0, 40, A_INT, "魔力消去"},
56 { 35, 30, 80, 800, 70, A_STR, "ロケット"},
57 { 5, 1, 20, 18, 15, A_DEX, "射撃"},
58 { 10, 4, 35, 89, 40, A_INT, "何か"},
59 { 10, 4, 35, 89, 40, A_INT, "何か"},
60 { 10, 4, 35, 89, 40, A_INT, "何か"},
61 { 20, 15, 55, 1600, 95, A_CON, "酸のブレス"},
62 { 20, 15, 55, 1600, 95, A_CON, "電撃のブレス"},
63 { 20, 15, 55, 1600, 95, A_CON, "炎のブレス"},
64 { 20, 15, 55, 1600, 95, A_CON, "冷気のブレス"},
65 { 20, 15, 55, 800, 95, A_CON, "毒のブレス"},
66 { 20, 15, 70, 550, 95, A_CON, "地獄のブレス"},
67 { 20, 16, 70, 400, 95, A_CON, "閃光のブレス"},
68 { 20, 16, 70, 400, 95, A_CON, "暗黒のブレス"},
69 { 20, 20, 70, 450, 95, A_CON, "混乱のブレス"},
70 { 20, 20, 70, 450, 95, A_CON, "轟音のブレス"},
71 { 20, 20, 70, 600, 95, A_CON, "カオスのブレス"},
72 { 20, 16, 70, 500, 95, A_CON, "劣化のブレス"},
73 { 30, 25, 80, 250, 95, A_CON, "因果混乱のブレス"},
74 { 35, 18, 80, 150, 95, A_CON, "時間逆転のブレス"},
75 { 30, 25, 80, 200, 95, A_CON, "遅鈍のブレス"},
76 { 30, 28, 90, 200, 95, A_CON, "重力のブレス"},
77 { 20, 15, 70, 500, 95, A_CON, "破片のブレス"},
78 { 35, 15, 80, 150, 95, A_CON, "プラズマのブレス"},
79 { 30, 18, 70, 200, 95, A_CON, "フォースのブレス"},
80 { 30, 28, 80, 250, 95, A_CON, "魔力のブレス"},
81 { 25, 20, 95, 320, 80, A_INT, "放射能球"},
82 { 25, 15, 70, 800, 95, A_CON, "放射性廃棄物のブレス"},
83 { 30, 32, 85, 400, 80, A_INT, "純ログルス"},
84 { 35, 40, 95, 150, 95, A_CON, "分解のブレス"},
85 { 18, 13, 55, 630, 80, A_INT, "アシッド・ボール"},
86 { 14, 10, 45, 316, 60, A_INT, "サンダー・ボール"},
87 { 20, 14, 60, 720, 80, A_INT, "ファイア・ボール"},
88 { 15, 11, 50, 320, 60, A_INT, "アイス・ボール"},
89 { 5, 3, 40, 48, 20, A_INT, "悪臭雲"},
90 { 25, 18, 70, 350, 80, A_INT, "地獄球"},
91 { 30, 22, 75, 350, 80, A_INT, "ウォーター・ボール"},
92 { 44, 45, 85, 550, 95, A_INT, "魔力の嵐"},
93 { 40, 42, 90, 550, 95, A_INT, "暗黒の嵐"},
94 { 10, 5, 50, 0, 25, A_INT, "魔力吸収"},
95 { 25, 10, 60, 0, 30, A_INT, "精神攻撃"},
96 { 30, 14, 65, 0, 30, A_INT, "脳攻撃"},
97 { 3, 1, 25, 24, 20, A_INT, "軽傷"},
98 { 12, 2, 35, 64, 25, A_INT, "重傷"},
99 { 22, 6, 50, 150, 30, A_INT, "致命傷"},
100 { 32, 10, 70, 225, 35, A_INT, "秘孔を突く"},
101 { 13, 7, 40, 178, 40, A_INT, "アシッド・ボルト"},
102 { 10, 5, 35, 130, 35, A_INT, "サンダー・ボルト"},
103 { 15, 9, 50, 210, 45, A_INT, "ファイア・ボルト"},
104 { 12, 6, 35, 162, 40, A_INT, "アイス・ボルト"},
105 { 40, 42, 90, 550, 95, A_INT, "スター・バースト"},
106 { 25, 17, 60, 255, 60, A_INT, "地獄の矢"},
107 { 25, 20, 65, 250, 60, A_INT, "ウォーター・ボルト"},
108 { 25, 24, 90, 400, 80, A_INT, "魔力の矢"},
109 { 25, 20, 80, 216, 60, A_INT, "プラズマ・ボルト"},
110 { 25, 16, 60, 186, 60, A_INT, "極寒の矢"},
111 { 3, 1, 25, 12, 20, A_INT, "マジック・ミサイル"},
112 { 5, 3, 35, 0, 20, A_INT, "恐慌"},
113 { 10, 5, 40, 0, 20, A_INT, "盲目"},
114 { 10, 5, 40, 0, 20, A_INT, "パニック・モンスター"},
115 { 10, 5, 40, 0, 20, A_INT, "スロウ・モンスター"},
116 { 10, 5, 40, 0, 20, A_INT, "スリープ・モンスター"},
117 { 20, 10, 70, 0, 40, A_INT, "スピード"},
118 { 45, 120, 95, 0, 60, A_INT, "破滅の手"},
119 { 20, 15, 70, 0, 20, A_WIS, "体力回復"},
120 { 45, 65, 80, 0, 60, A_INT, "無傷の球"},
121 { 5, 1, 30, 0, 20, A_INT, "ショート・テレポート"},
122 { 15, 8, 40, 0, 30, A_INT, "テレポート"},
123 { 40, 999, 99, 0, 80, A_INT, "ザ・ワールド"},
124 { 1, 0, 0, 0, 15, A_INT, "何か"},
125 { 15, 8, 50, 0, 30, A_INT, "引きよせる"},
126 { 20, 13, 80, 0, 30, A_INT, "テレポート・アウェイ"},
127 { 30, 40, 95, 0, 40, A_INT, "テレポート・レベル"},
128 { 35, 30, 80, 350, 70, A_INT, "光の剣"},
129 { 5, 1, 20, 0, 15, A_INT, "暗闇"},
130 { 5, 1, 20, 0, 15, A_DEX, "トラップ創造"},
131 { 15, 3, 40, 0, 30, A_INT, "記憶喪失"},
132 { 30, 30, 70, 0, 40, A_INT, "死者復活"},
133 { 40, 70, 85, 0, 45, A_INT, "援軍を呼ぶ"},
134 { 45, 90, 90, 0, 50, A_INT, "サイバーデーモンの召喚"},
135 { 25, 20, 65, 0, 30, A_INT, "モンスターの召喚"},
136 { 35, 30, 75, 0, 40, A_INT, "複数のモンスターの召喚"},
137 { 25, 25, 65, 0, 25, A_INT, "アリの召喚"},
138 { 25, 20, 60, 0, 25, A_INT, "蜘蛛の召喚"},
139 { 35, 26, 75, 0, 40, A_INT, "ハウンドの召喚"},
140 { 30, 23, 70, 0, 35, A_INT, "ヒドラの召喚"},
141 { 40, 50, 85, 0, 40, A_INT, "天使の召喚"},
142 { 35, 50, 80, 0, 35, A_INT, "デーモンの召喚"},
143 { 30, 30, 75, 0, 35, A_INT, "アンデッドの召喚"},
144 { 39, 70, 80, 0, 40, A_INT, "ドラゴンの召喚"},
145 { 43, 85, 85, 0, 45, A_INT, "上級アンデッドの召喚"},
146 { 46, 90, 85, 0, 45, A_INT, "古代ドラゴンの召喚"},
147 { 48, 120, 90, 0, 50, A_INT, "アンバーの王族の召喚"},
148 { 50, 150, 95, 0, 50, A_INT, "ユニークモンスターの召喚"},
150 { 1, 1, 10, 0, 15, A_CON, "shriek"},
151 { 10, 4, 35, 89, 40, A_INT, "something"},
152 { 40, 35, 85, 0, 40, A_INT, "dispel-magic"},
153 { 35, 30, 80, 800, 70, A_STR, "rocket"},
154 { 2, 1, 15, 10, 15, A_DEX, "arrow"},
155 { 5, 2, 20, 18, 20, A_DEX, "arrows"},
156 { 12, 3, 25, 30, 25, A_DEX, "missile"},
157 { 16, 4, 30, 42, 30, A_DEX, "missiles"},
158 { 20, 15, 55, 1600, 95, A_CON, "breath acid"},
159 { 20, 15, 55, 1600, 95, A_CON, "breath lightning"},
160 { 20, 15, 55, 1600, 95, A_CON, "breath fire"},
161 { 20, 15, 55, 1600, 95, A_CON, "breath cold"},
162 { 20, 15, 55, 800, 95, A_CON, "breath poison"},
163 { 20, 15, 70, 550, 95, A_CON, "breath nether"},
164 { 20, 16, 70, 400, 95, A_CON, "breath light"},
165 { 20, 16, 70, 400, 95, A_CON, "breath dark"},
166 { 20, 20, 70, 450, 95, A_CON, "breath confusion"},
167 { 20, 20, 70, 450, 95, A_CON, "breath sound"},
168 { 20, 20, 70, 600, 95, A_CON, "breath chaos"},
169 { 20, 16, 70, 500, 95, A_CON, "breath disenchantment"},
170 { 30, 25, 80, 250, 95, A_CON, "breath nexus"},
171 { 35, 18, 80, 150, 95, A_CON, "breath time"},
172 { 30, 25, 80, 200, 95, A_CON, "breath inertia"},
173 { 30, 28, 90, 200, 95, A_CON, "breath gravity"},
174 { 20, 15, 70, 500, 95, A_CON, "breath shards"},
175 { 35, 15, 80, 150, 95, A_CON, "breath plasma"},
176 { 30, 18, 70, 200, 95, A_CON, "breath force"},
177 { 30, 28, 80, 250, 95, A_CON, "breath mana"},
178 { 25, 20, 95, 320, 80, A_INT, "nuke ball"},
179 { 25, 15, 70, 800, 95, A_CON, "breath nuke"},
180 { 30, 32, 85, 400, 80, A_INT, "raw Logrus"},
181 { 35, 40, 95, 150, 95, A_CON, "breath disintegrate"},
182 { 18, 13, 55, 630, 80, A_INT, "acid ball"},
183 { 14, 10, 45, 316, 60, A_INT, "lightning ball"},
184 { 20, 14, 60, 720, 80, A_INT, "fire ball"},
185 { 15, 11, 50, 320, 60, A_INT, "frost ball"},
186 { 5, 3, 40, 48, 20, A_INT, "stinking cloud"},
187 { 25, 18, 70, 350, 80, A_INT, "nether ball"},
188 { 30, 22, 75, 350, 80, A_INT, "water ball"},
189 { 44, 45, 85, 550, 95, A_INT, "mana storm"},
190 { 40, 42, 90, 550, 95, A_INT, "darkness storm"},
191 { 10, 5, 50, 0, 25, A_INT, "drain mana"},
192 { 25, 10, 60, 0, 30, A_INT, "mind blast"},
193 { 30, 14, 65, 0, 30, A_INT, "brain smash"},
194 { 3, 1, 25, 24, 20, A_INT, "cause light wounds"},
195 { 12, 2, 35, 64, 25, A_INT, "cause serious wounds"},
196 { 22, 6, 50, 150, 30, A_INT, "cause critical wounds"},
197 { 32, 10, 70, 225, 35, A_INT, "cause mortal wounds"},
198 { 13, 7, 40, 178, 40, A_INT, "acid bolt"},
199 { 10, 5, 35, 130, 35, A_INT, "lightning bolt"},
200 { 15, 9, 50, 210, 45, A_INT, "fire bolt"},
201 { 12, 6, 35, 162, 40, A_INT, "frost bolt"},
202 { 40, 42, 90, 550, 95, A_INT, "starburst"},
203 { 25, 17, 60, 255, 60, A_INT, "nether bolt"},
204 { 25, 20, 65, 250, 60, A_INT, "water bolt"},
205 { 25, 24, 90, 400, 80, A_INT, "mana bolt"},
206 { 25, 20, 80, 216, 60, A_INT, "plasma bolt"},
207 { 25, 16, 60, 186, 60, A_INT, "ice bolt"},
208 { 3, 1, 25, 12, 20, A_INT, "magic missile"},
209 { 5, 3, 35, 0, 20, A_INT, "scare"},
210 { 10, 5, 40, 0, 20, A_INT, "blind"},
211 { 10, 5, 40, 0, 20, A_INT, "confuse"},
212 { 10, 5, 40, 0, 20, A_INT, "slow"},
213 { 10, 5, 40, 0, 20, A_INT, "sleep"},
214 { 20, 10, 70, 0, 40, A_INT, "speed"},
215 { 45, 120, 95, 0, 60, A_INT, "the Hand of Doom"},
216 { 20, 15, 70, 0, 20, A_WIS, "heal-self"},
217 { 45, 65, 80, 0, 60, A_INT, "make invulnerable"},
218 { 5, 1, 30, 0, 20, A_INT, "blink-self"},
219 { 15, 8, 40, 0, 30, A_INT, "teleport-self"},
220 { 40, 999, 99, 0, 80, A_INT, "The world"},
221 { 1, 0, 0, 0, 15, A_INT, "something"},
222 { 15, 8, 50, 0, 30, A_INT, "teleport to"},
223 { 20, 13, 80, 0, 30, A_INT, "teleport away"},
224 { 30, 40, 95, 0, 40, A_INT, "teleport level"},
225 { 35, 30, 80, 350, 70, A_INT, "psycho-spear"},
226 { 5, 1, 20, 0, 15, A_INT, "create darkness"},
227 { 5, 1, 20, 0, 15, A_DEX, "create traps"},
228 { 15, 3, 40, 0, 30, A_INT, "cause amnesia"},
229 { 30, 30, 70, 0, 40, A_INT, "raise dead"},
230 { 40, 70, 85, 0, 45, A_INT, "summon aid"},
231 { 45, 90, 90, 0, 50, A_INT, "summon Cyberdemons"},
232 { 25, 20, 65, 0, 30, A_INT, "summon a monster"},
233 { 35, 30, 75, 0, 40, A_INT, "summon monsters"},
234 { 25, 25, 65, 0, 25, A_INT, "summon ants"},
235 { 25, 20, 60, 0, 25, A_INT, "summon spiders"},
236 { 35, 26, 75, 0, 40, A_INT, "summon hounds"},
237 { 30, 23, 70, 0, 35, A_INT, "summon hydras"},
238 { 40, 50, 85, 0, 40, A_INT, "summon an angel"},
239 { 35, 50, 80, 0, 35, A_INT, "summon a daemon"},
240 { 30, 30, 75, 0, 35, A_INT, "summon an undead"},
241 { 39, 70, 80, 0, 40, A_INT, "summon a dragon"},
242 { 43, 85, 85, 0, 45, A_INT, "summon Greater Undead"},
243 { 46, 90, 85, 0, 45, A_INT, "summon Ancient Dragon"},
244 { 48, 120, 90, 0, 50, A_INT, "summon Lords of Amber"},
245 { 50, 150, 95, 0, 50, A_INT, "summon Unique Monsters"},
252 * @brief モンスター魔法名テーブル
254 const concptr monster_powers_short[MAX_MONSPELLS] = {
257 "叫ぶ", "何か", "魔力消去", "ロケット", "射撃", "何か", "何か", "何か",
258 "酸", "電撃", "火炎", "冷気", "毒", "地獄", "閃光", "暗黒",
259 "混乱", "轟音", "カオス", "劣化", "因果混乱", "時間逆転", "遅鈍", "重力",
260 "破片", "プラズマ", "フォース", "魔力", "放射能球", "放射性廃棄物", "純ログルス", "分解",
262 "酸", "電撃", "火炎", "冷気", "悪臭雲", "地獄球", "ウォーター", "魔力の嵐",
263 "暗黒の嵐", "魔力吸収", "精神攻撃", "脳攻撃", "軽傷", "重傷", "致命傷", "秘孔を突く",
264 "酸", "電撃", "火炎", "冷気", "スターバースト", "地獄の矢", "ウォーター", "魔力の矢",
265 "プラズマ", "極寒", "マジックミサイル", "恐慌", "盲目", "混乱", "減速", "睡眠",
267 "加速", "破滅の手", "体力回復", "無傷の球", "ショートテレポート", "テレポート", "時を止める", "何か",
268 "引きよせる", "テレポートアウェイ", "テレポートレベル", "光の剣", "暗闇", "トラップ創造", "記憶喪失", "死者復活",
269 "援軍", "サイバーデーモン", "モンスター", "複数のモンスター", "蟻", "蜘蛛", "ハウンド", "ヒドラ",
270 "天使", "悪魔", "アンデッド", "ドラゴン", "上級アンデッド", "古代ドラゴン", "アンバーの王族", "ユニーク"
274 "Shriek", "Something", "Dispel-magic", "Rocket", "Arrow", "Arrows", "Missile", "Missiles",
275 "Acid", "Lightning", "Fire", "Cold", "Poison", "Nether", "Light", "Dark",
276 "Confusion", "Sound", "Chaos", "Disenchantment", "Nexus", "Time", "Inertia", "Gravity",
277 "Shards", "Plasma", "Force", "Mana", "Nuke", "Nuke", "Logrus", "Disintergrate",
279 "Acid", "Lightning", "Fire", "Frost", "Stinking Cloud", "Nether", "Water", "Mana storm",
280 "Darkness storm", "Drain mana", "Mind blast", "Brain smash", "Cause Light Wound", "Cause Serious Wound", "Cause Critical Wound", "Cause Mortal Wound",
281 "Acid", "Lightning", "Fire", "Frost", "Starburst", "Nether", "Water", "Mana",
282 "Plasm", "Ice", "Magic missile", "Scare", "Blind", "Confuse", "Slow", "Sleep",
284 "Speed", "Hand of doom", "Heal-self", "Invulnerable", "Blink", "Teleport", "The world", "Something",
285 "Teleport to", "Teleport away", "Teleport level", "Psycho-spear", "Create darkness", "Create traps", "Amnesia", "Raise dead",
286 "Aid", "Cyberdeamons", "A monster", "Monsters", "Ants", "Spiders", "Hounds", "Hydras",
287 "Angel", "Daemon", "Undead", "Dragon", "Greater Undead", "Ancient Dragon", "Lords of Amber", "Unique monsters"
294 * @brief 文字列に青魔導師の呪文の攻撃力を加える
295 * @param SPELL_NUM 呪文番号
296 * @param plev プレイヤーレベル
298 * @param tmp 返すメッセージを格納する配列
301 void set_bluemage_damage(player_type *learner_type, int SPELL_NUM, PLAYER_LEVEL plev, concptr msg, char* tmp)
303 int base_damage = monspell_bluemage_damage(learner_type, SPELL_NUM, plev, BASE_DAM);
304 int dice_num = monspell_bluemage_damage(learner_type, SPELL_NUM, plev, DICE_NUM);
305 int dice_side = monspell_bluemage_damage(learner_type, SPELL_NUM, plev, DICE_SIDE);
306 int dice_mult = monspell_bluemage_damage(learner_type, SPELL_NUM, plev, DICE_MULT);
307 int dice_div = monspell_bluemage_damage(learner_type, SPELL_NUM, plev, DICE_DIV);
309 dice_to_string(base_damage, dice_num, dice_side, dice_mult, dice_div, dmg_str);
310 sprintf(tmp, " %s %s", msg, dmg_str);
315 * @brief 受け取ったモンスター魔法のIDに応じて青魔法の効果情報をまとめたフォーマットを返す
316 * @param learner_ptr プレーヤーへの参照ポインタ
317 * @param p 情報を返す文字列参照ポインタ
318 * @param power モンスター魔法のID
321 static void learned_info(player_type *learner_ptr, char *p, int power)
323 PLAYER_LEVEL plev = get_pseudo_monstetr_level(learner_ptr);
368 set_bluemage_damage(learner_ptr, power, plev, KWD_DAM, p); break;
404 set_bluemage_damage(learner_ptr, power, plev, KWD_DAM, p); break;
406 set_bluemage_damage(learner_ptr, power, plev, KWD_HEAL, p); break;
422 case MS_MAGIC_MISSILE:
423 set_bluemage_damage(learner_ptr, power, plev, KWD_DAM, p); break;
425 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
428 set_bluemage_damage(learner_ptr, power, plev, KWD_HEAL, p); break;
430 sprintf(p, " %sd7+7", KWD_DURATION);
433 sprintf(p, " %s10", KWD_SPHERE);
436 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
439 set_bluemage_damage(learner_ptr, power, plev, KWD_DAM, p); break;
442 sprintf(p, " %s5", KWD_SPHERE);
451 * @brief 使用可能な青魔法を選択する /
452 * Allow user to choose a imitation.
453 * @param caster_ptr プレーヤーへの参照ポインタ
454 * @param sn 選択したモンスター攻撃ID、キャンセルの場合-1、不正な選択の場合-2を返す
455 * @return 発動可能な魔法を選択した場合TRUE、キャンセル処理か不正な選択が行われた場合FALSEを返す。
457 * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
458 * If the user hits escape, returns FALSE, and set '*sn' to -1\n
459 * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n
461 * The "prompt" should be "cast", "recite", or "study"\n
462 * The "known" should be TRUE for cast/pray, FALSE for study\n
464 * nb: This function has a (trivial) display bug which will be obvious\n
465 * when you run it. It's probably easy to fix but I haven't tried,\n
468 static bool get_learned_power(player_type *caster_ptr, SPELL_IDX *sn)
474 PERCENTAGE minfail = 0;
475 PLAYER_LEVEL plev = caster_ptr->lev;
476 PERCENTAGE chance = 0;
477 int ask = TRUE, mode = 0;
478 int spellnum[MAX_MONSPELLS];
483 BIT_FLAGS f4 = 0L, f5 = 0L, f6 = 0L;
484 concptr p = _("魔法", "magic");
488 int menu_line = (use_menu ? 1 : 0);
490 /* Assume cancelled */
496 /* Get the spell, if available */
498 if (repeat_pull(&code))
500 *sn = (SPELL_IDX)code;
510 prt(format(_(" %s ボルト", " %s bolt"), (menu_line == 1) ? _("》", "> ") : " "), 2, 14);
511 prt(format(_(" %s ボール", " %s ball"), (menu_line == 2) ? _("》", "> ") : " "), 3, 14);
512 prt(format(_(" %s ブレス", " %s breath"), (menu_line == 3) ? _("》", "> ") : " "), 4, 14);
513 prt(format(_(" %s 召喚", " %s sommoning"), (menu_line == 4) ? _("》", "> ") : " "), 5, 14);
514 prt(format(_(" %s その他", " %s others"), (menu_line == 5) ? _("》", "> ") : " "), 6, 14);
515 prt(_("どの種類の魔法を使いますか?", "use which type of magic? "), 0, 0);
541 if (menu_line > 5) menu_line -= 5;
547 sprintf(comment, _("[A]ボルト, [B]ボール, [C]ブレス, [D]召喚, [E]その他:", "[A] bolt, [B] ball, [C] breath, [D] summoning, [E] others:"));
550 if (!get_com(comment, &ch, TRUE))
554 if (ch == 'A' || ch == 'a')
559 if (ch == 'B' || ch == 'b')
564 if (ch == 'C' || ch == 'c')
569 if (ch == 'D' || ch == 'd')
574 if (ch == 'E' || ch == 'e')
582 set_rf_masks(&f4, &f5, &f6, mode);
584 for (i = 0, num = 0; i < 32; i++)
586 if ((0x00000001 << i) & f4) spellnum[num++] = i;
590 if ((0x00000001 << (i - 32)) & f5) spellnum[num++] = i;
594 if ((0x00000001 << (i - 64)) & f6) spellnum[num++] = i;
596 for (i = 0; i < num; i++)
598 if (caster_ptr->magic_num2[spellnum[i]])
600 if (use_menu) menu_line = i+1;
606 msg_print(_("その種類の魔法は覚えていない!", "You don't know any spell of this type."));
610 /* Build a prompt (accept all spells) */
611 (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sを唱えますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
612 I2A(0), I2A(num - 1), p);
614 if (use_menu) screen_save();
616 choice= (always_show_list || use_menu) ? ESCAPE:1 ;
619 if(choice==ESCAPE) choice = ' ';
620 else if( !get_com(out_val, &choice, TRUE) )break;
622 if (use_menu && choice != ' ')
638 menu_line += (num-1);
639 if (menu_line > num) menu_line -= num;
640 } while(!caster_ptr->magic_num2[spellnum[menu_line-1]]);
651 if (menu_line > num) menu_line -= num;
652 } while(!caster_ptr->magic_num2[spellnum[menu_line-1]]);
661 while(!caster_ptr->magic_num2[spellnum[menu_line-1]]) menu_line--;
670 while(!caster_ptr->magic_num2[spellnum[menu_line-1]]) menu_line++;
685 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
688 if (!redraw || use_menu)
692 if (!use_menu) screen_save();
694 /* Display a list of spells */
696 put_str(_("名前", "Name"), y, x + 5);
697 put_str(_("MP 失率 効果", "SP Fail Info"), y, x + 33);
700 /* Dump the spells */
701 for (i = 0; i < num; i++)
705 prt("", y + i + 1, x);
706 if (!caster_ptr->magic_num2[spellnum[i]]) continue;
708 /* Access the spell */
709 spell = monster_powers[spellnum[i]];
713 /* Reduce failure rate by "effective" level adjustment */
714 if (plev > spell.level) chance -= 3 * (plev - spell.level);
715 else chance += (spell.level - plev);
717 /* Reduce failure rate by INT/WIS adjustment */
718 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[A_INT]] - 1);
720 chance = mod_spell_chance_1(caster_ptr, chance);
722 need_mana = mod_need_mana(caster_ptr, monster_powers[spellnum[i]].smana, 0, REALM_NONE);
724 /* Not enough mana to cast */
725 if (need_mana > caster_ptr->csp)
727 chance += 5 * (need_mana - caster_ptr->csp);
730 /* Extract the minimum failure rate */
731 minfail = adj_mag_fail[caster_ptr->stat_ind[A_INT]];
733 /* Minimum failure rate */
734 if (chance < minfail) chance = minfail;
736 /* Stunning makes spells harder */
737 if (caster_ptr->stun > 50) chance += 25;
738 else if (caster_ptr->stun) chance += 15;
740 /* Always a 5 percent chance of working */
741 if (chance > 95) chance = 95;
743 chance = mod_spell_chance_2(caster_ptr, chance);
746 learned_info(caster_ptr, comment, spellnum[i]);
750 if (i == (menu_line-1)) strcpy(psi_desc, _(" 》", " > "));
751 else strcpy(psi_desc, " ");
753 else sprintf(psi_desc, " %c)", I2A(i));
755 /* Dump the spell --(-- */
756 strcat(psi_desc, format(" %-26s %3d %3d%%%s",
757 spell.name, need_mana,
759 prt(psi_desc, y + i + 1, x);
762 /* Clear the bottom line */
763 if (y < 22) prt("", y + i + 1, x);
781 ask = isupper(choice);
784 if (ask) choice = (char)tolower(choice);
786 /* Extract request */
787 i = (islower(choice) ? A2I(choice) : -1);
790 /* Totally Illegal */
791 if ((i < 0) || (i >= num) || !caster_ptr->magic_num2[spellnum[i]])
797 /* Save the spell index */
798 spell = monster_powers[spellnum[i]];
806 (void) strnfmt(tmp_val, 78, _("%sの魔法を唱えますか?", "Use %s? "), monster_powers[spellnum[i]].name);
808 /* Belay that order */
809 if (!get_check(tmp_val)) continue;
816 if (redraw) screen_load();
818 caster_ptr->window |= (PW_SPELL);
819 handle_stuff(caster_ptr);
821 /* Abort if needed */
822 if (!flag) return FALSE;
824 /* Save the choice */
827 repeat_push((COMMAND_CODE)spellnum[i]);
836 * do_cmd_cast calls this function if the player's class is 'blue-mage'.
837 * @param spell 発動するモンスター攻撃のID
838 * @param success TRUEは成功時、FALSEは失敗時の処理を行う
839 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
841 static bool cast_learned_spell(player_type *caster_ptr, int spell, bool success)
844 PLAYER_LEVEL plev = get_pseudo_monstetr_level(caster_ptr);
845 PLAYER_LEVEL summon_lev = caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev/2);
846 HIT_POINT damage = 0;
848 bool no_trump = FALSE;
849 BIT_FLAGS p_mode, u_mode = 0L, g_mode;
853 p_mode = PM_FORCE_PET;
859 g_mode = PM_ALLOW_GROUP;
862 if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE;
865 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
869 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
870 aggravate_monsters(caster_ptr, 0);
878 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
879 m_idx = floor_ptr->grid_array[target_row][target_col].m_idx;
881 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
882 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
883 dispel_monster_status(caster_ptr, m_idx);
887 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
889 msg_print(_("ロケットを発射した。", "You fire a rocket."));
890 damage = monspell_bluemage_damage(caster_ptr, (MS_ROCKET), plev, DAM_ROLL);
891 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
895 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
897 msg_print(_("矢を放った。", "You fire an arrow."));
898 damage = monspell_bluemage_damage(caster_ptr, (MS_SHOOT), plev, DAM_ROLL);
899 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
909 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
911 msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
912 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_ACID), plev, DAM_ROLL);
913 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 40 ? 3 : 2));
916 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
918 msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
919 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_ELEC), plev, DAM_ROLL);
920 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 40 ? 3 : 2));
923 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
925 msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
926 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_FIRE), plev, DAM_ROLL);
927 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 40 ? 3 : 2));
930 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
932 msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
933 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_COLD), plev, DAM_ROLL);
934 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 40 ? 3 : 2));
937 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
939 msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
940 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_POIS), plev, DAM_ROLL);
941 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 40 ? 3 : 2));
944 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
946 msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
947 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_NETHER), plev, DAM_ROLL);
948 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 40 ? 3 : 2));
951 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
953 msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
954 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_LITE), plev, DAM_ROLL);
955 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 40 ? 3 : 2));
958 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
960 msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
961 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_DARK), plev, DAM_ROLL);
962 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 40 ? 3 : 2));
965 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
967 msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
968 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_CONF), plev, DAM_ROLL);
969 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 40 ? 3 : 2));
972 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
974 msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
975 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_SOUND), plev, DAM_ROLL);
976 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 40 ? 3 : 2));
979 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
981 msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
982 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_CHAOS), plev, DAM_ROLL);
983 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 40 ? 3 : 2));
986 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
988 msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
989 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_DISEN), plev, DAM_ROLL);
990 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 40 ? 3 : 2));
993 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
995 msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
996 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_NEXUS), plev, DAM_ROLL);
997 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 40 ? 3 : 2));
1000 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1002 msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
1003 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_TIME), plev, DAM_ROLL);
1004 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 40 ? 3 : 2));
1007 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1009 msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
1010 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_INERTIA), plev, DAM_ROLL);
1011 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 40 ? 3 : 2));
1014 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1016 msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
1017 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_GRAVITY), plev, DAM_ROLL);
1018 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 40 ? 3 : 2));
1021 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1023 msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
1024 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_SHARDS), plev, DAM_ROLL);
1025 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 40 ? 3 : 2));
1028 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1030 msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
1031 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_PLASMA), plev, DAM_ROLL);
1032 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 40 ? 3 : 2));
1035 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1037 msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
1038 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_FORCE), plev, DAM_ROLL);
1039 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 40 ? 3 : 2));
1042 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1044 msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
1045 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_MANA), plev, DAM_ROLL);
1046 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 40 ? 3 : 2));
1049 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1051 msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
1052 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_NUKE), plev, DAM_ROLL);
1053 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
1056 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1058 msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
1059 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_NUKE), plev, DAM_ROLL);
1060 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 40 ? 3 : 2));
1063 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1065 msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
1066 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_CHAOS), plev, DAM_ROLL);
1067 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
1070 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1072 msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
1073 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_DISI), plev, DAM_ROLL);
1074 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 40 ? 3 : 2));
1077 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1079 msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
1080 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_ACID), plev, DAM_ROLL);
1081 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
1084 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1086 msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
1087 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_ELEC), plev, DAM_ROLL);
1088 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
1091 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1093 msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
1094 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_FIRE), plev, DAM_ROLL);
1095 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
1098 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1100 msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
1101 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_COLD), plev, DAM_ROLL);
1102 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
1105 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1107 msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
1108 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_POIS), plev, DAM_ROLL);
1109 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
1111 case MS_BALL_NETHER:
1112 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1114 msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
1115 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_NETHER), plev, DAM_ROLL);
1116 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
1119 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1121 msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
1122 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_WATER), plev, DAM_ROLL);
1123 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
1126 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1128 msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
1129 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_MANA), plev, DAM_ROLL);
1130 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
1133 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1135 msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
1136 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_DARK), plev, DAM_ROLL);
1137 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
1140 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1142 damage = monspell_bluemage_damage(caster_ptr, (MS_DRAIN_MANA), plev, DAM_ROLL);
1143 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, damage, 0);
1146 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1148 damage = monspell_bluemage_damage(caster_ptr, (MS_MIND_BLAST), plev, DAM_ROLL);
1149 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
1151 case MS_BRAIN_SMASH:
1152 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1154 damage = monspell_bluemage_damage(caster_ptr, (MS_BRAIN_SMASH), plev, DAM_ROLL);
1155 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
1158 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1160 damage = monspell_bluemage_damage(caster_ptr, (MS_CAUSE_1), plev, DAM_ROLL);
1161 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
1164 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1166 damage = monspell_bluemage_damage(caster_ptr, (MS_CAUSE_2), plev, DAM_ROLL);
1167 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
1170 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1172 damage = monspell_bluemage_damage(caster_ptr, (MS_CAUSE_3), plev, DAM_ROLL);
1173 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
1176 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1178 damage = monspell_bluemage_damage(caster_ptr, (MS_CAUSE_4), plev, DAM_ROLL);
1179 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
1182 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1184 msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
1185 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_ACID), plev, DAM_ROLL);
1186 fire_bolt(caster_ptr, GF_ACID, dir, damage);
1189 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1191 msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
1192 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_ELEC), plev, DAM_ROLL);
1193 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
1196 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1198 msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
1199 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_FIRE), plev, DAM_ROLL);
1200 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
1203 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1205 msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
1206 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_COLD), plev, DAM_ROLL);
1207 fire_bolt(caster_ptr, GF_COLD, dir, damage);
1210 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1212 msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
1213 damage = monspell_bluemage_damage(caster_ptr, (MS_STARBURST), plev, DAM_ROLL);
1214 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
1216 case MS_BOLT_NETHER:
1217 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1219 msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
1220 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_NETHER), plev, DAM_ROLL);
1221 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
1224 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1226 msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
1227 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_WATER), plev, DAM_ROLL);
1228 fire_bolt(caster_ptr, GF_WATER, dir, damage);
1231 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1233 msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
1234 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_MANA), plev, DAM_ROLL);
1235 fire_bolt(caster_ptr, GF_MANA, dir, damage);
1237 case MS_BOLT_PLASMA:
1238 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1240 msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
1241 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_PLASMA), plev, DAM_ROLL);
1242 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
1245 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1247 msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
1248 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_ICE), plev, DAM_ROLL);
1249 fire_bolt(caster_ptr, GF_ICE, dir, damage);
1251 case MS_MAGIC_MISSILE:
1252 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1254 msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
1255 damage = monspell_bluemage_damage(caster_ptr, (MS_MAGIC_MISSILE), plev, DAM_ROLL);
1256 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
1259 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1261 msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
1262 fear_monster(caster_ptr, dir, plev+10);
1265 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1266 confuse_monster(caster_ptr, dir, plev * 2);
1269 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1271 msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
1272 confuse_monster(caster_ptr, dir, plev * 2);
1275 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1276 slow_monster(caster_ptr, dir, plev);
1279 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1280 sleep_monster(caster_ptr, dir, plev);
1283 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
1287 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1289 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
1290 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, plev * 3, 0);
1294 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
1295 (void)hp_player(caster_ptr, plev*4);
1296 (void)set_stun(caster_ptr, 0);
1297 (void)set_cut(caster_ptr,0);
1300 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
1301 (void)set_invuln(caster_ptr, randint1(4) + 4, FALSE);
1304 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
1307 teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
1310 (void)time_walk(caster_ptr);
1316 monster_type *m_ptr;
1317 monster_race *r_ptr;
1318 GAME_TEXT m_name[MAX_NLEN];
1320 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
1321 if (!floor_ptr->grid_array[target_row][target_col].m_idx) break;
1322 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
1323 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
1324 m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[target_row][target_col].m_idx];
1325 r_ptr = &r_info[m_ptr->r_idx];
1326 monster_desc(caster_ptr, m_name, m_ptr, 0);
1327 if (r_ptr->flagsr & RFR_RES_TELE)
1329 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
1331 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1332 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
1335 else if (r_ptr->level > randint1(100))
1337 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1338 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
1343 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
1344 teleport_monster_to(caster_ptr, floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE);
1348 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1350 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, 100);
1354 return teleport_level_other(caster_ptr);
1358 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1360 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
1361 damage = monspell_bluemage_damage(caster_ptr, (MS_PSY_SPEAR), plev, DAM_ROLL);
1362 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
1366 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
1367 (void)unlite_area(caster_ptr, 10, 3);
1370 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
1372 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
1373 trap_creation(caster_ptr, target_row, target_col);
1376 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
1379 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
1380 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
1384 msg_print(_("援軍を召喚した。", "You summon one of your kin."));
1385 for (int k = 0;k < 1; k++)
1387 if (summon_kin_player(caster_ptr, summon_lev, caster_ptr->y, caster_ptr->x, (pet ? PM_FORCE_PET : 0L)))
1389 if (!pet) msg_print(_("召喚された仲間は怒っている!", "The summoned companion is angry!"));
1401 msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!"));
1402 for (int k = 0; k < 1; k++)
1404 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_CYBER, p_mode))
1407 msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!"));
1418 msg_print(_("仲間を召喚した。", "You summon help."));
1419 for (int k = 0; k < 1; k++)
1421 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, 0, p_mode))
1424 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!"));
1436 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
1437 for (int k = 0; k < plev / 15 + 2; k++)
1439 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, 0, (p_mode | u_mode)))
1442 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!"));
1454 msg_print(_("アリを召喚した。", "You summon ants."));
1455 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode)))
1458 msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!"));
1468 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
1469 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode)))
1472 msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!"));
1483 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
1484 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode)))
1487 msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!"));
1498 msg_print(_("ヒドラを召喚した。", "You summon a hydras."));
1499 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HYDRA, (g_mode | p_mode)))
1502 msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!"));
1513 msg_print(_("天使を召喚した!", "You summon an angel!"));
1514 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_ANGEL, (g_mode | p_mode)))
1517 msg_print(_("召喚された天使は怒っている!", "The summoned angel is angry!"));
1527 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
1528 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_DEMON, (g_mode | p_mode)))
1531 msg_print(_("召喚されたデーモンは怒っている!", "The summoned demon is angry!"));
1541 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
1542 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode)))
1545 msg_print(_("召喚されたアンデッドは怒っている!", "The summoned undead is angry!"));
1555 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
1556 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_DRAGON, (g_mode | p_mode)))
1559 msg_print(_("召喚されたドラゴンは怒っている!", "The summoned dragon is angry!"));
1567 case MS_S_HI_UNDEAD:
1569 msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!"));
1570 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | u_mode)))
1573 msg_print(_("召喚された上級アンデッドは怒っている!", "The summoned greater undead is angry!"));
1581 case MS_S_HI_DRAGON:
1583 msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!"));
1584 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HI_DRAGON, (g_mode | p_mode | u_mode)))
1587 msg_print(_("召喚された古代ドラゴンは怒っている!", "The summoned ancient dragon is angry!"));
1597 msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!"));
1598 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode)))
1601 msg_print(_("召喚されたアンバーの王族は怒っている!", "The summoned Lord of Amber is angry!"));
1612 msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!"));
1613 for (k = 0; k < 1; k++)
1615 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_UNIQUE, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1619 msg_print(_("召喚されたユニーク・モンスターは怒っている!", "The summoned special opponent is angry!"));
1623 for (k = count; k < 1; k++)
1625 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HI_UNDEAD, (g_mode | p_mode | PM_ALLOW_UNIQUE)))
1629 msg_print(_("召喚された上級アンデッドは怒っている!", "The summoned greater undead is angry!"));
1646 msg_print(_("何も現れなかった。", "No one appeared."));
1654 * @brief 青魔法コマンドのメインルーチン /
1655 * do_cmd_cast calls this function if the player's class is 'Blue-Mage'.
1656 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1658 bool do_cmd_cast_learned(player_type *caster_ptr)
1662 PERCENTAGE minfail = 0;
1663 PLAYER_LEVEL plev = caster_ptr->lev;
1664 monster_power spell;
1666 MANA_POINT need_mana;
1668 if (cmd_limit_confused(caster_ptr)) return FALSE;
1670 if (!get_learned_power(caster_ptr, &n)) return FALSE;
1672 spell = monster_powers[n];
1674 need_mana = mod_need_mana(caster_ptr, spell.smana, 0, REALM_NONE);
1676 /* Verify "dangerous" spells */
1677 if (need_mana > caster_ptr->csp)
1680 msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
1682 if (!over_exert) return FALSE;
1685 if (!get_check(_("それでも挑戦しますか? ", "Attempt it anyway? "))) return FALSE;
1688 /* Spell failure chance */
1689 chance = spell.fail;
1691 /* Reduce failure rate by "effective" level adjustment */
1692 if (plev > spell.level) chance -= 3 * (plev - spell.level);
1693 else chance += (spell.level - plev);
1695 /* Reduce failure rate by INT/WIS adjustment */
1696 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[A_INT]] - 1);
1698 chance = mod_spell_chance_1(caster_ptr, chance);
1700 /* Not enough mana to cast */
1701 if (need_mana > caster_ptr->csp)
1703 chance += 5 * (need_mana - caster_ptr->csp);
1706 /* Extract the minimum failure rate */
1707 minfail = adj_mag_fail[caster_ptr->stat_ind[A_INT]];
1709 /* Minimum failure rate */
1710 if (chance < minfail) chance = minfail;
1712 /* Stunning makes spells harder */
1713 if (caster_ptr->stun > 50) chance += 25;
1714 else if (caster_ptr->stun) chance += 15;
1716 /* Always a 5 percent chance of working */
1717 if (chance > 95) chance = 95;
1719 chance = mod_spell_chance_2(caster_ptr, chance);
1722 if (randint0(100) < chance)
1724 if (flush_failure) flush();
1725 msg_print(_("魔法をうまく唱えられなかった。", "You failed to concentrate hard enough!"));
1730 cast = cast_learned_spell(caster_ptr, n, FALSE);
1735 cast = cast_learned_spell(caster_ptr, n, TRUE);
1736 if (!cast) return FALSE;
1739 /* Sufficient mana */
1740 if (need_mana <= caster_ptr->csp)
1743 caster_ptr->csp -= need_mana;
1747 int oops = need_mana;
1750 caster_ptr->csp = 0;
1751 caster_ptr->csp_frac = 0;
1753 msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
1755 /* Hack -- Bypass free action */
1756 (void)set_paralyzed(caster_ptr, caster_ptr->paralyzed + randint1(5 * oops + 1));
1758 chg_virtue(caster_ptr, V_KNOWLEDGE, -10);
1760 /* Damage CON (possibly permanently) */
1761 if (randint0(100) < 50)
1763 bool perm = (randint0(100) < 25);
1765 msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
1767 /* Reduce constitution */
1768 (void)dec_stat(caster_ptr, A_CON, 15 + randint1(10), perm);
1772 take_turn(caster_ptr, 100);
1774 caster_ptr->redraw |= (PR_MANA);
1775 caster_ptr->window |= (PW_PLAYER | PW_SPELL);
1782 * @brief 青魔法のラーニング判定と成功した場合のラーニング処理
1783 * @param monspell ラーニングを試みるモンスター攻撃のID
1786 void learn_spell(player_type *learner_ptr, int monspell)
1788 if (learner_ptr->action != ACTION_LEARN) return;
1789 if (monspell < 0) return;
1790 if (learner_ptr->magic_num2[monspell]) return;
1791 if (learner_ptr->confused || learner_ptr->blind || learner_ptr->image || learner_ptr->stun || learner_ptr->paralyzed) return;
1792 if (randint1(learner_ptr->lev + 70) > monster_powers[monspell].level + 40)
1794 learner_ptr->magic_num2[monspell] = 1;
1795 msg_format(_("%sを学習した!", "You have learned %s!"), monster_powers[monspell].name);
1796 gain_exp(learner_ptr, monster_powers[monspell].level * monster_powers[monspell].smana);
1800 learner_ptr->new_mane = TRUE;
1801 learner_ptr->redraw |= (PR_STATE);
1807 * todo f4, f5, f6を構造体にまとめ直す
1808 * @brief モンスター特殊能力のフラグ配列から特定条件の魔法だけを抜き出す処理
1809 * Extract monster spells mask for the given mode
1810 * @param f4 モンスター特殊能力の4番目のフラグ配列
1811 * @param f5 モンスター特殊能力の5番目のフラグ配列
1812 * @param f6 モンスター特殊能力の6番目のフラグ配列
1813 * @param mode 抜き出したい条件
1818 void set_rf_masks(BIT_FLAGS *f4, BIT_FLAGS *f5, BIT_FLAGS *f6, BIT_FLAGS mode)
1822 case MONSPELL_TYPE_BOLT:
1823 *f4 = ((RF4_BOLT_MASK | RF4_BEAM_MASK) & ~(RF4_ROCKET));
1824 *f5 = RF5_BOLT_MASK | RF5_BEAM_MASK;
1825 *f6 = RF6_BOLT_MASK | RF6_BEAM_MASK;
1828 case MONSPELL_TYPE_BALL:
1829 *f4 = (RF4_BALL_MASK & ~(RF4_BREATH_MASK));
1830 *f5 = (RF5_BALL_MASK & ~(RF5_BREATH_MASK));
1831 *f6 = (RF6_BALL_MASK & ~(RF6_BREATH_MASK));
1834 case MONSPELL_TYPE_BREATH:
1835 *f4 = RF4_BREATH_MASK;
1836 *f5 = RF5_BREATH_MASK;
1837 *f6 = RF6_BREATH_MASK;
1840 case MONSPELL_TYPE_SUMMON:
1841 *f4 = RF4_SUMMON_MASK;
1842 *f5 = RF5_SUMMON_MASK;
1843 *f6 = RF6_SUMMON_MASK;
1846 case MONSPELL_TYPE_OTHER:
1847 *f4 = RF4_ATTACK_MASK & ~(RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_INDIRECT_MASK);
1848 *f5 = RF5_ATTACK_MASK & ~(RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_INDIRECT_MASK);
1849 *f6 = RF6_ATTACK_MASK & ~(RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | RF6_INDIRECT_MASK);