OSDN Git Service

Replaced "spelling" with "spell casting" in English name for high mage innate ability.
[hengbandforosx/hengbandosx.git] / src / spells-summon.c
1 #include "angband.h"
2 #include "spells-summon.h"
3 #include "monster-status.h"
4
5 /*!
6 * @brief トランプ魔法独自の召喚処理を行う / Handle summoning and failure of trump spells
7 * @param num summon_specific()関数を呼び出す回数
8 * @param pet ペット化として召喚されるか否か
9 * @param y 召喚位置のy座標
10 * @param x 召喚位置のx座標
11 * @param lev 召喚レベル
12 * @param type 召喚条件ID
13 * @param mode モンスター生成条件フラグ
14 * @return モンスターが(敵対も含めて)召還されたならばTRUEを返す。
15 */
16 bool trump_summoning(int num, bool pet, POSITION y, POSITION x, DEPTH lev, int type, BIT_FLAGS mode)
17 {
18         PLAYER_LEVEL plev = p_ptr->lev;
19
20         MONSTER_IDX who;
21         int i;
22         bool success = FALSE;
23
24         /* Default level */
25         if (!lev) lev = plev * 2 / 3 + randint1(plev / 2);
26
27         if (pet)
28         {
29                 /* Become pet */
30                 mode |= PM_FORCE_PET;
31
32                 /* Only sometimes allow unique monster */
33                 if (mode & PM_ALLOW_UNIQUE)
34                 {
35                         /* Forbid often */
36                         if (randint1(50 + plev) >= plev / 10)
37                                 mode &= ~PM_ALLOW_UNIQUE;
38                 }
39
40                 /* Player is who summons */
41                 who = -1;
42         }
43         else
44         {
45                 /* Prevent taming, allow unique monster */
46                 mode |= PM_NO_PET;
47
48                 /* Behave as if they appear by themselfs */
49                 who = 0;
50         }
51
52         for (i = 0; i < num; i++)
53         {
54                 if (summon_specific(who, y, x, lev, type, mode, '\0'))
55                         success = TRUE;
56         }
57
58         if (!success)
59         {
60                 msg_print(_("誰もあなたのカードの呼び声に答えない。", "Nobody answers to your Trump call."));
61         }
62
63         return success;
64 }
65
66
67 bool cast_summon_demon(int power)
68 {
69         u32b flg = 0L;
70         bool pet = !one_in_(3);
71
72         if (pet) flg |= PM_FORCE_PET;
73         else flg |= PM_NO_PET;
74         if (!(pet && (p_ptr->lev < 50))) flg |= PM_ALLOW_GROUP;
75
76         if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, power, SUMMON_DEMON, flg, '\0'))
77         {
78                 msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
79                 if (pet)
80                 {
81                         msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
82                 }
83                 else
84                 {
85                         msg_print(_("「卑しき者よ、我は汝の下僕にあらず! お前の魂を頂くぞ!」",
86                                 "'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'"));
87                 }
88         }
89         return TRUE;
90 }
91
92 bool cast_summon_undead(player_type *creature_ptr, int power)
93 {
94         bool pet = one_in_(3);
95         int type;
96         BIT_FLAGS mode = 0L;
97
98         type = (creature_ptr->lev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
99
100         if (!pet || ((creature_ptr->lev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
101         if (pet) mode |= PM_FORCE_PET;
102         else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
103
104         if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, power, type, mode, '\0'))
105         {
106                 msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
107                         "Cold winds begin to blow around you, carrying with them the stench of decay..."));
108                 if (pet)
109                         msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
110                                 "Ancient, long-dead forms arise from the ground to serve you!"));
111                 else
112                         msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
113                                 "'The dead arise... to punish you for disturbing them!'"));
114         }
115         return TRUE;
116 }
117
118
119 bool cast_summon_hound(player_type *creature_ptr, int power)
120 {
121         BIT_FLAGS mode = PM_ALLOW_GROUP;
122         bool pet = !one_in_(5);
123         if (pet) mode |= PM_FORCE_PET;
124         else mode |= PM_NO_PET;
125
126         if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, power, SUMMON_HOUND, mode, '\0'))
127         {
128                 if (pet)
129                         msg_print(_("ハウンドがあなたの下僕として出現した。", "A group of hounds appear as your servant."));
130                 else
131                         msg_print(_("ハウンドはあなたに牙を向けている!", "A group of hounds appear as your enemy!"));
132         }
133         return TRUE;
134 }
135
136 bool cast_summon_elemental(player_type *creature_ptr, int power)
137 {
138         bool pet = one_in_(3);
139         BIT_FLAGS mode = 0L;
140
141         if (!(pet && (creature_ptr->lev < 50))) mode |= PM_ALLOW_GROUP;
142         if (pet) mode |= PM_FORCE_PET;
143         else mode |= PM_NO_PET;
144
145         if (summon_specific((pet ? -1 : 0), creature_ptr->y, creature_ptr->x, power, SUMMON_ELEMENTAL, mode, '\0'))
146         {
147                 msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
148                 if (pet)
149                         msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
150                 else
151                         msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
152         }
153
154         return TRUE;
155 }
156
157
158 bool cast_summon_octopus(player_type *creature_ptr)
159 {
160         BIT_FLAGS mode = PM_ALLOW_GROUP;
161         bool pet = !one_in_(5);
162         if (pet) mode |= PM_FORCE_PET;
163
164         if (summon_named_creature(0, creature_ptr->y, creature_ptr->x, MON_JIZOTAKO, mode))
165         {
166                 if (pet)
167                         msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant."));
168                 else
169                         msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemy!"));
170         }
171
172         return TRUE;
173 }
174
175 /*!
176 * @brief 悪魔領域のグレーターデーモン召喚に利用可能な死体かどうかを返す。 / An "item_tester_hook" for offer
177 * @param o_ptr オブジェクト構造体の参照ポインタ
178 * @return 生贄に使用可能な死体ならばTRUEを返す。
179 */
180 bool item_tester_offer(object_type *o_ptr)
181 {
182         /* Flasks of oil are okay */
183         if (o_ptr->tval != TV_CORPSE) return (FALSE);
184         if (o_ptr->sval != SV_CORPSE) return (FALSE);
185
186         if (my_strchr("pht", r_info[o_ptr->pval].d_char)) return (TRUE);
187
188         /* Assume not okay */
189         return (FALSE);
190 }
191
192 /*!
193 * @brief 悪魔領域のグレーターデーモン召喚を処理する / Daemon spell Summon Greater Demon
194 * @return 処理を実行したならばTRUEを返す。
195 */
196 bool cast_summon_greater_demon(void)
197 {
198         PLAYER_LEVEL plev = p_ptr->lev;
199         OBJECT_IDX item;
200         concptr q, s;
201         int summon_lev;
202         object_type *o_ptr;
203
204         item_tester_hook = item_tester_offer;
205         q = _("どの死体を捧げますか? ", "Sacrifice which corpse? ");
206         s = _("捧げられる死体を持っていない。", "You have nothing to scrifice.");
207         o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR));
208         if (!o_ptr) return FALSE;
209
210         summon_lev = plev * 2 / 3 + r_info[o_ptr->pval].level;
211
212         if (summon_specific(-1, p_ptr->y, p_ptr->x, summon_lev, SUMMON_HI_DEMON, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0'))
213         {
214                 msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
215                 msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
216
217                 /* Decrease the item (from the pack) */
218                 if (item >= 0)
219                 {
220                         inven_item_increase(item, -1);
221                         inven_item_describe(item);
222                         inven_item_optimize(item);
223                 }
224
225                 /* Decrease the item (from the floor) */
226                 else
227                 {
228                         floor_item_increase(0 - item, -1);
229                         floor_item_describe(0 - item);
230                         floor_item_optimize(0 - item);
231                 }
232         }
233         else
234         {
235                 msg_print(_("悪魔は現れなかった。", "No Greater Demon arrives."));
236         }
237
238         return TRUE;
239 }
240
241 /*!
242  * @brief 同族召喚(援軍)処理
243  * @param level 召喚基準レベル
244  * @param y 召喚先Y座標
245  * @param x 召喚先X座標
246  * @param mode 召喚オプション
247  * @return ターンを消費した場合TRUEを返す
248  */
249 bool summon_kin_player(DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode)
250 {
251         bool pet = (bool)(mode & PM_FORCE_PET);
252         SYMBOL_CODE symbol = '\0';
253         if (!pet) mode |= PM_NO_PET;
254
255         switch (p_ptr->mimic_form)
256         {
257         case MIMIC_NONE:
258                 switch (p_ptr->prace)
259                 {
260                 case RACE_HUMAN:
261                 case RACE_AMBERITE:
262                 case RACE_BARBARIAN:
263                 case RACE_BEASTMAN:
264                 case RACE_DUNADAN:
265                         symbol = 'p';
266                         break;
267                 case RACE_HALF_ELF:
268                 case RACE_ELF:
269                 case RACE_HOBBIT:
270                 case RACE_GNOME:
271                 case RACE_DWARF:
272                 case RACE_HIGH_ELF:
273                 case RACE_NIBELUNG:
274                 case RACE_DARK_ELF:
275                 case RACE_MIND_FLAYER:
276                 case RACE_KUTAR:
277                 case RACE_S_FAIRY:
278                         symbol = 'h';
279                         break;
280                 case RACE_HALF_ORC:
281                         symbol = 'o';
282                         break;
283                 case RACE_HALF_TROLL:
284                         symbol = 'T';
285                         break;
286                 case RACE_HALF_OGRE:
287                         symbol = 'O';
288                         break;
289                 case RACE_HALF_GIANT:
290                 case RACE_HALF_TITAN:
291                 case RACE_CYCLOPS:
292                         symbol = 'P';
293                         break;
294                 case RACE_YEEK:
295                         symbol = 'y';
296                         break;
297                 case RACE_KLACKON:
298                         symbol = 'K';
299                         break;
300                 case RACE_KOBOLD:
301                         symbol = 'k';
302                         break;
303                 case RACE_IMP:
304                         if (one_in_(13)) symbol = 'U';
305                         else symbol = 'u';
306                         break;
307                 case RACE_DRACONIAN:
308                         symbol = 'd';
309                         break;
310                 case RACE_GOLEM:
311                 case RACE_ANDROID:
312                         symbol = 'g';
313                         break;
314                 case RACE_SKELETON:
315                         if (one_in_(13)) symbol = 'L';
316                         else symbol = 's';
317                         break;
318                 case RACE_ZOMBIE:
319                         symbol = 'z';
320                         break;
321                 case RACE_VAMPIRE:
322                         symbol = 'V';
323                         break;
324                 case RACE_SPECTRE:
325                         symbol = 'G';
326                         break;
327                 case RACE_SPRITE:
328                         symbol = 'I';
329                         break;
330                 case RACE_ENT:
331                         symbol = '#';
332                         break;
333                 case RACE_ANGEL:
334                         symbol = 'A';
335                         break;
336                 case RACE_DEMON:
337                         symbol = 'U';
338                         break;
339                 default:
340                         symbol = 'p';
341                         break;
342                 }
343                 break;
344         case MIMIC_DEMON:
345                 if (one_in_(13)) symbol = 'U';
346                 else symbol = 'u';
347                 break;
348         case MIMIC_DEMON_LORD:
349                 symbol = 'U';
350                 break;
351         case MIMIC_VAMPIRE:
352                 symbol = 'V';
353                 break;
354         }
355         return summon_specific((pet ? -1 : 0), y, x, level, SUMMON_KIN, mode, symbol);
356 }
357
358 /*!
359  * @brief サイバーデーモンの召喚
360  * @param who 召喚主のモンスターID(0ならばプレイヤー)
361  * @param y 召喚位置Y座標
362  * @param x 召喚位置X座標
363  * @return 作用が実際にあった場合TRUEを返す
364  */
365 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
366 {
367         int i;
368         int max_cyber = (easy_band ? 1 : (current_floor_ptr->dun_level / 50) + randint1(2));
369         int count = 0;
370         BIT_FLAGS mode = PM_ALLOW_GROUP;
371
372         /* Summoned by a monster */
373         if (who > 0)
374         {
375                 monster_type *m_ptr = &current_floor_ptr->m_list[who];
376                 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
377         }
378
379         if (max_cyber > 4) max_cyber = 4;
380
381         for (i = 0; i < max_cyber; i++)
382         {
383                 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode, '\0');
384         }
385
386         return count;
387 }
388
389
390 void mitokohmon(void)
391 {
392         int count = 0, i;
393         monster_type *m_ptr;
394         concptr kakusan = "";
395
396         if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_SUKE, PM_FORCE_PET))
397         {
398                 msg_print(_("『助さん』が現れた。", "Suke-san apperars."));
399                 kakusan = "Suke-san";
400                 count++;
401         }
402         if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_KAKU, PM_FORCE_PET))
403         {
404                 msg_print(_("『格さん』が現れた。", "Kaku-san appears."));
405                 kakusan = "Kaku-san";
406                 count++;
407         }
408         if (!count)
409         {
410                 for (i = m_max - 1; i > 0; i--)
411                 {
412                         m_ptr = &current_floor_ptr->m_list[i];
413                         if (!monster_is_valid(m_ptr)) continue;
414                         if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
415                         if (!los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
416                         if (!projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
417                         count++;
418                         break;
419                 }
420         }
421
422         if (count)
423         {
424                 msg_format(_("「者ども、ひかえおろう!!!このお方をどなたとこころえる。」",
425                         "%^s says 'WHO do you think this person is! Bow your head, down to your knees!'"), kakusan);
426                 sukekaku = TRUE;
427                 stun_monsters(120);
428                 confuse_monsters(120);
429                 turn_monsters(120);
430                 stasis_monsters(120);
431                 sukekaku = FALSE;
432         }
433         else
434         {
435                 msg_print(_("しかし、何も起きなかった。", "Nothing happens."));
436         }
437 }