1 #include "spell/spells-summon.h"
2 #include "avatar/avatar.h"
3 #include "effect/spells-effect-util.h"
4 #include "floor/floor-object.h"
5 #include "floor/line-of-sight.h"
6 #include "game-option/birth-options.h"
7 #include "hpmp/hp-mp-processor.h"
8 #include "inventory/inventory-object.h"
9 #include "monster-floor/monster-summon.h"
10 #include "monster-floor/place-monster-types.h"
11 #include "monster-race/monster-race.h"
12 #include "monster-race/race-indice-types.h"
13 #include "monster/monster-info.h"
14 #include "monster/monster-status.h"
15 #include "monster/smart-learn-types.h"
16 #include "object/item-tester-hooker.h"
17 #include "object/item-use-flags.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-diceroll.h"
26 #include "spell/spells-status.h"
27 #include "spell/summon-types.h"
28 #include "status/bad-status-setter.h"
29 #include "sv-definition/sv-other-types.h"
30 #include "system/floor-type-definition.h"
31 #include "system/monster-race-definition.h"
32 #include "system/monster-type-definition.h"
33 #include "system/object-type-definition.h"
34 #include "system/player-type-definition.h"
35 #include "target/projection-path-calculator.h"
36 #include "util/string-processor.h"
37 #include "view/display-messages.h"
40 * @brief トランプ魔法独自の召喚処理を行う / Handle summoning and failure of trump spells
41 * @param num summon_specific()関数を呼び出す回数
42 * @param pet ペット化として召喚されるか否か
47 * @param mode モンスター生成条件フラグ
48 * @return モンスターが(敵対も含めて)召還されたならばTRUEを返す。
50 bool trump_summoning(PlayerType *player_ptr, int num, bool pet, POSITION y, POSITION x, DEPTH lev, summon_type type, BIT_FLAGS mode)
53 PLAYER_LEVEL plev = player_ptr->lev;
55 lev = plev * 2 / 3 + randint1(plev / 2);
62 /* Only sometimes allow unique monster */
63 if (mode & PM_ALLOW_UNIQUE) {
65 if (randint1(50 + plev) >= plev / 10)
66 mode &= ~PM_ALLOW_UNIQUE;
69 /* Player is who summons */
72 /* Prevent taming, allow unique monster */
75 /* Behave as if they appear by themselfs */
80 for (int i = 0; i < num; i++) {
81 if (summon_specific(player_ptr, who, y, x, lev, type, mode))
86 msg_print(_("誰もあなたのカードの呼び声に答えない。", "Nobody answers to your Trump call."));
92 bool cast_summon_demon(PlayerType *player_ptr, int power)
95 bool pet = !one_in_(3);
100 if (!(pet && (player_ptr->lev < 50)))
101 flg |= PM_ALLOW_GROUP;
103 if (!summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, power, SUMMON_DEMON, flg))
106 msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
108 msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
110 msg_print(_("「卑しき者よ、我は汝の下僕にあらず! お前の魂を頂くぞ!」", "'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'"));
116 bool cast_summon_undead(PlayerType *player_ptr, int power)
118 bool pet = one_in_(3);
119 summon_type type = (player_ptr->lev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
122 if (!pet || ((player_ptr->lev > 24) && one_in_(3)))
123 mode |= PM_ALLOW_GROUP;
125 mode |= PM_FORCE_PET;
127 mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
129 if (summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, power, type, mode)) {
130 msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
131 "Cold winds begin to blow around you, carrying with them the stench of decay..."));
133 msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!", "Ancient, long-dead forms arise from the ground to serve you!"));
135 msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!", "'The dead arise... to punish you for disturbing them!'"));
140 bool cast_summon_hound(PlayerType *player_ptr, int power)
142 BIT_FLAGS mode = PM_ALLOW_GROUP;
143 bool pet = !one_in_(5);
145 mode |= PM_FORCE_PET;
149 if (summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, power, SUMMON_HOUND, mode)) {
151 msg_print(_("ハウンドがあなたの下僕として出現した。", "A group of hounds appear as your servants."));
153 msg_print(_("ハウンドはあなたに牙を向けている!", "A group of hounds appear as your enemies!"));
159 bool cast_summon_elemental(PlayerType *player_ptr, int power)
161 bool pet = one_in_(3);
163 if (!(pet && (player_ptr->lev < 50)))
164 mode |= PM_ALLOW_GROUP;
166 mode |= PM_FORCE_PET;
170 if (summon_specific(player_ptr, (pet ? -1 : 0), player_ptr->y, player_ptr->x, power, SUMMON_ELEMENTAL, mode)) {
171 msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
173 msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
175 msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
181 bool cast_summon_octopus(PlayerType *player_ptr)
183 BIT_FLAGS mode = PM_ALLOW_GROUP;
184 bool pet = !one_in_(5);
186 mode |= PM_FORCE_PET;
187 if (summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, MON_JIZOTAKO, mode)) {
189 msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servants."));
191 msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemies!"));
198 * @brief 悪魔領域のグレーターデーモン召喚を処理する / Daemon spell Summon Greater Demon
199 * @return 処理を実行したならばTRUEを返す。
201 bool cast_summon_greater_demon(PlayerType *player_ptr)
203 concptr q = _("どの死体を捧げますか? ", "Sacrifice which corpse? ");
204 concptr s = _("捧げられる死体を持っていない。", "You have nothing to sacrifice.");
207 o_ptr = choose_object(player_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), FuncItemTester(&object_type::is_offerable));
211 PLAYER_LEVEL plev = player_ptr->lev;
212 int summon_lev = plev * 2 / 3 + r_info[o_ptr->pval].level;
214 if (summon_specific(player_ptr, -1, player_ptr->y, player_ptr->x, summon_lev, SUMMON_HI_DEMON, (PM_ALLOW_GROUP | PM_FORCE_PET))) {
215 msg_print(_("硫黄の悪臭が充満した。", "The area fills with a stench of sulphur and brimstone."));
216 msg_print(_("「ご用でございますか、ご主人様」", "'What is thy bidding... Master?'"));
217 vary_item(player_ptr, item, -1);
219 msg_print(_("悪魔は現れなかった。", "No Greater Demon arrives."));
227 * @param player_ptr プレイヤーへの参照ポインタ
228 * @param level 召喚基準レベル
231 * @param mode 召喚オプション
232 * @return ターンを消費した場合TRUEを返す
234 bool summon_kin_player(PlayerType *player_ptr, DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode)
236 bool pet = (bool)(mode & PM_FORCE_PET);
239 return summon_specific(player_ptr, (pet ? -1 : 0), y, x, level, SUMMON_KIN, mode);
244 * @param player_ptr プレイヤーへの参照ポインタ
245 * @param who 召喚主のモンスターID(0ならばプレイヤー)
248 * @return 作用が実際にあった場合TRUEを返す
250 int summon_cyber(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x)
252 /* Summoned by a monster */
253 BIT_FLAGS mode = PM_ALLOW_GROUP;
254 floor_type *floor_ptr = player_ptr->current_floor_ptr;
256 monster_type *m_ptr = &floor_ptr->m_list[who];
258 mode |= PM_FORCE_PET;
261 int max_cyber = (floor_ptr->dun_level / 50) + randint1(2);
266 for (int i = 0; i < max_cyber; i++) {
267 count += summon_specific(player_ptr, who, y, x, 100, SUMMON_CYBER, mode);
273 void mitokohmon(PlayerType *player_ptr)
276 concptr sukekakusan = "";
277 if (summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, MON_SUKE, PM_FORCE_PET)) {
278 msg_print(_("『助さん』が現れた。", "Suke-san apperars."));
279 sukekakusan = "Suke-san";
283 if (summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, MON_KAKU, PM_FORCE_PET)) {
284 msg_print(_("『格さん』が現れた。", "Kaku-san appears."));
285 sukekakusan = "Kaku-san";
290 for (int i = player_ptr->current_floor_ptr->m_max - 1; i > 0; i--) {
292 m_ptr = &player_ptr->current_floor_ptr->m_list[i];
293 if (!monster_is_valid(m_ptr))
295 if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU)))
297 if (!los(player_ptr, m_ptr->fy, m_ptr->fx, player_ptr->y, player_ptr->x))
299 if (!projectable(player_ptr, m_ptr->fy, m_ptr->fx, player_ptr->y, player_ptr->x))
307 msg_print(_("しかし、何も起きなかった。", "Nothing happens."));
312 _("「者ども、ひかえおろう!!!このお方をどなたとこころえる。」", "%^s says 'WHO do you think this person is! Bow your head, down to your knees!'"),
315 stun_monsters(player_ptr, 120);
316 confuse_monsters(player_ptr, 120);
317 turn_monsters(player_ptr, 120);
318 stasis_monsters(player_ptr, 120);
323 * @brief HI_SUMMON(上級召喚)処理発動
324 * @param player_ptr プレイヤーへの参照ポインタ
327 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
328 * @return 作用が実際にあった場合TRUEを返す
329 * @todo 引数にPOSITION x/yは必要か? 要調査
331 int activate_hi_summon(PlayerType *player_ptr, POSITION y, POSITION x, bool can_pet)
333 BIT_FLAGS mode = PM_ALLOW_GROUP;
337 mode |= PM_FORCE_FRIENDLY;
339 mode |= PM_FORCE_PET;
347 DEPTH dungeon_level = player_ptr->current_floor_ptr->dun_level;
348 DEPTH summon_lev = (pet ? player_ptr->lev * 2 / 3 + randint1(player_ptr->lev / 2) : dungeon_level);
350 for (int i = 0; i < (randint1(7) + (dungeon_level / 40)); i++) {
351 switch (randint1(25) + (dungeon_level / 20)) {
354 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
358 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
362 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
366 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
370 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
374 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
378 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
382 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
387 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
393 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
398 mode |= PM_ALLOW_UNIQUE;
399 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
404 mode |= PM_ALLOW_UNIQUE;
405 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
408 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
412 mode |= PM_ALLOW_UNIQUE;
413 count += summon_specific(player_ptr, (pet ? -1 : 0), y, x, pet ? summon_lev : (((summon_lev * 3) / 2) + 5), SUMMON_NONE, mode);
421 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
422 * @param player_ptr プレイヤーへの参照ポインタ
425 void cast_invoke_spirits(PlayerType *player_ptr, DIRECTION dir)
427 PLAYER_LEVEL plev = player_ptr->lev;
428 int die = randint1(100) + plev / 5;
429 int vir = virtue_number(player_ptr, V_CHANCE);
432 if (player_ptr->virtues[vir - 1] > 0) {
433 while (randint1(400) < player_ptr->virtues[vir - 1])
436 while (randint1(400) < (0 - player_ptr->virtues[vir - 1]))
441 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
443 chg_virtue(player_ptr, V_CHANCE, 1);
446 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
449 BadStatusSetter bss(player_ptr);
451 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!", "Oh no! Mouldering forms rise from the earth around you!"));
453 (void)summon_specific(player_ptr, 0, player_ptr->y, player_ptr->x, player_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD,
454 (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
455 chg_virtue(player_ptr, V_UNLIFE, 1);
456 } else if (die < 14) {
457 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
458 (void)bss.mod_afraidness(randint1(4) + 4);
459 } else if (die < 26) {
460 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...", "Your head is invaded by a horde of gibbering spectral voices..."));
461 (void)bss.mod_confusion(randint1(4) + 4);
462 } else if (die < 31) {
463 poly_monster(player_ptr, dir, plev);
464 } else if (die < 36) {
465 fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, AttributeType::MISSILE, dir, damroll(3 + ((plev - 1) / 5), 4));
466 } else if (die < 41) {
467 confuse_monster(player_ptr, dir, plev);
468 } else if (die < 46) {
469 fire_ball(player_ptr, AttributeType::POIS, dir, 20 + (plev / 2), 3);
470 } else if (die < 51) {
471 (void)lite_line(player_ptr, dir, damroll(6, 8));
472 } else if (die < 56) {
473 fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, AttributeType::ELEC, dir, damroll(3 + ((plev - 5) / 4), 8));
474 } else if (die < 61) {
475 fire_bolt_or_beam(player_ptr, beam_chance(player_ptr) - 10, AttributeType::COLD, dir, damroll(5 + ((plev - 5) / 4), 8));
476 } else if (die < 66) {
477 fire_bolt_or_beam(player_ptr, beam_chance(player_ptr), AttributeType::ACID, dir, damroll(6 + ((plev - 5) / 4), 8));
478 } else if (die < 71) {
479 fire_bolt_or_beam(player_ptr, beam_chance(player_ptr), AttributeType::FIRE, dir, damroll(8 + ((plev - 5) / 4), 8));
480 } else if (die < 76) {
481 hypodynamic_bolt(player_ptr, dir, 75);
482 } else if (die < 81) {
483 fire_ball(player_ptr, AttributeType::ELEC, dir, 30 + plev / 2, 2);
484 } else if (die < 86) {
485 fire_ball(player_ptr, AttributeType::ACID, dir, 40 + plev, 2);
486 } else if (die < 91) {
487 fire_ball(player_ptr, AttributeType::ICE, dir, 70 + plev, 3);
488 } else if (die < 96) {
489 fire_ball(player_ptr, AttributeType::FIRE, dir, 80 + plev, 3);
490 } else if (die < 101) {
491 hypodynamic_bolt(player_ptr, dir, 100 + plev);
492 } else if (die < 104) {
493 earthquake(player_ptr, player_ptr->y, player_ptr->x, 12, 0);
494 } else if (die < 106) {
495 (void)destroy_area(player_ptr, player_ptr->y, player_ptr->x, 13 + randint0(5), false);
496 } else if (die < 108) {
497 symbol_genocide(player_ptr, plev + 50, true);
498 } else if (die < 110) {
499 dispel_monsters(player_ptr, 120);
501 dispel_monsters(player_ptr, 150);
502 slow_monsters(player_ptr, plev);
503 sleep_monsters(player_ptr, plev);
504 hp_player(player_ptr, 300);
509 _("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」", "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));