1 #include "spell/spells-summon.h"
2 #include "effect/spells-effect-util.h"
3 #include "floor/floor.h"
4 #include "game-option/birth-options.h"
5 #include "inventory/inventory-object.h"
6 #include "inventory/player-inventory.h"
7 #include "monster-floor/monster-summon.h"
8 #include "monster-floor/place-monster-types.h"
9 #include "monster-race/race-indice-types.h"
10 #include "monster/monster-info.h"
11 #include "monster/monster-status.h"
12 #include "monster/smart-learn-types.h"
13 #include "object/item-use-flags.h"
14 #include "object/object-hook.h"
15 #include "player/avatar.h"
16 #include "player/player-effects.h"
17 #include "spell/spells-diceroll.h"
18 #include "spell-kind/earthquake.h"
19 #include "spell-kind/spells-floor.h"
20 #include "spell-kind/spells-genocide.h"
21 #include "spell-kind/spells-launcher.h"
22 #include "spell-kind/spells-lite.h"
23 #include "spell-kind/spells-sight.h"
24 #include "spell-kind/spells-specific-bolt.h"
25 #include "spell/spells-status.h"
26 #include "spell/spells-type.h"
27 #include "sv-definition/sv-other-types.h"
30 * @brief トランプ魔法独自の召喚処理を行う / Handle summoning and failure of trump spells
31 * @param num summon_specific()関数を呼び出す回数
32 * @param pet ペット化として召喚されるか否か
37 * @param mode モンスター生成条件フラグ
38 * @return モンスターが(敵対も含めて)召還されたならばTRUEを返す。
40 bool trump_summoning(player_type *caster_ptr, int num, bool pet, POSITION y, POSITION x, DEPTH lev, int type, BIT_FLAGS mode)
43 PLAYER_LEVEL plev = caster_ptr->lev;
44 if (!lev) lev = plev * 2 / 3 + randint1(plev / 2);
52 /* Only sometimes allow unique monster */
53 if (mode & PM_ALLOW_UNIQUE)
56 if (randint1(50 + plev) >= plev / 10)
57 mode &= ~PM_ALLOW_UNIQUE;
60 /* Player is who summons */
65 /* Prevent taming, allow unique monster */
68 /* Behave as if they appear by themselfs */
73 for (int i = 0; i < num; i++)
75 if (summon_specific(caster_ptr, who, y, x, lev, type, mode))
81 msg_print(_("誰もあなたのカードの呼び声に答えない。", "Nobody answers to your Trump call."));
88 bool cast_summon_demon(player_type *caster_ptr, int power)
91 bool pet = !one_in_(3);
92 if (pet) flg |= PM_FORCE_PET;
93 else flg |= PM_NO_PET;
94 if (!(pet && (caster_ptr->lev < 50))) flg |= PM_ALLOW_GROUP;
96 if (!summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x, power, SUMMON_DEMON, flg))
99 msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
102 msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
106 msg_print(_("「卑しき者よ、我は汝の下僕にあらず! お前の魂を頂くぞ!」",
107 "'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'"));
113 bool cast_summon_undead(player_type *creature_ptr, int power)
115 bool pet = one_in_(3);
116 int type = (creature_ptr->lev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
119 if (!pet || ((creature_ptr->lev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
120 if (pet) mode |= PM_FORCE_PET;
121 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
123 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, power, type, mode))
125 msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
126 "Cold winds begin to blow around you, carrying with them the stench of decay..."));
128 msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
129 "Ancient, long-dead forms arise from the ground to serve you!"));
131 msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
132 "'The dead arise... to punish you for disturbing them!'"));
138 bool cast_summon_hound(player_type *creature_ptr, int power)
140 BIT_FLAGS mode = PM_ALLOW_GROUP;
141 bool pet = !one_in_(5);
142 if (pet) mode |= PM_FORCE_PET;
143 else mode |= PM_NO_PET;
145 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, power, SUMMON_HOUND, mode))
148 msg_print(_("ハウンドがあなたの下僕として出現した。", "A group of hounds appear as your servant."));
150 msg_print(_("ハウンドはあなたに牙を向けている!", "A group of hounds appear as your enemy!"));
157 bool cast_summon_elemental(player_type *creature_ptr, int power)
159 bool pet = one_in_(3);
161 if (!(pet && (creature_ptr->lev < 50))) mode |= PM_ALLOW_GROUP;
162 if (pet) mode |= PM_FORCE_PET;
163 else mode |= PM_NO_PET;
165 if (summon_specific(creature_ptr, (pet ? -1 : 0), creature_ptr->y, creature_ptr->x, power, SUMMON_ELEMENTAL, mode))
167 msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
169 msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
171 msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
178 bool cast_summon_octopus(player_type *creature_ptr)
180 BIT_FLAGS mode = PM_ALLOW_GROUP;
181 bool pet = !one_in_(5);
182 if (pet) mode |= PM_FORCE_PET;
183 if (summon_named_creature(creature_ptr, 0, creature_ptr->y, creature_ptr->x, MON_JIZOTAKO, mode))
186 msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant."));
188 msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemy!"));
196 * @brief 悪魔領域のグレーターデーモン召喚に利用可能な死体かどうかを返す。 / An "item_tester_hook" for offer
197 * @param o_ptr オブジェクト構造体の参照ポインタ
198 * @return 生贄に使用可能な死体ならばTRUEを返す。
200 bool item_tester_offer(object_type *o_ptr)
202 if (o_ptr->tval != TV_CORPSE) return FALSE;
203 if (o_ptr->sval != SV_CORPSE) return FALSE;
204 if (angband_strchr("pht", r_info[o_ptr->pval].d_char)) return TRUE;
210 * @brief 悪魔領域のグレーターデーモン召喚を処理する / Daemon spell Summon Greater Demon
211 * @return 処理を実行したならばTRUEを返す。
213 bool cast_summon_greater_demon(player_type *caster_ptr)
215 item_tester_hook = item_tester_offer;
216 concptr q = _("どの死体を捧げますか? ", "Sacrifice which corpse? ");
217 concptr s = _("捧げられる死体を持っていない。", "You have nothing to scrifice.");
220 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
221 if (!o_ptr) return FALSE;
223 PLAYER_LEVEL plev = caster_ptr->lev;
224 int summon_lev = plev * 2 / 3 + r_info[o_ptr->pval].level;
226 if (summon_specific(caster_ptr, -1, caster_ptr->y, caster_ptr->x, summon_lev, SUMMON_HI_DEMON, (PM_ALLOW_GROUP | PM_FORCE_PET)))
228 msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
229 msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
230 vary_item(caster_ptr, item, -1);
234 msg_print(_("悪魔は現れなかった。", "No Greater Demon arrives."));
243 * @param player_ptr プレーヤーへの参照ポインタ
244 * @param level 召喚基準レベル
247 * @param mode 召喚オプション
248 * @return ターンを消費した場合TRUEを返す
250 bool summon_kin_player(player_type *creature_ptr, DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode)
252 bool pet = (bool)(mode & PM_FORCE_PET);
253 if (!pet) mode |= PM_NO_PET;
254 return summon_specific(creature_ptr, (pet ? -1 : 0), y, x, level, SUMMON_KIN, mode);
260 * @param player_ptr プレーヤーへの参照ポインタ
261 * @param who 召喚主のモンスターID(0ならばプレイヤー)
264 * @return 作用が実際にあった場合TRUEを返す
266 int summon_cyber(player_type *creature_ptr, MONSTER_IDX who, POSITION y, POSITION x)
268 /* Summoned by a monster */
269 BIT_FLAGS mode = PM_ALLOW_GROUP;
270 floor_type *floor_ptr = creature_ptr->current_floor_ptr;
273 monster_type *m_ptr = &floor_ptr->m_list[who];
274 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
277 int max_cyber = (easy_band ? 1 : (floor_ptr->dun_level / 50) + randint1(2));
278 if (max_cyber > 4) max_cyber = 4;
281 for (int i = 0; i < max_cyber; i++)
283 count += summon_specific(creature_ptr, who, y, x, 100, SUMMON_CYBER, mode);
290 void mitokohmon(player_type *kohmon_ptr)
293 concptr sukekakusan = "";
294 if (summon_named_creature(kohmon_ptr, 0, kohmon_ptr->y, kohmon_ptr->x, MON_SUKE, PM_FORCE_PET))
296 msg_print(_("『助さん』が現れた。", "Suke-san apperars."));
297 sukekakusan = "Suke-san";
301 if (summon_named_creature(kohmon_ptr, 0, kohmon_ptr->y, kohmon_ptr->x, MON_KAKU, PM_FORCE_PET))
303 msg_print(_("『格さん』が現れた。", "Kaku-san appears."));
304 sukekakusan = "Kaku-san";
310 for (int i = kohmon_ptr->current_floor_ptr->m_max - 1; i > 0; i--)
313 m_ptr = &kohmon_ptr->current_floor_ptr->m_list[i];
314 if (!monster_is_valid(m_ptr)) continue;
315 if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
316 if (!los(kohmon_ptr, m_ptr->fy, m_ptr->fx, kohmon_ptr->y, kohmon_ptr->x)) continue;
317 if (!projectable(kohmon_ptr, m_ptr->fy, m_ptr->fx, kohmon_ptr->y, kohmon_ptr->x)) continue;
325 msg_print(_("しかし、何も起きなかった。", "Nothing happens."));
329 msg_format(_("「者ども、ひかえおろう!!!このお方をどなたとこころえる。」",
330 "%^s says 'WHO do you think this person is! Bow your head, down to your knees!'"), sukekakusan);
332 stun_monsters(kohmon_ptr, 120);
333 confuse_monsters(kohmon_ptr, 120);
334 turn_monsters(kohmon_ptr, 120);
335 stasis_monsters(kohmon_ptr, 120);
340 * todo 引数にPOSITION x/yは必要か? 要調査
341 * @brief HI_SUMMON(上級召喚)処理発動
342 * @param caster_ptr プレーヤーへの参照ポインタ
345 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
346 * @return 作用が実際にあった場合TRUEを返す
348 int activate_hi_summon(player_type *caster_ptr, POSITION y, POSITION x, bool can_pet)
350 BIT_FLAGS mode = PM_ALLOW_GROUP;
354 mode |= PM_FORCE_FRIENDLY;
356 mode |= PM_FORCE_PET;
364 DEPTH dungeon_level = caster_ptr->current_floor_ptr->dun_level;
365 DEPTH summon_lev = (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : dungeon_level);
367 for (int i = 0; i < (randint1(7) + (dungeon_level / 40)); i++) {
368 switch (randint1(25) + (dungeon_level / 20)) {
371 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
375 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
379 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
383 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
387 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
391 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
395 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
399 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
404 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
410 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
415 mode |= PM_ALLOW_UNIQUE;
416 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
421 mode |= PM_ALLOW_UNIQUE;
422 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
425 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
429 mode |= PM_ALLOW_UNIQUE;
430 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
438 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
439 * @param caster_ptr プレーヤーへの参照ポインタ
443 void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
445 PLAYER_LEVEL plev = caster_ptr->lev;
446 int die = randint1(100) + plev / 5;
447 int vir = virtue_number(caster_ptr, V_CHANCE);
450 if (caster_ptr->virtues[vir - 1] > 0) {
451 while (randint1(400) < caster_ptr->virtues[vir - 1])
454 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1]))
459 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
461 chg_virtue(caster_ptr, V_CHANCE, 1);
464 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
468 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!", "Oh no! Mouldering forms rise from the earth around you!"));
470 (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD,
471 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
472 chg_virtue(caster_ptr, V_UNLIFE, 1);
473 } else if (die < 14) {
474 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
476 set_afraid(caster_ptr, caster_ptr->afraid + randint1(4) + 4);
477 } else if (die < 26) {
478 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...", "Your head is invaded by a horde of gibbering spectral voices..."));
480 set_confused(caster_ptr, caster_ptr->confused + randint1(4) + 4);
481 } else if (die < 31) {
482 poly_monster(caster_ptr, dir, plev);
483 } else if (die < 36) {
484 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4));
485 } else if (die < 41) {
486 confuse_monster(caster_ptr, dir, plev);
487 } else if (die < 46) {
488 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
489 } else if (die < 51) {
490 (void)lite_line(caster_ptr, dir, damroll(6, 8));
491 } else if (die < 56) {
492 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir, damroll(3 + ((plev - 5) / 4), 8));
493 } else if (die < 61) {
494 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir, damroll(5 + ((plev - 5) / 4), 8));
495 } else if (die < 66) {
496 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir, damroll(6 + ((plev - 5) / 4), 8));
497 } else if (die < 71) {
498 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir, damroll(8 + ((plev - 5) / 4), 8));
499 } else if (die < 76) {
500 hypodynamic_bolt(caster_ptr, dir, 75);
501 } else if (die < 81) {
502 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
503 } else if (die < 86) {
504 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
505 } else if (die < 91) {
506 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
507 } else if (die < 96) {
508 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
509 } else if (die < 101) {
510 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
511 } else if (die < 104) {
512 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
513 } else if (die < 106) {
514 (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
515 } else if (die < 108) {
516 symbol_genocide(caster_ptr, plev + 50, TRUE);
517 } else if (die < 110) {
518 dispel_monsters(caster_ptr, 120);
520 dispel_monsters(caster_ptr, 150);
521 slow_monsters(caster_ptr, plev);
522 sleep_monsters(caster_ptr, plev);
523 hp_player(caster_ptr, 300);
528 _("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」", "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));