OSDN Git Service

[Refactor] #37285 Separated specified-summon.c/h from mspell-summon.c/h
[hengband/hengband.git] / src / mspell / specified-summon.c
1 #include "mspell/specified-summon.h"
2 #include "effect/effect-characteristics.h"
3 #include "floor/cave.h"
4 #include "floor/floor.h"
5 #include "monster-floor/monster-summon.h"
6 #include "monster-floor/place-monster-types.h"
7 #include "monster-race/monster-race.h"
8 #include "monster-race/race-indice-types.h"
9 #include "monster/monster-info.h"
10 #include "mspell/mspell-util.h"
11 #include "mspell/mspells1.h"
12 #include "spell-kind/spells-launcher.h"
13 #include "spell/process-effect.h"
14 #include "spell/spell-types.h"
15 #include "spell/spells-summon.h"
16 #include "view/display-messages.h"
17
18 /*!
19  * @brief 鷹召喚の処理。 /
20  * @param target_ptr プレーヤーへの参照ポインタ
21  * @param y 対象の地点のy座標
22  * @param x 対象の地点のx座標
23  * @param rlev 呪文を唱えるモンスターのレベル
24  * @param m_idx 呪文を唱えるモンスターID
25  * @return 召喚したモンスターの数を返す。
26  */
27 MONSTER_NUMBER summon_EAGLE(player_type *target_ptr, POSITION y, POSITION x, int rlev, MONSTER_IDX m_idx)
28 {
29     int count = 0;
30     int num = 4 + randint1(3);
31     for (int k = 0; k < num; k++) {
32         count += summon_specific(target_ptr, m_idx, y, x, rlev, SUMMON_EAGLES, PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
33     }
34
35     return count;
36 }
37
38 /*!
39  * @brief インターネット・エクスプローダー召喚の処理。 /
40  * @param target_ptr プレーヤーへの参照ポインタ
41  * @param y 対象の地点のy座標
42  * @param x 対象の地点のx座標
43  * @param rlev 呪文を唱えるモンスターのレベル
44  * @param m_idx 呪文を唱えるモンスターID
45  * @return 召喚したモンスターの数を返す。
46  */
47 MONSTER_NUMBER summon_IE(player_type *target_ptr, POSITION y, POSITION x, int rlev, MONSTER_IDX m_idx)
48 {
49     int count = 0;
50     int num = 2 + randint1(1 + rlev / 20);
51     for (int k = 0; k < num; k++) {
52         count += summon_named_creature(target_ptr, m_idx, y, x, MON_IE, PM_NONE);
53     }
54
55     return count;
56 }
57
58 /*!
59  * @brief ダンジョンの主召喚の処理。 /
60  * @param target_ptr プレーヤーへの参照ポインタ
61  * @param y 対象の地点のy座標
62  * @param x 対象の地点のx座標
63  * @param rlev 呪文を唱えるモンスターのレベル
64  * @param m_idx 呪文を唱えるモンスターID
65  * @param t_idx 呪文を受けるモンスターID。プレイヤーの場合はdummyで0とする。
66  * @param TARGET_TYPE プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
67  * @return 召喚したモンスターの数を返す。
68  */
69 MONSTER_NUMBER summon_guardian(player_type *target_ptr, POSITION y, POSITION x, int rlev, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
70 {
71     int num = 2 + randint1(3);
72     bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
73     bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
74
75     if (r_info[MON_JORMUNGAND].cur_num < r_info[MON_JORMUNGAND].max_num && one_in_(6)) {
76         simple_monspell_message(target_ptr, m_idx, t_idx, _("地面から水が吹き出した!", "Water blew off from the ground!"),
77             _("地面から水が吹き出した!", "Water blew off from the ground!"), TARGET_TYPE);
78
79         if (mon_to_player)
80             fire_ball_hide(target_ptr, GF_WATER_FLOW, 0, 3, 8);
81         else if (mon_to_mon)
82             project(target_ptr, t_idx, 8, y, x, 3, GF_WATER_FLOW, PROJECT_GRID | PROJECT_HIDE, -1);
83     }
84
85     int count = 0;
86     for (int k = 0; k < num; k++) {
87         count += summon_specific(target_ptr, m_idx, y, x, rlev, SUMMON_GUARDIANS, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
88     }
89
90     return count;
91 }
92
93 /*!
94  * @brief ロックのクローン召喚の処理。 /
95  * @param target_ptr プレーヤーへの参照ポインタ
96  * @param y 対象の地点のy座標
97  * @param x 対象の地点のx座標
98  * @param m_idx 呪文を唱えるモンスターID
99  * @return 召喚したモンスターの数を返す。
100  */
101 MONSTER_NUMBER summon_LOCKE_CLONE(player_type *target_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx)
102 {
103     int count = 0;
104     int num = randint1(3);
105     for (int k = 0; k < num; k++) {
106         count += summon_named_creature(target_ptr, m_idx, y, x, MON_LOCKE_CLONE, PM_NONE);
107     }
108
109     return count;
110 }
111
112 /*!
113  * @brief シラミ召喚の処理。 /
114  * @param target_ptr プレーヤーへの参照ポインタ
115  * @param y 対象の地点のy座標
116  * @param x 対象の地点のx座標
117  * @param rlev 呪文を唱えるモンスターのレベル
118  * @param m_idx 呪文を唱えるモンスターID
119  * @return 召喚したモンスターの数を返す。
120  */
121 MONSTER_NUMBER summon_LOUSE(player_type *target_ptr, POSITION y, POSITION x, int rlev, MONSTER_IDX m_idx)
122 {
123     int count = 0;
124     int num = 2 + randint1(3);
125     for (int k = 0; k < num; k++) {
126         count += summon_specific(target_ptr, m_idx, y, x, rlev, SUMMON_LOUSE, PM_ALLOW_GROUP);
127     }
128
129     return count;
130 }
131
132 MONSTER_NUMBER summon_MOAI(player_type *target_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx)
133 {
134     int count = 0;
135     int num = 3 + randint1(3);
136     for (int k = 0; k < num; k++)
137         count += summon_named_creature(target_ptr, m_idx, y, x, MON_SMALL_MOAI, PM_NONE);
138
139     return count;
140 }
141
142 MONSTER_NUMBER summon_DEMON_SLAYER(player_type *target_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx)
143 {
144     int count = 0;
145     const int num = 5;
146     for (int k = 0; k < num; k++)
147         count += summon_named_creature(target_ptr, m_idx, y, x, MON_DEMON_SLAYER_MEMBER, PM_NONE);
148
149     return count;
150 }
151
152 /*!
153  * @brief ナズグル戦隊召喚の処理。 /
154  * @param target_ptr プレーヤーへの参照ポインタ
155  * @param y 対象の地点のy座標
156  * @param x 対象の地点のx座標
157  * @param m_idx 呪文を唱えるモンスターID
158  * @return 召喚したモンスターの数を返す。
159  */
160 MONSTER_NUMBER summon_NAZGUL(player_type *target_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx)
161 {
162     BIT_FLAGS mode = 0L;
163     POSITION cy = y;
164     POSITION cx = x;
165     GAME_TEXT m_name[MAX_NLEN];
166     monster_name(target_ptr, m_idx, m_name);
167
168     if (target_ptr->blind)
169         msg_format(_("%^sが何かをつぶやいた。", "%^s mumbles."), m_name);
170     else
171         msg_format(_("%^sが魔法で幽鬼戦隊を召喚した!", "%^s magically summons rangers of Nazgul!"), m_name);
172
173     msg_print(NULL);
174
175     int count = 0;
176     for (int k = 0; k < 30; k++) {
177         if (!summon_possible(target_ptr, cy, cx) || !is_cave_empty_bold(target_ptr, cy, cx)) {
178             int j;
179             for (j = 100; j > 0; j--) {
180                 scatter(target_ptr, &cy, &cx, y, x, 2, 0);
181                 if (is_cave_empty_bold(target_ptr, cy, cx))
182                     break;
183             }
184
185             if (!j)
186                 break;
187         }
188
189         if (!is_cave_empty_bold(target_ptr, cy, cx))
190             continue;
191
192         if (!summon_named_creature(target_ptr, m_idx, cy, cx, MON_NAZGUL, mode))
193             continue;
194
195         y = cy;
196         x = cx;
197         count++;
198         if (count == 1)
199             msg_format(_("「幽鬼戦隊%d号、ナズグル・ブラック!」", "A Nazgul says 'Nazgul-Rangers Number %d, Nazgul-Black!'"), count);
200         else
201             msg_format(_("「同じく%d号、ナズグル・ブラック!」", "Another one says 'Number %d, Nazgul-Black!'"), count);
202
203         msg_print(NULL);
204     }
205
206     msg_format(_("「%d人そろって、リングレンジャー!」", "They say 'The %d meets! We are the Ring-Ranger!'."), count);
207     msg_print(NULL);
208     return count;
209 }