OSDN Git Service

[Refactor] #1571 Defined stone-of-lore.cpp/h to separate the process of the stone...
[hengbandforosx/hengbandosx.git] / src / spell / spells-object.cpp
1 /*!
2  * @brief アイテムに影響のある魔法の処理
3  * @date 2019/01/22
4  * @author deskull
5  */
6
7 #include "spell/spells-object.h"
8 #include "avatar/avatar.h"
9 #include "core/player-redraw-types.h"
10 #include "core/player-update-types.h"
11 #include "core/window-redrawer.h"
12 #include "flavor/flavor-describer.h"
13 #include "flavor/object-flavor-types.h"
14 #include "floor/floor-object.h"
15 #include "game-option/disturbance-options.h"
16 #include "inventory/inventory-slot-types.h"
17 #include "monster-race/monster-race.h"
18 #include "monster-race/race-flags1.h"
19 #include "object-enchant/apply-magic.h"
20 #include "object-enchant/item-apply-magic.h"
21 #include "object-enchant/item-feeling.h"
22 #include "object-enchant/object-boost.h"
23 #include "object-enchant/object-ego.h"
24 #include "object-enchant/special-object-flags.h"
25 #include "object-enchant/trc-types.h"
26 #include "object-enchant/trg-types.h"
27 #include "object-hook/hook-armor.h"
28 #include "object-hook/hook-weapon.h"
29 #include "object/item-tester-hooker.h"
30 #include "object/item-use-flags.h"
31 #include "object/object-kind-hook.h"
32 #include "object/object-kind.h"
33 #include "perception/object-perception.h"
34 #include "player-info/class-info.h"
35 #include "player/player-damage.h"
36 #include "racial/racial-android.h"
37 #include "spell-kind/spells-perception.h"
38 #include "status/bad-status-setter.h"
39 #include "sv-definition/sv-other-types.h"
40 #include "sv-definition/sv-scroll-types.h"
41 #include "sv-definition/sv-weapon-types.h"
42 #include "system/artifact-type-definition.h"
43 #include "system/floor-type-definition.h"
44 #include "system/monster-race-definition.h"
45 #include "system/object-type-definition.h"
46 #include "system/player-type-definition.h"
47 #include "term/screen-processor.h"
48 #include "util/bit-flags-calculator.h"
49 #include "view/display-messages.h"
50
51 typedef struct {
52     tval_type tval;
53     OBJECT_SUBTYPE_VALUE sval;
54     PERCENTAGE prob;
55     byte flag;
56 } amuse_type;
57
58 /*!
59  * @brief 装備強化処理の失敗率定数(千分率) /
60  * Used by the "enchant" function (chance of failure)
61  * (modified for Zangband, we need better stuff there...) -- TY
62  */
63 static int enchant_table[16] = { 0, 10, 50, 100, 200, 300, 400, 500, 650, 800, 950, 987, 993, 995, 998, 1000 };
64
65 /*
66  * Scatter some "amusing" objects near the player
67  */
68
69 #define AMS_NOTHING 0x00 /* No restriction */
70 #define AMS_NO_UNIQUE 0x01 /* Don't make the amusing object of uniques */
71 #define AMS_FIXED_ART 0x02 /* Make a fixed artifact based on the amusing object */
72 #define AMS_MULTIPLE 0x04 /* Drop 1-3 objects for one type */
73 #define AMS_PILE 0x08 /* Drop 1-99 pile objects for one type */
74
75 static amuse_type amuse_info[]
76     = { { TV_BOTTLE, SV_ANY, 5, AMS_NOTHING }, { TV_JUNK, SV_ANY, 3, AMS_MULTIPLE }, { TV_SPIKE, SV_ANY, 10, AMS_PILE }, { TV_STATUE, SV_ANY, 15, AMS_NOTHING },
77           { TV_CORPSE, SV_ANY, 15, AMS_NO_UNIQUE }, { TV_SKELETON, SV_ANY, 10, AMS_NO_UNIQUE }, { TV_FIGURINE, SV_ANY, 10, AMS_NO_UNIQUE },
78           { TV_PARCHMENT, SV_ANY, 1, AMS_NOTHING }, { TV_POLEARM, SV_TSURIZAO, 3, AMS_NOTHING }, // Fishing Pole of Taikobo
79           { TV_SWORD, SV_BROKEN_DAGGER, 3, AMS_FIXED_ART }, // Broken Dagger of Magician
80           { TV_SWORD, SV_BROKEN_DAGGER, 10, AMS_NOTHING }, { TV_SWORD, SV_BROKEN_SWORD, 5, AMS_NOTHING }, { TV_SCROLL, SV_SCROLL_AMUSEMENT, 10, AMS_NOTHING },
81
82           { TV_NONE, 0, 0, 0 } };
83
84 /*!
85  * @brief 誰得ドロップを行う。
86  * @param player_ptr プレイヤーへの参照ポインタ
87  * @param y1 配置したいフロアのY座標
88  * @param x1 配置したいフロアのX座標
89  * @param num 誰得の処理回数
90  * @param known TRUEならばオブジェクトが必ず*鑑定*済になる
91  */
92 void amusement(player_type *player_ptr, POSITION y1, POSITION x1, int num, bool known)
93 {
94     int t = 0;
95     for (int n = 0; amuse_info[n].tval != 0; n++) {
96         t += amuse_info[n].prob;
97     }
98
99     /* Acquirement */
100     object_type *i_ptr;
101     object_type object_type_body;
102     while (num) {
103         int i;
104         KIND_OBJECT_IDX k_idx;
105         ARTIFACT_IDX a_idx = 0;
106         int r = randint0(t);
107         bool insta_art, fixed_art;
108
109         for (i = 0;; i++) {
110             r -= amuse_info[i].prob;
111             if (r <= 0)
112                 break;
113         }
114         i_ptr = &object_type_body;
115         i_ptr->wipe();
116         k_idx = lookup_kind(amuse_info[i].tval, amuse_info[i].sval);
117
118         /* Paranoia - reroll if nothing */
119         if (!k_idx)
120             continue;
121
122         /* Search an artifact index if need */
123         insta_art = k_info[k_idx].gen_flags.has(TRG::INSTA_ART);
124         fixed_art = (amuse_info[i].flag & AMS_FIXED_ART);
125
126         if (insta_art || fixed_art) {
127             for (const auto &a_ref : a_info) {
128                 if (a_ref.idx == 0)
129                     continue;
130                 if (insta_art && !a_ref.gen_flags.has(TRG::INSTA_ART))
131                     continue;
132                 if (a_ref.tval != k_info[k_idx].tval)
133                     continue;
134                 if (a_ref.sval != k_info[k_idx].sval)
135                     continue;
136                 if (a_ref.cur_num > 0)
137                     continue;
138                 break;
139             }
140
141             if (a_idx >= static_cast<ARTIFACT_IDX>(a_info.size()))
142                 continue;
143         }
144
145         /* Make an object (if possible) */
146         i_ptr->prep(k_idx);
147         if (a_idx)
148             i_ptr->name1 = a_idx;
149         apply_magic_to_object(player_ptr, i_ptr, 1, AM_NO_FIXED_ART);
150
151         if (amuse_info[i].flag & AMS_NO_UNIQUE) {
152             if (r_info[i_ptr->pval].flags1 & RF1_UNIQUE)
153                 continue;
154         }
155
156         if (amuse_info[i].flag & AMS_MULTIPLE)
157             i_ptr->number = randint1(3);
158         if (amuse_info[i].flag & AMS_PILE)
159             i_ptr->number = randint1(99);
160
161         if (known) {
162             object_aware(player_ptr, i_ptr);
163             object_known(i_ptr);
164         }
165
166         /* Paranoia - reroll if nothing */
167         if (!(i_ptr->k_idx))
168             continue;
169
170         (void)drop_near(player_ptr, i_ptr, -1, y1, x1);
171
172         num--;
173     }
174 }
175
176 /*!
177  * @brief 獲得ドロップを行う。
178  * Scatter some "great" objects near the player
179  * @param player_ptr プレイヤーへの参照ポインタ
180  * @param y1 配置したいフロアのY座標
181  * @param x1 配置したいフロアのX座標
182  * @param num 獲得の処理回数
183  * @param great TRUEならば必ず高級品以上を落とす
184  * @param special TRUEならば必ず特別品を落とす
185  * @param known TRUEならばオブジェクトが必ず*鑑定*済になる
186  */
187 void acquirement(player_type *player_ptr, POSITION y1, POSITION x1, int num, bool great, bool special, bool known)
188 {
189     object_type *i_ptr;
190     object_type object_type_body;
191     BIT_FLAGS mode = AM_GOOD | (great || special ? AM_GREAT : AM_NONE) | (special ? AM_SPECIAL : AM_NONE);
192
193     /* Acquirement */
194     while (num--) {
195         i_ptr = &object_type_body;
196         i_ptr->wipe();
197
198         /* Make a good (or great) object (if possible) */
199         if (!make_object(player_ptr, i_ptr, mode))
200             continue;
201
202         if (known) {
203             object_aware(player_ptr, i_ptr);
204             object_known(i_ptr);
205         }
206
207         (void)drop_near(player_ptr, i_ptr, -1, y1, x1);
208     }
209 }
210
211 /*!
212  * @brief 防具呪縛処理 /
213  * Curse the players armor
214  * @return 何も持っていない場合を除き、常にTRUEを返す
215  * @todo 元のreturnは間違っているが、修正後の↓文がどれくらい正しいかは要チェック
216  */
217 bool curse_armor(player_type *player_ptr)
218 {
219     /* Curse the body armor */
220     object_type *o_ptr;
221     o_ptr = &player_ptr->inventory_list[INVEN_BODY];
222
223     if (!o_ptr->k_idx)
224         return false;
225
226     GAME_TEXT o_name[MAX_NLEN];
227     describe_flavor(player_ptr, o_name, o_ptr, OD_OMIT_PREFIX);
228
229     /* Attempt a saving throw for artifacts */
230     if (o_ptr->is_artifact() && (randint0(100) < 50)) {
231         /* Cool */
232 #ifdef JP
233         msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返した!", "恐怖の暗黒オーラ", "防具", o_name);
234 #else
235         msg_format("A %s tries to %s, but your %s resists the effects!", "terrible black aura", "surround your armor", o_name);
236 #endif
237         return true;
238     }
239
240     /* not artifact or failed save... */
241     msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
242     chg_virtue(player_ptr, V_ENCHANT, -5);
243
244     /* Blast the armor */
245     o_ptr->name1 = 0;
246     o_ptr->name2 = EGO_BLASTED;
247     o_ptr->to_a = 0 - randint1(5) - randint1(5);
248     o_ptr->to_h = 0;
249     o_ptr->to_d = 0;
250     o_ptr->ac = 0;
251     o_ptr->dd = 0;
252     o_ptr->ds = 0;
253
254     o_ptr->art_flags.clear();
255
256     /* Curse it */
257     o_ptr->curse_flags.set(TRC::CURSED);
258
259     /* Break it */
260     o_ptr->ident |= (IDENT_BROKEN);
261     player_ptr->update |= (PU_BONUS | PU_MANA);
262     player_ptr->window_flags |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
263     return true;
264 }
265
266 /*!
267  * @brief 武器呪縛処理 /
268  * Curse the players weapon
269  * @param player_ptr 所持者の参照ポインタ
270  * @param force 無条件に呪縛を行うならばTRUE
271  * @param o_ptr 呪縛する武器のアイテム情報参照ポインタ
272  * @return 何も持っていない場合を除き、常にTRUEを返す
273  * @todo 元のreturnは間違っているが、修正後の↓文がどれくらい正しいかは要チェック
274  */
275 bool curse_weapon_object(player_type *player_ptr, bool force, object_type *o_ptr)
276 {
277     if (!o_ptr->k_idx)
278         return false;
279
280     GAME_TEXT o_name[MAX_NLEN];
281     describe_flavor(player_ptr, o_name, o_ptr, OD_OMIT_PREFIX);
282
283     /* Attempt a saving throw */
284     if (o_ptr->is_artifact() && (randint0(100) < 50) && !force) {
285 #ifdef JP
286         msg_format("%sが%sを包み込もうとしたが、%sはそれを跳ね返した!", "恐怖の暗黒オーラ", "武器", o_name);
287 #else
288         msg_format("A %s tries to %s, but your %s resists the effects!", "terrible black aura", "surround your weapon", o_name);
289 #endif
290         return true;
291     }
292
293     /* not artifact or failed save... */
294     if (!force)
295         msg_format(_("恐怖の暗黒オーラがあなたの%sを包み込んだ!", "A terrible black aura blasts your %s!"), o_name);
296     chg_virtue(player_ptr, V_ENCHANT, -5);
297
298     /* Shatter the weapon */
299     o_ptr->name1 = 0;
300     o_ptr->name2 = EGO_SHATTERED;
301     o_ptr->to_h = 0 - randint1(5) - randint1(5);
302     o_ptr->to_d = 0 - randint1(5) - randint1(5);
303     o_ptr->to_a = 0;
304     o_ptr->ac = 0;
305     o_ptr->dd = 0;
306     o_ptr->ds = 0;
307
308     o_ptr->art_flags.clear();
309
310     /* Curse it */
311     o_ptr->curse_flags.set(TRC::CURSED);
312
313     /* Break it */
314     o_ptr->ident |= (IDENT_BROKEN);
315     player_ptr->update |= (PU_BONUS | PU_MANA);
316     player_ptr->window_flags |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
317     return true;
318 }
319
320 /*!
321  * @brief ボルトのエゴ化処理(火炎エゴのみ) /
322  * Enchant some bolts
323  * @param player_ptr プレイヤーへの参照ポインタ
324  */
325 void brand_bolts(player_type *player_ptr)
326 {
327     /* Use the first acceptable bolts */
328     for (int i = 0; i < INVEN_PACK; i++) {
329         object_type *o_ptr = &player_ptr->inventory_list[i];
330
331         /* Skip non-bolts */
332         if (o_ptr->tval != TV_BOLT)
333             continue;
334
335         /* Skip artifacts and ego-items */
336         if (o_ptr->is_artifact() || o_ptr->is_ego())
337             continue;
338
339         /* Skip cursed/broken items */
340         if (o_ptr->is_cursed() || o_ptr->is_broken())
341             continue;
342
343         /* Randomize */
344         if (randint0(100) < 75)
345             continue;
346
347         msg_print(_("クロスボウの矢が炎のオーラに包まれた!", "Your bolts are covered in a fiery aura!"));
348
349         /* Ego-item */
350         o_ptr->name2 = EGO_FLAME;
351         enchant_equipment(player_ptr, o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
352         return;
353     }
354
355     if (flush_failure)
356         flush();
357     msg_print(_("炎で強化するのに失敗した。", "The fiery enchantment failed."));
358 }
359
360 /*!
361  * @brief 呪いの打ち破り処理 /
362  * Break the curse of an item
363  * @param o_ptr 呪い装備情報の参照ポインタ
364  */
365 static void break_curse(object_type *o_ptr)
366 {
367     BIT_FLAGS is_curse_broken
368         = o_ptr->is_cursed() && o_ptr->curse_flags.has_not(TRC::PERMA_CURSE) && o_ptr->curse_flags.has_not(TRC::HEAVY_CURSE) && (randint0(100) < 25);
369     if (!is_curse_broken) {
370         return;
371     }
372
373     msg_print(_("かけられていた呪いが打ち破られた!", "The curse is broken!"));
374
375     o_ptr->curse_flags.clear();
376     o_ptr->ident |= (IDENT_SENSE);
377     o_ptr->feeling = FEEL_NONE;
378 }
379
380 /*!
381  * @brief 装備修正強化処理 /
382  * Enchants a plus onto an item. -RAK-
383  * @param player_ptr プレイヤーへの参照ポインタ
384  * @param o_ptr 強化するアイテムの参照ポインタ
385  * @param n 強化基本量
386  * @param eflag 強化オプション(命中/ダメージ/AC)
387  * @return 強化に成功した場合TRUEを返す
388  * @details
389  * <pre>
390  * Revamped!  Now takes item pointer, number of times to try enchanting,
391  * and a flag of what to try enchanting.  Artifacts resist enchantment
392  * some of the time, and successful enchantment to at least +0 might
393  * break a curse on the item. -CFT-
394  *
395  * Note that an item can technically be enchanted all the way to +15 if
396  * you wait a very, very, long time.  Going from +9 to +10 only works
397  * about 5% of the time, and from +10 to +11 only about 1% of the time.
398  *
399  * Note that this function can now be used on "piles" of items, and
400  * the larger the pile, the lower the chance of success.
401  * </pre>
402  */
403 bool enchant_equipment(player_type *player_ptr, object_type *o_ptr, int n, int eflag)
404 {
405     /* Large piles resist enchantment */
406     int prob = o_ptr->number * 100;
407
408     /* Missiles are easy to enchant */
409     if ((o_ptr->tval == TV_BOLT) || (o_ptr->tval == TV_ARROW) || (o_ptr->tval == TV_SHOT)) {
410         prob = prob / 20;
411     }
412
413     /* Try "n" times */
414     int chance;
415     bool res = false;
416     bool a = o_ptr->is_artifact();
417     bool force = (eflag & ENCH_FORCE);
418     for (int i = 0; i < n; i++) {
419         /* Hack -- Roll for pile resistance */
420         if (!force && randint0(prob) >= 100)
421             continue;
422
423         /* Enchant to hit */
424         if (eflag & ENCH_TOHIT) {
425             if (o_ptr->to_h < 0)
426                 chance = 0;
427             else if (o_ptr->to_h > 15)
428                 chance = 1000;
429             else
430                 chance = enchant_table[o_ptr->to_h];
431
432             if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50)))) {
433                 o_ptr->to_h++;
434                 res = true;
435
436                 /* only when you get it above -1 -CFT */
437                 if (o_ptr->to_h >= 0)
438                     break_curse(o_ptr);
439             }
440         }
441
442         /* Enchant to damage */
443         if (eflag & ENCH_TODAM) {
444             if (o_ptr->to_d < 0)
445                 chance = 0;
446             else if (o_ptr->to_d > 15)
447                 chance = 1000;
448             else
449                 chance = enchant_table[o_ptr->to_d];
450
451             if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50)))) {
452                 o_ptr->to_d++;
453                 res = true;
454
455                 /* only when you get it above -1 -CFT */
456                 if (o_ptr->to_d >= 0)
457                     break_curse(o_ptr);
458             }
459         }
460
461         /* Enchant to armor class */
462         if (!(eflag & ENCH_TOAC)) {
463             continue;
464         }
465
466         if (o_ptr->to_a < 0)
467             chance = 0;
468         else if (o_ptr->to_a > 15)
469             chance = 1000;
470         else
471             chance = enchant_table[o_ptr->to_a];
472
473         if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50)))) {
474             o_ptr->to_a++;
475             res = true;
476
477             /* only when you get it above -1 -CFT */
478             if (o_ptr->to_a >= 0)
479                 break_curse(o_ptr);
480         }
481     }
482
483     /* Failure */
484     if (!res)
485         return false;
486     set_bits(player_ptr->update, PU_BONUS | PU_COMBINE | PU_REORDER);
487     set_bits(player_ptr->window_flags, PW_INVEN | PW_EQUIP | PW_PLAYER | PW_FLOOR_ITEM_LIST);
488
489     /* Success */
490     return true;
491 }
492
493 /*!
494  * @brief 装備修正強化処理のメインルーチン /
495  * Enchant an item (in the inventory or on the floor)
496  * @param player_ptr プレイヤーへの参照ポインタ
497  * @param num_hit 命中修正量
498  * @param num_dam ダメージ修正量
499  * @param num_ac AC修正量
500  * @return 強化に成功した場合TRUEを返す
501  * @details
502  * Note that "num_ac" requires armour, else weapon
503  * Returns TRUE if attempted, FALSE if cancelled
504  */
505 bool enchant_spell(player_type *player_ptr, HIT_PROB num_hit, HIT_POINT num_dam, ARMOUR_CLASS num_ac)
506 {
507     /* Assume enchant weapon */
508     FuncItemTester item_tester(&object_type::allow_enchant_weapon);
509
510     /* Enchant armor if requested */
511     if (num_ac)
512         item_tester = FuncItemTester(&object_type::is_armour);
513
514     concptr q = _("どのアイテムを強化しますか? ", "Enchant which item? ");
515     concptr s = _("強化できるアイテムがない。", "You have nothing to enchant.");
516
517     OBJECT_IDX item;
518     object_type *o_ptr;
519     o_ptr = choose_object(player_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), item_tester);
520     if (!o_ptr)
521         return false;
522
523     GAME_TEXT o_name[MAX_NLEN];
524     describe_flavor(player_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
525 #ifdef JP
526     msg_format("%s は明るく輝いた!", o_name);
527 #else
528     msg_format("%s %s glow%s brightly!", ((item >= 0) ? "Your" : "The"), o_name, ((o_ptr->number > 1) ? "" : "s"));
529 #endif
530
531     /* Enchant */
532     bool is_enchant_successful = false;
533     if (enchant_equipment(player_ptr, o_ptr, num_hit, ENCH_TOHIT))
534         is_enchant_successful = true;
535     if (enchant_equipment(player_ptr, o_ptr, num_dam, ENCH_TODAM))
536         is_enchant_successful = true;
537     if (enchant_equipment(player_ptr, o_ptr, num_ac, ENCH_TOAC))
538         is_enchant_successful = true;
539
540     if (!is_enchant_successful) {
541         if (flush_failure)
542             flush();
543         msg_print(_("強化に失敗した。", "The enchantment failed."));
544         if (one_in_(3))
545             chg_virtue(player_ptr, V_ENCHANT, -1);
546     } else
547         chg_virtue(player_ptr, V_ENCHANT, 1);
548
549     calc_android_exp(player_ptr);
550
551     /* Something happened */
552     return true;
553 }
554
555 /*!
556  * @brief 武器へのエゴ付加処理 /
557  * Brand the current weapon
558  * @param player_ptr プレイヤーへの参照ポインタ
559  * @param brand_type エゴ化ID(e_info.txtとは連動していない)
560  */
561 void brand_weapon(player_type *player_ptr, int brand_type)
562 {
563     concptr q = _("どの武器を強化しますか? ", "Enchant which weapon? ");
564     concptr s = _("強化できる武器がない。", "You have nothing to enchant.");
565
566     OBJECT_IDX item;
567     object_type *o_ptr;
568     o_ptr = choose_object(player_ptr, &item, q, s, USE_EQUIP | IGNORE_BOTHHAND_SLOT, FuncItemTester(&object_type::allow_enchant_melee_weapon));
569     if (!o_ptr)
570         return;
571
572     bool is_special_item = o_ptr->k_idx && !o_ptr->is_artifact() && !o_ptr->is_ego() && !o_ptr->is_cursed()
573         && !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) && !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE))
574         && !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE));
575     if (!is_special_item) {
576         if (flush_failure)
577             flush();
578
579         msg_print(_("属性付加に失敗した。", "The branding failed."));
580         chg_virtue(player_ptr, V_ENCHANT, -2);
581         calc_android_exp(player_ptr);
582         return;
583     }
584
585     GAME_TEXT o_name[MAX_NLEN];
586     describe_flavor(player_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
587
588     concptr act = nullptr;
589     switch (brand_type) {
590     case 17:
591         if (o_ptr->tval == TV_SWORD) {
592             act = _("は鋭さを増した!", "becomes very sharp!");
593
594             o_ptr->name2 = EGO_SHARPNESS;
595             o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, player_ptr->current_floor_ptr->dun_level) + 1;
596
597             if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2))
598                 o_ptr->pval = 2;
599         } else {
600             act = _("は破壊力を増した!", "seems very powerful.");
601             o_ptr->name2 = EGO_EARTHQUAKES;
602             o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, player_ptr->current_floor_ptr->dun_level);
603         }
604
605         break;
606     case 16:
607         act = _("は人間の血を求めている!", "seems to be looking for humans!");
608         o_ptr->name2 = EGO_KILL_HUMAN;
609         break;
610     case 15:
611         act = _("は電撃に覆われた!", "covered with lightning!");
612         o_ptr->name2 = EGO_BRAND_ELEC;
613         break;
614     case 14:
615         act = _("は酸に覆われた!", "coated with acid!");
616         o_ptr->name2 = EGO_BRAND_ACID;
617         break;
618     case 13:
619         act = _("は邪悪なる怪物を求めている!", "seems to be looking for evil monsters!");
620         o_ptr->name2 = EGO_KILL_EVIL;
621         break;
622     case 12:
623         act = _("は異世界の住人の肉体を求めている!", "seems to be looking for demons!");
624         o_ptr->name2 = EGO_KILL_DEMON;
625         break;
626     case 11:
627         act = _("は屍を求めている!", "seems to be looking for undead!");
628         o_ptr->name2 = EGO_KILL_UNDEAD;
629         break;
630     case 10:
631         act = _("は動物の血を求めている!", "seems to be looking for animals!");
632         o_ptr->name2 = EGO_KILL_ANIMAL;
633         break;
634     case 9:
635         act = _("はドラゴンの血を求めている!", "seems to be looking for dragons!");
636         o_ptr->name2 = EGO_KILL_DRAGON;
637         break;
638     case 8:
639         act = _("はトロルの血を求めている!", "seems to be looking for troll!s");
640         o_ptr->name2 = EGO_KILL_TROLL;
641         break;
642     case 7:
643         act = _("はオークの血を求めている!", "seems to be looking for orcs!");
644         o_ptr->name2 = EGO_KILL_ORC;
645         break;
646     case 6:
647         act = _("は巨人の血を求めている!", "seems to be looking for giants!");
648         o_ptr->name2 = EGO_KILL_GIANT;
649         break;
650     case 5:
651         act = _("は非常に不安定になったようだ。", "seems very unstable now.");
652         o_ptr->name2 = EGO_TRUMP;
653         o_ptr->pval = randint1(2);
654         break;
655     case 4:
656         act = _("は血を求めている!", "thirsts for blood!");
657         o_ptr->name2 = EGO_VAMPIRIC;
658         break;
659     case 3:
660         act = _("は毒に覆われた。", "is coated with poison.");
661         o_ptr->name2 = EGO_BRAND_POIS;
662         break;
663     case 2:
664         act = _("は純ログルスに飲み込まれた。", "is engulfed in raw Logrus!");
665         o_ptr->name2 = EGO_CHAOTIC;
666         break;
667     case 1:
668         act = _("は炎のシールドに覆われた!", "is covered in a fiery shield!");
669         o_ptr->name2 = EGO_BRAND_FIRE;
670         break;
671     default:
672         act = _("は深く冷たいブルーに輝いた!", "glows deep, icy blue!");
673         o_ptr->name2 = EGO_BRAND_COLD;
674         break;
675     }
676
677     msg_format(_("あなたの%s%s", "Your %s %s"), o_name, act);
678     enchant_equipment(player_ptr, o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
679     o_ptr->discount = 99;
680     chg_virtue(player_ptr, V_ENCHANT, 2);
681     calc_android_exp(player_ptr);
682 }