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
29 * Use for biased artifact creation
31 static int artifact_bias;
35 * Choose one random sustain
37 void one_sustain(object_type *o_ptr)
41 case 0: o_ptr->art_flags2 |= (TR2_SUST_STR); break;
42 case 1: o_ptr->art_flags2 |= (TR2_SUST_INT); break;
43 case 2: o_ptr->art_flags2 |= (TR2_SUST_WIS); break;
44 case 3: o_ptr->art_flags2 |= (TR2_SUST_DEX); break;
45 case 4: o_ptr->art_flags2 |= (TR2_SUST_CON); break;
46 case 5: o_ptr->art_flags2 |= (TR2_SUST_CHR); break;
52 * Choose one random high resistance
54 void one_high_resistance(object_type *o_ptr)
58 case 0: o_ptr->art_flags2 |= (TR2_RES_POIS); break;
59 case 1: o_ptr->art_flags2 |= (TR2_RES_LITE); break;
60 case 2: o_ptr->art_flags2 |= (TR2_RES_DARK); break;
61 case 3: o_ptr->art_flags2 |= (TR2_RES_SHARDS); break;
62 case 4: o_ptr->art_flags2 |= (TR2_RES_BLIND); break;
63 case 5: o_ptr->art_flags2 |= (TR2_RES_CONF); break;
64 case 6: o_ptr->art_flags2 |= (TR2_RES_SOUND); break;
65 case 7: o_ptr->art_flags2 |= (TR2_RES_NETHER); break;
66 case 8: o_ptr->art_flags2 |= (TR2_RES_NEXUS); break;
67 case 9: o_ptr->art_flags2 |= (TR2_RES_CHAOS); break;
68 case 10: o_ptr->art_flags2 |= (TR2_RES_DISEN); break;
69 case 11: o_ptr->art_flags2 |= (TR2_RES_FEAR); break;
75 * Choose one random high resistance ( except poison and disenchantment )
77 void one_lordly_high_resistance(object_type *o_ptr)
81 case 0: o_ptr->art_flags2 |= (TR2_RES_LITE); break;
82 case 1: o_ptr->art_flags2 |= (TR2_RES_DARK); break;
83 case 2: o_ptr->art_flags2 |= (TR2_RES_SHARDS); break;
84 case 3: o_ptr->art_flags2 |= (TR2_RES_BLIND); break;
85 case 4: o_ptr->art_flags2 |= (TR2_RES_CONF); break;
86 case 5: o_ptr->art_flags2 |= (TR2_RES_SOUND); break;
87 case 6: o_ptr->art_flags2 |= (TR2_RES_NETHER); break;
88 case 7: o_ptr->art_flags2 |= (TR2_RES_NEXUS); break;
89 case 8: o_ptr->art_flags2 |= (TR2_RES_CHAOS); break;
90 case 9: o_ptr->art_flags2 |= (TR2_RES_FEAR); break;
96 * Choose one random element resistance
98 void one_ele_resistance(object_type *o_ptr)
102 case 0: o_ptr->art_flags2 |= (TR2_RES_ACID); break;
103 case 1: o_ptr->art_flags2 |= (TR2_RES_ELEC); break;
104 case 2: o_ptr->art_flags2 |= (TR2_RES_COLD); break;
105 case 3: o_ptr->art_flags2 |= (TR2_RES_FIRE); break;
111 * Choose one random element or poison resistance
113 void one_dragon_ele_resistance(object_type *o_ptr)
117 o_ptr->art_flags2 |= (TR2_RES_POIS);
121 one_ele_resistance(o_ptr);
127 * Choose one random resistance
129 void one_resistance(object_type *o_ptr)
133 one_ele_resistance(o_ptr);
137 one_high_resistance(o_ptr);
143 * Choose one random ability
145 void one_ability(object_type *o_ptr)
149 case 0: o_ptr->art_flags3 |= (TR3_FEATHER); break;
150 case 1: o_ptr->art_flags3 |= (TR3_LITE); break;
151 case 2: o_ptr->art_flags3 |= (TR3_SEE_INVIS); break;
152 case 3: o_ptr->art_flags3 |= (TR3_WARNING); break;
153 case 4: o_ptr->art_flags3 |= (TR3_SLOW_DIGEST); break;
154 case 5: o_ptr->art_flags3 |= (TR3_REGEN); break;
155 case 6: o_ptr->art_flags2 |= (TR2_FREE_ACT); break;
156 case 7: o_ptr->art_flags2 |= (TR2_HOLD_LIFE); break;
161 static void curse_artifact(object_type * o_ptr)
163 if (o_ptr->pval > 0) o_ptr->pval = 0 - (o_ptr->pval + randint1(4));
164 if (o_ptr->to_a > 0) o_ptr->to_a = 0 - (o_ptr->to_a + randint1(4));
165 if (o_ptr->to_h > 0) o_ptr->to_h = 0 - (o_ptr->to_h + randint1(4));
166 if (o_ptr->to_d > 0) o_ptr->to_d = 0 - (o_ptr->to_d + randint1(4));
168 o_ptr->curse_flags |= (TRC_HEAVY_CURSE | TRC_CURSED);
169 o_ptr->art_flags3 &= ~(TR3_BLESSED);
171 if (one_in_(4)) o_ptr->curse_flags |= TRC_PERMA_CURSE;
172 if (one_in_(3)) o_ptr->art_flags3 |= TR3_TY_CURSE;
173 if (one_in_(2)) o_ptr->art_flags3 |= TR3_AGGRAVATE;
174 if (one_in_(3)) o_ptr->art_flags3 |= TR3_DRAIN_EXP;
175 if (one_in_(2)) o_ptr->art_flags3 |= TR3_TELEPORT;
176 else if (one_in_(3)) o_ptr->art_flags3 |= TR3_NO_TELE;
178 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))
179 o_ptr->art_flags3 |= TR3_NO_MAGIC;
183 static void random_plus(object_type * o_ptr)
185 int this_type = (o_ptr->tval < TV_BOOTS ? 23 : 19);
187 switch (artifact_bias)
190 if (!(o_ptr->art_flags1 & TR1_STR))
192 o_ptr->art_flags1 |= TR1_STR;
193 if (one_in_(2)) return;
196 if (!(o_ptr->art_flags1 & TR1_CON))
198 o_ptr->art_flags1 |= TR1_CON;
199 if (one_in_(2)) return;
202 if (!(o_ptr->art_flags1 & TR1_DEX))
204 o_ptr->art_flags1 |= TR1_DEX;
205 if (one_in_(2)) return;
210 if (!(o_ptr->art_flags1 & TR1_INT))
212 o_ptr->art_flags1 |= TR1_INT;
213 if (one_in_(2)) return;
215 if ((o_ptr->tval == TV_GLOVES) && !(o_ptr->art_flags1 & TR1_MAGIC_MASTERY))
217 o_ptr->art_flags1 |= TR1_MAGIC_MASTERY;
218 if (one_in_(2)) return;
223 if (!(o_ptr->art_flags1 & TR1_WIS))
225 o_ptr->art_flags1 |= TR1_WIS;
226 if (one_in_(2)) return;
231 if (!(o_ptr->art_flags1 & TR1_DEX))
233 o_ptr->art_flags1 |= TR1_DEX;
234 if (one_in_(2)) return;
237 if (!(o_ptr->art_flags1 & TR1_CON))
239 o_ptr->art_flags1 |= TR1_CON;
240 if (one_in_(2)) return;
243 if (!(o_ptr->art_flags1 & TR1_STR))
245 o_ptr->art_flags1 |= TR1_STR;
246 if (one_in_(2)) return;
251 if (!(o_ptr->art_flags1 & TR1_STEALTH))
253 o_ptr->art_flags1 |= TR1_STEALTH;
254 if (one_in_(2)) return;
256 if (!(o_ptr->art_flags1 & TR1_SEARCH))
258 o_ptr->art_flags1 |= TR1_SEARCH;
259 if (one_in_(2)) return;
264 if (!(o_ptr->art_flags1 & TR1_STR))
266 o_ptr->art_flags1 |= TR1_STR;
267 if (one_in_(2)) return;
272 if (!(o_ptr->art_flags1 & TR1_WIS))
274 o_ptr->art_flags1 |= TR1_WIS;
275 if (one_in_(2)) return;
280 if (!(o_ptr->art_flags1 & TR1_INT))
282 o_ptr->art_flags1 |= TR1_INT;
283 if (one_in_(2)) return;
288 if (!(o_ptr->art_flags1 & TR1_DEX))
290 o_ptr->art_flags1 |= TR1_DEX;
291 if (one_in_(2)) return;
296 if (!(o_ptr->art_flags1 & TR1_CON))
298 o_ptr->art_flags1 |= TR1_CON;
299 if (one_in_(2)) return;
304 if (!(o_ptr->art_flags1 & TR1_CHR))
306 o_ptr->art_flags1 |= TR1_CHR;
307 if (one_in_(2)) return;
312 if ((artifact_bias == BIAS_MAGE || artifact_bias == BIAS_PRIESTLY) && (o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ROBE))
314 if (!(o_ptr->art_flags3 & TR3_DEC_MANA) && one_in_(3))
316 o_ptr->art_flags3 |= TR3_DEC_MANA;
317 if (one_in_(2)) return;
321 switch (randint1(this_type))
324 o_ptr->art_flags1 |= TR1_STR;
325 if (!artifact_bias && !one_in_(13))
326 artifact_bias = BIAS_STR;
327 else if (!artifact_bias && one_in_(7))
328 artifact_bias = BIAS_WARRIOR;
331 o_ptr->art_flags1 |= TR1_INT;
332 if (!artifact_bias && !one_in_(13))
333 artifact_bias = BIAS_INT;
334 else if (!artifact_bias && one_in_(7))
335 artifact_bias = BIAS_MAGE;
338 o_ptr->art_flags1 |= TR1_WIS;
339 if (!artifact_bias && !one_in_(13))
340 artifact_bias = BIAS_WIS;
341 else if (!artifact_bias && one_in_(7))
342 artifact_bias = BIAS_PRIESTLY;
345 o_ptr->art_flags1 |= TR1_DEX;
346 if (!artifact_bias && !one_in_(13))
347 artifact_bias = BIAS_DEX;
348 else if (!artifact_bias && one_in_(7))
349 artifact_bias = BIAS_ROGUE;
352 o_ptr->art_flags1 |= TR1_CON;
353 if (!artifact_bias && !one_in_(13))
354 artifact_bias = BIAS_CON;
355 else if (!artifact_bias && one_in_(9))
356 artifact_bias = BIAS_RANGER;
359 o_ptr->art_flags1 |= TR1_CHR;
360 if (!artifact_bias && !one_in_(13))
361 artifact_bias = BIAS_CHR;
364 o_ptr->art_flags1 |= TR1_STEALTH;
365 if (!artifact_bias && one_in_(3))
366 artifact_bias = BIAS_ROGUE;
369 o_ptr->art_flags1 |= TR1_SEARCH;
370 if (!artifact_bias && one_in_(9))
371 artifact_bias = BIAS_RANGER;
374 o_ptr->art_flags1 |= TR1_INFRA;
377 o_ptr->art_flags1 |= TR1_SPEED;
378 if (!artifact_bias && one_in_(11))
379 artifact_bias = BIAS_ROGUE;
382 o_ptr->art_flags1 |= TR1_TUNNEL;
385 if (o_ptr->tval == TV_BOW) random_plus(o_ptr);
388 o_ptr->art_flags1 |= TR1_BLOWS;
389 if (!artifact_bias && one_in_(11))
390 artifact_bias = BIAS_WARRIOR;
397 static void random_resistance(object_type * o_ptr)
399 switch (artifact_bias)
402 if (!(o_ptr->art_flags2 & TR2_RES_ACID))
404 o_ptr->art_flags2 |= TR2_RES_ACID;
405 if (one_in_(2)) return;
407 if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_ACID))
409 o_ptr->art_flags2 |= TR2_IM_ACID;
410 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_COLD | TR2_IM_FIRE);
411 if (one_in_(2)) return;
416 if (!(o_ptr->art_flags2 & TR2_RES_ELEC))
418 o_ptr->art_flags2 |= TR2_RES_ELEC;
419 if (one_in_(2)) return;
421 if ((o_ptr->tval >= TV_CLOAK) && (o_ptr->tval <= TV_HARD_ARMOR) &&
422 !(o_ptr->art_flags3 & TR3_SH_ELEC))
424 o_ptr->art_flags3 |= TR3_SH_ELEC;
425 if (one_in_(2)) return;
427 if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_ELEC))
429 o_ptr->art_flags2 |= TR2_IM_ELEC;
430 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ACID | TR2_IM_COLD | TR2_IM_FIRE);
431 if (one_in_(2)) return;
436 if (!(o_ptr->art_flags2 & TR2_RES_FIRE))
438 o_ptr->art_flags2 |= TR2_RES_FIRE;
439 if (one_in_(2)) return;
441 if ((o_ptr->tval >= TV_CLOAK) &&
442 (o_ptr->tval <= TV_HARD_ARMOR) &&
443 !(o_ptr->art_flags3 & TR3_SH_FIRE))
445 o_ptr->art_flags3 |= TR3_SH_FIRE;
446 if (one_in_(2)) return;
448 if (one_in_(BIAS_LUCK) &&
449 !(o_ptr->art_flags2 & TR2_IM_FIRE))
451 o_ptr->art_flags2 |= TR2_IM_FIRE;
452 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_COLD | TR2_IM_ACID);
453 if (one_in_(2)) return;
458 if (!(o_ptr->art_flags2 & TR2_RES_COLD))
460 o_ptr->art_flags2 |= TR2_RES_COLD;
461 if (one_in_(2)) return;
463 if ((o_ptr->tval >= TV_CLOAK) &&
464 (o_ptr->tval <= TV_HARD_ARMOR) &&
465 !(o_ptr->art_flags3 & TR3_SH_COLD))
467 o_ptr->art_flags3 |= TR3_SH_COLD;
468 if (one_in_(2)) return;
470 if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_COLD))
472 o_ptr->art_flags2 |= TR2_IM_COLD;
473 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_ACID | TR2_IM_FIRE);
474 if (one_in_(2)) return;
479 if (!(o_ptr->art_flags2 & TR2_RES_POIS))
481 o_ptr->art_flags2 |= TR2_RES_POIS;
482 if (one_in_(2)) return;
487 if (!one_in_(3) && (!(o_ptr->art_flags2 & TR2_RES_FEAR)))
489 o_ptr->art_flags2 |= TR2_RES_FEAR;
490 if (one_in_(2)) return;
492 if (one_in_(3) && (!(o_ptr->art_flags3 & TR3_NO_MAGIC)))
494 o_ptr->art_flags3 |= TR3_NO_MAGIC;
495 if (one_in_(2)) return;
499 case BIAS_NECROMANTIC:
500 if (!(o_ptr->art_flags2 & TR2_RES_NETHER))
502 o_ptr->art_flags2 |= TR2_RES_NETHER;
503 if (one_in_(2)) return;
505 if (!(o_ptr->art_flags2 & TR2_RES_POIS))
507 o_ptr->art_flags2 |= TR2_RES_POIS;
508 if (one_in_(2)) return;
510 if (!(o_ptr->art_flags2 & TR2_RES_DARK))
512 o_ptr->art_flags2 |= TR2_RES_DARK;
513 if (one_in_(2)) return;
518 if (!(o_ptr->art_flags2 & TR2_RES_CHAOS))
520 o_ptr->art_flags2 |= TR2_RES_CHAOS;
521 if (one_in_(2)) return;
523 if (!(o_ptr->art_flags2 & TR2_RES_CONF))
525 o_ptr->art_flags2 |= TR2_RES_CONF;
526 if (one_in_(2)) return;
528 if (!(o_ptr->art_flags2 & TR2_RES_DISEN))
530 o_ptr->art_flags2 |= TR2_RES_DISEN;
531 if (one_in_(2)) return;
536 switch (randint1(42))
539 if (!one_in_(WEIRD_LUCK))
540 random_resistance(o_ptr);
543 o_ptr->art_flags2 |= TR2_IM_ACID;
545 artifact_bias = BIAS_ACID;
549 if (!one_in_(WEIRD_LUCK))
550 random_resistance(o_ptr);
553 o_ptr->art_flags2 |= TR2_IM_ELEC;
555 artifact_bias = BIAS_ELEC;
559 if (!one_in_(WEIRD_LUCK))
560 random_resistance(o_ptr);
563 o_ptr->art_flags2 |= TR2_IM_COLD;
565 artifact_bias = BIAS_COLD;
569 if (!one_in_(WEIRD_LUCK))
570 random_resistance(o_ptr);
573 o_ptr->art_flags2 |= TR2_IM_FIRE;
575 artifact_bias = BIAS_FIRE;
581 o_ptr->art_flags2 |= TR2_RES_ACID;
583 artifact_bias = BIAS_ACID;
588 o_ptr->art_flags2 |= TR2_RES_ELEC;
590 artifact_bias = BIAS_ELEC;
595 o_ptr->art_flags2 |= TR2_RES_FIRE;
597 artifact_bias = BIAS_FIRE;
602 o_ptr->art_flags2 |= TR2_RES_COLD;
604 artifact_bias = BIAS_COLD;
608 o_ptr->art_flags2 |= TR2_RES_POIS;
609 if (!artifact_bias && !one_in_(4))
610 artifact_bias = BIAS_POIS;
611 else if (!artifact_bias && one_in_(2))
612 artifact_bias = BIAS_NECROMANTIC;
613 else if (!artifact_bias && one_in_(2))
614 artifact_bias = BIAS_ROGUE;
618 o_ptr->art_flags2 |= TR2_RES_FEAR;
619 if (!artifact_bias && one_in_(3))
620 artifact_bias = BIAS_WARRIOR;
623 o_ptr->art_flags2 |= TR2_RES_LITE;
626 o_ptr->art_flags2 |= TR2_RES_DARK;
630 o_ptr->art_flags2 |= TR2_RES_BLIND;
634 o_ptr->art_flags2 |= TR2_RES_CONF;
635 if (!artifact_bias && one_in_(6))
636 artifact_bias = BIAS_CHAOS;
640 o_ptr->art_flags2 |= TR2_RES_SOUND;
644 o_ptr->art_flags2 |= TR2_RES_SHARDS;
648 o_ptr->art_flags2 |= TR2_RES_NETHER;
649 if (!artifact_bias && one_in_(3))
650 artifact_bias = BIAS_NECROMANTIC;
654 o_ptr->art_flags2 |= TR2_RES_NEXUS;
658 o_ptr->art_flags2 |= TR2_RES_CHAOS;
659 if (!artifact_bias && one_in_(2))
660 artifact_bias = BIAS_CHAOS;
664 o_ptr->art_flags2 |= TR2_RES_DISEN;
667 if (o_ptr->tval >= TV_CLOAK && o_ptr->tval <= TV_HARD_ARMOR)
668 o_ptr->art_flags3 |= TR3_SH_ELEC;
670 random_resistance(o_ptr);
672 artifact_bias = BIAS_ELEC;
675 if (o_ptr->tval >= TV_CLOAK && o_ptr->tval <= TV_HARD_ARMOR)
676 o_ptr->art_flags3 |= TR3_SH_FIRE;
678 random_resistance(o_ptr);
680 artifact_bias = BIAS_FIRE;
683 if (o_ptr->tval == TV_SHIELD || o_ptr->tval == TV_CLOAK ||
684 o_ptr->tval == TV_HELM || o_ptr->tval == TV_HARD_ARMOR)
685 o_ptr->art_flags2 |= TR2_REFLECT;
687 random_resistance(o_ptr);
690 if (o_ptr->tval >= TV_CLOAK && o_ptr->tval <= TV_HARD_ARMOR)
691 o_ptr->art_flags3 |= TR3_SH_COLD;
693 random_resistance(o_ptr);
695 artifact_bias = BIAS_COLD;
702 static void random_misc(object_type * o_ptr)
704 switch (artifact_bias)
707 if (!(o_ptr->art_flags2 & TR2_SUST_CON))
709 o_ptr->art_flags2 |= TR2_SUST_CON;
710 if (one_in_(2)) return;
715 if (!(o_ptr->art_flags2 & TR2_SUST_STR))
717 o_ptr->art_flags2 |= TR2_SUST_STR;
718 if (one_in_(2)) return;
723 if (!(o_ptr->art_flags2 & TR2_SUST_WIS))
725 o_ptr->art_flags2 |= TR2_SUST_WIS;
726 if (one_in_(2)) return;
731 if (!(o_ptr->art_flags2 & TR2_SUST_INT))
733 o_ptr->art_flags2 |= TR2_SUST_INT;
734 if (one_in_(2)) return;
739 if (!(o_ptr->art_flags2 & TR2_SUST_DEX))
741 o_ptr->art_flags2 |= TR2_SUST_DEX;
742 if (one_in_(2)) return;
747 if (!(o_ptr->art_flags2 & TR2_SUST_CON))
749 o_ptr->art_flags2 |= TR2_SUST_CON;
750 if (one_in_(2)) return;
755 if (!(o_ptr->art_flags2 & TR2_SUST_CHR))
757 o_ptr->art_flags2 |= TR2_SUST_CHR;
758 if (one_in_(2)) return;
763 if (!(o_ptr->art_flags3 & TR3_TELEPORT))
765 o_ptr->art_flags3 |= TR3_TELEPORT;
766 if (one_in_(2)) return;
771 if (!(o_ptr->art_flags3 & TR3_LITE))
773 o_ptr->art_flags3 |= TR3_LITE; /* Freebie */
778 switch (randint1(32))
781 o_ptr->art_flags2 |= TR2_SUST_STR;
783 artifact_bias = BIAS_STR;
786 o_ptr->art_flags2 |= TR2_SUST_INT;
788 artifact_bias = BIAS_INT;
791 o_ptr->art_flags2 |= TR2_SUST_WIS;
793 artifact_bias = BIAS_WIS;
796 o_ptr->art_flags2 |= TR2_SUST_DEX;
798 artifact_bias = BIAS_DEX;
801 o_ptr->art_flags2 |= TR2_SUST_CON;
803 artifact_bias = BIAS_CON;
806 o_ptr->art_flags2 |= TR2_SUST_CHR;
808 artifact_bias = BIAS_CHR;
813 o_ptr->art_flags2 |= TR2_FREE_ACT;
816 o_ptr->art_flags2 |= TR2_HOLD_LIFE;
817 if (!artifact_bias && one_in_(5))
818 artifact_bias = BIAS_PRIESTLY;
819 else if (!artifact_bias && one_in_(6))
820 artifact_bias = BIAS_NECROMANTIC;
824 o_ptr->art_flags3 |= TR3_LITE;
828 o_ptr->art_flags3 |= TR3_FEATHER;
833 o_ptr->art_flags3 |= TR3_SEE_INVIS;
836 if (one_in_(3)) break;
837 o_ptr->art_flags3 |= TR3_TELEPATHY;
838 if (!artifact_bias && one_in_(9))
839 artifact_bias = BIAS_MAGE;
843 o_ptr->art_flags3 |= TR3_SLOW_DIGEST;
847 o_ptr->art_flags3 |= TR3_REGEN;
850 o_ptr->art_flags3 |= TR3_TELEPORT;
855 if (o_ptr->tval >= TV_BOOTS && o_ptr->tval <= TV_DRAG_ARMOR)
859 o_ptr->to_a = 4 + randint1(11);
866 int bonus_h, bonus_d;
867 o_ptr->art_flags3 |= TR3_SHOW_MODS;
868 bonus_h = 4 + (randint1(11));
869 bonus_d = 4 + (randint1(11));
870 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))
875 o_ptr->to_h += bonus_h;
876 o_ptr->to_d += bonus_d;
880 o_ptr->art_flags3 |= TR3_NO_MAGIC;
883 o_ptr->art_flags3 |= TR3_NO_TELE;
886 o_ptr->art_flags3 |= TR3_WARNING;
892 static void random_slay(object_type *o_ptr)
894 if (o_ptr->tval == TV_BOW)
901 o_ptr->art_flags3 |= TR3_XTRA_MIGHT;
902 if (!one_in_(7)) o_ptr->art_flags3 &= ~(TR3_XTRA_SHOTS);
903 if (!artifact_bias && one_in_(9))
904 artifact_bias = BIAS_RANGER;
907 o_ptr->art_flags3 |= TR3_XTRA_SHOTS;
908 if (!one_in_(7)) o_ptr->art_flags3 &= ~(TR3_XTRA_MIGHT);
909 if (!artifact_bias && one_in_(9))
910 artifact_bias = BIAS_RANGER;
917 switch (artifact_bias)
920 if (!(o_ptr->art_flags1 & TR1_CHAOTIC))
922 o_ptr->art_flags1 |= TR1_CHAOTIC;
923 if (one_in_(2)) return;
928 if((o_ptr->tval == TV_SWORD || o_ptr->tval == TV_POLEARM) &&
929 !(o_ptr->art_flags3 & TR3_BLESSED))
931 /* A free power for "priestly" random artifacts */
932 o_ptr->art_flags3 |= TR3_BLESSED;
936 case BIAS_NECROMANTIC:
937 if (!(o_ptr->art_flags1 & TR1_VAMPIRIC))
939 o_ptr->art_flags1 |= TR1_VAMPIRIC;
940 if (one_in_(2)) return;
942 if (!(o_ptr->art_flags1 & TR1_BRAND_POIS) && one_in_(2))
944 o_ptr->art_flags1 |= TR1_BRAND_POIS;
945 if (one_in_(2)) return;
950 if (!(o_ptr->art_flags1 & TR1_SLAY_ANIMAL))
952 o_ptr->art_flags1 |= TR1_SLAY_ANIMAL;
953 if (one_in_(2)) return;
958 if ((((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DAGGER)) ||
959 ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_SPEAR))) &&
960 !(o_ptr->art_flags2 & TR2_THROW))
962 /* Free power for rogues... */
963 o_ptr->art_flags2 |= TR2_THROW;
965 if (!(o_ptr->art_flags1 & TR1_BRAND_POIS))
967 o_ptr->art_flags1 |= TR1_BRAND_POIS;
968 if (one_in_(2)) return;
973 if (!(o_ptr->art_flags1 & TR1_BRAND_POIS))
975 o_ptr->art_flags1 |= TR1_BRAND_POIS;
976 if (one_in_(2)) return;
981 if (!(o_ptr->art_flags1 & TR1_BRAND_FIRE))
983 o_ptr->art_flags1 |= TR1_BRAND_FIRE;
984 if (one_in_(2)) return;
989 if (!(o_ptr->art_flags1 & TR1_BRAND_COLD))
991 o_ptr->art_flags1 |= TR1_BRAND_COLD;
992 if (one_in_(2)) return;
997 if (!(o_ptr->art_flags1 & TR1_BRAND_ELEC))
999 o_ptr->art_flags1 |= TR1_BRAND_ELEC;
1000 if (one_in_(2)) return;
1005 if (!(o_ptr->art_flags1 & TR1_BRAND_ACID))
1007 o_ptr->art_flags1 |= TR1_BRAND_ACID;
1008 if (one_in_(2)) return;
1013 if (!(o_ptr->art_flags1 & TR1_SLAY_EVIL))
1015 o_ptr->art_flags1 |= TR1_SLAY_EVIL;
1016 if (one_in_(2)) return;
1018 if (!(o_ptr->art_flags1 & TR1_SLAY_UNDEAD))
1020 o_ptr->art_flags1 |= TR1_SLAY_UNDEAD;
1021 if (one_in_(2)) return;
1023 if (!(o_ptr->art_flags1 & TR1_SLAY_DEMON))
1025 o_ptr->art_flags1 |= TR1_SLAY_DEMON;
1026 if (one_in_(2)) return;
1031 switch (randint1(36))
1035 o_ptr->art_flags1 |= TR1_SLAY_ANIMAL;
1039 o_ptr->art_flags1 |= TR1_SLAY_EVIL;
1040 if (!artifact_bias && one_in_(2))
1041 artifact_bias = BIAS_LAW;
1042 else if (!artifact_bias && one_in_(9))
1043 artifact_bias = BIAS_PRIESTLY;
1047 o_ptr->art_flags1 |= TR1_SLAY_UNDEAD;
1048 if (!artifact_bias && one_in_(9))
1049 artifact_bias = BIAS_PRIESTLY;
1053 o_ptr->art_flags1 |= TR1_SLAY_DEMON;
1054 if (!artifact_bias && one_in_(9))
1055 artifact_bias = BIAS_PRIESTLY;
1059 o_ptr->art_flags1 |= TR1_SLAY_ORC;
1063 o_ptr->art_flags1 |= TR1_SLAY_TROLL;
1067 o_ptr->art_flags1 |= TR1_SLAY_GIANT;
1071 o_ptr->art_flags1 |= TR1_SLAY_DRAGON;
1074 o_ptr->art_flags1 |= TR1_KILL_DRAGON;
1078 if (o_ptr->tval == TV_SWORD)
1080 o_ptr->art_flags1 |= TR1_VORPAL;
1081 if (!artifact_bias && one_in_(9))
1082 artifact_bias = BIAS_WARRIOR;
1088 o_ptr->art_flags1 |= TR1_IMPACT;
1092 o_ptr->art_flags1 |= TR1_BRAND_FIRE;
1094 artifact_bias = BIAS_FIRE;
1098 o_ptr->art_flags1 |= TR1_BRAND_COLD;
1100 artifact_bias = BIAS_COLD;
1104 o_ptr->art_flags1 |= TR1_BRAND_ELEC;
1106 artifact_bias = BIAS_ELEC;
1110 o_ptr->art_flags1 |= TR1_BRAND_ACID;
1112 artifact_bias = BIAS_ACID;
1116 o_ptr->art_flags1 |= TR1_BRAND_POIS;
1117 if (!artifact_bias && !one_in_(3))
1118 artifact_bias = BIAS_POIS;
1119 else if (!artifact_bias && one_in_(6))
1120 artifact_bias = BIAS_NECROMANTIC;
1121 else if (!artifact_bias)
1122 artifact_bias = BIAS_ROGUE;
1125 o_ptr->art_flags1 |= TR1_VAMPIRIC;
1127 artifact_bias = BIAS_NECROMANTIC;
1130 o_ptr->art_flags1 |= TR1_FORCE_WEAPON;
1132 artifact_bias = (one_in_(2) ? BIAS_MAGE : BIAS_PRIESTLY);
1136 o_ptr->art_flags3 |= TR3_SLAY_HUMAN;
1139 o_ptr->art_flags1 |= TR1_CHAOTIC;
1141 artifact_bias = BIAS_CHAOS;
1147 static void give_activation_power(object_type *o_ptr)
1149 int type = 0, chance = 0;
1151 switch (artifact_bias)
1156 type = ACT_BO_ELEC_1;
1158 else if (!one_in_(5))
1160 type = ACT_BA_ELEC_2;
1164 type = ACT_BA_ELEC_3;
1170 type = ACT_BA_POIS_1;
1177 type = ACT_BO_FIRE_1;
1179 else if (!one_in_(5))
1181 type = ACT_BA_FIRE_1;
1185 type = ACT_BA_FIRE_2;
1193 type = ACT_BO_COLD_1;
1194 else if (!one_in_(3))
1195 type = ACT_BA_COLD_1;
1196 else if (!one_in_(3))
1197 type = ACT_BA_COLD_2;
1199 type = ACT_BA_COLD_3;
1205 type = ACT_SUMMON_DEMON;
1207 type = ACT_CALL_CHAOS;
1214 type = ACT_CHARM_UNDEAD;
1215 else if (one_in_(12))
1216 type = ACT_BANISH_EVIL;
1217 else if (one_in_(11))
1218 type = ACT_DISP_EVIL;
1219 else if (one_in_(10))
1220 type = ACT_PROT_EVIL;
1221 else if (one_in_(9))
1222 type = ACT_CURE_1000;
1223 else if (one_in_(8))
1224 type = ACT_CURE_700;
1225 else if (one_in_(7))
1226 type = ACT_REST_ALL;
1227 else if (one_in_(6))
1228 type = ACT_REST_LIFE;
1233 case BIAS_NECROMANTIC:
1237 else if (one_in_(13))
1238 type = ACT_DISP_GOOD;
1239 else if (one_in_(9))
1240 type = ACT_MASS_GENO;
1241 else if (one_in_(8))
1242 type = ACT_GENOCIDE;
1243 else if (one_in_(13))
1244 type = ACT_SUMMON_UNDEAD;
1245 else if (one_in_(9))
1246 type = ACT_VAMPIRE_2;
1247 else if (one_in_(6))
1248 type = ACT_CHARM_UNDEAD;
1250 type = ACT_VAMPIRE_1;
1256 type = ACT_BANISH_EVIL;
1257 else if (one_in_(4))
1258 type = ACT_DISP_EVIL;
1260 type = ACT_PROT_EVIL;
1267 else if (one_in_(4))
1269 else if (one_in_(3))
1270 type = ACT_DETECT_ALL;
1271 else if (one_in_(8))
1274 type = ACT_ID_PLAIN;
1280 type = ACT_SUMMON_ELEMENTAL;
1281 else if (one_in_(10))
1282 type = ACT_SUMMON_PHANTOM;
1283 else if (one_in_(5))
1284 type = ACT_RUNE_EXPLO;
1300 type = ACT_CHARM_ANIMALS;
1301 else if (one_in_(7))
1302 type = ACT_SUMMON_ANIMAL;
1303 else if (one_in_(6))
1304 type = ACT_CHARM_ANIMAL;
1305 else if (one_in_(4))
1306 type = ACT_RESIST_ALL;
1307 else if (one_in_(3))
1310 type = ACT_CURE_POISON;
1314 while (!type || (randint1(100) >= chance))
1316 type = randint1(255);
1331 case ACT_CURE_POISON:
1345 case ACT_RESIST_ALL:
1346 case ACT_DETECT_ALL:
1368 case ACT_CHARM_ANIMAL:
1371 case ACT_SUMMON_ANIMAL:
1377 case ACT_BANISH_EVIL:
1380 case ACT_CHARM_UNDEAD:
1381 case ACT_CHARM_OTHER:
1382 case ACT_SUMMON_PHANTOM:
1384 case ACT_RUNE_EXPLO:
1387 case ACT_CALL_CHAOS:
1389 case ACT_CHARM_ANIMALS:
1390 case ACT_CHARM_OTHERS:
1391 case ACT_SUMMON_ELEMENTAL:
1399 case ACT_XTRA_SPEED:
1400 case ACT_DETECT_XTRA:
1404 case ACT_SUMMON_UNDEAD:
1405 case ACT_SUMMON_DEMON:
1416 /* A type was chosen... */
1417 o_ptr->xtra2 = type;
1418 o_ptr->art_flags3 |= TR3_ACTIVATE;
1423 static void get_random_name(char *return_name, bool armour, int power)
1425 if (randint1(100) <= TABLE_NAME)
1427 get_table_name(return_name);
1440 filename = "a_cursed_j.txt";
1442 filename = "a_cursed.txt";
1448 filename = "a_low_j.txt";
1450 filename = "a_low.txt";
1456 filename = "a_med_j.txt";
1458 filename = "a_med.txt";
1464 filename = "a_high_j.txt";
1466 filename = "a_high.txt";
1476 filename = "w_cursed_j.txt";
1478 filename = "w_cursed.txt";
1484 filename = "w_low_j.txt";
1486 filename = "w_low.txt";
1492 filename = "w_med_j.txt";
1494 filename = "w_med.txt";
1500 filename = "w_high_j.txt";
1502 filename = "w_high.txt";
1508 (void)get_rnd_line(filename, artifact_bias, return_name);
1510 if(return_name[0]==0)get_table_name(return_name);
1516 bool create_artifact(object_type *o_ptr, bool a_scroll)
1518 char new_name[1024];
1520 int powers = randint1(5) + 1;
1521 int max_type = (o_ptr->tval < TV_BOOTS ? 7 : 5);
1524 bool a_cursed = FALSE;
1525 int warrior_artifact_bias = 0;
1527 /* Reset artifact bias */
1530 /* Nuke enchantments */
1534 o_ptr->art_flags1 |= k_info[o_ptr->k_idx].flags1;
1535 o_ptr->art_flags2 |= k_info[o_ptr->k_idx].flags2;
1536 o_ptr->art_flags3 |= k_info[o_ptr->k_idx].flags3;
1537 if (o_ptr->pval) has_pval = TRUE;
1539 if (a_scroll && one_in_(4))
1541 switch (p_ptr->pclass)
1544 case CLASS_BERSERKER:
1549 artifact_bias = BIAS_WARRIOR;
1552 case CLASS_HIGH_MAGE:
1553 case CLASS_SORCERER:
1554 case CLASS_MAGIC_EATER:
1555 case CLASS_BLUE_MAGE:
1556 artifact_bias = BIAS_MAGE;
1559 artifact_bias = BIAS_PRIESTLY;
1563 artifact_bias = BIAS_ROGUE;
1564 warrior_artifact_bias = 25;
1567 artifact_bias = BIAS_RANGER;
1568 warrior_artifact_bias = 30;
1571 artifact_bias = BIAS_PRIESTLY;
1572 warrior_artifact_bias = 40;
1574 case CLASS_WARRIOR_MAGE:
1575 case CLASS_RED_MAGE:
1576 artifact_bias = BIAS_MAGE;
1577 warrior_artifact_bias = 40;
1579 case CLASS_CHAOS_WARRIOR:
1580 artifact_bias = BIAS_CHAOS;
1581 warrior_artifact_bias = 40;
1584 case CLASS_FORCETRAINER:
1585 artifact_bias = BIAS_PRIESTLY;
1587 case CLASS_MINDCRAFTER:
1589 if (randint1(5) > 2) artifact_bias = BIAS_PRIESTLY;
1592 if (randint1(5) > 2) artifact_bias = BIAS_WARRIOR;
1594 case CLASS_IMITATOR:
1595 if (randint1(2) > 1) artifact_bias = BIAS_RANGER;
1597 case CLASS_BEASTMASTER:
1598 artifact_bias = BIAS_CHR;
1599 warrior_artifact_bias = 50;
1601 case CLASS_MIRROR_MASTER:
1602 if (randint1(4) > 1)
1604 artifact_bias = BIAS_MAGE;
1608 artifact_bias = BIAS_ROGUE;
1614 if (a_scroll && (randint1(100) <= warrior_artifact_bias))
1615 artifact_bias = BIAS_WARRIOR;
1617 strcpy(new_name, "");
1619 if (!a_scroll && one_in_(A_CURSED))
1621 if (((o_ptr->tval == TV_AMULET) || (o_ptr->tval == TV_RING)) && cursed_p(o_ptr))
1624 while (one_in_(powers) || one_in_(7) || one_in_(10))
1627 if (!a_cursed && one_in_(WEIRD_LUCK))
1630 if (a_cursed) powers /= 2;
1635 switch (randint1(max_type))
1642 if (one_in_(2) && (o_ptr->tval < TV_BOOTS) && (o_ptr->tval != TV_BOW))
1644 if (a_cursed && !one_in_(13)) break;
1647 if (one_in_(o_ptr->ds+4)) o_ptr->ds++;
1651 if (one_in_(o_ptr->dd+1)) o_ptr->dd++;
1655 random_resistance(o_ptr);
1664 if (wizard) msg_print("Switch error in create_artifact!");
1672 o_ptr->art_flags3 |= TR3_SHOW_MODS;
1674 /* This one commented out by gw's request... */
1676 o_ptr->art_flags3 |= TR3_HIDE_TYPE;
1679 if (o_ptr->art_flags1 & TR1_BLOWS)
1681 o_ptr->pval = randint1(2);
1682 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA))
1691 while (o_ptr->pval < randint1(5) || one_in_(o_ptr->pval));
1694 if ((o_ptr->pval > 4) && !one_in_(WEIRD_LUCK))
1698 /* give it some plusses... */
1699 if (o_ptr->tval >= TV_BOOTS && o_ptr->tval <= TV_DRAG_ARMOR)
1700 o_ptr->to_a += randint1(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
1701 else if (o_ptr->tval <= TV_SWORD)
1703 o_ptr->to_h += randint1(o_ptr->to_h > 19 ? 1 : 20 - o_ptr->to_h);
1704 o_ptr->to_d += randint1(o_ptr->to_d > 19 ? 1 : 20 - o_ptr->to_d);
1705 if ((o_ptr->art_flags1 & TR1_WIS) && (o_ptr->pval > 0)) o_ptr->art_flags3 |= TR3_BLESSED;
1708 /* Just to be sure */
1709 o_ptr->art_flags3 |= (TR3_IGNORE_ACID | TR3_IGNORE_ELEC |
1710 TR3_IGNORE_FIRE | TR3_IGNORE_COLD);
1712 total_flags = flag_cost(o_ptr, o_ptr->pval);
1713 if (cheat_peek) msg_format("%ld", total_flags);
1715 if (a_cursed) curse_artifact(o_ptr);
1718 (randint1((o_ptr->tval >= TV_BOOTS)
1719 ? ACTIVATION_CHANCE * 2 : ACTIVATION_CHANCE) == 1))
1722 give_activation_power(o_ptr);
1725 if ((o_ptr->tval >= TV_BOOTS) && (o_ptr->tval <= TV_DRAG_ARMOR))
1727 while ((o_ptr->to_d+o_ptr->to_h) > 20)
1729 if (one_in_(o_ptr->to_d) && one_in_(o_ptr->to_h)) break;
1730 o_ptr->to_d -= (s16b)randint0(3);
1731 o_ptr->to_h -= (s16b)randint0(3);
1733 while ((o_ptr->to_d+o_ptr->to_h) > 10)
1735 if (one_in_(o_ptr->to_d) || one_in_(o_ptr->to_h)) break;
1736 o_ptr->to_d -= (s16b)randint0(3);
1737 o_ptr->to_h -= (s16b)randint0(3);
1741 if (((artifact_bias == BIAS_MAGE) || (artifact_bias == BIAS_INT)) && (o_ptr->tval == TV_GLOVES)) o_ptr->art_flags2 |= TR2_FREE_ACT;
1743 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
1747 o_ptr->art_flags1 &= ~(TR1_BLOWS);
1748 o_ptr->art_flags1 &= ~(TR1_FORCE_WEAPON);
1749 o_ptr->art_flags1 &= ~(TR1_SLAY_ANIMAL);
1750 o_ptr->art_flags1 &= ~(TR1_SLAY_EVIL);
1751 o_ptr->art_flags1 &= ~(TR1_SLAY_UNDEAD);
1752 o_ptr->art_flags1 &= ~(TR1_SLAY_DEMON);
1753 o_ptr->art_flags1 &= ~(TR1_SLAY_ORC);
1754 o_ptr->art_flags1 &= ~(TR1_SLAY_TROLL);
1755 o_ptr->art_flags1 &= ~(TR1_SLAY_GIANT);
1756 o_ptr->art_flags1 &= ~(TR1_SLAY_DRAGON);
1757 o_ptr->art_flags1 &= ~(TR1_KILL_DRAGON);
1758 o_ptr->art_flags3 &= ~(TR3_SLAY_HUMAN);
1759 o_ptr->art_flags1 &= ~(TR1_VORPAL);
1760 o_ptr->art_flags1 &= ~(TR1_BRAND_POIS);
1761 o_ptr->art_flags1 &= ~(TR1_BRAND_ACID);
1762 o_ptr->art_flags1 &= ~(TR1_BRAND_ELEC);
1763 o_ptr->art_flags1 &= ~(TR1_BRAND_FIRE);
1764 o_ptr->art_flags1 &= ~(TR1_BRAND_COLD);
1767 if (o_ptr->tval >= TV_BOOTS)
1769 if (a_cursed) power_level = 0;
1770 else if (total_flags < 15000) power_level = 1;
1771 else if (total_flags < 25000) power_level = 2;
1772 else power_level = 3;
1777 if (a_cursed) power_level = 0;
1778 else if (total_flags < 20000) power_level = 1;
1779 else if (total_flags < 35000) power_level = 2;
1780 else power_level = 3;
1785 char dummy_name[80];
1786 /* Identify it fully */
1787 object_aware(o_ptr);
1788 object_known(o_ptr);
1790 /* Mark the item as fully known */
1791 o_ptr->ident |= (IDENT_MENTAL);
1793 strcpy(dummy_name, "");
1794 (void)identify_fully_aux(o_ptr);
1797 if (!(get_string("¤³¤Î¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ò²¿¤È̾ÉÕ¤±¤Þ¤¹¤«¡©", dummy_name, 80)))
1799 if (!(get_string("What do you want to call the artifact? ", dummy_name, 80)))
1803 get_random_name(new_name, (bool)(o_ptr->tval >= TV_BOOTS), power_level);
1808 strcpy(new_name, "¡Ô");
1810 strcpy(new_name, "'");
1813 strcat(new_name, dummy_name);
1815 strcat(new_name, "¡Õ¤È¤¤¤¦Ì¾¤Î");
1817 strcat(new_name, "'");
1822 chg_virtue(V_INDIVIDUALISM, 2);
1823 chg_virtue(V_ENCHANT, 5);
1828 get_random_name(new_name, (bool)(o_ptr->tval >= TV_BOOTS), power_level);
1835 msg_format("±¿¤ÎÊФä¿¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È: %d¡£", artifact_bias);
1837 msg_format("Biased artifact: %d.", artifact_bias);
1842 msg_print("¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ë±¿¤ÎÊФê¤Ê¤·¡£");
1844 msg_print("No bias in artifact.");
1849 /* Save the inscription */
1850 o_ptr->art_name = quark_add(new_name);
1853 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1859 bool activate_random_artifact(object_type * o_ptr)
1861 int plev = p_ptr->lev;
1862 int k, dir, dummy = 0;
1864 if (!o_ptr->art_name) return FALSE; /* oops? */
1866 /* Activate for attack */
1867 switch (o_ptr->xtra2)
1871 if (!get_aim_dir(&dir)) return FALSE;
1873 msg_print("ÂÀÍÛ¸÷Àþ¤¬Êü¤¿¤ì¤¿¡£");
1875 msg_print("A line of sunlight appears.");
1878 (void)lite_line(dir);
1879 o_ptr->timeout = 10;
1886 msg_print("¤½¤ì¤ÏâÁ¤·¤¤¤¯¤é¤¤¤ËÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
1888 msg_print("It glows extremely brightly...");
1891 if (!get_aim_dir(&dir)) return FALSE;
1892 fire_bolt(GF_MISSILE, dir, damroll(2, 6));
1900 msg_print("¤½¤ì¤ÏÇ»Î理Ë̮ư¤·¤Æ¤¤¤ë...");
1902 msg_print("It throbs deep green...");
1905 if (!get_aim_dir(&dir)) return FALSE;
1906 fire_ball(GF_POIS, dir, 12, 3);
1907 o_ptr->timeout = randint0(4) + 4;
1914 msg_print("¤½¤ì¤Ï²Ð²Ö¤Ëʤ¤ï¤ì¤¿...");
1916 msg_print("It is covered in sparks...");
1919 if (!get_aim_dir(&dir)) return FALSE;
1920 fire_bolt(GF_ELEC, dir, damroll(4, 8));
1921 o_ptr->timeout = randint0(5) + 5;
1928 msg_print("¤½¤ì¤Ï»À¤Ëʤ¤ï¤ì¤¿...");
1930 msg_print("It is covered in acid...");
1933 if (!get_aim_dir(&dir)) return FALSE;
1934 fire_bolt(GF_ACID, dir, damroll(5, 8));
1935 o_ptr->timeout = randint0(6) + 6;
1942 msg_print("¤½¤ì¤ÏÁú¤Ëʤ¤ï¤ì¤¿...");
1944 msg_print("It is covered in frost...");
1947 if (!get_aim_dir(&dir)) return FALSE;
1948 fire_bolt(GF_COLD, dir, damroll(6, 8));
1949 o_ptr->timeout = randint0(7) + 7;
1956 msg_print("¤½¤ì¤Ï±ê¤Ëʤ¤ï¤ì¤¿...");
1958 msg_print("It is covered in fire...");
1961 if (!get_aim_dir(&dir)) return FALSE;
1962 fire_bolt(GF_FIRE, dir, damroll(9, 8));
1963 o_ptr->timeout = randint0(8) + 8;
1970 msg_print("¤½¤ì¤ÏÁú¤Ëʤ¤ï¤ì¤¿...");
1972 msg_print("It is covered in frost...");
1975 if (!get_aim_dir(&dir)) return FALSE;
1976 fire_ball(GF_COLD, dir, 48, 2);
1977 o_ptr->timeout = 400;
1984 msg_print("¤½¤ì¤ÏÀÖ¤¯·ã¤·¤¯µ±¤¤¤¿...");
1986 msg_print("It glows an intense red...");
1989 if (!get_aim_dir(&dir)) return FALSE;
1990 fire_ball(GF_FIRE, dir, 72, 2);
1991 o_ptr->timeout = 400;
1998 msg_print("¤½¤ì¤Ï¹õ¤¯µ±¤¤¤¿...");
2000 msg_print("It glows black...");
2003 if (!get_aim_dir(&dir)) return FALSE;
2004 if (drain_life(dir, 100))
2005 o_ptr->timeout = randint0(100) + 100;
2012 msg_print("¤½¤ì¤ÏÀĤ¯·ã¤·¤¯µ±¤¤¤¿...");
2014 msg_print("It glows an intense blue...");
2017 if (!get_aim_dir(&dir)) return FALSE;
2018 fire_ball(GF_COLD, dir, 100, 2);
2019 o_ptr->timeout = 300;
2026 msg_print("Åŵ¤¤¬¥Ñ¥Á¥Ñ¥Á²»¤òΩ¤Æ¤¿...");
2028 msg_print("It crackles with electricity...");
2031 if (!get_aim_dir(&dir)) return FALSE;
2032 fire_ball(GF_ELEC, dir, 100, 3);
2033 o_ptr->timeout = 500;
2040 msg_print("¹õ¤¯µ±¤¤¤Æ¤¤¤ë...");
2042 msg_print("It glows black...");
2045 if (!get_aim_dir(&dir)) return FALSE;
2046 drain_life(dir, 120);
2047 o_ptr->timeout = 400;
2053 if (!get_aim_dir(&dir)) return FALSE;
2054 for (dummy = 0; dummy < 3; dummy++)
2056 if (drain_life(dir, 50))
2059 o_ptr->timeout = 400;
2066 msg_print("ËâË¡¤Î¥È¥²¤¬¸½¤ì¤¿...");
2068 msg_print("It grows magical spikes...");
2071 if (!get_aim_dir(&dir)) return FALSE;
2072 fire_bolt(GF_ARROW, dir, 150);
2073 o_ptr->timeout = randint0(90) + 90;
2080 msg_print("¿¼ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2082 msg_print("It glows deep red...");
2085 if (!get_aim_dir(&dir)) return FALSE;
2086 fire_ball(GF_FIRE, dir, 120, 3);
2087 o_ptr->timeout = randint0(225) + 225;
2094 msg_print("ÌÀ¤ë¤¯Çò¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2096 msg_print("It glows bright white...");
2099 if (!get_aim_dir(&dir)) return FALSE;
2100 fire_ball(GF_COLD, dir, 200, 3);
2101 o_ptr->timeout = randint0(325) + 325;
2108 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2110 msg_print("It glows deep blue...");
2113 if (!get_aim_dir(&dir)) return FALSE;
2114 fire_ball(GF_ELEC, dir, 250, 3);
2115 o_ptr->timeout = randint0(425) + 425;
2124 monster_type *m_ptr;
2126 for (dir = 0; dir <= 9; dir++)
2130 c_ptr = &cave[y][x];
2132 /* Get the monster */
2133 m_ptr = &m_list[c_ptr->m_idx];
2135 /* Hack -- attack monsters */
2136 if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
2140 o_ptr->timeout = 250;
2146 if (!get_aim_dir(&dir)) return FALSE;
2147 for (dummy = 0; dummy < 3; dummy++)
2149 if (drain_life(dir, 100))
2153 o_ptr->timeout = 400;
2158 case ACT_CALL_CHAOS:
2161 msg_print("ÍÍ¡¹¤Ê¿§¤Î²Ð²Ö¤òȯ¤·¤Æ¤¤¤ë...");
2163 msg_print("It glows in scintillating colours...");
2167 o_ptr->timeout = 350;
2173 if (!get_aim_dir(&dir)) return FALSE;
2175 msg_print("¥í¥±¥Ã¥È¤òȯ¼Í¤·¤¿¡ª");
2177 msg_print("You launch a rocket!");
2180 fire_ball(GF_ROCKET, dir, 250 + plev*3, 2);
2181 o_ptr->timeout = 400;
2188 msg_print("¿ÀÀ»¤ÊÊ·°Ïµ¤¤¬½¼Ëþ¤·¤¿...");
2190 msg_print("It floods the area with goodness...");
2193 dispel_evil(p_ptr->lev * 5);
2194 o_ptr->timeout = randint0(300) + 300;
2201 msg_print("¼Ù°¤ÊÊ·°Ïµ¤¤¬½¼Ëþ¤·¤¿...");
2203 msg_print("It floods the area with evil...");
2206 dispel_good(p_ptr->lev * 5);
2207 o_ptr->timeout = randint0(300) + 300;
2213 if (!get_aim_dir(&dir)) return FALSE;
2215 msg_print("¤¢¤Ê¤¿¤Ï¥¨¥ì¥á¥ó¥È¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
2217 msg_print("You breathe the elements.");
2220 fire_ball(GF_MISSILE, dir, 300, 4);
2221 o_ptr->timeout = 500;
2225 /* Activate for other offensive action */
2230 msg_print("ÍÍ¡¹¤Ê¿§¤Î²Ð²Ö¤òȯ¤·¤Æ¤¤¤ë...");
2232 msg_print("It glows in scintillating colours...");
2235 if (!get_aim_dir(&dir)) return FALSE;
2236 confuse_monster(dir, 20);
2237 o_ptr->timeout = 15;
2244 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2246 msg_print("It glows deep blue...");
2249 sleep_monsters_touch();
2250 o_ptr->timeout = 55;
2256 earthquake(py, px, 10);
2257 o_ptr->timeout = 50;
2263 turn_monsters(40 + p_ptr->lev);
2264 o_ptr->timeout = 3 * (p_ptr->lev + 10);
2270 if (!get_aim_dir(&dir)) return FALSE;
2271 (void)fire_beam(GF_AWAY_ALL, dir, plev);
2272 o_ptr->timeout = 200;
2276 case ACT_BANISH_EVIL:
2278 if (banish_evil(100))
2281 msg_print("¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ÎÎϤ¬¼Ù°¤òÂǤÁÅݤ·¤¿¡ª");
2283 msg_print("The power of the artifact banishes evil!");
2287 o_ptr->timeout = 250 + randint1(250);
2294 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2296 msg_print("It glows deep blue...");
2299 (void)symbol_genocide(200, TRUE);
2300 o_ptr->timeout = 500;
2307 msg_print("¤Ò¤É¤¯±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...");
2309 msg_print("It lets out a long, shrill note...");
2312 (void)mass_genocide(200, TRUE);
2313 o_ptr->timeout = 1000;
2317 /* Activate for summoning / charming */
2319 case ACT_CHARM_ANIMAL:
2321 if (!get_aim_dir(&dir)) return FALSE;
2322 (void)charm_animal(dir, plev);
2323 o_ptr->timeout = 300;
2327 case ACT_CHARM_UNDEAD:
2329 if (!get_aim_dir(&dir)) return FALSE;
2330 (void)control_one_undead(dir, plev);
2331 o_ptr->timeout = 333;
2335 case ACT_CHARM_OTHER:
2337 if (!get_aim_dir(&dir)) return FALSE;
2338 (void)charm_monster(dir, plev);
2339 o_ptr->timeout = 400;
2343 case ACT_CHARM_ANIMALS:
2345 (void)charm_animals(plev * 2);
2346 o_ptr->timeout = 500;
2350 case ACT_CHARM_OTHERS:
2352 charm_monsters(plev * 2);
2353 o_ptr->timeout = 750;
2357 case ACT_SUMMON_ANIMAL:
2359 (void)summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
2360 o_ptr->timeout = 200 + randint1(300);
2364 case ACT_SUMMON_PHANTOM:
2367 msg_print("¸¸Îî¤ò¾¤´¤·¤¿¡£");
2369 msg_print("You summon a phantasmal servant.");
2372 (void)summon_specific(-1, py, px, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
2373 o_ptr->timeout = 200 + randint1(200);
2377 case ACT_SUMMON_ELEMENTAL:
2379 bool pet = one_in_(3);
2382 if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
2383 if (pet) mode |= PM_FORCE_PET;
2384 else mode |= PM_NO_PET;
2386 if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode))
2389 msg_print("¥¨¥ì¥á¥ó¥¿¥ë¤¬¸½¤ì¤¿...");
2391 msg_print("An elemental materializes...");
2397 msg_print("¤¢¤Ê¤¿¤ËÉþ½¾¤·¤Æ¤¤¤ë¤è¤¦¤À¡£");
2399 msg_print("It seems obedient to you.");
2404 msg_print("¤½¤ì¤ò¥³¥ó¥È¥í¡¼¥ë¤Ç¤¤Ê¤«¤Ã¤¿¡ª");
2406 msg_print("You fail to control it!");
2411 o_ptr->timeout = 750;
2415 case ACT_SUMMON_DEMON:
2417 bool pet = one_in_(3);
2420 if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
2421 if (pet) mode |= PM_FORCE_PET;
2422 else mode |= PM_NO_PET;
2424 if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_DEMON, mode))
2427 msg_print("ⲫ¤Î°½¤¬½¼Ëþ¤·¤¿¡£");
2429 msg_print("The area fills with a stench of sulphur and brimstone.");
2434 msg_print("¡Ö¤´ÍѤǤ´¤¶¤¤¤Þ¤¹¤«¡¢¤´¼ç¿ÍÍÍ¡×");
2436 msg_print("'What is thy bidding... Master?'");
2441 msg_print("¡ÖNON SERVIAM! Wretch! ¤ªÁ°¤Îº²¤òĺ¤¯¤¾¡ª¡×");
2443 msg_print("'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'");
2448 o_ptr->timeout = 666 + randint1(333);
2452 case ACT_SUMMON_UNDEAD:
2454 bool pet = one_in_(3);
2458 type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
2460 if (!pet || ((plev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
2461 if (pet) mode |= PM_FORCE_PET;
2462 else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
2464 if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), type, mode))
2467 msg_print("Î䤿¤¤É÷¤¬¤¢¤Ê¤¿¤Î¼þ¤ê¤Ë¿á¤»Ï¤á¤¿¡£¤½¤ì¤ÏÉåÇÔ½¤ò±¿¤ó¤Ç¤¤¤ë...");
2469 msg_print("Cold winds begin to blow around you, carrying with them the stench of decay...");
2474 msg_print("¸Å¤¨¤Î»à¤»¤ë¼Ô¶¦¤¬¤¢¤Ê¤¿¤Ë»Å¤¨¤ë¤¿¤áÅÚ¤«¤éᴤä¿¡ª");
2476 msg_print("Ancient, long-dead forms arise from the ground to serve you!");
2481 msg_print("»à¼Ô¤¬á´¤Ã¤¿¡£Ì²¤ê¤ò˸¤²¤ë¤¢¤Ê¤¿¤òȳ¤¹¤ë¤¿¤á¤Ë¡ª");
2483 msg_print("'The dead arise... to punish you for disturbing them!'");
2488 o_ptr->timeout = 666 + randint1(333);
2492 /* Activate for healing */
2496 (void)set_afraid(0);
2497 (void)hp_player(30);
2498 o_ptr->timeout = 10;
2505 msg_print("¿¼»ç¿§¤Î¸÷¤òȯ¤·¤Æ¤¤¤ë...");
2507 msg_print("It radiates deep purple...");
2510 hp_player(damroll(4, 8));
2511 (void)set_cut((p_ptr->cut / 2) - 50);
2512 o_ptr->timeout = randint0(3) + 3;
2516 case ACT_CURE_POISON:
2519 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2521 msg_print("It glows deep blue...");
2524 (void)set_afraid(0);
2525 (void)set_poisoned(0);
2533 msg_print("¿¼¹È¤Ëµ±¤¤¤Æ¤¤¤ë...");
2535 msg_print("It glows a deep red...");
2539 o_ptr->timeout = 450;
2546 msg_print("Ç»Îп§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2548 msg_print("It glows a deep green...");
2551 (void)do_res_stat(A_STR);
2552 (void)do_res_stat(A_INT);
2553 (void)do_res_stat(A_WIS);
2554 (void)do_res_stat(A_DEX);
2555 (void)do_res_stat(A_CON);
2556 (void)do_res_stat(A_CHR);
2557 (void)restore_level();
2558 o_ptr->timeout = 750;
2565 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2567 msg_print("It glows deep blue...");
2571 msg_print("ÂÎÆâ¤ËÃȤ«¤¤¸ÝÆ°¤¬´¶¤¸¤é¤ì¤ë...");
2573 msg_print("You feel a warm tingling inside...");
2576 (void)hp_player(700);
2578 o_ptr->timeout = 250;
2585 msg_print("Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2587 msg_print("It glows a bright white...");
2591 msg_print("¤Ò¤¸¤ç¤¦¤Ëµ¤Ê¬¤¬¤è¤¤...");
2593 msg_print("You feel much better...");
2596 (void)hp_player(1000);
2598 o_ptr->timeout = 888;
2602 /* Activate for timed effect */
2606 (void)set_tim_esp(randint1(30) + 25, FALSE);
2607 o_ptr->timeout = 200;
2613 (void)set_hero(randint1(50) + 50, FALSE);
2614 (void)set_blessed(randint1(50) + 50, FALSE);
2615 o_ptr->timeout = 100 + randint1(100);
2622 msg_print("±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...");
2624 msg_print("It lets out a shrill wail...");
2628 (void)set_protevil(randint1(25) + k, FALSE);
2629 o_ptr->timeout = randint0(225) + 225;
2633 case ACT_RESIST_ALL:
2636 msg_print("ÍÍ¡¹¤Ê¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2638 msg_print("It glows many colours...");
2641 (void)set_oppose_acid(randint1(40) + 40, FALSE);
2642 (void)set_oppose_elec(randint1(40) + 40, FALSE);
2643 (void)set_oppose_fire(randint1(40) + 40, FALSE);
2644 (void)set_oppose_cold(randint1(40) + 40, FALSE);
2645 (void)set_oppose_pois(randint1(40) + 40, FALSE);
2646 o_ptr->timeout = 200;
2653 msg_print("ÌÀ¤ë¤¯Îп§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2655 msg_print("It glows bright green...");
2658 (void)set_fast(randint1(20) + 20, FALSE);
2659 o_ptr->timeout = 250;
2663 case ACT_XTRA_SPEED:
2666 msg_print("ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2668 msg_print("It glows brightly...");
2671 (void)set_fast(randint1(75) + 75, FALSE);
2672 o_ptr->timeout = randint0(200) + 200;
2678 set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
2679 o_ptr->timeout = 1000;
2685 (void)set_invuln(randint1(8) + 8, FALSE);
2686 o_ptr->timeout = 1000;
2690 /* Activate for general purpose effect (detection etc.) */
2695 msg_print("À¡¤ó¤À¸÷¤¬¤¢¤Õ¤ì½Ð¤¿...");
2697 msg_print("It wells with clear light...");
2700 lite_area(damroll(2, 15), 3);
2701 o_ptr->timeout = randint0(10) + 10;
2708 msg_print("âÁ¤·¤¯µ±¤¤¤¿...");
2710 msg_print("It shines brightly...");
2713 map_area(DETECT_RAD_MAP);
2714 lite_area(damroll(2, 15), 3);
2715 o_ptr->timeout = randint0(50) + 50;
2719 case ACT_DETECT_ALL:
2722 msg_print("Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2724 msg_print("It glows bright white...");
2728 msg_print("¿´¤Ë¥¤¥á¡¼¥¸¤¬É⤫¤ó¤Ç¤¤¿...");
2730 msg_print("An image forms in your mind...");
2733 detect_all(DETECT_RAD_DEFAULT);
2734 o_ptr->timeout = randint0(55) + 55;
2738 case ACT_DETECT_XTRA:
2741 msg_print("ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2743 msg_print("It glows brightly...");
2746 detect_all(DETECT_RAD_DEFAULT);
2748 identify_fully(FALSE, FALSE);
2749 o_ptr->timeout = 1000;
2756 msg_print("²«¿§¤¯µ±¤¤¤Æ¤¤¤ë...");
2758 msg_print("It glows yellow...");
2761 identify_fully(FALSE, FALSE);
2762 o_ptr->timeout = 750;
2768 if (!ident_spell(FALSE, FALSE)) return FALSE;
2769 o_ptr->timeout = 10;
2773 case ACT_RUNE_EXPLO:
2776 msg_print("ÌÀ¤ë¤¤ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2778 msg_print("It glows bright red...");
2782 o_ptr->timeout = 200;
2789 msg_print("¥Ö¥ë¡¼¤ËÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2791 msg_print("It glows light blue...");
2795 o_ptr->timeout = 400;
2801 (void)set_food(PY_FOOD_MAX - 1);
2802 o_ptr->timeout = 200;
2809 msg_print("ÌÀ¤ë¤¤ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2811 msg_print("It glows bright red...");
2814 destroy_doors_touch();
2815 o_ptr->timeout = 10;
2822 msg_print("¸ÝÆ°¤·¤Æ¤¤¤ë...");
2824 msg_print("It pulsates...");
2827 if (!get_aim_dir(&dir)) return FALSE;
2836 o_ptr->timeout = 70;
2843 msg_print("ÌÀ¤ë¤¤²«¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2845 msg_print("It glows bright yellow...");
2849 o_ptr->timeout = 500;
2856 msg_print("¼¡¸µ¤ÎÈ⤬³«¤¤¤¿¡£ÌÜŪÃϤòÁª¤ó¤Ç²¼¤µ¤¤¡£");
2858 msg_print("You open a dimensional gate. Choose a destination.");
2861 if (!dimension_door()) return FALSE;
2862 o_ptr->timeout = 100;
2870 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ë...");
2872 msg_print("It twists space around you...");
2875 teleport_player(100);
2876 o_ptr->timeout = 45;
2883 msg_print("¤ä¤ï¤é¤«¤ÊÇò¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2885 msg_print("It glows soft white...");
2887 if (!word_of_recall()) return FALSE;
2888 o_ptr->timeout = 200;
2895 msg_format("Unknown activation effect: %d.", o_ptr->xtra2);
2897 msg_format("Unknown activation effect: %d.", o_ptr->xtra2);
2908 void random_artifact_resistance(object_type * o_ptr, artifact_type *a_ptr)
2910 bool give_resistance = FALSE, give_power = FALSE;
2912 if (o_ptr->name1 == ART_TERROR) /* Terror Mask is for warriors... */
2914 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_ARCHER || p_ptr->pclass == CLASS_CAVALRY || p_ptr->pclass == CLASS_BERSERKER)
2917 give_resistance = TRUE;
2921 o_ptr->art_flags3 |=
2922 (TR3_AGGRAVATE | TR3_TY_CURSE);
2923 o_ptr->curse_flags |=
2924 (TRC_CURSED | TRC_HEAVY_CURSE);
2925 o_ptr->curse_flags |= get_curse(2, o_ptr);
2929 if (o_ptr->name1 == ART_MURAMASA)
2931 if (p_ptr->pclass != CLASS_SAMURAI)
2933 o_ptr->art_flags3 |= (TR3_NO_MAGIC);
2934 o_ptr->curse_flags |= (TRC_HEAVY_CURSE);
2938 if (o_ptr->name1 == ART_XIAOLONG)
2940 if (p_ptr->pclass == CLASS_MONK)
2941 o_ptr->art_flags1 |= TR1_BLOWS;
2944 if (o_ptr->name1 == ART_BLOOD)
2947 dummy = randint1(2)+randint1(2);
2948 for (i = 0; i < dummy; i++)
2950 int flag = randint0(19);
2951 if (flag == 18) o_ptr->art_flags3 |= TR3_SLAY_HUMAN;
2952 else o_ptr->art_flags1 |= (TR1_CHAOTIC << flag);
2954 dummy = randint1(2);
2955 for (i = 0; i < dummy; i++)
2956 one_resistance(o_ptr);
2958 for (i = 0; i < dummy; i++)
2960 int tmp = randint0(11);
2961 if (tmp < 6) o_ptr->art_flags1 |= (TR1_STR << tmp);
2962 else o_ptr->art_flags1 |= (TR1_STEALTH << (tmp - 6));
2966 if (a_ptr->gen_flags & (TRG_XTRA_POWER)) give_power = TRUE;
2967 if (a_ptr->gen_flags & (TRG_XTRA_H_RES)) give_resistance = TRUE;
2968 if (a_ptr->gen_flags & (TRG_XTRA_RES_OR_POWER))
2970 /* Give a resistance OR a power */
2971 if (one_in_(2)) give_resistance = TRUE;
2972 else give_power = TRUE;
2980 if (give_resistance)
2982 one_high_resistance(o_ptr);
2988 * Create the artifact of the specified number
2990 void create_named_art(int a_idx, int y, int x)
2996 artifact_type *a_ptr = &a_info[a_idx];
2998 /* Get local object */
3001 /* Ignore "empty" artifacts */
3002 if (!a_ptr->name) return;
3004 /* Acquire the "kind" index */
3005 i = lookup_kind(a_ptr->tval, a_ptr->sval);
3010 /* Create the artifact */
3011 object_prep(q_ptr, i);
3014 q_ptr->name1 = a_idx;
3016 /* Extract the fields */
3017 q_ptr->pval = a_ptr->pval;
3018 q_ptr->ac = a_ptr->ac;
3019 q_ptr->dd = a_ptr->dd;
3020 q_ptr->ds = a_ptr->ds;
3021 q_ptr->to_a = a_ptr->to_a;
3022 q_ptr->to_h = a_ptr->to_h;
3023 q_ptr->to_d = a_ptr->to_d;
3024 q_ptr->weight = a_ptr->weight;
3026 /* Hack -- extract the "cursed" flag */
3027 if (a_ptr->gen_flags & TRG_CURSED) q_ptr->curse_flags |= (TRC_CURSED);
3028 if (a_ptr->gen_flags & TRG_HEAVY_CURSE) q_ptr->curse_flags |= (TRC_HEAVY_CURSE);
3029 if (a_ptr->gen_flags & TRG_PERMA_CURSE) q_ptr->curse_flags |= (TRC_PERMA_CURSE);
3030 if (a_ptr->gen_flags & (TRG_RANDOM_CURSE0)) q_ptr->curse_flags |= get_curse(0, q_ptr);
3031 if (a_ptr->gen_flags & (TRG_RANDOM_CURSE1)) q_ptr->curse_flags |= get_curse(1, q_ptr);
3032 if (a_ptr->gen_flags & (TRG_RANDOM_CURSE2)) q_ptr->curse_flags |= get_curse(2, q_ptr);
3034 random_artifact_resistance(q_ptr, a_ptr);
3036 /* Drop the artifact from heaven */
3037 (void)drop_near(q_ptr, -1, y, x);