OSDN Git Service

Suppress gcc warning
[hengband/hengband.git] / src / artifact.c
index f064c56..ad5a8bd 100644 (file)
@@ -184,6 +184,122 @@ void one_ability(object_type *o_ptr)
        }
 }
 
+/*
+ * Choose one random activation
+ */
+void one_activation(object_type *o_ptr)
+{
+       int type = 0;
+       int chance = 0;
+
+       while (randint1(100) >= chance)
+       {
+               type = randint1(255);
+               switch (type)
+               {
+                       case ACT_SUNLIGHT:
+                       case ACT_BO_MISS_1:
+                       case ACT_BA_POIS_1:
+                       case ACT_BO_ELEC_1:
+                       case ACT_BO_ACID_1:
+                       case ACT_BO_COLD_1:
+                       case ACT_BO_FIRE_1:
+                       case ACT_CONFUSE:
+                       case ACT_SLEEP:
+                       case ACT_QUAKE:
+                       case ACT_CURE_LW:
+                       case ACT_CURE_MW:
+                       case ACT_CURE_POISON:
+                       case ACT_BERSERK:
+                       case ACT_LIGHT:
+                       case ACT_MAP_LIGHT:
+                       case ACT_DEST_DOOR:
+                       case ACT_STONE_MUD:
+                       case ACT_TELEPORT:
+                               chance = 101;
+                               break;
+                       case ACT_BA_COLD_1:
+                       case ACT_BA_FIRE_1:
+                       case ACT_DRAIN_1:
+                       case ACT_TELE_AWAY:
+                       case ACT_ESP:
+                       case ACT_RESIST_ALL:
+                       case ACT_DETECT_ALL:
+                       case ACT_RECALL:
+                       case ACT_SATIATE:
+                       case ACT_RECHARGE:
+                               chance = 85;
+                               break;
+                       case ACT_TERROR:
+                       case ACT_PROT_EVIL:
+                       case ACT_ID_PLAIN:
+                               chance = 75;
+                               break;
+                       case ACT_DRAIN_2:
+                       case ACT_VAMPIRE_1:
+                       case ACT_BO_MISS_2:
+                       case ACT_BA_FIRE_2:
+                       case ACT_REST_LIFE:
+                               chance = 66;
+                               break;
+                       case ACT_BA_FIRE_3:
+                       case ACT_BA_COLD_3:
+                       case ACT_BA_ELEC_3:
+                       case ACT_WHIRLWIND:
+                       case ACT_VAMPIRE_2:
+                       case ACT_CHARM_ANIMAL:
+                               chance = 50;
+                               break;
+                       case ACT_SUMMON_ANIMAL:
+                               chance = 40;
+                               break;
+                       case ACT_DISP_EVIL:
+                       case ACT_BA_MISS_3:
+                       case ACT_DISP_GOOD:
+                       case ACT_BANISH_EVIL:
+                       case ACT_GENOCIDE:
+                       case ACT_MASS_GENO:
+                       case ACT_CHARM_UNDEAD:
+                       case ACT_CHARM_OTHER:
+                       case ACT_SUMMON_PHANTOM:
+                       case ACT_REST_ALL:
+                       case ACT_RUNE_EXPLO:
+                               chance = 33;
+                               break;
+                       case ACT_CALL_CHAOS:
+                       case ACT_ROCKET:
+                       case ACT_CHARM_ANIMALS:
+                       case ACT_CHARM_OTHERS:
+                       case ACT_SUMMON_ELEMENTAL:
+                       case ACT_CURE_700:
+                       case ACT_SPEED:
+                       case ACT_ID_FULL:
+                       case ACT_RUNE_PROT:
+                               chance = 25;
+                               break;
+                       case ACT_CURE_1000:
+                       case ACT_XTRA_SPEED:
+                       case ACT_DETECT_XTRA:
+                       case ACT_DIM_DOOR:
+                               chance = 10;
+                               break;
+                       case ACT_SUMMON_UNDEAD:
+                       case ACT_SUMMON_DEMON:
+                       case ACT_WRAITH:
+                       case ACT_INVULN:
+                       case ACT_ALCHEMY:
+                               chance = 5;
+                               break;
+                       default:
+                               chance = 0;
+               }
+       }
+
+       /* A type was chosen... */
+       o_ptr->xtra2 = type;
+       add_flag(o_ptr->art_flags, TR_ACTIVATE);
+       o_ptr->timeout = 0;
+}
 
 static void curse_artifact(object_type * o_ptr)
 {
@@ -199,6 +315,8 @@ static void curse_artifact(object_type * o_ptr)
        if (one_in_(3)) add_flag(o_ptr->art_flags, TR_TY_CURSE);
        if (one_in_(2)) add_flag(o_ptr->art_flags, TR_AGGRAVATE);
        if (one_in_(3)) add_flag(o_ptr->art_flags, TR_DRAIN_EXP);
+       if (one_in_(6)) add_flag(o_ptr->art_flags, TR_ADD_L_CURSE);
+       if (one_in_(9)) add_flag(o_ptr->art_flags, TR_ADD_H_CURSE);
        if (one_in_(2)) add_flag(o_ptr->art_flags, TR_TELEPORT);
        else if (one_in_(3)) add_flag(o_ptr->art_flags, TR_NO_TELE);
 
@@ -1433,107 +1551,10 @@ static void give_activation_power(object_type *o_ptr)
                        break;
        }
 
-       while (!type || (randint1(100) >= chance))
+       if (!type || (randint1(100) >= chance))
        {
-               type = randint1(255);
-               switch (type)
-               {
-                       case ACT_SUNLIGHT:
-                       case ACT_BO_MISS_1:
-                       case ACT_BA_POIS_1:
-                       case ACT_BO_ELEC_1:
-                       case ACT_BO_ACID_1:
-                       case ACT_BO_COLD_1:
-                       case ACT_BO_FIRE_1:
-                       case ACT_CONFUSE:
-                       case ACT_SLEEP:
-                       case ACT_QUAKE:
-                       case ACT_CURE_LW:
-                       case ACT_CURE_MW:
-                       case ACT_CURE_POISON:
-                       case ACT_BERSERK:
-                       case ACT_LIGHT:
-                       case ACT_MAP_LIGHT:
-                       case ACT_DEST_DOOR:
-                       case ACT_STONE_MUD:
-                       case ACT_TELEPORT:
-                               chance = 101;
-                               break;
-                       case ACT_BA_COLD_1:
-                       case ACT_BA_FIRE_1:
-                       case ACT_DRAIN_1:
-                       case ACT_TELE_AWAY:
-                       case ACT_ESP:
-                       case ACT_RESIST_ALL:
-                       case ACT_DETECT_ALL:
-                       case ACT_RECALL:
-                       case ACT_SATIATE:
-                       case ACT_RECHARGE:
-                               chance = 85;
-                               break;
-                       case ACT_TERROR:
-                       case ACT_PROT_EVIL:
-                       case ACT_ID_PLAIN:
-                               chance = 75;
-                               break;
-                       case ACT_DRAIN_2:
-                       case ACT_VAMPIRE_1:
-                       case ACT_BO_MISS_2:
-                       case ACT_BA_FIRE_2:
-                       case ACT_REST_LIFE:
-                               chance = 66;
-                               break;
-                       case ACT_BA_FIRE_3:
-                       case ACT_BA_COLD_3:
-                       case ACT_BA_ELEC_3:
-                       case ACT_WHIRLWIND:
-                       case ACT_VAMPIRE_2:
-                       case ACT_CHARM_ANIMAL:
-                               chance = 50;
-                               break;
-                       case ACT_SUMMON_ANIMAL:
-                               chance = 40;
-                               break;
-                       case ACT_DISP_EVIL:
-                       case ACT_BA_MISS_3:
-                       case ACT_DISP_GOOD:
-                       case ACT_BANISH_EVIL:
-                       case ACT_GENOCIDE:
-                       case ACT_MASS_GENO:
-                       case ACT_CHARM_UNDEAD:
-                       case ACT_CHARM_OTHER:
-                       case ACT_SUMMON_PHANTOM:
-                       case ACT_REST_ALL:
-                       case ACT_RUNE_EXPLO:
-                               chance = 33;
-                               break;
-                       case ACT_CALL_CHAOS:
-                       case ACT_ROCKET:
-                       case ACT_CHARM_ANIMALS:
-                       case ACT_CHARM_OTHERS:
-                       case ACT_SUMMON_ELEMENTAL:
-                       case ACT_CURE_700:
-                       case ACT_SPEED:
-                       case ACT_ID_FULL:
-                       case ACT_RUNE_PROT:
-                               chance = 25;
-                               break;
-                       case ACT_CURE_1000:
-                       case ACT_XTRA_SPEED:
-                       case ACT_DETECT_XTRA:
-                       case ACT_DIM_DOOR:
-                               chance = 10;
-                               break;
-                       case ACT_SUMMON_UNDEAD:
-                       case ACT_SUMMON_DEMON:
-                       case ACT_WRAITH:
-                       case ACT_INVULN:
-                       case ACT_ALCHEMY:
-                               chance = 5;
-                               break;
-                       default:
-                               chance = 0;
-               }
+               one_activation(o_ptr);
+               return;
        }
 
        /* A type was chosen... */
@@ -1922,6 +1943,9 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
                /* Mark the item as fully known */
                o_ptr->ident |= (IDENT_MENTAL);
 
+               /* For being treated as random artifact in screen_object() */
+               o_ptr->art_name = quark_add("");
+
                (void)screen_object(o_ptr, 0L);
 
                if (!get_string(ask_msg, dummy_name, sizeof dummy_name)
@@ -1973,17 +1997,115 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
 }
 
 
+int activation_index(object_type *o_ptr)
+{
+       /* Give priority to weaponsmith's essential activations */
+       if (object_is_smith(o_ptr))
+       {
+               switch (o_ptr->xtra3-1)
+               {
+               case ESSENCE_TMP_RES_ACID: return ACT_RESIST_ACID;
+               case ESSENCE_TMP_RES_ELEC: return ACT_RESIST_ELEC;
+               case ESSENCE_TMP_RES_FIRE: return ACT_RESIST_FIRE;
+               case ESSENCE_TMP_RES_COLD: return ACT_RESIST_COLD;
+               case TR_IMPACT: return ACT_QUAKE;
+               }
+       }
+
+       if (object_is_fixed_artifact(o_ptr))
+       {
+               if (have_flag(a_info[o_ptr->name1].flags, TR_ACTIVATE))
+               {
+                       return a_info[o_ptr->name1].act_idx;
+               }
+       }
+       if (object_is_ego(o_ptr))
+       {
+               if (have_flag(e_info[o_ptr->name2].flags, TR_ACTIVATE))
+               {
+                       return e_info[o_ptr->name2].act_idx;
+               }
+       }
+       if (!object_is_random_artifact(o_ptr))
+       {
+               if (have_flag(k_info[o_ptr->k_idx].flags, TR_ACTIVATE))
+               {
+                       return k_info[o_ptr->k_idx].act_idx;
+               }
+       }
+
+       return o_ptr->xtra2;
+}
+
+const activation_type* find_activation_info(object_type *o_ptr)
+{
+       const int index = activation_index(o_ptr);
+       const activation_type* p;
+
+       for (p = activation_info; p->flag != NULL; ++ p) {
+               if (p->index == index)
+               {
+                       return p;
+               }
+       }
+
+       return NULL;
+}
+
+
+/* Dragon breath activation */
+static bool activate_dragon_breath(object_type *o_ptr)
+{
+       u32b flgs[4]; /* for resistance flags */
+       int type[20];
+       cptr name[20];
+       int i, dir, t, n = 0;
+
+       if (!get_aim_dir(&dir)) return FALSE;
+
+       object_flags(o_ptr, flgs);
+
+       for (i = 0; dragonbreath_info[i].flag != 0; i++)
+       {
+               if (have_flag(flgs, dragonbreath_info[i].flag))
+               {
+                       type[n] = dragonbreath_info[i].type;
+                       name[n] = dragonbreath_info[i].name;
+                       n++;
+               }
+       }
+
+       /* Paranoia */
+       if (n == 0) return FALSE;
+
+       /* Stop speaking */
+       if (music_singing_any()) stop_singing();
+       if (hex_spelling_any()) stop_hex_spell_all();
+
+       t = randint0(n);
+       msg_format(_("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£", "You breathe %s."), name[t]);
+       fire_ball(type[t], dir, 250, -4);
+
+       return TRUE;
+}
+
+
 bool activate_random_artifact(object_type *o_ptr)
 {
        int plev = p_ptr->lev;
        int k, dir, dummy = 0;
        cptr name = k_name + k_info[o_ptr->k_idx].name;
+       const activation_type* const act_ptr = find_activation_info(o_ptr);
 
        /* Paranoia */
-       if (!o_ptr->xtra2) return FALSE;
+       if (!act_ptr) {
+               /* Maybe forgot adding information to activation_info table ? */
+               msg_print("Activation information is not found.");
+               return FALSE;
+       }
 
        /* Activate for attack */
-       switch (o_ptr->xtra2)
+       switch (act_ptr->index)
        {
                case ACT_SUNLIGHT:
                {
@@ -1993,8 +2115,7 @@ bool activate_random_artifact(object_type *o_ptr)
 #else
                        msg_print("A line of sunlight appears.");
 #endif
-                       (void)lite_line(dir);
-                       o_ptr->timeout = 10;
+                       (void)lite_line(dir, damroll(6, 8));
                        break;
                }
 
@@ -2007,7 +2128,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_MISSILE, dir, damroll(2, 6));
-                       o_ptr->timeout = 2;
                        break;
                }
 
@@ -2020,7 +2140,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_POIS, dir, 12, 3);
-                       o_ptr->timeout = randint0(4) + 4;
                        break;
                }
 
@@ -2033,7 +2152,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_ELEC, dir, damroll(4, 8));
-                       o_ptr->timeout = randint0(5) + 5;
                        break;
                }
 
@@ -2046,7 +2164,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_ACID, dir, damroll(5, 8));
-                       o_ptr->timeout = randint0(6) + 6;
                        break;
                }
 
@@ -2059,7 +2176,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_COLD, dir, damroll(6, 8));
-                       o_ptr->timeout = randint0(7) + 7;
                        break;
                }
 
@@ -2072,7 +2188,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_FIRE, dir, damroll(9, 8));
-                       o_ptr->timeout = randint0(8) + 8;
                        break;
                }
 
@@ -2085,7 +2200,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_COLD, dir, 48, 2);
-                       o_ptr->timeout = randint0(6) + 6;
                        break;
                }
 
@@ -2098,7 +2212,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_FIRE, dir, 72, 2);
-                       o_ptr->timeout = randint0(9) + 9;
                        break;
                }
 
@@ -2111,7 +2224,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        if (drain_life(dir, 100))
-                       o_ptr->timeout = randint0(100) + 100;
                        break;
                }
 
@@ -2124,7 +2236,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_COLD, dir, 100, 2);
-                       o_ptr->timeout = randint0(12) + 12;
                        break;
                }
 
@@ -2137,7 +2248,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_ELEC, dir, 100, 3);
-                       o_ptr->timeout = randint0(12) + 12;
                        break;
                }
 
@@ -2150,7 +2260,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_FIRE, dir, 120, 3);
-                       o_ptr->timeout = 15;
                        break;
                }
 
@@ -2163,7 +2272,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        drain_life(dir, 120);
-                       o_ptr->timeout = 400;
                        break;
                }
 
@@ -2175,7 +2283,6 @@ bool activate_random_artifact(object_type *o_ptr)
                                if (drain_life(dir, 50))
                                hp_player(50);
                        }
-                       o_ptr->timeout = 400;
                        break;
                }
 
@@ -2188,7 +2295,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_ARROW, dir, 150);
-                       o_ptr->timeout = randint0(90) + 90;
                        break;
                }
 
@@ -2201,7 +2307,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_FIRE, dir, 300, 3);
-                       o_ptr->timeout = randint0(225) + 225;
                        break;
                }
 
@@ -2214,7 +2319,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_COLD, dir, 400, 3);
-                       o_ptr->timeout = randint0(325) + 325;
                        break;
                }
 
@@ -2227,7 +2331,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_ELEC, dir, 500, 3);
-                       o_ptr->timeout = randint0(425) + 425;
                        break;
                }
 
@@ -2252,7 +2355,6 @@ bool activate_random_artifact(object_type *o_ptr)
                                                py_attack(y, x, 0);
                                }
                        }
-                       o_ptr->timeout = 250;
                        break;
                }
 
@@ -2264,8 +2366,6 @@ bool activate_random_artifact(object_type *o_ptr)
                                if (drain_life(dir, 100))
                                hp_player(100);
                        }
-
-                       o_ptr->timeout = 400;
                        break;
                }
 
@@ -2278,7 +2378,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows in scintillating colours...");
 #endif
                        call_chaos();
-                       o_ptr->timeout = 350;
                        break;
                }
 
@@ -2291,7 +2390,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("You launch a rocket!");
 #endif
                        fire_ball(GF_ROCKET, dir, 250 + plev*3, 2);
-                       o_ptr->timeout = 400;
                        break;
                }
 
@@ -2303,7 +2401,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It floods the area with goodness...");
 #endif
                        dispel_evil(p_ptr->lev * 5);
-                       o_ptr->timeout = randint0(100) + 100;
                        break;
                }
 
@@ -2315,8 +2412,7 @@ bool activate_random_artifact(object_type *o_ptr)
 #else
                        msg_print("You breathe the elements.");
 #endif
-                       fire_ball(GF_MISSILE, dir, 300, 4);
-                       o_ptr->timeout = 500;
+                       fire_ball(GF_MISSILE, dir, 300, -4);
                        break;
                }
 
@@ -2328,7 +2424,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It floods the area with evil...");
 #endif
                        dispel_good(p_ptr->lev * 5);
-                       o_ptr->timeout = randint0(100) + 100;
                        break;
                }
 
@@ -2341,7 +2436,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_bolt(GF_ARROW, dir, 150);
-                       o_ptr->timeout = randint0(90) + 90;
                        break;
                }
 
@@ -2354,7 +2448,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_WATER, dir, 200, 3);
-                       o_ptr->timeout = 250;
                        break;
                }
 
@@ -2367,7 +2460,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        fire_ball(GF_DARK, dir, 250, 4);
-                       o_ptr->timeout = randint0(150) + 150;
                        break;
                }
 
@@ -2379,8 +2471,7 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_format("The %s glows pale...", name);
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
-                       fire_ball(GF_MANA, dir, 400, 4);
-                       o_ptr->timeout = randint0(250) + 250;
+                       fire_ball(GF_MANA, dir, 250, 4);
                        break;
                }
 
@@ -2392,7 +2483,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("You exterminate small life.");
 #endif
                        (void)dispel_monsters(4);
-                       o_ptr->timeout = randint0(55) + 55;
                        break;
                }
 
@@ -2405,7 +2495,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        fire_ball(GF_LITE, 0, 300, 6);
                        confuse_monsters(3 * p_ptr->lev / 2);
-                       o_ptr->timeout = 250;
                        break;
                }
 
@@ -2418,7 +2507,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        ring_of_power(dir);
-                       o_ptr->timeout = randint0(450) + 450;
                        break;
                }
 
@@ -2449,7 +2537,6 @@ bool activate_random_artifact(object_type *o_ptr)
                                                        (PROJECT_THRU | PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
                        }
 
-                       o_ptr->timeout = 1000;
                        break;
                }
 
@@ -2461,7 +2548,7 @@ bool activate_random_artifact(object_type *o_ptr)
 #else
                        msg_print("You breathe the elements.");
 #endif
-                       fire_ball(GF_MISSILE, dir, 300, 4);
+                       fire_ball(GF_MISSILE, dir, 300, -4);
 #ifdef JP
                        msg_print("³»¤¬ÍÍ¡¹¤Ê¿§¤Ëµ±¤¤¤¿...");
 #else
@@ -2476,7 +2563,38 @@ bool activate_random_artifact(object_type *o_ptr)
                        (void)set_oppose_fire(randint1(50) + 50, FALSE);
                        (void)set_oppose_cold(randint1(50) + 50, FALSE);
                        (void)set_oppose_pois(randint1(50) + 50, FALSE);
-                       o_ptr->timeout = 400;
+                       break;
+               }
+               case ACT_BA_ACID_1:
+               {
+                       if (!get_aim_dir(&dir)) return FALSE;
+                       fire_ball(GF_ACID, dir, 100, 2);
+                       break;
+               }
+
+               case ACT_BR_FIRE:
+               {
+                       if (!get_aim_dir(&dir)) return FALSE;
+                       fire_ball(GF_FIRE, dir, 200, -2);
+                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
+                       {
+                               (void)set_oppose_fire(randint1(20) + 20, FALSE);
+                       }
+                       break;
+               }
+               case ACT_BR_COLD:
+               {
+                       if (!get_aim_dir(&dir)) return FALSE;
+                       fire_ball(GF_COLD, dir, 200, -2);
+                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
+                       {
+                               (void)set_oppose_cold(randint1(20) + 20, FALSE);
+                       }
+                       break;
+               }
+               case ACT_BR_DRAGON:
+               {
+                       if (!activate_dragon_breath(o_ptr)) return FALSE;
                        break;
                }
 
@@ -2491,7 +2609,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
                        confuse_monster(dir, 20);
-                       o_ptr->timeout = 15;
                        break;
                }
 
@@ -2503,21 +2620,18 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows deep blue...");
 #endif
                        sleep_monsters_touch();
-                       o_ptr->timeout = 55;
                        break;
                }
 
                case ACT_QUAKE:
                {
-                       earthquake(py, px, 10);
-                       o_ptr->timeout = 50;
+                       earthquake(py, px, 5);
                        break;
                }
 
                case ACT_TERROR:
                {
                        turn_monsters(40 + p_ptr->lev);
-                       o_ptr->timeout = 3 * (p_ptr->lev + 10);
                        break;
                }
 
@@ -2525,7 +2639,6 @@ bool activate_random_artifact(object_type *o_ptr)
                {
                        if (!get_aim_dir(&dir)) return FALSE;
                        (void)fire_beam(GF_AWAY_ALL, dir, plev);
-                       o_ptr->timeout = 200;
                        break;
                }
 
@@ -2539,7 +2652,6 @@ bool activate_random_artifact(object_type *o_ptr)
                                msg_print("The power of the artifact banishes evil!");
 #endif
                        }
-                       o_ptr->timeout = 250 + randint1(250);
                        break;
                }
 
@@ -2551,7 +2663,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows deep blue...");
 #endif
                        (void)symbol_genocide(200, TRUE);
-                       o_ptr->timeout = 500;
                        break;
                }
 
@@ -2563,7 +2674,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It lets out a long, shrill note...");
 #endif
                        (void)mass_genocide(200, TRUE);
-                       o_ptr->timeout = 1000;
                        break;
                }
 
@@ -2577,7 +2687,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("You wind a mighty blast; your enemies tremble!");
 #endif
                        (void)turn_monsters((3 * p_ptr->lev / 2) + 10);
-                       o_ptr->timeout = randint0(40) + 40;
                        break;
                }
 
@@ -2609,7 +2718,6 @@ bool activate_random_artifact(object_type *o_ptr)
                {
                        if (!get_aim_dir(&dir)) return FALSE;
                        (void)charm_animal(dir, plev * 2);
-                       o_ptr->timeout = 200;
                        break;
                }
 
@@ -2617,7 +2725,6 @@ bool activate_random_artifact(object_type *o_ptr)
                {
                        if (!get_aim_dir(&dir)) return FALSE;
                        (void)control_one_undead(dir, plev * 2);
-                       o_ptr->timeout = 333;
                        break;
                }
 
@@ -2625,28 +2732,24 @@ bool activate_random_artifact(object_type *o_ptr)
                {
                        if (!get_aim_dir(&dir)) return FALSE;
                        (void)charm_monster(dir, plev * 2);
-                       o_ptr->timeout = 400;
                        break;
                }
 
                case ACT_CHARM_ANIMALS:
                {
                        (void)charm_animals(plev * 2);
-                       o_ptr->timeout = 500;
                        break;
                }
 
                case ACT_CHARM_OTHERS:
                {
                        charm_monsters(plev * 2);
-                       o_ptr->timeout = 750;
                        break;
                }
 
                case ACT_SUMMON_ANIMAL:
                {
                        (void)summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
-                       o_ptr->timeout = 200 + randint1(300);
                        break;
                }
 
@@ -2658,7 +2761,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("You summon a phantasmal servant.");
 #endif
                        (void)summon_specific(-1, py, px, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
-                       o_ptr->timeout = 200 + randint1(200);
                        break;
                }
 
@@ -2692,7 +2794,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        }
 
-                       o_ptr->timeout = 750;
                        break;
                }
 
@@ -2726,7 +2827,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        }
 
-                       o_ptr->timeout = 666 + randint1(333);
                        break;
                }
 
@@ -2763,7 +2863,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        }
 
-                       o_ptr->timeout = 666 + randint1(333);
                        break;
                }
 
@@ -2793,7 +2892,6 @@ bool activate_random_artifact(object_type *o_ptr)
 
                        }
 
-                       o_ptr->timeout = 300 + randint1(150);
                        break;
                }
 
@@ -2805,7 +2903,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("You summon the Legion of the Dawn.");
 #endif
                        (void)summon_specific(-1, py, px, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
-                       o_ptr->timeout = 500 + randint1(500);
                        break;
                }
 
@@ -2831,7 +2928,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        }
 
-                       o_ptr->timeout = 300 + randint1(150);
                        break;
                }
 
@@ -2852,7 +2948,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        (void)set_afraid(0);
                        (void)set_hero(randint1(25) + 25, FALSE);
                        (void)hp_player(777);
-                       o_ptr->timeout = 300;
                        break;
                }
 
@@ -2860,7 +2955,6 @@ bool activate_random_artifact(object_type *o_ptr)
                {
                        (void)set_afraid(0);
                        (void)hp_player(30);
-                       o_ptr->timeout = 10;
                        break;
                }
 
@@ -2873,7 +2967,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        hp_player(damroll(4, 8));
                        (void)set_cut((p_ptr->cut / 2) - 50);
-                       o_ptr->timeout = randint0(3) + 3;
                        break;
                }
 
@@ -2886,7 +2979,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        (void)set_afraid(0);
                        (void)set_poisoned(0);
-                       o_ptr->timeout = 5;
                        break;
                }
 
@@ -2898,7 +2990,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows a deep red...");
 #endif
                        restore_level();
-                       o_ptr->timeout = 450;
                        break;
                }
 
@@ -2916,7 +3007,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        (void)do_res_stat(A_CON);
                        (void)do_res_stat(A_CHR);
                        (void)restore_level();
-                       o_ptr->timeout = 750;
                        break;
                }
 
@@ -2931,7 +3021,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        (void)hp_player(700);
                        (void)set_cut(0);
-                       o_ptr->timeout = 250;
                        break;
                }
 
@@ -2946,7 +3035,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        (void)hp_player(1000);
                        (void)set_cut(0);
-                       o_ptr->timeout = 888;
                        break;
                }
 
@@ -2964,7 +3052,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        (void)set_cut(0);
                        (void)set_image(0);
 
-                       o_ptr->timeout = 100;
                        break;
                }
 
@@ -3009,7 +3096,6 @@ bool activate_random_artifact(object_type *o_ptr)
                                p_ptr->window |= (PW_PLAYER);
                                p_ptr->window |= (PW_SPELL);
                        }
-                       o_ptr->timeout = 777;
                        break;
                }
 
@@ -3018,16 +3104,17 @@ bool activate_random_artifact(object_type *o_ptr)
                case ACT_ESP:
                {
                        (void)set_tim_esp(randint1(30) + 25, FALSE);
-                       o_ptr->timeout = 200;
                        break;
                }
 
                case ACT_BERSERK:
                {
                        (void)set_afraid(0);
+                       (void)set_shero(randint1(25) + 25, FALSE);
+                       /* (void)set_afraid(0);
                        (void)set_hero(randint1(50) + 50, FALSE);
                        (void)set_blessed(randint1(50) + 50, FALSE);
-                       o_ptr->timeout = 100 + randint1(100);
+                       o_ptr->timeout = 100 + randint1(100); */
                        break;
                }
 
@@ -3040,7 +3127,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        k = 3 * p_ptr->lev;
                        (void)set_protevil(randint1(25) + k, FALSE);
-                       o_ptr->timeout = randint0(200) + 200;
                        break;
                }
 
@@ -3056,7 +3142,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        (void)set_oppose_fire(randint1(40) + 40, FALSE);
                        (void)set_oppose_cold(randint1(40) + 40, FALSE);
                        (void)set_oppose_pois(randint1(40) + 40, FALSE);
-                       o_ptr->timeout = 200;
                        break;
                }
 
@@ -3068,7 +3153,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows bright green...");
 #endif
                        (void)set_fast(randint1(20) + 20, FALSE);
-                       o_ptr->timeout = randint0(100) + 100;
                        break;
                }
 
@@ -3080,21 +3164,18 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows brightly...");
 #endif
                        (void)set_fast(randint1(75) + 75, FALSE);
-                       o_ptr->timeout = randint0(100) + 100;
                        break;
                }
 
                case ACT_WRAITH:
                {
                        set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
-                       o_ptr->timeout = 1000;
                        break;
                }
 
                case ACT_INVULN:
                {
                        (void)set_invuln(randint1(8) + 8, FALSE);
-                       o_ptr->timeout = 1000;
                        break;
                }
 
@@ -3103,7 +3184,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        (void)set_afraid(0);
                        set_hero(randint1(25)+25, FALSE);
                        hp_player(10);
-                       o_ptr->timeout = randint0(30) + 30;
                        break;
                }
 
@@ -3113,7 +3193,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        hp_player(10);
                        set_afraid(0);
                        set_hero(randint1(50) + 50, FALSE);
-                       o_ptr->timeout = randint0(200) + 100;
                        break;
                }
 
@@ -3124,8 +3203,12 @@ bool activate_random_artifact(object_type *o_ptr)
 #else
                        msg_format("The %s grows black.", name);
 #endif
+                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ACID))
+                       {
+                               if (!get_aim_dir(&dir)) return FALSE;
+                               fire_ball(GF_ACID, dir, 100, 2);
+                       }
                        (void)set_oppose_acid(randint1(20) + 20, FALSE);
-                       o_ptr->timeout = 40 + randint1(40);
                        break;
                }
 
@@ -3136,8 +3219,12 @@ bool activate_random_artifact(object_type *o_ptr)
 #else
                        msg_format("The %s grows red.", name);
 #endif
+                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES))
+                       {
+                               if (!get_aim_dir(&dir)) return FALSE;
+                               fire_ball(GF_FIRE, dir, 100, 2);
+                       }
                        (void)set_oppose_fire(randint1(20) + 20, FALSE);
-                       o_ptr->timeout = 40 + randint1(40);
                        break;
                }
 
@@ -3148,8 +3235,12 @@ bool activate_random_artifact(object_type *o_ptr)
 #else
                        msg_format("The %s grows white.", name);
 #endif
+                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE))
+                       {
+                               if (!get_aim_dir(&dir)) return FALSE;
+                               fire_ball(GF_COLD, dir, 100, 2);
+                       }
                        (void)set_oppose_cold(randint1(20) + 20, FALSE);
-                       o_ptr->timeout = 40 + randint1(40);
                        break;
                }
 
@@ -3160,8 +3251,12 @@ bool activate_random_artifact(object_type *o_ptr)
 #else
                        msg_format("The %s grows blue.", name);
 #endif
-                       (void)set_oppose_cold(randint1(20) + 20, FALSE);
-                       o_ptr->timeout = 40 + randint1(40);
+                       if ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ELEC))
+                       {
+                               if (!get_aim_dir(&dir)) return FALSE;
+                               fire_ball(GF_ELEC, dir, 100, 2);
+                       }
+                       (void)set_oppose_elec(randint1(20) + 20, FALSE);
                        break;
                }
 
@@ -3172,8 +3267,7 @@ bool activate_random_artifact(object_type *o_ptr)
 #else
                        msg_format("The %s grows green.", name);
 #endif
-                       (void)set_oppose_cold(randint1(20) + 20, FALSE);
-                       o_ptr->timeout = 40 + randint1(40);
+                       (void)set_oppose_pois(randint1(20) + 20, FALSE);
                        break;
                }
 
@@ -3187,7 +3281,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_format("The %s wells with clear light...", name);
 #endif
                        lite_area(damroll(2, 15), 3);
-                       o_ptr->timeout = randint0(10) + 10;
                        break;
                }
 
@@ -3200,7 +3293,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                        map_area(DETECT_RAD_MAP);
                        lite_area(damroll(2, 15), 3);
-                       o_ptr->timeout = randint0(50) + 50;
                        break;
                }
 
@@ -3214,7 +3306,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("An image forms in your mind...");
 #endif
                        detect_all(DETECT_RAD_DEFAULT);
-                       o_ptr->timeout = randint0(55) + 55;
                        break;
                }
 
@@ -3228,7 +3319,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        detect_all(DETECT_RAD_DEFAULT);
                        probing();
                        identify_fully(FALSE);
-                       o_ptr->timeout = 100;
                        break;
                }
 
@@ -3240,14 +3330,12 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows yellow...");
 #endif
                        identify_fully(FALSE);
-                       o_ptr->timeout = 75;
                        break;
                }
 
                case ACT_ID_PLAIN:
                {
                        if (!ident_spell(FALSE)) return FALSE;
-                       o_ptr->timeout = 10;
                        break;
                }
 
@@ -3259,7 +3347,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows bright red...");
 #endif
                        explosive_rune();
-                       o_ptr->timeout = 200;
                        break;
                }
 
@@ -3271,14 +3358,12 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows light blue...");
 #endif
                        warding_glyph();
-                       o_ptr->timeout = 400;
                        break;
                }
 
                case ACT_SATIATE:
                {
                        (void)set_food(PY_FOOD_MAX - 1);
-                       o_ptr->timeout = 200;
                        break;
                }
 
@@ -3290,7 +3375,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows bright red...");
 #endif
                        destroy_doors_touch();
-                       o_ptr->timeout = 10;
                        break;
                }
 
@@ -3302,15 +3386,13 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It pulsates...");
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
-                       wall_to_mud(dir);
-                       o_ptr->timeout = 3;
+                       wall_to_mud(dir, 20 + randint1(30));
                        break;
                }
 
                case ACT_RECHARGE:
                {
                        recharge(130);
-                       o_ptr->timeout = 70;
                        break;
                }
 
@@ -3322,7 +3404,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows bright yellow...");
 #endif
                        (void)alchemy();
-                       o_ptr->timeout = 500;
                        break;
                }
 
@@ -3334,7 +3415,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("You open a dimensional gate. Choose a destination.");
 #endif
                        if (!dimension_door()) return FALSE;
-                       o_ptr->timeout = 100;
                        break;
                }
 
@@ -3347,7 +3427,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It twists space around you...");
 #endif
                        teleport_player(100, 0L);
-                       o_ptr->timeout = 25;
                        break;
                }
 
@@ -3359,7 +3438,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It glows soft white...");
 #endif
                        if (!word_of_recall()) return FALSE;
-                       o_ptr->timeout = 200;
                        break;
                }
 
@@ -3392,7 +3470,6 @@ bool activate_random_artifact(object_type *o_ptr)
                                (void)word_of_recall();
                        }
 
-                       o_ptr->timeout = randint0(20) + 20;
                        break;
                }
 
@@ -3405,7 +3482,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_format("You stretched your %s.", name);
 #endif
                        fetch(dir, 500, TRUE);
-                       o_ptr->timeout = randint0(25) + 25;
                        break;
                }
 
@@ -3439,7 +3515,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #endif
                                }
                        }
-                       o_ptr->timeout = 200;
                        break;
                }
 
@@ -3469,7 +3544,6 @@ bool activate_random_artifact(object_type *o_ptr)
                                        p_ptr->leaving = TRUE;
                                }
                        }
-                       o_ptr->timeout = 35;
                        break;
                }
 
@@ -3500,7 +3574,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_format("Your %s glows deep red...", name);
 #endif
                        (void)brand_bolts();
-                       o_ptr->timeout = 999;
                        break;
                }
 
@@ -3512,7 +3585,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_format("The %s gleams with blinding light...", name);
 #endif
                        if (!recharge(1000)) return FALSE;
-                       o_ptr->timeout = 200;
                        break;
                }
 
@@ -3577,7 +3649,6 @@ bool activate_random_artifact(object_type *o_ptr)
 #else
                                take_hit(DAMAGE_LOSELIFE, damroll(4, 10), "perilous secrets", -1);
 #endif
-                       o_ptr->timeout = 0;
                        break;
                }
 
@@ -3591,11 +3662,84 @@ bool activate_random_artifact(object_type *o_ptr)
                        (void)set_afraid(0);
                        (void)set_hero(randint1(20) + 20, FALSE);
                        dispel_evil(p_ptr->lev * 3);
-                       o_ptr->timeout = 100 + randint1(100);
                        break;
                }
 
+               case ACT_PHASE_DOOR:
+               {
+                       teleport_player(10, 0L);
+                       break;
+               }
+
+               case ACT_DETECT_ALL_MONS:
+               {
+                       (void)detect_monsters_invis(255);
+                       (void)detect_monsters_normal(255);
+                       break;
+               }
+
+               case ACT_ULTIMATE_RESIST:
+               {
+                       int v = randint1(25)+25;
+                       (void)set_afraid(0);
+                       (void)set_hero(v, FALSE);
+                       (void)hp_player(10);
+                       (void)set_blessed(v, FALSE);
+                       (void)set_oppose_acid(v, FALSE);
+                       (void)set_oppose_elec(v, FALSE);
+                       (void)set_oppose_fire(v, FALSE);
+                       (void)set_oppose_cold(v, FALSE);
+                       (void)set_oppose_pois(v, FALSE);
+                       (void)set_ultimate_res(v, FALSE);
+                       break;
+               }
+
+
                /* Unique activation */
+               case ACT_CAST_OFF:
+               {
+                       int inv, o_idx, t;
+                       char o_name[MAX_NLEN];
+                       object_type forge;
+
+                       /* Cast off activated item */
+                       for (inv = INVEN_RARM; inv <= INVEN_FEET; inv++)
+                       {
+                               if (o_ptr == &inventory[inv]) break;
+                       }
+
+                       /* Paranoia */
+                       if (inv > INVEN_FEET) return FALSE;
+
+                       object_copy(&forge, o_ptr);
+                       inven_item_increase(inv, (0 - o_ptr->number));
+                       inven_item_optimize(inv);
+                       o_idx = drop_near(&forge, 0, py, px);
+                       o_ptr = &o_list[o_idx];
+
+                       object_desc(o_name, o_ptr, OD_NAME_ONLY);
+                       msg_format(_("%s¤ò椮¼Î¤Æ¤¿¡£", "You cast off %s."), o_name);
+
+                       /* Get effects */
+                       msg_print(_("¡Ödz¤¨¾å¤¬¤ì²¶¤Î¾®±§Ã衪¡×", "You say, 'Burn up my cosmo!"));
+                       t = 20 + randint1(20);
+                       (void)set_blind(p_ptr->blind + t);
+                       (void)set_afraid(0);
+                       (void)set_tim_esp(p_ptr->tim_esp + t, FALSE);
+                       (void)set_tim_regen(p_ptr->tim_regen + t, FALSE);
+                       (void)set_hero(p_ptr->hero + t, FALSE);
+                       (void)set_blessed(p_ptr->blessed + t, FALSE);
+                       (void)set_fast(p_ptr->fast + t, FALSE);
+                       (void)set_shero(p_ptr->shero + t, FALSE);
+                       if (p_ptr->pclass == CLASS_FORCETRAINER)
+                       {
+                               p_ptr->magic_num1[0] = plev * 5 + 190;
+                               msg_print(_("µ¤¤¬ÇúȯÀ£Á°¤Ë¤Ê¤Ã¤¿¡£", "Your force are immediatly before explosion."));
+                       }
+
+                       break;
+               }
+
                case ACT_FISHING:
                {
                        int x, y;
@@ -3693,7 +3837,6 @@ bool activate_random_artifact(object_type *o_ptr)
                                msg_print("Nothing happen.");
 #endif
                        }
-                       o_ptr->timeout = randint0(150) + 150;
                        break;
                }
 
@@ -3736,7 +3879,6 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("Your scythe glows brightly!");
 #endif
                        get_bloody_moon_flags(o_ptr);
-                       o_ptr->timeout = 3333;
                        if (p_ptr->prace == RACE_ANDROID) calc_android_exp();
                        p_ptr->update |= (PU_BONUS | PU_HP);
                        break;
@@ -3785,21 +3927,47 @@ bool activate_random_artifact(object_type *o_ptr)
 
                        for (i = 0; i < num; i++)
                                project(0, p_ptr->lev/20+1, ty, tx, p_ptr->lev*p_ptr->lev*6/50, GF_ROCKET, flg, -1);
-                       o_ptr->timeout = 15;
                        break;
                }
 
                default:
                {
 #ifdef JP
-                       msg_format("Unknown activation effect: %d.", o_ptr->xtra2);
+                       msg_format("Unknown activation effect: %d.", act_ptr->index);
 #else
-                       msg_format("Unknown activation effect: %d.", o_ptr->xtra2);
+                       msg_format("Unknown activation effect: %d.", act_ptr->index);
 #endif
                        return FALSE;
                }
        }
 
+       /* Set activation timeout */
+       if (act_ptr->timeout.constant >= 0) {
+               o_ptr->timeout = act_ptr->timeout.constant;
+               if (act_ptr->timeout.dice > 0) {
+                       o_ptr->timeout += randint1(act_ptr->timeout.dice);
+               }
+       } else {
+               /* Activations that have special timeout */
+               switch (act_ptr->index) {
+               case ACT_BR_FIRE:
+                       o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_FLAMES)) ? 200 : 250;
+                       break;
+               case ACT_BR_COLD:
+                       o_ptr->timeout = ((o_ptr->tval == TV_RING) && (o_ptr->sval == SV_RING_ICE)) ? 200 : 250;
+                       break;
+               case ACT_TERROR:
+                       o_ptr->timeout = 3 * (p_ptr->lev + 10);
+                       break;
+               case ACT_MURAMASA:
+                       /* Nothing to do */
+                       break;
+               default:
+                       msg_format("Special timeout is not implemented: %d.", act_ptr->index);
+                       return FALSE;
+               }
+       }
+
        return TRUE;
 }
 
@@ -3942,7 +4110,6 @@ bool create_named_art(int a_idx, int y, int x)
        q_ptr->to_h = a_ptr->to_h;
        q_ptr->to_d = a_ptr->to_d;
        q_ptr->weight = a_ptr->weight;
-       q_ptr->xtra2 = a_ptr->act_idx;
 
        /* Hack -- extract the "cursed" flag */
        if (a_ptr->gen_flags & TRG_CURSED) q_ptr->curse_flags |= (TRC_CURSED);