OSDN Git Service

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