OSDN Git Service

[Refactor] #40634 Separated activation-bolt-ball.c/h from activation-switcher.c
[hengband/hengband.git] / src / object-activation / activation-switcher.c
1 /*!
2  * @brief プレイヤーの発動コマンド実装
3  * @date 2018/09/07
4  * @author deskull
5  */
6
7 #include "object-activation/activation-switcher.h"
8 #include "action/action-limited.h"
9 #include "action/activation-execution.h"
10 #include "art-definition/art-bow-types.h"
11 #include "art-definition/art-sword-types.h"
12 #include "art-definition/art-weapon-types.h"
13 #include "art-definition/random-art-effects.h"
14 #include "artifact/artifact-info.h"
15 #include "cmd-io/cmd-save.h"
16 #include "core/asking-player.h"
17 #include "core/hp-mp-processor.h"
18 #include "core/player-update-types.h"
19 #include "core/window-redrawer.h"
20 #include "effect/effect-characteristics.h"
21 #include "effect/spells-effect-util.h"
22 #include "floor/cave.h"
23 #include "floor/floor-object.h"
24 #include "floor/floor.h"
25 #include "game-option/disturbance-options.h"
26 #include "game-option/input-options.h"
27 #include "game-option/special-options.h"
28 #include "grid/feature-flag-types.h"
29 #include "grid/grid.h"
30 #include "main/sound-definitions-table.h"
31 #include "main/sound-of-music.h"
32 #include "monster-floor/monster-generator.h"
33 #include "monster-floor/monster-summon.h"
34 #include "monster-floor/place-monster-types.h"
35 #include "monster-race/monster-race.h"
36 #include "monster-race/race-flags1.h"
37 #include "monster/monster-info.h"
38 #include "monster/monster-status.h"
39 #include "monster/monster-util.h"
40 #include "monster/smart-learn-types.h"
41 #include "object-activation/activation-bolt-ball.h"
42 #include "object-activation/activation-breath.h"
43 #include "object-enchant/activation-info-table.h"
44 #include "object-enchant/dragon-breaths-table.h"
45 #include "object-enchant/object-ego.h"
46 #include "object-hook/hook-enchant.h"
47 #include "object-hook/hook-magic.h"
48 #include "object/item-tester-hooker.h"
49 #include "object/item-use-flags.h"
50 #include "object/object-flags.h"
51 #include "object/object-info.h"
52 #include "object/object-kind.h"
53 #include "player-attack/player-attack.h"
54 #include "player/attack-defense-types.h"
55 #include "player/avatar.h"
56 #include "player/digestion-processor.h"
57 #include "player/player-damage.h"
58 #include "player/player-race-types.h"
59 #include "player/special-defense-types.h"
60 #include "racial/racial-android.h"
61 #include "specific-object/death-crimson.h"
62 #include "spell-kind/earthquake.h"
63 #include "spell-kind/magic-item-recharger.h"
64 #include "spell-kind/spells-beam.h"
65 #include "spell-kind/spells-charm.h"
66 #include "spell-kind/spells-curse-removal.h"
67 #include "spell-kind/spells-detection.h"
68 #include "spell-kind/spells-fetcher.h"
69 #include "spell-kind/spells-floor.h"
70 #include "spell-kind/spells-genocide.h"
71 #include "spell-kind/spells-grid.h"
72 #include "spell-kind/spells-launcher.h"
73 #include "spell-kind/spells-lite.h"
74 #include "spell-kind/spells-neighbor.h"
75 #include "spell-kind/spells-perception.h"
76 #include "spell-kind/spells-random.h"
77 #include "spell-kind/spells-sight.h"
78 #include "spell-kind/spells-specific-bolt.h"
79 #include "spell-kind/spells-teleport.h"
80 #include "spell-kind/spells-world.h"
81 #include "spell-realm/spells-hex.h"
82 #include "spell-realm/spells-sorcery.h"
83 #include "spell/process-effect.h"
84 #include "spell/spell-types.h"
85 #include "spell/spells-object.h"
86 #include "spell/spells-status.h"
87 #include "spell/spells-summon.h"
88 #include "status/action-setter.h"
89 #include "status/bad-status-setter.h"
90 #include "status/base-status.h"
91 #include "status/body-improvement.h"
92 #include "status/buff-setter.h"
93 #include "status/element-resistance.h"
94 #include "status/experience.h"
95 #include "status/shape-changer.h"
96 #include "status/sight-setter.h"
97 #include "status/temporary-resistance.h"
98 #include "sv-definition/sv-lite-types.h"
99 #include "sv-definition/sv-ring-types.h"
100 #include "system/artifact-type-definition.h"
101 #include "system/floor-type-definition.h"
102 #include "target/target-getter.h"
103 #include "term/screen-processor.h"
104 #include "util/bit-flags-calculator.h"
105 #include "util/quarks.h"
106 #include "util/sort.h"
107 #include "view/display-messages.h"
108 #include "world/world.h"
109
110 bool activate_sunlight(player_type *user_ptr)
111 {
112     DIRECTION dir;
113     if (!get_aim_dir(user_ptr, &dir))
114         return FALSE;
115
116     msg_print(_("太陽光線が放たれた。", "A line of sunlight appears."));
117     (void)lite_line(user_ptr, dir, damroll(6, 8));
118     return TRUE;
119 }
120
121 bool activate_ring_of_power(player_type *user_ptr, concptr name)
122 {
123     DIRECTION dir;
124     msg_format(_("%sは漆黒に輝いた...", "The %s glows intensely black..."), name);
125     if (!get_aim_dir(user_ptr, &dir))
126         return FALSE;
127
128     ring_of_power(user_ptr, dir);
129     return TRUE;
130 }
131
132 bool activate_bladeturner(player_type *user_ptr)
133 {
134     DIRECTION dir;
135     if (!get_aim_dir(user_ptr, &dir))
136         return FALSE;
137
138     msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
139     fire_breath(user_ptr, GF_MISSILE, dir, 300, 4);
140     msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
141     (void)set_afraid(user_ptr, 0);
142     (void)set_hero(user_ptr, randint1(50) + 50, FALSE);
143     (void)hp_player(user_ptr, 10);
144     (void)set_blessed(user_ptr, randint1(50) + 50, FALSE);
145     (void)set_oppose_acid(user_ptr, randint1(50) + 50, FALSE);
146     (void)set_oppose_elec(user_ptr, randint1(50) + 50, FALSE);
147     (void)set_oppose_fire(user_ptr, randint1(50) + 50, FALSE);
148     (void)set_oppose_cold(user_ptr, randint1(50) + 50, FALSE);
149     (void)set_oppose_pois(user_ptr, randint1(50) + 50, FALSE);
150     return TRUE;
151 }
152
153 bool activate_confusion(player_type *user_ptr)
154 {
155     DIRECTION dir;
156     msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
157     if (!get_aim_dir(user_ptr, &dir))
158         return FALSE;
159
160     confuse_monster(user_ptr, dir, 20);
161     return TRUE;
162 }
163
164 bool activate_teleport_away(player_type *user_ptr)
165 {
166     DIRECTION dir;
167     if (!get_aim_dir(user_ptr, &dir))
168         return FALSE;
169
170     (void)fire_beam(user_ptr, GF_AWAY_ALL, dir, user_ptr->lev);
171     return TRUE;
172 }
173
174 bool activate_banish_evil(player_type *user_ptr)
175 {
176     if (banish_evil(user_ptr, 100))
177         msg_print(_("アーティファクトの力が邪悪を打ち払った!", "The power of the artifact banishes evil!"));
178
179     return TRUE;
180 }
181
182 bool activate_scare(player_type *user_ptr)
183 {
184     if (music_singing_any(user_ptr))
185         stop_singing(user_ptr);
186
187     if (hex_spelling_any(user_ptr))
188         stop_hex_spell_all(user_ptr);
189
190     msg_print(_("あなたは力強い突風を吹き鳴らした。周囲の敵が震え上っている!", "You wind a mighty blast; your enemies tremble!"));
191     (void)turn_monsters(user_ptr, (3 * user_ptr->lev / 2) + 10);
192     return TRUE;
193 }
194
195 bool activate_aggravation(player_type *user_ptr, object_type *o_ptr, concptr name)
196 {
197     if (o_ptr->name1 == ART_HYOUSIGI)
198         msg_print(_("拍子木を打った。", "You beat your wooden clappers."));
199     else
200         msg_format(_("%sは不快な物音を立てた。", "The %s sounds an unpleasant noise."), name);
201
202     aggravate_monsters(user_ptr, 0);
203     return TRUE;
204 }
205
206 bool switch_activation(player_type *user_ptr, object_type *o_ptr, const activation_type *const act_ptr, concptr name)
207 {
208     DIRECTION dir;
209     switch (act_ptr->index) {
210     case ACT_SUNLIGHT:
211         return activate_sunlight(user_ptr);
212     case ACT_BO_MISS_1:
213         return activate_missile_1(user_ptr);
214     case ACT_BA_POIS_1:
215         return activate_ball_pois_1(user_ptr);
216     case ACT_BO_ELEC_1:
217         return activate_bolt_elec_1(user_ptr);
218     case ACT_BO_ACID_1:
219         return activate_bolt_acid_1(user_ptr);
220     case ACT_BO_COLD_1:
221         return activate_bolt_cold_1(user_ptr);
222     case ACT_BO_FIRE_1:
223         return activate_bolt_fire_1(user_ptr);
224     case ACT_BA_COLD_1:
225         return activate_ball_cold_1(user_ptr);
226     case ACT_BA_COLD_2:
227         return activate_ball_cold_2(user_ptr);
228     case ACT_BA_COLD_3:
229         return activate_ball_cold_2(user_ptr);
230     case ACT_BA_FIRE_1:
231         return activate_ball_fire_1(user_ptr);
232     case ACT_BA_FIRE_2:
233         return activate_ball_fire_2(user_ptr, name);
234     case ACT_BA_FIRE_3:
235         return activate_ball_fire_3(user_ptr);
236     case ACT_BA_FIRE_4:
237         return activate_ball_fire_4(user_ptr);
238     case ACT_BA_ELEC_2:
239         return activate_ball_elec_2(user_ptr);
240     case ACT_BA_ELEC_3:
241         return activate_ball_elec_3(user_ptr);
242     case ACT_BA_ACID_1:
243         return activate_ball_acid_1(user_ptr);
244     case ACT_BA_NUKE_1:
245         return activate_ball_nuke_1(user_ptr);
246     case ACT_HYPODYNAMIA_1:
247         return activate_bolt_hypodynamia_1(user_ptr, name);
248     case ACT_HYPODYNAMIA_2:
249         return activate_bolt_hypodynamia_2(user_ptr);
250     case ACT_DRAIN_1:
251         return activate_bolt_drain_1(user_ptr);
252     case ACT_BO_MISS_2:
253         return activate_missile_2(user_ptr);
254     case ACT_WHIRLWIND:
255         massacre(user_ptr);
256         return TRUE;
257     case ACT_DRAIN_2:
258         return activate_bolt_drain_2(user_ptr);
259     case ACT_CALL_CHAOS:
260         msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
261         call_chaos(user_ptr);
262         return TRUE;
263     case ACT_ROCKET:
264         return activate_rocket(user_ptr);
265     case ACT_DISP_EVIL:
266         msg_print(_("神聖な雰囲気が充満した...", "It floods the area with goodness..."));
267         dispel_evil(user_ptr, user_ptr->lev * 5);
268         return TRUE;
269     case ACT_BA_MISS_3:
270         return activate_missile_3(user_ptr);
271     case ACT_DISP_GOOD:
272         msg_print(_("邪悪な雰囲気が充満した...", "It floods the area with evil..."));
273         dispel_good(user_ptr, user_ptr->lev * 5);
274         return TRUE;
275     case ACT_BO_MANA:
276         return activate_bolt_mana(user_ptr, name);
277     case ACT_BA_WATER:
278         return activate_ball_water(user_ptr, name);
279     case ACT_BA_DARK:
280         return activate_ball_dark(user_ptr, name);
281     case ACT_BA_MANA:
282         return activate_ball_mana(user_ptr, name);
283     case ACT_PESTICIDE:
284         msg_print(_("あなたは害虫を一掃した。", "You exterminate small life."));
285         (void)dispel_monsters(user_ptr, 4);
286         return TRUE;
287     case ACT_BLINDING_LIGHT:
288         msg_format(_("%sが眩しい光で輝いた...", "The %s gleams with blinding light..."), name);
289         (void)fire_ball(user_ptr, GF_LITE, 0, 300, 6);
290         confuse_monsters(user_ptr, 3 * user_ptr->lev / 2);
291         return TRUE;
292     case ACT_BIZARRE:
293         return activate_ring_of_power(user_ptr, name);
294     case ACT_CAST_BA_STAR:
295         return activate_ball_lite(user_ptr, name);
296     case ACT_BLADETURNER:
297         return activate_bladeturner(user_ptr);
298     case ACT_BR_FIRE:
299         return activate_breath_fire(user_ptr, o_ptr);
300     case ACT_BR_COLD:
301         return activate_breath_cold(user_ptr, o_ptr);
302     case ACT_BR_DRAGON:
303         return activate_dragon_breath(user_ptr, o_ptr);
304     case ACT_CONFUSE:
305         return activate_confusion(user_ptr);
306     case ACT_SLEEP:
307         msg_print(_("深青色に輝いている...", "It glows deep blue..."));
308         sleep_monsters_touch(user_ptr);
309         return TRUE;
310     case ACT_QUAKE:
311         earthquake(user_ptr, user_ptr->y, user_ptr->x, 5, 0);
312         return TRUE;
313     case ACT_TERROR:
314         turn_monsters(user_ptr, 40 + user_ptr->lev);
315         return TRUE;
316     case ACT_TELE_AWAY:
317         return activate_teleport_away(user_ptr);
318     case ACT_BANISH_EVIL:
319         return activate_banish_evil(user_ptr);
320     case ACT_GENOCIDE:
321         msg_print(_("深青色に輝いている...", "It glows deep blue..."));
322         (void)symbol_genocide(user_ptr, 200, TRUE);
323         return TRUE;
324     case ACT_MASS_GENO:
325         msg_print(_("ひどく鋭い音が流れ出た...", "It lets out a long, shrill note..."));
326         (void)mass_genocide(user_ptr, 200, TRUE);
327         return TRUE;
328     case ACT_SCARE_AREA:
329         return activate_scare(user_ptr);
330     case ACT_AGGRAVATE:
331         return activate_aggravation(user_ptr, o_ptr, name);
332     case ACT_CHARM_ANIMAL:
333         if (!get_aim_dir(user_ptr, &dir))
334             return FALSE;
335
336         (void)charm_animal(user_ptr, dir, user_ptr->lev);
337         return TRUE;
338     case ACT_CHARM_UNDEAD:
339         if (!get_aim_dir(user_ptr, &dir))
340             return FALSE;
341
342         (void)control_one_undead(user_ptr, dir, user_ptr->lev);
343         return TRUE;
344     case ACT_CHARM_OTHER:
345         if (!get_aim_dir(user_ptr, &dir))
346             return FALSE;
347
348         (void)charm_monster(user_ptr, dir, user_ptr->lev * 2);
349         return TRUE;
350     case ACT_CHARM_ANIMALS:
351         (void)charm_animals(user_ptr, user_ptr->lev * 2);
352         return TRUE;
353     case ACT_CHARM_OTHERS:
354         (void)charm_monsters(user_ptr, user_ptr->lev * 2);
355         return TRUE;
356     case ACT_SUMMON_ANIMAL:
357         (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, user_ptr->lev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
358         return TRUE;
359     case ACT_SUMMON_PHANTOM:
360         msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
361         (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
362         return TRUE;
363     case ACT_SUMMON_ELEMENTAL:
364         return cast_summon_elemental(user_ptr, (user_ptr->lev * 3) / 2);
365     case ACT_SUMMON_DEMON:
366         cast_summon_demon(user_ptr, (user_ptr->lev * 3) / 2);
367         return TRUE;
368     case ACT_SUMMON_UNDEAD:
369         return cast_summon_undead(user_ptr, (user_ptr->lev * 3) / 2);
370     case ACT_SUMMON_HOUND:
371         return cast_summon_hound(user_ptr, (user_ptr->lev * 3) / 2);
372     case ACT_SUMMON_DAWN:
373         msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
374         (void)summon_specific(user_ptr, -1, user_ptr->y, user_ptr->x, user_ptr->current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
375         return TRUE;
376     case ACT_SUMMON_OCTOPUS:
377         return cast_summon_octopus(user_ptr);
378     case ACT_CHOIR_SINGS:
379         msg_print(_("天国の歌が聞こえる...", "A heavenly choir sings..."));
380         (void)cure_critical_wounds(user_ptr, 777);
381         (void)set_hero(user_ptr, randint1(25) + 25, FALSE);
382         return TRUE;
383     case ACT_CURE_LW:
384         (void)set_afraid(user_ptr, 0);
385         (void)hp_player(user_ptr, 30);
386         return TRUE;
387     case ACT_CURE_MW:
388         msg_print(_("深紫色の光を発している...", "It radiates deep purple..."));
389         (void)cure_serious_wounds(user_ptr, 4, 8);
390         return TRUE;
391     case ACT_CURE_POISON:
392         msg_print(_("深青色に輝いている...", "It glows deep blue..."));
393         (void)set_afraid(user_ptr, 0);
394         (void)set_poisoned(user_ptr, 0);
395         return TRUE;
396     case ACT_REST_EXP:
397         msg_print(_("深紅に輝いている...", "It glows a deep red..."));
398         restore_level(user_ptr);
399         return TRUE;
400     case ACT_REST_ALL:
401         msg_print(_("濃緑色に輝いている...", "It glows a deep green..."));
402         (void)restore_all_status(user_ptr);
403         (void)restore_level(user_ptr);
404         return TRUE;
405     case ACT_CURE_700:
406         msg_print(_("深青色に輝いている...", "It glows deep blue..."));
407         msg_print(_("体内に暖かい鼓動が感じられる...", "You feel a warm tingling inside..."));
408         (void)cure_critical_wounds(user_ptr, 700);
409         return TRUE;
410     case ACT_CURE_1000:
411         msg_print(_("白く明るく輝いている...", "It glows a bright white..."));
412         msg_print(_("ひじょうに気分がよい...", "You feel much better..."));
413         (void)cure_critical_wounds(user_ptr, 1000);
414         return TRUE;
415     case ACT_CURING:
416         msg_format(_("%sの優しさに癒される...", "the %s cures you affectionately ..."), name);
417         true_healing(user_ptr, 0);
418         return TRUE;
419     case ACT_CURE_MANA_FULL:
420         msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
421         restore_mana(user_ptr, TRUE);
422         return TRUE;
423     case ACT_ESP:
424         (void)set_tim_esp(user_ptr, randint1(30) + 25, FALSE);
425         return TRUE;
426     case ACT_BERSERK:
427         (void)berserk(user_ptr, randint1(25) + 25);
428         return TRUE;
429     case ACT_PROT_EVIL:
430         msg_format(_("%sから鋭い音が流れ出た...", "The %s lets out a shrill wail..."), name);
431         (void)set_protevil(user_ptr, randint1(25) + user_ptr->lev * 3, FALSE);
432         return TRUE;
433     case ACT_RESIST_ALL:
434         msg_print(_("様々な色に輝いている...", "It glows many colours..."));
435         (void)set_oppose_acid(user_ptr, randint1(40) + 40, FALSE);
436         (void)set_oppose_elec(user_ptr, randint1(40) + 40, FALSE);
437         (void)set_oppose_fire(user_ptr, randint1(40) + 40, FALSE);
438         (void)set_oppose_cold(user_ptr, randint1(40) + 40, FALSE);
439         (void)set_oppose_pois(user_ptr, randint1(40) + 40, FALSE);
440         return TRUE;
441     case ACT_SPEED:
442         msg_print(_("明るく緑色に輝いている...", "It glows bright green..."));
443         (void)set_fast(user_ptr, randint1(20) + 20, FALSE);
444         return TRUE;
445     case ACT_XTRA_SPEED:
446         msg_print(_("明るく輝いている...", "It glows brightly..."));
447         (void)set_fast(user_ptr, randint1(75) + 75, FALSE);
448         return TRUE;
449     case ACT_WRAITH:
450         set_wraith_form(user_ptr, randint1(user_ptr->lev / 2) + (user_ptr->lev / 2), FALSE);
451         return TRUE;
452     case ACT_INVULN:
453         (void)set_invuln(user_ptr, randint1(8) + 8, FALSE);
454         return TRUE;
455     case ACT_HERO:
456         (void)heroism(user_ptr, 25);
457         return TRUE;
458     case ACT_HERO_SPEED:
459         (void)set_fast(user_ptr, randint1(50) + 50, FALSE);
460         (void)heroism(user_ptr, 50);
461         return TRUE;
462     case ACT_RESIST_ACID:
463         msg_format(_("%sが黒く輝いた...", "The %s grows black."), name);
464         if ((o_ptr->tval != TV_RING) || (o_ptr->sval != SV_RING_ACID))
465             return TRUE;
466
467         if (!get_aim_dir(user_ptr, &dir))
468             return FALSE;
469
470         (void)fire_ball(user_ptr, GF_ACID, dir, 100, 2);
471         (void)set_oppose_acid(user_ptr, randint1(20) + 20, FALSE);
472         return TRUE;
473     case ACT_RESIST_FIRE:
474         msg_format(_("%sが赤く輝いた...", "The %s grows red."), name);
475         if ((o_ptr->tval != TV_RING) || (o_ptr->sval != SV_RING_FLAMES))
476             return TRUE;
477
478         if (!get_aim_dir(user_ptr, &dir))
479             return FALSE;
480
481         (void)fire_ball(user_ptr, GF_FIRE, dir, 100, 2);
482         (void)set_oppose_fire(user_ptr, randint1(20) + 20, FALSE);
483         return TRUE;
484     case ACT_RESIST_COLD:
485         msg_format(_("%sが白く輝いた...", "The %s grows white."), name);
486         if ((o_ptr->tval != TV_RING) || (o_ptr->sval != SV_RING_ICE))
487             return TRUE;
488
489         if (!get_aim_dir(user_ptr, &dir))
490             return FALSE;
491
492         (void)fire_ball(user_ptr, GF_COLD, dir, 100, 2);
493         (void)set_oppose_cold(user_ptr, randint1(20) + 20, FALSE);
494         return TRUE;
495     case ACT_RESIST_ELEC:
496         msg_format(_("%sが青く輝いた...", "The %s grows blue."), name);
497         if ((o_ptr->tval != TV_RING) || (o_ptr->sval != SV_RING_ELEC))
498             return TRUE;
499
500         if (!get_aim_dir(user_ptr, &dir))
501             return FALSE;
502
503         (void)fire_ball(user_ptr, GF_ELEC, dir, 100, 2);
504         (void)set_oppose_elec(user_ptr, randint1(20) + 20, FALSE);
505         return TRUE;
506     case ACT_RESIST_POIS:
507         msg_format(_("%sが緑に輝いた...", "The %s grows green."), name);
508         (void)set_oppose_pois(user_ptr, randint1(20) + 20, FALSE);
509         return TRUE;
510     case ACT_LIGHT:
511         msg_format(_("%sから澄んだ光があふれ出た...", "The %s wells with clear light..."), name);
512         lite_area(user_ptr, damroll(2, 15), 3);
513         return TRUE;
514     case ACT_MAP_LIGHT:
515         msg_print(_("眩しく輝いた...", "It shines brightly..."));
516         map_area(user_ptr, DETECT_RAD_MAP);
517         lite_area(user_ptr, damroll(2, 15), 3);
518         return TRUE;
519     case ACT_DETECT_ALL:
520         msg_print(_("白く明るく輝いている...", "It glows bright white..."));
521         msg_print(_("心にイメージが浮かんできた...", "An image forms in your mind..."));
522         detect_all(user_ptr, DETECT_RAD_DEFAULT);
523         return TRUE;
524     case ACT_DETECT_XTRA:
525         msg_print(_("明るく輝いている...", "It glows brightly..."));
526         detect_all(user_ptr, DETECT_RAD_DEFAULT);
527         probing(user_ptr);
528         identify_fully(user_ptr, FALSE, 0);
529         return TRUE;
530     case ACT_ID_FULL:
531         msg_print(_("黄色く輝いている...", "It glows yellow..."));
532         identify_fully(user_ptr, FALSE, 0);
533         return TRUE;
534     case ACT_ID_PLAIN:
535         return ident_spell(user_ptr, FALSE, 0);
536     case ACT_RUNE_EXPLO:
537         msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
538         explosive_rune(user_ptr, user_ptr->y, user_ptr->x);
539         return TRUE;
540     case ACT_RUNE_PROT:
541         msg_print(_("ブルーに明るく輝いている...", "It glows light blue..."));
542         warding_glyph(user_ptr);
543         return TRUE;
544     case ACT_SATIATE:
545         (void)set_food(user_ptr, PY_FOOD_MAX - 1);
546         return TRUE;
547     case ACT_DEST_DOOR:
548         msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
549         destroy_doors_touch(user_ptr);
550         return TRUE;
551     case ACT_STONE_MUD:
552         msg_print(_("鼓動している...", "It pulsates..."));
553         if (!get_aim_dir(user_ptr, &dir))
554             return FALSE;
555
556         wall_to_mud(user_ptr, dir, 20 + randint1(30));
557         return TRUE;
558     case ACT_RECHARGE:
559         recharge(user_ptr, 130);
560         return TRUE;
561     case ACT_ALCHEMY:
562         msg_print(_("明るい黄色に輝いている...", "It glows bright yellow..."));
563         (void)alchemy(user_ptr);
564         return TRUE;
565     case ACT_DIM_DOOR:
566         msg_print(_("次元の扉が開いた。目的地を選んで下さい。", "You open a dimensional gate. Choose a destination."));
567         return dimension_door(user_ptr);
568     case ACT_TELEPORT:
569         msg_print(_("周りの空間が歪んでいる...", "It twists space around you..."));
570         teleport_player(user_ptr, 100, TELEPORT_SPONTANEOUS);
571         return TRUE;
572     case ACT_RECALL:
573         msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
574         return recall_player(user_ptr, randint0(21) + 15);
575     case ACT_JUDGE:
576         msg_format(_("%sは赤く明るく光った!", "The %s flashes bright red!"), name);
577         chg_virtue(user_ptr, V_KNOWLEDGE, 1);
578         chg_virtue(user_ptr, V_ENLIGHTEN, 1);
579         wiz_lite(user_ptr, FALSE);
580
581         msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
582         take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1);
583
584         (void)detect_traps(user_ptr, DETECT_RAD_DEFAULT, TRUE);
585         (void)detect_doors(user_ptr, DETECT_RAD_DEFAULT);
586         (void)detect_stairs(user_ptr, DETECT_RAD_DEFAULT);
587
588         if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
589             (void)recall_player(user_ptr, randint0(21) + 15);
590
591         return TRUE;
592     case ACT_TELEKINESIS:
593         if (!get_aim_dir(user_ptr, &dir))
594             return FALSE;
595
596         msg_format(_("%sを伸ばした。", "You stretched your %s."), name);
597         fetch_item(user_ptr, dir, 500, TRUE);
598         return TRUE;
599     case ACT_DETECT_UNIQUE: {
600         monster_type *m_ptr;
601         monster_race *r_ptr;
602         msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ..."));
603         for (int i = user_ptr->current_floor_ptr->m_max - 1; i >= 1; i--) {
604             m_ptr = &user_ptr->current_floor_ptr->m_list[i];
605             if (!monster_is_valid(m_ptr))
606                 continue;
607
608             r_ptr = &r_info[m_ptr->r_idx];
609             if (r_ptr->flags1 & RF1_UNIQUE)
610                 msg_format(_("%s. ", "%s. "), r_name + r_ptr->name);
611         }
612
613         return TRUE;
614     }
615     case ACT_ESCAPE:
616         switch (randint1(13)) {
617         case 1:
618         case 2:
619         case 3:
620         case 4:
621         case 5:
622             teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
623             return TRUE;
624         case 6:
625         case 7:
626         case 8:
627         case 9:
628         case 10:
629             teleport_player(user_ptr, 222, TELEPORT_SPONTANEOUS);
630             return TRUE;
631         case 11:
632         case 12:
633             (void)stair_creation(user_ptr);
634             return TRUE;
635         default:
636             if (!get_check(_("この階を去りますか?", "Leave this level? ")))
637                 return TRUE;
638
639             if (autosave_l)
640                 do_cmd_save_game(user_ptr, TRUE);
641
642             user_ptr->leaving = TRUE;
643             return TRUE;
644         }
645     case ACT_DISP_CURSE_XTRA:
646         msg_format(_("%sが真実を照らし出す...", "The %s exhibits the truth..."), name);
647         (void)remove_all_curse(user_ptr);
648         (void)probing(user_ptr);
649         return TRUE;
650     case ACT_BRAND_FIRE_BOLTS:
651         msg_format(_("%sが深紅に輝いた...", "Your %s glows deep red..."), name);
652         brand_bolts(user_ptr);
653         return TRUE;
654     case ACT_RECHARGE_XTRA:
655         msg_format(_("%sが白く輝いた...", "The %s gleams with blinding light..."), name);
656         return recharge(user_ptr, 1000);
657     case ACT_LORE:
658         msg_print(_("石が隠された秘密を写し出した...", "The stone reveals hidden mysteries..."));
659         return perilous_secrets(user_ptr);
660     case ACT_SHIKOFUMI:
661         msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
662         (void)set_afraid(user_ptr, 0);
663         (void)set_hero(user_ptr, randint1(20) + 20, FALSE);
664         (void)dispel_evil(user_ptr, user_ptr->lev * 3);
665         return TRUE;
666     case ACT_PHASE_DOOR:
667         teleport_player(user_ptr, 10, TELEPORT_SPONTANEOUS);
668         return TRUE;
669     case ACT_DETECT_ALL_MONS:
670         (void)detect_monsters_invis(user_ptr, 255);
671         (void)detect_monsters_normal(user_ptr, 255);
672         return TRUE;
673     case ACT_ULTIMATE_RESIST: {
674         TIME_EFFECT v = randint1(25) + 25;
675         (void)set_afraid(user_ptr, 0);
676         (void)set_hero(user_ptr, v, FALSE);
677         (void)hp_player(user_ptr, 10);
678         (void)set_blessed(user_ptr, v, FALSE);
679         (void)set_oppose_acid(user_ptr, v, FALSE);
680         (void)set_oppose_elec(user_ptr, v, FALSE);
681         (void)set_oppose_fire(user_ptr, v, FALSE);
682         (void)set_oppose_cold(user_ptr, v, FALSE);
683         (void)set_oppose_pois(user_ptr, v, FALSE);
684         (void)set_ultimate_res(user_ptr, v, FALSE);
685         return TRUE;
686     }
687     case ACT_CAST_OFF:
688         cosmic_cast_off(user_ptr, o_ptr);
689         return TRUE;
690     case ACT_FALLING_STAR:
691         msg_print(_("あなたは妖刀に魅入られた…", "You are enchanted by cursed blade..."));
692         msg_print(_("「狂ほしく 血のごとき 月はのぼれり 秘めおきし 魔剣 いずこぞや」", "'Behold the blade arts.'"));
693         massacre(user_ptr);
694         return TRUE;
695     case ACT_GRAND_CROSS:
696         msg_print(_("「闇に還れ!」", "You say, 'Return to darkness!'"));
697         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);
698         return TRUE;
699     case ACT_TELEPORT_LEVEL:
700         if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)")))
701             return FALSE;
702
703         teleport_level(user_ptr, 0);
704         return TRUE;
705     case ACT_STRAIN_HASTE:
706         msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
707         take_hit(user_ptr, DAMAGE_LOSELIFE, damroll(3, 8), _("加速した疲労", "the strain of haste"), -1);
708         (void)set_fast(user_ptr, user_ptr->fast + 25 + randint1(25), FALSE);
709         return TRUE;
710     case ACT_FISHING:
711         return fishing(user_ptr);
712     case ACT_INROU:
713         mitokohmon(user_ptr);
714         return TRUE;
715     case ACT_MURAMASA:
716         if (o_ptr->name1 != ART_MURAMASA)
717             return FALSE;
718
719         if (!get_check(_("本当に使いますか?", "Are you sure?!")))
720             return TRUE;
721
722         msg_print(_("村正が震えた...", "The Muramasa pulsates..."));
723         do_inc_stat(user_ptr, A_STR);
724         if (one_in_(2)) {
725             msg_print(_("村正は壊れた!", "The Muramasa is destroyed!"));
726             curse_weapon_object(user_ptr, TRUE, o_ptr);
727         }
728
729         return TRUE;
730     case ACT_BLOODY_MOON:
731         if (o_ptr->name1 != ART_BLOOD)
732             return FALSE;
733
734         msg_print(_("鎌が明るく輝いた...", "Your scythe glows brightly!"));
735         get_bloody_moon_flags(o_ptr);
736         if (user_ptr->prace == RACE_ANDROID)
737             calc_android_exp(user_ptr);
738
739         user_ptr->update |= (PU_BONUS | PU_HP);
740         return TRUE;
741     case ACT_CRIMSON:
742         if (o_ptr->name1 != ART_CRIMSON)
743             return FALSE;
744
745         msg_print(_("せっかくだから『クリムゾン』をぶっぱなすぜ!", "I'll fire CRIMSON! SEKKAKUDAKARA!"));
746         return fire_crimson(user_ptr);
747     default:
748         msg_format(_("Unknown activation effect: %d.", "Unknown activation effect: %d."), act_ptr->index);
749         return FALSE;
750     }
751 }
752
753 /*!
754  * @brief アイテムの発動効果を処理する。
755  * @param user_ptr プレーヤーへの参照ポインタ
756  * @param o_ptr 対象のオブジェクト構造体ポインタ
757  * @return 発動実行の是非を返す。
758  */
759 bool activate_artifact(player_type *user_ptr, object_type *o_ptr)
760 {
761     concptr name = k_name + k_info[o_ptr->k_idx].name;
762     const activation_type *const act_ptr = find_activation_info(user_ptr, o_ptr);
763     if (!act_ptr) {
764         msg_print("Activation information is not found.");
765         return FALSE;
766     }
767
768     if (!switch_activation(user_ptr, o_ptr, act_ptr, name))
769         return FALSE;
770
771     if (act_ptr->timeout.constant >= 0) {
772         o_ptr->timeout = (s16b)act_ptr->timeout.constant;
773         if (act_ptr->timeout.dice > 0)
774             o_ptr->timeout += randint1(act_ptr->timeout.dice);
775
776         return TRUE;
777     }
778
779     switch (act_ptr->index) {
780     case ACT_BR_FIRE:
781         o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250;
782         return TRUE;
783     case ACT_BR_COLD:
784         o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250;
785         return TRUE;
786     case ACT_TERROR:
787         o_ptr->timeout = 3 * (user_ptr->lev + 10);
788         return TRUE;
789     case ACT_MURAMASA:
790         return TRUE;
791     default:
792         msg_format("Special timeout is not implemented: %d.", act_ptr->index);
793         return FALSE;
794     }
795 }