OSDN Git Service

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