OSDN Git Service

[Refactor] #37353 spells-floor.c/h 追加。 / Add spells-floor.c/h.
[hengband/hengband.git] / src / cmd-activate.c
1 /*!
2 * @file cmd-activate.c
3 * @brief プレイヤーの発動コマンド実装
4 * @date 2018/09/07
5 * @details
6 * cmd6.cより分離。
7 */
8
9 #include "angband.h"
10 #include "cmd-activate.h"
11 #include "object-hook.h"
12 #include "spells-summon.h"
13 #include "sort.h"
14 #include "projection.h"
15 #include "artifact.h"
16 #include "avatar.h"
17 #include "spells-status.h"
18 #include "spells-object.h"
19 #include "spells-floor.h"
20 #include "realm-hex.h"
21 #include "player-status.h"
22
23 /*!
24  * @brief アイテムの発動効果テーブル /
25  * Define flags, levels, values of activations
26  */
27 const activation_type activation_info[] =
28 {
29         { "SUNLIGHT", ACT_SUNLIGHT, 10, 250, {10, 0},
30           _("太陽光線", "beam of sunlight") },
31         { "BO_MISS_1", ACT_BO_MISS_1, 10, 250, {2, 0},
32           _("マジック・ミサイル(2d6)", "magic missile (2d6)") },
33         { "BA_POIS_1", ACT_BA_POIS_1, 10, 300, {4, 0},
34           _("悪臭雲(12)", "stinking cloud (12)") },
35         { "BO_ELEC_1", ACT_BO_ELEC_1, 20, 250, {5, 0},
36           _("サンダー・ボルト(4d8)", "lightning bolt (4d8)") },
37         { "BO_ACID_1", ACT_BO_ACID_1, 20, 250, {6, 0},
38           _("アシッド・ボルト(5d8)", "acid bolt (5d8)") },
39         { "BO_COLD_1", ACT_BO_COLD_1, 20, 250, {7, 0},
40           _("アイス・ボルト(6d8)", "frost bolt (6d8)") },
41         { "BO_FIRE_1", ACT_BO_FIRE_1, 20, 250, {8, 0},
42           _("ファイア・ボルト(9d8)", "fire bolt (9d8)") },
43         { "BA_COLD_1", ACT_BA_COLD_1, 30, 750, {6, 0},
44           _("アイス・ボール(48)", "ball of cold (48)") },
45         { "BA_COLD_2", ACT_BA_COLD_2, 40, 1000, {12, 0},
46           _("アイス・ボール(100)", "ball of cold (100)") },
47         { "BA_COLD_3", ACT_BA_COLD_3, 70, 2500, {50, 0},
48           _("巨大アイス・ボール(400)", "ball of cold (400)") },
49         { "BA_FIRE_1", ACT_BA_FIRE_1, 30, 1000, {9, 0},
50           _("ファイア・ボール(72)", "ball of fire (72)") },
51         { "BA_FIRE_2", ACT_BA_FIRE_2, 40, 1500, {15, 0},
52           _("巨大ファイア・ボール(120)", "large fire ball (120)") },
53         { "BA_FIRE_3", ACT_BA_FIRE_3, 60, 1750, {40, 0},
54           _("巨大ファイア・ボール(300)", "fire ball (300)") },
55         { "BA_FIRE_4", ACT_BA_FIRE_4, 40, 1000, {12, 0},
56           _("ファイア・ボール(100)", "fire ball (100)") },
57         { "BA_ELEC_2", ACT_BA_ELEC_2, 40, 1000, {12, 0},
58           _("サンダー・ボール(100)", "ball of lightning (100)") },
59         { "BA_ELEC_3", ACT_BA_ELEC_3, 70, 2500, {70, 0},
60           _("巨大サンダー・ボール(500)", "ball of lightning (500)") },
61         { "BA_ACID_1", ACT_BA_ACID_1, 30, 1000, {12, 0},
62           _("アシッド・ボール(100)", "ball of acid (100)") },
63         { "BA_NUKE_1", ACT_BA_NUKE_1, 50, 1000, {12, 0},
64           _("放射能球(100)", "ball of nuke (100)") },
65         { "HYPODYNAMIA_1", ACT_HYPODYNAMIA_1, 30, 500, {12, 0},
66           _("窒息攻撃(100)", "a strangling attack (100)") },
67         { "HYPODYNAMIA_2", ACT_HYPODYNAMIA_2, 40, 750, {15, 0},
68           _("衰弱の矢(120)", "hypodynamic bolt (120)") },
69         { "DRAIN_1", ACT_DRAIN_1, 40, 1000, {20, 0},
70           _("吸収の矢(3*50)", "drain bolt (3*50)") },
71         { "BO_MISS_2", ACT_BO_MISS_2, 40, 1000, {20, 0},
72           _("矢(150)", "arrows (150)") },
73         { "WHIRLWIND", ACT_WHIRLWIND, 50, 7500, {25, 0},
74           _("カマイタチ", "whirlwind attack") },
75         { "DRAIN_2", ACT_DRAIN_2, 50, 2500, {40, 0},
76           _("吸収の矢(3*100)", "drain bolt (3*100)") },
77         { "CALL_CHAOS", ACT_CALL_CHAOS, 70, 5000, {35, 0},
78           _("混沌召来", "call chaos") },
79         { "ROCKET", ACT_ROCKET, 70, 5000, {20, 0},
80           _("ロケット(120+レベル)", "launch rocket (120+level)") },
81         { "DISP_EVIL", ACT_DISP_EVIL, 50, 4000, {50, 0},
82           _("邪悪退散(x5)", "dispel evil (x5)") },
83         { "BA_MISS_3", ACT_BA_MISS_3, 50, 1500, {50, 0},
84           _("エレメントのブレス(300)", "elemental breath (300)") },
85         { "DISP_GOOD", ACT_DISP_GOOD, 50, 3500, {50, 0},
86           _("善良退散(x5)", "dispel good (x5)") },
87         { "BO_MANA", ACT_BO_MANA, 40, 1500, {20, 0},
88           _("魔法の矢(150)", "a magical arrow (150)") },
89         { "BA_WATER", ACT_BA_WATER, 50, 2000, {25, 0},
90           _("ウォーター・ボール(200)", "water ball (200)") },
91         { "BA_STAR", ACT_BA_STAR, 50, 2200, {25, 0},
92           _("巨大スター・ボール(200)", "large star ball (200)") },
93         { "BA_DARK", ACT_BA_DARK, 50, 2200, {30, 0},
94           _("暗黒の嵐(250)", "darkness storm (250)") },
95         { "BA_MANA", ACT_BA_MANA, 70, 2500, {30, 0},
96           _("魔力の嵐(250)", "a mana storm (250)") },
97         { "PESTICIDE", ACT_PESTICIDE, 10, 500, {10, 0},
98           _("害虫の駆除", "dispel small life") },
99         { "BLINDING_LIGHT", ACT_BLINDING_LIGHT, 30, 5000, {40, 0},
100           _("眩しい光", "blinding light") },
101         { "BIZARRE", ACT_BIZARRE, 90, 10000, {50, 0},
102           _("信じ難いこと", "bizarre things") },
103         { "CAST_BA_STAR", ACT_CAST_BA_STAR, 70, 7500, {100, 0},
104           _("スター・ボール・ダスト(150)", "cast star balls (150)") },
105         { "BLADETURNER", ACT_BLADETURNER, 80, 20000, {80, 0},
106           _("エレメントのブレス(300), 士気高揚、祝福、耐性", "breathe elements (300), hero, bless, and resistance") },
107         { "BR_FIRE", ACT_BR_FIRE, 50, 5000, {-1, 0},
108           _("火炎のブレス (200)", "fire breath (200)") },
109         { "BR_COLD", ACT_BR_COLD, 50, 5000, {-1, 0},
110           _("冷気のブレス (200)", "cold breath (200)") },
111         { "BR_DRAGON", ACT_BR_DRAGON, 70, 10000, { 30, 0 },
112           "" /* built by item_activation_dragon_breath() */ },
113
114         { "CONFUSE", ACT_CONFUSE, 10, 500, {10, 0},
115           _("パニック・モンスター", "confuse monster") },
116         { "SLEEP", ACT_SLEEP, 10, 750, {15, 0},
117           _("周囲のモンスターを眠らせる", "sleep nearby monsters") },
118         { "QUAKE", ACT_QUAKE, 30, 600, {20, 0},
119           _("地震", "earthquake") },
120         { "TERROR", ACT_TERROR, 20, 2500, {-1, 0},
121           _("恐慌", "terror") },
122         { "TELE_AWAY", ACT_TELE_AWAY, 20, 2000, {15, 0},
123           _("テレポート・アウェイ", "teleport away") },
124         { "BANISH_EVIL", ACT_BANISH_EVIL, 40, 2000, {250, 0},
125           _("邪悪消滅", "banish evil") },
126         { "GENOCIDE", ACT_GENOCIDE, 50, 10000, {500, 0},
127           _("抹殺", "genocide") },
128         { "MASS_GENO", ACT_MASS_GENO, 50, 10000, {1000, 0},
129           _("周辺抹殺", "mass genocide") },
130         { "SCARE_AREA", ACT_SCARE_AREA, 20, 2500, {20, 0},
131           _("モンスター恐慌", "frighten monsters") },
132         { "AGGRAVATE", ACT_AGGRAVATE, 0, 100, {0, 0},
133           _("モンスターを怒らせる", "aggravete monsters") },
134
135         { "CHARM_ANIMAL", ACT_CHARM_ANIMAL, 40, 7500, {200, 0},
136           _("動物魅了", "charm animal") },
137         { "CHARM_UNDEAD", ACT_CHARM_UNDEAD, 40, 10000, {333, 0},
138           _("アンデッド従属", "enslave undead") },
139         { "CHARM_OTHER", ACT_CHARM_OTHER, 40, 10000, {400, 0},
140           _("モンスター魅了", "charm monster") },
141         { "CHARM_ANIMALS", ACT_CHARM_ANIMALS, 40, 12500, {500, 0},
142           _("動物友和", "animal friendship") },
143         { "CHARM_OTHERS", ACT_CHARM_OTHERS, 40, 17500, {750, 0},
144           _("周辺魅了", "mass charm") },
145         { "SUMMON_ANIMAL", ACT_SUMMON_ANIMAL, 50, 10000, {200, 300},
146           _("動物召喚", "summon animal") },
147         { "SUMMON_PHANTOM", ACT_SUMMON_PHANTOM, 50, 12000, {200, 200},
148           _("幻霊召喚", "summon phantasmal servant") },
149         { "SUMMON_ELEMENTAL", ACT_SUMMON_ELEMENTAL, 50, 15000, {750, 0},
150           _("エレメンタル召喚", "summon elemental") },
151         { "SUMMON_DEMON", ACT_SUMMON_DEMON, 50, 20000, {666, 0},
152           _("悪魔召喚", "summon demon") },
153         { "SUMMON_UNDEAD", ACT_SUMMON_UNDEAD, 50, 20000, {666, 0},
154           _("アンデッド召喚", "summon undead") },
155         { "SUMMON_HOUND", ACT_SUMMON_HOUND, 50, 15000, {300, 0},
156           _("ハウンド召喚", "summon hound") },
157         { "SUMMON_DAWN", ACT_SUMMON_DAWN, 50, 15000, {500, 0},
158           _("暁の師団召喚", "summon the Legion of the Dawn") },
159         { "SUMMON_OCTOPUS", ACT_SUMMON_OCTOPUS, 50, 15000, {300, 0},
160           _("蛸の大群召喚", "summon octopus") },
161
162         { "CHOIR_SINGS", ACT_CHOIR_SINGS, 60, 20000, {300, 0},
163           _("回復(777)、癒し、士気高揚", "heal 777 hit points, curing and HEROism") },
164         { "CURE_LW", ACT_CURE_LW, 10, 500, {10, 0},
165           _("恐怖除去/体力回復(30)", "remove fear and heal 30 hp") },
166         { "CURE_MW", ACT_CURE_MW, 20, 750, {3, 3},
167           _("傷回復(4d8)", "heal 4d8 and wounds") },
168         { "CURE_POISON", ACT_CURE_POISON, 10, 1000, {5, 0},
169           _("恐怖除去/毒消し", "remove fear and cure poison") },
170         { "REST_LIFE", ACT_REST_EXP, 40, 7500, {450, 0},
171           _("経験値復活", "restore experience") },
172         { "REST_ALL", ACT_REST_ALL, 30, 15000, {750, 0},
173           _("全ステータスと経験値復活", "restore stats and experience") },
174         { "CURE_700", ACT_CURE_700, 40, 10000, {250, 0},
175           _("体力回復(700)", "heal 700 hit points") },
176         { "CURE_1000", ACT_CURE_1000, 50, 15000, {888, 0},
177           _("体力回復(1000)", "heal 1000 hit points") },
178         { "CURING", ACT_CURING, 30, 5000, {100, 0},
179           _("癒し", "curing") },
180         { "CURE_MANA_FULL", ACT_CURE_MANA_FULL, 60, 20000, {777, 0},
181           _("魔力復活", "restore mana") },
182
183         { "ESP", ACT_ESP, 30, 1500, {100, 0},
184           _("テレパシー(期間 25+d30)", "telepathy (dur 25+d30)") },
185         { "BERSERK", ACT_BERSERK, 10, 800, {75, 0},
186           _("狂戦士化(25+d25ターン)", "berserk (25+d25 turns)") },
187         { "PROT_EVIL", ACT_PROT_EVIL, 30, 5000, {100, 0},
188           _("対邪悪結界(期間 3*レベル+d25)", "protect evil (dur level*3 + d25)") },
189         { "RESIST_ALL", ACT_RESIST_ALL, 30, 5000, {111, 0},
190           _("全耐性(期間 20+d20)", "resist elements (dur 20+d20)") },
191         { "SPEED", ACT_SPEED, 40, 15000, {250, 0},
192           _("加速(期間 20+d20)", "speed (dur 20+d20)") },
193         { "XTRA_SPEED", ACT_XTRA_SPEED, 40, 25000, {200, 200},
194           _("加速(期間 75+d75)", "speed (dur 75+d75)") },
195         { "WRAITH", ACT_WRAITH, 90, 25000, {1000, 0},
196           _("幽体化(期間 (レベル/2)+d(レベル/2))", "wraith form (dur level/2 + d(level/2))") },
197         { "INVULN", ACT_INVULN, 90, 25000, {1000, 0},
198           _("無敵化(期間 8+d8)", "invulnerability (dur 8+d8)") },
199         { "HERO", ACT_HERO, 10, 500, {30, 30},
200           _("士気高揚", "heroism") },
201         { "HERO_SPEED", ACT_HERO_SPEED, 30, 20000, {100, 200},
202           _("士気高揚, スピード(期間 50+d50ターン)", "hero and +10 to speed (50)") },
203         { "RESIST_ACID", ACT_RESIST_ACID, 20, 2000, {40, 40},
204           _("酸への耐性(期間 20+d20)", "resist acid (dur 20+d20)") },
205         { "RESIST_FIRE", ACT_RESIST_FIRE, 20, 2000, {40, 40},
206           _("火炎への耐性(期間 20+d20)", "resist fire (dur 20+d20)") },
207         { "RESIST_COLD", ACT_RESIST_COLD, 20, 2000, {40, 40},
208           _("冷気への耐性(期間 20+d20)", "resist cold (dur 20+d20)") },
209         { "RESIST_ELEC", ACT_RESIST_ELEC, 20, 2000, {40, 40},
210           _("電撃への耐性(期間 20+d20)", "resist elec (dur 20+d20)") },
211         { "RESIST_POIS", ACT_RESIST_POIS, 20, 2000, {40, 40},
212           _("毒への耐性(期間 20+d20)", "resist poison (dur 20+d20)") },
213
214         { "LIGHT", ACT_LIGHT, 10, 150, {10, 10},
215           _("イルミネーション", "light area (dam 2d15)") },
216         { "MAP_LIGHT", ACT_MAP_LIGHT, 30, 500, {50, 50},
217           _("魔法の地図と光", "light (dam 2d15) & map area") },
218         { "DETECT_ALL", ACT_DETECT_ALL, 30, 1000, {55, 55},
219           _("全感知", "detection") },
220         { "DETECT_XTRA", ACT_DETECT_XTRA, 50, 12500, {100, 0},
221           _("全感知、探索、*鑑定*", "detection, probing and identify true") },
222         { "ID_FULL", ACT_ID_FULL, 50, 10000, {75, 0},
223           _("*鑑定*", "identify true") },
224         { "ID_PLAIN", ACT_ID_PLAIN, 20, 1250, {10, 0},
225           _("鑑定", "identify spell") },
226         { "RUNE_EXPLO", ACT_RUNE_EXPLO, 40, 4000, {200, 0},
227           _("爆発のルーン", "explosive rune") },
228         { "RUNE_PROT", ACT_RUNE_PROT, 60, 10000, {400, 0},
229           _("守りのルーン", "rune of protection") },
230         { "SATIATE", ACT_SATIATE, 10, 2000, {200, 0},
231           _("空腹充足", "satisfy hunger") },
232         { "DEST_DOOR", ACT_DEST_DOOR, 10, 100, {10, 0},
233           _("ドア破壊", "destroy doors") },
234         { "STONE_MUD", ACT_STONE_MUD, 20, 1000, {3, 0},
235           _("岩石溶解", "stone to mud") },
236         { "RECHARGE", ACT_RECHARGE, 30, 1000, {70, 0},
237           _("魔力充填", "recharging") },
238         { "ALCHEMY", ACT_ALCHEMY, 50, 10000, {500, 0},
239           _("錬金術", "alchemy") },
240         { "DIM_DOOR", ACT_DIM_DOOR, 50, 10000, {100, 0},
241           _("次元の扉", "dimension door") },
242         { "TELEPORT", ACT_TELEPORT, 10, 2000, {25, 0},
243           _("テレポート", "teleport") },
244         { "RECALL", ACT_RECALL, 30, 7500, {200, 0},
245           _("帰還の詔", "word of recall") },
246         { "JUDGE", ACT_JUDGE, 90, 50000, {20, 20},
247           _("体力と引き替えに千里眼と帰還", "a telekinesis (500 lb)") },
248         { "TELEKINESIS", ACT_TELEKINESIS, 20, 5500, {25, 25},
249           _("物体を引き寄せる(重量25kgまで)", "clairvoyance and recall, draining you") },
250         { "DETECT_UNIQUE", ACT_DETECT_UNIQUE, 40, 10000, {200, 0},
251           _("この階にいるユニークモンスターを表示", "list of the uniques on the level") },
252         { "ESCAPE", ACT_ESCAPE, 10, 3000, {35, 0},
253           _("逃走", "a getaway") },
254         { "DISP_CURSE_XTRA", ACT_DISP_CURSE_XTRA, 40, 30000, {0, 0},
255           _("*解呪*と調査", "dispel curse and probing") },
256         { "BRAND_FIRE_BOLTS", ACT_BRAND_FIRE_BOLTS, 40, 20000, {999, 0},
257           _("刃先のファイア・ボルト", "fire branding of bolts") },
258         { "RECHARGE_XTRA", ACT_RECHARGE_XTRA, 70, 30000, {200, 0},
259           _("魔力充填", "recharge item") },
260         { "LORE", ACT_LORE, 10, 30000, {0, 0},
261           _("危険を伴う鑑定", "perilous identify") },
262         { "SHIKOFUMI", ACT_SHIKOFUMI, 10, 10000, {100, 100},
263           _("四股踏み", "shiko") },
264         { "PHASE_DOOR", ACT_PHASE_DOOR, 10, 1500, {10, 0},
265           _("ショート・テレポート", "blink") },
266         { "DETECT_ALL_MONS", ACT_DETECT_ALL_MONS, 30, 3000, {150, 0},
267           _("全モンスター感知", "detect all monsters") },
268         { "ULTIMATE_RESIST", ACT_ULTIMATE_RESIST, 90, 20000, {777, 0},
269           _("士気高揚、祝福、究極の耐性", "hero, bless, and ultimate resistance") },
270
271         { "CAST_OFF", ACT_CAST_OFF, 30, 15000, {100, 0},
272           _("脱衣と小宇宙燃焼", "cast it off and cosmic heroism") },
273         { "FISHING", ACT_FISHING, 0, 100, {0, 0},
274           _("釣りをする", "fishing") },
275         { "INROU", ACT_INROU, 40, 15000, {150, 150},
276           _("例のアレ", "reveal your identity") },
277         { "MURAMASA", ACT_MURAMASA, 0, 0, {-1, 0},
278           _("腕力の上昇", "increase STR") },
279         { "BLOODY_MOON", ACT_BLOODY_MOON, 0, 0, {3333, 0},
280           _("属性変更", "change zokusei") },
281         { "CRIMSON", ACT_CRIMSON, 0, 50000, {15, 0},
282           _("ファイア!", "fire!") },
283
284         { "STRAIN_HASTE", ACT_STRAIN_HASTE, 10, 1000, {120, 100},
285           _("体力と引き換えに加速", "haste with strain") },
286         { "GRAND_CROSS", ACT_GRAND_CROSS, 30, 15000, {250, 200},
287           _("グランド・クロス", "grand cross") },
288         { "TELEPORT_LEVEL", ACT_TELEPORT_LEVEL, 10, 1500, {100, 200},
289           _("テレポート・レベル", "teleort level") },
290         { "ARTS_FALLING_STAR", ACT_FALLING_STAR, 20, 5500, {30, 50},
291           _("魔剣・流れ星", "blade arts 'falling star'") },
292         { NULL, 0, 0, 0, {0, 0},
293           "" }
294 };
295
296 /*!
297 * @brief ペット入りモンスターボールをソートするための比較関数
298 * @param u 所持品配列の参照ポインタ
299 * @param v 未使用
300 * @param a 所持品ID1
301 * @param b 所持品ID2
302 * @return 1の方が大であればTRUE
303 */
304 static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
305 {
306         u16b *who = (u16b*)(u);
307
308         int w1 = who[a];
309         int w2 = who[b];
310
311         monster_type *m_ptr1 = &m_list[w1];
312         monster_type *m_ptr2 = &m_list[w2];
313         monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
314         monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
315
316         /* Unused */
317         (void)v;
318
319         if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
320         if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
321
322         if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
323         if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
324
325         if (r_ptr1->level > r_ptr2->level) return TRUE;
326         if (r_ptr2->level > r_ptr1->level) return FALSE;
327
328         if (m_ptr1->hp > m_ptr2->hp) return TRUE;
329         if (m_ptr2->hp > m_ptr1->hp) return FALSE;
330
331         return w1 <= w2;
332 }
333
334
335 /*!
336  * @brief 装備を発動するコマンドのサブルーチン /
337  * Activate a wielded object.  Wielded objects never stack.
338  * And even if they did, activatable objects never stack.
339  * @param item 発動するオブジェクトの所持品ID
340  * @return なし
341  * @details
342  * <pre>
343  * Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
344  * But one could, for example, easily make an activatable "Ring of Plasma".
345  * Note that it always takes a turn to activate an artifact, even if
346  * the user hits "escape" at the "direction" prompt.
347  * </pre>
348  */
349 void do_cmd_activate_aux(INVENTORY_IDX item)
350 {
351         DIRECTION dir;
352         DEPTH lev;
353         int chance, fail;
354         object_type *o_ptr;
355         bool success;
356
357
358         /* Get the item (in the pack) */
359         if (item >= 0)
360         {
361                 o_ptr = &inventory[item];
362         }
363
364         /* Get the item (on the floor) */
365         else
366         {
367                 o_ptr = &o_list[0 - item];
368         }
369
370         take_turn(p_ptr, 100);
371
372         /* Extract the item level */
373         lev = k_info[o_ptr->k_idx].level;
374
375         /* Hack -- use artifact level instead */
376         if (object_is_fixed_artifact(o_ptr)) lev = a_info[o_ptr->name1].level;
377         else if (object_is_random_artifact(o_ptr))
378         {
379                 const activation_type* const act_ptr = find_activation_info(o_ptr);
380                 if (act_ptr) {
381                         lev = act_ptr->level;
382                 }
383         }
384         else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
385
386         /* Base chance of success */
387         chance = p_ptr->skill_dev;
388
389         /* Confusion hurts skill */
390         if (p_ptr->confused) chance = chance / 2;
391
392         fail = lev+5;
393         if (chance > fail) fail -= (chance - fail)*2;
394         else chance -= (fail - chance)*2;
395         if (fail < USE_DEVICE) fail = USE_DEVICE;
396         if (chance < USE_DEVICE) chance = USE_DEVICE;
397
398         if(cmd_limit_time_walk(p_ptr)) return;
399
400         if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
401         else if (chance > fail)
402         {
403                 if (randint0(chance*2) < fail) success = FALSE;
404                 else success = TRUE;
405         }
406         else
407         {
408                 if (randint0(fail*2) < chance) success = TRUE;
409                 else success = FALSE;
410         }
411
412         /* Roll for usage */
413         if (!success)
414         {
415                 if (flush_failure) flush();
416                 msg_print(_("うまく始動させることができなかった。", "You failed to activate it properly."));
417                 sound(SOUND_FAIL);
418                 return;
419         }
420
421         /* Check the recharge */
422         if (o_ptr->timeout)
423         {
424                 msg_print(_("それは微かに音を立て、輝き、消えた...", "It whines, glows and fades..."));
425                 return;
426         }
427
428         /* Some lights need enough fuel for activation */
429         if (!o_ptr->xtra4 && (o_ptr->tval == TV_FLASK) &&
430                 ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
431         {
432                 msg_print(_("燃料がない。", "It has no fuel."));
433                 free_turn(p_ptr);
434                 return;
435         }
436
437         /* Activate the artifact */
438         msg_print(_("始動させた...", "You activate it..."));
439
440         sound(SOUND_ZAP);
441
442         /* Activate object */
443         if (activation_index(o_ptr))
444         {
445                 (void)activate_artifact(o_ptr);
446
447                 p_ptr->window |= (PW_INVEN | PW_EQUIP);
448
449                 /* Success */
450                 return;
451         }
452
453         /* Special items */
454         else if (o_ptr->tval == TV_WHISTLE)
455         {
456                 if (music_singing_any()) stop_singing(p_ptr);
457                 if (hex_spelling_any()) stop_hex_spell_all();
458
459                 {
460                         IDX pet_ctr, i;
461                         MONSTER_IDX *who;
462                         int max_pet = 0;
463                         u16b dummy_why;
464
465                         /* Allocate the "who" array */
466                         C_MAKE(who, max_m_idx, MONSTER_IDX);
467
468                         /* Process the monsters (backwards) */
469                         for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
470                         {
471                                 if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
472                                   who[max_pet++] = pet_ctr;
473                         }
474
475                         /* Select the sort method */
476                         ang_sort_comp = ang_sort_comp_pet;
477                         ang_sort_swap = ang_sort_swap_hook;
478
479                         ang_sort(who, &dummy_why, max_pet);
480
481                         /* Process the monsters (backwards) */
482                         for (i = 0; i < max_pet; i++)
483                         {
484                                 pet_ctr = who[i];
485                                 teleport_monster_to(pet_ctr, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
486                         }
487
488                         /* Free the "who" array */
489                         C_KILL(who, max_m_idx, IDX);
490                 }
491                 o_ptr->timeout = 100 + randint1(100);
492                 return;
493         }
494         else if (o_ptr->tval == TV_CAPTURE)
495         {
496                 if(!o_ptr->pval)
497                 {
498                         bool old_target_pet = target_pet;
499                         target_pet = TRUE;
500                         if (!get_aim_dir(&dir))
501                         {
502                                 target_pet = old_target_pet;
503                                 return;
504                         }
505                         target_pet = old_target_pet;
506
507                         if(fire_ball(GF_CAPTURE, dir, 0, 0))
508                         {
509                                 o_ptr->pval = (PARAMETER_VALUE)cap_mon;
510                                 o_ptr->xtra3 = (XTRA8)cap_mspeed;
511                                 o_ptr->xtra4 = (XTRA16)cap_hp;
512                                 o_ptr->xtra5 = (XTRA16)cap_maxhp;
513                                 if (cap_nickname)
514                                 {
515                                         concptr t;
516                                         char *s;
517                                         char buf[80] = "";
518
519                                         if (o_ptr->inscription)
520                                                 strcpy(buf, quark_str(o_ptr->inscription));
521                                         s = buf;
522                                         for (s = buf;*s && (*s != '#'); s++)
523                                         {
524 #ifdef JP
525                                                 if (iskanji(*s)) s++;
526 #endif
527                                         }
528                                         *s = '#';
529                                         s++;
530 #ifdef JP
531  /*nothing*/
532 #else
533                                         *s++ = '\'';
534 #endif
535                                         t = quark_str(cap_nickname);
536                                         while (*t)
537                                         {
538                                                 *s = *t;
539                                                 s++;
540                                                 t++;
541                                         }
542 #ifdef JP
543  /*nothing*/
544 #else
545                                         *s++ = '\'';
546 #endif
547                                         *s = '\0';
548                                         o_ptr->inscription = quark_add(buf);
549                                 }
550                         }
551                 }
552                 else
553                 {
554                         success = FALSE;
555                         if (!get_direction(&dir, FALSE, FALSE)) return;
556                         if (monster_can_enter(p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
557                         {
558                                 if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
559                                 {
560                                         if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
561                                         if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
562                                         if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
563                                         m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
564                                         if (o_ptr->inscription)
565                                         {
566                                                 char buf[80];
567                                                 concptr t;
568 #ifndef JP
569                                                 bool quote = FALSE;
570 #endif
571
572                                                 t = quark_str(o_ptr->inscription);
573                                                 for (t = quark_str(o_ptr->inscription);*t && (*t != '#'); t++)
574                                                 {
575 #ifdef JP
576                                                         if (iskanji(*t)) t++;
577 #endif
578                                                 }
579                                                 if (*t)
580                                                 {
581                                                         char *s = buf;
582                                                         t++;
583 #ifdef JP
584                                                         /* nothing */
585 #else
586                                                         if (*t =='\'')
587                                                         {
588                                                                 t++;
589                                                                 quote = TRUE;
590                                                         }
591 #endif
592                                                         while(*t)
593                                                         {
594                                                                 *s = *t;
595                                                                 t++;
596                                                                 s++;
597                                                         }
598 #ifdef JP
599                                                         /* nothing */
600 #else
601                                                         if (quote && *(s-1) =='\'')
602                                                                 s--;
603 #endif
604                                                         *s = '\0';
605                                                         m_list[hack_m_idx_ii].nickname = quark_add(buf);
606                                                         t = quark_str(o_ptr->inscription);
607                                                         s = buf;
608                                                         while(*t && (*t != '#'))
609                                                         {
610                                                                 *s = *t;
611                                                                 t++;
612                                                                 s++;
613                                                         }
614                                                         *s = '\0';
615                                                         o_ptr->inscription = quark_add(buf);
616                                                 }
617                                         }
618                                         o_ptr->pval = 0;
619                                         o_ptr->xtra3 = 0;
620                                         o_ptr->xtra4 = 0;
621                                         o_ptr->xtra5 = 0;
622                                         success = TRUE;
623                                 }
624                         }
625                         if (!success)
626                                 msg_print(_("おっと、解放に失敗した。", "Oops.  You failed to release your pet."));
627                 }
628                 calc_android_exp();
629                 return;
630         }
631
632         /* Mistake */
633         msg_print(_("おっと、このアイテムは始動できない。", "Oops.  That object cannot be activated."));
634 }
635
636 /*!
637  * @brief 装備を発動するコマンドのメインルーチン /
638  * @return なし
639  */
640 void do_cmd_activate(void)
641 {
642         OBJECT_IDX item;
643         concptr q, s;
644
645         if (p_ptr->wild_mode) return;
646         if (cmd_limit_arena(p_ptr)) return;
647
648         if (p_ptr->special_defense & (KATA_MUSOU | KATA_KOUKIJIN))
649         {
650                 set_action(ACTION_NONE);
651         }
652
653         item_tester_hook = item_tester_hook_activate;
654
655         q = _("どのアイテムを始動させますか? ", "Activate which item? ");
656         s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
657
658         if (!choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
659
660         /* Activate the item */
661         do_cmd_activate_aux(item);
662 }
663
664 /*!
665 * @brief 発動によるブレスの属性をアイテムの耐性から選択し、実行を処理する。/ Dragon breath activation
666 * @details 対象となる耐性は dragonbreath_info テーブルを参照のこと。
667 * @param o_ptr 対象のオブジェクト構造体ポインタ
668 * @return 発動実行の是非を返す。
669 */
670 static bool activate_dragon_breath(object_type *o_ptr)
671 {
672         BIT_FLAGS flgs[TR_FLAG_SIZE]; /* for resistance flags */
673         int type[20];
674         concptr name[20];
675         int i, t, n = 0;
676         DIRECTION dir;
677
678         if (!get_aim_dir(&dir)) return FALSE;
679
680         object_flags(o_ptr, flgs);
681
682         for (i = 0; dragonbreath_info[i].flag != 0; i++)
683         {
684                 if (have_flag(flgs, dragonbreath_info[i].flag))
685                 {
686                         type[n] = dragonbreath_info[i].type;
687                         name[n] = dragonbreath_info[i].name;
688                         n++;
689                 }
690         }
691
692         /* Paranoia */
693         if (n == 0) return FALSE;
694
695         /* Stop speaking */
696         if (music_singing_any()) stop_singing(p_ptr);
697         if (hex_spelling_any()) stop_hex_spell_all();
698
699         t = randint0(n);
700         msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), name[t]);
701         fire_breath(type[t], dir, 250, 4);
702
703         return TRUE;
704 }
705
706 /*!
707  * @brief アイテムの発動効果を処理する。
708  * @param o_ptr 対象のオブジェクト構造体ポインタ
709  * @return 発動実行の是非を返す。
710  */
711 bool activate_artifact(object_type *o_ptr)
712 {
713         PLAYER_LEVEL plev = p_ptr->lev;
714         int k, dummy = 0;
715         DIRECTION dir;
716         concptr name = k_name + k_info[o_ptr->k_idx].name;
717         const activation_type* const act_ptr = find_activation_info(o_ptr);
718
719         /* Paranoia */
720         if (!act_ptr) {
721                 /* Maybe forgot adding information to activation_info table ? */
722                 msg_print("Activation information is not found.");
723                 return FALSE;
724         }
725
726         /* Activate for attack */
727         switch (act_ptr->index)
728         {
729         case ACT_SUNLIGHT:
730         {
731                 if (!get_aim_dir(&dir)) return FALSE;
732                 msg_print(_("太陽光線が放たれた。", "A line of sunlight appears."));
733                 (void)lite_line(dir, damroll(6, 8));
734                 break;
735         }
736
737         case ACT_BO_MISS_1:
738         {
739                 msg_print(_("それは眩しいくらいに明るく輝いている...", "It glows extremely brightly..."));
740                 if (!get_aim_dir(&dir)) return FALSE;
741                 fire_bolt(GF_MISSILE, dir, damroll(2, 6));
742                 break;
743         }
744
745         case ACT_BA_POIS_1:
746         {
747                 msg_print(_("それは濃緑色に脈動している...", "It throbs deep green..."));
748                 if (!get_aim_dir(&dir)) return FALSE;
749                 fire_ball(GF_POIS, dir, 12, 3);
750                 break;
751         }
752
753         case ACT_BO_ELEC_1:
754         {
755                 msg_print(_("それは火花に覆われた...", "It is covered in sparks..."));
756                 if (!get_aim_dir(&dir)) return FALSE;
757                 fire_bolt(GF_ELEC, dir, damroll(4, 8));
758                 break;
759         }
760
761         case ACT_BO_ACID_1:
762         {
763                 msg_print(_("それは酸に覆われた...", "It is covered in acid..."));
764                 if (!get_aim_dir(&dir)) return FALSE;
765                 fire_bolt(GF_ACID, dir, damroll(5, 8));
766                 break;
767         }
768
769         case ACT_BO_COLD_1:
770         {
771                 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
772                 if (!get_aim_dir(&dir)) return FALSE;
773                 fire_bolt(GF_COLD, dir, damroll(6, 8));
774                 break;
775         }
776
777         case ACT_BO_FIRE_1:
778         {
779                 msg_print(_("それは炎に覆われた...", "It is covered in fire..."));
780                 if (!get_aim_dir(&dir)) return FALSE;
781                 fire_bolt(GF_FIRE, dir, damroll(9, 8));
782                 break;
783         }
784
785         case ACT_BA_COLD_1:
786         {
787                 msg_print(_("それは霜に覆われた...", "It is covered in frost..."));
788                 if (!get_aim_dir(&dir)) return FALSE;
789                 fire_ball(GF_COLD, dir, 48, 2);
790                 break;
791         }
792
793         case ACT_BA_COLD_2:
794         {
795                 msg_print(_("それは青く激しく輝いた...", "It glows an intense blue..."));
796                 if (!get_aim_dir(&dir)) return FALSE;
797                 fire_ball(GF_COLD, dir, 100, 2);
798                 break;
799         }
800
801         case ACT_BA_COLD_3:
802         {
803                 msg_print(_("明るく白色に輝いている...", "It glows bright white..."));
804                 if (!get_aim_dir(&dir)) return FALSE;
805                 fire_ball(GF_COLD, dir, 400, 3);
806                 break;
807         }
808
809         case ACT_BA_FIRE_1:
810         {
811                 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
812                 if (!get_aim_dir(&dir)) return FALSE;
813                 fire_ball(GF_FIRE, dir, 72, 2);
814                 break;
815         }
816
817         case ACT_BA_FIRE_2:
818         {
819                 msg_format(_("%sから炎が吹き出した...", "The %s rages in fire..."), name);
820                 if (!get_aim_dir(&dir)) return FALSE;
821                 fire_ball(GF_FIRE, dir, 120, 3);
822                 break;
823         }
824
825         case ACT_BA_FIRE_3:
826         {
827                 msg_print(_("深赤色に輝いている...", "It glows deep red..."));
828                 if (!get_aim_dir(&dir)) return FALSE;
829                 fire_ball(GF_FIRE, dir, 300, 3);
830                 break;
831         }
832
833         case ACT_BA_FIRE_4:
834         {
835                 msg_print(_("それは赤く激しく輝いた...", "It glows an intense red..."));
836                 if (!get_aim_dir(&dir)) return FALSE;
837                 fire_ball(GF_FIRE, dir, 100, 2);
838                 break;
839         }
840
841         case ACT_BA_ELEC_2:
842         {
843                 msg_print(_("電気がパチパチ音を立てた...", "It crackles with electricity..."));
844                 if (!get_aim_dir(&dir)) return FALSE;
845                 fire_ball(GF_ELEC, dir, 100, 3);
846                 break;
847         }
848
849         case ACT_BA_ELEC_3:
850         {
851                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
852                 if (!get_aim_dir(&dir)) return FALSE;
853                 fire_ball(GF_ELEC, dir, 500, 3);
854                 break;
855         }
856
857         case ACT_BA_ACID_1:
858         {
859                 msg_print(_("それは黒く激しく輝いた...", "It glows an intense black..."));
860                 if (!get_aim_dir(&dir)) return FALSE;
861                 fire_ball(GF_ACID, dir, 100, 2);
862                 break;
863         }
864
865         case ACT_BA_NUKE_1:
866         {
867                 msg_print(_("それは緑に激しく輝いた...", "It glows an intense green..."));
868                 if (!get_aim_dir(&dir)) return FALSE;
869                 fire_ball(GF_NUKE, dir, 100, 2);
870                 break;
871         }
872
873         case ACT_HYPODYNAMIA_1:
874         {
875                 msg_format(_("あなたは%sに敵を締め殺すよう命じた。", "You order the %s to strangle your opponent."), name);
876                 if (!get_aim_dir(&dir)) return FALSE;
877                 if (hypodynamic_bolt(dir, 100))
878                         break;
879         }
880
881         case ACT_HYPODYNAMIA_2:
882         {
883                 msg_print(_("黒く輝いている...", "It glows black..."));
884                 if (!get_aim_dir(&dir)) return FALSE;
885                 hypodynamic_bolt(dir, 120);
886                 break;
887         }
888
889         case ACT_DRAIN_1:
890         {
891                 if (!get_aim_dir(&dir)) return FALSE;
892                 for (dummy = 0; dummy < 3; dummy++)
893                 {
894                         if (hypodynamic_bolt(dir, 50))
895                                 hp_player(50);
896                 }
897                 break;
898         }
899
900         case ACT_BO_MISS_2:
901         {
902                 msg_print(_("魔法のトゲが現れた...", "It grows magical spikes..."));
903                 if (!get_aim_dir(&dir)) return FALSE;
904                 fire_bolt(GF_ARROW, dir, 150);
905                 break;
906         }
907
908         case ACT_WHIRLWIND:
909         {
910                 massacre();
911                 break;
912         }
913
914         case ACT_DRAIN_2:
915         {
916                 if (!get_aim_dir(&dir)) return FALSE;
917                 for (dummy = 0; dummy < 3; dummy++)
918                 {
919                         if (hypodynamic_bolt(dir, 100))
920                                 hp_player(100);
921                 }
922                 break;
923         }
924
925
926         case ACT_CALL_CHAOS:
927         {
928                 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
929                 call_chaos();
930                 break;
931         }
932
933         case ACT_ROCKET:
934         {
935                 if (!get_aim_dir(&dir)) return FALSE;
936                 msg_print(_("ロケットを発射した!", "You launch a rocket!"));
937                 fire_ball(GF_ROCKET, dir, 250 + plev * 3, 2);
938                 break;
939         }
940
941         case ACT_DISP_EVIL:
942         {
943                 msg_print(_("神聖な雰囲気が充満した...", "It floods the area with goodness..."));
944                 dispel_evil(p_ptr->lev * 5);
945                 break;
946         }
947
948         case ACT_BA_MISS_3:
949         {
950                 if (!get_aim_dir(&dir)) return FALSE;
951                 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
952                 fire_breath(GF_MISSILE, dir, 300, 4);
953                 break;
954         }
955
956         case ACT_DISP_GOOD:
957         {
958                 msg_print(_("邪悪な雰囲気が充満した...", "It floods the area with evil..."));
959                 dispel_good(p_ptr->lev * 5);
960                 break;
961         }
962
963         case ACT_BO_MANA:
964         {
965                 msg_format(_("%sに魔法のトゲが現れた...", "The %s grows magical spikes..."), name);
966                 if (!get_aim_dir(&dir)) return FALSE;
967                 fire_bolt(GF_ARROW, dir, 150);
968                 break;
969         }
970
971         case ACT_BA_WATER:
972         {
973                 msg_format(_("%sが深い青色に鼓動している...", "The %s throbs deep blue..."), name);
974                 if (!get_aim_dir(&dir)) return FALSE;
975                 fire_ball(GF_WATER, dir, 200, 3);
976                 break;
977         }
978
979         case ACT_BA_DARK:
980         {
981                 msg_format(_("%sが深い闇に覆われた...", "The %s is coverd in pitch-darkness..."), name);
982                 if (!get_aim_dir(&dir)) return FALSE;
983                 fire_ball(GF_DARK, dir, 250, 4);
984                 break;
985         }
986
987         case ACT_BA_MANA:
988         {
989                 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
990                 if (!get_aim_dir(&dir)) return FALSE;
991                 fire_ball(GF_MANA, dir, 250, 4);
992                 break;
993         }
994
995         case ACT_PESTICIDE:
996         {
997                 msg_print(_("あなたは害虫を一掃した。", "You exterminate small life."));
998                 (void)dispel_monsters(4);
999                 break;
1000         }
1001
1002         case ACT_BLINDING_LIGHT:
1003         {
1004                 msg_format(_("%sが眩しい光で輝いた...", "The %s gleams with blinding light..."), name);
1005                 fire_ball(GF_LITE, 0, 300, 6);
1006                 confuse_monsters(3 * p_ptr->lev / 2);
1007                 break;
1008         }
1009
1010         case ACT_BIZARRE:
1011         {
1012                 msg_format(_("%sは漆黒に輝いた...", "The %s glows intensely black..."), name);
1013                 if (!get_aim_dir(&dir)) return FALSE;
1014                 ring_of_power(dir);
1015                 break;
1016         }
1017
1018         case ACT_CAST_BA_STAR:
1019         {
1020                 HIT_POINT num = damroll(5, 3);
1021                 POSITION y = 0, x = 0;
1022                 int attempts;
1023                 msg_format(_("%sが稲妻で覆われた...", "The %s is surrounded by lightning..."), name);
1024                 for (k = 0; k < num; k++)
1025                 {
1026                         attempts = 1000;
1027
1028                         while (attempts--)
1029                         {
1030                                 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
1031                                 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
1032                                 if (!player_bold(y, x)) break;
1033                         }
1034
1035                         project(0, 3, y, x, 150, GF_ELEC,
1036                                 (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
1037                 }
1038
1039                 break;
1040         }
1041
1042         case ACT_BLADETURNER:
1043         {
1044                 if (!get_aim_dir(&dir)) return FALSE;
1045                 msg_print(_("あなたはエレメントのブレスを吐いた。", "You breathe the elements."));
1046                 fire_breath(GF_MISSILE, dir, 300, 4);
1047                 msg_print(_("鎧が様々な色に輝いた...", "Your armor glows many colours..."));
1048                 (void)set_afraid(0);
1049                 (void)set_hero(randint1(50) + 50, FALSE);
1050                 (void)hp_player(10);
1051                 (void)set_blessed(randint1(50) + 50, FALSE);
1052                 (void)set_oppose_acid(randint1(50) + 50, FALSE);
1053                 (void)set_oppose_elec(randint1(50) + 50, FALSE);
1054                 (void)set_oppose_fire(randint1(50) + 50, FALSE);
1055                 (void)set_oppose_cold(randint1(50) + 50, FALSE);
1056                 (void)set_oppose_pois(randint1(50) + 50, FALSE);
1057                 break;
1058         }
1059
1060         case ACT_BR_FIRE:
1061         {
1062                 if (!get_aim_dir(&dir)) return FALSE;
1063                 fire_breath(GF_FIRE, dir, 200, 2);
1064                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
1065                 {
1066                         (void)set_oppose_fire(randint1(20) + 20, FALSE);
1067                 }
1068                 break;
1069         }
1070
1071         case ACT_BR_COLD:
1072         {
1073                 if (!get_aim_dir(&dir)) return FALSE;
1074                 fire_breath(GF_COLD, dir, 200, 2);
1075                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
1076                 {
1077                         (void)set_oppose_cold(randint1(20) + 20, FALSE);
1078                 }
1079                 break;
1080         }
1081
1082         case ACT_BR_DRAGON:
1083         {
1084                 if (!activate_dragon_breath(o_ptr)) return FALSE;
1085                 break;
1086         }
1087
1088         /* Activate for other offensive action */
1089         case ACT_CONFUSE:
1090         {
1091                 msg_print(_("様々な色の火花を発している...", "It glows in scintillating colours..."));
1092                 if (!get_aim_dir(&dir)) return FALSE;
1093                 confuse_monster(dir, 20);
1094                 break;
1095         }
1096
1097         case ACT_SLEEP:
1098         {
1099                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1100                 sleep_monsters_touch();
1101                 break;
1102         }
1103
1104         case ACT_QUAKE:
1105         {
1106                 earthquake(p_ptr->y, p_ptr->x, 5);
1107                 break;
1108         }
1109
1110         case ACT_TERROR:
1111         {
1112                 turn_monsters(40 + p_ptr->lev);
1113                 break;
1114         }
1115
1116         case ACT_TELE_AWAY:
1117         {
1118                 if (!get_aim_dir(&dir)) return FALSE;
1119                 (void)fire_beam(GF_AWAY_ALL, dir, plev);
1120                 break;
1121         }
1122
1123         case ACT_BANISH_EVIL:
1124         {
1125                 if (banish_evil(100))
1126                 {
1127                         msg_print(_("アーティファクトの力が邪悪を打ち払った!", "The power of the artifact banishes evil!"));
1128                 }
1129                 break;
1130         }
1131
1132         case ACT_GENOCIDE:
1133         {
1134                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1135                 (void)symbol_genocide(200, TRUE);
1136                 break;
1137         }
1138
1139         case ACT_MASS_GENO:
1140         {
1141                 msg_print(_("ひどく鋭い音が流れ出た...", "It lets out a long, shrill note..."));
1142                 (void)mass_genocide(200, TRUE);
1143                 break;
1144         }
1145
1146         case ACT_SCARE_AREA:
1147         {
1148                 if (music_singing_any()) stop_singing(p_ptr);
1149                 if (hex_spelling_any()) stop_hex_spell_all();
1150                 msg_print(_("あなたは力強い突風を吹き鳴らした。周囲の敵が震え上っている!",
1151                         "You wind a mighty blast; your enemies tremble!"));
1152                 (void)turn_monsters((3 * p_ptr->lev / 2) + 10);
1153                 break;
1154         }
1155
1156         case ACT_AGGRAVATE:
1157         {
1158                 if (o_ptr->name1 == ART_HYOUSIGI)
1159                 {
1160                         msg_print(_("拍子木を打った。", "You beat Your wooden clappers."));
1161                 }
1162                 else
1163                 {
1164                         msg_format(_("%sは不快な物音を立てた。", "The %s sounds an unpleasant noise."), name);
1165                 }
1166                 aggravate_monsters(0);
1167                 break;
1168         }
1169
1170         /* Activate for summoning / charming */
1171
1172         case ACT_CHARM_ANIMAL:
1173         {
1174                 if (!get_aim_dir(&dir)) return FALSE;
1175                 (void)charm_animal(dir, plev);
1176                 break;
1177         }
1178
1179         case ACT_CHARM_UNDEAD:
1180         {
1181                 if (!get_aim_dir(&dir)) return FALSE;
1182                 (void)control_one_undead(dir, plev);
1183                 break;
1184         }
1185
1186         case ACT_CHARM_OTHER:
1187         {
1188                 if (!get_aim_dir(&dir)) return FALSE;
1189                 (void)charm_monster(dir, plev * 2);
1190                 break;
1191         }
1192
1193         case ACT_CHARM_ANIMALS:
1194         {
1195                 (void)charm_animals(plev * 2);
1196                 break;
1197         }
1198
1199         case ACT_CHARM_OTHERS:
1200         {
1201                 charm_monsters(plev * 2);
1202                 break;
1203         }
1204
1205         case ACT_SUMMON_ANIMAL:
1206         {
1207                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
1208                 break;
1209         }
1210
1211         case ACT_SUMMON_PHANTOM:
1212         {
1213                 msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
1214                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
1215                 break;
1216         }
1217
1218         case ACT_SUMMON_ELEMENTAL:
1219         {
1220                 bool pet = one_in_(3);
1221                 BIT_FLAGS mode = 0L;
1222
1223                 if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
1224                 if (pet) mode |= PM_FORCE_PET;
1225                 else mode |= PM_NO_PET;
1226
1227                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode, '\0'))
1228                 {
1229                         msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
1230                         if (pet)
1231                                 msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
1232                         else
1233                                 msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
1234                 }
1235
1236                 break;
1237         }
1238
1239         case ACT_SUMMON_DEMON:
1240         {
1241                 cast_summon_demon((plev * 3) / 2);
1242                 break;
1243         }
1244
1245         case ACT_SUMMON_UNDEAD:
1246         {
1247                 bool pet = one_in_(3);
1248                 int type;
1249                 BIT_FLAGS mode = 0L;
1250
1251                 type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
1252
1253                 if (!pet || ((plev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
1254                 if (pet) mode |= PM_FORCE_PET;
1255                 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
1256
1257                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), type, mode, '\0'))
1258                 {
1259                         msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
1260                                 "Cold winds begin to blow around you, carrying with them the stench of decay..."));
1261                         if (pet)
1262                                 msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
1263                                         "Ancient, long-dead forms arise from the ground to serve you!"));
1264                         else
1265                                 msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
1266                                         "'The dead arise... to punish you for disturbing them!'"));
1267                 }
1268
1269                 break;
1270         }
1271
1272         case ACT_SUMMON_HOUND:
1273         {
1274                 BIT_FLAGS mode = PM_ALLOW_GROUP;
1275                 bool pet = !one_in_(5);
1276                 if (pet) mode |= PM_FORCE_PET;
1277                 else mode |= PM_NO_PET;
1278
1279                 if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode, '\0'))
1280                 {
1281
1282                         if (pet)
1283                                 msg_print(_("ハウンドがあなたの下僕として出現した。",
1284                                         "A group of hounds appear as your servant."));
1285                         else
1286                                 msg_print(_("ハウンドはあなたに牙を向けている!",
1287                                         "A group of hounds appear as your enemy!"));
1288                 }
1289
1290                 break;
1291         }
1292
1293         case ACT_SUMMON_DAWN:
1294         {
1295                 msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
1296                 (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
1297                 break;
1298         }
1299
1300         case ACT_SUMMON_OCTOPUS:
1301         {
1302                 BIT_FLAGS mode = PM_ALLOW_GROUP;
1303                 bool pet = !one_in_(5);
1304                 if (pet) mode |= PM_FORCE_PET;
1305
1306                 if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_JIZOTAKO, mode))
1307                 {
1308                         if (pet)
1309                                 msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant."));
1310                         else
1311                                 msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemy!"));
1312                 }
1313
1314                 break;
1315         }
1316
1317         /* Activate for healing */
1318
1319         case ACT_CHOIR_SINGS:
1320         {
1321                 msg_print(_("天国の歌が聞こえる...", "A heavenly choir sings..."));
1322                 (void)cure_critical_wounds(777);
1323                 (void)set_hero(randint1(25) + 25, FALSE);
1324                 break;
1325         }
1326
1327         case ACT_CURE_LW:
1328         {
1329                 (void)set_afraid(0);
1330                 (void)hp_player(30);
1331                 break;
1332         }
1333
1334         case ACT_CURE_MW:
1335         {
1336                 msg_print(_("深紫色の光を発している...", "It radiates deep purple..."));
1337                 (void)cure_serious_wounds(4, 8);
1338                 break;
1339         }
1340
1341         case ACT_CURE_POISON:
1342         {
1343                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1344                 (void)set_afraid(0);
1345                 (void)set_poisoned(0);
1346                 break;
1347         }
1348
1349         case ACT_REST_EXP:
1350         {
1351                 msg_print(_("深紅に輝いている...", "It glows a deep red..."));
1352                 restore_level();
1353                 break;
1354         }
1355
1356         case ACT_REST_ALL:
1357         {
1358                 msg_print(_("濃緑色に輝いている...", "It glows a deep green..."));
1359                 (void)restore_all_status();
1360                 (void)restore_level();
1361                 break;
1362         }
1363
1364         case ACT_CURE_700:
1365         {
1366                 msg_print(_("深青色に輝いている...", "It glows deep blue..."));
1367                 msg_print(_("体内に暖かい鼓動が感じられる...", "You feel a warm tingling inside..."));
1368                 (void)cure_critical_wounds(700);
1369                 break;
1370         }
1371
1372         case ACT_CURE_1000:
1373         {
1374                 msg_print(_("白く明るく輝いている...", "It glows a bright white..."));
1375                 msg_print(_("ひじょうに気分がよい...", "You feel much better..."));
1376                 (void)cure_critical_wounds(1000);
1377                 break;
1378         }
1379
1380         case ACT_CURING:
1381         {
1382                 msg_format(_("%sの優しさに癒される...", "the %s cures you affectionately ..."), name);
1383                 true_healing(0);
1384                 break;
1385         }
1386
1387         case ACT_CURE_MANA_FULL:
1388         {
1389                 msg_format(_("%sが青白く光った...", "The %s glows pale..."), name);
1390                 restore_mana(TRUE);
1391                 break;
1392         }
1393
1394         /* Activate for timed effect */
1395
1396         case ACT_ESP:
1397         {
1398                 (void)set_tim_esp(randint1(30) + 25, FALSE);
1399                 break;
1400         }
1401
1402         case ACT_BERSERK:
1403         {
1404                 (void)berserk(randint1(25) + 25);
1405                 break;
1406         }
1407
1408         case ACT_PROT_EVIL:
1409         {
1410                 msg_format(_("%sから鋭い音が流れ出た...", "The %s lets out a shrill wail..."), name);
1411                 k = 3 * p_ptr->lev;
1412                 (void)set_protevil(randint1(25) + k, FALSE);
1413                 break;
1414         }
1415
1416         case ACT_RESIST_ALL:
1417         {
1418                 msg_print(_("様々な色に輝いている...", "It glows many colours..."));
1419                 (void)set_oppose_acid(randint1(40) + 40, FALSE);
1420                 (void)set_oppose_elec(randint1(40) + 40, FALSE);
1421                 (void)set_oppose_fire(randint1(40) + 40, FALSE);
1422                 (void)set_oppose_cold(randint1(40) + 40, FALSE);
1423                 (void)set_oppose_pois(randint1(40) + 40, FALSE);
1424                 break;
1425         }
1426
1427         case ACT_SPEED:
1428         {
1429                 msg_print(_("明るく緑色に輝いている...", "It glows bright green..."));
1430                 (void)set_fast(randint1(20) + 20, FALSE);
1431                 break;
1432         }
1433
1434         case ACT_XTRA_SPEED:
1435         {
1436                 msg_print(_("明るく輝いている...", "It glows brightly..."));
1437                 (void)set_fast(randint1(75) + 75, FALSE);
1438                 break;
1439         }
1440
1441         case ACT_WRAITH:
1442         {
1443                 set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
1444                 break;
1445         }
1446
1447         case ACT_INVULN:
1448         {
1449                 (void)set_invuln(randint1(8) + 8, FALSE);
1450                 break;
1451         }
1452
1453         case ACT_HERO:
1454         {
1455                 (void)heroism(25);
1456                 break;
1457         }
1458
1459         case ACT_HERO_SPEED:
1460         {
1461                 (void)set_fast(randint1(50) + 50, FALSE);
1462                 (void)heroism(50);
1463                 break;
1464         }
1465
1466         case ACT_RESIST_ACID:
1467         {
1468                 msg_format(_("%sが黒く輝いた...", "The %s grows black."), name);
1469                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID))
1470                 {
1471                         if (!get_aim_dir(&dir)) return FALSE;
1472                         fire_ball(GF_ACID, dir, 100, 2);
1473                 }
1474                 (void)set_oppose_acid(randint1(20) + 20, FALSE);
1475                 break;
1476         }
1477
1478         case ACT_RESIST_FIRE:
1479         {
1480                 msg_format(_("%sが赤く輝いた...", "The %s grows red."), name);
1481                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
1482                 {
1483                         if (!get_aim_dir(&dir)) return FALSE;
1484                         fire_ball(GF_FIRE, dir, 100, 2);
1485                 }
1486                 (void)set_oppose_fire(randint1(20) + 20, FALSE);
1487                 break;
1488         }
1489
1490         case ACT_RESIST_COLD:
1491         {
1492                 msg_format(_("%sが白く輝いた...", "The %s grows white."), name);
1493                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
1494                 {
1495                         if (!get_aim_dir(&dir)) return FALSE;
1496                         fire_ball(GF_COLD, dir, 100, 2);
1497                 }
1498                 (void)set_oppose_cold(randint1(20) + 20, FALSE);
1499                 break;
1500         }
1501
1502         case ACT_RESIST_ELEC:
1503         {
1504                 msg_format(_("%sが青く輝いた...", "The %s grows blue."), name);
1505                 if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC))
1506                 {
1507                         if (!get_aim_dir(&dir)) return FALSE;
1508                         fire_ball(GF_ELEC, dir, 100, 2);
1509                 }
1510                 (void)set_oppose_elec(randint1(20) + 20, FALSE);
1511                 break;
1512         }
1513
1514         case ACT_RESIST_POIS:
1515         {
1516                 msg_format(_("%sが緑に輝いた...", "The %s grows green."), name);
1517                 (void)set_oppose_pois(randint1(20) + 20, FALSE);
1518                 break;
1519         }
1520
1521         /* Activate for general purpose effect (detection etc.) */
1522
1523         case ACT_LIGHT:
1524         {
1525                 msg_format(_("%sから澄んだ光があふれ出た...", "The %s wells with clear light..."), name);
1526                 lite_area(damroll(2, 15), 3);
1527                 break;
1528         }
1529
1530         case ACT_MAP_LIGHT:
1531         {
1532                 msg_print(_("眩しく輝いた...", "It shines brightly..."));
1533                 map_area(DETECT_RAD_MAP);
1534                 lite_area(damroll(2, 15), 3);
1535                 break;
1536         }
1537
1538         case ACT_DETECT_ALL:
1539         {
1540                 msg_print(_("白く明るく輝いている...", "It glows bright white..."));
1541                 msg_print(_("心にイメージが浮かんできた...", "An image forms in your mind..."));
1542                 detect_all(DETECT_RAD_DEFAULT);
1543                 break;
1544         }
1545
1546         case ACT_DETECT_XTRA:
1547         {
1548                 msg_print(_("明るく輝いている...", "It glows brightly..."));
1549                 detect_all(DETECT_RAD_DEFAULT);
1550                 probing();
1551                 identify_fully(FALSE);
1552                 break;
1553         }
1554
1555         case ACT_ID_FULL:
1556         {
1557                 msg_print(_("黄色く輝いている...", "It glows yellow..."));
1558                 identify_fully(FALSE);
1559                 break;
1560         }
1561
1562         case ACT_ID_PLAIN:
1563         {
1564                 if (!ident_spell(FALSE)) return FALSE;
1565                 break;
1566         }
1567
1568         case ACT_RUNE_EXPLO:
1569         {
1570                 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1571                 explosive_rune();
1572                 break;
1573         }
1574
1575         case ACT_RUNE_PROT:
1576         {
1577                 msg_print(_("ブルーに明るく輝いている...", "It glows light blue..."));
1578                 warding_glyph();
1579                 break;
1580         }
1581
1582         case ACT_SATIATE:
1583         {
1584                 (void)set_food(PY_FOOD_MAX - 1);
1585                 break;
1586         }
1587
1588         case ACT_DEST_DOOR:
1589         {
1590                 msg_print(_("明るい赤色に輝いている...", "It glows bright red..."));
1591                 destroy_doors_touch();
1592                 break;
1593         }
1594
1595         case ACT_STONE_MUD:
1596         {
1597                 msg_print(_("鼓動している...", "It pulsates..."));
1598                 if (!get_aim_dir(&dir)) return FALSE;
1599                 wall_to_mud(dir, 20 + randint1(30));
1600                 break;
1601         }
1602
1603         case ACT_RECHARGE:
1604         {
1605                 recharge(130);
1606                 break;
1607         }
1608
1609         case ACT_ALCHEMY:
1610         {
1611                 msg_print(_("明るい黄色に輝いている...", "It glows bright yellow..."));
1612                 (void)alchemy();
1613                 break;
1614         }
1615
1616         case ACT_DIM_DOOR:
1617         {
1618                 msg_print(_("次元の扉が開いた。目的地を選んで下さい。", "You open a dimensional gate. Choose a destination."));
1619                 if (!dimension_door()) return FALSE;
1620                 break;
1621         }
1622
1623
1624         case ACT_TELEPORT:
1625         {
1626                 msg_print(_("周りの空間が歪んでいる...", "It twists space around you..."));
1627                 teleport_player(100, 0L);
1628                 break;
1629         }
1630
1631         case ACT_RECALL:
1632         {
1633                 msg_print(_("やわらかな白色に輝いている...", "It glows soft white..."));
1634                 if (!recall_player(p_ptr, randint0(21) + 15)) return FALSE;
1635                 break;
1636         }
1637
1638         case ACT_JUDGE:
1639         {
1640                 msg_format(_("%sは赤く明るく光った!", "The %s flashes bright red!"), name);
1641                 chg_virtue(V_KNOWLEDGE, 1);
1642                 chg_virtue(V_ENLIGHTEN, 1);
1643                 wiz_lite(FALSE);
1644
1645                 msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
1646                 take_hit(DAMAGE_LOSELIFE, damroll(3, 8), _("審判の宝石", "the Jewel of Judgement"), -1);
1647
1648                 (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
1649                 (void)detect_doors(DETECT_RAD_DEFAULT);
1650                 (void)detect_stairs(DETECT_RAD_DEFAULT);
1651
1652                 if (get_check(_("帰還の力を使いますか?", "Activate recall? ")))
1653                 {
1654                         (void)recall_player(p_ptr, randint0(21) + 15);
1655                 }
1656
1657                 break;
1658         }
1659
1660         case ACT_TELEKINESIS:
1661         {
1662                 if (!get_aim_dir(&dir)) return FALSE;
1663                 msg_format(_("%sを伸ばした。", "You stretched your %s."), name);
1664                 fetch(dir, 500, TRUE);
1665                 break;
1666         }
1667
1668         case ACT_DETECT_UNIQUE:
1669         {
1670                 int i;
1671                 monster_type *m_ptr;
1672                 monster_race *r_ptr;
1673                 msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ..."));
1674                 /* Process the monsters (backwards) */
1675                 for (i = m_max - 1; i >= 1; i--)
1676                 {
1677                         /* Access the monster */
1678                         m_ptr = &m_list[i];
1679
1680                         /* Ignore "dead" monsters */
1681                         if (!m_ptr->r_idx) continue;
1682
1683                         r_ptr = &r_info[m_ptr->r_idx];
1684
1685                         if (r_ptr->flags1 & RF1_UNIQUE)
1686                         {
1687                                 msg_format(_("%s. ", "%s. "), r_name + r_ptr->name);
1688                         }
1689                 }
1690                 break;
1691         }
1692
1693         case ACT_ESCAPE:
1694         {
1695                 switch (randint1(13))
1696                 {
1697                 case 1: case 2: case 3: case 4: case 5:
1698                         teleport_player(10, 0L);
1699                         break;
1700                 case 6: case 7: case 8: case 9: case 10:
1701                         teleport_player(222, 0L);
1702                         break;
1703                 case 11: case 12:
1704                         (void)stair_creation();
1705                         break;
1706                 default:
1707                         if (get_check(_("この階を去りますか?", "Leave this level? ")))
1708                         {
1709                                 if (autosave_l) do_cmd_save_game(TRUE);
1710
1711                                 /* Leaving */
1712                                 p_ptr->leaving = TRUE;
1713                         }
1714                 }
1715                 break;
1716         }
1717
1718         case ACT_DISP_CURSE_XTRA:
1719         {
1720                 msg_format(_("%sが真実を照らし出す...", "The %s exhibits the truth..."), name);
1721                 (void)remove_all_curse();
1722                 (void)probing();
1723                 break;
1724         }
1725
1726         case ACT_BRAND_FIRE_BOLTS:
1727         {
1728                 msg_format(_("%sが深紅に輝いた...", "Your %s glows deep red..."), name);
1729                 (void)brand_bolts();
1730                 break;
1731         }
1732
1733         case ACT_RECHARGE_XTRA:
1734         {
1735                 msg_format(_("%sが白く輝いた...", "The %s gleams with blinding light..."), name);
1736                 if (!recharge(1000)) return FALSE;
1737                 break;
1738         }
1739
1740         case ACT_LORE:
1741         {
1742                 msg_print(_("石が隠された秘密を写し出した...", "The stone reveals hidden mysteries..."));
1743                 if (!ident_spell(FALSE)) return FALSE;
1744
1745                 if (mp_ptr->spell_book)
1746                 {
1747                         /* Sufficient mana */
1748                         if (20 <= p_ptr->csp)
1749                         {
1750                                 /* Use some mana */
1751                                 p_ptr->csp -= 20;
1752                         }
1753
1754                         /* Over-exert the player */
1755                         else
1756                         {
1757                                 int oops = 20 - p_ptr->csp;
1758
1759                                 /* No mana left */
1760                                 p_ptr->csp = 0;
1761                                 p_ptr->csp_frac = 0;
1762
1763                                 msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
1764                                 /* Hack -- Bypass free action */
1765                                 (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
1766
1767                                 /* Confusing. */
1768                                 (void)set_confused(p_ptr->confused + randint1(5 * oops + 1));
1769                         }
1770                         p_ptr->redraw |= (PR_MANA);
1771                 }
1772                 take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
1773                 /* Confusing. */
1774                 if (one_in_(5)) (void)set_confused(p_ptr->confused + randint1(10));
1775
1776                 /* Exercise a little care... */
1777                 if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
1778                 break;
1779         }
1780
1781         case ACT_SHIKOFUMI:
1782         {
1783                 msg_print(_("力強く四股を踏んだ。", "You stamp. (as if you are in a ring.)"));
1784                 (void)set_afraid(0);
1785                 (void)set_hero(randint1(20) + 20, FALSE);
1786                 dispel_evil(p_ptr->lev * 3);
1787                 break;
1788         }
1789
1790         case ACT_PHASE_DOOR:
1791         {
1792                 teleport_player(10, 0L);
1793                 break;
1794         }
1795
1796         case ACT_DETECT_ALL_MONS:
1797         {
1798                 (void)detect_monsters_invis(255);
1799                 (void)detect_monsters_normal(255);
1800                 break;
1801         }
1802
1803         case ACT_ULTIMATE_RESIST:
1804         {
1805                 TIME_EFFECT v = randint1(25) + 25;
1806                 (void)set_afraid(0);
1807                 (void)set_hero(v, FALSE);
1808                 (void)hp_player(10);
1809                 (void)set_blessed(v, FALSE);
1810                 (void)set_oppose_acid(v, FALSE);
1811                 (void)set_oppose_elec(v, FALSE);
1812                 (void)set_oppose_fire(v, FALSE);
1813                 (void)set_oppose_cold(v, FALSE);
1814                 (void)set_oppose_pois(v, FALSE);
1815                 (void)set_ultimate_res(v, FALSE);
1816                 break;
1817         }
1818
1819
1820         /* Unique activation */
1821         case ACT_CAST_OFF:
1822         {
1823                 INVENTORY_IDX inv;
1824                 int t;
1825                 OBJECT_IDX o_idx;
1826                 GAME_TEXT o_name[MAX_NLEN];
1827                 object_type forge;
1828
1829                 /* Cast off activated item */
1830                 for (inv = INVEN_RARM; inv <= INVEN_FEET; inv++)
1831                 {
1832                         if (o_ptr == &inventory[inv]) break;
1833                 }
1834
1835                 /* Paranoia */
1836                 if (inv > INVEN_FEET) return FALSE;
1837
1838                 object_copy(&forge, o_ptr);
1839                 inven_item_increase(inv, (0 - o_ptr->number));
1840                 inven_item_optimize(inv);
1841                 o_idx = drop_near(&forge, 0, p_ptr->y, p_ptr->x);
1842                 o_ptr = &o_list[o_idx];
1843
1844                 object_desc(o_name, o_ptr, OD_NAME_ONLY);
1845                 msg_format(_("%sを脱ぎ捨てた。", "You cast off %s."), o_name);
1846
1847                 /* Get effects */
1848                 msg_print(_("「燃え上がれ俺の小宇宙!」", "You say, 'Burn up my cosmo!"));
1849                 t = 20 + randint1(20);
1850                 (void)set_blind(p_ptr->blind + t);
1851                 (void)set_afraid(0);
1852                 (void)set_tim_esp(p_ptr->tim_esp + t, FALSE);
1853                 (void)set_tim_regen(p_ptr->tim_regen + t, FALSE);
1854                 (void)set_hero(p_ptr->hero + t, FALSE);
1855                 (void)set_blessed(p_ptr->blessed + t, FALSE);
1856                 (void)set_fast(p_ptr->fast + t, FALSE);
1857                 (void)set_shero(p_ptr->shero + t, FALSE);
1858                 if (p_ptr->pclass == CLASS_FORCETRAINER)
1859                 {
1860                         P_PTR_KI = plev * 5 + 190;
1861                         msg_print(_("気が爆発寸前になった。", "Your force are immediatly before explosion."));
1862                 }
1863
1864                 break;
1865         }
1866
1867         case ACT_FALLING_STAR:
1868         {
1869                 msg_print(_("あなたは妖刀に魅入られた…", "You are enchanted by cursed blade..."));
1870                 msg_print(_("「狂ほしく 血のごとき 月はのぼれり 秘めおきし 魔剣 いずこぞや」", "'Behold the blade arts.'"));
1871                 massacre();
1872                 break;
1873         }
1874
1875         case ACT_GRAND_CROSS:
1876         {
1877                 msg_print(_("「闇に還れ!」", "You say, 'Return to darkness!'"));
1878                 project(0, 8, p_ptr->y, p_ptr->x, (randint1(100) + 200) * 2, GF_HOLY_FIRE, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
1879                 break;
1880         }
1881
1882         case ACT_TELEPORT_LEVEL:
1883         {
1884                 if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)"))) return FALSE;
1885                 teleport_level(0);
1886                 break;
1887         }
1888
1889         case ACT_STRAIN_HASTE:
1890         {
1891                 int t;
1892                 msg_format(_("%sはあなたの体力を奪った...", "The %s drains your vitality..."), name);
1893                 take_hit(DAMAGE_LOSELIFE, damroll(3, 8), _("加速した疲労", "the strain of haste"), -1);
1894                 t = 25 + randint1(25);
1895                 (void)set_fast(p_ptr->fast + t, FALSE);
1896                 break;
1897         }
1898
1899         case ACT_FISHING:
1900         {
1901                 POSITION x, y;
1902
1903                 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
1904                 y = p_ptr->y + ddy[dir];
1905                 x = p_ptr->x + ddx[dir];
1906                 p_ptr->fishing_dir = dir;
1907                 if (!cave_have_flag_bold(y, x, FF_WATER))
1908                 {
1909                         msg_print(_("そこは水辺ではない。", "There is no fishing place."));
1910                         return FALSE;
1911                 }
1912                 else if (grid_array[y][x].m_idx)
1913                 {
1914                         GAME_TEXT m_name[MAX_NLEN];
1915                         monster_desc(m_name, &m_list[grid_array[y][x].m_idx], 0);
1916                         msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name);
1917                         free_turn(p_ptr);
1918                         return FALSE;
1919                 }
1920                 set_action(ACTION_FISH);
1921                 p_ptr->redraw |= (PR_STATE);
1922                 break;
1923         }
1924
1925         case ACT_INROU:
1926         {
1927                 int count = 0, i;
1928                 monster_type *m_ptr;
1929                 concptr kakusan = "";
1930
1931                 if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_SUKE, PM_FORCE_PET))
1932                 {
1933                         msg_print(_("『助さん』が現れた。", "Suke-san apperars."));
1934                         kakusan = "Suke-san";
1935                         count++;
1936                 }
1937                 if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_KAKU, PM_FORCE_PET))
1938                 {
1939                         msg_print(_("『格さん』が現れた。", "Kaku-san appears."));
1940                         kakusan = "Kaku-san";
1941                         count++;
1942                 }
1943                 if (!count)
1944                 {
1945                         for (i = m_max - 1; i > 0; i--)
1946                         {
1947                                 m_ptr = &m_list[i];
1948                                 if (!m_ptr->r_idx) continue;
1949                                 if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
1950                                 if (!los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
1951                                 if (!projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
1952                                 count++;
1953                                 break;
1954                         }
1955                 }
1956
1957                 if (count)
1958                 {
1959                         msg_format(_("「者ども、ひかえおろう!!!このお方をどなたとこころえる。」",
1960                                 "%^s says 'WHO do you think this person is! Bow your head, down your knees!'"), kakusan);
1961                         sukekaku = TRUE;
1962                         stun_monsters(120);
1963                         confuse_monsters(120);
1964                         turn_monsters(120);
1965                         stasis_monsters(120);
1966                         sukekaku = FALSE;
1967                 }
1968                 else
1969                 {
1970                         msg_print(_("しかし、何も起きなかった。", "Nothing happen."));
1971                 }
1972                 break;
1973         }
1974
1975         case ACT_MURAMASA:
1976         {
1977                 /* Only for Muramasa */
1978                 if (o_ptr->name1 != ART_MURAMASA) return FALSE;
1979                 if (get_check(_("本当に使いますか?", "Are you sure?!")))
1980                 {
1981                         msg_print(_("村正が震えた...", "The Muramasa pulsates..."));
1982                         do_inc_stat(A_STR);
1983                         if (one_in_(2))
1984                         {
1985                                 msg_print(_("村正は壊れた!", "The Muramasa is destroyed!"));
1986                                 curse_weapon_object(TRUE, o_ptr);
1987                         }
1988                 }
1989                 break;
1990         }
1991
1992         case ACT_BLOODY_MOON:
1993         {
1994                 /* Only for Bloody Moon */
1995                 if (o_ptr->name1 != ART_BLOOD) return FALSE;
1996                 msg_print(_("鎌が明るく輝いた...", "Your scythe glows brightly!"));
1997                 get_bloody_moon_flags(o_ptr);
1998                 if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
1999                 p_ptr->update |= (PU_BONUS | PU_HP);
2000                 break;
2001         }
2002
2003         case ACT_CRIMSON:
2004         {
2005                 int num = 1;
2006                 int i;
2007                 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2008                 int tx, ty;
2009
2010                 /* Only for Crimson */
2011                 if (o_ptr->name1 != ART_CRIMSON) return FALSE;
2012
2013                 msg_print(_("せっかくだから『クリムゾン』をぶっぱなすぜ!", "I'll fire CRIMSON! SEKKAKUDAKARA!"));
2014
2015                 if (!get_aim_dir(&dir)) return FALSE;
2016
2017                 /* Use the given direction */
2018                 tx = p_ptr->x + 99 * ddx[dir];
2019                 ty = p_ptr->y + 99 * ddy[dir];
2020
2021                 /* Hack -- Use an actual "target" */
2022                 if ((dir == 5) && target_okay())
2023                 {
2024                         tx = target_col;
2025                         ty = target_row;
2026                 }
2027
2028                 if (p_ptr->pclass == CLASS_ARCHER)
2029                 {
2030                         /* Extra shot at level 10 */
2031                         if (p_ptr->lev >= 10) num++;
2032
2033                         /* Extra shot at level 30 */
2034                         if (p_ptr->lev >= 30) num++;
2035
2036                         /* Extra shot at level 45 */
2037                         if (p_ptr->lev >= 45) num++;
2038                 }
2039
2040                 for (i = 0; i < num; i++)
2041                         project(0, p_ptr->lev / 20 + 1, ty, tx, p_ptr->lev*p_ptr->lev * 6 / 50, GF_ROCKET, flg, -1);
2042                 break;
2043         }
2044
2045         default:
2046         {
2047                 msg_format(_("Unknown activation effect: %d.", "Unknown activation effect: %d."), act_ptr->index);
2048                 return FALSE;
2049         }
2050         }
2051
2052         /* Set activation timeout */
2053         if (act_ptr->timeout.constant >= 0) {
2054                 o_ptr->timeout = (s16b)act_ptr->timeout.constant;
2055                 if (act_ptr->timeout.dice > 0) {
2056                         o_ptr->timeout += randint1(act_ptr->timeout.dice);
2057                 }
2058         }
2059         else {
2060                 /* Activations that have special timeout */
2061                 switch (act_ptr->index) {
2062                 case ACT_BR_FIRE:
2063                         o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250;
2064                         break;
2065                 case ACT_BR_COLD:
2066                         o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250;
2067                         break;
2068                 case ACT_TERROR:
2069                         o_ptr->timeout = 3 * (p_ptr->lev + 10);
2070                         break;
2071                 case ACT_MURAMASA:
2072                         /* Nothing to do */
2073                         break;
2074                 default:
2075                         msg_format("Special timeout is not implemented: %d.", act_ptr->index);
2076                         return FALSE;
2077                 }
2078         }
2079
2080         return TRUE;
2081 }
2082
2083 /*!
2084  * @brief 固定アーティファクト『ブラッディムーン』の特性を変更する。
2085  * @details スレイ2d2種、及びone_resistance()による耐性1d2種、pval2種を得る。
2086  * @param o_ptr 対象のオブジェクト構造体(ブラッディムーン)のポインタ
2087  * @return なし
2088  */
2089 void get_bloody_moon_flags(object_type *o_ptr)
2090 {
2091         int dummy, i;
2092
2093         for (i = 0; i < TR_FLAG_SIZE; i++)
2094                 o_ptr->art_flags[i] = a_info[ART_BLOOD].flags[i];
2095
2096         dummy = randint1(2) + randint1(2);
2097         for (i = 0; i < dummy; i++)
2098         {
2099                 int flag = randint0(26);
2100                 if (flag >= 20) add_flag(o_ptr->art_flags, TR_KILL_UNDEAD + flag - 20);
2101                 else if (flag == 19) add_flag(o_ptr->art_flags, TR_KILL_ANIMAL);
2102                 else if (flag == 18) add_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
2103                 else add_flag(o_ptr->art_flags, TR_CHAOTIC + flag);
2104         }
2105
2106         dummy = randint1(2);
2107         for (i = 0; i < dummy; i++) one_resistance(o_ptr);
2108
2109         for (i = 0; i < 2; i++)
2110         {
2111                 int tmp = randint0(11);
2112                 if (tmp < A_MAX) add_flag(o_ptr->art_flags, TR_STR + tmp);
2113                 else add_flag(o_ptr->art_flags, TR_STEALTH + tmp - 6);
2114         }
2115 }
2116
2117