OSDN Git Service

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