1 #include "blue-magic/blue-magic-caster.h"
2 #include "blue-magic/blue-magic-ball-bolt.h"
3 #include "blue-magic/blue-magic-breath.h"
4 #include "blue-magic/blue-magic-spirit-curse.h"
5 #include "blue-magic/blue-magic-status.h"
6 #include "blue-magic/blue-magic-summon.h"
7 #include "blue-magic/blue-magic-util.h"
8 #include "blue-magic/learnt-info.h"
9 #include "core/hp-mp-processor.h"
10 #include "floor/cave.h"
11 #include "floor/floor.h"
12 #include "grid/grid.h"
13 #include "io/targeting.h"
14 #include "monster-race/monster-race.h"
15 #include "monster-race/race-flags-resistance.h"
16 #include "monster-race/race-flags1.h"
17 #include "monster/monster-describer.h"
18 #include "monster/monster-info.h"
19 #include "monster/monster-status.h"
20 #include "mspell/mspell-damage-calculator.h"
21 #include "spell-kind/spells-launcher.h"
22 #include "spell-kind/spells-lite.h"
23 #include "spell-kind/spells-neighbor.h"
24 #include "spell-kind/spells-sight.h"
25 #include "spell-kind/spells-teleport.h"
26 #include "spell-kind/spells-world.h"
27 #include "spell/spell-types.h"
28 #include "spell/spells-status.h"
29 #include "status/bad-status-setter.h"
30 #include "status/body-improvement.h"
31 #include "status/buff-setter.h"
32 #include "system/floor-type-definition.h"
33 #include "view/display-messages.h"
35 static bool cast_blue_dispel(player_type *caster_ptr)
37 if (!target_set(caster_ptr, TARGET_KILL))
40 MONSTER_IDX m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
41 if ((m_idx == 0) || !player_has_los_bold(caster_ptr, target_row, target_col)
42 || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
45 dispel_monster_status(caster_ptr, m_idx);
49 static bool cast_blue_rocket(player_type *caster_ptr, bmc_type *bmc_ptr)
51 if (!get_aim_dir(caster_ptr, &bmc_ptr->dir))
54 msg_print(_("ロケットを発射した。", "You fire a rocket."));
55 bmc_ptr->damage = monspell_bluemage_damage(caster_ptr, (MS_ROCKET), bmc_ptr->plev, DAM_ROLL);
56 fire_rocket(caster_ptr, GF_ROCKET, bmc_ptr->dir, bmc_ptr->damage, 2);
60 static bool cast_blue_shoot(player_type *caster_ptr, bmc_type *bmc_ptr)
62 if (!get_aim_dir(caster_ptr, &bmc_ptr->dir))
65 msg_print(_("矢を放った。", "You fire an arrow."));
66 bmc_ptr->damage = monspell_bluemage_damage(caster_ptr, (MS_SHOOT), bmc_ptr->plev, DAM_ROLL);
67 fire_bolt(caster_ptr, GF_ARROW, bmc_ptr->dir, bmc_ptr->damage);
71 static bool cast_blue_hand_doom(player_type *caster_ptr, bmc_type *bmc_ptr)
73 if (!get_aim_dir(caster_ptr, &bmc_ptr->dir))
76 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
77 fire_ball_hide(caster_ptr, GF_HAND_DOOM, bmc_ptr->dir, bmc_ptr->plev * 3, 0);
81 static bool exe_blue_teleport_back(player_type *caster_ptr, GAME_TEXT *m_name)
85 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
86 if ((floor_ptr->grid_array[target_row][target_col].m_idx == 0) || !player_has_los_bold(caster_ptr, target_row, target_col)
87 || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
90 m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[target_row][target_col].m_idx];
91 r_ptr = &r_info[m_ptr->r_idx];
92 monster_desc(caster_ptr, m_name, m_ptr, 0);
93 if ((r_ptr->flagsr & RFR_RES_TELE) == 0)
96 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flagsr & RFR_RES_ALL)) {
97 if (is_original_ap_and_seen(caster_ptr, m_ptr))
98 r_ptr->r_flagsr |= RFR_RES_TELE;
100 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
104 if (r_ptr->level <= randint1(100))
107 if (is_original_ap_and_seen(caster_ptr, m_ptr))
108 r_ptr->r_flagsr |= RFR_RES_TELE;
110 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
114 static bool cast_blue_teleport_back(player_type *caster_ptr)
116 if (!target_set(caster_ptr, TARGET_KILL))
119 GAME_TEXT m_name[MAX_NLEN];
120 if (exe_blue_teleport_back(caster_ptr, m_name))
123 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
125 caster_ptr, caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE);
129 static bool cast_blue_teleport_away(player_type *caster_ptr, bmc_type *bmc_ptr)
131 if (!get_aim_dir(caster_ptr, &bmc_ptr->dir))
134 (void)fire_beam(caster_ptr, GF_AWAY_ALL, bmc_ptr->dir, 100);
138 static bool cast_blue_psy_spear(player_type *caster_ptr, bmc_type *bmc_ptr)
140 if (!get_aim_dir(caster_ptr, &bmc_ptr->dir))
143 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
144 bmc_ptr->damage = monspell_bluemage_damage(caster_ptr, (MS_PSY_SPEAR), bmc_ptr->plev, DAM_ROLL);
145 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, bmc_ptr->dir, bmc_ptr->damage);
149 static bool cast_blue_make_trap(player_type *caster_ptr)
151 if (!target_set(caster_ptr, TARGET_KILL))
154 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
155 trap_creation(caster_ptr, target_row, target_col);
159 bool switch_cast_blue_magic(player_type *caster_ptr, bmc_type *bmc_ptr, SPELL_IDX spell)
163 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
164 aggravate_monsters(caster_ptr, 0);
172 return cast_blue_dispel(caster_ptr);
174 return cast_blue_rocket(caster_ptr, bmc_ptr);
176 return cast_blue_shoot(caster_ptr, bmc_ptr);
178 return cast_blue_breath_acid(caster_ptr, bmc_ptr);
180 return cast_blue_breath_elec(caster_ptr, bmc_ptr);
182 return cast_blue_breath_fire(caster_ptr, bmc_ptr);
184 return cast_blue_breath_cold(caster_ptr, bmc_ptr);
186 return cast_blue_breath_pois(caster_ptr, bmc_ptr);
188 return cast_blue_breath_nether(caster_ptr, bmc_ptr);
190 return cast_blue_breath_lite(caster_ptr, bmc_ptr);
192 return cast_blue_breath_dark(caster_ptr, bmc_ptr);
194 return cast_blue_breath_conf(caster_ptr, bmc_ptr);
196 return cast_blue_breath_sound(caster_ptr, bmc_ptr);
198 return cast_blue_breath_chaos(caster_ptr, bmc_ptr);
200 return cast_blue_breath_disenchant(caster_ptr, bmc_ptr);
202 return cast_blue_breath_nexus(caster_ptr, bmc_ptr);
204 return cast_blue_breath_time(caster_ptr, bmc_ptr);
206 return cast_blue_breath_inertia(caster_ptr, bmc_ptr);
208 return cast_blue_breath_gravity(caster_ptr, bmc_ptr);
210 return cast_blue_breath_shards(caster_ptr, bmc_ptr);
212 return cast_blue_breath_plasma(caster_ptr, bmc_ptr);
214 return cast_blue_breath_force(caster_ptr, bmc_ptr);
216 return cast_blue_breath_mana(caster_ptr, bmc_ptr);
218 return cast_blue_breath_nuke(caster_ptr, bmc_ptr);
220 return cast_blue_breath_disintegration(caster_ptr, bmc_ptr);
222 return cast_blue_ball_acid(caster_ptr, bmc_ptr);
224 return cast_blue_ball_elec(caster_ptr, bmc_ptr);
226 return cast_blue_ball_fire(caster_ptr, bmc_ptr);
228 return cast_blue_ball_cold(caster_ptr, bmc_ptr);
230 return cast_blue_ball_pois(caster_ptr, bmc_ptr);
232 return cast_blue_ball_nuke(caster_ptr, bmc_ptr);
234 return cast_blue_ball_nether(caster_ptr, bmc_ptr);
236 return cast_blue_ball_chaos(caster_ptr, bmc_ptr);
238 return cast_blue_ball_water(caster_ptr, bmc_ptr);
240 return cast_blue_ball_star_burst(caster_ptr, bmc_ptr);
242 return cast_blue_ball_dark_storm(caster_ptr, bmc_ptr);
244 return cast_blue_ball_mana_storm(caster_ptr, bmc_ptr);
246 return cast_blue_drain_mana(caster_ptr, bmc_ptr);
248 return cast_blue_mind_blast(caster_ptr, bmc_ptr);
250 return cast_blue_brain_smash(caster_ptr, bmc_ptr);
252 return cast_blue_curse_1(caster_ptr, bmc_ptr);
254 return cast_blue_curse_2(caster_ptr, bmc_ptr);
256 return cast_blue_curse_3(caster_ptr, bmc_ptr);
258 return cast_blue_curse_4(caster_ptr, bmc_ptr);
260 return cast_blue_bolt_acid(caster_ptr, bmc_ptr);
262 return cast_blue_bolt_elec(caster_ptr, bmc_ptr);
264 return !cast_blue_bolt_fire(caster_ptr, bmc_ptr);
266 return cast_blue_bolt_cold(caster_ptr, bmc_ptr);
268 return cast_blue_bolt_nether(caster_ptr, bmc_ptr);
270 return cast_blue_bolt_water(caster_ptr, bmc_ptr);
272 return cast_blue_bolt_mana(caster_ptr, bmc_ptr);
274 return cast_blue_bolt_plasma(caster_ptr, bmc_ptr);
276 return cast_blue_bolt_icee(caster_ptr, bmc_ptr);
277 case MS_MAGIC_MISSILE:
278 return cast_blue_bolt_missile(caster_ptr, bmc_ptr);
280 return cast_blue_scare(caster_ptr, bmc_ptr);
282 return cast_blue_blind(caster_ptr, bmc_ptr);
284 return cast_blue_confusion(caster_ptr, bmc_ptr);
286 return cast_blue_slow(caster_ptr, bmc_ptr);
288 return cast_blue_sleep(caster_ptr, bmc_ptr);
290 (void)set_fast(caster_ptr, randint1(20 + bmc_ptr->plev) + bmc_ptr->plev, FALSE);
293 return cast_blue_hand_doom(caster_ptr, bmc_ptr);
295 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
296 (void)hp_player(caster_ptr, bmc_ptr->plev * 4);
297 (void)set_stun(caster_ptr, 0);
298 (void)set_cut(caster_ptr, 0);
301 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
302 (void)set_invuln(caster_ptr, randint1(4) + 4, FALSE);
305 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
308 teleport_player(caster_ptr, bmc_ptr->plev * 5, TELEPORT_SPONTANEOUS);
311 (void)time_walk(caster_ptr);
316 return cast_blue_teleport_back(caster_ptr);
318 return cast_blue_teleport_away(caster_ptr, bmc_ptr);
320 return teleport_level_other(caster_ptr);
322 return cast_blue_psy_spear(caster_ptr, bmc_ptr);
324 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
325 (void)unlite_area(caster_ptr, 10, 3);
328 return cast_blue_make_trap(caster_ptr);
330 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
333 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
334 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
337 return cast_blue_summon_kin(caster_ptr, bmc_ptr);
339 return cast_blue_summon_cyber(caster_ptr, bmc_ptr);
341 return cast_blue_summon_monster(caster_ptr, bmc_ptr);
343 return cast_blue_summon_monsters(caster_ptr, bmc_ptr);
345 return cast_blue_summon_ant(caster_ptr, bmc_ptr);
347 return cast_blue_summon_spider(caster_ptr, bmc_ptr);
349 return cast_blue_summon_hound(caster_ptr, bmc_ptr);
351 return cast_blue_summon_hydra(caster_ptr, bmc_ptr);
353 return cast_blue_summon_angel(caster_ptr, bmc_ptr);
355 return cast_blue_summon_demon(caster_ptr, bmc_ptr);
357 return cast_blue_summon_undead(caster_ptr, bmc_ptr);
359 return cast_blue_summon_dragon(caster_ptr, bmc_ptr);
361 return cast_blue_summon_high_undead(caster_ptr, bmc_ptr);
363 return cast_blue_summon_high_dragon(caster_ptr, bmc_ptr);
365 return cast_blue_summon_amberite(caster_ptr, bmc_ptr);
367 return cast_blue_summon_unique(caster_ptr, bmc_ptr);
376 * do_cmd_cast calls this function if the player's class is 'blue-mage'.
377 * @param spell 発動するモンスター攻撃のID
378 * @param success TRUEは成功時、FALSEは失敗時の処理を行う
379 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
381 bool cast_learned_spell(player_type *caster_ptr, SPELL_IDX spell, const bool success)
384 bmc_type *bmc_ptr = initialize_blue_magic_type(caster_ptr, &tmp_bm, success, get_pseudo_monstetr_level);
385 if (switch_cast_blue_magic(caster_ptr, bmc_ptr, spell))
388 if (bmc_ptr->no_trump)
389 msg_print(_("何も現れなかった。", "No one appeared."));