OSDN Git Service

[Refactor] #40498 Separated player-redraw-types.h from player-status.h
[hengband/hengband.git] / src / spell-kind / blood-curse.c
1 #include "spell-kind/blood-curse.h"
2 #include "effect/effect-characteristics.h"
3 #include "floor/floor.h"
4 #include "grid/grid.h"
5 #include "monster-floor/monster-summon.h"
6 #include "monster-floor/place-monster-types.h"
7 #include "spell-kind/earthquake.h"
8 #include "spell-kind/spells-sight.h"
9 #include "spell-kind/spells-teleport.h"
10 #include "spell/process-effect.h"
11 #include "spell/spell-types.h"
12 #include "spell/spells-summon.h"
13 #include "status/base-status.h"
14 #include "status/experience.h"
15 #include "system/monster-type-definition.h"
16 #include "view/display-messages.h"
17
18 void blood_curse_to_enemy(player_type *caster_ptr, MONSTER_IDX m_idx)
19 {
20     monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
21     grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx];
22     BIT_FLAGS curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
23     int count = 0;
24     bool is_first_loop = TRUE;
25     while (is_first_loop || one_in_(5)) {
26         is_first_loop = FALSE;
27         switch (randint1(28)) {
28         case 1:
29         case 2:
30             if (!count) {
31                 msg_print(_("地面が揺れた...", "The ground trembles..."));
32                 earthquake(caster_ptr, m_ptr->fy, m_ptr->fx, 4 + randint0(4), 0);
33                 if (!one_in_(6))
34                     break;
35             }
36             /* Fall through */
37         case 3:
38         case 4:
39         case 5:
40         case 6:
41             if (!count) {
42                 int extra_dam = damroll(10, 10);
43                 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
44                 project(caster_ptr, 0, 8, m_ptr->fy, m_ptr->fx, extra_dam, GF_MANA, curse_flg, -1);
45                 if (!one_in_(6))
46                     break;
47             }
48             /* Fall through */
49         case 7:
50         case 8:
51             if (!count) {
52                 msg_print(_("空間が歪んだ!", "Space warps about you!"));
53                 if (m_ptr->r_idx)
54                     teleport_away(caster_ptr, g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
55                 if (one_in_(13))
56                     count += activate_hi_summon(caster_ptr, m_ptr->fy, m_ptr->fx, TRUE);
57                 if (!one_in_(6))
58                     break;
59             }
60             /* Fall through */
61         case 9:
62         case 10:
63         case 11:
64             msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
65             project(caster_ptr, 0, 7, m_ptr->fy, m_ptr->fx, 50, GF_DISINTEGRATE, curse_flg, -1);
66             if (!one_in_(6))
67                 break;
68             /* Fall through */
69         case 12:
70         case 13:
71         case 14:
72         case 15:
73         case 16:
74             aggravate_monsters(caster_ptr, 0);
75             if (!one_in_(6))
76                 break;
77             /* Fall through */
78         case 17:
79         case 18:
80             count += activate_hi_summon(caster_ptr, m_ptr->fy, m_ptr->fx, TRUE);
81             if (!one_in_(6))
82                 break;
83             /* Fall through */
84         case 19:
85         case 20:
86         case 21:
87         case 22: {
88             bool pet = !one_in_(3);
89             BIT_FLAGS mode = PM_ALLOW_GROUP;
90
91             if (pet)
92                 mode |= PM_FORCE_PET;
93             else
94                 mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
95
96             count += summon_specific(caster_ptr, (pet ? -1 : 0), caster_ptr->y, caster_ptr->x,
97                 (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : caster_ptr->current_floor_ptr->dun_level), 0, mode);
98             if (!one_in_(6))
99                 break;
100         }
101             /* Fall through */
102         case 23:
103         case 24:
104         case 25:
105             if (caster_ptr->hold_exp && (randint0(100) < 75))
106                 break;
107
108             msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
109             if (caster_ptr->hold_exp)
110                 lose_exp(caster_ptr, caster_ptr->exp / 160);
111             else
112                 lose_exp(caster_ptr, caster_ptr->exp / 16);
113             if (!one_in_(6))
114                 break;
115             /* Fall through */
116         case 26:
117         case 27:
118         case 28: {
119             if (one_in_(13)) {
120                 for (int i = 0; i < A_MAX; i++) {
121                     bool is_first_dec_stat = TRUE;
122                     while (is_first_dec_stat || one_in_(2)) {
123                         (void)do_dec_stat(caster_ptr, i);
124                     }
125                 }
126             } else {
127                 (void)do_dec_stat(caster_ptr, randint0(6));
128             }
129
130             break;
131         }
132         }
133     }
134 }