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"
18 #include "floor/floor.h"
20 #include "spells-summon.h"
22 #include "spells-status.h"
23 #include "cmd-spell.h"
24 #include "player/player-status.h"
25 #include "monster-spell.h"
26 #include "monster/monster-status.h"
27 #include "spell/spells-type.h"
28 #include "cmd-basic.h"
29 #include "player/player-effects.h"
30 #include "targeting.h"
31 #include "view/display-main-window.h"
32 #include "spell/spells2.h"
33 #include "spell/spells3.h"
36 * @brief モンスター魔法をプレイヤーが使用する場合の換算レベル
37 * @param caster_ptr プレーヤーへの参照ポインタ
40 PLAYER_LEVEL get_pseudo_monstetr_level(player_type *caster_ptr)
42 PLAYER_LEVEL monster_level = caster_ptr->lev + 40;
43 return (monster_level * monster_level - 1550) / 130;
50 * level, smana, %fail, manedam, %manefail, use_stat, name
52 const monster_power monster_powers[MAX_MONSPELLS] =
55 { 1, 1, 10, 0, 15, A_CON, "叫ぶ"},
56 { 10, 4, 35, 89, 40, A_INT, "何か"},
57 { 40, 35, 85, 0, 40, A_INT, "魔力消去"},
58 { 35, 30, 80, 800, 70, A_STR, "ロケット"},
59 { 5, 1, 20, 18, 15, A_DEX, "射撃"},
60 { 10, 4, 35, 89, 40, A_INT, "何か"},
61 { 10, 4, 35, 89, 40, A_INT, "何か"},
62 { 10, 4, 35, 89, 40, A_INT, "何か"},
63 { 20, 15, 55, 1600, 95, A_CON, "酸のブレス"},
64 { 20, 15, 55, 1600, 95, A_CON, "電撃のブレス"},
65 { 20, 15, 55, 1600, 95, A_CON, "炎のブレス"},
66 { 20, 15, 55, 1600, 95, A_CON, "冷気のブレス"},
67 { 20, 15, 55, 800, 95, A_CON, "毒のブレス"},
68 { 20, 15, 70, 550, 95, A_CON, "地獄のブレス"},
69 { 20, 16, 70, 400, 95, A_CON, "閃光のブレス"},
70 { 20, 16, 70, 400, 95, A_CON, "暗黒のブレス"},
71 { 20, 20, 70, 450, 95, A_CON, "混乱のブレス"},
72 { 20, 20, 70, 450, 95, A_CON, "轟音のブレス"},
73 { 20, 20, 70, 600, 95, A_CON, "カオスのブレス"},
74 { 20, 16, 70, 500, 95, A_CON, "劣化のブレス"},
75 { 30, 25, 80, 250, 95, A_CON, "因果混乱のブレス"},
76 { 35, 18, 80, 150, 95, A_CON, "時間逆転のブレス"},
77 { 30, 25, 80, 200, 95, A_CON, "遅鈍のブレス"},
78 { 30, 28, 90, 200, 95, A_CON, "重力のブレス"},
79 { 20, 15, 70, 500, 95, A_CON, "破片のブレス"},
80 { 35, 15, 80, 150, 95, A_CON, "プラズマのブレス"},
81 { 30, 18, 70, 200, 95, A_CON, "フォースのブレス"},
82 { 30, 28, 80, 250, 95, A_CON, "魔力のブレス"},
83 { 25, 20, 95, 320, 80, A_INT, "放射能球"},
84 { 25, 15, 70, 800, 95, A_CON, "放射性廃棄物のブレス"},
85 { 30, 32, 85, 400, 80, A_INT, "純ログルス"},
86 { 35, 40, 95, 150, 95, A_CON, "分解のブレス"},
87 { 18, 13, 55, 630, 80, A_INT, "アシッド・ボール"},
88 { 14, 10, 45, 316, 60, A_INT, "サンダー・ボール"},
89 { 20, 14, 60, 720, 80, A_INT, "ファイア・ボール"},
90 { 15, 11, 50, 320, 60, A_INT, "アイス・ボール"},
91 { 5, 3, 40, 48, 20, A_INT, "悪臭雲"},
92 { 25, 18, 70, 350, 80, A_INT, "地獄球"},
93 { 30, 22, 75, 350, 80, A_INT, "ウォーター・ボール"},
94 { 44, 45, 85, 550, 95, A_INT, "魔力の嵐"},
95 { 40, 42, 90, 550, 95, A_INT, "暗黒の嵐"},
96 { 10, 5, 50, 0, 25, A_INT, "魔力吸収"},
97 { 25, 10, 60, 0, 30, A_INT, "精神攻撃"},
98 { 30, 14, 65, 0, 30, A_INT, "脳攻撃"},
99 { 3, 1, 25, 24, 20, A_INT, "軽傷"},
100 { 12, 2, 35, 64, 25, A_INT, "重傷"},
101 { 22, 6, 50, 150, 30, A_INT, "致命傷"},
102 { 32, 10, 70, 225, 35, A_INT, "秘孔を突く"},
103 { 13, 7, 40, 178, 40, A_INT, "アシッド・ボルト"},
104 { 10, 5, 35, 130, 35, A_INT, "サンダー・ボルト"},
105 { 15, 9, 50, 210, 45, A_INT, "ファイア・ボルト"},
106 { 12, 6, 35, 162, 40, A_INT, "アイス・ボルト"},
107 { 40, 42, 90, 550, 95, A_INT, "スター・バースト"},
108 { 25, 17, 60, 255, 60, A_INT, "地獄の矢"},
109 { 25, 20, 65, 250, 60, A_INT, "ウォーター・ボルト"},
110 { 25, 24, 90, 400, 80, A_INT, "魔力の矢"},
111 { 25, 20, 80, 216, 60, A_INT, "プラズマ・ボルト"},
112 { 25, 16, 60, 186, 60, A_INT, "極寒の矢"},
113 { 3, 1, 25, 12, 20, A_INT, "マジック・ミサイル"},
114 { 5, 3, 35, 0, 20, A_INT, "恐慌"},
115 { 10, 5, 40, 0, 20, A_INT, "盲目"},
116 { 10, 5, 40, 0, 20, A_INT, "パニック・モンスター"},
117 { 10, 5, 40, 0, 20, A_INT, "スロウ・モンスター"},
118 { 10, 5, 40, 0, 20, A_INT, "スリープ・モンスター"},
119 { 20, 10, 70, 0, 40, A_INT, "スピード"},
120 { 45, 120, 95, 0, 60, A_INT, "破滅の手"},
121 { 20, 15, 70, 0, 20, A_WIS, "体力回復"},
122 { 45, 65, 80, 0, 60, A_INT, "無傷の球"},
123 { 5, 1, 30, 0, 20, A_INT, "ショート・テレポート"},
124 { 15, 8, 40, 0, 30, A_INT, "テレポート"},
125 { 40, 999, 99, 0, 80, A_INT, "ザ・ワールド"},
126 { 1, 0, 0, 0, 15, A_INT, "何か"},
127 { 15, 8, 50, 0, 30, A_INT, "引きよせる"},
128 { 20, 13, 80, 0, 30, A_INT, "テレポート・アウェイ"},
129 { 30, 40, 95, 0, 40, A_INT, "テレポート・レベル"},
130 { 35, 30, 80, 350, 70, A_INT, "光の剣"},
131 { 5, 1, 20, 0, 15, A_INT, "暗闇"},
132 { 5, 1, 20, 0, 15, A_DEX, "トラップ創造"},
133 { 15, 3, 40, 0, 30, A_INT, "記憶喪失"},
134 { 30, 30, 70, 0, 40, A_INT, "死者復活"},
135 { 40, 70, 85, 0, 45, A_INT, "援軍を呼ぶ"},
136 { 45, 90, 90, 0, 50, A_INT, "サイバーデーモンの召喚"},
137 { 25, 20, 65, 0, 30, A_INT, "モンスターの召喚"},
138 { 35, 30, 75, 0, 40, A_INT, "複数のモンスターの召喚"},
139 { 25, 25, 65, 0, 25, A_INT, "アリの召喚"},
140 { 25, 20, 60, 0, 25, A_INT, "蜘蛛の召喚"},
141 { 35, 26, 75, 0, 40, A_INT, "ハウンドの召喚"},
142 { 30, 23, 70, 0, 35, A_INT, "ヒドラの召喚"},
143 { 40, 50, 85, 0, 40, A_INT, "天使の召喚"},
144 { 35, 50, 80, 0, 35, A_INT, "デーモンの召喚"},
145 { 30, 30, 75, 0, 35, A_INT, "アンデッドの召喚"},
146 { 39, 70, 80, 0, 40, A_INT, "ドラゴンの召喚"},
147 { 43, 85, 85, 0, 45, A_INT, "上級アンデッドの召喚"},
148 { 46, 90, 85, 0, 45, A_INT, "古代ドラゴンの召喚"},
149 { 48, 120, 90, 0, 50, A_INT, "アンバーの王族の召喚"},
150 { 50, 150, 95, 0, 50, A_INT, "ユニークモンスターの召喚"},
152 { 1, 1, 10, 0, 15, A_CON, "shriek"},
153 { 10, 4, 35, 89, 40, A_INT, "something"},
154 { 40, 35, 85, 0, 40, A_INT, "dispel-magic"},
155 { 35, 30, 80, 800, 70, A_STR, "rocket"},
156 { 2, 1, 15, 10, 15, A_DEX, "arrow"},
157 { 5, 2, 20, 18, 20, A_DEX, "arrows"},
158 { 12, 3, 25, 30, 25, A_DEX, "missile"},
159 { 16, 4, 30, 42, 30, A_DEX, "missiles"},
160 { 20, 15, 55, 1600, 95, A_CON, "breath acid"},
161 { 20, 15, 55, 1600, 95, A_CON, "breath lightning"},
162 { 20, 15, 55, 1600, 95, A_CON, "breath fire"},
163 { 20, 15, 55, 1600, 95, A_CON, "breath cold"},
164 { 20, 15, 55, 800, 95, A_CON, "breath poison"},
165 { 20, 15, 70, 550, 95, A_CON, "breath nether"},
166 { 20, 16, 70, 400, 95, A_CON, "breath light"},
167 { 20, 16, 70, 400, 95, A_CON, "breath dark"},
168 { 20, 20, 70, 450, 95, A_CON, "breath confusion"},
169 { 20, 20, 70, 450, 95, A_CON, "breath sound"},
170 { 20, 20, 70, 600, 95, A_CON, "breath chaos"},
171 { 20, 16, 70, 500, 95, A_CON, "breath disenchantment"},
172 { 30, 25, 80, 250, 95, A_CON, "breath nexus"},
173 { 35, 18, 80, 150, 95, A_CON, "breath time"},
174 { 30, 25, 80, 200, 95, A_CON, "breath inertia"},
175 { 30, 28, 90, 200, 95, A_CON, "breath gravity"},
176 { 20, 15, 70, 500, 95, A_CON, "breath shards"},
177 { 35, 15, 80, 150, 95, A_CON, "breath plasma"},
178 { 30, 18, 70, 200, 95, A_CON, "breath force"},
179 { 30, 28, 80, 250, 95, A_CON, "breath mana"},
180 { 25, 20, 95, 320, 80, A_INT, "nuke ball"},
181 { 25, 15, 70, 800, 95, A_CON, "breath nuke"},
182 { 30, 32, 85, 400, 80, A_INT, "raw Logrus"},
183 { 35, 40, 95, 150, 95, A_CON, "breath disintegrate"},
184 { 18, 13, 55, 630, 80, A_INT, "acid ball"},
185 { 14, 10, 45, 316, 60, A_INT, "lightning ball"},
186 { 20, 14, 60, 720, 80, A_INT, "fire ball"},
187 { 15, 11, 50, 320, 60, A_INT, "frost ball"},
188 { 5, 3, 40, 48, 20, A_INT, "stinking cloud"},
189 { 25, 18, 70, 350, 80, A_INT, "nether ball"},
190 { 30, 22, 75, 350, 80, A_INT, "water ball"},
191 { 44, 45, 85, 550, 95, A_INT, "mana storm"},
192 { 40, 42, 90, 550, 95, A_INT, "darkness storm"},
193 { 10, 5, 50, 0, 25, A_INT, "drain mana"},
194 { 25, 10, 60, 0, 30, A_INT, "mind blast"},
195 { 30, 14, 65, 0, 30, A_INT, "brain smash"},
196 { 3, 1, 25, 24, 20, A_INT, "cause light wounds"},
197 { 12, 2, 35, 64, 25, A_INT, "cause serious wounds"},
198 { 22, 6, 50, 150, 30, A_INT, "cause critical wounds"},
199 { 32, 10, 70, 225, 35, A_INT, "cause mortal wounds"},
200 { 13, 7, 40, 178, 40, A_INT, "acid bolt"},
201 { 10, 5, 35, 130, 35, A_INT, "lightning bolt"},
202 { 15, 9, 50, 210, 45, A_INT, "fire bolt"},
203 { 12, 6, 35, 162, 40, A_INT, "frost bolt"},
204 { 40, 42, 90, 550, 95, A_INT, "starburst"},
205 { 25, 17, 60, 255, 60, A_INT, "nether bolt"},
206 { 25, 20, 65, 250, 60, A_INT, "water bolt"},
207 { 25, 24, 90, 400, 80, A_INT, "mana bolt"},
208 { 25, 20, 80, 216, 60, A_INT, "plasma bolt"},
209 { 25, 16, 60, 186, 60, A_INT, "ice bolt"},
210 { 3, 1, 25, 12, 20, A_INT, "magic missile"},
211 { 5, 3, 35, 0, 20, A_INT, "scare"},
212 { 10, 5, 40, 0, 20, A_INT, "blind"},
213 { 10, 5, 40, 0, 20, A_INT, "confuse"},
214 { 10, 5, 40, 0, 20, A_INT, "slow"},
215 { 10, 5, 40, 0, 20, A_INT, "sleep"},
216 { 20, 10, 70, 0, 40, A_INT, "speed"},
217 { 45, 120, 95, 0, 60, A_INT, "the Hand of Doom"},
218 { 20, 15, 70, 0, 20, A_WIS, "heal-self"},
219 { 45, 65, 80, 0, 60, A_INT, "make invulnerable"},
220 { 5, 1, 30, 0, 20, A_INT, "blink-self"},
221 { 15, 8, 40, 0, 30, A_INT, "teleport-self"},
222 { 40, 999, 99, 0, 80, A_INT, "The world"},
223 { 1, 0, 0, 0, 15, A_INT, "something"},
224 { 15, 8, 50, 0, 30, A_INT, "teleport to"},
225 { 20, 13, 80, 0, 30, A_INT, "teleport away"},
226 { 30, 40, 95, 0, 40, A_INT, "teleport level"},
227 { 35, 30, 80, 350, 70, A_INT, "psycho-spear"},
228 { 5, 1, 20, 0, 15, A_INT, "create darkness"},
229 { 5, 1, 20, 0, 15, A_DEX, "create traps"},
230 { 15, 3, 40, 0, 30, A_INT, "cause amnesia"},
231 { 30, 30, 70, 0, 40, A_INT, "raise dead"},
232 { 40, 70, 85, 0, 45, A_INT, "summon aid"},
233 { 45, 90, 90, 0, 50, A_INT, "summon Cyberdemons"},
234 { 25, 20, 65, 0, 30, A_INT, "summon a monster"},
235 { 35, 30, 75, 0, 40, A_INT, "summon monsters"},
236 { 25, 25, 65, 0, 25, A_INT, "summon ants"},
237 { 25, 20, 60, 0, 25, A_INT, "summon spiders"},
238 { 35, 26, 75, 0, 40, A_INT, "summon hounds"},
239 { 30, 23, 70, 0, 35, A_INT, "summon hydras"},
240 { 40, 50, 85, 0, 40, A_INT, "summon an angel"},
241 { 35, 50, 80, 0, 35, A_INT, "summon a daemon"},
242 { 30, 30, 75, 0, 35, A_INT, "summon an undead"},
243 { 39, 70, 80, 0, 40, A_INT, "summon a dragon"},
244 { 43, 85, 85, 0, 45, A_INT, "summon Greater Undead"},
245 { 46, 90, 85, 0, 45, A_INT, "summon Ancient Dragon"},
246 { 48, 120, 90, 0, 50, A_INT, "summon Lords of Amber"},
247 { 50, 150, 95, 0, 50, A_INT, "summon Unique Monsters"},
254 * @brief モンスター魔法名テーブル
256 const concptr monster_powers_short[MAX_MONSPELLS] = {
259 "叫ぶ", "何か", "魔力消去", "ロケット", "射撃", "何か", "何か", "何か",
260 "酸", "電撃", "火炎", "冷気", "毒", "地獄", "閃光", "暗黒",
261 "混乱", "轟音", "カオス", "劣化", "因果混乱", "時間逆転", "遅鈍", "重力",
262 "破片", "プラズマ", "フォース", "魔力", "放射能球", "放射性廃棄物", "純ログルス", "分解",
264 "酸", "電撃", "火炎", "冷気", "悪臭雲", "地獄球", "ウォーター", "魔力の嵐",
265 "暗黒の嵐", "魔力吸収", "精神攻撃", "脳攻撃", "軽傷", "重傷", "致命傷", "秘孔を突く",
266 "酸", "電撃", "火炎", "冷気", "スターバースト", "地獄の矢", "ウォーター", "魔力の矢",
267 "プラズマ", "極寒", "マジックミサイル", "恐慌", "盲目", "混乱", "減速", "睡眠",
269 "加速", "破滅の手", "体力回復", "無傷の球", "ショートテレポート", "テレポート", "時を止める", "何か",
270 "引きよせる", "テレポートアウェイ", "テレポートレベル", "光の剣", "暗闇", "トラップ創造", "記憶喪失", "死者復活",
271 "援軍", "サイバーデーモン", "モンスター", "複数のモンスター", "蟻", "蜘蛛", "ハウンド", "ヒドラ",
272 "天使", "悪魔", "アンデッド", "ドラゴン", "上級アンデッド", "古代ドラゴン", "アンバーの王族", "ユニーク"
276 "Shriek", "Something", "Dispel-magic", "Rocket", "Arrow", "Arrows", "Missile", "Missiles",
277 "Acid", "Lightning", "Fire", "Cold", "Poison", "Nether", "Light", "Dark",
278 "Confusion", "Sound", "Chaos", "Disenchantment", "Nexus", "Time", "Inertia", "Gravity",
279 "Shards", "Plasma", "Force", "Mana", "Nuke", "Nuke", "Logrus", "Disintergrate",
281 "Acid", "Lightning", "Fire", "Frost", "Stinking Cloud", "Nether", "Water", "Mana storm",
282 "Darkness storm", "Drain mana", "Mind blast", "Brain smash", "Cause Light Wound", "Cause Serious Wound", "Cause Critical Wound", "Cause Mortal Wound",
283 "Acid", "Lightning", "Fire", "Frost", "Starburst", "Nether", "Water", "Mana",
284 "Plasm", "Ice", "Magic missile", "Scare", "Blind", "Confuse", "Slow", "Sleep",
286 "Speed", "Hand of doom", "Heal-self", "Invulnerable", "Blink", "Teleport", "The world", "Something",
287 "Teleport to", "Teleport away", "Teleport level", "Psycho-spear", "Create darkness", "Create traps", "Amnesia", "Raise dead",
288 "Aid", "Cyberdeamons", "A monster", "Monsters", "Ants", "Spiders", "Hounds", "Hydras",
289 "Angel", "Daemon", "Undead", "Dragon", "Greater Undead", "Ancient Dragon", "Lords of Amber", "Unique monsters"
296 * @brief 文字列に青魔導師の呪文の攻撃力を加える
297 * @param SPELL_NUM 呪文番号
298 * @param plev プレイヤーレベル
300 * @param tmp 返すメッセージを格納する配列
303 void set_bluemage_damage(player_type *learner_type, int SPELL_NUM, PLAYER_LEVEL plev, concptr msg, char* tmp)
305 int base_damage = monspell_bluemage_damage(learner_type, SPELL_NUM, plev, BASE_DAM);
306 int dice_num = monspell_bluemage_damage(learner_type, SPELL_NUM, plev, DICE_NUM);
307 int dice_side = monspell_bluemage_damage(learner_type, SPELL_NUM, plev, DICE_SIDE);
308 int dice_mult = monspell_bluemage_damage(learner_type, SPELL_NUM, plev, DICE_MULT);
309 int dice_div = monspell_bluemage_damage(learner_type, SPELL_NUM, plev, DICE_DIV);
311 dice_to_string(base_damage, dice_num, dice_side, dice_mult, dice_div, dmg_str);
312 sprintf(tmp, " %s %s", msg, dmg_str);
317 * @brief 受け取ったモンスター魔法のIDに応じて青魔法の効果情報をまとめたフォーマットを返す
318 * @param learner_ptr プレーヤーへの参照ポインタ
319 * @param p 情報を返す文字列参照ポインタ
320 * @param power モンスター魔法のID
323 static void learned_info(player_type *learner_ptr, char *p, int power)
325 PLAYER_LEVEL plev = get_pseudo_monstetr_level(learner_ptr);
370 set_bluemage_damage(learner_ptr, power, plev, KWD_DAM, p); break;
406 set_bluemage_damage(learner_ptr, power, plev, KWD_DAM, p); break;
408 set_bluemage_damage(learner_ptr, power, plev, KWD_HEAL, p); break;
424 case MS_MAGIC_MISSILE:
425 set_bluemage_damage(learner_ptr, power, plev, KWD_DAM, p); break;
427 sprintf(p, " %sd%d+%d", KWD_DURATION, 20+plev, plev);
430 set_bluemage_damage(learner_ptr, power, plev, KWD_HEAL, p); break;
432 sprintf(p, " %sd7+7", KWD_DURATION);
435 sprintf(p, " %s10", KWD_SPHERE);
438 sprintf(p, " %s%d", KWD_SPHERE, plev * 5);
441 set_bluemage_damage(learner_ptr, power, plev, KWD_DAM, p); break;
444 sprintf(p, " %s5", KWD_SPHERE);
453 * @brief 使用可能な青魔法を選択する /
454 * Allow user to choose a imitation.
455 * @param caster_ptr プレーヤーへの参照ポインタ
456 * @param sn 選択したモンスター攻撃ID、キャンセルの場合-1、不正な選択の場合-2を返す
457 * @return 発動可能な魔法を選択した場合TRUE、キャンセル処理か不正な選択が行われた場合FALSEを返す。
459 * If a valid spell is chosen, saves it in '*sn' and returns TRUE\n
460 * If the user hits escape, returns FALSE, and set '*sn' to -1\n
461 * If there are no legal choices, returns FALSE, and sets '*sn' to -2\n
463 * The "prompt" should be "cast", "recite", or "study"\n
464 * The "known" should be TRUE for cast/pray, FALSE for study\n
466 * nb: This function has a (trivial) display bug which will be obvious\n
467 * when you run it. It's probably easy to fix but I haven't tried,\n
470 static bool get_learned_power(player_type *caster_ptr, SPELL_IDX *sn)
476 PERCENTAGE minfail = 0;
477 PLAYER_LEVEL plev = caster_ptr->lev;
478 PERCENTAGE chance = 0;
479 int ask = TRUE, mode = 0;
480 int spellnum[MAX_MONSPELLS];
485 BIT_FLAGS f4 = 0L, f5 = 0L, f6 = 0L;
486 concptr p = _("魔法", "magic");
490 int menu_line = (use_menu ? 1 : 0);
492 /* Assume cancelled */
498 /* Get the spell, if available */
500 if (repeat_pull(&code))
502 *sn = (SPELL_IDX)code;
512 prt(format(_(" %s ボルト", " %s bolt"), (menu_line == 1) ? _("》", "> ") : " "), 2, 14);
513 prt(format(_(" %s ボール", " %s ball"), (menu_line == 2) ? _("》", "> ") : " "), 3, 14);
514 prt(format(_(" %s ブレス", " %s breath"), (menu_line == 3) ? _("》", "> ") : " "), 4, 14);
515 prt(format(_(" %s 召喚", " %s sommoning"), (menu_line == 4) ? _("》", "> ") : " "), 5, 14);
516 prt(format(_(" %s その他", " %s others"), (menu_line == 5) ? _("》", "> ") : " "), 6, 14);
517 prt(_("どの種類の魔法を使いますか?", "use which type of magic? "), 0, 0);
543 if (menu_line > 5) menu_line -= 5;
549 sprintf(comment, _("[A]ボルト, [B]ボール, [C]ブレス, [D]召喚, [E]その他:", "[A] bolt, [B] ball, [C] breath, [D] summoning, [E] others:"));
552 if (!get_com(comment, &ch, TRUE))
556 if (ch == 'A' || ch == 'a')
561 if (ch == 'B' || ch == 'b')
566 if (ch == 'C' || ch == 'c')
571 if (ch == 'D' || ch == 'd')
576 if (ch == 'E' || ch == 'e')
584 set_rf_masks(&f4, &f5, &f6, mode);
586 for (i = 0, num = 0; i < 32; i++)
588 if ((0x00000001 << i) & f4) spellnum[num++] = i;
592 if ((0x00000001 << (i - 32)) & f5) spellnum[num++] = i;
596 if ((0x00000001 << (i - 64)) & f6) spellnum[num++] = i;
598 for (i = 0; i < num; i++)
600 if (caster_ptr->magic_num2[spellnum[i]])
602 if (use_menu) menu_line = i+1;
608 msg_print(_("その種類の魔法は覚えていない!", "You don't know any spell of this type."));
612 /* Build a prompt (accept all spells) */
613 (void)strnfmt(out_val, 78, _("(%c-%c, '*'で一覧, ESC) どの%sを唱えますか?", "(%c-%c, *=List, ESC=exit) Use which %s? "),
614 I2A(0), I2A(num - 1), p);
616 if (use_menu) screen_save();
618 choice= (always_show_list || use_menu) ? ESCAPE:1 ;
621 if(choice==ESCAPE) choice = ' ';
622 else if( !get_com(out_val, &choice, TRUE) )break;
624 if (use_menu && choice != ' ')
640 menu_line += (num-1);
641 if (menu_line > num) menu_line -= num;
642 } while(!caster_ptr->magic_num2[spellnum[menu_line-1]]);
653 if (menu_line > num) menu_line -= num;
654 } while(!caster_ptr->magic_num2[spellnum[menu_line-1]]);
663 while(!caster_ptr->magic_num2[spellnum[menu_line-1]]) menu_line--;
672 while(!caster_ptr->magic_num2[spellnum[menu_line-1]]) menu_line++;
687 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask))
690 if (!redraw || use_menu)
694 if (!use_menu) screen_save();
696 /* Display a list of spells */
698 put_str(_("名前", "Name"), y, x + 5);
699 put_str(_("MP 失率 効果", "SP Fail Info"), y, x + 33);
702 /* Dump the spells */
703 for (i = 0; i < num; i++)
707 prt("", y + i + 1, x);
708 if (!caster_ptr->magic_num2[spellnum[i]]) continue;
710 /* Access the spell */
711 spell = monster_powers[spellnum[i]];
715 /* Reduce failure rate by "effective" level adjustment */
716 if (plev > spell.level) chance -= 3 * (plev - spell.level);
717 else chance += (spell.level - plev);
719 /* Reduce failure rate by INT/WIS adjustment */
720 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[A_INT]] - 1);
722 chance = mod_spell_chance_1(caster_ptr, chance);
724 need_mana = mod_need_mana(caster_ptr, monster_powers[spellnum[i]].smana, 0, REALM_NONE);
726 /* Not enough mana to cast */
727 if (need_mana > caster_ptr->csp)
729 chance += 5 * (need_mana - caster_ptr->csp);
732 /* Extract the minimum failure rate */
733 minfail = adj_mag_fail[caster_ptr->stat_ind[A_INT]];
735 /* Minimum failure rate */
736 if (chance < minfail) chance = minfail;
738 /* Stunning makes spells harder */
739 if (caster_ptr->stun > 50) chance += 25;
740 else if (caster_ptr->stun) chance += 15;
742 /* Always a 5 percent chance of working */
743 if (chance > 95) chance = 95;
745 chance = mod_spell_chance_2(caster_ptr, chance);
748 learned_info(caster_ptr, comment, spellnum[i]);
752 if (i == (menu_line-1)) strcpy(psi_desc, _(" 》", " > "));
753 else strcpy(psi_desc, " ");
755 else sprintf(psi_desc, " %c)", I2A(i));
757 /* Dump the spell --(-- */
758 strcat(psi_desc, format(" %-26s %3d %3d%%%s",
759 spell.name, need_mana,
761 prt(psi_desc, y + i + 1, x);
764 /* Clear the bottom line */
765 if (y < 22) prt("", y + i + 1, x);
783 ask = isupper(choice);
786 if (ask) choice = (char)tolower(choice);
788 /* Extract request */
789 i = (islower(choice) ? A2I(choice) : -1);
792 /* Totally Illegal */
793 if ((i < 0) || (i >= num) || !caster_ptr->magic_num2[spellnum[i]])
799 /* Save the spell index */
800 spell = monster_powers[spellnum[i]];
808 (void) strnfmt(tmp_val, 78, _("%sの魔法を唱えますか?", "Use %s? "), monster_powers[spellnum[i]].name);
810 /* Belay that order */
811 if (!get_check(tmp_val)) continue;
818 if (redraw) screen_load();
820 caster_ptr->window |= (PW_SPELL);
821 handle_stuff(caster_ptr);
823 /* Abort if needed */
824 if (!flag) return FALSE;
826 /* Save the choice */
829 repeat_push((COMMAND_CODE)spellnum[i]);
838 * do_cmd_cast calls this function if the player's class is 'blue-mage'.
839 * @param spell 発動するモンスター攻撃のID
840 * @param success TRUEは成功時、FALSEは失敗時の処理を行う
841 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
843 static bool cast_learned_spell(player_type *caster_ptr, int spell, bool success)
846 PLAYER_LEVEL plev = get_pseudo_monstetr_level(caster_ptr);
847 PLAYER_LEVEL summon_lev = caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev/2);
848 HIT_POINT damage = 0;
850 bool no_trump = FALSE;
851 BIT_FLAGS p_mode, u_mode = 0L, g_mode;
855 p_mode = PM_FORCE_PET;
861 g_mode = PM_ALLOW_GROUP;
864 if (!success || (randint1(50+plev) < plev/10)) u_mode = PM_ALLOW_UNIQUE;
867 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
871 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
872 aggravate_monsters(caster_ptr, 0);
880 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
881 m_idx = floor_ptr->grid_array[target_row][target_col].m_idx;
883 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
884 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
885 dispel_monster_status(caster_ptr, m_idx);
889 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
891 msg_print(_("ロケットを発射した。", "You fire a rocket."));
892 damage = monspell_bluemage_damage(caster_ptr, (MS_ROCKET), plev, DAM_ROLL);
893 fire_rocket(caster_ptr, GF_ROCKET, dir, damage, 2);
897 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
899 msg_print(_("矢を放った。", "You fire an arrow."));
900 damage = monspell_bluemage_damage(caster_ptr, (MS_SHOOT), plev, DAM_ROLL);
901 fire_bolt(caster_ptr, GF_ARROW, dir, damage);
911 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
913 msg_print(_("酸のブレスを吐いた。", "You breathe acid."));
914 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_ACID), plev, DAM_ROLL);
915 fire_breath(caster_ptr, GF_ACID, dir, damage, (plev > 40 ? 3 : 2));
918 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
920 msg_print(_("稲妻のブレスを吐いた。", "You breathe lightning."));
921 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_ELEC), plev, DAM_ROLL);
922 fire_breath(caster_ptr, GF_ELEC, dir, damage, (plev > 40 ? 3 : 2));
925 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
927 msg_print(_("火炎のブレスを吐いた。", "You breathe fire."));
928 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_FIRE), plev, DAM_ROLL);
929 fire_breath(caster_ptr, GF_FIRE, dir, damage, (plev > 40 ? 3 : 2));
932 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
934 msg_print(_("冷気のブレスを吐いた。", "You breathe frost."));
935 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_COLD), plev, DAM_ROLL);
936 fire_breath(caster_ptr, GF_COLD, dir, damage, (plev > 40 ? 3 : 2));
939 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
941 msg_print(_("ガスのブレスを吐いた。", "You breathe gas."));
942 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_POIS), plev, DAM_ROLL);
943 fire_breath(caster_ptr, GF_POIS, dir, damage, (plev > 40 ? 3 : 2));
946 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
948 msg_print(_("地獄のブレスを吐いた。", "You breathe nether."));
949 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_NETHER), plev, DAM_ROLL);
950 fire_breath(caster_ptr, GF_NETHER, dir, damage, (plev > 40 ? 3 : 2));
953 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
955 msg_print(_("閃光のブレスを吐いた。", "You breathe light."));
956 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_LITE), plev, DAM_ROLL);
957 fire_breath(caster_ptr, GF_LITE, dir, damage, (plev > 40 ? 3 : 2));
960 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
962 msg_print(_("暗黒のブレスを吐いた。", "You breathe darkness."));
963 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_DARK), plev, DAM_ROLL);
964 fire_breath(caster_ptr, GF_DARK, dir, damage, (plev > 40 ? 3 : 2));
967 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
969 msg_print(_("混乱のブレスを吐いた。", "You breathe confusion."));
970 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_CONF), plev, DAM_ROLL);
971 fire_breath(caster_ptr, GF_CONFUSION, dir, damage, (plev > 40 ? 3 : 2));
974 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
976 msg_print(_("轟音のブレスを吐いた。", "You breathe sound."));
977 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_SOUND), plev, DAM_ROLL);
978 fire_breath(caster_ptr, GF_SOUND, dir, damage, (plev > 40 ? 3 : 2));
981 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
983 msg_print(_("カオスのブレスを吐いた。", "You breathe chaos."));
984 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_CHAOS), plev, DAM_ROLL);
985 fire_breath(caster_ptr, GF_CHAOS, dir, damage, (plev > 40 ? 3 : 2));
988 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
990 msg_print(_("劣化のブレスを吐いた。", "You breathe disenchantment."));
991 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_DISEN), plev, DAM_ROLL);
992 fire_breath(caster_ptr, GF_DISENCHANT, dir, damage, (plev > 40 ? 3 : 2));
995 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
997 msg_print(_("因果混乱のブレスを吐いた。", "You breathe nexus."));
998 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_NEXUS), plev, DAM_ROLL);
999 fire_breath(caster_ptr, GF_NEXUS, dir, damage, (plev > 40 ? 3 : 2));
1002 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1004 msg_print(_("時間逆転のブレスを吐いた。", "You breathe time."));
1005 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_TIME), plev, DAM_ROLL);
1006 fire_breath(caster_ptr, GF_TIME, dir, damage, (plev > 40 ? 3 : 2));
1009 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1011 msg_print(_("遅鈍のブレスを吐いた。", "You breathe inertia."));
1012 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_INERTIA), plev, DAM_ROLL);
1013 fire_breath(caster_ptr, GF_INERTIAL, dir, damage, (plev > 40 ? 3 : 2));
1016 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1018 msg_print(_("重力のブレスを吐いた。", "You breathe gravity."));
1019 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_GRAVITY), plev, DAM_ROLL);
1020 fire_breath(caster_ptr, GF_GRAVITY, dir, damage, (plev > 40 ? 3 : 2));
1023 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1025 msg_print(_("破片のブレスを吐いた。", "You breathe shards."));
1026 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_SHARDS), plev, DAM_ROLL);
1027 fire_breath(caster_ptr, GF_SHARDS, dir, damage, (plev > 40 ? 3 : 2));
1030 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1032 msg_print(_("プラズマのブレスを吐いた。", "You breathe plasma."));
1033 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_PLASMA), plev, DAM_ROLL);
1034 fire_breath(caster_ptr, GF_PLASMA, dir, damage, (plev > 40 ? 3 : 2));
1037 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1039 msg_print(_("フォースのブレスを吐いた。", "You breathe force."));
1040 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_FORCE), plev, DAM_ROLL);
1041 fire_breath(caster_ptr, GF_FORCE, dir, damage, (plev > 40 ? 3 : 2));
1044 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1046 msg_print(_("魔力のブレスを吐いた。", "You breathe mana."));
1047 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_MANA), plev, DAM_ROLL);
1048 fire_breath(caster_ptr, GF_MANA, dir, damage, (plev > 40 ? 3 : 2));
1051 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1053 msg_print(_("放射能球を放った。", "You cast a ball of radiation."));
1054 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_NUKE), plev, DAM_ROLL);
1055 fire_ball(caster_ptr, GF_NUKE, dir, damage, 2);
1058 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1060 msg_print(_("放射性廃棄物のブレスを吐いた。", "You breathe toxic waste."));
1061 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_NUKE), plev, DAM_ROLL);
1062 fire_breath(caster_ptr, GF_NUKE, dir, damage, (plev > 40 ? 3 : 2));
1065 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1067 msg_print(_("純ログルスを放った。", "You invoke a raw Logrus."));
1068 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_CHAOS), plev, DAM_ROLL);
1069 fire_ball(caster_ptr, GF_CHAOS, dir, damage, 4);
1072 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1074 msg_print(_("分解のブレスを吐いた。", "You breathe disintegration."));
1075 damage = monspell_bluemage_damage(caster_ptr, (MS_BR_DISI), plev, DAM_ROLL);
1076 fire_breath(caster_ptr, GF_DISINTEGRATE, dir, damage, (plev > 40 ? 3 : 2));
1079 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1081 msg_print(_("アシッド・ボールの呪文を唱えた。", "You cast an acid ball."));
1082 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_ACID), plev, DAM_ROLL);
1083 fire_ball(caster_ptr, GF_ACID, dir, damage, 2);
1086 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1088 msg_print(_("サンダー・ボールの呪文を唱えた。", "You cast a lightning ball."));
1089 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_ELEC), plev, DAM_ROLL);
1090 fire_ball(caster_ptr, GF_ELEC, dir, damage, 2);
1093 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1095 msg_print(_("ファイア・ボールの呪文を唱えた。", "You cast a fire ball."));
1096 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_FIRE), plev, DAM_ROLL);
1097 fire_ball(caster_ptr, GF_FIRE, dir, damage, 2);
1100 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1102 msg_print(_("アイス・ボールの呪文を唱えた。", "You cast a frost ball."));
1103 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_COLD), plev, DAM_ROLL);
1104 fire_ball(caster_ptr, GF_COLD, dir, damage, 2);
1107 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1109 msg_print(_("悪臭雲の呪文を唱えた。", "You cast a stinking cloud."));
1110 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_POIS), plev, DAM_ROLL);
1111 fire_ball(caster_ptr, GF_POIS, dir, damage, 2);
1113 case MS_BALL_NETHER:
1114 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1116 msg_print(_("地獄球の呪文を唱えた。", "You cast a nether ball."));
1117 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_NETHER), plev, DAM_ROLL);
1118 fire_ball(caster_ptr, GF_NETHER, dir, damage, 2);
1121 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1123 msg_print(_("流れるような身振りをした。", "You gesture fluidly."));
1124 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_WATER), plev, DAM_ROLL);
1125 fire_ball(caster_ptr, GF_WATER, dir, damage, 4);
1128 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1130 msg_print(_("魔力の嵐の呪文を念じた。", "You invoke a mana storm."));
1131 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_MANA), plev, DAM_ROLL);
1132 fire_ball(caster_ptr, GF_MANA, dir, damage, 4);
1135 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1137 msg_print(_("暗黒の嵐の呪文を念じた。", "You invoke a darkness storm."));
1138 damage = monspell_bluemage_damage(caster_ptr, (MS_BALL_DARK), plev, DAM_ROLL);
1139 fire_ball(caster_ptr, GF_DARK, dir, damage, 4);
1142 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1144 damage = monspell_bluemage_damage(caster_ptr, (MS_DRAIN_MANA), plev, DAM_ROLL);
1145 fire_ball_hide(caster_ptr, GF_DRAIN_MANA, dir, damage, 0);
1148 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1150 damage = monspell_bluemage_damage(caster_ptr, (MS_MIND_BLAST), plev, DAM_ROLL);
1151 fire_ball_hide(caster_ptr, GF_MIND_BLAST, dir, damage, 0);
1153 case MS_BRAIN_SMASH:
1154 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1156 damage = monspell_bluemage_damage(caster_ptr, (MS_BRAIN_SMASH), plev, DAM_ROLL);
1157 fire_ball_hide(caster_ptr, GF_BRAIN_SMASH, dir, damage, 0);
1160 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1162 damage = monspell_bluemage_damage(caster_ptr, (MS_CAUSE_1), plev, DAM_ROLL);
1163 fire_ball_hide(caster_ptr, GF_CAUSE_1, dir, damage, 0);
1166 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1168 damage = monspell_bluemage_damage(caster_ptr, (MS_CAUSE_2), plev, DAM_ROLL);
1169 fire_ball_hide(caster_ptr, GF_CAUSE_2, dir, damage, 0);
1172 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1174 damage = monspell_bluemage_damage(caster_ptr, (MS_CAUSE_3), plev, DAM_ROLL);
1175 fire_ball_hide(caster_ptr, GF_CAUSE_3, dir, damage, 0);
1178 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1180 damage = monspell_bluemage_damage(caster_ptr, (MS_CAUSE_4), plev, DAM_ROLL);
1181 fire_ball_hide(caster_ptr, GF_CAUSE_4, dir, damage, 0);
1184 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1186 msg_print(_("アシッド・ボルトの呪文を唱えた。", "You cast an acid bolt."));
1187 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_ACID), plev, DAM_ROLL);
1188 fire_bolt(caster_ptr, GF_ACID, dir, damage);
1191 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1193 msg_print(_("サンダー・ボルトの呪文を唱えた。", "You cast a lightning bolt."));
1194 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_ELEC), plev, DAM_ROLL);
1195 fire_bolt(caster_ptr, GF_ELEC, dir, damage);
1198 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1200 msg_print(_("ファイア・ボルトの呪文を唱えた。", "You cast a fire bolt."));
1201 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_FIRE), plev, DAM_ROLL);
1202 fire_bolt(caster_ptr, GF_FIRE, dir, damage);
1205 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1207 msg_print(_("アイス・ボルトの呪文を唱えた。", "You cast a frost bolt."));
1208 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_COLD), plev, DAM_ROLL);
1209 fire_bolt(caster_ptr, GF_COLD, dir, damage);
1212 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1214 msg_print(_("スターバーストの呪文を念じた。", "You invoke a starburst."));
1215 damage = monspell_bluemage_damage(caster_ptr, (MS_STARBURST), plev, DAM_ROLL);
1216 fire_ball(caster_ptr, GF_LITE, dir, damage, 4);
1218 case MS_BOLT_NETHER:
1219 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1221 msg_print(_("地獄の矢の呪文を唱えた。", "You cast a nether bolt."));
1222 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_NETHER), plev, DAM_ROLL);
1223 fire_bolt(caster_ptr, GF_NETHER, dir, damage);
1226 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1228 msg_print(_("ウォーター・ボルトの呪文を唱えた。", "You cast a water bolt."));
1229 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_WATER), plev, DAM_ROLL);
1230 fire_bolt(caster_ptr, GF_WATER, dir, damage);
1233 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1235 msg_print(_("魔力の矢の呪文を唱えた。", "You cast a mana bolt."));
1236 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_MANA), plev, DAM_ROLL);
1237 fire_bolt(caster_ptr, GF_MANA, dir, damage);
1239 case MS_BOLT_PLASMA:
1240 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1242 msg_print(_("プラズマ・ボルトの呪文を唱えた。", "You cast a plasma bolt."));
1243 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_PLASMA), plev, DAM_ROLL);
1244 fire_bolt(caster_ptr, GF_PLASMA, dir, damage);
1247 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1249 msg_print(_("極寒の矢の呪文を唱えた。", "You cast a ice bolt."));
1250 damage = monspell_bluemage_damage(caster_ptr, (MS_BOLT_ICE), plev, DAM_ROLL);
1251 fire_bolt(caster_ptr, GF_ICE, dir, damage);
1253 case MS_MAGIC_MISSILE:
1254 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1256 msg_print(_("マジック・ミサイルの呪文を唱えた。", "You cast a magic missile."));
1257 damage = monspell_bluemage_damage(caster_ptr, (MS_MAGIC_MISSILE), plev, DAM_ROLL);
1258 fire_bolt(caster_ptr, GF_MISSILE, dir, damage);
1261 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1263 msg_print(_("恐ろしげな幻覚を作り出した。", "You cast a fearful illusion."));
1264 fear_monster(caster_ptr, dir, plev+10);
1267 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1268 confuse_monster(caster_ptr, dir, plev * 2);
1271 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1273 msg_print(_("誘惑的な幻覚をつくり出した。", "You cast a mesmerizing illusion."));
1274 confuse_monster(caster_ptr, dir, plev * 2);
1277 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1278 slow_monster(caster_ptr, dir, plev);
1281 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1282 sleep_monster(caster_ptr, dir, plev);
1285 (void)set_fast(caster_ptr, randint1(20 + plev) + plev, FALSE);
1289 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1291 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
1292 fire_ball_hide(caster_ptr, GF_HAND_DOOM, dir, plev * 3, 0);
1296 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
1297 (void)hp_player(caster_ptr, plev*4);
1298 (void)set_stun(caster_ptr, 0);
1299 (void)set_cut(caster_ptr,0);
1302 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
1303 (void)set_invuln(caster_ptr, randint1(4) + 4, FALSE);
1306 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
1309 teleport_player(caster_ptr, plev * 5, TELEPORT_SPONTANEOUS);
1312 (void)time_walk(caster_ptr);
1318 monster_type *m_ptr;
1319 monster_race *r_ptr;
1320 GAME_TEXT m_name[MAX_NLEN];
1322 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
1323 if (!floor_ptr->grid_array[target_row][target_col].m_idx) break;
1324 if (!player_has_los_bold(caster_ptr, target_row, target_col)) break;
1325 if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) break;
1326 m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[target_row][target_col].m_idx];
1327 r_ptr = &r_info[m_ptr->r_idx];
1328 monster_desc(caster_ptr, m_name, m_ptr, 0);
1329 if (r_ptr->flagsr & RFR_RES_TELE)
1331 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
1333 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1334 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
1337 else if (r_ptr->level > randint1(100))
1339 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1340 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
1345 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
1346 teleport_monster_to(caster_ptr, floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE);
1350 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1352 (void)fire_beam(caster_ptr, GF_AWAY_ALL, dir, 100);
1356 return teleport_level_other(caster_ptr);
1360 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
1362 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
1363 damage = monspell_bluemage_damage(caster_ptr, (MS_PSY_SPEAR), plev, DAM_ROLL);
1364 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, dir, damage);
1368 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
1369 (void)unlite_area(caster_ptr, 10, 3);
1372 if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
1374 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
1375 trap_creation(caster_ptr, target_row, target_col);
1378 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
1381 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
1382 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
1386 msg_print(_("援軍を召喚した。", "You summon one of your kin."));
1387 for (int k = 0;k < 1; k++)
1389 if (summon_kin_player(caster_ptr, summon_lev, caster_ptr->y, caster_ptr->x, (pet ? PM_FORCE_PET : 0L)))
1391 if (!pet) msg_print(_("召喚された仲間は怒っている!", "The summoned companion is angry!"));
1403 msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!"));
1404 for (int k = 0; k < 1; k++)
1406 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_CYBER, p_mode))
1409 msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!"));
1420 msg_print(_("仲間を召喚した。", "You summon help."));
1421 for (int k = 0; k < 1; k++)
1423 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, 0, p_mode))
1426 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!"));
1438 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
1439 for (int k = 0; k < plev / 15 + 2; k++)
1441 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, 0, (p_mode | u_mode)))
1444 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!"));
1456 msg_print(_("アリを召喚した。", "You summon ants."));
1457 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | p_mode)))
1460 msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!"));
1470 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
1471 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | p_mode)))
1474 msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!"));
1485 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
1486 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | p_mode)))
1489 msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!"));
1500 msg_print(_("ヒドラを召喚した。", "You summon a hydras."));
1501 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HYDRA, (g_mode | p_mode)))
1504 msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!"));
1515 msg_print(_("天使を召喚した!", "You summon an angel!"));
1516 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_ANGEL, (g_mode | p_mode)))
1519 msg_print(_("召喚された天使は怒っている!", "The summoned angel is angry!"));
1529 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
1530 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_DEMON, (g_mode | p_mode)))
1533 msg_print(_("召喚されたデーモンは怒っている!", "The summoned demon is angry!"));
1543 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
1544 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_UNDEAD, (g_mode | p_mode)))
1547 msg_print(_("召喚されたアンデッドは怒っている!", "The summoned undead is angry!"));
1557 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
1558 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_DRAGON, (g_mode | p_mode)))
1561 msg_print(_("召喚されたドラゴンは怒っている!", "The summoned dragon is angry!"));
1569 case MS_S_HI_UNDEAD:
1571 msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!"));
1572 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)))
1575 msg_print(_("召喚された上級アンデッドは怒っている!", "The summoned greater undead is angry!"));
1583 case MS_S_HI_DRAGON:
1585 msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!"));
1586 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)))
1589 msg_print(_("召喚された古代ドラゴンは怒っている!", "The summoned ancient dragon is angry!"));
1599 msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!"));
1600 if (summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_AMBERITES, (g_mode | p_mode | u_mode)))
1603 msg_print(_("召喚されたアンバーの王族は怒っている!", "The summoned Lord of Amber is angry!"));
1614 msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!"));
1615 for (k = 0; k < 1; k++)
1617 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)))
1621 msg_print(_("召喚されたユニーク・モンスターは怒っている!", "The summoned special opponent is angry!"));
1625 for (k = count; k < 1; k++)
1627 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)))
1631 msg_print(_("召喚された上級アンデッドは怒っている!", "The summoned greater undead is angry!"));
1648 msg_print(_("何も現れなかった。", "No one appeared."));
1656 * @brief 青魔法コマンドのメインルーチン /
1657 * do_cmd_cast calls this function if the player's class is 'Blue-Mage'.
1658 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
1660 bool do_cmd_cast_learned(player_type *caster_ptr)
1664 PERCENTAGE minfail = 0;
1665 PLAYER_LEVEL plev = caster_ptr->lev;
1666 monster_power spell;
1668 MANA_POINT need_mana;
1670 if (cmd_limit_confused(caster_ptr)) return FALSE;
1672 if (!get_learned_power(caster_ptr, &n)) return FALSE;
1674 spell = monster_powers[n];
1676 need_mana = mod_need_mana(caster_ptr, spell.smana, 0, REALM_NONE);
1678 /* Verify "dangerous" spells */
1679 if (need_mana > caster_ptr->csp)
1682 msg_print(_("MPが足りません。", "You do not have enough mana to use this power."));
1684 if (!over_exert) return FALSE;
1687 if (!get_check(_("それでも挑戦しますか? ", "Attempt it anyway? "))) return FALSE;
1690 /* Spell failure chance */
1691 chance = spell.fail;
1693 /* Reduce failure rate by "effective" level adjustment */
1694 if (plev > spell.level) chance -= 3 * (plev - spell.level);
1695 else chance += (spell.level - plev);
1697 /* Reduce failure rate by INT/WIS adjustment */
1698 chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[A_INT]] - 1);
1700 chance = mod_spell_chance_1(caster_ptr, chance);
1702 /* Not enough mana to cast */
1703 if (need_mana > caster_ptr->csp)
1705 chance += 5 * (need_mana - caster_ptr->csp);
1708 /* Extract the minimum failure rate */
1709 minfail = adj_mag_fail[caster_ptr->stat_ind[A_INT]];
1711 /* Minimum failure rate */
1712 if (chance < minfail) chance = minfail;
1714 /* Stunning makes spells harder */
1715 if (caster_ptr->stun > 50) chance += 25;
1716 else if (caster_ptr->stun) chance += 15;
1718 /* Always a 5 percent chance of working */
1719 if (chance > 95) chance = 95;
1721 chance = mod_spell_chance_2(caster_ptr, chance);
1724 if (randint0(100) < chance)
1726 if (flush_failure) flush();
1727 msg_print(_("魔法をうまく唱えられなかった。", "You failed to concentrate hard enough!"));
1732 cast = cast_learned_spell(caster_ptr, n, FALSE);
1737 cast = cast_learned_spell(caster_ptr, n, TRUE);
1738 if (!cast) return FALSE;
1741 /* Sufficient mana */
1742 if (need_mana <= caster_ptr->csp)
1745 caster_ptr->csp -= need_mana;
1749 int oops = need_mana;
1752 caster_ptr->csp = 0;
1753 caster_ptr->csp_frac = 0;
1755 msg_print(_("精神を集中しすぎて気を失ってしまった!", "You faint from the effort!"));
1757 /* Hack -- Bypass free action */
1758 (void)set_paralyzed(caster_ptr, caster_ptr->paralyzed + randint1(5 * oops + 1));
1760 chg_virtue(caster_ptr, V_KNOWLEDGE, -10);
1762 /* Damage CON (possibly permanently) */
1763 if (randint0(100) < 50)
1765 bool perm = (randint0(100) < 25);
1767 msg_print(_("体を悪くしてしまった!", "You have damaged your health!"));
1769 /* Reduce constitution */
1770 (void)dec_stat(caster_ptr, A_CON, 15 + randint1(10), perm);
1774 take_turn(caster_ptr, 100);
1776 caster_ptr->redraw |= (PR_MANA);
1777 caster_ptr->window |= (PW_PLAYER | PW_SPELL);
1784 * @brief 青魔法のラーニング判定と成功した場合のラーニング処理
1785 * @param monspell ラーニングを試みるモンスター攻撃のID
1788 void learn_spell(player_type *learner_ptr, int monspell)
1790 if (learner_ptr->action != ACTION_LEARN) return;
1791 if (monspell < 0) return;
1792 if (learner_ptr->magic_num2[monspell]) return;
1793 if (learner_ptr->confused || learner_ptr->blind || learner_ptr->image || learner_ptr->stun || learner_ptr->paralyzed) return;
1794 if (randint1(learner_ptr->lev + 70) > monster_powers[monspell].level + 40)
1796 learner_ptr->magic_num2[monspell] = 1;
1797 msg_format(_("%sを学習した!", "You have learned %s!"), monster_powers[monspell].name);
1798 gain_exp(learner_ptr, monster_powers[monspell].level * monster_powers[monspell].smana);
1802 learner_ptr->new_mane = TRUE;
1803 learner_ptr->redraw |= (PR_STATE);
1809 * todo f4, f5, f6を構造体にまとめ直す
1810 * @brief モンスター特殊能力のフラグ配列から特定条件の魔法だけを抜き出す処理
1811 * Extract monster spells mask for the given mode
1812 * @param f4 モンスター特殊能力の4番目のフラグ配列
1813 * @param f5 モンスター特殊能力の5番目のフラグ配列
1814 * @param f6 モンスター特殊能力の6番目のフラグ配列
1815 * @param mode 抜き出したい条件
1820 void set_rf_masks(BIT_FLAGS *f4, BIT_FLAGS *f5, BIT_FLAGS *f6, BIT_FLAGS mode)
1824 case MONSPELL_TYPE_BOLT:
1825 *f4 = ((RF4_BOLT_MASK | RF4_BEAM_MASK) & ~(RF4_ROCKET));
1826 *f5 = RF5_BOLT_MASK | RF5_BEAM_MASK;
1827 *f6 = RF6_BOLT_MASK | RF6_BEAM_MASK;
1830 case MONSPELL_TYPE_BALL:
1831 *f4 = (RF4_BALL_MASK & ~(RF4_BREATH_MASK));
1832 *f5 = (RF5_BALL_MASK & ~(RF5_BREATH_MASK));
1833 *f6 = (RF6_BALL_MASK & ~(RF6_BREATH_MASK));
1836 case MONSPELL_TYPE_BREATH:
1837 *f4 = RF4_BREATH_MASK;
1838 *f5 = RF5_BREATH_MASK;
1839 *f6 = RF6_BREATH_MASK;
1842 case MONSPELL_TYPE_SUMMON:
1843 *f4 = RF4_SUMMON_MASK;
1844 *f5 = RF5_SUMMON_MASK;
1845 *f6 = RF6_SUMMON_MASK;
1848 case MONSPELL_TYPE_OTHER:
1849 *f4 = RF4_ATTACK_MASK & ~(RF4_BOLT_MASK | RF4_BEAM_MASK | RF4_BALL_MASK | RF4_INDIRECT_MASK);
1850 *f5 = RF5_ATTACK_MASK & ~(RF5_BOLT_MASK | RF5_BEAM_MASK | RF5_BALL_MASK | RF5_INDIRECT_MASK);
1851 *f6 = RF6_ATTACK_MASK & ~(RF6_BOLT_MASK | RF6_BEAM_MASK | RF6_BALL_MASK | RF6_INDIRECT_MASK);