OSDN Git Service

New Magic-Eater's class power, 'Powerful Activation' is added
[hengband/hengband.git] / src / artifact.c
index bc1c2c8..07c800d 100644 (file)
@@ -1975,7 +1975,7 @@ bool create_artifact(object_type *o_ptr, bool a_scroll)
 }
 
 
-static const activation_type* find_activation_info(const object_type *o_ptr)
+const activation_type* find_activation_info(const object_type *o_ptr)
 {
        const activation_type* p;
 
@@ -1989,6 +1989,44 @@ static const activation_type* find_activation_info(const object_type *o_ptr)
        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;
@@ -2010,7 +2048,7 @@ bool activate_random_artifact(object_type *o_ptr)
 #else
                        msg_print("A line of sunlight appears.");
 #endif
-                       (void)lite_line(dir);
+                       (void)lite_line(dir, damroll(6, 8));
                        break;
                }
 
@@ -2307,7 +2345,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);
                        break;
                }
 
@@ -2443,7 +2481,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
@@ -2487,6 +2525,11 @@ bool activate_random_artifact(object_type *o_ptr)
                        }
                        break;
                }
+               case ACT_BR_DRAGON:
+               {
+                       if (!activate_dragon_breath(o_ptr)) return FALSE;
+                       break;
+               }
 
                /* Activate for other offensive action */
 
@@ -3093,6 +3136,11 @@ 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);
                        break;
                }
@@ -3104,6 +3152,11 @@ 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);
                        break;
                }
@@ -3115,6 +3168,11 @@ 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);
                        break;
                }
@@ -3126,6 +3184,11 @@ bool activate_random_artifact(object_type *o_ptr)
 #else
                        msg_format("The %s grows blue.", name);
 #endif
+                       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;
                }
@@ -3256,7 +3319,7 @@ bool activate_random_artifact(object_type *o_ptr)
                        msg_print("It pulsates...");
 #endif
                        if (!get_aim_dir(&dir)) return FALSE;
-                       wall_to_mud(dir);
+                       wall_to_mud(dir, 20 + randint1(30));
                        break;
                }
 
@@ -3566,6 +3629,50 @@ bool activate_random_artifact(object_type *o_ptr)
 
 
                /* 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 %d."), 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;
@@ -3768,14 +3875,20 @@ bool activate_random_artifact(object_type *o_ptr)
        }
 
        /* Set activation timeout */
-        act_ptr = find_activation_info(o_ptr);
+       act_ptr = find_activation_info(o_ptr);
+
+       if (!act_ptr) {
+               /* Maybe forgot adding information to activation_info table ? */
+               msg_format("Activation information is not found: %d.", o_ptr->xtra2);
+               return FALSE;
+       }
 
-        if (act_ptr->timeout.constant >= 0) {
+       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 {
+       } else {
                /* Activations that have special timeout */
                switch (o_ptr->xtra2) {
                case ACT_BR_FIRE:
@@ -3792,9 +3905,9 @@ bool activate_random_artifact(object_type *o_ptr)
                        break;
                default:
                        msg_format("Special timeout is not implemented: %d.", o_ptr->xtra2);
-                       break;
+                       return FALSE;
                }
-        }
+       }
 
        return TRUE;
 }