1 #include "mspell/mspell-bolt.h"
2 #include "effect/attribute-types.h"
3 #include "effect/effect-processor.h"
4 #include "main/sound-definitions-table.h"
5 #include "main/sound-of-music.h"
6 #include "mind/drs-types.h"
7 #include "monster-race/race-ability-flags.h"
8 #include "monster/monster-info.h"
9 #include "monster/monster-update.h"
10 #include "mspell/mspell-checker.h"
11 #include "mspell/mspell-damage-calculator.h"
12 #include "mspell/mspell-result.h"
13 #include "mspell/mspell-util.h"
14 #include "system/floor-type-definition.h"
15 #include "system/player-type-definition.h"
18 * @brief RF4_SHOOTの処理。射撃。 /
19 * @param player_ptr プレイヤーへの参照ポインタ
22 * @param m_idx 呪文を唱えるモンスターID
23 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
24 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
28 MonsterSpellResult spell_RF4_SHOOT(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
30 mspell_cast_msg_blind msg(_("%^sが奇妙な音を発した。", "%^s makes a strange noise."),
31 _("%^sが矢を放った。", "%^s fires an arrow."),
32 _("%^sが%sに矢を放った。", "%^s fires an arrow at %s."));
34 bool notice = monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
40 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::SHOOT, m_idx, DAM_ROLL);
41 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::MONSTER_SHOOT, dam, target_type);
43 auto res = MonsterSpellResult::make_valid(dam);
44 res.learnable = proj_res.affected_player;
50 * @brief RF5_BO_ACIDの処理。アシッド・ボルト。 /
51 * @param player_ptr プレイヤーへの参照ポインタ
54 * @param m_idx 呪文を唱えるモンスターID
55 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
56 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
60 MonsterSpellResult spell_RF5_BO_ACID(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
62 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
63 _("%^sがアシッド・ボルトの呪文を唱えた。", "%^s casts an acid bolt."),
64 _("%sが%sに向かってアシッド・ボルトの呪文を唱えた。", "%^s casts an acid bolt at %s."));
66 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
68 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::BO_ACID, m_idx, DAM_ROLL);
69 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::ACID, dam, target_type);
70 if (target_type == MONSTER_TO_PLAYER) {
71 update_smart_learn(player_ptr, m_idx, DRS_ACID);
72 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
75 auto res = MonsterSpellResult::make_valid(dam);
76 res.learnable = proj_res.affected_player;
82 * @brief RF5_BO_ELECの処理。サンダー・ボルト。 /
83 * @param player_ptr プレイヤーへの参照ポインタ
86 * @param m_idx 呪文を唱えるモンスターID
87 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
88 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
92 MonsterSpellResult spell_RF5_BO_ELEC(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
94 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
95 _("%^sがサンダー・ボルトの呪文を唱えた。", "%^s casts a lightning bolt."),
96 _("%^sが%sに向かってサンダー・ボルトの呪文を唱えた。", "%^s casts a lightning bolt at %s."));
98 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
100 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::BO_ELEC, m_idx, DAM_ROLL);
101 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::ELEC, dam, target_type);
102 if (target_type == MONSTER_TO_PLAYER) {
103 update_smart_learn(player_ptr, m_idx, DRS_ELEC);
104 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
107 auto res = MonsterSpellResult::make_valid(dam);
108 res.learnable = proj_res.affected_player;
114 * @brief RF5_BO_FIREの処理。ファイア・ボルト。 /
115 * @param player_ptr プレイヤーへの参照ポインタ
118 * @param m_idx 呪文を唱えるモンスターID
119 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
120 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
124 MonsterSpellResult spell_RF5_BO_FIRE(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
126 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
127 _("%^sがファイア・ボルトの呪文を唱えた。", "%^s casts a fire bolt."),
128 _("%^sが%sに向かってファイア・ボルトの呪文を唱えた。", "%^s casts a fire bolt at %s."));
130 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
132 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::BO_FIRE, m_idx, DAM_ROLL);
133 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::FIRE, dam, target_type);
134 if (target_type == MONSTER_TO_PLAYER) {
135 update_smart_learn(player_ptr, m_idx, DRS_FIRE);
136 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
139 auto res = MonsterSpellResult::make_valid(dam);
140 res.learnable = proj_res.affected_player;
146 * @brief RF5_BO_COLDの処理。アイス・ボルト。 /
147 * @param player_ptr プレイヤーへの参照ポインタ
150 * @param m_idx 呪文を唱えるモンスターID
151 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
152 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
156 MonsterSpellResult spell_RF5_BO_COLD(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
158 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
159 _("%^sがアイス・ボルトの呪文を唱えた。", "%^s casts a frost bolt."),
160 _("%^sが%sに向かってアイス・ボルトの呪文を唱えた。", "%^s casts a frost bolt at %s."));
162 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
164 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::BO_COLD, m_idx, DAM_ROLL);
165 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::COLD, dam, target_type);
166 if (target_type == MONSTER_TO_PLAYER) {
167 update_smart_learn(player_ptr, m_idx, DRS_COLD);
168 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
171 auto res = MonsterSpellResult::make_valid(dam);
172 res.learnable = proj_res.affected_player;
178 * @brief RF5_BO_NETHの処理。地獄の矢。 /
179 * @param player_ptr プレイヤーへの参照ポインタ
182 * @param m_idx 呪文を唱えるモンスターID
183 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
184 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
188 MonsterSpellResult spell_RF5_BO_NETH(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
190 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."), _("%^sが地獄の矢の呪文を唱えた。", "%^s casts a nether bolt."),
191 _("%^sが%sに向かって地獄の矢の呪文を唱えた。", "%^s casts a nether bolt at %s."));
193 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
195 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::BO_NETH, m_idx, DAM_ROLL);
196 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::NETHER, dam, target_type);
197 if (target_type == MONSTER_TO_PLAYER) {
198 update_smart_learn(player_ptr, m_idx, DRS_NETH);
199 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
202 auto res = MonsterSpellResult::make_valid(dam);
203 res.learnable = proj_res.affected_player;
209 * @brief RF5_BO_WATEの処理。ウォーター・ボルト。 /
210 * @param player_ptr プレイヤーへの参照ポインタ
213 * @param m_idx 呪文を唱えるモンスターID
214 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
215 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
219 MonsterSpellResult spell_RF5_BO_WATE(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
221 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
222 _("%^sがウォーター・ボルトの呪文を唱えた。", "%^s casts a water bolt."),
223 _("%^sが%sに向かってウォーター・ボルトの呪文を唱えた。", "%^s casts a water bolt at %s."));
225 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
227 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::BO_WATE, m_idx, DAM_ROLL);
228 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::WATER, dam, target_type);
229 if (target_type == MONSTER_TO_PLAYER) {
230 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
233 auto res = MonsterSpellResult::make_valid(dam);
234 res.learnable = proj_res.affected_player;
240 * @brief RF5_BO_MANAの処理。魔力の矢。 /
241 * @param player_ptr プレイヤーへの参照ポインタ
244 * @param m_idx 呪文を唱えるモンスターID
245 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
246 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
250 MonsterSpellResult spell_RF5_BO_MANA(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
252 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."), _("%^sが魔力の矢の呪文を唱えた。", "%^s casts a mana bolt."),
253 _("%^sが%sに向かって魔力の矢の呪文を唱えた。", "%^s casts a mana bolt at %s."));
255 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
257 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::BO_MANA, m_idx, DAM_ROLL);
258 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::MANA, dam, target_type);
259 if (target_type == MONSTER_TO_PLAYER) {
260 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
263 auto res = MonsterSpellResult::make_valid(dam);
264 res.learnable = proj_res.affected_player;
270 * @brief RF5_BO_PLASの処理。プラズマ・ボルト。 /
271 * @param player_ptr プレイヤーへの参照ポインタ
274 * @param m_idx 呪文を唱えるモンスターID
275 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
276 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
280 MonsterSpellResult spell_RF5_BO_PLAS(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
282 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
283 _("%^sがプラズマ・ボルトの呪文を唱えた。", "%^s casts a plasma bolt."),
284 _("%^sが%sに向かってプラズマ・ボルトの呪文を唱えた。", "%^s casts a plasma bolt at %s."));
286 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
288 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::BO_PLAS, m_idx, DAM_ROLL);
289 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::PLASMA, dam, target_type);
290 if (target_type == MONSTER_TO_PLAYER) {
291 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
294 auto res = MonsterSpellResult::make_valid(dam);
295 res.learnable = proj_res.affected_player;
301 * @brief RF5_BO_ICEEの処理。極寒の矢。 /
302 * @param player_ptr プレイヤーへの参照ポインタ
305 * @param m_idx 呪文を唱えるモンスターID
306 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
307 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
311 MonsterSpellResult spell_RF5_BO_ICEE(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
313 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."), _("%^sが極寒の矢の呪文を唱えた。", "%^s casts an ice bolt."),
314 _("%^sが%sに向かって極寒の矢の呪文を唱えた。", "%^s casts an ice bolt at %s."));
316 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
318 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::BO_ICEE, m_idx, DAM_ROLL);
319 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::ICE, dam, target_type);
320 if (target_type == MONSTER_TO_PLAYER) {
321 update_smart_learn(player_ptr, m_idx, DRS_COLD);
322 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
325 auto res = MonsterSpellResult::make_valid(dam);
326 res.learnable = proj_res.affected_player;
332 * @brief RF5_BO_VOIDの処理。ヴォイド・ボルト。 /
333 * @param player_ptr プレイヤーへの参照ポインタ
336 * @param m_idx 呪文を唱えるモンスターID
337 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
338 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
342 MonsterSpellResult spell_RF5_BO_VOID(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
344 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
345 _("%^sがヴォイド・ボルトの呪文を唱えた。", "%^s casts a void bolt."),
346 _("%^sが%sに向かってヴォイド・ボルトの呪文を唱えた。", "%^s casts a void bolt at %s."));
348 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
350 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::BO_VOID, m_idx, DAM_ROLL);
351 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::VOID_MAGIC, dam, target_type);
352 if (target_type == MONSTER_TO_PLAYER) {
353 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
356 auto res = MonsterSpellResult::make_valid(dam);
357 res.learnable = proj_res.affected_player;
363 * @brief RF5_BO_ABYSSの処理。アビス・ボルト。 /
364 * @param player_ptr プレイヤーへの参照ポインタ
367 * @param m_idx 呪文を唱えるモンスターID
368 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
369 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
373 MonsterSpellResult spell_RF5_BO_ABYSS(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
375 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
376 _("%^sがアビス・ボルトの呪文を唱えた。", "%^s casts a abyss bolt."),
377 _("%^sが%sに向かってアビス・ボルトの呪文を唱えた。", "%^s casts a abyss bolt at %s."));
379 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
381 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::BO_ABYSS, m_idx, DAM_ROLL);
382 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::ABYSS, dam, target_type);
383 if (target_type == MONSTER_TO_PLAYER) {
384 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
387 auto res = MonsterSpellResult::make_valid(dam);
388 res.learnable = proj_res.affected_player;
394 * @brief RF5_MISSILEの処理。マジック・ミサイル。 /
395 * @param player_ptr プレイヤーへの参照ポインタ
398 * @param m_idx 呪文を唱えるモンスターID
399 * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
400 * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
404 MonsterSpellResult spell_RF5_MISSILE(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int target_type)
406 mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
407 _("%^sがマジック・ミサイルの呪文を唱えた。", "%^s casts a magic missile."),
408 _("%^sが%sに向かってマジック・ミサイルの呪文を唱えた。", "%^s casts a magic missile at %s."));
410 monspell_message(player_ptr, m_idx, t_idx, msg, target_type);
412 const auto dam = monspell_damage(player_ptr, MonsterAbilityType::MISSILE, m_idx, DAM_ROLL);
413 const auto proj_res = bolt(player_ptr, m_idx, y, x, AttributeType::MISSILE, dam, target_type);
414 if (target_type == MONSTER_TO_PLAYER) {
415 update_smart_learn(player_ptr, m_idx, DRS_REFLECT);
418 auto res = MonsterSpellResult::make_valid(dam);
419 res.learnable = proj_res.affected_player;