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_loadly_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->art_flags3 |= (TR3_HEAVY_CURSE | TR3_CURSED);
170 if (one_in_(4)) o_ptr->art_flags3 |= TR3_PERMA_CURSE;
171 if (one_in_(3)) o_ptr->art_flags3 |= TR3_TY_CURSE;
172 if (one_in_(2)) o_ptr->art_flags3 |= TR3_AGGRAVATE;
173 if (one_in_(3)) o_ptr->art_flags3 |= TR3_DRAIN_EXP;
174 if (one_in_(2)) o_ptr->art_flags3 |= TR3_TELEPORT;
175 else if (one_in_(3)) o_ptr->art_flags3 |= TR3_NO_TELE;
177 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))
178 o_ptr->art_flags3 |= TR3_NO_MAGIC;
180 o_ptr->ident |= IDENT_CURSED;
184 static void random_plus(object_type * o_ptr)
186 int this_type = (o_ptr->tval < TV_BOOTS ? 23 : 19);
188 switch (artifact_bias)
191 if (!(o_ptr->art_flags1 & TR1_STR))
193 o_ptr->art_flags1 |= TR1_STR;
194 if (one_in_(2)) return;
197 if (!(o_ptr->art_flags1 & TR1_CON))
199 o_ptr->art_flags1 |= TR1_CON;
200 if (one_in_(2)) return;
203 if (!(o_ptr->art_flags1 & TR1_DEX))
205 o_ptr->art_flags1 |= TR1_DEX;
206 if (one_in_(2)) return;
211 if (!(o_ptr->art_flags1 & TR1_INT))
213 o_ptr->art_flags1 |= TR1_INT;
214 if (one_in_(2)) return;
216 if ((o_ptr->tval == TV_GLOVES) && !(o_ptr->art_flags1 & TR1_MAGIC_MASTERY))
218 o_ptr->art_flags1 |= TR1_MAGIC_MASTERY;
219 if (one_in_(2)) return;
224 if (!(o_ptr->art_flags1 & TR1_WIS))
226 o_ptr->art_flags1 |= TR1_WIS;
227 if (one_in_(2)) return;
232 if (!(o_ptr->art_flags1 & TR1_DEX))
234 o_ptr->art_flags1 |= TR1_DEX;
235 if (one_in_(2)) return;
238 if (!(o_ptr->art_flags1 & TR1_CON))
240 o_ptr->art_flags1 |= TR1_CON;
241 if (one_in_(2)) return;
244 if (!(o_ptr->art_flags1 & TR1_STR))
246 o_ptr->art_flags1 |= TR1_STR;
247 if (one_in_(2)) return;
252 if (!(o_ptr->art_flags1 & TR1_STEALTH))
254 o_ptr->art_flags1 |= TR1_STEALTH;
255 if (one_in_(2)) return;
257 if (!(o_ptr->art_flags1 & TR1_SEARCH))
259 o_ptr->art_flags1 |= TR1_SEARCH;
260 if (one_in_(2)) return;
265 if (!(o_ptr->art_flags1 & TR1_STR))
267 o_ptr->art_flags1 |= TR1_STR;
268 if (one_in_(2)) return;
273 if (!(o_ptr->art_flags1 & TR1_WIS))
275 o_ptr->art_flags1 |= TR1_WIS;
276 if (one_in_(2)) return;
281 if (!(o_ptr->art_flags1 & TR1_INT))
283 o_ptr->art_flags1 |= TR1_INT;
284 if (one_in_(2)) return;
289 if (!(o_ptr->art_flags1 & TR1_DEX))
291 o_ptr->art_flags1 |= TR1_DEX;
292 if (one_in_(2)) return;
297 if (!(o_ptr->art_flags1 & TR1_CON))
299 o_ptr->art_flags1 |= TR1_CON;
300 if (one_in_(2)) return;
305 if (!(o_ptr->art_flags1 & TR1_CHR))
307 o_ptr->art_flags1 |= TR1_CHR;
308 if (one_in_(2)) return;
313 if ((artifact_bias == BIAS_MAGE || artifact_bias == BIAS_PRIESTLY) && (o_ptr->tval == TV_SOFT_ARMOR) && (o_ptr->sval == SV_ROBE))
315 if (!(o_ptr->art_flags3 & TR3_DEC_MANA) && one_in_(3))
317 o_ptr->art_flags3 |= TR3_DEC_MANA;
318 if (one_in_(2)) return;
322 switch (randint1(this_type))
325 o_ptr->art_flags1 |= TR1_STR;
326 if (!artifact_bias && !one_in_(13))
327 artifact_bias = BIAS_STR;
328 else if (!artifact_bias && one_in_(7))
329 artifact_bias = BIAS_WARRIOR;
332 o_ptr->art_flags1 |= TR1_INT;
333 if (!artifact_bias && !one_in_(13))
334 artifact_bias = BIAS_INT;
335 else if (!artifact_bias && one_in_(7))
336 artifact_bias = BIAS_MAGE;
339 o_ptr->art_flags1 |= TR1_WIS;
340 if (!artifact_bias && !one_in_(13))
341 artifact_bias = BIAS_WIS;
342 else if (!artifact_bias && one_in_(7))
343 artifact_bias = BIAS_PRIESTLY;
346 o_ptr->art_flags1 |= TR1_DEX;
347 if (!artifact_bias && !one_in_(13))
348 artifact_bias = BIAS_DEX;
349 else if (!artifact_bias && one_in_(7))
350 artifact_bias = BIAS_ROGUE;
353 o_ptr->art_flags1 |= TR1_CON;
354 if (!artifact_bias && !one_in_(13))
355 artifact_bias = BIAS_CON;
356 else if (!artifact_bias && one_in_(9))
357 artifact_bias = BIAS_RANGER;
360 o_ptr->art_flags1 |= TR1_CHR;
361 if (!artifact_bias && !one_in_(13))
362 artifact_bias = BIAS_CHR;
365 o_ptr->art_flags1 |= TR1_STEALTH;
366 if (!artifact_bias && one_in_(3))
367 artifact_bias = BIAS_ROGUE;
370 o_ptr->art_flags1 |= TR1_SEARCH;
371 if (!artifact_bias && one_in_(9))
372 artifact_bias = BIAS_RANGER;
375 o_ptr->art_flags1 |= TR1_INFRA;
378 o_ptr->art_flags1 |= TR1_SPEED;
379 if (!artifact_bias && one_in_(11))
380 artifact_bias = BIAS_ROGUE;
383 o_ptr->art_flags1 |= TR1_TUNNEL;
386 if (o_ptr->tval == TV_BOW) random_plus(o_ptr);
389 o_ptr->art_flags1 |= TR1_BLOWS;
390 if (!artifact_bias && one_in_(11))
391 artifact_bias = BIAS_WARRIOR;
398 static void random_resistance(object_type * o_ptr)
400 switch (artifact_bias)
403 if (!(o_ptr->art_flags2 & TR2_RES_ACID))
405 o_ptr->art_flags2 |= TR2_RES_ACID;
406 if (one_in_(2)) return;
408 if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_ACID))
410 o_ptr->art_flags2 |= TR2_IM_ACID;
411 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_COLD | TR2_IM_FIRE);
412 if (one_in_(2)) return;
417 if (!(o_ptr->art_flags2 & TR2_RES_ELEC))
419 o_ptr->art_flags2 |= TR2_RES_ELEC;
420 if (one_in_(2)) return;
422 if ((o_ptr->tval >= TV_CLOAK) && (o_ptr->tval <= TV_HARD_ARMOR) &&
423 !(o_ptr->art_flags3 & TR3_SH_ELEC))
425 o_ptr->art_flags3 |= TR3_SH_ELEC;
426 if (one_in_(2)) return;
428 if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_ELEC))
430 o_ptr->art_flags2 |= TR2_IM_ELEC;
431 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ACID | TR2_IM_COLD | TR2_IM_FIRE);
432 if (one_in_(2)) return;
437 if (!(o_ptr->art_flags2 & TR2_RES_FIRE))
439 o_ptr->art_flags2 |= TR2_RES_FIRE;
440 if (one_in_(2)) return;
442 if ((o_ptr->tval >= TV_CLOAK) &&
443 (o_ptr->tval <= TV_HARD_ARMOR) &&
444 !(o_ptr->art_flags3 & TR3_SH_FIRE))
446 o_ptr->art_flags3 |= TR3_SH_FIRE;
447 if (one_in_(2)) return;
449 if (one_in_(BIAS_LUCK) &&
450 !(o_ptr->art_flags2 & TR2_IM_FIRE))
452 o_ptr->art_flags2 |= TR2_IM_FIRE;
453 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_COLD | TR2_IM_ACID);
454 if (one_in_(2)) return;
459 if (!(o_ptr->art_flags2 & TR2_RES_COLD))
461 o_ptr->art_flags2 |= TR2_RES_COLD;
462 if (one_in_(2)) return;
464 if ((o_ptr->tval >= TV_CLOAK) &&
465 (o_ptr->tval <= TV_HARD_ARMOR) &&
466 !(o_ptr->art_flags3 & TR3_SH_COLD))
468 o_ptr->art_flags3 |= TR3_SH_COLD;
469 if (one_in_(2)) return;
471 if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_COLD))
473 o_ptr->art_flags2 |= TR2_IM_COLD;
474 if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_ACID | TR2_IM_FIRE);
475 if (one_in_(2)) return;
480 if (!(o_ptr->art_flags2 & TR2_RES_POIS))
482 o_ptr->art_flags2 |= TR2_RES_POIS;
483 if (one_in_(2)) return;
488 if (!one_in_(3) && (!(o_ptr->art_flags2 & TR2_RES_FEAR)))
490 o_ptr->art_flags2 |= TR2_RES_FEAR;
491 if (one_in_(2)) return;
493 if (one_in_(3) && (!(o_ptr->art_flags3 & TR3_NO_MAGIC)))
495 o_ptr->art_flags3 |= TR3_NO_MAGIC;
496 if (one_in_(2)) return;
500 case BIAS_NECROMANTIC:
501 if (!(o_ptr->art_flags2 & TR2_RES_NETHER))
503 o_ptr->art_flags2 |= TR2_RES_NETHER;
504 if (one_in_(2)) return;
506 if (!(o_ptr->art_flags2 & TR2_RES_POIS))
508 o_ptr->art_flags2 |= TR2_RES_POIS;
509 if (one_in_(2)) return;
511 if (!(o_ptr->art_flags2 & TR2_RES_DARK))
513 o_ptr->art_flags2 |= TR2_RES_DARK;
514 if (one_in_(2)) return;
519 if (!(o_ptr->art_flags2 & TR2_RES_CHAOS))
521 o_ptr->art_flags2 |= TR2_RES_CHAOS;
522 if (one_in_(2)) return;
524 if (!(o_ptr->art_flags2 & TR2_RES_CONF))
526 o_ptr->art_flags2 |= TR2_RES_CONF;
527 if (one_in_(2)) return;
529 if (!(o_ptr->art_flags2 & TR2_RES_DISEN))
531 o_ptr->art_flags2 |= TR2_RES_DISEN;
532 if (one_in_(2)) return;
537 switch (randint1(42))
540 if (!one_in_(WEIRD_LUCK))
541 random_resistance(o_ptr);
544 o_ptr->art_flags2 |= TR2_IM_ACID;
546 artifact_bias = BIAS_ACID;
550 if (!one_in_(WEIRD_LUCK))
551 random_resistance(o_ptr);
554 o_ptr->art_flags2 |= TR2_IM_ELEC;
556 artifact_bias = BIAS_ELEC;
560 if (!one_in_(WEIRD_LUCK))
561 random_resistance(o_ptr);
564 o_ptr->art_flags2 |= TR2_IM_COLD;
566 artifact_bias = BIAS_COLD;
570 if (!one_in_(WEIRD_LUCK))
571 random_resistance(o_ptr);
574 o_ptr->art_flags2 |= TR2_IM_FIRE;
576 artifact_bias = BIAS_FIRE;
582 o_ptr->art_flags2 |= TR2_RES_ACID;
584 artifact_bias = BIAS_ACID;
589 o_ptr->art_flags2 |= TR2_RES_ELEC;
591 artifact_bias = BIAS_ELEC;
596 o_ptr->art_flags2 |= TR2_RES_FIRE;
598 artifact_bias = BIAS_FIRE;
603 o_ptr->art_flags2 |= TR2_RES_COLD;
605 artifact_bias = BIAS_COLD;
609 o_ptr->art_flags2 |= TR2_RES_POIS;
610 if (!artifact_bias && !one_in_(4))
611 artifact_bias = BIAS_POIS;
612 else if (!artifact_bias && one_in_(2))
613 artifact_bias = BIAS_NECROMANTIC;
614 else if (!artifact_bias && one_in_(2))
615 artifact_bias = BIAS_ROGUE;
619 o_ptr->art_flags2 |= TR2_RES_FEAR;
620 if (!artifact_bias && one_in_(3))
621 artifact_bias = BIAS_WARRIOR;
624 o_ptr->art_flags2 |= TR2_RES_LITE;
627 o_ptr->art_flags2 |= TR2_RES_DARK;
631 o_ptr->art_flags2 |= TR2_RES_BLIND;
635 o_ptr->art_flags2 |= TR2_RES_CONF;
636 if (!artifact_bias && one_in_(6))
637 artifact_bias = BIAS_CHAOS;
641 o_ptr->art_flags2 |= TR2_RES_SOUND;
645 o_ptr->art_flags2 |= TR2_RES_SHARDS;
649 o_ptr->art_flags2 |= TR2_RES_NETHER;
650 if (!artifact_bias && one_in_(3))
651 artifact_bias = BIAS_NECROMANTIC;
655 o_ptr->art_flags2 |= TR2_RES_NEXUS;
659 o_ptr->art_flags2 |= TR2_RES_CHAOS;
660 if (!artifact_bias && one_in_(2))
661 artifact_bias = BIAS_CHAOS;
665 o_ptr->art_flags2 |= TR2_RES_DISEN;
668 if (o_ptr->tval >= TV_CLOAK && o_ptr->tval <= TV_HARD_ARMOR)
669 o_ptr->art_flags3 |= TR3_SH_ELEC;
671 random_resistance(o_ptr);
673 artifact_bias = BIAS_ELEC;
676 if (o_ptr->tval >= TV_CLOAK && o_ptr->tval <= TV_HARD_ARMOR)
677 o_ptr->art_flags3 |= TR3_SH_FIRE;
679 random_resistance(o_ptr);
681 artifact_bias = BIAS_FIRE;
684 if (o_ptr->tval == TV_SHIELD || o_ptr->tval == TV_CLOAK ||
685 o_ptr->tval == TV_HELM || o_ptr->tval == TV_HARD_ARMOR)
686 o_ptr->art_flags2 |= TR2_REFLECT;
688 random_resistance(o_ptr);
691 if (o_ptr->tval >= TV_CLOAK && o_ptr->tval <= TV_HARD_ARMOR)
692 o_ptr->art_flags3 |= TR3_SH_COLD;
694 random_resistance(o_ptr);
696 artifact_bias = BIAS_COLD;
703 static void random_misc(object_type * o_ptr)
705 switch (artifact_bias)
708 if (!(o_ptr->art_flags2 & TR2_SUST_CON))
710 o_ptr->art_flags2 |= TR2_SUST_CON;
711 if (one_in_(2)) return;
716 if (!(o_ptr->art_flags2 & TR2_SUST_STR))
718 o_ptr->art_flags2 |= TR2_SUST_STR;
719 if (one_in_(2)) return;
724 if (!(o_ptr->art_flags2 & TR2_SUST_WIS))
726 o_ptr->art_flags2 |= TR2_SUST_WIS;
727 if (one_in_(2)) return;
732 if (!(o_ptr->art_flags2 & TR2_SUST_INT))
734 o_ptr->art_flags2 |= TR2_SUST_INT;
735 if (one_in_(2)) return;
740 if (!(o_ptr->art_flags2 & TR2_SUST_DEX))
742 o_ptr->art_flags2 |= TR2_SUST_DEX;
743 if (one_in_(2)) return;
748 if (!(o_ptr->art_flags2 & TR2_SUST_CON))
750 o_ptr->art_flags2 |= TR2_SUST_CON;
751 if (one_in_(2)) return;
756 if (!(o_ptr->art_flags2 & TR2_SUST_CHR))
758 o_ptr->art_flags2 |= TR2_SUST_CHR;
759 if (one_in_(2)) return;
764 if (!(o_ptr->art_flags3 & TR3_TELEPORT))
766 o_ptr->art_flags3 |= TR3_TELEPORT;
767 if (one_in_(2)) return;
772 if (!(o_ptr->art_flags3 & TR3_LITE))
774 o_ptr->art_flags3 |= TR3_LITE; /* Freebie */
779 switch (randint1(31))
782 o_ptr->art_flags2 |= TR2_SUST_STR;
784 artifact_bias = BIAS_STR;
787 o_ptr->art_flags2 |= TR2_SUST_INT;
789 artifact_bias = BIAS_INT;
792 o_ptr->art_flags2 |= TR2_SUST_WIS;
794 artifact_bias = BIAS_WIS;
797 o_ptr->art_flags2 |= TR2_SUST_DEX;
799 artifact_bias = BIAS_DEX;
802 o_ptr->art_flags2 |= TR2_SUST_CON;
804 artifact_bias = BIAS_CON;
807 o_ptr->art_flags2 |= TR2_SUST_CHR;
809 artifact_bias = BIAS_CHR;
814 o_ptr->art_flags2 |= TR2_FREE_ACT;
817 o_ptr->art_flags2 |= TR2_HOLD_LIFE;
818 if (!artifact_bias && one_in_(5))
819 artifact_bias = BIAS_PRIESTLY;
820 else if (!artifact_bias && one_in_(6))
821 artifact_bias = BIAS_NECROMANTIC;
825 o_ptr->art_flags3 |= TR3_LITE;
829 o_ptr->art_flags3 |= TR3_FEATHER;
834 o_ptr->art_flags3 |= TR3_SEE_INVIS;
837 if (one_in_(3)) break;
838 o_ptr->art_flags3 |= TR3_TELEPATHY;
839 if (!artifact_bias && one_in_(9))
840 artifact_bias = BIAS_MAGE;
844 o_ptr->art_flags3 |= TR3_SLOW_DIGEST;
848 o_ptr->art_flags3 |= TR3_REGEN;
851 o_ptr->art_flags3 |= TR3_TELEPORT;
856 if (o_ptr->tval >= TV_BOOTS && o_ptr->tval <= TV_DRAG_ARMOR)
860 o_ptr->to_a = 4 + randint1(11);
867 int bonus_h, bonus_d;
868 o_ptr->art_flags3 |= TR3_SHOW_MODS;
869 bonus_h = 4 + (randint1(11));
870 bonus_d = 4 + (randint1(11));
871 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))
876 o_ptr->to_h += bonus_h;
877 o_ptr->to_d += bonus_d;
881 o_ptr->art_flags3 |= TR3_NO_MAGIC;
884 o_ptr->art_flags3 |= TR3_NO_TELE;
890 static void random_slay(object_type *o_ptr)
892 if (o_ptr->tval == TV_BOW)
899 o_ptr->art_flags3 |= TR3_XTRA_MIGHT;
900 if (!one_in_(7)) o_ptr->art_flags3 &= ~(TR3_XTRA_SHOTS);
901 if (!artifact_bias && one_in_(9))
902 artifact_bias = BIAS_RANGER;
905 o_ptr->art_flags3 |= TR3_XTRA_SHOTS;
906 if (!one_in_(7)) o_ptr->art_flags3 &= ~(TR3_XTRA_MIGHT);
907 if (!artifact_bias && one_in_(9))
908 artifact_bias = BIAS_RANGER;
915 switch (artifact_bias)
918 if (!(o_ptr->art_flags1 & TR1_CHAOTIC))
920 o_ptr->art_flags1 |= TR1_CHAOTIC;
921 if (one_in_(2)) return;
926 if((o_ptr->tval == TV_SWORD || o_ptr->tval == TV_POLEARM) &&
927 !(o_ptr->art_flags3 & TR3_BLESSED))
929 /* A free power for "priestly" random artifacts */
930 o_ptr->art_flags3 |= TR3_BLESSED;
934 case BIAS_NECROMANTIC:
935 if (!(o_ptr->art_flags1 & TR1_VAMPIRIC))
937 o_ptr->art_flags1 |= TR1_VAMPIRIC;
938 if (one_in_(2)) return;
940 if (!(o_ptr->art_flags1 & TR1_BRAND_POIS) && one_in_(2))
942 o_ptr->art_flags1 |= TR1_BRAND_POIS;
943 if (one_in_(2)) return;
948 if (!(o_ptr->art_flags1 & TR1_SLAY_ANIMAL))
950 o_ptr->art_flags1 |= TR1_SLAY_ANIMAL;
951 if (one_in_(2)) return;
956 if ((((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DAGGER)) ||
957 ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_SPEAR))) &&
958 !(o_ptr->art_flags2 & TR2_THROW))
960 /* Free power for rogues... */
961 o_ptr->art_flags2 |= TR2_THROW;
963 if (!(o_ptr->art_flags1 & TR1_BRAND_POIS))
965 o_ptr->art_flags1 |= TR1_BRAND_POIS;
966 if (one_in_(2)) return;
971 if (!(o_ptr->art_flags1 & TR1_BRAND_POIS))
973 o_ptr->art_flags1 |= TR1_BRAND_POIS;
974 if (one_in_(2)) return;
979 if (!(o_ptr->art_flags1 & TR1_BRAND_FIRE))
981 o_ptr->art_flags1 |= TR1_BRAND_FIRE;
982 if (one_in_(2)) return;
987 if (!(o_ptr->art_flags1 & TR1_BRAND_COLD))
989 o_ptr->art_flags1 |= TR1_BRAND_COLD;
990 if (one_in_(2)) return;
995 if (!(o_ptr->art_flags1 & TR1_BRAND_ELEC))
997 o_ptr->art_flags1 |= TR1_BRAND_ELEC;
998 if (one_in_(2)) return;
1003 if (!(o_ptr->art_flags1 & TR1_BRAND_ACID))
1005 o_ptr->art_flags1 |= TR1_BRAND_ACID;
1006 if (one_in_(2)) return;
1011 if (!(o_ptr->art_flags1 & TR1_SLAY_EVIL))
1013 o_ptr->art_flags1 |= TR1_SLAY_EVIL;
1014 if (one_in_(2)) return;
1016 if (!(o_ptr->art_flags1 & TR1_SLAY_UNDEAD))
1018 o_ptr->art_flags1 |= TR1_SLAY_UNDEAD;
1019 if (one_in_(2)) return;
1021 if (!(o_ptr->art_flags1 & TR1_SLAY_DEMON))
1023 o_ptr->art_flags1 |= TR1_SLAY_DEMON;
1024 if (one_in_(2)) return;
1029 switch (randint1(34))
1033 o_ptr->art_flags1 |= TR1_SLAY_ANIMAL;
1037 o_ptr->art_flags1 |= TR1_SLAY_EVIL;
1038 if (!artifact_bias && one_in_(2))
1039 artifact_bias = BIAS_LAW;
1040 else if (!artifact_bias && one_in_(9))
1041 artifact_bias = BIAS_PRIESTLY;
1045 o_ptr->art_flags1 |= TR1_SLAY_UNDEAD;
1046 if (!artifact_bias && one_in_(9))
1047 artifact_bias = BIAS_PRIESTLY;
1051 o_ptr->art_flags1 |= TR1_SLAY_DEMON;
1052 if (!artifact_bias && one_in_(9))
1053 artifact_bias = BIAS_PRIESTLY;
1057 o_ptr->art_flags1 |= TR1_SLAY_ORC;
1061 o_ptr->art_flags1 |= TR1_SLAY_TROLL;
1065 o_ptr->art_flags1 |= TR1_SLAY_GIANT;
1069 o_ptr->art_flags1 |= TR1_SLAY_DRAGON;
1072 o_ptr->art_flags1 |= TR1_KILL_DRAGON;
1076 if (o_ptr->tval == TV_SWORD)
1078 o_ptr->art_flags1 |= TR1_VORPAL;
1079 if (!artifact_bias && one_in_(9))
1080 artifact_bias = BIAS_WARRIOR;
1086 o_ptr->art_flags1 |= TR1_IMPACT;
1090 o_ptr->art_flags1 |= TR1_BRAND_FIRE;
1092 artifact_bias = BIAS_FIRE;
1096 o_ptr->art_flags1 |= TR1_BRAND_COLD;
1098 artifact_bias = BIAS_COLD;
1102 o_ptr->art_flags1 |= TR1_BRAND_ELEC;
1104 artifact_bias = BIAS_ELEC;
1108 o_ptr->art_flags1 |= TR1_BRAND_ACID;
1110 artifact_bias = BIAS_ACID;
1114 o_ptr->art_flags1 |= TR1_BRAND_POIS;
1115 if (!artifact_bias && !one_in_(3))
1116 artifact_bias = BIAS_POIS;
1117 else if (!artifact_bias && one_in_(6))
1118 artifact_bias = BIAS_NECROMANTIC;
1119 else if (!artifact_bias)
1120 artifact_bias = BIAS_ROGUE;
1123 o_ptr->art_flags1 |= TR1_VAMPIRIC;
1125 artifact_bias = BIAS_NECROMANTIC;
1128 o_ptr->art_flags1 |= TR1_FORCE_WEAPON;
1130 artifact_bias = (one_in_(2) ? BIAS_MAGE : BIAS_PRIESTLY);
1133 o_ptr->art_flags1 |= TR1_CHAOTIC;
1135 artifact_bias = BIAS_CHAOS;
1141 static void give_activation_power(object_type *o_ptr)
1143 int type = 0, chance = 0;
1145 switch (artifact_bias)
1150 type = ACT_BO_ELEC_1;
1152 else if (!one_in_(5))
1154 type = ACT_BA_ELEC_2;
1158 type = ACT_BA_ELEC_3;
1164 type = ACT_BA_POIS_1;
1171 type = ACT_BO_FIRE_1;
1173 else if (!one_in_(5))
1175 type = ACT_BA_FIRE_1;
1179 type = ACT_BA_FIRE_2;
1187 type = ACT_BO_COLD_1;
1188 else if (!one_in_(3))
1189 type = ACT_BA_COLD_1;
1190 else if (!one_in_(3))
1191 type = ACT_BA_COLD_2;
1193 type = ACT_BA_COLD_3;
1199 type = ACT_SUMMON_DEMON;
1201 type = ACT_CALL_CHAOS;
1208 type = ACT_CHARM_UNDEAD;
1209 else if (one_in_(12))
1210 type = ACT_BANISH_EVIL;
1211 else if (one_in_(11))
1212 type = ACT_DISP_EVIL;
1213 else if (one_in_(10))
1214 type = ACT_PROT_EVIL;
1215 else if (one_in_(9))
1216 type = ACT_CURE_1000;
1217 else if (one_in_(8))
1218 type = ACT_CURE_700;
1219 else if (one_in_(7))
1220 type = ACT_REST_ALL;
1221 else if (one_in_(6))
1222 type = ACT_REST_LIFE;
1227 case BIAS_NECROMANTIC:
1231 else if (one_in_(13))
1232 type = ACT_DISP_GOOD;
1233 else if (one_in_(9))
1234 type = ACT_MASS_GENO;
1235 else if (one_in_(8))
1236 type = ACT_GENOCIDE;
1237 else if (one_in_(13))
1238 type = ACT_SUMMON_UNDEAD;
1239 else if (one_in_(9))
1240 type = ACT_VAMPIRE_2;
1241 else if (one_in_(6))
1242 type = ACT_CHARM_UNDEAD;
1244 type = ACT_VAMPIRE_1;
1250 type = ACT_BANISH_EVIL;
1251 else if (one_in_(4))
1252 type = ACT_DISP_EVIL;
1254 type = ACT_PROT_EVIL;
1261 else if (one_in_(4))
1263 else if (one_in_(3))
1264 type = ACT_DETECT_ALL;
1265 else if (one_in_(8))
1268 type = ACT_ID_PLAIN;
1274 type = ACT_SUMMON_ELEMENTAL;
1275 else if (one_in_(10))
1276 type = ACT_SUMMON_PHANTOM;
1277 else if (one_in_(5))
1278 type = ACT_RUNE_EXPLO;
1294 type = ACT_CHARM_ANIMALS;
1295 else if (one_in_(7))
1296 type = ACT_SUMMON_ANIMAL;
1297 else if (one_in_(6))
1298 type = ACT_CHARM_ANIMAL;
1299 else if (one_in_(4))
1300 type = ACT_RESIST_ALL;
1301 else if (one_in_(3))
1304 type = ACT_CURE_POISON;
1308 while (!type || (randint1(100) >= chance))
1310 type = randint1(255);
1325 case ACT_CURE_POISON:
1339 case ACT_RESIST_ALL:
1340 case ACT_DETECT_ALL:
1362 case ACT_CHARM_ANIMAL:
1365 case ACT_SUMMON_ANIMAL:
1371 case ACT_BANISH_EVIL:
1374 case ACT_CHARM_UNDEAD:
1375 case ACT_CHARM_OTHER:
1376 case ACT_SUMMON_PHANTOM:
1378 case ACT_RUNE_EXPLO:
1381 case ACT_CALL_CHAOS:
1383 case ACT_CHARM_ANIMALS:
1384 case ACT_CHARM_OTHERS:
1385 case ACT_SUMMON_ELEMENTAL:
1393 case ACT_XTRA_SPEED:
1394 case ACT_DETECT_XTRA:
1398 case ACT_SUMMON_UNDEAD:
1399 case ACT_SUMMON_DEMON:
1410 /* A type was chosen... */
1411 o_ptr->xtra2 = type;
1412 o_ptr->art_flags3 |= TR3_ACTIVATE;
1417 static void get_random_name(char *return_name, bool armour, int power)
1419 if (randint1(100) <= TABLE_NAME)
1421 get_table_name(return_name);
1434 filename = "a_cursed_j.txt";
1436 filename = "a_cursed.txt";
1442 filename = "a_low_j.txt";
1444 filename = "a_low.txt";
1450 filename = "a_med_j.txt";
1452 filename = "a_med.txt";
1458 filename = "a_high_j.txt";
1460 filename = "a_high.txt";
1470 filename = "w_cursed_j.txt";
1472 filename = "w_cursed.txt";
1478 filename = "w_low_j.txt";
1480 filename = "w_low.txt";
1486 filename = "w_med_j.txt";
1488 filename = "w_med.txt";
1494 filename = "w_high_j.txt";
1496 filename = "w_high.txt";
1502 (void)get_rnd_line(filename, artifact_bias, return_name);
1504 if(return_name[0]==0)get_table_name(return_name);
1510 bool create_artifact(object_type *o_ptr, bool a_scroll)
1512 char new_name[1024];
1514 int powers = randint1(5) + 1;
1515 int max_type = (o_ptr->tval < TV_BOOTS ? 7 : 5);
1518 bool a_cursed = FALSE;
1519 int warrior_artifact_bias = 0;
1521 /* Reset artifact bias */
1524 /* Nuke enchantments */
1528 o_ptr->art_flags1 |= k_info[o_ptr->k_idx].flags1;
1529 o_ptr->art_flags2 |= k_info[o_ptr->k_idx].flags2;
1530 o_ptr->art_flags3 |= k_info[o_ptr->k_idx].flags3;
1531 if (o_ptr->pval) has_pval = TRUE;
1533 if (a_scroll && one_in_(4))
1535 switch (p_ptr->pclass)
1538 case CLASS_BERSERKER:
1543 artifact_bias = BIAS_WARRIOR;
1546 case CLASS_HIGH_MAGE:
1547 case CLASS_SORCERER:
1548 case CLASS_MAGIC_EATER:
1549 case CLASS_BLUE_MAGE:
1550 artifact_bias = BIAS_MAGE;
1553 artifact_bias = BIAS_PRIESTLY;
1557 artifact_bias = BIAS_ROGUE;
1558 warrior_artifact_bias = 25;
1561 artifact_bias = BIAS_RANGER;
1562 warrior_artifact_bias = 30;
1565 artifact_bias = BIAS_PRIESTLY;
1566 warrior_artifact_bias = 40;
1568 case CLASS_WARRIOR_MAGE:
1569 case CLASS_RED_MAGE:
1570 artifact_bias = BIAS_MAGE;
1571 warrior_artifact_bias = 40;
1573 case CLASS_CHAOS_WARRIOR:
1574 artifact_bias = BIAS_CHAOS;
1575 warrior_artifact_bias = 40;
1578 case CLASS_FORCETRAINER:
1579 artifact_bias = BIAS_PRIESTLY;
1581 case CLASS_MINDCRAFTER:
1583 if (randint1(5) > 2) artifact_bias = BIAS_PRIESTLY;
1586 if (randint1(5) > 2) artifact_bias = BIAS_WARRIOR;
1588 case CLASS_IMITATOR:
1589 if (randint1(2) > 1) artifact_bias = BIAS_RANGER;
1591 case CLASS_BEASTMASTER:
1592 artifact_bias = BIAS_CHR;
1593 warrior_artifact_bias = 50;
1595 case CLASS_MIRROR_MASTER:
1596 if (randint1(4) > 1)
1598 artifact_bias = BIAS_MAGE;
1602 artifact_bias = BIAS_ROGUE;
1608 if (a_scroll && (randint1(100) <= warrior_artifact_bias))
1609 artifact_bias = BIAS_WARRIOR;
1611 strcpy(new_name, "");
1613 if (!a_scroll && one_in_(A_CURSED))
1615 if (((o_ptr->tval == TV_AMULET) || (o_ptr->tval == TV_RING)) && cursed_p(o_ptr))
1618 while (one_in_(powers) || one_in_(7) || one_in_(10))
1621 if (!a_cursed && one_in_(WEIRD_LUCK))
1624 if (a_cursed) powers /= 2;
1629 switch (randint1(max_type))
1636 if (one_in_(2) && (o_ptr->tval < TV_BOOTS) && (o_ptr->tval != TV_BOW))
1638 if (a_cursed && !one_in_(13)) break;
1641 if (one_in_(o_ptr->ds+4)) o_ptr->ds++;
1645 if (one_in_(o_ptr->dd+1)) o_ptr->dd++;
1649 random_resistance(o_ptr);
1658 if (wizard) msg_print("Switch error in create_artifact!");
1666 o_ptr->art_flags3 |= TR3_SHOW_MODS;
1668 /* This one commented out by gw's request... */
1670 o_ptr->art_flags3 |= TR3_HIDE_TYPE;
1673 if (o_ptr->art_flags1 & TR1_BLOWS)
1675 o_ptr->pval = randint1(2);
1676 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA))
1685 while (o_ptr->pval < randint1(5) || one_in_(o_ptr->pval));
1688 if ((o_ptr->pval > 4) && !one_in_(WEIRD_LUCK))
1692 /* give it some plusses... */
1693 if (o_ptr->tval >= TV_BOOTS && o_ptr->tval <= TV_DRAG_ARMOR)
1694 o_ptr->to_a += randint1(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
1695 else if (o_ptr->tval <= TV_SWORD)
1697 o_ptr->to_h += randint1(o_ptr->to_h > 19 ? 1 : 20 - o_ptr->to_h);
1698 o_ptr->to_d += randint1(o_ptr->to_d > 19 ? 1 : 20 - o_ptr->to_d);
1699 if ((o_ptr->art_flags1 & TR1_WIS) && (o_ptr->pval > 0)) o_ptr->art_flags3 |= TR3_BLESSED;
1702 /* Just to be sure */
1703 o_ptr->art_flags3 |= (TR3_IGNORE_ACID | TR3_IGNORE_ELEC |
1704 TR3_IGNORE_FIRE | TR3_IGNORE_COLD);
1706 total_flags = flag_cost(o_ptr, o_ptr->pval);
1707 if (cheat_peek) msg_format("%ld", total_flags);
1709 if (a_cursed) curse_artifact(o_ptr);
1712 (randint1((o_ptr->tval >= TV_BOOTS)
1713 ? ACTIVATION_CHANCE * 2 : ACTIVATION_CHANCE) == 1))
1716 give_activation_power(o_ptr);
1719 if ((o_ptr->tval >= TV_BOOTS) && (o_ptr->tval <= TV_DRAG_ARMOR))
1721 while ((o_ptr->to_d+o_ptr->to_h) > 20)
1723 if (one_in_(o_ptr->to_d) && one_in_(o_ptr->to_h)) break;
1724 o_ptr->to_d -= (s16b)randint0(3);
1725 o_ptr->to_h -= (s16b)randint0(3);
1727 while ((o_ptr->to_d+o_ptr->to_h) > 10)
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);
1735 if (((artifact_bias == BIAS_MAGE) || (artifact_bias == BIAS_INT)) && (o_ptr->tval == TV_GLOVES)) o_ptr->art_flags2 |= TR2_FREE_ACT;
1737 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI))
1741 o_ptr->art_flags1 &= ~(TR1_BLOWS);
1742 o_ptr->art_flags1 &= ~(TR1_FORCE_WEAPON);
1743 o_ptr->art_flags1 &= ~(TR1_SLAY_ANIMAL);
1744 o_ptr->art_flags1 &= ~(TR1_SLAY_EVIL);
1745 o_ptr->art_flags1 &= ~(TR1_SLAY_UNDEAD);
1746 o_ptr->art_flags1 &= ~(TR1_SLAY_DEMON);
1747 o_ptr->art_flags1 &= ~(TR1_SLAY_ORC);
1748 o_ptr->art_flags1 &= ~(TR1_SLAY_TROLL);
1749 o_ptr->art_flags1 &= ~(TR1_SLAY_GIANT);
1750 o_ptr->art_flags1 &= ~(TR1_SLAY_DRAGON);
1751 o_ptr->art_flags1 &= ~(TR1_KILL_DRAGON);
1752 o_ptr->art_flags1 &= ~(TR1_VORPAL);
1753 o_ptr->art_flags1 &= ~(TR1_BRAND_POIS);
1754 o_ptr->art_flags1 &= ~(TR1_BRAND_ACID);
1755 o_ptr->art_flags1 &= ~(TR1_BRAND_ELEC);
1756 o_ptr->art_flags1 &= ~(TR1_BRAND_FIRE);
1757 o_ptr->art_flags1 &= ~(TR1_BRAND_COLD);
1760 if (o_ptr->tval >= TV_BOOTS)
1762 if (a_cursed) power_level = 0;
1763 else if (total_flags < 15000) power_level = 1;
1764 else if (total_flags < 25000) power_level = 2;
1765 else power_level = 3;
1770 if (a_cursed) power_level = 0;
1771 else if (total_flags < 20000) power_level = 1;
1772 else if (total_flags < 35000) power_level = 2;
1773 else power_level = 3;
1778 char dummy_name[80];
1779 /* Identify it fully */
1780 object_aware(o_ptr);
1781 object_known(o_ptr);
1783 /* Mark the item as fully known */
1784 o_ptr->ident |= (IDENT_MENTAL);
1786 strcpy(dummy_name, "");
1787 (void)identify_fully_aux(o_ptr);
1790 if (!(get_string("¤³¤Î¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ò²¿¤È̾ÉÕ¤±¤Þ¤¹¤«¡©", dummy_name, 80)))
1792 if (!(get_string("What do you want to call the artifact? ", dummy_name, 80)))
1796 get_random_name(new_name, (bool)(o_ptr->tval >= TV_BOOTS), power_level);
1801 strcpy(new_name, "¡Ô");
1803 strcpy(new_name, "'");
1806 strcat(new_name, dummy_name);
1808 strcat(new_name, "¡Õ¤È¤¤¤¦Ì¾¤Î");
1810 strcat(new_name, "'");
1815 chg_virtue(V_INDIVIDUALISM, 2);
1816 chg_virtue(V_ENCHANT, 5);
1821 get_random_name(new_name, (bool)(o_ptr->tval >= TV_BOOTS), power_level);
1828 msg_format("±¿¤ÎÊФä¿¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È: %d¡£", artifact_bias);
1830 msg_format("Biased artifact: %d.", artifact_bias);
1835 msg_print("¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤Ë±¿¤ÎÊФê¤Ê¤·¡£");
1837 msg_print("No bias in artifact.");
1842 /* Save the inscription */
1843 o_ptr->art_name = quark_add(new_name);
1846 p_ptr->window |= (PW_INVEN | PW_EQUIP);
1852 bool activate_random_artifact(object_type * o_ptr)
1854 int plev = p_ptr->lev;
1855 int k, dir, dummy = 0;
1857 if (!o_ptr->art_name) return FALSE; /* oops? */
1859 /* Activate for attack */
1860 switch (o_ptr->xtra2)
1864 if (!get_aim_dir(&dir)) return FALSE;
1866 msg_print("ÂÀÍÛ¸÷Àþ¤¬Êü¤¿¤ì¤¿¡£");
1868 msg_print("A line of sunlight appears.");
1871 (void)lite_line(dir);
1872 o_ptr->timeout = 10;
1879 msg_print("¤½¤ì¤ÏâÁ¤·¤¤¤¯¤é¤¤¤ËÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
1881 msg_print("It glows extremely brightly...");
1884 if (!get_aim_dir(&dir)) return FALSE;
1885 fire_bolt(GF_MISSILE, dir, damroll(2, 6));
1893 msg_print("¤½¤ì¤ÏÇ»Î理Ë̮ư¤·¤Æ¤¤¤ë...");
1895 msg_print("It throbs deep green...");
1898 if (!get_aim_dir(&dir)) return FALSE;
1899 fire_ball(GF_POIS, dir, 12, 3);
1900 o_ptr->timeout = randint0(4) + 4;
1907 msg_print("¤½¤ì¤Ï²Ð²Ö¤Ëʤ¤ï¤ì¤¿...");
1909 msg_print("It is covered in sparks...");
1912 if (!get_aim_dir(&dir)) return FALSE;
1913 fire_bolt(GF_ELEC, dir, damroll(4, 8));
1914 o_ptr->timeout = randint0(5) + 5;
1921 msg_print("¤½¤ì¤Ï»À¤Ëʤ¤ï¤ì¤¿...");
1923 msg_print("It is covered in acid...");
1926 if (!get_aim_dir(&dir)) return FALSE;
1927 fire_bolt(GF_ACID, dir, damroll(5, 8));
1928 o_ptr->timeout = randint0(6) + 6;
1935 msg_print("¤½¤ì¤ÏÁú¤Ëʤ¤ï¤ì¤¿...");
1937 msg_print("It is covered in frost...");
1940 if (!get_aim_dir(&dir)) return FALSE;
1941 fire_bolt(GF_COLD, dir, damroll(6, 8));
1942 o_ptr->timeout = randint0(7) + 7;
1949 msg_print("¤½¤ì¤Ï±ê¤Ëʤ¤ï¤ì¤¿...");
1951 msg_print("It is covered in fire...");
1954 if (!get_aim_dir(&dir)) return FALSE;
1955 fire_bolt(GF_FIRE, dir, damroll(9, 8));
1956 o_ptr->timeout = randint0(8) + 8;
1963 msg_print("¤½¤ì¤ÏÁú¤Ëʤ¤ï¤ì¤¿...");
1965 msg_print("It is covered in frost...");
1968 if (!get_aim_dir(&dir)) return FALSE;
1969 fire_ball(GF_COLD, dir, 48, 2);
1970 o_ptr->timeout = 400;
1977 msg_print("¤½¤ì¤ÏÀÖ¤¯·ã¤·¤¯µ±¤¤¤¿...");
1979 msg_print("It glows an intense red...");
1982 if (!get_aim_dir(&dir)) return FALSE;
1983 fire_ball(GF_FIRE, dir, 72, 2);
1984 o_ptr->timeout = 400;
1991 msg_print("¤½¤ì¤Ï¹õ¤¯µ±¤¤¤¿...");
1993 msg_print("It glows black...");
1996 if (!get_aim_dir(&dir)) return FALSE;
1997 if (drain_life(dir, 100))
1998 o_ptr->timeout = randint0(100) + 100;
2005 msg_print("¤½¤ì¤ÏÀĤ¯·ã¤·¤¯µ±¤¤¤¿...");
2007 msg_print("It glows an intense blue...");
2010 if (!get_aim_dir(&dir)) return FALSE;
2011 fire_ball(GF_COLD, dir, 100, 2);
2012 o_ptr->timeout = 300;
2019 msg_print("Åŵ¤¤¬¥Ñ¥Á¥Ñ¥Á²»¤òΩ¤Æ¤¿...");
2021 msg_print("It crackles with electricity...");
2024 if (!get_aim_dir(&dir)) return FALSE;
2025 fire_ball(GF_ELEC, dir, 100, 3);
2026 o_ptr->timeout = 500;
2033 msg_print("¹õ¤¯µ±¤¤¤Æ¤¤¤ë...");
2035 msg_print("It glows black...");
2038 if (!get_aim_dir(&dir)) return FALSE;
2039 drain_life(dir, 120);
2040 o_ptr->timeout = 400;
2046 if (!get_aim_dir(&dir)) return FALSE;
2047 for (dummy = 0; dummy < 3; dummy++)
2049 if (drain_life(dir, 50))
2052 o_ptr->timeout = 400;
2059 msg_print("ËâË¡¤Î¥È¥²¤¬¸½¤ì¤¿...");
2061 msg_print("It grows magical spikes...");
2064 if (!get_aim_dir(&dir)) return FALSE;
2065 fire_bolt(GF_ARROW, dir, 150);
2066 o_ptr->timeout = randint0(90) + 90;
2073 msg_print("¿¼ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2075 msg_print("It glows deep red...");
2078 if (!get_aim_dir(&dir)) return FALSE;
2079 fire_ball(GF_FIRE, dir, 120, 3);
2080 o_ptr->timeout = randint0(225) + 225;
2087 msg_print("ÌÀ¤ë¤¯Çò¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2089 msg_print("It glows bright white...");
2092 if (!get_aim_dir(&dir)) return FALSE;
2093 fire_ball(GF_COLD, dir, 200, 3);
2094 o_ptr->timeout = randint0(325) + 325;
2101 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2103 msg_print("It glows deep blue...");
2106 if (!get_aim_dir(&dir)) return FALSE;
2107 fire_ball(GF_ELEC, dir, 250, 3);
2108 o_ptr->timeout = randint0(425) + 425;
2117 monster_type *m_ptr;
2119 for (dir = 0; dir <= 9; dir++)
2123 c_ptr = &cave[y][x];
2125 /* Get the monster */
2126 m_ptr = &m_list[c_ptr->m_idx];
2128 /* Hack -- attack monsters */
2129 if (c_ptr->m_idx && (m_ptr->ml || cave_floor_bold(y, x)))
2133 o_ptr->timeout = 250;
2139 if (!get_aim_dir(&dir)) return FALSE;
2140 for (dummy = 0; dummy < 3; dummy++)
2142 if (drain_life(dir, 100))
2146 o_ptr->timeout = 400;
2151 case ACT_CALL_CHAOS:
2154 msg_print("ÍÍ¡¹¤Ê¿§¤Î²Ð²Ö¤òȯ¤·¤Æ¤¤¤ë...");
2156 msg_print("It glows in scintillating colours...");
2160 o_ptr->timeout = 350;
2166 if (!get_aim_dir(&dir)) return FALSE;
2168 msg_print("¥í¥±¥Ã¥È¤òȯ¼Í¤·¤¿¡ª");
2170 msg_print("You launch a rocket!");
2173 fire_ball(GF_ROCKET, dir, 250 + plev*3, 2);
2174 o_ptr->timeout = 400;
2181 msg_print("¿ÀÀ»¤ÊÊ·°Ïµ¤¤¬½¼Ëþ¤·¤¿...");
2183 msg_print("It floods the area with goodness...");
2186 dispel_evil(p_ptr->lev * 5);
2187 o_ptr->timeout = randint0(300) + 300;
2194 msg_print("¼Ù°¤ÊÊ·°Ïµ¤¤¬½¼Ëþ¤·¤¿...");
2196 msg_print("It floods the area with evil...");
2199 dispel_good(p_ptr->lev * 5);
2200 o_ptr->timeout = randint0(300) + 300;
2206 if (!get_aim_dir(&dir)) return FALSE;
2208 msg_print("¤¢¤Ê¤¿¤Ï¥¨¥ì¥á¥ó¥È¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£");
2210 msg_print("You breathe the elements.");
2213 fire_ball(GF_MISSILE, dir, 300, 4);
2214 o_ptr->timeout = 500;
2218 /* Activate for other offensive action */
2223 msg_print("ÍÍ¡¹¤Ê¿§¤Î²Ð²Ö¤òȯ¤·¤Æ¤¤¤ë...");
2225 msg_print("It glows in scintillating colours...");
2228 if (!get_aim_dir(&dir)) return FALSE;
2229 confuse_monster(dir, 20);
2230 o_ptr->timeout = 15;
2237 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2239 msg_print("It glows deep blue...");
2242 sleep_monsters_touch();
2243 o_ptr->timeout = 55;
2249 earthquake(py, px, 10);
2250 o_ptr->timeout = 50;
2256 turn_monsters(40 + p_ptr->lev);
2257 o_ptr->timeout = 3 * (p_ptr->lev + 10);
2263 if (!get_aim_dir(&dir)) return FALSE;
2264 (void)fire_beam(GF_AWAY_ALL, dir, plev);
2265 o_ptr->timeout = 200;
2269 case ACT_BANISH_EVIL:
2271 if (banish_evil(100))
2274 msg_print("¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤ÎÎϤ¬¼Ù°¤òÂǤÁÅݤ·¤¿¡ª");
2276 msg_print("The power of the artifact banishes evil!");
2280 o_ptr->timeout = 250 + randint1(250);
2287 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2289 msg_print("It glows deep blue...");
2292 (void)symbol_genocide(200, TRUE);
2293 o_ptr->timeout = 500;
2300 msg_print("¤Ò¤É¤¯±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...");
2302 msg_print("It lets out a long, shrill note...");
2305 (void)mass_genocide(200, TRUE);
2306 o_ptr->timeout = 1000;
2310 /* Activate for summoning / charming */
2312 case ACT_CHARM_ANIMAL:
2314 if (!get_aim_dir(&dir)) return FALSE;
2315 (void)charm_animal(dir, plev);
2316 o_ptr->timeout = 300;
2320 case ACT_CHARM_UNDEAD:
2322 if (!get_aim_dir(&dir)) return FALSE;
2323 (void)control_one_undead(dir, plev);
2324 o_ptr->timeout = 333;
2328 case ACT_CHARM_OTHER:
2330 if (!get_aim_dir(&dir)) return FALSE;
2331 (void)charm_monster(dir, plev);
2332 o_ptr->timeout = 400;
2336 case ACT_CHARM_ANIMALS:
2338 (void)charm_animals(plev * 2);
2339 o_ptr->timeout = 500;
2343 case ACT_CHARM_OTHERS:
2345 charm_monsters(plev * 2);
2346 o_ptr->timeout = 750;
2350 case ACT_SUMMON_ANIMAL:
2352 (void)summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, TRUE, TRUE, TRUE, FALSE, FALSE);
2353 o_ptr->timeout = 200 + randint1(300);
2357 case ACT_SUMMON_PHANTOM:
2360 msg_print("¸¸Îî¤ò¾¤´¤·¤¿¡£");
2362 msg_print("You summon a phantasmal servant.");
2365 (void)summon_specific(-1, py, px, dun_level, SUMMON_PHANTOM, TRUE, TRUE, TRUE, FALSE, FALSE);
2366 o_ptr->timeout = 200 + randint1(200);
2370 case ACT_SUMMON_ELEMENTAL:
2372 bool pet = one_in_(3);
2373 bool group = !(pet && (plev < 50));
2375 if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_ELEMENTAL, group, FALSE, pet, FALSE, (bool)(!pet)))
2378 msg_print("¥¨¥ì¥á¥ó¥¿¥ë¤¬¸½¤ì¤¿...");
2380 msg_print("An elemental materializes...");
2386 msg_print("¤¢¤Ê¤¿¤ËÉþ½¾¤·¤Æ¤¤¤ë¤è¤¦¤À¡£");
2388 msg_print("It seems obedient to you.");
2393 msg_print("¤½¤ì¤ò¥³¥ó¥È¥í¡¼¥ë¤Ç¤¤Ê¤«¤Ã¤¿¡ª");
2395 msg_print("You fail to control it!");
2400 o_ptr->timeout = 750;
2404 case ACT_SUMMON_DEMON:
2406 bool pet = one_in_(3);
2407 bool group = !(pet && (plev < 50));
2409 if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_DEMON, group, FALSE, pet, FALSE, (bool)(!pet)))
2412 msg_print("ⲫ¤Î°½¤¬½¼Ëþ¤·¤¿¡£");
2414 msg_print("The area fills with a stench of sulphur and brimstone.");
2419 msg_print("¡Ö¤´ÍѤǤ´¤¶¤¤¤Þ¤¹¤«¡¢¤´¼ç¿ÍÍÍ¡×");
2421 msg_print("'What is thy bidding... Master?'");
2426 msg_print("¡ÖNON SERVIAM! Wretch! ¤ªÁ°¤Îº²¤òĺ¤¯¤¾¡ª¡×");
2428 msg_print("'NON SERVIAM! Wretch! I shall feast on thy mortal soul!'");
2433 o_ptr->timeout = 666 + randint1(333);
2437 case ACT_SUMMON_UNDEAD:
2439 bool pet = one_in_(3);
2444 type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
2447 group = (((plev > 24) && one_in_(3)) ? TRUE : FALSE);
2448 unique_okay = FALSE;
2456 if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), type,
2457 group, FALSE, pet, unique_okay, (bool)(!pet)))
2460 msg_print("Î䤿¤¤É÷¤¬¤¢¤Ê¤¿¤Î¼þ¤ê¤Ë¿á¤»Ï¤á¤¿¡£¤½¤ì¤ÏÉåÇÔ½¤ò±¿¤ó¤Ç¤¤¤ë...");
2462 msg_print("Cold winds begin to blow around you, carrying with them the stench of decay...");
2467 msg_print("¸Å¤¨¤Î»à¤»¤ë¼Ô¶¦¤¬¤¢¤Ê¤¿¤Ë»Å¤¨¤ë¤¿¤áÅÚ¤«¤éᴤä¿¡ª");
2469 msg_print("Ancient, long-dead forms arise from the ground to serve you!");
2474 msg_print("»à¼Ô¤¬á´¤Ã¤¿¡£Ì²¤ê¤ò˸¤²¤ë¤¢¤Ê¤¿¤òȳ¤¹¤ë¤¿¤á¤Ë¡ª");
2476 msg_print("'The dead arise... to punish you for disturbing them!'");
2481 o_ptr->timeout = 666 + randint1(333);
2485 /* Activate for healing */
2489 (void)set_afraid(0);
2490 (void)hp_player(30);
2491 o_ptr->timeout = 10;
2498 msg_print("¿¼»ç¿§¤Î¸÷¤òȯ¤·¤Æ¤¤¤ë...");
2500 msg_print("It radiates deep purple...");
2503 hp_player(damroll(4, 8));
2504 (void)set_cut((p_ptr->cut / 2) - 50);
2505 o_ptr->timeout = randint0(3) + 3;
2509 case ACT_CURE_POISON:
2512 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2514 msg_print("It glows deep blue...");
2517 (void)set_afraid(0);
2518 (void)set_poisoned(0);
2526 msg_print("¿¼¹È¤Ëµ±¤¤¤Æ¤¤¤ë...");
2528 msg_print("It glows a deep red...");
2532 o_ptr->timeout = 450;
2539 msg_print("Ç»Îп§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2541 msg_print("It glows a deep green...");
2544 (void)do_res_stat(A_STR);
2545 (void)do_res_stat(A_INT);
2546 (void)do_res_stat(A_WIS);
2547 (void)do_res_stat(A_DEX);
2548 (void)do_res_stat(A_CON);
2549 (void)do_res_stat(A_CHR);
2550 (void)restore_level();
2551 o_ptr->timeout = 750;
2558 msg_print("¿¼ÀÄ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2560 msg_print("It glows deep blue...");
2564 msg_print("ÂÎÆâ¤ËÃȤ«¤¤¸ÝÆ°¤¬´¶¤¸¤é¤ì¤ë...");
2566 msg_print("You feel a warm tingling inside...");
2569 (void)hp_player(700);
2571 o_ptr->timeout = 250;
2578 msg_print("Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2580 msg_print("It glows a bright white...");
2584 msg_print("¤Ò¤¸¤ç¤¦¤Ëµ¤Ê¬¤¬¤è¤¤...");
2586 msg_print("You feel much better...");
2589 (void)hp_player(1000);
2591 o_ptr->timeout = 888;
2595 /* Activate for timed effect */
2599 (void)set_tim_esp(randint1(30) + 25, FALSE);
2600 o_ptr->timeout = 200;
2606 (void)set_hero(randint1(50) + 50, FALSE);
2607 (void)set_blessed(randint1(50) + 50, FALSE);
2608 o_ptr->timeout = 100 + randint1(100);
2615 msg_print("±Ô¤¤²»¤¬Î®¤ì½Ð¤¿...");
2617 msg_print("It lets out a shrill wail...");
2621 (void)set_protevil(randint1(25) + k, FALSE);
2622 o_ptr->timeout = randint0(225) + 225;
2626 case ACT_RESIST_ALL:
2629 msg_print("ÍÍ¡¹¤Ê¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2631 msg_print("It glows many colours...");
2634 (void)set_oppose_acid(randint1(40) + 40, FALSE);
2635 (void)set_oppose_elec(randint1(40) + 40, FALSE);
2636 (void)set_oppose_fire(randint1(40) + 40, FALSE);
2637 (void)set_oppose_cold(randint1(40) + 40, FALSE);
2638 (void)set_oppose_pois(randint1(40) + 40, FALSE);
2639 o_ptr->timeout = 200;
2646 msg_print("ÌÀ¤ë¤¯Îп§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2648 msg_print("It glows bright green...");
2651 (void)set_fast(randint1(20) + 20, FALSE);
2652 o_ptr->timeout = 250;
2656 case ACT_XTRA_SPEED:
2659 msg_print("ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2661 msg_print("It glows brightly...");
2664 (void)set_fast(randint1(75) + 75, FALSE);
2665 o_ptr->timeout = randint0(200) + 200;
2671 set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
2672 o_ptr->timeout = 1000;
2678 (void)set_invuln(randint1(8) + 8, FALSE);
2679 o_ptr->timeout = 1000;
2683 /* Activate for general purpose effect (detection etc.) */
2688 msg_print("À¡¤ó¤À¸÷¤¬¤¢¤Õ¤ì½Ð¤¿...");
2690 msg_print("It wells with clear light...");
2693 lite_area(damroll(2, 15), 3);
2694 o_ptr->timeout = randint0(10) + 10;
2701 msg_print("âÁ¤·¤¯µ±¤¤¤¿...");
2703 msg_print("It shines brightly...");
2706 map_area(DETECT_RAD_MAP);
2707 lite_area(damroll(2, 15), 3);
2708 o_ptr->timeout = randint0(50) + 50;
2712 case ACT_DETECT_ALL:
2715 msg_print("Çò¤¯ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2717 msg_print("It glows bright white...");
2721 msg_print("¿´¤Ë¥¤¥á¡¼¥¸¤¬É⤫¤ó¤Ç¤¤¿...");
2723 msg_print("An image forms in your mind...");
2726 detect_all(DETECT_RAD_DEFAULT);
2727 o_ptr->timeout = randint0(55) + 55;
2731 case ACT_DETECT_XTRA:
2734 msg_print("ÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2736 msg_print("It glows brightly...");
2739 detect_all(DETECT_RAD_DEFAULT);
2741 identify_fully(FALSE);
2742 o_ptr->timeout = 1000;
2749 msg_print("²«¿§¤¯µ±¤¤¤Æ¤¤¤ë...");
2751 msg_print("It glows yellow...");
2754 identify_fully(FALSE);
2755 o_ptr->timeout = 750;
2761 if (!ident_spell(FALSE)) return FALSE;
2762 o_ptr->timeout = 10;
2766 case ACT_RUNE_EXPLO:
2769 msg_print("ÌÀ¤ë¤¤ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2771 msg_print("It glows bright red...");
2775 o_ptr->timeout = 200;
2782 msg_print("¥Ö¥ë¡¼¤ËÌÀ¤ë¤¯µ±¤¤¤Æ¤¤¤ë...");
2784 msg_print("It glows light blue...");
2788 o_ptr->timeout = 400;
2794 (void)set_food(PY_FOOD_MAX - 1);
2795 o_ptr->timeout = 200;
2802 msg_print("ÌÀ¤ë¤¤ÀÖ¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2804 msg_print("It glows bright red...");
2807 destroy_doors_touch();
2808 o_ptr->timeout = 10;
2815 msg_print("¸ÝÆ°¤·¤Æ¤¤¤ë...");
2817 msg_print("It pulsates...");
2820 if (!get_aim_dir(&dir)) return FALSE;
2829 o_ptr->timeout = 70;
2836 msg_print("ÌÀ¤ë¤¤²«¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2838 msg_print("It glows bright yellow...");
2842 o_ptr->timeout = 500;
2849 msg_print("¼¡¸µ¤ÎÈ⤬³«¤¤¤¿¡£ÌÜŪÃϤòÁª¤ó¤Ç²¼¤µ¤¤¡£");
2851 msg_print("You open a dimensional gate. Choose a destination.");
2854 if (!dimension_door()) return FALSE;
2855 o_ptr->timeout = 100;
2863 msg_print("¼þ¤ê¤Î¶õ´Ö¤¬ÏĤó¤Ç¤¤¤ë...");
2865 msg_print("It twists space around you...");
2868 teleport_player(100);
2869 o_ptr->timeout = 45;
2876 msg_print("¤ä¤ï¤é¤«¤ÊÇò¿§¤Ëµ±¤¤¤Æ¤¤¤ë...");
2878 msg_print("It glows soft white...");
2880 if (!word_of_recall()) return FALSE;
2881 o_ptr->timeout = 200;
2888 msg_format("Unknown activation effect: %d.", o_ptr->xtra2);
2890 msg_format("Unknown activation effect: %d.", o_ptr->xtra2);
2901 void random_artifact_resistance(object_type * o_ptr)
2903 bool give_resistance = FALSE, give_power = FALSE;
2905 if (o_ptr->name1 == ART_TERROR) /* Terror Mask is for warriors... */
2907 if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_ARCHER || p_ptr->pclass == CLASS_CAVALRY || p_ptr->pclass == CLASS_BERSERKER)
2910 give_resistance = TRUE;
2914 o_ptr->art_flags3 |=
2915 (TR3_CURSED | TR3_HEAVY_CURSE | TR3_AGGRAVATE | TR3_TY_CURSE);
2916 o_ptr->ident |= IDENT_CURSED;
2920 if (o_ptr->name1 == ART_MURAMASA)
2922 if (p_ptr->pclass != CLASS_SAMURAI)
2924 o_ptr->art_flags3 |= (TR3_NO_TELE | TR3_NO_MAGIC | TR3_HEAVY_CURSE);
2925 o_ptr->ident |= IDENT_CURSED;
2929 if (o_ptr->name1 == ART_XIAOLONG)
2931 if (p_ptr->pclass == CLASS_MONK)
2932 o_ptr->art_flags1 |= TR1_BLOWS;
2935 if (o_ptr->name1 == ART_BLOOD)
2938 dummy = randint1(2)+randint1(2);
2939 for (i = 0; i < dummy; i++)
2940 o_ptr->art_flags1 |= (TR1_CHAOTIC << randint0(18));
2941 dummy = randint1(2);
2942 for (i = 0; i < dummy; i++)
2943 one_resistance(o_ptr);
2945 for (i = 0; i < dummy; i++)
2947 int tmp = randint0(11);
2948 if (tmp < 6) o_ptr->art_flags1 |= (TR1_STR << tmp);
2949 else o_ptr->art_flags1 |= (TR1_STEALTH << (tmp - 6));
2953 switch (o_ptr->name1)
2971 case ART_THALKETTOTH:
2974 /* Give a resistance */
2975 give_resistance = TRUE;
2990 /* Give a resistance OR a power */
2991 if (one_in_(2)) give_resistance = TRUE;
2992 else give_power = TRUE;
3013 give_resistance = TRUE;
3023 if (give_resistance)
3025 one_high_resistance(o_ptr);
3031 * Create the artifact of the specified number
3033 void create_named_art(int a_idx, int y, int x)
3039 artifact_type *a_ptr = &a_info[a_idx];
3041 /* Get local object */
3044 /* Ignore "empty" artifacts */
3045 if (!a_ptr->name) return;
3047 /* Acquire the "kind" index */
3048 i = lookup_kind(a_ptr->tval, a_ptr->sval);
3053 /* Create the artifact */
3054 object_prep(q_ptr, i);
3057 q_ptr->name1 = a_idx;
3059 /* Extract the fields */
3060 q_ptr->pval = a_ptr->pval;
3061 q_ptr->ac = a_ptr->ac;
3062 q_ptr->dd = a_ptr->dd;
3063 q_ptr->ds = a_ptr->ds;
3064 q_ptr->to_a = a_ptr->to_a;
3065 q_ptr->to_h = a_ptr->to_h;
3066 q_ptr->to_d = a_ptr->to_d;
3067 q_ptr->weight = a_ptr->weight;
3069 /* Hack -- acquire "cursed" flag */
3070 if (a_ptr->flags3 & TR3_CURSED) q_ptr->ident |= (IDENT_CURSED);
3072 random_artifact_resistance(q_ptr);
3074 /* Drop the artifact from heaven */
3075 (void)drop_near(q_ptr, -1, y, x);