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-util.h"
7 #include "blue-magic/learnt-info.h"
8 #include "core/hp-mp-processor.h"
9 #include "floor/cave.h"
10 #include "floor/floor.h"
11 #include "grid/grid.h"
12 #include "io/targeting.h"
13 #include "monster-floor/monster-summon.h"
14 #include "monster-floor/place-monster-types.h"
15 #include "monster-race/monster-race.h"
16 #include "monster-race/race-flags-resistance.h"
17 #include "monster-race/race-flags1.h"
18 #include "monster/monster-describer.h"
19 #include "monster/monster-info.h"
20 #include "monster/monster-status.h"
21 #include "mspell/mspell-damage-calculator.h"
22 #include "mspell/mspell-type.h"
23 #include "spell-kind/spells-launcher.h"
24 #include "spell-kind/spells-lite.h"
25 #include "spell-kind/spells-neighbor.h"
26 #include "spell-kind/spells-sight.h"
27 #include "spell-kind/spells-teleport.h"
28 #include "spell-kind/spells-world.h"
29 #include "spell/spell-types.h"
30 #include "spell/spells-status.h"
31 #include "spell/spells-summon.h"
32 #include "status/bad-status-setter.h"
33 #include "status/body-improvement.h"
34 #include "status/buff-setter.h"
35 #include "system/floor-type-definition.h"
36 #include "view/display-messages.h"
38 static bool cast_blue_dispel(player_type *caster_ptr)
40 if (!target_set(caster_ptr, TARGET_KILL))
43 MONSTER_IDX m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
44 if ((m_idx == 0) || !player_has_los_bold(caster_ptr, target_row, target_col)
45 || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
48 dispel_monster_status(caster_ptr, m_idx);
52 static bool cast_blue_rocket(player_type *caster_ptr, bmc_type *bmc_ptr)
54 if (!get_aim_dir(caster_ptr, &bmc_ptr->dir))
57 msg_print(_("ロケットを発射した。", "You fire a rocket."));
58 bmc_ptr->damage = monspell_bluemage_damage(caster_ptr, (MS_ROCKET), bmc_ptr->plev, DAM_ROLL);
59 fire_rocket(caster_ptr, GF_ROCKET, bmc_ptr->dir, bmc_ptr->damage, 2);
63 static bool cast_blue_shoot(player_type *caster_ptr, bmc_type *bmc_ptr)
65 if (!get_aim_dir(caster_ptr, &bmc_ptr->dir))
68 msg_print(_("矢を放った。", "You fire an arrow."));
69 bmc_ptr->damage = monspell_bluemage_damage(caster_ptr, (MS_SHOOT), bmc_ptr->plev, DAM_ROLL);
70 fire_bolt(caster_ptr, GF_ARROW, bmc_ptr->dir, bmc_ptr->damage);
74 static bool cast_blue_hand_doom(player_type *caster_ptr, bmc_type *bmc_ptr)
76 if (!get_aim_dir(caster_ptr, &bmc_ptr->dir))
79 msg_print(_("<破滅の手>を放った!", "You invoke the Hand of Doom!"));
80 fire_ball_hide(caster_ptr, GF_HAND_DOOM, bmc_ptr->dir, bmc_ptr->plev * 3, 0);
84 static bool exe_blue_teleport_back(player_type *caster_ptr, GAME_TEXT *m_name)
88 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
89 if ((floor_ptr->grid_array[target_row][target_col].m_idx == 0) || !player_has_los_bold(caster_ptr, target_row, target_col)
90 || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col))
93 m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[target_row][target_col].m_idx];
94 r_ptr = &r_info[m_ptr->r_idx];
95 monster_desc(caster_ptr, m_name, m_ptr, 0);
96 if ((r_ptr->flagsr & RFR_RES_TELE) == 0)
99 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flagsr & RFR_RES_ALL)) {
100 if (is_original_ap_and_seen(caster_ptr, m_ptr))
101 r_ptr->r_flagsr |= RFR_RES_TELE;
103 msg_format(_("%sには効果がなかった!", "%s is unaffected!"), m_name);
107 if (r_ptr->level <= randint1(100))
110 if (is_original_ap_and_seen(caster_ptr, m_ptr))
111 r_ptr->r_flagsr |= RFR_RES_TELE;
113 msg_format(_("%sには耐性がある!", "%s resists!"), m_name);
117 bool cast_blue_teleport_back(player_type *caster_ptr)
119 if (!target_set(caster_ptr, TARGET_KILL))
122 GAME_TEXT m_name[MAX_NLEN];
123 if (exe_blue_teleport_back(caster_ptr, m_name))
126 msg_format(_("%sを引き戻した。", "You command %s to return."), m_name);
128 caster_ptr, caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx, caster_ptr->y, caster_ptr->x, 100, TELEPORT_PASSIVE);
132 bool cast_blue_teleport_away(player_type *caster_ptr, bmc_type *bmc_ptr)
134 if (!get_aim_dir(caster_ptr, &bmc_ptr->dir))
137 (void)fire_beam(caster_ptr, GF_AWAY_ALL, bmc_ptr->dir, 100);
143 * do_cmd_cast calls this function if the player's class is 'blue-mage'.
144 * @param spell 発動するモンスター攻撃のID
145 * @param success TRUEは成功時、FALSEは失敗時の処理を行う
146 * @return 処理を実行したらTRUE、キャンセルした場合FALSEを返す。
148 bool cast_learned_spell(player_type *caster_ptr, int spell, const bool success)
151 bmc_type *bmc_ptr = initialize_blue_magic_type(caster_ptr, &tmp_bm, success, get_pseudo_monstetr_level);
154 msg_print(_("かん高い金切り声をあげた。", "You make a high pitched shriek."));
155 aggravate_monsters(caster_ptr, 0);
156 break; // 関数分割後に'return TRUE;' に差し替え.
161 break; // 関数分割後に'return TRUE;' に差し替え.
163 if (!cast_blue_dispel(caster_ptr))
168 if (!cast_blue_rocket(caster_ptr, bmc_ptr))
173 if (!cast_blue_shoot(caster_ptr, bmc_ptr))
178 if (!cast_blue_breath_acid(caster_ptr, bmc_ptr))
183 if (!cast_blue_breath_elec(caster_ptr, bmc_ptr))
188 if (!cast_blue_breath_fire(caster_ptr, bmc_ptr))
193 if (!cast_blue_breath_cold(caster_ptr, bmc_ptr))
198 if (!cast_blue_breath_pois(caster_ptr, bmc_ptr))
203 if (!cast_blue_breath_nether(caster_ptr, bmc_ptr))
208 if (!cast_blue_breath_lite(caster_ptr, bmc_ptr))
213 if (!cast_blue_breath_dark(caster_ptr, bmc_ptr))
218 if (!cast_blue_breath_conf(caster_ptr, bmc_ptr))
223 if (!cast_blue_breath_sound(caster_ptr, bmc_ptr))
228 if (!cast_blue_breath_chaos(caster_ptr, bmc_ptr))
233 if (!cast_blue_breath_disenchant(caster_ptr, bmc_ptr))
238 if (!cast_blue_breath_nexus(caster_ptr, bmc_ptr))
243 if (!cast_blue_breath_time(caster_ptr, bmc_ptr))
248 if (!cast_blue_breath_inertia(caster_ptr, bmc_ptr))
253 if (!cast_blue_breath_gravity(caster_ptr, bmc_ptr))
258 if (!cast_blue_breath_shards(caster_ptr, bmc_ptr))
263 if (!cast_blue_breath_plasma(caster_ptr, bmc_ptr))
268 if (!cast_blue_breath_force(caster_ptr, bmc_ptr))
273 if (!cast_blue_breath_mana(caster_ptr, bmc_ptr))
278 if (!cast_blue_breath_nuke(caster_ptr, bmc_ptr))
283 if (!cast_blue_breath_disintegration(caster_ptr, bmc_ptr))
288 if (!cast_blue_ball_acid(caster_ptr, bmc_ptr))
293 if (!cast_blue_ball_elec(caster_ptr, bmc_ptr))
298 if (!cast_blue_ball_fire(caster_ptr, bmc_ptr))
303 if (!cast_blue_ball_cold(caster_ptr, bmc_ptr))
308 if (!cast_blue_ball_pois(caster_ptr, bmc_ptr))
313 if (!cast_blue_ball_nuke(caster_ptr, bmc_ptr))
318 if (!cast_blue_ball_nether(caster_ptr, bmc_ptr))
323 if (!cast_blue_ball_chaos(caster_ptr, bmc_ptr))
328 if (!cast_blue_ball_water(caster_ptr, bmc_ptr))
333 if (!cast_blue_ball_star_burst(caster_ptr, bmc_ptr))
338 if (!cast_blue_ball_dark_storm(caster_ptr, bmc_ptr))
343 if (!cast_blue_ball_mana_storm(caster_ptr, bmc_ptr))
348 if (!cast_blue_drain_mana(caster_ptr, bmc_ptr))
353 if (!cast_blue_mind_blast(caster_ptr, bmc_ptr))
358 if (!cast_blue_brain_smash(caster_ptr, bmc_ptr))
363 if (!cast_blue_curse_1(caster_ptr, bmc_ptr))
368 if (!cast_blue_curse_2(caster_ptr, bmc_ptr))
373 if (!cast_blue_curse_3(caster_ptr, bmc_ptr))
378 if (!cast_blue_curse_4(caster_ptr, bmc_ptr))
383 if (!cast_blue_bolt_acid(caster_ptr, bmc_ptr))
388 if (!cast_blue_bolt_elec(caster_ptr, bmc_ptr))
393 if (!cast_blue_bolt_fire(caster_ptr, bmc_ptr))
398 if (!cast_blue_bolt_cold(caster_ptr, bmc_ptr))
403 if (!cast_blue_bolt_nether(caster_ptr, bmc_ptr))
408 if (!cast_blue_bolt_water(caster_ptr, bmc_ptr))
413 if (!cast_blue_bolt_mana(caster_ptr, bmc_ptr))
418 if (!cast_blue_bolt_plasma(caster_ptr, bmc_ptr))
423 if (!cast_blue_bolt_icee(caster_ptr, bmc_ptr))
427 case MS_MAGIC_MISSILE:
428 if (!cast_blue_bolt_missile(caster_ptr, bmc_ptr))
433 if (!cast_blue_scare(caster_ptr, bmc_ptr))
438 if (!cast_blue_blind(caster_ptr, bmc_ptr))
443 if (!cast_blue_confusion(caster_ptr, bmc_ptr))
448 if (!cast_blue_slow(caster_ptr, bmc_ptr))
453 if (!cast_blue_sleep(caster_ptr, bmc_ptr))
458 (void)set_fast(caster_ptr, randint1(20 + bmc_ptr->plev) + bmc_ptr->plev, FALSE);
459 break; // 関数分割後に'return TRUE;' に差し替え
461 if (!cast_blue_hand_doom(caster_ptr, bmc_ptr))
466 msg_print(_("自分の傷に念を集中した。", "You concentrate on your wounds!"));
467 (void)hp_player(caster_ptr, bmc_ptr->plev * 4);
468 (void)set_stun(caster_ptr, 0);
469 (void)set_cut(caster_ptr, 0);
470 break; // 関数分割後に'return TRUE;' に差し替え
472 msg_print(_("無傷の球の呪文を唱えた。", "You cast a Globe of Invulnerability."));
473 (void)set_invuln(caster_ptr, randint1(4) + 4, FALSE);
474 break; // 関数分割後に'return TRUE;' に差し替え
476 teleport_player(caster_ptr, 10, TELEPORT_SPONTANEOUS);
477 break; // 関数分割後に'return TRUE;' に差し替え
479 teleport_player(caster_ptr, bmc_ptr->plev * 5, TELEPORT_SPONTANEOUS);
480 break; // 関数分割後に'return TRUE;' に差し替え
482 (void)time_walk(caster_ptr);
483 break; // 関数分割後に'return TRUE;' に差し替え
485 break; // 関数分割後に'return TRUE;' に差し替え
487 if (!cast_blue_teleport_back(caster_ptr))
492 if (!cast_blue_teleport_away(caster_ptr, bmc_ptr))
497 return teleport_level_other(caster_ptr);
499 if (!get_aim_dir(caster_ptr, &bmc_ptr->dir))
502 msg_print(_("光の剣を放った。", "You throw a psycho-spear."));
503 bmc_ptr->damage = monspell_bluemage_damage(caster_ptr, (MS_PSY_SPEAR), bmc_ptr->plev, DAM_ROLL);
504 (void)fire_beam(caster_ptr, GF_PSY_SPEAR, bmc_ptr->dir, bmc_ptr->damage);
507 msg_print(_("暗闇の中で手を振った。", "You gesture in shadow."));
508 (void)unlite_area(caster_ptr, 10, 3);
511 if (!target_set(caster_ptr, TARGET_KILL))
514 msg_print(_("呪文を唱えて邪悪に微笑んだ。", "You cast a spell and cackle evilly."));
515 trap_creation(caster_ptr, target_row, target_col);
518 msg_print(_("しかし何も起きなかった。", "Nothing happen."));
519 break; // 関数分割後に'return TRUE;' に差し替え
521 msg_print(_("死者復活の呪文を唱えた。", "You animate the dead."));
522 (void)animate_dead(caster_ptr, 0, caster_ptr->y, caster_ptr->x);
523 break; // 関数分割後に'return TRUE;' に差し替え
525 msg_print(_("援軍を召喚した。", "You summon one of your kin."));
526 for (int k = 0; k < 1; k++) {
527 if (summon_kin_player(caster_ptr, bmc_ptr->summon_lev, caster_ptr->y, caster_ptr->x, (bmc_ptr->pet ? PM_FORCE_PET : 0L))) {
529 msg_print(_("召喚された仲間は怒っている!", "The summoned companion is angry!"));
531 bmc_ptr->no_trump = TRUE;
538 msg_print(_("サイバーデーモンを召喚した!", "You summon a Cyberdemon!"));
539 for (int k = 0; k < 1; k++) {
540 if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_CYBER, bmc_ptr->p_mode)) {
542 msg_print(_("召喚されたサイバーデーモンは怒っている!", "The summoned Cyberdemon are angry!"));
544 bmc_ptr->no_trump = TRUE;
551 msg_print(_("仲間を召喚した。", "You summon help."));
552 for (int k = 0; k < 1; k++) {
553 if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, 0, bmc_ptr->p_mode)) {
555 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monster is angry!"));
557 bmc_ptr->no_trump = TRUE;
563 case MS_S_MONSTERS: {
564 msg_print(_("モンスターを召喚した!", "You summon monsters!"));
565 for (int k = 0; k < bmc_ptr->plev / 15 + 2; k++) {
566 if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, 0, (bmc_ptr->p_mode | bmc_ptr->u_mode))) {
568 msg_print(_("召喚されたモンスターは怒っている!", "The summoned monsters are angry!"));
570 bmc_ptr->no_trump = TRUE;
577 msg_print(_("アリを召喚した。", "You summon ants."));
579 caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_ANT, (PM_ALLOW_GROUP | bmc_ptr->p_mode))) {
581 msg_print(_("召喚されたアリは怒っている!", "The summoned ants are angry!"));
583 bmc_ptr->no_trump = TRUE;
589 msg_print(_("蜘蛛を召喚した。", "You summon spiders."));
591 caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_SPIDER, (PM_ALLOW_GROUP | bmc_ptr->p_mode))) {
593 msg_print(_("召喚された蜘蛛は怒っている!", "Summoned spiders are angry!"));
595 bmc_ptr->no_trump = TRUE;
601 msg_print(_("ハウンドを召喚した。", "You summon hounds."));
603 caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_HOUND, (PM_ALLOW_GROUP | bmc_ptr->p_mode))) {
605 msg_print(_("召喚されたハウンドは怒っている!", "Summoned hounds are angry!"));
607 bmc_ptr->no_trump = TRUE;
613 msg_print(_("ヒドラを召喚した。", "You summon a hydras."));
615 caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_HYDRA, (bmc_ptr->g_mode | bmc_ptr->p_mode))) {
617 msg_print(_("召喚されたヒドラは怒っている!", "Summoned hydras are angry!"));
619 bmc_ptr->no_trump = TRUE;
625 msg_print(_("天使を召喚した!", "You summon an angel!"));
627 caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_ANGEL, (bmc_ptr->g_mode | bmc_ptr->p_mode))) {
629 msg_print(_("召喚された天使は怒っている!", "The summoned angel is angry!"));
631 bmc_ptr->no_trump = TRUE;
637 msg_print(_("混沌の宮廷から悪魔を召喚した!", "You summon a demon from the Courts of Chaos!"));
639 caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_DEMON, (bmc_ptr->g_mode | bmc_ptr->p_mode))) {
641 msg_print(_("召喚されたデーモンは怒っている!", "The summoned demon is angry!"));
643 bmc_ptr->no_trump = TRUE;
649 msg_print(_("アンデッドの強敵を召喚した!", "You summon an undead adversary!"));
651 caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_UNDEAD, (bmc_ptr->g_mode | bmc_ptr->p_mode))) {
653 msg_print(_("召喚されたアンデッドは怒っている!", "The summoned undead is angry!"));
655 bmc_ptr->no_trump = TRUE;
661 msg_print(_("ドラゴンを召喚した!", "You summon a dragon!"));
663 caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_DRAGON, (bmc_ptr->g_mode | bmc_ptr->p_mode))) {
665 msg_print(_("召喚されたドラゴンは怒っている!", "The summoned dragon is angry!"));
667 bmc_ptr->no_trump = TRUE;
672 case MS_S_HI_UNDEAD: {
673 msg_print(_("強力なアンデッドを召喚した!", "You summon a greater undead!"));
674 if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_HI_UNDEAD,
675 (bmc_ptr->g_mode | bmc_ptr->p_mode | bmc_ptr->u_mode))) {
677 msg_print(_("召喚された上級アンデッドは怒っている!", "The summoned greater undead is angry!"));
679 bmc_ptr->no_trump = TRUE;
684 case MS_S_HI_DRAGON: {
685 msg_print(_("古代ドラゴンを召喚した!", "You summon an ancient dragon!"));
686 if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_HI_DRAGON,
687 (bmc_ptr->g_mode | bmc_ptr->p_mode | bmc_ptr->u_mode))) {
689 msg_print(_("召喚された古代ドラゴンは怒っている!", "The summoned ancient dragon is angry!"));
691 bmc_ptr->no_trump = TRUE;
696 case MS_S_AMBERITE: {
697 msg_print(_("アンバーの王族を召喚した!", "You summon a Lord of Amber!"));
698 if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_AMBERITES,
699 (bmc_ptr->g_mode | bmc_ptr->p_mode | bmc_ptr->u_mode))) {
701 msg_print(_("召喚されたアンバーの王族は怒っている!", "The summoned Lord of Amber is angry!"));
703 bmc_ptr->no_trump = TRUE;
710 msg_print(_("特別な強敵を召喚した!", "You summon a special opponent!"));
711 for (int k = 0; k < 1; k++) {
712 if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_UNIQUE,
713 (bmc_ptr->g_mode | bmc_ptr->p_mode | PM_ALLOW_UNIQUE))) {
716 msg_print(_("召喚されたユニーク・モンスターは怒っている!", "The summoned special opponent is angry!"));
720 for (int k = count; k < 1; k++) {
721 if (summon_specific(caster_ptr, (bmc_ptr->pet ? -1 : 0), caster_ptr->y, caster_ptr->x, bmc_ptr->summon_lev, SUMMON_HI_UNDEAD,
722 (bmc_ptr->g_mode | bmc_ptr->p_mode | PM_ALLOW_UNIQUE))) {
725 msg_print(_("召喚された上級アンデッドは怒っている!", "The summoned greater undead is angry!"));
730 bmc_ptr->no_trump = TRUE;
738 if (bmc_ptr->no_trump)
739 msg_print(_("何も現れなかった。", "No one appeared."));