OSDN Git Service

[feature] ソースファイルをC++に対応
[hengbandforosx/hengbandosx.git] / src / object-activation / activation-others.c
1 /*!
2  * @brief 発動処理その他 (肥大化しがちなので適宜まとまりを別ファイルへ分割すること)
3  * @date 2020/08/19
4  * @author Hourier
5  */
6
7 #include "object-activation/activation-others.h"
8 #include "artifact/fixed-art-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 "effect/effect-processor.h"
14 #include "game-option/special-options.h"
15 #include "monster-race/monster-race.h"
16 #include "monster-race/race-flags1.h"
17 #include "monster-race/race-indice-types.h"
18 #include "monster/monster-status.h"
19 #include "player-attack/player-attack.h"
20 #include "player-info/avatar.h"
21 #include "player/player-damage.h"
22 #include "spell-kind/earthquake.h"
23 #include "spell-kind/magic-item-recharger.h"
24 #include "spell-kind/spells-beam.h"
25 #include "spell-kind/spells-curse-removal.h"
26 #include "spell-kind/spells-detection.h"
27 #include "spell-kind/spells-fetcher.h"
28 #include "spell-kind/spells-floor.h"
29 #include "spell-kind/spells-grid.h"
30 #include "spell-kind/spells-launcher.h"
31 #include "spell-kind/spells-lite.h"
32 #include "spell-kind/spells-neighbor.h"
33 #include "spell-kind/spells-perception.h"
34 #include "spell-kind/spells-random.h"
35 #include "spell-kind/spells-sight.h"
36 #include "spell-kind/spells-teleport.h"
37 #include "spell-kind/spells-world.h"
38 #include "spell-realm/spells-hex.h"
39 #include "spell/spell-types.h"
40 #include "spell/spells-status.h"
41 #include "status/bad-status-setter.h"
42 #include "status/buff-setter.h"
43 #include "system/floor-type-definition.h"
44 #include "system/object-type-definition.h"
45 #include "target/target-getter.h"
46 #include "util/quarks.h"
47 #include "view/display-messages.h"
48
49 bool activate_sunlight(player_type *user_ptr)
50 {
51     DIRECTION dir;
52     if (!get_aim_dir(user_ptr, &dir))
53         return FALSE;
54
55     msg_print(_("太陽光線が放たれた。", "A line of sunlight appears."));
56     (void)lite_line(user_ptr, dir, damroll(6, 8));
57     return TRUE;
58 }
59
60 bool activate_confusion(player_type *user_ptr)
61 {
62     DIRECTION dir;
63     msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
64     if (!get_aim_dir(user_ptr, &dir))
65         return FALSE;
66
67     confuse_monster(user_ptr, dir, 20);
68     return TRUE;
69 }
70
71 bool activate_banish_evil(player_type *user_ptr)
72 {
73     if (banish_evil(user_ptr, 100))
74         msg_print(_("アーティファクトの力が邪悪を打ち払った!", "The power of the artifact banishes evil!"));
75
76     return TRUE;
77 }
78
79 bool activate_scare(player_type *user_ptr)
80 {
81     if (music_singing_any(user_ptr))
82         stop_singing(user_ptr);
83
84     if (hex_spelling_any(user_ptr))
85         stop_hex_spell_all(user_ptr);
86
87     msg_print(_("あなたは力強い突風を吹き鳴らした。周囲の敵が震え上っている!", "You wind a mighty blast; your enemies tremble!"));
88     (void)turn_monsters(user_ptr, (3 * user_ptr->lev / 2) + 10);
89     return TRUE;
90 }
91
92 bool activate_aggravation(player_type *user_ptr, object_type *o_ptr, concptr name)
93 {
94     if (o_ptr->name1 == ART_HYOUSIGI)
95         msg_print(_("拍子木を打った。", "You beat your wooden clappers."));
96     else
97         msg_format(_("%sは不快な物音を立てた。", "The %s sounds an unpleasant noise."), name);
98
99     aggravate_monsters(user_ptr, 0);
100     return TRUE;
101 }
102
103 bool activate_stone_mud(player_type *user_ptr)
104 {
105     DIRECTION dir;
106     msg_print(_("鼓動している...", "It pulsates..."));
107     if (!get_aim_dir(user_ptr, &dir))
108         return FALSE;
109
110     wall_to_mud(user_ptr, dir, 20 + randint1(30));
111     return TRUE;
112 }
113
114 bool activate_judgement(player_type *user_ptr, concptr name)
115 {
116     msg_format(_("%sは赤く明るく光った!", "The %s flashes bright red!"), name);
117     chg_virtue(user_ptr, V_KNOWLEDGE, 1);
118     chg_virtue(user_ptr, V_ENLIGHTEN, 1);
119     wiz_lite(user_ptr, FALSE);
120
121     msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
122     take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1);
123
124     (void)detect_traps(user_ptr, DETECT_RAD_DEFAULT, TRUE);
125     (void)detect_doors(user_ptr, DETECT_RAD_DEFAULT);
126     (void)detect_stairs(user_ptr, DETECT_RAD_DEFAULT);
127
128     if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
129         (void)recall_player(user_ptr, randint0(21) + 15);
130
131     return TRUE;
132 }
133
134 bool activate_telekinesis(player_type *user_ptr, concptr name)
135 {
136     DIRECTION dir;
137     if (!get_aim_dir(user_ptr, &dir))
138         return FALSE;
139
140     msg_format(_("%sを伸ばした。", "You stretched your %s."), name);
141     fetch_item(user_ptr, dir, 500, TRUE);
142     return TRUE;
143 }
144
145 bool activate_unique_detection(player_type *user_ptr)
146 {
147     monster_type *m_ptr;
148     monster_race *r_ptr;
149     msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ..."));
150     for (int i = user_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) {
151         m_ptr = &user_ptr->current_floor_ptr->m_list[i];
152         if (!monster_is_valid(m_ptr))
153             continue;
154
155         r_ptr = &r_info[m_ptr->r_idx];
156         if (r_ptr->flags1 & RF1_UNIQUE)
157             msg_format(_("%s. ", "%s. "), r_name + r_ptr->name);
158
159         if (m_ptr->r_idx == MON_DIO)
160             msg_print(_("きさま! 見ているなッ!", "You bastard! You're watching me, well watch this!"));
161     }
162
163     return TRUE;
164 }
165
166 bool activate_dispel_curse(player_type *user_ptr, concptr name)
167 {
168     msg_format(_("%sが真実を照らし出す...", "The %s exhibits the truth..."), name);
169     (void)remove_all_curse(user_ptr);
170     (void)probing(user_ptr);
171     return TRUE;
172 }
173
174 bool activate_cure_lw(player_type *user_ptr)
175 {
176     (void)set_afraid(user_ptr, 0);
177     (void)hp_player(user_ptr, 30);
178     return TRUE;
179 }
180
181 bool activate_grand_cross(player_type *user_ptr)
182 {
183     msg_print(_("「闇に還れ!」", "You say, 'Return to darkness!'"));
184     (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);
185     return TRUE;
186 }
187
188 bool activate_call_chaos(player_type *user_ptr)
189 {
190     msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
191     call_chaos(user_ptr);
192     return TRUE;
193 }
194
195 bool activate_dispel_evil(player_type *user_ptr)
196 {
197     msg_print(_("神聖な雰囲気が充満した...", "It floods the area with goodness..."));
198     dispel_evil(user_ptr, user_ptr->lev * 5);
199     return TRUE;
200 }
201
202 bool activate_dispel_good(player_type *user_ptr)
203 {
204     msg_print(_("邪悪な雰囲気が充満した...", "It floods the area with evil..."));
205     dispel_good(user_ptr, user_ptr->lev * 5);
206     return TRUE;
207 }
208
209 bool activate_all_monsters_detection(player_type *user_ptr)
210 {
211     (void)detect_monsters_invis(user_ptr, 255);
212     (void)detect_monsters_normal(user_ptr, 255);
213     return TRUE;
214 }
215
216 bool activate_all_detection(player_type *user_ptr)
217 {
218     msg_print(_("白く明るく輝いている...", "It glows bright white..."));
219     msg_print(_("心にイメージが浮かんできた...", "An image forms in your mind..."));
220     detect_all(user_ptr, DETECT_RAD_DEFAULT);
221     return TRUE;
222 }
223
224 bool activate_extra_detection(player_type *user_ptr)
225 {
226     msg_print(_("明るく輝いている...", "It glows brightly..."));
227     detect_all(user_ptr, DETECT_RAD_DEFAULT);
228     probing(user_ptr);
229     identify_fully(user_ptr, FALSE, TV_NONE);
230     return TRUE;
231 }
232
233 bool activate_fully_identification(player_type *user_ptr)
234 {
235     msg_print(_("黄色く輝いている...", "It glows yellow..."));
236     identify_fully(user_ptr, FALSE, TV_NONE);
237     return TRUE;
238 }
239
240 /*!
241  * @brief switch_activation() から個々のスペルへの依存性をなくすためのシンタックスシュガー
242  * @param user_ptr プレーヤーへの参照ポインタ
243  * @return 発動に成功したらTRUE
244  */
245 bool activate_identification(player_type *user_ptr) { return ident_spell(user_ptr, FALSE, TV_NONE); }
246
247 bool activate_pesticide(player_type *user_ptr)
248 {
249     msg_print(_("あなたは害虫を一掃した。", "You exterminate some pests."));
250     (void)dispel_monsters(user_ptr, 4);
251     return TRUE;
252 }
253
254 /*!
255  * @brief switch_activation() から個々のスペルへの依存性をなくすためのシンタックスシュガー
256  * @param user_ptr プレーヤーへの参照ポインタ
257  * @return 発動に成功したらTRUE
258  */
259 bool activate_whirlwind(player_type *user_ptr)
260 {
261     massacre(user_ptr);
262     return TRUE;
263 }
264
265 bool activate_blinding_light(player_type *user_ptr, concptr name)
266 {
267     msg_format(_("%sが眩しい光で輝いた...", "The %s gleams with blinding light..."), name);
268     (void)fire_ball(user_ptr, GF_LITE, 0, 300, 6);
269     confuse_monsters(user_ptr, 3 * user_ptr->lev / 2);
270     return TRUE;
271 }
272
273 bool activate_sleep(player_type *user_ptr)
274 {
275     msg_print(_("深青色に輝いている...", "It glows deep blue..."));
276     sleep_monsters_touch(user_ptr);
277     return TRUE;
278 }
279
280 bool activate_door_destroy(player_type *user_ptr)
281 {
282     msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
283     destroy_doors_touch(user_ptr);
284     return TRUE;
285 }
286
287 bool activate_earthquake(player_type *user_ptr)
288 {
289     earthquake(user_ptr, user_ptr->y, user_ptr->x, 5, 0);
290     return TRUE;
291 }
292
293 bool activate_recharge(player_type *user_ptr)
294 {
295     recharge(user_ptr, 130);
296     return TRUE;
297 }
298
299 bool activate_recharge_extra(player_type *user_ptr, concptr name)
300 {
301     msg_format(_("%sが白く輝いた...", "The %s gleams with blinding light..."), name);
302     return recharge(user_ptr, 1000);
303 }
304
305 bool activate_shikofumi(player_type *user_ptr)
306 {
307     msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
308     (void)set_afraid(user_ptr, 0);
309     (void)set_hero(user_ptr, randint1(20) + 20, FALSE);
310     (void)dispel_evil(user_ptr, user_ptr->lev * 3);
311     return TRUE;
312 }
313
314 bool activate_terror(player_type *user_ptr)
315 {
316     turn_monsters(user_ptr, 40 + user_ptr->lev);
317     return TRUE;
318 }
319
320 bool activate_map_light(player_type *user_ptr)
321 {
322     msg_print(_("眩しく輝いた...", "It shines brightly..."));
323     map_area(user_ptr, DETECT_RAD_MAP);
324     lite_area(user_ptr, damroll(2, 15), 3);
325     return TRUE;
326 }
327
328 bool activate_exploding_rune(player_type *user_ptr)
329 {
330     msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
331     create_rune_explosion(user_ptr, user_ptr->y, user_ptr->x);
332     return TRUE;
333 }
334
335 bool activate_protection_rune(player_type *user_ptr)
336 {
337     msg_print(_("ブルーに明るく輝いている...", "It glows light blue..."));
338     create_rune_protection_one(user_ptr);
339     return TRUE;
340 }
341
342 bool activate_light(player_type *user_ptr, concptr name)
343 {
344     msg_format(_("%sから澄んだ光があふれ出た...", "The %s wells with clear light..."), name);
345     (void)lite_area(user_ptr, damroll(2, 15), 3);
346     return TRUE;
347 }
348
349 bool activate_recall(player_type *user_ptr)
350 {
351     msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
352     return recall_player(user_ptr, randint0(21) + 15);
353 }
354
355 bool activate_tree_creation(player_type *user_ptr, object_type *o_ptr, concptr name)
356 {
357     msg_format(_("%s%sから明るい緑の光があふれ出た...", "The %s%s wells with clear light..."), name, quark_str(o_ptr->art_name));
358     return tree_creation(user_ptr, user_ptr->y, user_ptr->x);
359 }
360
361 bool activate_animate_dead(player_type *user_ptr, object_type *o_ptr)
362 {
363     msg_print(_("黄金色の光が溢れ出た...", "It emitted a golden light..."));
364     if (o_ptr->name1 > 0)
365         msg_print(_("ぴぴるぴるぴるぴぴるぴ~♪", "Pipiru piru piru pipiru pii"));
366
367     return animate_dead(user_ptr, 0, user_ptr->y, user_ptr->x);
368 }