OSDN Git Service

[Refactor] #40634 Removed dependencies for spells-sight.h in acivation-switcher.c
[hengband/hengband.git] / src / object-activation / activation-others.c
1 /*!
2  * @brief \94­\93®\8f\88\97\9d\82»\82Ì\91¼ (\94ì\91å\89»\82µ\82ª\82¿\82È\82Ì\82Å\93K\8bX\82Ü\82Æ\82Ü\82è\82ð\95Ê\83t\83@\83C\83\8b\82Ö\95ª\8a\84\82·\82é\82±\82Æ)
3  * @date 2020/08/19
4  * @author Hourier
5  */
6
7 #include "object-activation/activation-others.h"
8 #include "art-definition/art-weapon-types.h"
9 #include "cmd-io/cmd-save.h"
10 #include "core/asking-player.h"
11 #include "core/hp-mp-processor.h"
12 #include "effect/effect-characteristics.h"
13 #include "game-option/special-options.h"
14 #include "monster-race/monster-race.h"
15 #include "monster-race/race-flags1.h"
16 #include "monster/monster-status.h"
17 #include "player/avatar.h"
18 #include "player-attack/player-attack.h"
19 #include "player/player-damage.h"
20 #include "spell/spell-types.h"
21 #include "spell-kind/earthquake.h"
22 #include "spell-kind/magic-item-recharger.h"
23 #include "spell-kind/spells-beam.h"
24 #include "spell-kind/spells-curse-removal.h"
25 #include "spell-kind/spells-detection.h"
26 #include "spell-kind/spells-fetcher.h"
27 #include "spell-kind/spells-floor.h"
28 #include "spell-kind/spells-grid.h"
29 #include "spell-kind/spells-launcher.h"
30 #include "spell-kind/spells-lite.h"
31 #include "spell-kind/spells-neighbor.h"
32 #include "spell-kind/spells-perception.h"
33 #include "spell-kind/spells-random.h"
34 #include "spell-kind/spells-sight.h"
35 #include "spell-kind/spells-teleport.h"
36 #include "spell-kind/spells-world.h"
37 #include "spell-realm/spells-hex.h"
38 #include "spell/process-effect.h"
39 #include "spell/spells-status.h"
40 #include "status/bad-status-setter.h"
41 #include "status/buff-setter.h"
42 #include "system/floor-type-definition.h"
43 #include "system/object-type-definition.h"
44 #include "target/target-getter.h"
45 #include "view/display-messages.h"
46
47 bool activate_sunlight(player_type *user_ptr)
48 {
49     DIRECTION dir;
50     if (!get_aim_dir(user_ptr, &dir))
51         return FALSE;
52
53     msg_print(_("\91¾\97z\8cõ\90ü\82ª\95ú\82½\82ê\82½\81B", "A line of sunlight appears."));
54     (void)lite_line(user_ptr, dir, damroll(6, 8));
55     return TRUE;
56 }
57
58 bool activate_confusion(player_type *user_ptr)
59 {
60     DIRECTION dir;
61     msg_print(_("\97l\81X\82È\90F\82Ì\89Î\89Ô\82ð\94­\82µ\82Ä\82¢\82é...", "It glows in scintillating colours..."));
62     if (!get_aim_dir(user_ptr, &dir))
63         return FALSE;
64
65     confuse_monster(user_ptr, dir, 20);
66     return TRUE;
67 }
68
69 bool activate_banish_evil(player_type *user_ptr)
70 {
71     if (banish_evil(user_ptr, 100))
72         msg_print(_("\83A\81[\83e\83B\83t\83@\83N\83g\82Ì\97Í\82ª\8e×\88«\82ð\91Å\82¿\95¥\82Á\82½\81I", "The power of the artifact banishes evil!"));
73
74     return TRUE;
75 }
76
77 bool activate_scare(player_type *user_ptr)
78 {
79     if (music_singing_any(user_ptr))
80         stop_singing(user_ptr);
81
82     if (hex_spelling_any(user_ptr))
83         stop_hex_spell_all(user_ptr);
84
85     msg_print(_("\82 \82È\82½\82Í\97Í\8b­\82¢\93Ë\95\97\82ð\90\81\82«\96Â\82ç\82µ\82½\81B\8eü\88Í\82Ì\93G\82ª\90k\82¦\8fã\82Á\82Ä\82¢\82é!", "You wind a mighty blast; your enemies tremble!"));
86     (void)turn_monsters(user_ptr, (3 * user_ptr->lev / 2) + 10);
87     return TRUE;
88 }
89
90 bool activate_aggravation(player_type *user_ptr, object_type *o_ptr, concptr name)
91 {
92     if (o_ptr->name1 == ART_HYOUSIGI)
93         msg_print(_("\94\8f\8eq\96Ø\82ð\91Å\82Á\82½\81B", "You beat your wooden clappers."));
94     else
95         msg_format(_("%s\82Í\95s\89õ\82È\95¨\89¹\82ð\97§\82Ä\82½\81B", "The %s sounds an unpleasant noise."), name);
96
97     aggravate_monsters(user_ptr, 0);
98     return TRUE;
99 }
100
101 bool activate_stone_mud(player_type *user_ptr)
102 {
103     DIRECTION dir;
104     msg_print(_("\8cÛ\93®\82µ\82Ä\82¢\82é...", "It pulsates..."));
105     if (!get_aim_dir(user_ptr, &dir))
106         return FALSE;
107
108     wall_to_mud(user_ptr, dir, 20 + randint1(30));
109     return TRUE;
110 }
111
112 bool activate_judgement(player_type *user_ptr, concptr name)
113 {
114     msg_format(_("%s\82Í\90Ô\82­\96¾\82é\82­\8cõ\82Á\82½\81I", "The %s flashes bright red!"), name);
115     chg_virtue(user_ptr, V_KNOWLEDGE, 1);
116     chg_virtue(user_ptr, V_ENLIGHTEN, 1);
117     wiz_lite(user_ptr, FALSE);
118
119     msg_format(_("%s\82Í\82 \82È\82½\82Ì\91Ì\97Í\82ð\92D\82Á\82½...", "The %s drains your vitality..."), name);
120     take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("\90R\94»\82Ì\95ó\90Î", "the Jewel of Judgement"), -1);
121
122     (void)detect_traps(user_ptr, DETECT_RAD_DEFAULT, TRUE);
123     (void)detect_doors(user_ptr, DETECT_RAD_DEFAULT);
124     (void)detect_stairs(user_ptr, DETECT_RAD_DEFAULT);
125
126     if (get_check(_("\8bA\8aÒ\82Ì\97Í\82ð\8eg\82¢\82Ü\82·\82©\81H", "Activate recall? ")))
127         (void)recall_player(user_ptr, randint0(21) + 15);
128
129     return TRUE;
130 }
131
132 bool activate_telekinesis(player_type *user_ptr, concptr name)
133 {
134     DIRECTION dir;
135     if (!get_aim_dir(user_ptr, &dir))
136         return FALSE;
137
138     msg_format(_("%s\82ð\90L\82Î\82µ\82½\81B", "You stretched your %s."), name);
139     fetch_item(user_ptr, dir, 500, TRUE);
140     return TRUE;
141 }
142
143 bool activate_unique_detection(player_type *user_ptr)
144 {
145     monster_type *m_ptr;
146     monster_race *r_ptr;
147     msg_print(_("\8aï\96­\82È\8fê\8f\8a\82ª\93ª\82Ì\92\86\82É\95\82\82©\82ñ\82¾\81D\81D\81D", "Some strange places show up in your mind. And you see ..."));
148     for (int i = user_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) {
149         m_ptr = &user_ptr->current_floor_ptr->m_list[i];
150         if (!monster_is_valid(m_ptr))
151             continue;
152
153         r_ptr = &r_info[m_ptr->r_idx];
154         if (r_ptr->flags1 & RF1_UNIQUE)
155             msg_format(_("%s\81D ", "%s. "), r_name + r_ptr->name);
156     }
157
158     return TRUE;
159 }
160
161 bool activate_dispel_curse(player_type *user_ptr, concptr name)
162 {
163     msg_format(_("%s\82ª\90^\8eÀ\82ð\8fÆ\82ç\82µ\8fo\82·...", "The %s exhibits the truth..."), name);
164     (void)remove_all_curse(user_ptr);
165     (void)probing(user_ptr);
166     return TRUE;
167 }
168
169 bool activate_cure_lw(player_type *user_ptr)
170 {
171     (void)set_afraid(user_ptr, 0);
172     (void)hp_player(user_ptr, 30);
173     return TRUE;
174 }
175
176 bool activate_grand_cross(player_type *user_ptr)
177 {
178     msg_print(_("\81u\88Å\82É\8aÒ\82ê\81I\81v", "You say, 'Return to darkness!'"));
179     (void)project(user_ptr, 0, 8, user_ptr->y, user_ptr->x, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
180     return TRUE;
181 }
182
183 bool activate_call_chaos(player_type *user_ptr)
184 {
185     msg_print(_("\97l\81X\82È\90F\82Ì\89Î\89Ô\82ð\94­\82µ\82Ä\82¢\82é...", "It glows in scintillating colours..."));
186     call_chaos(user_ptr);
187     return TRUE;
188 }
189
190 bool activate_dispel_evil(player_type *user_ptr)
191 {
192     msg_print(_("\90_\90¹\82È\95µ\88Í\8bC\82ª\8f[\96\9e\82µ\82½...", "It floods the area with goodness..."));
193     dispel_evil(user_ptr, user_ptr->lev * 5);
194     return TRUE;
195 }
196
197 bool activate_dispel_good(player_type *user_ptr)
198 {
199     msg_print(_("\8e×\88«\82È\95µ\88Í\8bC\82ª\8f[\96\9e\82µ\82½...", "It floods the area with evil..."));
200     dispel_good(user_ptr, user_ptr->lev * 5);
201     return TRUE;
202 }
203
204 bool activate_all_monsters_detection(player_type *user_ptr)
205 {
206     (void)detect_monsters_invis(user_ptr, 255);
207     (void)detect_monsters_normal(user_ptr, 255);
208     return TRUE;
209 }
210
211 bool activate_all_detection(player_type *user_ptr)
212 {
213     msg_print(_("\94\92\82­\96¾\82é\82­\8bP\82¢\82Ä\82¢\82é...", "It glows bright white..."));
214     msg_print(_("\90S\82É\83C\83\81\81[\83W\82ª\95\82\82©\82ñ\82Å\82«\82½...", "An image forms in your mind..."));
215     detect_all(user_ptr, DETECT_RAD_DEFAULT);
216     return TRUE;
217 }
218
219 bool activate_extra_detection(player_type *user_ptr)
220 {
221     msg_print(_("\96¾\82é\82­\8bP\82¢\82Ä\82¢\82é...", "It glows brightly..."));
222     detect_all(user_ptr, DETECT_RAD_DEFAULT);
223     probing(user_ptr);
224     identify_fully(user_ptr, FALSE, 0);
225     return TRUE;
226 }
227
228 bool activate_fully_identification(player_type *user_ptr)
229 {
230     msg_print(_("\89©\90F\82­\8bP\82¢\82Ä\82¢\82é...", "It glows yellow..."));
231     identify_fully(user_ptr, FALSE, 0);
232     return TRUE;
233 }
234
235 /*!
236  * @brief switch_activation() \82©\82ç\8cÂ\81X\82Ì\83X\83y\83\8b\82Ö\82Ì\88Ë\91\90«\82ð\82È\82­\82·\82½\82ß\82Ì\83V\83\93\83^\83b\83N\83X\83V\83\85\83K\81[
237  * @param user_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
238  * @return \94­\93®\82É\90¬\8c÷\82µ\82½\82çTRUE
239  */
240 bool activate_identification(player_type *user_ptr) { return ident_spell(user_ptr, FALSE, 0); }
241
242 bool activate_pesticide(player_type *user_ptr)
243 {
244     msg_print(_("\82 \82È\82½\82Í\8aQ\92\8e\82ð\88ê\91|\82µ\82½\81B", "You exterminate small life."));
245     (void)dispel_monsters(user_ptr, 4);
246     return TRUE;
247 }
248
249 /*!
250  * @brief switch_activation() \82©\82ç\8cÂ\81X\82Ì\83X\83y\83\8b\82Ö\82Ì\88Ë\91\90«\82ð\82È\82­\82·\82½\82ß\82Ì\83V\83\93\83^\83b\83N\83X\83V\83\85\83K\81[
251  * @param user_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
252  * @return \94­\93®\82É\90¬\8c÷\82µ\82½\82çTRUE
253  */
254 bool activate_whirlwind(player_type *user_ptr)
255 {
256     massacre(user_ptr);
257     return TRUE;
258 }
259
260 bool activate_blinding_light(player_type *user_ptr, concptr name)
261 {
262     msg_format(_("%s\82ªá¿\82µ\82¢\8cõ\82Å\8bP\82¢\82½...", "The %s gleams with blinding light..."), name);
263     (void)fire_ball(user_ptr, GF_LITE, 0, 300, 6);
264     confuse_monsters(user_ptr, 3 * user_ptr->lev / 2);
265     return TRUE;
266 }
267
268 bool activate_sleep(player_type *user_ptr)
269 {
270     msg_print(_("\90[\90Â\90F\82É\8bP\82¢\82Ä\82¢\82é...", "It glows deep blue..."));
271     sleep_monsters_touch(user_ptr);
272     return TRUE;
273 }
274
275 bool activate_door_destroy(player_type *user_ptr)
276 {
277     msg_print(_("\96¾\82é\82¢\90Ô\90F\82É\8bP\82¢\82Ä\82¢\82é...", "It glows bright red..."));
278     destroy_doors_touch(user_ptr);
279     return TRUE;
280 }
281
282 bool activate_earthquake(player_type *user_ptr)
283 {
284     earthquake(user_ptr, user_ptr->y, user_ptr->x, 5, 0);
285     return TRUE;
286 }
287
288 bool activate_recharge(player_type *user_ptr)
289 {
290     recharge(user_ptr, 130);
291     return TRUE;
292 }
293
294 bool activate_recharge_extra(player_type *user_ptr, concptr name)
295 {
296     msg_format(_("%s\82ª\94\92\82­\8bP\82¢\82½\81D\81D\81D", "The %s gleams with blinding light..."), name);
297     return recharge(user_ptr, 1000);
298 }
299
300 bool activate_shikofumi(player_type *user_ptr)
301 {
302     msg_print(_("\97Í\8b­\82­\8el\8cÒ\82ð\93¥\82ñ\82¾\81B", "You stamp. (as if you are in a ring.)"));
303     (void)set_afraid(user_ptr, 0);
304     (void)set_hero(user_ptr, randint1(20) + 20, FALSE);
305     (void)dispel_evil(user_ptr, user_ptr->lev * 3);
306     return TRUE;
307 }
308
309 bool activate_terror(player_type *user_ptr)
310 {
311     turn_monsters(user_ptr, 40 + user_ptr->lev);
312     return TRUE;
313
314 }