OSDN Git Service

typo修正。何年気がつかなかったんだろ、これ。
[hengband/hengband.git] / src / cmd6.c
index c8bd7f4..5860d15 100644 (file)
@@ -1,15 +1,15 @@
 /* File: cmd6.c */
 
-/* Purpose: Object commands */
-
 /*
- * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
+ * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
  *
- * This software may be copied and distributed for educational, research, and
- * not for profit purposes provided that this copyright and statement are
- * included in all such copies.
+ * This software may be copied and distributed for educational, research,
+ * and not for profit purposes provided that this copyright and statement
+ * are included in all such copies.  Other copyrights may also apply.
  */
 
+/* Purpose: Object commands */
+
 #include "angband.h"
 
 
@@ -59,6 +59,8 @@ static void do_cmd_eat_food_aux(int item)
        int ident, lev;
        object_type *o_ptr;
 
+       if (music_singing_any()) stop_singing();
+
        /* Get the item (in the pack) */
        if (item >= 0)
        {
@@ -81,7 +83,7 @@ static void do_cmd_eat_food_aux(int item)
        ident = FALSE;
 
        /* Object level */
-       lev = get_object_level(o_ptr);
+       lev = k_info[o_ptr->k_idx].level;
 
        if (o_ptr->tval == TV_FOOD)
        {
@@ -90,7 +92,7 @@ static void do_cmd_eat_food_aux(int item)
                {
                        case SV_FOOD_POISON:
                        {
-                               if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
+                               if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
                                {
                                        if (set_poisoned(p_ptr->poisoned + randint0(10) + 10))
                                        {
@@ -378,7 +380,7 @@ static void do_cmd_eat_food_aux(int item)
        /* Combine / Reorder the pack (later) */
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
-       if (!(object_aware_p(o_ptr)))
+       if (!(object_is_aware(o_ptr)))
        {
                chg_virtue(V_KNOWLEDGE, -1);
                chg_virtue(V_PATIENCE, -1);
@@ -386,10 +388,10 @@ static void do_cmd_eat_food_aux(int item)
        }
 
        /* We have tried it */
-       object_tried(o_ptr);
+       if (o_ptr->tval == TV_FOOD) object_tried(o_ptr);
 
        /* The player is now aware of the object */
-       if (ident && !object_aware_p(o_ptr))
+       if (ident && !object_is_aware(o_ptr))
        {
                object_aware(o_ptr);
                gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
@@ -418,8 +420,141 @@ msg_print("
 #endif
 
        }
-       else if (p_ptr->prace == RACE_SKELETON)
+       else if ((prace_is_(RACE_SKELETON) ||
+                 prace_is_(RACE_GOLEM) ||
+                 prace_is_(RACE_ZOMBIE) ||
+                 prace_is_(RACE_SPECTRE)) &&
+                (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND))
        {
+               cptr staff;
+
+               if (o_ptr->tval == TV_STAFF &&
+                   (item < 0) && (o_ptr->number > 1))
+               {
+#ifdef JP
+                       msg_print("¤Þ¤º¤Ï¾ó¤ò½¦¤ï¤Ê¤±¤ì¤Ð¡£");
+#else
+                       msg_print("You must first pick up the staffs.");
+#endif
+                       return;
+               }
+
+#ifdef JP
+               staff = (o_ptr->tval == TV_STAFF) ? "¾ó" : "ËâË¡ËÀ";
+#else
+               staff = (o_ptr->tval == TV_STAFF) ? "staff" : "wand";
+#endif
+
+               /* "Eat" charges */
+               if (o_ptr->pval == 0)
+               {
+#ifdef JP
+                       msg_format("¤³¤Î%s¤Ë¤Ï¤â¤¦ËâÎϤ¬»Ä¤Ã¤Æ¤¤¤Ê¤¤¡£", staff);
+#else
+                       msg_format("The %s has no charges left.", staff);
+#endif
+
+                       o_ptr->ident |= (IDENT_EMPTY);
+
+                       /* Combine / Reorder the pack (later) */
+                       p_ptr->notice |= (PN_COMBINE | PN_REORDER);
+                       p_ptr->window |= (PW_INVEN);
+
+                       return;
+               }
+
+#ifdef JP
+               msg_format("¤¢¤Ê¤¿¤Ï%s¤ÎËâÎϤò¥¨¥Í¥ë¥®¡¼¸»¤È¤·¤ÆµÛ¼ý¤·¤¿¡£", staff);
+#else
+               msg_format("You absorb mana of the %s as your energy.", staff);
+#endif
+
+               /* Use a single charge */
+               o_ptr->pval--;
+
+               /* Eat a charge */
+               set_food(p_ptr->food + 5000);
+
+               /* XXX Hack -- unstack if necessary */
+               if (o_ptr->tval == TV_STAFF &&
+                   (item >= 0) && (o_ptr->number > 1))
+               {
+                       object_type forge;
+                       object_type *q_ptr;
+
+                       /* Get local object */
+                       q_ptr = &forge;
+
+                       /* Obtain a local object */
+                       object_copy(q_ptr, o_ptr);
+
+                       /* Modify quantity */
+                       q_ptr->number = 1;
+
+                       /* Restore the charges */
+                       o_ptr->pval++;
+
+                       /* Unstack the used item */
+                       o_ptr->number--;
+                       p_ptr->total_weight -= q_ptr->weight;
+                       item = inven_carry(q_ptr);
+
+                       /* Message */
+#ifdef JP
+                       msg_format("¾ó¤ò¤Þ¤È¤á¤Ê¤ª¤·¤¿¡£");
+#else
+                       msg_print("You unstack your staff.");
+#endif
+               }
+
+               /* Describe charges in the pack */
+               if (item >= 0)
+               {
+                       inven_item_charges(item);
+               }
+
+               /* Describe charges on the floor */
+               else
+               {
+                       floor_item_charges(0 - item);
+               }
+
+               /* Don't eat a staff/wand itself */
+               return;
+       }
+       else if ((prace_is_(RACE_DEMON) ||
+                (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
+                (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
+                 my_strchr("pht", r_info[o_ptr->pval].d_char)))
+       {
+               /* Drain vitality of humanoids */
+               char o_name[MAX_NLEN];
+
+               object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+
+#ifdef JP
+               msg_format("%s¤Ïdz¤¨¾å¤ê³¥¤Ë¤Ê¤Ã¤¿¡£ÀºÎϤòµÛ¼ý¤·¤¿µ¤¤¬¤¹¤ë¡£", o_name);
+#else
+               msg_format("%^s is burnt to ashes.  You absorb its vitality!", o_name);
+#endif
+               (void)set_food(PY_FOOD_MAX - 1);
+       }
+       else if (prace_is_(RACE_SKELETON))
+       {
+#if 0
+               if (o_ptr->tval == TV_SKELETON ||
+                   (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
+               {
+#ifdef JP
+                       msg_print("¤¢¤Ê¤¿¤Ï¹ü¤Ç¼«Ê¬¤ÎÂΤòÊä¤Ã¤¿¡£");
+#else
+                       msg_print("Your body absorbs the bone.");
+#endif
+                       set_food(p_ptr->food + 5000);
+               }
+               else 
+#endif
+
                if (!((o_ptr->sval == SV_FOOD_WAYBREAD) ||
                      (o_ptr->sval < SV_FOOD_BISCUIT)))
                {
@@ -449,12 +584,12 @@ msg_print("
 
                }
        }
-       else if ((p_ptr->prace == RACE_GOLEM) ||
-                (p_ptr->prace == RACE_ZOMBIE) ||
-                (p_ptr->prace == RACE_ENT) ||
-                (p_ptr->prace == RACE_DEMON) ||
-                (p_ptr->prace == RACE_ANDROID) ||
-                (p_ptr->prace == RACE_SPECTRE) ||
+       else if (prace_is_(RACE_GOLEM) ||
+                prace_is_(RACE_ZOMBIE) ||
+                prace_is_(RACE_ENT) ||
+                prace_is_(RACE_DEMON) ||
+                prace_is_(RACE_ANDROID) ||
+                prace_is_(RACE_SPECTRE) ||
                 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
        {
 #ifdef JP
@@ -465,8 +600,14 @@ msg_print("
 
                set_food(p_ptr->food + ((o_ptr->pval) / 20));
        }
+       else if (o_ptr->tval == TV_FOOD && o_ptr->sval == SV_FOOD_WAYBREAD)
+       {
+               /* Waybread is always fully satisfying. */
+               set_food(MAX(p_ptr->food, PY_FOOD_MAX - 1));
+       }
        else
        {
+               /* Food can feed the player */
                (void)set_food(p_ptr->food + o_ptr->pval);
        }
 
@@ -493,8 +634,34 @@ msg_print("
  */
 static bool item_tester_hook_eatable(object_type *o_ptr)
 {
-/*     if ((o_ptr->tval==TV_FOOD) || ((o_ptr->tval==TV_CORPSE) && o_ptr->sval)) return (TRUE); */
-       if (o_ptr->tval==TV_FOOD) return (TRUE);
+       if (o_ptr->tval==TV_FOOD) return TRUE;
+
+#if 0
+       if (prace_is_(RACE_SKELETON))
+       {
+               if (o_ptr->tval == TV_SKELETON ||
+                   (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
+                       return TRUE;
+       }
+       else 
+#endif
+
+       if (prace_is_(RACE_SKELETON) ||
+           prace_is_(RACE_GOLEM) ||
+           prace_is_(RACE_ZOMBIE) ||
+           prace_is_(RACE_SPECTRE))
+       {
+               if (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND)
+                       return TRUE;
+       }
+       else if (prace_is_(RACE_DEMON) ||
+                (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON))
+       {
+               if (o_ptr->tval == TV_CORPSE &&
+                   o_ptr->sval == SV_CORPSE &&
+                   my_strchr("pht", r_info[o_ptr->pval].d_char))
+                       return TRUE;
+       }
 
        /* Assume not */
        return (FALSE);
@@ -561,10 +728,7 @@ static void do_cmd_quaff_potion_aux(int item)
                return;
        }
 
-       if((p_ptr->pclass == CLASS_BARD) && p_ptr->magic_num1[0])
-       {
-               stop_singing();
-       }
+       if (music_singing_any()) stop_singing();
 
        /* Get the item (in the pack) */
        if (item >= 0)
@@ -611,70 +775,71 @@ static void do_cmd_quaff_potion_aux(int item)
        ident = FALSE;
 
        /* Object level */
-       lev = get_object_level(q_ptr);
+       lev = k_info[q_ptr->k_idx].level;
 
        /* Analyze the potion */
-       switch (q_ptr->sval)
+       if (q_ptr->tval == TV_POTION)
        {
+               switch (q_ptr->sval)
+               {
 #ifdef JP
-               /* °û¤ß¤´¤¿¤¨¤ò¥ª¥ê¥¸¥Ê¥ë¤è¤êºÙ¤«¤¯É½¸½ */
+                       /* °û¤ß¤´¤¿¤¨¤ò¥ª¥ê¥¸¥Ê¥ë¤è¤êºÙ¤«¤¯É½¸½ */
                case SV_POTION_WATER:
-               {
                        msg_print("¸ý¤ÎÃ椬¤µ¤Ã¤Ñ¤ê¤·¤¿¡£");
                        msg_print("¤Î¤É¤Î³é¤­¤¬¾¯¤·¤ª¤µ¤Þ¤Ã¤¿¡£");
                        ident = TRUE;
                        break;
-               }
+
                case SV_POTION_APPLE_JUICE:
-               {
                        msg_print("´Å¤¯¤Æ¥µ¥Ã¥Ñ¥ê¤È¤·¤Æ¤¤¤Æ¡¢¤È¤Æ¤â¤ª¤¤¤·¤¤¡£");
                        msg_print("¤Î¤É¤Î³é¤­¤¬¾¯¤·¤ª¤µ¤Þ¤Ã¤¿¡£");
                        ident = TRUE;
                        break;
-               }
+
                case SV_POTION_SLIME_MOLD:
-               {
                        msg_print("¤Ê¤ó¤È¤âÉÔµ¤Ì£¤ÊÌ£¤À¡£");
                        msg_print("¤Î¤É¤Î³é¤­¤¬¾¯¤·¤ª¤µ¤Þ¤Ã¤¿¡£");
                        ident = TRUE;
                        break;
-               }
+
 #else
                case SV_POTION_WATER:
                case SV_POTION_APPLE_JUICE:
                case SV_POTION_SLIME_MOLD:
-               {
                        msg_print("You feel less thirsty.");
                        ident = TRUE;
                        break;
-               }
 #endif
 
-
                case SV_POTION_SLOWNESS:
-               {
                        if (set_slow(randint1(25) + 15, FALSE)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_SALT_WATER:
-               {
 #ifdef JP
                        msg_print("¤¦¤§¡ª»×¤ï¤ºÅǤ¤¤Æ¤·¤Þ¤Ã¤¿¡£");
 #else
                        msg_print("The potion makes you vomit!");
 #endif
 
-                       (void)set_food(PY_FOOD_STARVE - 1);
+                       if (!(prace_is_(RACE_GOLEM) ||
+                             prace_is_(RACE_ZOMBIE) ||
+                             prace_is_(RACE_DEMON) ||
+                             prace_is_(RACE_ANDROID) ||
+                             prace_is_(RACE_SPECTRE) ||
+                             (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)))
+                       {
+                               /* Only living creatures get thirsty */
+                               (void)set_food(PY_FOOD_STARVE - 1);
+                       }
+
                        (void)set_poisoned(0);
                        (void)set_paralyzed(p_ptr->paralyzed + 4);
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_POISON:
-               {
-                       if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
+                       if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
                        {
                                if (set_poisoned(p_ptr->poisoned + randint0(15) + 10))
                                {
@@ -682,10 +847,8 @@ static void do_cmd_quaff_potion_aux(int item)
                                }
                        }
                        break;
-               }
 
                case SV_POTION_BLINDNESS:
-               {
                        if (!p_ptr->resist_blind)
                        {
                                if (set_blind(p_ptr->blind + randint0(100) + 100))
@@ -694,10 +857,8 @@ static void do_cmd_quaff_potion_aux(int item)
                                }
                        }
                        break;
-               }
 
                case SV_POTION_CONFUSION: /* Booze */
-               {
                        if (p_ptr->pclass != CLASS_MONK) chg_virtue(V_HARMONY, -1);
                        else if (!p_ptr->resist_conf) p_ptr->special_attack |= ATTACK_SUIKEN;
                        if (!p_ptr->resist_conf)
@@ -722,11 +883,11 @@ static void do_cmd_quaff_potion_aux(int item)
                                        ident = TRUE;
                                        if (one_in_(3)) lose_all_info();
                                        else wiz_dark();
-                                       teleport_player(100);
+                                       (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
                                        wiz_dark();
 #ifdef JP
-msg_print("ÃΤé¤Ê¤¤¾ì½ê¤ÇÌܤ¬Àä᤿¡£Æ¬Äˤ¬¤¹¤ë¡£");
-msg_print("²¿¤â»×¤¤½Ð¤»¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ØÍ褿¤Î¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
+                                       msg_print("ÃΤé¤Ê¤¤¾ì½ê¤ÇÌܤ¬Àä᤿¡£Æ¬Äˤ¬¤¹¤ë¡£");
+                                       msg_print("²¿¤â»×¤¤½Ð¤»¤Ê¤¤¡£¤É¤¦¤ä¤Ã¤Æ¤³¤³¤ØÍ褿¤Î¤«¤âʬ¤«¤é¤Ê¤¤¡ª");
 #else
                                        msg_print("You wake up somewhere with a sore head...");
                                        msg_print("You can't remember a thing, or how you got here!");
@@ -735,10 +896,8 @@ msg_print("
                                }
                        }
                        break;
-               }
 
                case SV_POTION_SLEEP:
-               {
                        if (!p_ptr->free_act)
                        {
 #ifdef JP
@@ -772,10 +931,8 @@ msg_print("
                                }
                        }
                        break;
-               }
 
                case SV_POTION_LOSE_MEMORIES:
-               {
                        if (!p_ptr->hold_life && (p_ptr->exp > 0))
                        {
 #ifdef JP
@@ -789,10 +946,8 @@ msg_print("
                                ident = TRUE;
                        }
                        break;
-               }
 
                case SV_POTION_RUINATION:
-               {
 #ifdef JP
                        msg_print("¿È¤â¿´¤â¼å¤Ã¤Æ¤­¤Æ¡¢Àºµ¤¤¬È´¤±¤Æ¤¤¤¯¤è¤¦¤À¡£");
                        take_hit(DAMAGE_LOSELIFE, damroll(10, 10), "ÇËÌǤÎÌô", -1);
@@ -809,46 +964,32 @@ msg_print("
                        (void)dec_stat(A_INT, 25, TRUE);
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_DEC_STR:
-               {
                        if (do_dec_stat(A_STR)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_DEC_INT:
-               {
                        if (do_dec_stat(A_INT)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_DEC_WIS:
-               {
                        if (do_dec_stat(A_WIS)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_DEC_DEX:
-               {
                        if (do_dec_stat(A_DEX)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_DEC_CON:
-               {
                        if (do_dec_stat(A_CON)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_DEC_CHR:
-               {
                        if (do_dec_stat(A_CHR)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_DETONATIONS:
-               {
 #ifdef JP
                        msg_print("ÂΤÎÃæ¤Ç·ã¤·¤¤Çúȯ¤¬µ¯¤­¤¿¡ª");
                        take_hit(DAMAGE_NOESCAPE, damroll(50, 20), "Çúȯ¤ÎÌô", -1);
@@ -861,10 +1002,8 @@ msg_print("
                        (void)set_cut(p_ptr->cut + 5000);
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_DEATH:
-               {
                        chg_virtue(V_VITALITY, -1);
                        chg_virtue(V_UNLIFE, 5);
 #ifdef JP
@@ -877,46 +1016,34 @@ msg_print("
 
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_INFRAVISION:
-               {
                        if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE))
                        {
                                ident = TRUE;
                        }
                        break;
-               }
 
                case SV_POTION_DETECT_INVIS:
-               {
                        if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE))
                        {
                                ident = TRUE;
                        }
                        break;
-               }
 
                case SV_POTION_SLOW_POISON:
-               {
                        if (set_poisoned(p_ptr->poisoned / 2)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_CURE_POISON:
-               {
                        if (set_poisoned(0)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_BOLDNESS:
-               {
                        if (set_afraid(0)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_SPEED:
-               {
                        if (!p_ptr->fast)
                        {
                                if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE;
@@ -926,63 +1053,49 @@ msg_print("
                                (void)set_fast(p_ptr->fast + 5, FALSE);
                        }
                        break;
-               }
 
                case SV_POTION_RESIST_HEAT:
-               {
                        if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE))
                        {
                                ident = TRUE;
                        }
                        break;
-               }
 
                case SV_POTION_RESIST_COLD:
-               {
                        if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE))
                        {
                                ident = TRUE;
                        }
                        break;
-               }
 
                case SV_POTION_HEROISM:
-               {
                        if (set_afraid(0)) ident = TRUE;
                        if (set_hero(p_ptr->hero + randint1(25) + 25, FALSE)) ident = TRUE;
                        if (hp_player(10)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_BESERK_STRENGTH:
-               {
                        if (set_afraid(0)) ident = TRUE;
                        if (set_shero(p_ptr->shero + randint1(25) + 25, FALSE)) ident = TRUE;
                        if (hp_player(30)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_CURE_LIGHT:
-               {
                        if (hp_player(damroll(2, 8))) ident = TRUE;
                        if (set_blind(0)) ident = TRUE;
                        if (set_cut(p_ptr->cut - 10)) ident = TRUE;
                        if (set_shero(0,TRUE)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_CURE_SERIOUS:
-               {
                        if (hp_player(damroll(4, 8))) ident = TRUE;
                        if (set_blind(0)) ident = TRUE;
                        if (set_confused(0)) ident = TRUE;
                        if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
                        if (set_shero(0,TRUE)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_CURE_CRITICAL:
-               {
                        if (hp_player(damroll(6, 8))) ident = TRUE;
                        if (set_blind(0)) ident = TRUE;
                        if (set_confused(0)) ident = TRUE;
@@ -991,10 +1104,8 @@ msg_print("
                        if (set_cut(0)) ident = TRUE;
                        if (set_shero(0,TRUE)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_HEALING:
-               {
                        if (hp_player(300)) ident = TRUE;
                        if (set_blind(0)) ident = TRUE;
                        if (set_confused(0)) ident = TRUE;
@@ -1003,10 +1114,8 @@ msg_print("
                        if (set_cut(0)) ident = TRUE;
                        if (set_shero(0,TRUE)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_STAR_HEALING:
-               {
                        if (hp_player(1200)) ident = TRUE;
                        if (set_blind(0)) ident = TRUE;
                        if (set_confused(0)) ident = TRUE;
@@ -1015,10 +1124,8 @@ msg_print("
                        if (set_cut(0)) ident = TRUE;
                        if (set_shero(0,TRUE)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_LIFE:
-               {
                        chg_virtue(V_VITALITY, 1);
                        chg_virtue(V_UNLIFE, -5);
 #ifdef JP
@@ -1045,10 +1152,8 @@ msg_print("
                        hp_player(5000);
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_RESTORE_MANA:
-               {
                        if (p_ptr->pclass == CLASS_MAGIC_EATER)
                        {
                                int i;
@@ -1066,7 +1171,7 @@ msg_print("
 #ifdef JP
                                msg_print("Ƭ¤¬¥Ï¥Ã¥­¥ê¤È¤·¤¿¡£");
 #else
-                               msg_print("Your feel your head clear.");
+                               msg_print("You feel your head clear.");
 #endif
                                p_ptr->window |= (PW_PLAYER);
                                ident = TRUE;
@@ -1078,7 +1183,7 @@ msg_print("
 #ifdef JP
                                msg_print("Ƭ¤¬¥Ï¥Ã¥­¥ê¤È¤·¤¿¡£");
 #else
-                               msg_print("Your feel your head clear.");
+                               msg_print("You feel your head clear.");
 #endif
 
                                p_ptr->redraw |= (PR_MANA);
@@ -1088,88 +1193,60 @@ msg_print("
                        }
                        if (set_shero(0,TRUE)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_RESTORE_EXP:
-               {
                        if (restore_level()) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_RES_STR:
-               {
                        if (do_res_stat(A_STR)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_RES_INT:
-               {
                        if (do_res_stat(A_INT)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_RES_WIS:
-               {
                        if (do_res_stat(A_WIS)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_RES_DEX:
-               {
                        if (do_res_stat(A_DEX)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_RES_CON:
-               {
                        if (do_res_stat(A_CON)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_RES_CHR:
-               {
                        if (do_res_stat(A_CHR)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_INC_STR:
-               {
                        if (do_inc_stat(A_STR)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_INC_INT:
-               {
                        if (do_inc_stat(A_INT)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_INC_WIS:
-               {
                        if (do_inc_stat(A_WIS)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_INC_DEX:
-               {
                        if (do_inc_stat(A_DEX)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_INC_CON:
-               {
                        if (do_inc_stat(A_CON)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_INC_CHR:
-               {
                        if (do_inc_stat(A_CHR)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_AUGMENTATION:
-               {
                        if (do_inc_stat(A_STR)) ident = TRUE;
                        if (do_inc_stat(A_INT)) ident = TRUE;
                        if (do_inc_stat(A_WIS)) ident = TRUE;
@@ -1177,10 +1254,8 @@ msg_print("
                        if (do_inc_stat(A_CON)) ident = TRUE;
                        if (do_inc_stat(A_CHR)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_ENLIGHTENMENT:
-               {
 #ifdef JP
                        msg_print("¼«Ê¬¤ÎÃÖ¤«¤ì¤Æ¤¤¤ë¾õ¶·¤¬Ç¾Î¢¤ËÉ⤫¤ó¤Ç¤­¤¿...");
 #else
@@ -1189,13 +1264,11 @@ msg_print("
 
                        chg_virtue(V_KNOWLEDGE, 1);
                        chg_virtue(V_ENLIGHTEN, 1);
-                       wiz_lite(FALSE, FALSE);
+                       wiz_lite(FALSE);
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_STAR_ENLIGHTENMENT:
-               {
 #ifdef JP
                        msg_print("¹¹¤Ê¤ë·¼Ìؤò´¶¤¸¤¿...");
 #else
@@ -1205,7 +1278,7 @@ msg_print("
                        chg_virtue(V_KNOWLEDGE, 1);
                        chg_virtue(V_ENLIGHTEN, 2);
                        msg_print(NULL);
-                       wiz_lite(TRUE, FALSE);
+                       wiz_lite(FALSE);
                        (void)do_inc_stat(A_INT);
                        (void)do_inc_stat(A_WIS);
                        (void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
@@ -1218,10 +1291,8 @@ msg_print("
                        self_knowledge();
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_SELF_KNOWLEDGE:
-               {
 #ifdef JP
                        msg_print("¼«Ê¬¼«¿È¤Î¤³¤È¤¬¾¯¤·¤Ïʬ¤«¤Ã¤¿µ¤¤¬¤¹¤ë...");
 #else
@@ -1232,10 +1303,8 @@ msg_print("
                        self_knowledge();
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_EXPERIENCE:
-               {
                        if (p_ptr->prace == RACE_ANDROID) break;
                        chg_virtue(V_ENLIGHTEN, 1);
                        if (p_ptr->exp < PY_MAX_EXP)
@@ -1252,10 +1321,8 @@ msg_print("
                                ident = TRUE;
                        }
                        break;
-               }
 
                case SV_POTION_RESISTANCE:
-               {
                        (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE);
                        (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE);
                        (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE);
@@ -1263,10 +1330,8 @@ msg_print("
                        (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE);
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_CURING:
-               {
                        if (hp_player(50)) ident = TRUE;
                        if (set_blind(0)) ident = TRUE;
                        if (set_poisoned(0)) ident = TRUE;
@@ -1275,17 +1340,13 @@ msg_print("
                        if (set_cut(0)) ident = TRUE;
                        if (set_image(0)) ident = TRUE;
                        break;
-               }
 
                case SV_POTION_INVULNERABILITY:
-               {
                        (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE);
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_NEW_LIFE:
-               {
                        do_cmd_rerate(FALSE);
                        get_max_stats();
                        p_ptr->update |= PU_BONUS;
@@ -1305,18 +1366,14 @@ msg_print("
                        }
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_NEO_TSUYOSHI:
-               {
                        (void)set_image(0);
                        (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE);
                        ident = TRUE;
                        break;
-               }
 
                case SV_POTION_TSUYOSHI:
-               {
 #ifdef JP
 msg_print("¡Ö¥ª¥¯¥ì·»¤µ¤ó¡ª¡×");
 #else
@@ -1331,10 +1388,8 @@ msg_print("
                        }
                        ident = TRUE;
                        break;
-               }
                
                case SV_POTION_POLYMORPH:
-               {
                        if ((p_ptr->muta1 || p_ptr->muta2 || p_ptr->muta3) && one_in_(23))
                        {
                                chg_virtue(V_CHANCE, -5);
@@ -1363,7 +1418,7 @@ msg_print("
                }
        }
 
-       if (p_ptr->prace == RACE_SKELETON)
+       if (prace_is_(RACE_SKELETON))
        {
 #ifdef JP
 msg_print("±ÕÂΤΰìÉô¤Ï¤¢¤Ê¤¿¤Î¥¢¥´¤òÁÇÄ̤ꤷ¤ÆÍî¤Á¤¿¡ª");
@@ -1377,7 +1432,7 @@ msg_print("
        /* Combine / Reorder the pack (later) */
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
-       if (!(object_aware_p(o_ptr)))
+       if (!(object_is_aware(o_ptr)))
        {
                chg_virtue(V_PATIENCE, -1);
                chg_virtue(V_CHANCE, 1);
@@ -1388,7 +1443,7 @@ msg_print("
        object_tried(q_ptr);
 
        /* An identification was made */
-       if (ident && !object_aware_p(q_ptr))
+       if (ident && !object_is_aware(q_ptr))
        {
                object_aware(q_ptr);
                gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
@@ -1411,12 +1466,33 @@ msg_print("
                                break;
                        case RACE_GOLEM:
                        case RACE_ZOMBIE:
-                       case RACE_ENT:
                        case RACE_DEMON:
                        case RACE_SPECTRE:
-                       case RACE_ANDROID:
                                set_food(p_ptr->food + ((o_ptr->pval) / 20));
                                break;
+                       case RACE_ANDROID:
+                               if (q_ptr->tval == TV_FLASK)
+                               {
+#ifdef JP
+                                       msg_print("¥ª¥¤¥ë¤òÊäµë¤·¤¿¡£");
+#else
+                                       msg_print("You replenish yourself with the oil.");
+#endif
+                                       set_food(p_ptr->food + 5000);
+                               }
+                               else
+                               {
+                                       set_food(p_ptr->food + ((o_ptr->pval) / 20));
+                               }
+                               break;
+                       case RACE_ENT:
+#ifdef JP
+                               msg_print("¿åʬ¤ò¼è¤ê¹þ¤ó¤À¡£");
+#else
+                               msg_print("You are moistened.");
+#endif
+                               set_food(MIN(p_ptr->food + o_ptr->pval + MAX(0, o_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
+                               break;
                        default:
                                (void)set_food(p_ptr->food + o_ptr->pval);
                                break;
@@ -1436,6 +1512,26 @@ msg_print("
 }
 
 
+/*
+ * Hook to determine if an object can be quaffed
+ */
+static bool item_tester_hook_quaff(object_type *o_ptr)
+{
+       if (o_ptr->tval == TV_POTION) return TRUE;
+
+       if (prace_is_(RACE_ANDROID))
+       {
+               if (o_ptr->tval == TV_FLASK && o_ptr->sval == SV_FLASK_OIL)
+                       return TRUE;
+       }
+
+       return FALSE;
+}
+
+
+/*
+ * Quaff some potion (from the pack or floor)
+ */
 void do_cmd_quaff_potion(void)
 {
        int  item;
@@ -1447,7 +1543,7 @@ void do_cmd_quaff_potion(void)
        }
 
        /* Restrict choices to potions */
-       item_tester_tval = TV_POTION;
+       item_tester_hook = item_tester_hook_quaff;
 
        /* Get an item */
 #ifdef JP
@@ -1518,16 +1614,13 @@ static void do_cmd_read_scroll_aux(int item, bool known)
                return;
        }
 
-       if((p_ptr->pclass == CLASS_BARD) && p_ptr->magic_num1[0])
-       {
-               stop_singing();
-       }
+       if (music_singing_any()) stop_singing();
 
        /* Not identified yet */
        ident = FALSE;
 
        /* Object level */
-       lev = get_object_level(o_ptr);
+       lev = k_info[o_ptr->k_idx].level;
 
        /* Assume the scroll will get used up */
        used_up = TRUE;
@@ -1568,7 +1661,14 @@ static void do_cmd_read_scroll_aux(int item, bool known)
 
                case SV_SCROLL_CURSE_WEAPON:
                {
-                       if (curse_weapon(FALSE, INVEN_RARM)) ident = TRUE;
+                       k = 0;
+                       if (buki_motteruka(INVEN_RARM))
+                       {
+                               k = INVEN_RARM;
+                               if (buki_motteruka(INVEN_LARM) && one_in_(2)) k = INVEN_LARM;
+                       }
+                       else if (buki_motteruka(INVEN_LARM)) k = INVEN_LARM;
+                       if (k && curse_weapon(FALSE, k)) ident = TRUE;
                        break;
                }
 
@@ -1622,21 +1722,21 @@ static void do_cmd_read_scroll_aux(int item, bool known)
 
                case SV_SCROLL_PHASE_DOOR:
                {
-                       teleport_player(10);
+                       teleport_player(10, 0L);
                        ident = TRUE;
                        break;
                }
 
                case SV_SCROLL_TELEPORT:
                {
-                       teleport_player(100);
+                       teleport_player(100, 0L);
                        ident = TRUE;
                        break;
                }
 
                case SV_SCROLL_TELEPORT_LEVEL:
                {
-                       (void)teleport_player_level();
+                       (void)teleport_level(0);
                        ident = TRUE;
                        break;
                }
@@ -1848,7 +1948,7 @@ static void do_cmd_read_scroll_aux(int item, bool known)
 
                case SV_SCROLL_STAR_DESTRUCTION:
                {
-                       if (destroy_area(py, px, 13+randint0(5), TRUE))
+                       if (destroy_area(py, px, 13 + randint0(5), FALSE))
                                ident = TRUE;
                        else
 #ifdef JP
@@ -1909,7 +2009,7 @@ msg_print("
                {
                        fire_ball(GF_FIRE, 0, 666, 4);
                        /* Note: "Double" damage since it is centered on the player ... */
-                       if (!(p_ptr->oppose_fire || p_ptr->resist_fire || p_ptr->immune_fire))
+                       if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire))
 #ifdef JP
 take_hit(DAMAGE_NOESCAPE, 50+randint1(50), "±ê¤Î´¬Êª", -1);
 #else
@@ -1924,7 +2024,7 @@ take_hit(DAMAGE_NOESCAPE, 50+randint1(50), "
                case SV_SCROLL_ICE:
                {
                        fire_ball(GF_ICE, 0, 777, 4);
-                       if (!(p_ptr->oppose_cold || p_ptr->resist_cold || p_ptr->immune_cold))
+                       if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold))
 #ifdef JP
 take_hit(DAMAGE_NOESCAPE, 100+randint1(100), "ɹ¤Î´¬Êª", -1);
 #else
@@ -2065,7 +2165,7 @@ msg_print("
 #endif
                used_up = FALSE;
        }
-       else if (o_ptr->tval==TV_PARCHEMENT)
+       else if (o_ptr->tval==TV_PARCHMENT)
        {
                cptr q;
                char o_name[MAX_NLEN];
@@ -2077,7 +2177,7 @@ msg_print("
                q=format("book-%d_jp.txt",o_ptr->sval);
 
                /* Display object description */
-               object_desc(o_name, o_ptr, TRUE, 0);
+               object_desc(o_name, o_ptr, OD_NAME_ONLY);
 
                /* Build the filename */
                path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, q);
@@ -2095,7 +2195,7 @@ msg_print("
        /* Combine / Reorder the pack (later) */
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
-       if (!(object_aware_p(o_ptr)))
+       if (!(object_is_aware(o_ptr)))
        {
                chg_virtue(V_PATIENCE, -1);
                chg_virtue(V_CHANCE, 1);
@@ -2106,7 +2206,7 @@ msg_print("
        object_tried(o_ptr);
 
        /* An identification was made */
-       if (ident && !object_aware_p(o_ptr))
+       if (ident && !object_is_aware(o_ptr))
        {
                object_aware(o_ptr);
                gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
@@ -2147,7 +2247,7 @@ msg_print("
  */
 static bool item_tester_hook_readable(object_type *o_ptr)
 {
-       if ((o_ptr->tval==TV_SCROLL) || (o_ptr->tval==TV_PARCHEMENT) || (o_ptr->name1 == ART_GHB) || (o_ptr->name1 == ART_POWER)) return (TRUE);
+       if ((o_ptr->tval==TV_SCROLL) || (o_ptr->tval==TV_PARCHMENT) || (o_ptr->name1 == ART_GHB) || (o_ptr->name1 == ART_POWER)) return (TRUE);
 
        /* Assume not */
        return (FALSE);
@@ -2225,7 +2325,7 @@ void do_cmd_read_scroll(void)
        }
 
        /* Read the scroll */
-       do_cmd_read_scroll_aux(item, object_aware_p(o_ptr));
+       do_cmd_read_scroll_aux(item, object_is_aware(o_ptr));
 }
 
 
@@ -2273,7 +2373,7 @@ static int staff_effect(int sval, bool *use_charge, bool magic, bool known)
 
                case SV_STAFF_TELEPORTATION:
                {
-                       teleport_player(100);
+                       teleport_player(100, 0L);
                        ident = TRUE;
                        break;
                }
@@ -2328,15 +2428,15 @@ static int staff_effect(int sval, bool *use_charge, bool magic, bool known)
                        }
                        for (k = 0; k < num; k++)
                        {
-               attempts = 1000;
+                               attempts = 1000;
 
-                               while(attempts--)
+                               while (attempts--)
                                {
                                        scatter(&y, &x, py, px, 4, 0);
 
-                                       if (!cave_floor_bold(y, x)) continue;
+                                       if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
 
-                                       if ((y != py) || (x != px)) break;
+                                       if (!player_bold(y, x)) break;
                                }
 
                                project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
@@ -2436,7 +2536,7 @@ static int staff_effect(int sval, bool *use_charge, bool magic, bool known)
 #ifdef JP
                                msg_print("Ƭ¤¬¥Ï¥Ã¥­¥ê¤È¤·¤¿¡£");
 #else
-                               msg_print("Your feel your head clear.");
+                               msg_print("You feel your head clear.");
 #endif
 
                                p_ptr->redraw |= (PR_MANA);
@@ -2521,7 +2621,7 @@ msg_print("
 
                case SV_STAFF_DESTRUCTION:
                {
-                       if (destroy_area(py, px, 13+randint0(5), TRUE))
+                       if (destroy_area(py, px, 13 + randint0(5), FALSE))
                                ident = TRUE;
 
                        break;
@@ -2556,6 +2656,23 @@ msg_print("
 
                        break;
                }
+
+               case SV_STAFF_NOTHING:
+               {
+#ifdef JP
+                       msg_print("²¿¤âµ¯¤é¤Ê¤«¤Ã¤¿¡£");
+#else
+                       msg_print("Nothing happen.");
+#endif
+                       if (prace_is_(RACE_SKELETON) || prace_is_(RACE_GOLEM) ||
+                               prace_is_(RACE_ZOMBIE) || prace_is_(RACE_SPECTRE))
+#ifdef JP
+                               msg_print("¤â¤Ã¤¿¤¤¤Ê¤¤»ö¤ò¤·¤¿¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£¿©¤Ùʪ¤ÏÂçÀڤˤ·¤Ê¤¯¤Æ¤Ï¡£");
+#else
+                               msg_print("What a waste.  It's your food!");
+#endif
+                       break;
+               }
        }
        return ident;
 }
@@ -2607,7 +2724,7 @@ static void do_cmd_use_staff_aux(int item)
        energy_use = 100;
 
        /* Extract the item level */
-       lev = get_object_level(o_ptr);
+       lev = k_info[o_ptr->k_idx].level;
        if (lev > 50) lev = 50 + (lev - 50)/2;
 
        /* Base chance of success */
@@ -2675,9 +2792,9 @@ static void do_cmd_use_staff_aux(int item)
        /* Sound */
        sound(SOUND_ZAP);
 
-       ident = staff_effect(o_ptr->sval, &use_charge, FALSE, object_aware_p(o_ptr));
+       ident = staff_effect(o_ptr->sval, &use_charge, FALSE, object_is_aware(o_ptr));
 
-       if (!(object_aware_p(o_ptr)))
+       if (!(object_is_aware(o_ptr)))
        {
                chg_virtue(V_PATIENCE, -1);
                chg_virtue(V_CHANCE, 1);
@@ -2691,7 +2808,7 @@ static void do_cmd_use_staff_aux(int item)
        object_tried(o_ptr);
 
        /* An identification was made */
-       if (ident && !object_aware_p(o_ptr))
+       if (ident && !object_is_aware(o_ptr))
        {
                object_aware(o_ptr);
                gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
@@ -3127,7 +3244,7 @@ static void do_cmd_aim_wand_aux(int item)
 
 
        /* Allow direction to be cancelled for free */
-       if (object_aware_p(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
+       if (object_is_aware(o_ptr) && (o_ptr->sval == SV_WAND_HEAL_MONSTER
                                      || o_ptr->sval == SV_WAND_HASTE_MONSTER))
                        target_pet = TRUE;
        if (!get_aim_dir(&dir))
@@ -3141,7 +3258,7 @@ static void do_cmd_aim_wand_aux(int item)
        energy_use = 100;
 
        /* Get the level */
-       lev = get_object_level(o_ptr);
+       lev = k_info[o_ptr->k_idx].level;
        if (lev > 50) lev = 50 + (lev - 50)/2;
 
        /* Base chance of success */
@@ -3213,7 +3330,7 @@ static void do_cmd_aim_wand_aux(int item)
        /* Combine / Reorder the pack (later) */
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
-       if (!(object_aware_p(o_ptr)))
+       if (!(object_is_aware(o_ptr)))
        {
                chg_virtue(V_PATIENCE, -1);
                chg_virtue(V_CHANCE, 1);
@@ -3224,7 +3341,7 @@ static void do_cmd_aim_wand_aux(int item)
        object_tried(o_ptr);
 
        /* Apply identification */
-       if (ident && !object_aware_p(o_ptr))
+       if (ident && !object_is_aware(o_ptr))
        {
                object_aware(o_ptr);
                gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
@@ -3284,12 +3401,15 @@ static int rod_effect(int sval, int dir, bool *use_charge, bool magic)
 {
        int ident = FALSE;
 
+       /* Unused */
+       (void)magic;
+
        /* Analyze the rod */
        switch (sval)
        {
                case SV_ROD_DETECT_TRAP:
                {
-                       if (detect_traps(DETECT_RAD_DEFAULT, dir ? FALSE : TRUE)) ident = TRUE;
+                       if (detect_traps(DETECT_RAD_DEFAULT, (bool)(dir ? FALSE : TRUE))) ident = TRUE;
                        break;
                }
 
@@ -3564,7 +3684,7 @@ static void do_cmd_zap_rod_aux(int item)
 
        /* Get a direction (unless KNOWN not to need it) */
        if (((o_ptr->sval >= SV_ROD_MIN_DIRECTION) && (o_ptr->sval != SV_ROD_HAVOC) && (o_ptr->sval != SV_ROD_AGGRAVATE) && (o_ptr->sval != SV_ROD_PESTICIDE)) ||
-            !object_aware_p(o_ptr))
+            !object_is_aware(o_ptr))
        {
                /* Get a direction, allow cancel */
                if (!get_aim_dir(&dir)) return;
@@ -3575,7 +3695,7 @@ static void do_cmd_zap_rod_aux(int item)
        energy_use = 100;
 
        /* Extract the item level */
-       lev = get_object_level(o_ptr);
+       lev = k_info[o_ptr->k_idx].level;
 
        /* Base chance of success */
        chance = p_ptr->skill_dev;
@@ -3666,7 +3786,7 @@ msg_print("
        /* Combine / Reorder the pack (later) */
        p_ptr->notice |= (PN_COMBINE | PN_REORDER);
 
-       if (!(object_aware_p(o_ptr)))
+       if (!(object_is_aware(o_ptr)))
        {
                chg_virtue(V_PATIENCE, -1);
                chg_virtue(V_CHANCE, 1);
@@ -3677,7 +3797,7 @@ msg_print("
        object_tried(o_ptr);
 
        /* Successfully determined the object function */
-       if (ident && !object_aware_p(o_ptr))
+       if (ident && !object_is_aware(o_ptr))
        {
                object_aware(o_ptr);
                gain_exp((lev + (p_ptr->lev >> 1)) / p_ptr->lev);
@@ -3725,7 +3845,7 @@ static bool item_tester_hook_activate(object_type *o_ptr)
        u32b flgs[TR_FLAG_SIZE];
 
        /* Not known */
-       if (!object_known_p(o_ptr)) return (FALSE);
+       if (!object_is_known(o_ptr)) return (FALSE);
 
        /* Extract the flags */
        object_flags(o_ptr, flgs);
@@ -3826,6 +3946,9 @@ static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
        monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
        monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
 
+       /* Unused */
+       (void)v;
+
        if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
        if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
 
@@ -3874,10 +3997,10 @@ static void do_cmd_activate_aux(int item)
        energy_use = 100;
 
        /* Extract the item level */
-       lev = get_object_level(o_ptr);
+       lev = k_info[o_ptr->k_idx].level;
 
        /* Hack -- use artifact level instead */
-       if (artifact_p(o_ptr)) lev = a_info[o_ptr->name1].level;
+       if (object_is_fixed_artifact(o_ptr)) lev = a_info[o_ptr->name1].level;
        else if (o_ptr->art_name)
        {
                switch (o_ptr->xtra2)
@@ -4066,7 +4189,7 @@ static void do_cmd_activate_aux(int item)
        }
 
        /* Artifacts */
-       else if (o_ptr->name1)
+       else if (object_is_fixed_artifact(o_ptr))
        {
                /* Choose effect */
                switch (o_ptr->name1)
@@ -4074,7 +4197,7 @@ static void do_cmd_activate_aux(int item)
                        case ART_GALADRIEL:
                        {
 #ifdef JP
-                               msg_print("ààÎÜÉÓ¤«¤éÀ¡¤ó¤À¸÷¤¬¤¢¤Õ¤ì½Ð¤¿...");
+                               msg_print("ààÍþÉÓ¤«¤éÀ¡¤ó¤À¸÷¤¬¤¢¤Õ¤ì½Ð¤¿...");
 #else
                                msg_print("The phial wells with clear light...");
 #endif
@@ -4108,7 +4231,7 @@ msg_print("
 
                                chg_virtue(V_KNOWLEDGE, 1);
                                chg_virtue(V_ENLIGHTEN, 1);
-                               wiz_lite(FALSE, FALSE);
+                               wiz_lite(FALSE);
 #ifdef JP
 msg_print("¤½¤ÎÊõÀФϤ¢¤Ê¤¿¤ÎÂÎÎϤòÃ¥¤Ã¤¿...");
 take_hit(DAMAGE_LOSELIFE, damroll(3,8), "¿³È½¤ÎÊõÀÐ", -1);
@@ -4275,15 +4398,15 @@ msg_print("
 
                                for (k = 0; k < num; k++)
                                {
-               attempts = 1000;
+                                       attempts = 1000;
 
-                                       while(attempts--)
+                                       while (attempts--)
                                        {
                                                scatter(&y, &x, py, px, 4, 0);
 
-                                               if (!cave_floor_bold(y, x)) continue;
+                                               if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
 
-                                               if ((y != py) || (x != px)) break;
+                                               if (!player_bold(y, x)) break;
                                        }
 
                                        project(0, 3, y, x, 150, GF_ELEC,
@@ -4352,6 +4475,7 @@ msg_print("ŷ
                                (void)set_stun(0);
                                (void)set_confused(0);
                                (void)set_blind(0);
+                               (void)set_afraid(0);
                                (void)set_hero(randint1(25) + 25, FALSE);
                                (void)hp_player(777);
                                o_ptr->timeout = 300;
@@ -4477,7 +4601,7 @@ msg_print("ŷ
                                msg_print("Your cloak twists space around you...");
 #endif
 
-                               teleport_player(100);
+                               teleport_player(100, 0L);
                                o_ptr->timeout = 45;
                                break;
                        }
@@ -4696,10 +4820,10 @@ msg_print("ŷ
                                switch (randint1(13))
                                {
                                case 1: case 2: case 3: case 4: case 5:
-                                       teleport_player(10);
+                                       teleport_player(10, 0L);
                                        break;
                                case 6: case 7: case 8: case 9: case 10:
-                                       teleport_player(222);
+                                       teleport_player(222, 0L);
                                        break;
                                case 11: case 12:
                                        (void)stair_creation();
@@ -4724,7 +4848,7 @@ if (get_check("
 
                        case ART_KAMUI:
                        {
-                               teleport_player(222);
+                               teleport_player(222, 0L);
                                o_ptr->timeout = 25;
                                break;
                        }
@@ -4984,7 +5108,7 @@ msg_print("
                                detect_all(DETECT_RAD_DEFAULT);
                                probing();
                                identify_fully(FALSE);
-                               o_ptr->timeout = 1000;
+                               o_ptr->timeout = 100;
                                break;
                        }
 
@@ -5162,7 +5286,12 @@ msg_print("
 
                        case ART_BOROMIR:
                        {
+                               if (music_singing_any()) stop_singing();
+#ifdef JP
+                               msg_print("¤¢¤Ê¤¿¤ÏÎ϶¯¤¤ÆÍÉ÷¤ò¿á¤­ÌĤ餷¤¿¡£¼þ°Ï¤ÎŨ¤¬¿Ì¤¨¾å¤Ã¤Æ¤¤¤ë!");
+#else
                                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;
@@ -5283,10 +5412,10 @@ msg_print("
                                y = py+ddy[dir];
                                x = px+ddx[dir];
                                tsuri_dir = dir;
-                               if (!(cave[y][x].feat == FEAT_DEEP_WATER) && !(cave[y][x].feat == FEAT_SHAL_WATER))
+                               if (!cave_have_flag_bold(y, x, FF_WATER))
                                {
 #ifdef JP
-                                       msg_print("¤½¤³¤ÏΦÃϤÀ¡£");
+                                       msg_print("¤½¤³¤Ï¿åÊդǤϤʤ¤¡£");
 #else
                                        msg_print("There is no fishing place.");
 #endif
@@ -5314,7 +5443,7 @@ msg_print("
 #ifdef JP
                                msg_print("¥à¥Á¤ò¿­¤Ð¤·¤¿¡£");
 #else
-                               msg_print("You stretched your wip.");
+                               msg_print("You stretched your whip.");
 #endif
 
                                fetch(dir, 500, TRUE);
@@ -5401,6 +5530,7 @@ msg_print("
                                                if (!m_ptr->r_idx) continue;
                                                if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
                                                if (!los(m_ptr->fy, m_ptr->fx, py, px)) continue;
+                                               if (!projectable(m_ptr->fy, m_ptr->fx, py, px)) continue;
                                                count++;
                                                break;
                                        }
@@ -5447,6 +5577,7 @@ msg_print("
                        case ART_MATOI:
                        case ART_AEGISFANG:
                        {
+                               (void)set_afraid(0);
                                set_hero(randint1(25)+25, FALSE);
                                hp_player(10);
                                o_ptr->timeout = randint0(30) + 30;
@@ -5489,32 +5620,12 @@ msg_print("
                        }
                        case ART_BLOOD:
                        {
-                               int dummy, i;
 #ifdef JP
                                msg_print("³ù¤¬ÌÀ¤ë¤¯µ±¤¤¤¿...");
 #else
                                msg_print("Your scythe glows brightly!");
 #endif
-                               for (i = 0; i < TR_FLAG_SIZE; i++)
-                                       o_ptr->art_flags[i] = a_info[ART_BLOOD].flags[i];
-
-                               dummy = randint1(2)+randint1(2);
-                               for (i = 0; i < dummy; i++)
-                               {
-                                       int flag = randint0(19);
-                                       if (flag == 18) add_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
-                                       else add_flag(o_ptr->art_flags, TR_CHAOTIC + flag);
-                               }
-                               dummy = randint1(2);
-                               for (i = 0; i < dummy; i++)
-                                       one_resistance(o_ptr);
-                               dummy = 2;
-                               for (i = 0; i < dummy; i++)
-                               {
-                                       int tmp = randint0(11);
-                                       if (tmp < 6) add_flag(o_ptr->art_flags, TR_STR + tmp);
-                                       else add_flag(o_ptr->art_flags, TR_STEALTH + tmp - 6);
-                               }
+                               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);
@@ -5527,6 +5638,7 @@ msg_print("
 #else
                                msg_print("You stamp. (as if you are in a ring.)");
 #endif
+                               (void)set_afraid(0);
                                (void)set_hero(randint1(20) + 20, FALSE);
                                dispel_evil(p_ptr->lev * 3);
                                o_ptr->timeout = 100 + randint1(100);
@@ -5609,6 +5721,81 @@ msg_print("
                                o_ptr->timeout = randint0(150) + 150;
                                break;
                        }
+                       case ART_HELL:
+                       {
+#ifdef JP
+                               msg_print("¼óÎؤ¬¿¼¤¤°Ç¤Ëʤ¤ï¤ì¤¿...");
+#else
+                               msg_print("Your collar harness is coverd in pitch-darkness...");
+#endif
+                               if (!get_aim_dir(&dir)) return;
+                               fire_ball(GF_DARK, dir, 250, 4);
+                               o_ptr->timeout = randint0(150) + 150;
+                               break;
+                       }
+                       case ART_SACRED_KNIGHTS:
+                       {
+#ifdef JP
+                               msg_print("¼ó¾þ¤ê¤¬¿¿¼Â¤ò¾È¤é¤·½Ð¤¹...");
+#else
+                               msg_print("Your amulet exhibits the truth...");
+#endif
+                               if (remove_all_curse())
+                               {
+#ifdef JP
+                                       msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
+#else
+                                       msg_print("You feel as if someone is watching over you.");
+#endif
+                               }
+                               (void)probing();
+                               break;
+                       }
+                       case ART_CHARMED:
+                       {
+#ifdef JP
+                               msg_print("¥Ú¥ó¥À¥ó¥È¤¬ÀÄÇò¤¯¸÷¤Ã¤¿¡¥¡¥¡¥");
+#else
+                               msg_print("Your pendant glows pale...");
+#endif
+                               if (p_ptr->pclass == CLASS_MAGIC_EATER)
+                               {
+                                       int i;
+                                       for (i = 0; i < EATER_EXT*2; i++)
+                                       {
+                                               p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i]*EATER_CHARGE/3;
+                                               if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i]*EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
+                                       }
+                                       for (; i < EATER_EXT*3; i++)
+                                       {
+                                               int k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2);
+                                               p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE*3 : p_ptr->magic_num2[i]*EATER_ROD_CHARGE/3)*k_info[k_idx].pval;
+                                               if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
+                                       }
+#ifdef JP
+                                       msg_print("Ƭ¤¬¥Ï¥Ã¥­¥ê¤È¤·¤¿¡£");
+#else
+                                       msg_print("You feel your head clear.");
+#endif
+                                       p_ptr->window |= (PW_PLAYER);
+                               }
+                               else if (p_ptr->csp < p_ptr->msp)
+                               {
+                                       p_ptr->csp = p_ptr->msp;
+                                       p_ptr->csp_frac = 0;
+#ifdef JP
+                                       msg_print("Ƭ¤¬¥Ï¥Ã¥­¥ê¤È¤·¤¿¡£");
+#else
+                                       msg_print("You feel your head clear.");
+#endif
+
+                                       p_ptr->redraw |= (PR_MANA);
+                                       p_ptr->window |= (PW_PLAYER);
+                                       p_ptr->window |= (PW_SPELL);
+                               }
+                               o_ptr->timeout = 777;
+                               break;
+                       }
                }
 
                /* Window stuff */
@@ -5618,7 +5805,7 @@ msg_print("
                return;
        }
 
-       else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3))
+       if (object_is_smith(o_ptr))
        {
                switch (o_ptr->xtra3-1)
                {
@@ -5655,9 +5842,9 @@ msg_print("
        }
 
 
-       else if (o_ptr->name2 == EGO_TRUMP)
+       if (o_ptr->name2 == EGO_TRUMP)
        {
-               teleport_player(100);
+               teleport_player(100, 0L);
                o_ptr->timeout = 50 + randint1(50);
 
                /* Window stuff */
@@ -5668,7 +5855,7 @@ msg_print("
        }
 
 
-       else if (o_ptr->name2 == EGO_LITE_ILLUMINATION)
+       if (o_ptr->name2 == EGO_LITE_ILLUMINATION)
        {
                if (!o_ptr->xtra4 && ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
                {
@@ -5690,7 +5877,7 @@ msg_print("
        }
 
 
-       else if (o_ptr->name2 == EGO_EARTHQUAKES)
+       if (o_ptr->name2 == EGO_EARTHQUAKES)
        {
                earthquake(py, px, 5);
                o_ptr->timeout = 100 + randint1(100);
@@ -5703,9 +5890,9 @@ msg_print("
        }
 
 
-       else if (o_ptr->name2 == EGO_JUMP)
+       if (o_ptr->name2 == EGO_JUMP)
        {
-               teleport_player(10);
+               teleport_player(10, 0L);
                o_ptr->timeout = 10 + randint1(10);
 
                /* Window stuff */
@@ -5717,11 +5904,13 @@ msg_print("
 
 
        /* Hack -- Dragon Scale Mail can be activated as well */
-       else if (o_ptr->tval == TV_DRAG_ARMOR)
+       if (o_ptr->tval == TV_DRAG_ARMOR)
        {
                /* Get a direction for breathing (or abort) */
                if (!get_aim_dir(&dir)) return;
 
+               if (music_singing_any()) stop_singing();
+
                /* Branch on the sub-type */
                switch (o_ptr->sval)
                {
@@ -5938,7 +6127,7 @@ msg_print("
 
        else if (o_ptr->tval == TV_RING)
        {
-               if (o_ptr->name2)
+               if (object_is_ego(o_ptr))
                {
                        bool success = TRUE;
 
@@ -5972,7 +6161,7 @@ msg_print("
                                break;
                        case EGO_RING_ACID_BOLT:
                                if (!get_aim_dir(&dir)) return;
-                               fire_bolt(GF_FIRE, dir, damroll(5, 8));
+                               fire_bolt(GF_ACID, dir, damroll(5, 8));
                                o_ptr->timeout = randint0(6) + 6;
                                break;
                        case EGO_RING_MANA_BOLT:
@@ -6035,6 +6224,7 @@ msg_print("
                                o_ptr->timeout = 100;
                                break;
                        case EGO_RING_BERSERKER:
+                               (void)set_afraid(0);
                                (void)set_shero(randint1(25) + 25, FALSE);
                                o_ptr->timeout = randint0(75)+75;
                                break;
@@ -6113,7 +6303,7 @@ msg_print("
 
        else if (o_ptr->tval == TV_AMULET)
        {
-               if (o_ptr->name2)
+               if (object_is_ego(o_ptr))
                {
                        switch (o_ptr->name2)
                        {
@@ -6127,11 +6317,11 @@ msg_print("
                                o_ptr->timeout = 200;
                                break;
                        case EGO_AMU_JUMP:
-                               teleport_player(10);
+                               teleport_player(10, 0L);
                                o_ptr->timeout = randint0(10) + 10;
                                break;
                        case EGO_AMU_TELEPORT:
-                               teleport_player(100);
+                               teleport_player(100, 0L);
                                o_ptr->timeout = randint0(50) + 50;
                                break;
                        case EGO_AMU_D_DOOR:
@@ -6165,8 +6355,10 @@ msg_print("
 
        else if (o_ptr->tval == TV_WHISTLE)
        {
+               if (music_singing_any()) stop_singing();
+
 #if 0
-               if (cursed_p(o_ptr))
+               if (object_is_cursed(o_ptr))
                {
 #ifdef JP
                        msg_print("¥«¥ó¹â¤¤²»¤¬¶Á¤­ÅϤä¿¡£");
@@ -6203,7 +6395,7 @@ msg_print("
                        for (i = 0; i < max_pet; i++)
                        {
                                pet_ctr = who[i];
-                               teleport_to_player(pet_ctr, 100);
+                               teleport_monster_to(pet_ctr, py, px, 100, TELEPORT_PASSIVE);
                        }
 
                        /* Free the "who" array */
@@ -6274,7 +6466,7 @@ msg_print("
                {
                        bool success = FALSE;
                        if (!get_rep_dir2(&dir)) return;
-                       if (cave_floor_bold(py+ddy[dir],px+ddx[dir]))
+                       if (monster_can_enter(py + ddy[dir], px + ddx[dir], &r_info[o_ptr->pval], 0))
                        {
                                if (place_monster_aux(0, py + ddy[dir], px + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
                                {
@@ -6424,7 +6616,7 @@ static bool item_tester_hook_use(object_type *o_ptr)
                        int i;
 
                        /* Not known */
-                       if (!object_known_p(o_ptr)) return (FALSE);
+                       if (!object_is_known(o_ptr)) return (FALSE);
 
                        /* HACK - only items from the equipment can be activated */
                        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
@@ -6588,11 +6780,11 @@ msg_print("
        }
 }
 
-static bool select_magic_eater(bool only_browse)
+static int select_magic_eater(bool only_browse)
 {
        int ext=0;
        char choice;
-       bool flag, redraw, request_list;
+       bool flag, request_list;
        int tval = 0;
        int             ask = TRUE, i = 0;
        char            out_val[160];
@@ -6641,7 +6833,7 @@ static bool select_magic_eater(bool only_browse)
                        prt(format(" %s staff", (menu_line == 1) ? "> " : "  "), 2, 14);
                        prt(format(" %s wand", (menu_line == 2) ? "> " : "  "), 3, 14);
                        prt(format(" %s rod", (menu_line == 3) ? "> " : "  "), 4, 14);
-                       prt("Which type of magic do you usu?", 0, 0);
+                       prt("Which type of magic do you use?", 0, 0);
 #endif
                        choice = inkey();
                        switch(choice)
@@ -6727,9 +6919,6 @@ static bool select_magic_eater(bool only_browse)
        /* Nothing chosen yet */
        flag = FALSE;
 
-       /* No redraw yet */
-       redraw = FALSE;
-
        /* Build a prompt */
 #ifdef JP
 (void) strnfmt(out_val, 78, "('*'¤Ç°ìÍ÷, ESC¤ÇÃæÃÇ) ¤É¤ÎËâÎϤò»È¤¤¤Þ¤¹¤«¡©");
@@ -6807,11 +6996,7 @@ static bool select_magic_eater(bool only_browse)
                                {
                                        chance -= 3 * (p_ptr->lev - level);
                                }
-                               chance += p_ptr->to_m_chance;
-                               if (p_ptr->heavy_spell) chance += 20;
-                               if(p_ptr->dec_mana && p_ptr->easy_spell) chance-=4;
-                               else if (p_ptr->easy_spell) chance-=3;
-                               else if (p_ptr->dec_mana) chance-=2;
+                               chance = mod_spell_chance_1(chance);
                                chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
                                /* Stunning makes spells harder */
                                if (p_ptr->stun > 50) chance += 25;
@@ -6819,8 +7004,7 @@ static bool select_magic_eater(bool only_browse)
 
                                if (chance > 95) chance = 95;
 
-                               if(p_ptr->dec_mana) chance--;
-                               if (p_ptr->heavy_spell) chance += 5;
+                               chance = mod_spell_chance_2(chance);
 
                                col = TERM_WHITE;
 
@@ -6852,17 +7036,16 @@ static bool select_magic_eater(bool only_browse)
                        }
                }
 
-               if(!get_com(out_val, &choice, FALSE)) break; 
+               if (!get_com(out_val, &choice, FALSE)) break;
 
                if (use_menu && choice != ' ')
                {
-                       switch(choice)
+                       switch (choice)
                        {
                                case '0':
                                {
                                        screen_load();
-                                       return (FALSE);
-                                       break;
+                                       return 0;
                                }
 
                                case '8':
@@ -7041,7 +7224,7 @@ static bool select_magic_eater(bool only_browse)
                        Term_erase(7, 21, 255);
                        Term_erase(7, 20, 255);
 
-                       roff_to_buf(k_text + k_info[lookup_kind(tval, i)].text, 62, temp);
+                       roff_to_buf(k_text + k_info[lookup_kind(tval, i)].text, 62, temp, sizeof(temp));
                        for (j = 0, line = 21; temp[j]; j += 1 + strlen(&temp[j]))
                        {
                                prt(&temp[j], line, 10);
@@ -7112,11 +7295,7 @@ msg_print("
        {
                chance -= 3 * (p_ptr->lev - level);
        }
-       chance += p_ptr->to_m_chance;
-       if (p_ptr->heavy_spell) chance += 20;
-       if(p_ptr->dec_mana && p_ptr->easy_spell) chance-=4;
-       else if (p_ptr->easy_spell) chance-=3;
-       else if (p_ptr->dec_mana) chance-=2;
+       chance = mod_spell_chance_1(chance);
        chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
        /* Stunning makes spells harder */
        if (p_ptr->stun > 50) chance += 25;
@@ -7124,8 +7303,7 @@ msg_print("
 
        if (chance > 95) chance = 95;
 
-       if(p_ptr->dec_mana) chance--;
-       if (p_ptr->heavy_spell) chance += 5;
+       chance = mod_spell_chance_2(chance);
 
        if (randint0(100) < chance)
        {