1 /* Purpose: Artifact code */
4 * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
6 * This software may be copied and distributed for educational, research, and
7 * not for profit purposes provided that this copyright and statement are
8 * included in all such copies.
14 /* Chance of using syllables to form the name instead of the "template" files */
22 * Bias luck needs to be higher than weird luck,
23 * since it is usually tested several times...
25 #define ACTIVATION_CHANCE 3
28 static void curse_artifact(object_type * o_ptr)
30 if (o_ptr->pval > 0) o_ptr->pval = 0 - (o_ptr->pval + randint1(4));
31 if (o_ptr->to_a > 0) o_ptr->to_a = 0 - (o_ptr->to_a + randint1(4));
32 if (o_ptr->to_h > 0) o_ptr->to_h = 0 - (o_ptr->to_h + randint1(4));
33 if (o_ptr->to_d > 0) o_ptr->to_d = 0 - (o_ptr->to_d + randint1(4));
35 o_ptr->art_flags3 |= (TR3_HEAVY_CURSE | TR3_CURSED);
37 if (one_in_(4)) o_ptr->art_flags3 |= TR3_PERMA_CURSE;
38 if (one_in_(3)) o_ptr->art_flags3 |= TR3_TY_CURSE;
39 if (one_in_(2)) o_ptr->art_flags3 |= TR3_AGGRAVATE;
40 if (one_in_(3)) o_ptr->art_flags3 |= TR3_DRAIN_EXP;
41 if (one_in_(2)) o_ptr->art_flags3 |= TR3_TELEPORT;
42 else if (one_in_(3)) o_ptr->art_flags3 |= TR3_NO_TELE;
44 if ((p_ptr->pclass != CLASS_WARRIOR) && (p_ptr->pclass != CLASS_ARCHER) && (p_ptr->pclass != CLASS_CAVALRY) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH) && one_in_(3))
45 o_ptr->art_flags3 |= TR3_NO_MAGIC;
47 o_ptr->ident |= IDENT_CURSED;
51 static void random_plus(object_type * o_ptr, bool is_scroll)
53 int this_type = (o_ptr->tval < TV_BOOTS ? 23 : 19);
55 if (artifact_bias == BIAS_WARRIOR)
57 if (!(o_ptr->art_flags1 & TR1_STR))
59 o_ptr->art_flags1 |= TR1_STR;
60 if (one_in_(2)) return; /* 50% chance of being a "free" power */
63 if (!(o_ptr->art_flags1 & TR1_CON))
65 o_ptr->art_flags1 |= TR1_CON;
66 if (one_in_(2)) return;
69 if (!(o_ptr->art_flags1 & TR1_DEX))
71 o_ptr->art_flags1 |= TR1_DEX;
72 if (one_in_(2)) return;
75 else if (artifact_bias == BIAS_MAGE)
77 if (!(o_ptr->art_flags1 & TR1_INT))
79 o_ptr->art_flags1 |= TR1_INT;
80 if (one_in_(2)) return;
82 if ((o_ptr->tval == TV_GLOVES) && !(o_ptr->art_flags1 & TR1_MAGIC_MASTERY))
84 o_ptr->art_flags1 |= TR1_MAGIC_MASTERY;
85 if (one_in_(2)) return;
88 else if (artifact_bias == BIAS_PRIESTLY)
90 if (!(o_ptr->art_flags1 & TR1_WIS))
92 o_ptr->art_flags1 |= TR1_WIS;
93 if (one_in_(2)) return;
96 else if (artifact_bias == BIAS_RANGER)
98 if (!(o_ptr->art_flags1 & TR1_DEX))
100 o_ptr->art_flags1 |= TR1_DEX;
101 if (one_in_(2)) return;
104 if (!(o_ptr->art_flags1 & TR1_CON))
106 o_ptr->art_flags1 |= TR1_CON;
107 if (one_in_(2)) return; /* 50% chance of being a "free" power */
110 if (!(o_ptr->art_flags1 & TR1_STR))
112 o_ptr->art_flags1 |= TR1_STR;
113 if (one_in_(2)) return;
116 else if (artifact_bias == BIAS_ROGUE)
118 if (!(o_ptr->art_flags1 & TR1_STEALTH))
120 o_ptr->art_flags1 |= TR1_STEALTH;
121 if (one_in_(2)) return;
123 if (!(o_ptr->art_flags1 & TR1_SEARCH))
125 o_ptr->art_flags1 |= TR1_SEARCH;
126 if (one_in_(2)) return;
129 else if (artifact_bias == BIAS_STR)
131 if (!(o_ptr->art_flags1 & TR1_STR))
133 o_ptr->art_flags1 |= TR1_STR;
134 if (one_in_(2)) return;
137 else if (artifact_bias == BIAS_WIS)
139 if (!(o_ptr->art_flags1 & TR1_WIS))
141 o_ptr->art_flags1 |= TR1_WIS;
142 if (one_in_(2)) return;
145 else if (artifact_bias == BIAS_INT)
147 if (!(o_ptr->art_flags1 & TR1_INT))
149 o_ptr->art_flags1 |= TR1_INT;
150 if (one_in_(2)) return;
153 else if (artifact_bias == BIAS_DEX)
155 if (!(o_ptr->art_flags1 & TR1_DEX))
157 o_ptr->art_flags1 |= TR1_DEX;
158 if (one_in_(2)) return;
161 else if (artifact_bias == BIAS_CON)
163 if (!(o_ptr->art_flags1 & TR1_CON))
165 o_ptr->art_flags1 |= TR1_CON;
166 if (one_in_(2)) return;
169 else if (artifact_bias == BIAS_CHR)
171 if (!(o_ptr->art_flags1 & TR1_CHR))
173 o_ptr->art_flags1 |= TR1_CHR;
174 if (one_in_(2)) return;
178 if ((artifact_bias == BIAS_MAGE || artifact_bias == BIAS_PRIESTLY) && (o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ROBE))
180 if (!(o_ptr->art_flags3 & TR3_DEC_MANA) && one_in_(3))
182 o_ptr->art_flags3 |= TR3_DEC_MANA;
183 if (one_in_(2)) return;
187 switch (randint1(this_type))
190 o_ptr->art_flags1 |= TR1_STR;
191 /* if (is_scroll) msg_print("It makes you feel strong!"); */
192 if (!artifact_bias && !one_in_(13))
193 artifact_bias = BIAS_STR;
194 else if (!artifact_bias && one_in_(7))
195 artifact_bias = BIAS_WARRIOR;
198 o_ptr->art_flags1 |= TR1_INT;
199 /* if (is_scroll) msg_print("It makes you feel smart!"); */
200 if (!artifact_bias && !one_in_(13))
201 artifact_bias = BIAS_INT;
202 else if (!artifact_bias && one_in_(7))
203 artifact_bias = BIAS_MAGE;
206 o_ptr->art_flags1 |= TR1_WIS;
207 /* if (is_scroll) msg_print("It makes you feel wise!"); */
208 if (!artifact_bias && !one_in_(13))
209 artifact_bias = BIAS_WIS;
210 else if (!artifact_bias && one_in_(7))
211 artifact_bias = BIAS_PRIESTLY;
214 o_ptr->art_flags1 |= TR1_DEX;
215 /* if (is_scroll) msg_print("It makes you feel nimble!"); */
216 if (!artifact_bias && !one_in_(13))
217 artifact_bias = BIAS_DEX;
218 else if (!artifact_bias && one_in_(7))
219 artifact_bias = BIAS_ROGUE;
222 o_ptr->art_flags1 |= TR1_CON;
223 /* if (is_scroll) msg_print("It makes you feel healthy!"); */
224 if (!artifact_bias && !one_in_(13))
225 artifact_bias = BIAS_CON;
226 else if (!artifact_bias && one_in_(9))
227 artifact_bias = BIAS_RANGER;
230 o_ptr->art_flags1 |= TR1_CHR;
231 /* if (is_scroll) msg_print("It makes you look great!"); */
232 if (!artifact_bias && !one_in_(13))
233 artifact_bias = BIAS_CHR;
236 o_ptr->art_flags1 |= TR1_STEALTH;
237 /* if (is_scroll) msg_print("It looks muffled."); */
238 if (!artifact_bias && one_in_(3))
239 artifact_bias = BIAS_ROGUE;
242 o_ptr->art_flags1 |= TR1_SEARCH;
243 /* if (is_scroll) msg_print("It makes you see better."); */
244 if (!artifact_bias && one_in_(9))
245 artifact_bias = BIAS_RANGER;
248 o_ptr->art_flags1 |= TR1_INFRA;
249 /* if (is_scroll) msg_print("It makes you see tiny red animals.");*/
252 o_ptr->art_flags1 |= TR1_SPEED;
253 /* if (is_scroll) msg_print("It makes you move faster!"); */
254 if (!artifact_bias && one_in_(11))
255 artifact_bias = BIAS_ROGUE;
258 o_ptr->art_flags1 |= TR1_TUNNEL;
259 /* if (is_scroll) msg_print("Gravel flies from it!"); */
262 if (o_ptr->tval == TV_BOW) random_plus(o_ptr, is_scroll);
265 o_ptr->art_flags1 |= TR1_BLOWS;
266 /* if (is_scroll) msg_print("It seems faster!"); */
267 if (!artifact_bias && one_in_(11))
268 artifact_bias = BIAS_WARRIOR;
275 void random_resistance(object_type * o_ptr, bool is_scroll, int specific)
277 if (!specific) /* To avoid a number of possible bugs */
279 if (artifact_bias == BIAS_ACID)
281 if (!(o_ptr->art_flags2 & TR2_RES_ACID))
283 o_ptr->art_flags2 |= TR2_RES_ACID;
284 if (one_in_(2)) return;
286 if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_ACID))
288 o_ptr->art_flags2 |= TR2_IM_ACID;
289 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_COLD | TR2_IM_FIRE);
290 if (one_in_(2)) return;
293 else if (artifact_bias == BIAS_ELEC)
295 if (!(o_ptr->art_flags2 & TR2_RES_ELEC))
297 o_ptr->art_flags2 |= TR2_RES_ELEC;
298 if (one_in_(2)) return;
300 if ((o_ptr->tval >= TV_CLOAK) && (o_ptr->tval <= TV_HARD_ARMOR) &&
301 !(o_ptr->art_flags3 & TR3_SH_ELEC))
303 o_ptr->art_flags3 |= TR3_SH_ELEC;
304 if (one_in_(2)) return;
306 if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_ELEC))
308 o_ptr->art_flags2 |= TR2_IM_ELEC;
309 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ACID | TR2_IM_COLD | TR2_IM_FIRE);
310 if (one_in_(2)) return;
313 else if (artifact_bias == BIAS_FIRE)
315 if (!(o_ptr->art_flags2 & TR2_RES_FIRE))
317 o_ptr->art_flags2 |= TR2_RES_FIRE;
318 if (one_in_(2)) return;
320 if ((o_ptr->tval >= TV_CLOAK) &&
321 (o_ptr->tval <= TV_HARD_ARMOR) &&
322 !(o_ptr->art_flags3 & TR3_SH_FIRE))
324 o_ptr->art_flags3 |= TR3_SH_FIRE;
325 if (one_in_(2)) return;
327 if (one_in_(BIAS_LUCK) &&
328 !(o_ptr->art_flags2 & TR2_IM_FIRE))
330 o_ptr->art_flags2 |= TR2_IM_FIRE;
331 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_COLD | TR2_IM_ACID);
332 if (one_in_(2)) return;
335 else if (artifact_bias == BIAS_COLD)
337 if (!(o_ptr->art_flags2 & TR2_RES_COLD))
339 o_ptr->art_flags2 |= TR2_RES_COLD;
340 if (one_in_(2)) return;
342 if ((o_ptr->tval >= TV_CLOAK) &&
343 (o_ptr->tval <= TV_HARD_ARMOR) &&
344 !(o_ptr->art_flags3 & TR3_SH_COLD))
346 o_ptr->art_flags3 |= TR3_SH_COLD;
347 if (one_in_(2)) return;
349 if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_COLD))
351 o_ptr->art_flags2 |= TR2_IM_COLD;
352 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_ACID | TR2_IM_FIRE);
353 if (one_in_(2)) return;
356 else if (artifact_bias == BIAS_POIS)
358 if (!(o_ptr->art_flags2 & TR2_RES_POIS))
360 o_ptr->art_flags2 |= TR2_RES_POIS;
361 if (one_in_(2)) return;
364 else if (artifact_bias == BIAS_WARRIOR)
366 if (!one_in_(3) && (!(o_ptr->art_flags2 & TR2_RES_FEAR)))
368 o_ptr->art_flags2 |= TR2_RES_FEAR;
369 if (one_in_(2)) return;
371 if (one_in_(3) && (!(o_ptr->art_flags3 & TR3_NO_MAGIC)))
373 o_ptr->art_flags3 |= TR3_NO_MAGIC;
374 if (one_in_(2)) return;
377 else if (artifact_bias == BIAS_NECROMANTIC)
379 if (!(o_ptr->art_flags2 & TR2_RES_NETHER))
381 o_ptr->art_flags2 |= TR2_RES_NETHER;
382 if (one_in_(2)) return;
384 if (!(o_ptr->art_flags2 & TR2_RES_POIS))
386 o_ptr->art_flags2 |= TR2_RES_POIS;
387 if (one_in_(2)) return;
389 if (!(o_ptr->art_flags2 & TR2_RES_DARK))
391 o_ptr->art_flags2 |= TR2_RES_DARK;
392 if (one_in_(2)) return;
395 else if (artifact_bias == BIAS_CHAOS)
397 if (!(o_ptr->art_flags2 & TR2_RES_CHAOS))
399 o_ptr->art_flags2 |= TR2_RES_CHAOS;
400 if (one_in_(2)) return;
402 if (!(o_ptr->art_flags2 & TR2_RES_CONF))
404 o_ptr->art_flags2 |= TR2_RES_CONF;
405 if (one_in_(2)) return;
407 if (!(o_ptr->art_flags2 & TR2_RES_DISEN))
409 o_ptr->art_flags2 |= TR2_RES_DISEN;
410 if (one_in_(2)) return;
415 switch (specific ? specific : randint1(42))
418 if (!one_in_(WEIRD_LUCK))
419 random_resistance(o_ptr, is_scroll, specific);
422 o_ptr->art_flags2 |= TR2_IM_ACID;
423 /* if (is_scroll) msg_print("It looks totally incorruptible."); */
425 artifact_bias = BIAS_ACID;
429 if (!one_in_(WEIRD_LUCK))
430 random_resistance(o_ptr, is_scroll, specific);
433 o_ptr->art_flags2 |= TR2_IM_ELEC;
434 /* if (is_scroll) msg_print("It looks completely grounded."); */
436 artifact_bias = BIAS_ELEC;
440 if (!one_in_(WEIRD_LUCK))
441 random_resistance(o_ptr, is_scroll, specific);
444 o_ptr->art_flags2 |= TR2_IM_COLD;
445 /* if (is_scroll) msg_print("It feels very warm."); */
447 artifact_bias = BIAS_COLD;
451 if (!one_in_(WEIRD_LUCK))
452 random_resistance(o_ptr, is_scroll, specific);
455 o_ptr->art_flags2 |= TR2_IM_FIRE;
456 /* if (is_scroll) msg_print("It feels very cool."); */
458 artifact_bias = BIAS_FIRE;
464 o_ptr->art_flags2 |= TR2_RES_ACID;
465 /* if (is_scroll) msg_print("It makes your stomach rumble."); */
467 artifact_bias = BIAS_ACID;
472 o_ptr->art_flags2 |= TR2_RES_ELEC;
473 /* if (is_scroll) msg_print("It makes you feel grounded."); */
475 artifact_bias = BIAS_ELEC;
480 o_ptr->art_flags2 |= TR2_RES_FIRE;
481 /* if (is_scroll) msg_print("It makes you feel cool!");*/
483 artifact_bias = BIAS_FIRE;
488 o_ptr->art_flags2 |= TR2_RES_COLD;
489 /* if (is_scroll) msg_print("It makes you feel full of hot air!");*/
491 artifact_bias = BIAS_COLD;
495 o_ptr->art_flags2 |= TR2_RES_POIS;
496 /* if (is_scroll) msg_print("It makes breathing easier for you."); */
497 if (!artifact_bias && !one_in_(4))
498 artifact_bias = BIAS_POIS;
499 else if (!artifact_bias && one_in_(2))
500 artifact_bias = BIAS_NECROMANTIC;
501 else if (!artifact_bias && one_in_(2))
502 artifact_bias = BIAS_ROGUE;
506 o_ptr->art_flags2 |= TR2_RES_FEAR;
507 /* if (is_scroll) msg_print("It makes you feel brave!"); */
508 if (!artifact_bias && one_in_(3))
509 artifact_bias = BIAS_WARRIOR;
512 o_ptr->art_flags2 |= TR2_RES_LITE;
513 /* if (is_scroll) msg_print("It makes everything look darker.");*/
516 o_ptr->art_flags2 |= TR2_RES_DARK;
517 /* if (is_scroll) msg_print("It makes everything look brighter.");*/
521 o_ptr->art_flags2 |= TR2_RES_BLIND;
522 /* if (is_scroll) msg_print("It makes you feel you are wearing glasses.");*/
526 o_ptr->art_flags2 |= TR2_RES_CONF;
527 /* if (is_scroll) msg_print("It makes you feel very determined.");*/
528 if (!artifact_bias && one_in_(6))
529 artifact_bias = BIAS_CHAOS;
533 o_ptr->art_flags2 |= TR2_RES_SOUND;
534 /* if (is_scroll) msg_print("It makes you feel deaf!");*/
538 o_ptr->art_flags2 |= TR2_RES_SHARDS;
539 /* if (is_scroll) msg_print("It makes your skin feel thicker.");*/
543 o_ptr->art_flags2 |= TR2_RES_NETHER;
544 /* if (is_scroll) msg_print("It makes you feel like visiting a graveyard!");*/
545 if (!artifact_bias && one_in_(3))
546 artifact_bias = BIAS_NECROMANTIC;
550 o_ptr->art_flags2 |= TR2_RES_NEXUS;
551 /* if (is_scroll) msg_print("It makes you feel normal.");*/
555 o_ptr->art_flags2 |= TR2_RES_CHAOS;
556 /* if (is_scroll) msg_print("It makes you feel very firm.");*/
557 if (!artifact_bias && one_in_(2))
558 artifact_bias = BIAS_CHAOS;
562 o_ptr->art_flags2 |= TR2_RES_DISEN;
563 /* if (is_scroll) msg_print("It is surrounded by a static feeling.");*/
566 if (o_ptr->tval >= TV_CLOAK && o_ptr->tval <= TV_HARD_ARMOR)
567 o_ptr->art_flags3 |= TR3_SH_ELEC;
569 random_resistance(o_ptr, is_scroll, specific);
571 artifact_bias = BIAS_ELEC;
574 if (o_ptr->tval >= TV_CLOAK && o_ptr->tval <= TV_HARD_ARMOR)
575 o_ptr->art_flags3 |= TR3_SH_FIRE;
577 random_resistance(o_ptr, is_scroll, specific);
579 artifact_bias = BIAS_FIRE;
582 if (o_ptr->tval == TV_SHIELD || o_ptr->tval == TV_CLOAK ||
583 o_ptr->tval == TV_HELM || o_ptr->tval == TV_HARD_ARMOR)
584 o_ptr->art_flags2 |= TR2_REFLECT;
586 random_resistance(o_ptr, is_scroll, specific);
589 if (o_ptr->tval >= TV_CLOAK && o_ptr->tval <= TV_HARD_ARMOR)
590 o_ptr->art_flags3 |= TR3_SH_COLD;
592 random_resistance(o_ptr, is_scroll, specific);
594 artifact_bias = BIAS_COLD;
601 static void random_misc(object_type * o_ptr, bool is_scroll)
603 if (artifact_bias == BIAS_RANGER)
605 if (!(o_ptr->art_flags2 & TR2_SUST_CON))
607 o_ptr->art_flags2 |= TR2_SUST_CON;
608 if (one_in_(2)) return;
611 else if (artifact_bias == BIAS_STR)
613 if (!(o_ptr->art_flags2 & TR2_SUST_STR))
615 o_ptr->art_flags2 |= TR2_SUST_STR;
616 if (one_in_(2)) return;
619 else if (artifact_bias == BIAS_WIS)
621 if (!(o_ptr->art_flags2 & TR2_SUST_WIS))
623 o_ptr->art_flags2 |= TR2_SUST_WIS;
624 if (one_in_(2)) return;
627 else if (artifact_bias == BIAS_INT)
629 if (!(o_ptr->art_flags2 & TR2_SUST_INT))
631 o_ptr->art_flags2 |= TR2_SUST_INT;
632 if (one_in_(2)) return;
635 else if (artifact_bias == BIAS_DEX)
637 if (!(o_ptr->art_flags2 & TR2_SUST_DEX))
639 o_ptr->art_flags2 |= TR2_SUST_DEX;
640 if (one_in_(2)) return;
643 else if (artifact_bias == BIAS_CON)
645 if (!(o_ptr->art_flags2 & TR2_SUST_CON))
647 o_ptr->art_flags2 |= TR2_SUST_CON;
648 if (one_in_(2)) return;
651 else if (artifact_bias == BIAS_CHR)
653 if (!(o_ptr->art_flags2 & TR2_SUST_CHR))
655 o_ptr->art_flags2 |= TR2_SUST_CHR;
656 if (one_in_(2)) return;
659 else if (artifact_bias == BIAS_CHAOS)
661 if (!(o_ptr->art_flags3 & TR3_TELEPORT))
663 o_ptr->art_flags3 |= TR3_TELEPORT;
664 if (one_in_(2)) return;
667 else if (artifact_bias == BIAS_FIRE)
669 if (!(o_ptr->art_flags3 & TR3_LITE))
671 o_ptr->art_flags3 |= TR3_LITE; /* Freebie */
675 switch (randint1(31))
678 o_ptr->art_flags2 |= TR2_SUST_STR;
679 /* if (is_scroll) msg_print("It makes you feel you cannot become weaker."); */
681 artifact_bias = BIAS_STR;
684 o_ptr->art_flags2 |= TR2_SUST_INT;
685 /* if (is_scroll) msg_print("It makes you feel you cannot become more stupid.");*/
687 artifact_bias = BIAS_INT;
690 o_ptr->art_flags2 |= TR2_SUST_WIS;
691 /* if (is_scroll) msg_print("It makes you feel you cannot become simpler.");*/
693 artifact_bias = BIAS_WIS;
696 o_ptr->art_flags2 |= TR2_SUST_DEX;
697 /* if (is_scroll) msg_print("It makes you feel you cannot become clumsier.");*/
699 artifact_bias = BIAS_DEX;
702 o_ptr->art_flags2 |= TR2_SUST_CON;
703 /* if (is_scroll) msg_print("It makes you feel you cannot become less healthy.");*/
705 artifact_bias = BIAS_CON;
708 o_ptr->art_flags2 |= TR2_SUST_CHR;
709 /* if (is_scroll) msg_print("It makes you feel you cannot become uglier.");*/
711 artifact_bias = BIAS_CHR;
716 o_ptr->art_flags2 |= TR2_FREE_ACT;
717 /* if (is_scroll) msg_print("It makes you feel like a young rebel!");*/
720 o_ptr->art_flags2 |= TR2_HOLD_LIFE;
721 /* if (is_scroll) msg_print("It makes you feel immortal.");*/
722 if (!artifact_bias && one_in_(5))
723 artifact_bias = BIAS_PRIESTLY;
724 else if (!artifact_bias && one_in_(6))
725 artifact_bias = BIAS_NECROMANTIC;
729 o_ptr->art_flags3 |= TR3_LITE;
730 /* if (is_scroll) msg_print("It starts shining.");*/
734 o_ptr->art_flags3 |= TR3_FEATHER;
735 /* if (is_scroll) msg_print("It feels lighter.");*/
740 o_ptr->art_flags3 |= TR3_SEE_INVIS;
741 /* if (is_scroll) msg_print("It makes you see the air!");*/
744 if (one_in_(3)) break;
745 o_ptr->art_flags3 |= TR3_TELEPATHY;
746 /* if (is_scroll) msg_print("It makes you hear voices inside your head!");*/
747 if (!artifact_bias && one_in_(9))
748 artifact_bias = BIAS_MAGE;
752 o_ptr->art_flags3 |= TR3_SLOW_DIGEST;
753 /* if (is_scroll) msg_print("It makes you feel less hungry.");*/
757 o_ptr->art_flags3 |= TR3_REGEN;
758 /* if (is_scroll) msg_print("It looks as good as new.");*/
761 o_ptr->art_flags3 |= TR3_TELEPORT;
762 /* if (is_scroll) msg_print("Its position feels uncertain!");*/
767 if (o_ptr->tval >= TV_BOOTS && o_ptr->tval <= TV_DRAG_ARMOR)
768 random_misc(o_ptr, is_scroll);
771 o_ptr->to_a = 4 + randint1(11);
778 int bonus_h, bonus_d;
779 o_ptr->art_flags3 |= TR3_SHOW_MODS;
780 bonus_h = 4 + (randint1(11));
781 bonus_d = 4 + (randint1(11));
782 if ((o_ptr->tval != TV_SWORD) && (o_ptr->tval != TV_POLEARM) && (o_ptr->tval != TV_HAFTED) && (o_ptr->tval != TV_DIGGING) && (o_ptr->tval != TV_GLOVES) && (o_ptr->tval != TV_RING))
787 o_ptr->to_h += bonus_h;
788 o_ptr->to_d += bonus_d;
792 o_ptr->art_flags3 |= TR3_NO_MAGIC;
795 o_ptr->art_flags3 |= TR3_NO_TELE;
801 static void random_slay(object_type *o_ptr, bool is_scroll)
803 if (artifact_bias == BIAS_CHAOS && (o_ptr->tval != TV_BOW))
805 if (!(o_ptr->art_flags1 & TR1_CHAOTIC))
807 o_ptr->art_flags1 |= TR1_CHAOTIC;
808 if (one_in_(2)) return;
812 else if (artifact_bias == BIAS_PRIESTLY &&
813 (o_ptr->tval == TV_SWORD || o_ptr->tval == TV_POLEARM) &&
814 !(o_ptr->art_flags3 & TR3_BLESSED))
816 /* A free power for "priestly" random artifacts */
817 o_ptr->art_flags3 |= TR3_BLESSED;
820 else if (artifact_bias == BIAS_NECROMANTIC && (o_ptr->tval != TV_BOW))
822 if (!(o_ptr->art_flags1 & TR1_VAMPIRIC))
824 o_ptr->art_flags1 |= TR1_VAMPIRIC;
825 if (one_in_(2)) return;
827 if (!(o_ptr->art_flags1 & TR1_BRAND_POIS) && one_in_(2))
829 o_ptr->art_flags1 |= TR1_BRAND_POIS;
830 if (one_in_(2)) return;
834 else if (artifact_bias == BIAS_RANGER && (o_ptr->tval != TV_BOW))
836 if (!(o_ptr->art_flags1 & TR1_SLAY_ANIMAL))
838 o_ptr->art_flags1 |= TR1_SLAY_ANIMAL;
839 if (one_in_(2)) return;
843 else if (artifact_bias == BIAS_ROGUE && (o_ptr->tval != TV_BOW))
845 if ((((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DAGGER)) ||
846 ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_SPEAR))) &&
847 !(o_ptr->art_flags2 & TR2_THROW))
849 /* Free power for rogues... */
850 o_ptr->art_flags2 |= TR2_THROW;
852 if (!(o_ptr->art_flags1 & TR1_BRAND_POIS))
854 o_ptr->art_flags1 |= TR1_BRAND_POIS;
855 if (one_in_(2)) return;
859 else if (artifact_bias == BIAS_POIS && (o_ptr->tval != TV_BOW))
861 if (!(o_ptr->art_flags1 & TR1_BRAND_POIS))
863 o_ptr->art_flags1 |= TR1_BRAND_POIS;
864 if (one_in_(2)) return;
868 else if (artifact_bias == BIAS_FIRE && (o_ptr->tval != TV_BOW))
870 if (!(o_ptr->art_flags1 & TR1_BRAND_FIRE))
872 o_ptr->art_flags1 |= TR1_BRAND_FIRE;
873 if (one_in_(2)) return;
877 else if (artifact_bias == BIAS_COLD && (o_ptr->tval != TV_BOW))
879 if (!(o_ptr->art_flags1 & TR1_BRAND_COLD))
881 o_ptr->art_flags1 |= TR1_BRAND_COLD;
882 if (one_in_(2)) return;
886 else if (artifact_bias == BIAS_ELEC && (o_ptr->tval != TV_BOW))
888 if (!(o_ptr->art_flags1 & TR1_BRAND_ELEC))
890 o_ptr->art_flags1 |= TR1_BRAND_ELEC;
891 if (one_in_(2)) return;
895 else if (artifact_bias == BIAS_ACID && (o_ptr->tval != TV_BOW))
897 if (!(o_ptr->art_flags1 & TR1_BRAND_ACID))
899 o_ptr->art_flags1 |= TR1_BRAND_ACID;
900 if (one_in_(2)) return;
904 else if (artifact_bias == BIAS_LAW && (o_ptr->tval != TV_BOW))
906 if (!(o_ptr->art_flags1 & TR1_SLAY_EVIL))
908 o_ptr->art_flags1 |= TR1_SLAY_EVIL;
909 if (one_in_(2)) return;
911 if (!(o_ptr->art_flags1 & TR1_SLAY_UNDEAD))
913 o_ptr->art_flags1 |= TR1_SLAY_UNDEAD;
914 if (one_in_(2)) return;
916 if (!(o_ptr->art_flags1 & TR1_SLAY_DEMON))
918 o_ptr->art_flags1 |= TR1_SLAY_DEMON;
919 if (one_in_(2)) return;
923 if (o_ptr->tval != TV_BOW)
925 switch (randint1(34))
929 o_ptr->art_flags1 |= TR1_SLAY_ANIMAL;
930 /* if (is_scroll) msg_print("You start hating animals.");*/
934 o_ptr->art_flags1 |= TR1_SLAY_EVIL;
935 /* if (is_scroll) msg_print("You hate evil creatures.");*/
936 if (!artifact_bias && one_in_(2))
937 artifact_bias = BIAS_LAW;
938 else if (!artifact_bias && one_in_(9))
939 artifact_bias = BIAS_PRIESTLY;
943 o_ptr->art_flags1 |= TR1_SLAY_UNDEAD;
944 /* if (is_scroll) msg_print("You hate undead creatures.");*/
945 if (!artifact_bias && one_in_(9))
946 artifact_bias = BIAS_PRIESTLY;
950 o_ptr->art_flags1 |= TR1_SLAY_DEMON;
951 /* if (is_scroll) msg_print("You hate demons.");*/
952 if (!artifact_bias && one_in_(9))
953 artifact_bias = BIAS_PRIESTLY;
957 o_ptr->art_flags1 |= TR1_SLAY_ORC;
958 /* if (is_scroll) msg_print("You hate orcs.");*/
962 o_ptr->art_flags1 |= TR1_SLAY_TROLL;
963 /* if (is_scroll) msg_print("You hate trolls.");*/
967 o_ptr->art_flags1 |= TR1_SLAY_GIANT;
968 /* if (is_scroll) msg_print("You hate giants.");*/
972 o_ptr->art_flags1 |= TR1_SLAY_DRAGON;
973 /* if (is_scroll) msg_print("You hate dragons.");*/
976 o_ptr->art_flags1 |= TR1_KILL_DRAGON;
977 /* if (is_scroll) msg_print("You feel an intense hatred of dragons.");*/
981 if (o_ptr->tval == TV_SWORD)
983 o_ptr->art_flags1 |= TR1_VORPAL;
984 /* if (is_scroll) msg_print("It looks extremely sharp!");*/
985 if (!artifact_bias && one_in_(9))
986 artifact_bias = BIAS_WARRIOR;
989 random_slay(o_ptr, is_scroll);
992 o_ptr->art_flags1 |= TR1_IMPACT;
993 /* if (is_scroll) msg_print("The ground trembles beneath you.");*/
997 o_ptr->art_flags1 |= TR1_BRAND_FIRE;
998 /* if (is_scroll) msg_print("It feels hot!");*/
1000 artifact_bias = BIAS_FIRE;
1004 o_ptr->art_flags1 |= TR1_BRAND_COLD;
1005 /* if (is_scroll) msg_print("It feels cold!");*/
1007 artifact_bias = BIAS_COLD;
1011 o_ptr->art_flags1 |= TR1_BRAND_ELEC;
1012 /* if (is_scroll) msg_print("Ouch! You get zapped!");*/
1014 artifact_bias = BIAS_ELEC;
1018 o_ptr->art_flags1 |= TR1_BRAND_ACID;
1019 /* if (is_scroll) msg_print("Its smell makes you feel dizzy.");*/
1021 artifact_bias = BIAS_ACID;
1025 o_ptr->art_flags1 |= TR1_BRAND_POIS;
1026 /* if (is_scroll) msg_print("It smells rotten.");*/
1027 if (!artifact_bias && !one_in_(3))
1028 artifact_bias = BIAS_POIS;
1029 else if (!artifact_bias && one_in_(6))
1030 artifact_bias = BIAS_NECROMANTIC;
1031 else if (!artifact_bias)
1032 artifact_bias = BIAS_ROGUE;
1035 o_ptr->art_flags1 |= TR1_VAMPIRIC;
1036 /* if (is_scroll) msg_print("You think it bit you!");*/
1038 artifact_bias = BIAS_NECROMANTIC;
1041 o_ptr->art_flags1 |= TR1_FORCE_WEAPON;
1042 /* if (is_scroll) msg_print("It looks consuming your MP!");*/
1044 artifact_bias = (one_in_(2) ? BIAS_MAGE : BIAS_PRIESTLY);
1047 o_ptr->art_flags1 |= TR1_CHAOTIC;
1048 /* if (is_scroll) msg_print("It looks very confusing.");*/
1050 artifact_bias = BIAS_CHAOS;
1056 switch (randint1(6))
1061 o_ptr->art_flags3 |= TR3_XTRA_MIGHT;
1062 if (!one_in_(7)) o_ptr->art_flags3 &= ~(TR3_XTRA_SHOTS);
1063 /* if (is_scroll) msg_print("It looks mightier than before."); */
1064 if (!artifact_bias && one_in_(9))
1065 artifact_bias = BIAS_RANGER;
1068 o_ptr->art_flags3 |= TR3_XTRA_SHOTS;
1069 if (!one_in_(7)) o_ptr->art_flags3 &= ~(TR3_XTRA_MIGHT);
1070 /* if (is_scroll) msg_print("It seems faster!"); */
1071 if (!artifact_bias && one_in_(9))
1072 artifact_bias = BIAS_RANGER;
1079 static void give_activation_power(object_type *o_ptr)
1081 int type = 0, chance = 0;
1085 if (artifact_bias == BIAS_ELEC)
1089 type = ACT_BO_ELEC_1;
1091 else if (!one_in_(5))
1093 type = ACT_BA_ELEC_2;
1097 type = ACT_BA_ELEC_3;
1101 else if (artifact_bias == BIAS_POIS)
1103 type = ACT_BA_POIS_1;
1106 else if (artifact_bias == BIAS_FIRE)
1110 type = ACT_BO_FIRE_1;
1112 else if (!one_in_(5))
1114 type = ACT_BA_FIRE_1;
1118 type = ACT_BA_FIRE_2;
1122 else if (artifact_bias == BIAS_COLD)
1126 type = ACT_BO_COLD_1;
1127 else if (!one_in_(3))
1128 type = ACT_BA_COLD_1;
1129 else if (!one_in_(3))
1130 type = ACT_BA_COLD_2;
1132 type = ACT_BA_COLD_3;
1134 else if (artifact_bias == BIAS_CHAOS)
1138 type = ACT_SUMMON_DEMON;
1140 type = ACT_CALL_CHAOS;
1142 else if (artifact_bias == BIAS_PRIESTLY)
1147 type = ACT_CHARM_UNDEAD;
1148 else if (one_in_(12))
1149 type = ACT_BANISH_EVIL;
1150 else if (one_in_(11))
1151 type = ACT_DISP_EVIL;
1152 else if (one_in_(10))
1153 type = ACT_PROT_EVIL;
1154 else if (one_in_(9))
1155 type = ACT_CURE_1000;
1156 else if (one_in_(8))
1157 type = ACT_CURE_700;
1158 else if (one_in_(7))
1159 type = ACT_REST_ALL;
1160 else if (one_in_(6))
1161 type = ACT_REST_LIFE;
1165 else if (artifact_bias == BIAS_NECROMANTIC)
1170 else if (one_in_(13))
1171 type = ACT_DISP_GOOD;
1172 else if (one_in_(9))
1173 type = ACT_MASS_GENO;
1174 else if (one_in_(8))
1175 type = ACT_GENOCIDE;
1176 else if (one_in_(13))
1177 type = ACT_SUMMON_UNDEAD;
1178 else if (one_in_(9))
1179 type = ACT_VAMPIRE_2;
1180 else if (one_in_(6))
1181 type = ACT_CHARM_UNDEAD;
1183 type = ACT_VAMPIRE_1;
1185 else if (artifact_bias == BIAS_LAW)
1189 type = ACT_BANISH_EVIL;
1190 else if (one_in_(4))
1191 type = ACT_DISP_EVIL;
1193 type = ACT_PROT_EVIL;
1195 else if (artifact_bias == BIAS_ROGUE)
1200 else if (one_in_(4))
1202 else if (one_in_(3))
1203 type = ACT_DETECT_ALL;
1204 else if (one_in_(8))
1207 type = ACT_ID_PLAIN;
1209 else if (artifact_bias == BIAS_MAGE)
1213 type = ACT_SUMMON_ELEMENTAL;
1214 else if (one_in_(10))
1215 type = ACT_SUMMON_PHANTOM;
1216 else if (one_in_(5))
1217 type = ACT_RUNE_EXPLO;
1221 else if (artifact_bias == BIAS_WARRIOR)
1229 else if (artifact_bias == BIAS_RANGER)
1233 type = ACT_CHARM_ANIMALS;
1234 else if (one_in_(7))
1235 type = ACT_SUMMON_ANIMAL;
1236 else if (one_in_(6))
1237 type = ACT_CHARM_ANIMAL;
1238 else if (one_in_(4))
1239 type = ACT_RESIST_ALL;
1240 else if (one_in_(3))
1243 type = ACT_CURE_POISON;
1247 while (!type || (randint1(100) >= chance))
1249 type = randint1(255);
1264 case ACT_CURE_POISON:
1278 case ACT_RESIST_ALL:
1279 case ACT_DETECT_ALL:
1301 case ACT_CHARM_ANIMAL:
1304 case ACT_SUMMON_ANIMAL:
1310 case ACT_BANISH_EVIL:
1313 case ACT_CHARM_UNDEAD:
1314 case ACT_CHARM_OTHER:
1315 case ACT_SUMMON_PHANTOM:
1317 case ACT_RUNE_EXPLO:
1320 case ACT_CALL_CHAOS:
1322 case ACT_CHARM_ANIMALS:
1323 case ACT_CHARM_OTHERS:
1324 case ACT_SUMMON_ELEMENTAL:
1332 case ACT_XTRA_SPEED:
1333 case ACT_DETECT_XTRA:
1337 case ACT_SUMMON_UNDEAD:
1338 case ACT_SUMMON_DEMON:
1349 /* A type was chosen... */
1350 o_ptr->xtra2 = type;
1351 o_ptr->art_flags3 |= TR3_ACTIVATE;
1356 static void get_random_name(char *return_name, bool armour, int power)
1358 if (randint1(100) <= TABLE_NAME)
1360 get_table_name(return_name);
1373 filename = "a_cursed_j.txt";
1375 filename = "a_cursed.txt";
1381 filename = "a_low_j.txt";
1383 filename = "a_low.txt";
1389 filename = "a_med_j.txt";
1391 filename = "a_med.txt";
1397 filename = "a_high_j.txt";
1399 filename = "a_high.txt";
1409 filename = "w_cursed_j.txt";
1411 filename = "w_cursed.txt";
1417 filename = "w_low_j.txt";
1419 filename = "w_low.txt";
1425 filename = "w_med_j.txt";
1427 filename = "w_med.txt";
1433 filename = "w_high_j.txt";
1435 filename = "w_high.txt";
1441 (void)get_rnd_line(filename, artifact_bias, return_name);
1443 if(return_name[0]==0)get_table_name(return_name);
1449 bool create_artifact(object_type *o_ptr, bool a_scroll)
1451 char new_name[1024];
1453 int powers = randint1(5) + 1;
1454 int max_type = (o_ptr->tval < TV_BOOTS ? 7 : 5);
1457 bool a_cursed = FALSE;
1458 int warrior_artifact_bias = 0;
1463 /* Nuke enchantments */
1467 o_ptr->art_flags1 |= k_info[o_ptr->k_idx].flags1;
1468 o_ptr->art_flags2 |= k_info[o_ptr->k_idx].flags2;
1469 o_ptr->art_flags3 |= k_info[o_ptr->k_idx].flags3;
1470 if (o_ptr->pval) has_pval = TRUE;
1472 if (a_scroll && one_in_(4))
1474 switch (p_ptr->pclass)
1477 case CLASS_BERSERKER:
1482 artifact_bias = BIAS_WARRIOR;
1485 case CLASS_HIGH_MAGE:
1486 case CLASS_SORCERER:
1487 case CLASS_MAGIC_EATER:
1488 case CLASS_BLUE_MAGE:
1489 artifact_bias = BIAS_MAGE;
1492 artifact_bias = BIAS_PRIESTLY;
1496 artifact_bias = BIAS_ROGUE;
1497 warrior_artifact_bias = 25;
1500 artifact_bias = BIAS_RANGER;
1501 warrior_artifact_bias = 30;
1504 artifact_bias = BIAS_PRIESTLY;
1505 warrior_artifact_bias = 40;
1507 case CLASS_WARRIOR_MAGE:
1508 case CLASS_RED_MAGE:
1509 artifact_bias = BIAS_MAGE;
1510 warrior_artifact_bias = 40;
1512 case CLASS_CHAOS_WARRIOR:
1513 artifact_bias = BIAS_CHAOS;
1514 warrior_artifact_bias = 40;
1517 case CLASS_FORCETRAINER:
1518 artifact_bias = BIAS_PRIESTLY;
1520 case CLASS_MINDCRAFTER:
1522 if (randint1(5) > 2) artifact_bias = BIAS_PRIESTLY;
1525 if (randint1(5) > 2) artifact_bias = BIAS_WARRIOR;
1527 case CLASS_IMITATOR:
1528 if (randint1(2) > 1) artifact_bias = BIAS_RANGER;
1530 case CLASS_BEASTMASTER:
1531 artifact_bias = BIAS_CHR;
1532 warrior_artifact_bias = 50;
1534 case CLASS_MIRROR_MASTER:
1535 if (randint1(4) > 1)
1537 artifact_bias = BIAS_MAGE;
1541 artifact_bias = BIAS_ROGUE;
1547 if (a_scroll && (randint1(100) <= warrior_artifact_bias))
1548 artifact_bias = BIAS_WARRIOR;
1550 strcpy(new_name, "");
1552 if (!a_scroll && one_in_(A_CURSED))
1554 if (((o_ptr->tval == TV_AMULET) || (o_ptr->tval == TV_RING)) && cursed_p(o_ptr))
1557 while (one_in_(powers) || one_in_(7) || one_in_(10))
1560 if (!a_cursed && one_in_(WEIRD_LUCK))
1563 if (a_cursed) powers /= 2;
1568 switch (randint1(max_type))
1571 random_plus(o_ptr, a_scroll);
1575 if (one_in_(2) && (o_ptr->tval < TV_BOOTS) && (o_ptr->tval != TV_BOW))
1577 if (a_cursed && !one_in_(13)) break;
1580 if (one_in_(o_ptr->ds+4)) o_ptr->ds++;
1584 if (one_in_(o_ptr->dd+1)) o_ptr->dd++;
1588 random_resistance(o_ptr, a_scroll, FALSE);
1591 random_misc(o_ptr, a_scroll);
1594 random_slay(o_ptr, a_scroll);
1597 if (wizard) msg_print("Switch error in create_artifact!");
1605 o_ptr->art_flags3 |= TR3_SHOW_MODS;
1607 /* This one commented out by gw's request... */
1609 o_ptr->art_flags3 |= TR3_HIDE_TYPE;
1612 if (o_ptr->art_flags1 & TR1_BLOWS)
1614 o_ptr->pval = randint1(2);
1615 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA))
1624 while (o_ptr->pval < randint1(5) || one_in_(o_ptr->pval));
1627 if ((o_ptr->pval > 4) && !one_in_(WEIRD_LUCK))
1631 /* give it some plusses... */
1632 if (o_ptr->tval >= TV_BOOTS && o_ptr->tval <= TV_DRAG_ARMOR)
1633 o_ptr->to_a += randint1(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
1634 else if (o_ptr->tval <= TV_SWORD)
1636 o_ptr->to_h += randint1(o_ptr->to_h > 19 ? 1 : 20 - o_ptr->to_h);
1637 o_ptr->to_d += randint1(o_ptr->to_d > 19 ? 1 : 20 - o_ptr->to_d);
1638 if ((o_ptr->art_flags1 & TR1_WIS) && (o_ptr->pval > 0)) o_ptr->art_flags3 |= TR3_BLESSED;
1641 /* Just to be sure */
1642 o_ptr->art_flags3 |= (TR3_IGNORE_ACID | TR3_IGNORE_ELEC |
1643 TR3_IGNORE_FIRE | TR3_IGNORE_COLD);
1645 total_flags = flag_cost(o_ptr, o_ptr->pval);
1646 if (cheat_peek) msg_format("%ld", total_flags);
1648 if (a_cursed) curse_artifact(o_ptr);
1651 (randint1((o_ptr->tval >= TV_BOOTS)
1652 ? ACTIVATION_CHANCE * 2 : ACTIVATION_CHANCE) == 1))
1655 give_activation_power(o_ptr);
1658 if ((o_ptr->tval >= TV_BOOTS) && (o_ptr->tval <= TV_DRAG_ARMOR))
1660 while ((o_ptr->to_d+o_ptr->to_h) > 20)
1662 if (one_in_(o_ptr->to_d) && one_in_(o_ptr->to_h)) break;
1663 o_ptr->to_d -= (s16b)randint0(3);
1664 o_ptr->to_h -= (s16b)randint0(3);
1666 while ((o_ptr->to_d+o_ptr->to_h) > 10)
1668 if (one_in_(o_ptr->to_d) || one_in_(o_ptr->to_h)) break;
1669 o_ptr->to_d -= (s16b)randint0(3);
1670 o_ptr->to_h -= (s16b)randint0(3);
1674 if (((artifact_bias == BIAS_MAGE) || (artifact_bias == BIAS_INT)) && (o_ptr->tval == TV_GLOVES)) o_ptr->art_flags2 |= TR2_FREE_ACT;
1676 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
1680 o_ptr->art_flags1 &= ~(TR1_BLOWS);
1681 o_ptr->art_flags1 &= ~(TR1_FORCE_WEAPON);
1682 o_ptr->art_flags1 &= ~(TR1_SLAY_ANIMAL);
1683 o_ptr->art_flags1 &= ~(TR1_SLAY_EVIL);
1684 o_ptr->art_flags1 &= ~(TR1_SLAY_UNDEAD);
1685 o_ptr->art_flags1 &= ~(TR1_SLAY_DEMON);
1686 o_ptr->art_flags1 &= ~(TR1_SLAY_ORC);
1687 o_ptr->art_flags1 &= ~(TR1_SLAY_TROLL);
1688 o_ptr->art_flags1 &= ~(TR1_SLAY_GIANT);
1689 o_ptr->art_flags1 &= ~(TR1_SLAY_DRAGON);
1690 o_ptr->art_flags1 &= ~(TR1_KILL_DRAGON);
1691 o_ptr->art_flags1 &= ~(TR1_VORPAL);
1692 o_ptr->art_flags1 &= ~(TR1_BRAND_POIS);
1693 o_ptr->art_flags1 &= ~(TR1_BRAND_ACID);
1694 o_ptr->art_flags1 &= ~(TR1_BRAND_ELEC);
1695 o_ptr->art_flags1 &= ~(TR1_BRAND_FIRE);
1696 o_ptr->art_flags1 &= ~(TR1_BRAND_COLD);
1699 if (o_ptr->tval >= TV_BOOTS)
1701 if (a_cursed) power_level = 0;
1702 else if (total_flags < 15000) power_level = 1;
1703 else if (total_flags < 25000) power_level = 2;
1704 else power_level = 3;
1709 if (a_cursed) power_level = 0;
1710 else if (total_flags < 20000) power_level = 1;
1711 else if (total_flags < 35000) power_level = 2;
1712 else power_level = 3;
1717 char dummy_name[80];
1718 /* Identify it fully */
1719 object_aware(o_ptr);
1720 object_known(o_ptr);
1722 /* Mark the item as fully known */
1723 o_ptr->ident |= (IDENT_MENTAL);
1725 strcpy(dummy_name, "");
1726 (void)identify_fully_aux(o_ptr);
1729 if (!(get_string("¤³¤Î¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ò²¿¤È̾ÉÕ¤±¤Þ¤¹¤«¡©", dummy_name, 80)))
1731 if (!(get_string("What do you want to call the artifact? ", dummy_name, 80)))
1735 get_random_name(new_name, (bool)(o_ptr->tval >= TV_BOOTS), power_level);
1740 strcpy(new_name, "¡Ô");
1742 strcpy(new_name, "'");
1745 strcat(new_name, dummy_name);
1747 strcat(new_name, "¡Õ¤È¤¤¤¦Ì¾¤Î");
1749 strcat(new_name, "'");
1754 chg_virtue(V_INDIVIDUALISM, 2);
1755 chg_virtue(V_ENCHANT, 5);
1760 get_random_name(new_name, (bool)(o_ptr->tval >= TV_BOOTS), power_level);
1767 msg_format("±¿¤ÎÊФä¿¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È: %d¡£", artifact_bias);
1769 msg_format("Biased artifact: %d.", artifact_bias);
1774 msg_print("¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ë±¿¤ÎÊФê¤Ê¤·¡£");
1776 msg_print("No bias in artifact.");
1781 /* Save the inscription */
1782 o_ptr->art_name = quark_add(new_name);
1785 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1791 bool activate_random_artifact(object_type * o_ptr)
1793 int plev = p_ptr->lev;
1794 int k, dir, dummy = 0;
1796 if (!o_ptr->art_name) return FALSE; /* oops? */
1798 /* Activate for attack */
1799 switch (o_ptr->xtra2)
1803 if (!get_aim_dir(&dir)) return FALSE;
1805 msg_print("ÂÀÍÛ¸÷Àþ¤¬Êü¤¿¤ì¤¿¡£");
1807 msg_print("A line of sunlight appears.");
1810 (void)lite_line(dir);
1811 o_ptr->timeout = 10;
1818 msg_print("¤½¤ì¤ÏâÁ¤·¤¤¤¯¤é¤¤¤ËÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
1820 msg_print("It glows extremely brightly...");
1823 if (!get_aim_dir(&dir)) return FALSE;
1824 fire_bolt(GF_MISSILE, dir, damroll(2, 6));
1832 msg_print("¤½¤ì¤ÏÇ»Î理Ë̮ư¤·¤Æ¤¤¤ë...");
1834 msg_print("It throbs deep green...");
1837 if (!get_aim_dir(&dir)) return FALSE;
1838 fire_ball(GF_POIS, dir, 12, 3);
1839 o_ptr->timeout = randint0(4) + 4;
1846 msg_print("¤½¤ì¤Ï²Ð²Ö¤Ëʤ¤ï¤ì¤¿...");
1848 msg_print("It is covered in sparks...");
1851 if (!get_aim_dir(&dir)) return FALSE;
1852 fire_bolt(GF_ELEC, dir, damroll(4, 8));
1853 o_ptr->timeout = randint0(5) + 5;
1860 msg_print("¤½¤ì¤Ï»À¤Ëʤ¤ï¤ì¤¿...");
1862 msg_print("It is covered in acid...");
1865 if (!get_aim_dir(&dir)) return FALSE;
1866 fire_bolt(GF_ACID, dir, damroll(5, 8));
1867 o_ptr->timeout = randint0(6) + 6;
1874 msg_print("¤½¤ì¤ÏÁú¤Ëʤ¤ï¤ì¤¿...");
1876 msg_print("It is covered in frost...");
1879 if (!get_aim_dir(&dir)) return FALSE;
1880 fire_bolt(GF_COLD, dir, damroll(6, 8));
1881 o_ptr->timeout = randint0(7) + 7;
1888 msg_print("¤½¤ì¤Ï±ê¤Ëʤ¤ï¤ì¤¿...");
1890 msg_print("It is covered in fire...");
1893 if (!get_aim_dir(&dir)) return FALSE;
1894 fire_bolt(GF_FIRE, dir, damroll(9, 8));
1895 o_ptr->timeout = randint0(8) + 8;
1902 msg_print("¤½¤ì¤ÏÁú¤Ëʤ¤ï¤ì¤¿...");
1904 msg_print("It is covered in frost...");
1907 if (!get_aim_dir(&dir)) return FALSE;
1908 fire_ball(GF_COLD, dir, 48, 2);
1909 o_ptr->timeout = 400;
1916 msg_print("¤½¤ì¤ÏÀÖ¤¯·ã¤·¤¯µ±¤¤¤¿...");
1918 msg_print("It glows an intense red...");
1921 if (!get_aim_dir(&dir)) return FALSE;
1922 fire_ball(GF_FIRE, dir, 72, 2);
1923 o_ptr->timeout = 400;
1930 msg_print("¤½¤ì¤Ï¹õ¤¯µ±¤¤¤¿...");
1932 msg_print("It glows black...");
1935 if (!get_aim_dir(&dir)) return FALSE;
1936 if (drain_life(dir, 100))
1937 o_ptr->timeout = randint0(100) + 100;
1944 msg_print("¤½¤ì¤ÏÀĤ¯·ã¤·¤¯µ±¤¤¤¿...");
1946 msg_print("It glows an intense blue...");
1949 if (!get_aim_dir(&dir)) return FALSE;
1950 fire_ball(GF_COLD, dir, 100, 2);
1951 o_ptr->timeout = 300;
1958 msg_print("Åŵ¤¤¬¥Ñ¥Á¥Ñ¥Á²»¤òΩ¤Æ¤¿...");
1960 msg_print("It crackles with electricity...");
1963 if (!get_aim_dir(&dir)) return FALSE;
1964 fire_ball(GF_ELEC, dir, 100, 3);
1965 o_ptr->timeout = 500;
1972 msg_print("¹õ¤¯µ±¤¤¤Æ¤¤¤ë...");
1974 msg_print("It glows black...");
1977 if (!get_aim_dir(&dir)) return FALSE;
1978 drain_life(dir, 120);
1979 o_ptr->timeout = 400;
1985 if (!get_aim_dir(&dir)) return FALSE;
1986 for (dummy = 0; dummy < 3; dummy++)
1988 if (drain_life(dir, 50))
1991 o_ptr->timeout = 400;
1998 msg_print("ËâË¡¤Î¥È¥²¤¬¸½¤ì¤¿...");
2000 msg_print("It grows magical spikes...");
2003 if (!get_aim_dir(&dir)) return FALSE;
2004 fire_bolt(GF_ARROW, dir, 150);
2005 o_ptr->timeout = randint0(90) + 90;
2012 msg_print("¿¼ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2014 msg_print("It glows deep red...");
2017 if (!get_aim_dir(&dir)) return FALSE;
2018 fire_ball(GF_FIRE, dir, 120, 3);
2019 o_ptr->timeout = randint0(225) + 225;
2026 msg_print("ÌÀ¤ë¤¯Çò¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2028 msg_print("It glows bright white...");
2031 if (!get_aim_dir(&dir)) return FALSE;
2032 fire_ball(GF_COLD, dir, 200, 3);
2033 o_ptr->timeout = randint0(325) + 325;
2040 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2042 msg_print("It glows deep blue...");
2045 if (!get_aim_dir(&dir)) return FALSE;
2046 fire_ball(GF_ELEC, dir, 250, 3);
2047 o_ptr->timeout = randint0(425) + 425;
2056 monster_type *m_ptr;
2058 for (dir = 0; dir <= 9; dir++)
2062 c_ptr = &cave[y][x];
2064 /* Get the monster */
2065 m_ptr = &m_list[c_ptr->m_idx];
2067 /* Hack -- attack monsters */
2068 if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
2072 o_ptr->timeout = 250;
2078 if (!get_aim_dir(&dir)) return FALSE;
2079 for (dummy = 0; dummy < 3; dummy++)
2081 if (drain_life(dir, 100))
2085 o_ptr->timeout = 400;
2090 case ACT_CALL_CHAOS:
2093 msg_print("ÍÍ¡¹¤Ê¿§¤Î²Ð²Ö¤òȯ¤·¤Æ¤¤¤ë...");
2095 msg_print("It glows in scintillating colours...");
2099 o_ptr->timeout = 350;
2105 if (!get_aim_dir(&dir)) return FALSE;
2107 msg_print("¥í¥±¥Ã¥È¤òȯ¼Í¤·¤¿¡ª");
2109 msg_print("You launch a rocket!");
2112 fire_ball(GF_ROCKET, dir, 250 + plev*3, 2);
2113 o_ptr->timeout = 400;
2120 msg_print("¿ÀÀ»¤ÊÊ·°Ïµ¤¤¬½¼Ëþ¤·¤¿...");
2122 msg_print("It floods the area with goodness...");
2125 dispel_evil(p_ptr->lev * 5);
2126 o_ptr->timeout = randint0(300) + 300;
2133 msg_print("¼Ù°¤ÊÊ·°Ïµ¤¤¬½¼Ëþ¤·¤¿...");
2135 msg_print("It floods the area with evil...");
2138 dispel_good(p_ptr->lev * 5);
2139 o_ptr->timeout = randint0(300) + 300;
2145 if (!get_aim_dir(&dir)) return FALSE;
2147 msg_print("¤¢¤Ê¤¿¤Ï¥¨¥ì¥á¥ó¥È¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
2149 msg_print("You breathe the elements.");
2152 fire_ball(GF_MISSILE, dir, 300, 4);
2153 o_ptr->timeout = 500;
2157 /* Activate for other offensive action */
2162 msg_print("ÍÍ¡¹¤Ê¿§¤Î²Ð²Ö¤òȯ¤·¤Æ¤¤¤ë...");
2164 msg_print("It glows in scintillating colours...");
2167 if (!get_aim_dir(&dir)) return FALSE;
2168 confuse_monster(dir, 20);
2169 o_ptr->timeout = 15;
2176 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2178 msg_print("It glows deep blue...");
2181 sleep_monsters_touch();
2182 o_ptr->timeout = 55;
2188 earthquake(py, px, 10);
2189 o_ptr->timeout = 50;
2195 turn_monsters(40 + p_ptr->lev);
2196 o_ptr->timeout = 3 * (p_ptr->lev + 10);
2202 if (!get_aim_dir(&dir)) return FALSE;
2203 (void)fire_beam(GF_AWAY_ALL, dir, plev);
2204 o_ptr->timeout = 200;
2208 case ACT_BANISH_EVIL:
2210 if (banish_evil(100))
2213 msg_print("¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ÎÎϤ¬¼Ù°¤òÂǤÁÅݤ·¤¿¡ª");
2215 msg_print("The power of the artifact banishes evil!");
2219 o_ptr->timeout = 250 + randint1(250);
2226 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2228 msg_print("It glows deep blue...");
2231 (void)symbol_genocide(200, TRUE);
2232 o_ptr->timeout = 500;
2239 msg_print("¤Ò¤É¤¯±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...");
2241 msg_print("It lets out a long, shrill note...");
2244 (void)mass_genocide(200, TRUE);
2245 o_ptr->timeout = 1000;
2249 /* Activate for summoning / charming */
2251 case ACT_CHARM_ANIMAL:
2253 if (!get_aim_dir(&dir)) return FALSE;
2254 (void)charm_animal(dir, plev);
2255 o_ptr->timeout = 300;
2259 case ACT_CHARM_UNDEAD:
2261 if (!get_aim_dir(&dir)) return FALSE;
2262 (void)control_one_undead(dir, plev);
2263 o_ptr->timeout = 333;
2267 case ACT_CHARM_OTHER:
2269 if (!get_aim_dir(&dir)) return FALSE;
2270 (void)charm_monster(dir, plev);
2271 o_ptr->timeout = 400;
2275 case ACT_CHARM_ANIMALS:
2277 (void)charm_animals(plev * 2);
2278 o_ptr->timeout = 500;
2282 case ACT_CHARM_OTHERS:
2284 charm_monsters(plev * 2);
2285 o_ptr->timeout = 750;
2289 case ACT_SUMMON_ANIMAL:
2291 (void)summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, TRUE, TRUE, TRUE, FALSE, FALSE);
2292 o_ptr->timeout = 200 + randint1(300);
2296 case ACT_SUMMON_PHANTOM:
2299 msg_print("¸¸Îî¤ò¾¤´¤·¤¿¡£");
2301 msg_print("You summon a phantasmal servant.");
2304 (void)summon_specific(-1, py, px, dun_level, SUMMON_PHANTOM, TRUE, TRUE, TRUE, FALSE, FALSE);
2305 o_ptr->timeout = 200 + randint1(200);
2309 case ACT_SUMMON_ELEMENTAL:
2311 bool pet = one_in_(3);
2312 bool group = !(pet && (plev < 50));
2314 if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_ELEMENTAL, group, FALSE, pet, FALSE, (bool)(!pet)))
2317 msg_print("¥¨¥ì¥á¥ó¥¿¥ë¤¬¸½¤ì¤¿...");
2319 msg_print("An elemental materializes...");
2325 msg_print("¤¢¤Ê¤¿¤ËÉþ½¾¤·¤Æ¤¤¤ë¤è¤¦¤À¡£");
2327 msg_print("It seems obedient to you.");
2332 msg_print("¤½¤ì¤ò¥³¥ó¥È¥í¡¼¥ë¤Ç¤¤Ê¤«¤Ã¤¿¡ª");
2334 msg_print("You fail to control it!");
2339 o_ptr->timeout = 750;
2343 case ACT_SUMMON_DEMON:
2345 bool pet = one_in_(3);
2346 bool group = !(pet && (plev < 50));
2348 if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_DEMON, group, FALSE, pet, FALSE, (bool)(!pet)))
2351 msg_print("ⲫ¤Î°½¤¬½¼Ëþ¤·¤¿¡£");
2353 msg_print("The area fills with a stench of sulphur and brimstone.");
2358 msg_print("¡Ö¤´ÍѤǤ´¤¶¤¤¤Þ¤¹¤«¡¢¤´¼ç¿ÍÍÍ¡×");
2360 msg_print("'What is thy bidding... Master?'");
2365 msg_print("¡ÖNON SERVIAM! Wretch! ¤ªÁ°¤Îº²¤òĺ¤¯¤¾¡ª¡×");
2367 msg_print("'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'");
2372 o_ptr->timeout = 666 + randint1(333);
2376 case ACT_SUMMON_UNDEAD:
2378 bool pet = one_in_(3);
2383 type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
2386 group = (((plev > 24) && one_in_(3)) ? TRUE : FALSE);
2387 unique_okay = FALSE;
2395 if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), type,
2396 group, FALSE, pet, unique_okay, (bool)(!pet)))
2399 msg_print("Î䤿¤¤É÷¤¬¤¢¤Ê¤¿¤Î¼þ¤ê¤Ë¿á¤»Ï¤á¤¿¡£¤½¤ì¤ÏÉåÇÔ½¤ò±¿¤ó¤Ç¤¤¤ë...");
2401 msg_print("Cold winds begin to blow around you, carrying with them the stench of decay...");
2406 msg_print("¸Å¤¨¤Î»à¤»¤ë¼Ô¶¦¤¬¤¢¤Ê¤¿¤Ë»Å¤¨¤ë¤¿¤áÅÚ¤«¤éᴤä¿¡ª");
2408 msg_print("Ancient, long-dead forms arise from the ground to serve you!");
2413 msg_print("»à¼Ô¤¬á´¤Ã¤¿¡£Ì²¤ê¤ò˸¤²¤ë¤¢¤Ê¤¿¤òȳ¤¹¤ë¤¿¤á¤Ë¡ª");
2415 msg_print("'The dead arise... to punish you for disturbing them!'");
2420 o_ptr->timeout = 666 + randint1(333);
2424 /* Activate for healing */
2428 (void)set_afraid(0);
2429 (void)hp_player(30);
2430 o_ptr->timeout = 10;
2437 msg_print("¿¼»ç¿§¤Î¸÷¤òȯ¤·¤Æ¤¤¤ë...");
2439 msg_print("It radiates deep purple...");
2442 hp_player(damroll(4, 8));
2443 (void)set_cut((p_ptr->cut / 2) - 50);
2444 o_ptr->timeout = randint0(3) + 3;
2448 case ACT_CURE_POISON:
2451 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2453 msg_print("It glows deep blue...");
2456 (void)set_afraid(0);
2457 (void)set_poisoned(0);
2465 msg_print("¿¼¹È¤Ëµ±¤¤¤Æ¤¤¤ë...");
2467 msg_print("It glows a deep red...");
2471 o_ptr->timeout = 450;
2478 msg_print("Ç»Îп§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2480 msg_print("It glows a deep green...");
2483 (void)do_res_stat(A_STR);
2484 (void)do_res_stat(A_INT);
2485 (void)do_res_stat(A_WIS);
2486 (void)do_res_stat(A_DEX);
2487 (void)do_res_stat(A_CON);
2488 (void)do_res_stat(A_CHR);
2489 (void)restore_level();
2490 o_ptr->timeout = 750;
2497 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2499 msg_print("It glows deep blue...");
2503 msg_print("ÂÎÆâ¤ËÃȤ«¤¤¸ÝÆ°¤¬´¶¤¸¤é¤ì¤ë...");
2505 msg_print("You feel a warm tingling inside...");
2508 (void)hp_player(700);
2510 o_ptr->timeout = 250;
2517 msg_print("Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2519 msg_print("It glows a bright white...");
2523 msg_print("¤Ò¤¸¤ç¤¦¤Ëµ¤Ê¬¤¬¤è¤¤...");
2525 msg_print("You feel much better...");
2528 (void)hp_player(1000);
2530 o_ptr->timeout = 888;
2534 /* Activate for timed effect */
2538 (void)set_tim_esp(randint1(30) + 25, FALSE);
2539 o_ptr->timeout = 200;
2545 (void)set_hero(randint1(50) + 50, FALSE);
2546 (void)set_blessed(randint1(50) + 50, FALSE);
2547 o_ptr->timeout = 100 + randint1(100);
2554 msg_print("±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...");
2556 msg_print("It lets out a shrill wail...");
2560 (void)set_protevil(randint1(25) + k, FALSE);
2561 o_ptr->timeout = randint0(225) + 225;
2565 case ACT_RESIST_ALL:
2568 msg_print("ÍÍ¡¹¤Ê¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2570 msg_print("It glows many colours...");
2573 (void)set_oppose_acid(randint1(40) + 40, FALSE);
2574 (void)set_oppose_elec(randint1(40) + 40, FALSE);
2575 (void)set_oppose_fire(randint1(40) + 40, FALSE);
2576 (void)set_oppose_cold(randint1(40) + 40, FALSE);
2577 (void)set_oppose_pois(randint1(40) + 40, FALSE);
2578 o_ptr->timeout = 200;
2585 msg_print("ÌÀ¤ë¤¯Îп§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2587 msg_print("It glows bright green...");
2590 (void)set_fast(randint1(20) + 20, FALSE);
2591 o_ptr->timeout = 250;
2595 case ACT_XTRA_SPEED:
2598 msg_print("ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2600 msg_print("It glows brightly...");
2603 (void)set_fast(randint1(75) + 75, FALSE);
2604 o_ptr->timeout = randint0(200) + 200;
2610 set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
2611 o_ptr->timeout = 1000;
2617 (void)set_invuln(randint1(8) + 8, FALSE);
2618 o_ptr->timeout = 1000;
2622 /* Activate for general purpose effect (detection etc.) */
2627 msg_print("À¡¤ó¤À¸÷¤¬¤¢¤Õ¤ì½Ð¤¿...");
2629 msg_print("It wells with clear light...");
2632 lite_area(damroll(2, 15), 3);
2633 o_ptr->timeout = randint0(10) + 10;
2640 msg_print("âÁ¤·¤¯µ±¤¤¤¿...");
2642 msg_print("It shines brightly...");
2645 map_area(DETECT_RAD_MAP);
2646 lite_area(damroll(2, 15), 3);
2647 o_ptr->timeout = randint0(50) + 50;
2651 case ACT_DETECT_ALL:
2654 msg_print("Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2656 msg_print("It glows bright white...");
2660 msg_print("¿´¤Ë¥¤¥á¡¼¥¸¤¬É⤫¤ó¤Ç¤¤¿...");
2662 msg_print("An image forms in your mind...");
2665 detect_all(DETECT_RAD_DEFAULT);
2666 o_ptr->timeout = randint0(55) + 55;
2670 case ACT_DETECT_XTRA:
2673 msg_print("ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2675 msg_print("It glows brightly...");
2678 detect_all(DETECT_RAD_DEFAULT);
2680 identify_fully(FALSE);
2681 o_ptr->timeout = 1000;
2688 msg_print("²«¿§¤¯µ±¤¤¤Æ¤¤¤ë...");
2690 msg_print("It glows yellow...");
2693 identify_fully(FALSE);
2694 o_ptr->timeout = 750;
2700 if (!ident_spell(FALSE)) return FALSE;
2701 o_ptr->timeout = 10;
2705 case ACT_RUNE_EXPLO:
2708 msg_print("ÌÀ¤ë¤¤ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2710 msg_print("It glows bright red...");
2714 o_ptr->timeout = 200;
2721 msg_print("¥Ö¥ë¡¼¤ËÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2723 msg_print("It glows light blue...");
2727 o_ptr->timeout = 400;
2733 (void)set_food(PY_FOOD_MAX - 1);
2734 o_ptr->timeout = 200;
2741 msg_print("ÌÀ¤ë¤¤ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2743 msg_print("It glows bright red...");
2746 destroy_doors_touch();
2747 o_ptr->timeout = 10;
2754 msg_print("¸ÝÆ°¤·¤Æ¤¤¤ë...");
2756 msg_print("It pulsates...");
2759 if (!get_aim_dir(&dir)) return FALSE;
2768 o_ptr->timeout = 70;
2775 msg_print("ÌÀ¤ë¤¤²«¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2777 msg_print("It glows bright yellow...");
2781 o_ptr->timeout = 500;
2788 msg_print("¼¡¸µ¤ÎÈ⤬³«¤¤¤¿¡£ÌÜŪÃϤòÁª¤ó¤Ç²¼¤µ¤¤¡£");
2790 msg_print("You open a dimensional gate. Choose a destination.");
2793 if (!dimension_door()) return FALSE;
2794 o_ptr->timeout = 100;
2802 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ë...");
2804 msg_print("It twists space around you...");
2807 teleport_player(100);
2808 o_ptr->timeout = 45;
2815 msg_print("¤ä¤ï¤é¤«¤ÊÇò¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2817 msg_print("It glows soft white...");
2819 if (!word_of_recall()) return FALSE;
2820 o_ptr->timeout = 200;
2827 msg_format("Unknown activation effect: %d.", o_ptr->xtra2);
2829 msg_format("Unknown activation effect: %d.", o_ptr->xtra2);
2840 void random_artifact_resistance(object_type * o_ptr)
2842 bool give_resistance = FALSE, give_power = FALSE;
2844 if (o_ptr->name1 == ART_TERROR) /* Terror Mask is for warriors... */
2846 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_ARCHER || p_ptr->pclass == CLASS_CAVALRY || p_ptr->pclass == CLASS_BERSERKER)
2849 give_resistance = TRUE;
2853 o_ptr->art_flags3 |=
2854 (TR3_CURSED | TR3_HEAVY_CURSE | TR3_AGGRAVATE | TR3_TY_CURSE);
2855 o_ptr->ident |= IDENT_CURSED;
2859 if (o_ptr->name1 == ART_MURAMASA)
2861 if (p_ptr->pclass != CLASS_SAMURAI)
2863 o_ptr->art_flags3 |= (TR3_NO_TELE | TR3_NO_MAGIC | TR3_HEAVY_CURSE);
2864 o_ptr->ident |= IDENT_CURSED;
2868 if (o_ptr->name1 == ART_XIAOLONG)
2870 if (p_ptr->pclass == CLASS_MONK)
2871 o_ptr->art_flags1 |= TR1_BLOWS;
2874 if (o_ptr->name1 == ART_BLOOD)
2877 dummy = randint1(2)+randint1(2);
2878 for (i = 0; i < dummy; i++)
2879 o_ptr->art_flags1 |= (TR1_CHAOTIC << randint0(18));
2880 dummy = randint1(2);
2881 for (i = 0; i < dummy; i++)
2882 random_resistance(o_ptr, FALSE, randint1(34) + 4);
2884 for (i = 0; i < dummy; i++)
2886 int tmp = randint0(11);
2887 if (tmp < 6) o_ptr->art_flags1 |= (TR1_STR << tmp);
2888 else o_ptr->art_flags1 |= (TR1_STEALTH << (tmp - 6));
2892 switch (o_ptr->name1)
2910 case ART_THALKETTOTH:
2913 /* Give a resistance */
2914 give_resistance = TRUE;
2923 case ART_HARADEKKET:
2929 /* Give a resistance OR a power */
2930 if (one_in_(2)) give_resistance = TRUE;
2931 else give_power = TRUE;
2952 give_resistance = TRUE;
2959 o_ptr->xtra1 = EGO_XTRA_ABILITY;
2961 /* Randomize the "xtra" power */
2962 if (o_ptr->xtra1) o_ptr->xtra2 = randint1(256);
2967 if (give_resistance)
2969 random_resistance(o_ptr, FALSE, randint1(22) + 16);
2975 * Create the artifact of the specified number
2977 void create_named_art(int a_idx, int y, int x)
2983 artifact_type *a_ptr = &a_info[a_idx];
2985 /* Get local object */
2988 /* Ignore "empty" artifacts */
2989 if (!a_ptr->name) return;
2991 /* Acquire the "kind" index */
2992 i = lookup_kind(a_ptr->tval, a_ptr->sval);
2997 /* Create the artifact */
2998 object_prep(q_ptr, i);
3001 q_ptr->name1 = a_idx;
3003 /* Extract the fields */
3004 q_ptr->pval = a_ptr->pval;
3005 q_ptr->ac = a_ptr->ac;
3006 q_ptr->dd = a_ptr->dd;
3007 q_ptr->ds = a_ptr->ds;
3008 q_ptr->to_a = a_ptr->to_a;
3009 q_ptr->to_h = a_ptr->to_h;
3010 q_ptr->to_d = a_ptr->to_d;
3011 q_ptr->weight = a_ptr->weight;
3013 /* Hack -- acquire "cursed" flag */
3014 if (a_ptr->flags3 & TR3_CURSED) q_ptr->ident |= (IDENT_CURSED);
3016 random_artifact_resistance(q_ptr);
3018 /* Drop the artifact from heaven */
3019 (void)drop_near(q_ptr, -1, y, x);