OSDN Git Service

[Fix] #39587 misc_english_usage_patch.txt に従い英文校正 / Proofreading English in complianc...
[hengband/hengband.git] / src / spells-summon.c
1 #include "angband.h"
2 #include "util.h"
3
4 #include "spells.h"
5 #include "spells-summon.h"
6 #include "player-inventory.h"
7 #include "monster-status.h"
8 #include "floor.h"
9
10 /*!
11 * @brief トランプ魔法独自の召喚処理を行う / Handle summoning and failure of trump spells
12 * @param num summon_specific()関数を呼び出す回数
13 * @param pet ペット化として召喚されるか否か
14 * @param y 召喚位置のy座標
15 * @param x 召喚位置のx座標
16 * @param lev 召喚レベル
17 * @param type 召喚条件ID
18 * @param mode モンスター生成条件フラグ
19 * @return モンスターが(敵対も含めて)召還されたならばTRUEを返す。
20 */
21 bool trump_summoning(player_type *caster_ptr, int num, bool pet, POSITION y, POSITION x, DEPTH lev, int type, BIT_FLAGS mode)
22 {
23         PLAYER_LEVEL plev = caster_ptr->lev;
24
25         MONSTER_IDX who;
26         int i;
27         bool success = FALSE;
28
29         /* Default level */
30         if (!lev) lev = plev * 2 / 3 + randint1(plev / 2);
31
32         if (pet)
33         {
34                 /* Become pet */
35                 mode |= PM_FORCE_PET;
36
37                 /* Only sometimes allow unique monster */
38                 if (mode & PM_ALLOW_UNIQUE)
39                 {
40                         /* Forbid often */
41                         if (randint1(50 + plev) >= plev / 10)
42                                 mode &= ~PM_ALLOW_UNIQUE;
43                 }
44
45                 /* Player is who summons */
46                 who = -1;
47         }
48         else
49         {
50                 /* Prevent taming, allow unique monster */
51                 mode |= PM_NO_PET;
52
53                 /* Behave as if they appear by themselfs */
54                 who = 0;
55         }
56
57         for (i = 0; i < num; i++)
58         {
59                 if (summon_specific(who, y, x, lev, type, mode))
60                         success = TRUE;
61         }
62
63         if (!success)
64         {
65                 msg_print(_("誰もあなたのカードの呼び声に答えない。", "Nobody answers to your Trump call."));
66         }
67
68         return success;
69 }
70
71
72 bool cast_summon_demon(player_type *caster_ptr, int power)
73 {
74         u32b flg = 0L;
75         bool pet = !one_in_(3);
76
77         if (pet) flg |= PM_FORCE_PET;
78         else flg |= PM_NO_PET;
79         if (!(pet && (caster_ptr->lev < 50))) flg |= PM_ALLOW_GROUP;
80
81         if (summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, power, SUMMON_DEMON, flg))
82         {
83                 msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
84                 if (pet)
85                 {
86                         msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
87                 }
88                 else
89                 {
90                         msg_print(_("「卑しき者よ、我は汝の下僕にあらず! お前の魂を頂くぞ!」",
91                                 "'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'"));
92                 }
93         }
94         return TRUE;
95 }
96
97 bool cast_summon_undead(player_type *creature_ptr, int power)
98 {
99         bool pet = one_in_(3);
100         int type;
101         BIT_FLAGS mode = 0L;
102
103         type = (creature_ptr->lev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
104
105         if (!pet || ((creature_ptr->lev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
106         if (pet) mode |= PM_FORCE_PET;
107         else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
108
109         if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, power, type, mode))
110         {
111                 msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
112                         "Cold winds begin to blow around you, carrying with them the stench of decay..."));
113                 if (pet)
114                         msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
115                                 "Ancient, long-dead forms arise from the ground to serve you!"));
116                 else
117                         msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
118                                 "'The dead arise... to punish you for disturbing them!'"));
119         }
120         return TRUE;
121 }
122
123
124 bool cast_summon_hound(player_type *creature_ptr, int power)
125 {
126         BIT_FLAGS mode = PM_ALLOW_GROUP;
127         bool pet = !one_in_(5);
128         if (pet) mode |= PM_FORCE_PET;
129         else mode |= PM_NO_PET;
130
131         if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, power, SUMMON_HOUND, mode))
132         {
133                 if (pet)
134                         msg_print(_("ハウンドがあなたの下僕として出現した。", "A group of hounds appear as your servant."));
135                 else
136                         msg_print(_("ハウンドはあなたに牙を向けている!", "A group of hounds appear as your enemy!"));
137         }
138         return TRUE;
139 }
140
141 bool cast_summon_elemental(player_type *creature_ptr, int power)
142 {
143         bool pet = one_in_(3);
144         BIT_FLAGS mode = 0L;
145
146         if (!(pet && (creature_ptr->lev < 50))) mode |= PM_ALLOW_GROUP;
147         if (pet) mode |= PM_FORCE_PET;
148         else mode |= PM_NO_PET;
149
150         if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, power, SUMMON_ELEMENTAL, mode))
151         {
152                 msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
153                 if (pet)
154                         msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
155                 else
156                         msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
157         }
158
159         return TRUE;
160 }
161
162
163 bool cast_summon_octopus(player_type *creature_ptr)
164 {
165         BIT_FLAGS mode = PM_ALLOW_GROUP;
166         bool pet = !one_in_(5);
167         if (pet) mode |= PM_FORCE_PET;
168
169         if (summon_named_creature(0, creature_ptr->y, creature_ptr->x, MON_JIZOTAKO, mode))
170         {
171                 if (pet)
172                         msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant."));
173                 else
174                         msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemy!"));
175         }
176
177         return TRUE;
178 }
179
180 /*!
181 * @brief 悪魔領域のグレーターデーモン召喚に利用可能な死体かどうかを返す。 / An "item_tester_hook" for offer
182 * @param o_ptr オブジェクト構造体の参照ポインタ
183 * @return 生贄に使用可能な死体ならばTRUEを返す。
184 */
185 bool item_tester_offer(object_type *o_ptr)
186 {
187         /* Flasks of oil are okay */
188         if (o_ptr->tval != TV_CORPSE) return (FALSE);
189         if (o_ptr->sval != SV_CORPSE) return (FALSE);
190
191         if (my_strchr("pht", r_info[o_ptr->pval].d_char)) return (TRUE);
192
193         /* Assume not okay */
194         return (FALSE);
195 }
196
197 /*!
198 * @brief 悪魔領域のグレーターデーモン召喚を処理する / Daemon spell Summon Greater Demon
199 * @return 処理を実行したならばTRUEを返す。
200 */
201 bool cast_summon_greater_demon(player_type *caster_ptr)
202 {
203         PLAYER_LEVEL plev = caster_ptr->lev;
204         OBJECT_IDX item;
205         concptr q, s;
206         int summon_lev;
207         object_type *o_ptr;
208
209         item_tester_hook = item_tester_offer;
210         q = _("どの死体を捧げますか? ", "Sacrifice which corpse? ");
211         s = _("捧げられる死体を持っていない。", "You have nothing to scrifice.");
212         o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
213         if (!o_ptr) return FALSE;
214
215         summon_lev = plev * 2 / 3 + r_info[o_ptr->pval].level;
216
217         if (summon_specific(-1, caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HI_DEMON, (PM_ALLOW_GROUP | PM_FORCE_PET)))
218         {
219                 msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
220                 msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
221                 vary_item(caster_ptr, item, -1);
222         }
223         else
224         {
225                 msg_print(_("悪魔は現れなかった。", "No Greater Demon arrive."));
226         }
227
228         return TRUE;
229 }
230
231 /*!
232  * @brief 同族召喚(援軍)処理
233  * @param level 召喚基準レベル
234  * @param y 召喚先Y座標
235  * @param x 召喚先X座標
236  * @param mode 召喚オプション
237  * @return ターンを消費した場合TRUEを返す
238  */
239 bool summon_kin_player(DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode)
240 {
241         bool pet = (bool)(mode & PM_FORCE_PET);
242         if (!pet) mode |= PM_NO_PET;
243         return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, mode);
244 }
245
246 /*!
247  * @brief サイバーデーモンの召喚
248  * @param who 召喚主のモンスターID(0ならばプレイヤー)
249  * @param y 召喚位置Y座標
250  * @param x 召喚位置X座標
251  * @return 作用が実際にあった場合TRUEを返す
252  */
253 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
254 {
255         int i;
256         int max_cyber = (easy_band ? 1 : (p_ptr->current_floor_ptr->dun_level / 50) + randint1(2));
257         int count = 0;
258         BIT_FLAGS mode = PM_ALLOW_GROUP;
259
260         /* Summoned by a monster */
261         if (who > 0)
262         {
263                 monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[who];
264                 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
265         }
266
267         if (max_cyber > 4) max_cyber = 4;
268
269         for (i = 0; i < max_cyber; i++)
270         {
271                 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
272         }
273
274         return count;
275 }
276
277
278 void mitokohmon(player_type *kohmon_ptr)
279 {
280         int count = 0, i;
281         monster_type *m_ptr;
282         concptr kakusan = "";
283
284         if (summon_named_creature(0, kohmon_ptr->y, kohmon_ptr->x, MON_SUKE, PM_FORCE_PET))
285         {
286                 msg_print(_("『助さん』が現れた。", "Suke-san apperars."));
287                 kakusan = "Suke-san";
288                 count++;
289         }
290         if (summon_named_creature(0, kohmon_ptr->y, kohmon_ptr->x, MON_KAKU, PM_FORCE_PET))
291         {
292                 msg_print(_("『格さん』が現れた。", "Kaku-san appears."));
293                 kakusan = "Kaku-san";
294                 count++;
295         }
296         if (!count)
297         {
298                 for (i = kohmon_ptr->current_floor_ptr->m_max - 1; i > 0; i--)
299                 {
300                         m_ptr = &kohmon_ptr->current_floor_ptr->m_list[i];
301                         if (!monster_is_valid(m_ptr)) continue;
302                         if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
303                         if (!los(kohmon_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, kohmon_ptr->y, kohmon_ptr->x)) continue;
304                         if (!projectable(kohmon_ptr->current_floor_ptr, m_ptr->fy, m_ptr->fx, kohmon_ptr->y, kohmon_ptr->x)) continue;
305                         count++;
306                         break;
307                 }
308         }
309
310         if (count)
311         {
312                 msg_format(_("「者ども、ひかえおろう!!!このお方をどなたとこころえる。」",
313                         "%^s says 'WHO do you think this person is! Bow your head, down to your knees!'"), kakusan);
314                 sukekaku = TRUE;
315                 stun_monsters(kohmon_ptr, 120);
316                 confuse_monsters(kohmon_ptr, 120);
317                 turn_monsters(kohmon_ptr, 120);
318                 stasis_monsters(kohmon_ptr, 120);
319                 sukekaku = FALSE;
320         }
321         else
322         {
323                 msg_print(_("しかし、何も起きなかった。", "Nothing happen."));
324         }
325 }