OSDN Git Service

Weaponsmiths can drain lite essence according to lite radius of draining objects
[hengband/hengband.git] / src / xtra1.c
index 70646d0..0969c8b 100644 (file)
@@ -161,14 +161,14 @@ void prt_time(void)
        extract_day_hour_min(&day, &hour, &min);
 
        /* Dump the info itself */
-       c_put_str(TERM_WHITE, format(
 #ifdef JP
-               "%2dÆüÌÜ",
+       if (day < 1000) c_put_str(TERM_WHITE, format("%2dÆüÌÜ", day), ROW_DAY, COL_DAY);
+       else c_put_str(TERM_WHITE, "***ÆüÌÜ", ROW_DAY, COL_DAY);
 #else
-               "Day %-2d",
+       if (day < 1000) c_put_str(TERM_WHITE, format("Day%3d", day), ROW_DAY, COL_DAY);
+       else c_put_str(TERM_WHITE, "Day***", ROW_DAY, COL_DAY);
 #endif
-               day), ROW_DAY, COL_DAY);
-       
+
        c_put_str(TERM_WHITE, format("%2d:%02d", hour, min), ROW_DAY, COL_DAY+7);
 }
 
@@ -323,7 +323,20 @@ static void prt_stat(int stat)
 #define BAR_SUPERSTEALTH 50
 #define BAR_RECALL 51
 #define BAR_ALTER 52
-
+#define BAR_SHCOLD 53
+#define BAR_SHELEC 54
+#define BAR_SHSHADOW 55
+#define BAR_MIGHT 56
+#define BAR_BUILD 57
+#define BAR_ANTIMULTI 58
+#define BAR_ANTITELE 59
+#define BAR_ANTIMAGIC 60
+#define BAR_PATIENCE 61
+#define BAR_REVENGE 62
+#define BAR_RUNESWORD 63
+#define BAR_VAMPILIC 64
+#define BAR_CURE 65
+#define BAR_ESP_EVIL 66
 
 static struct {
        byte attr;
@@ -385,12 +398,27 @@ static struct {
        {TERM_YELLOW, "±£", "Ķ±£Ì©"},
        {TERM_WHITE, "µ¢", "µ¢´Ô"},
        {TERM_WHITE, "¸½", "¸½¼ÂÊÑÍÆ"},
+       /* Hex */
+       {TERM_WHITE, "¥ª", "ɹ¥ª¡¼¥é"},
+       {TERM_BLUE, "¥ª", "ÅÅ¥ª¡¼¥é"},
+       {TERM_L_DARK, "¥ª", "±Æ¥ª¡¼¥é"},
+       {TERM_YELLOW, "ÏÓ", "ÏÓÎ϶¯²½"},
+       {TERM_RED, "Æù", "ÆùÂζ¯²½"},
+       {TERM_L_DARK, "¿£", "È¿Áý¿£"},
+       {TERM_ORANGE, "¥Æ", "È¿¥Æ¥ì¥Ý"},
+       {TERM_RED, "Ëâ", "È¿ËâË¡"},
+       {TERM_SLATE, "²æ", "²æËý"},
+       {TERM_SLATE, "Àë", "Àë¹ð"},
+       {TERM_L_DARK, "·õ", "Ëâ·õ²½"},
+       {TERM_RED, "µÛ", "µÛ·ìÂÇ·â"},
+       {TERM_WHITE, "²ó", "²óÉü"},
+       {TERM_L_DARK, "´¶", "¼Ù°­´¶ÃÎ"},
        {0, NULL, NULL}
 };
 #else
 = {
        {TERM_YELLOW, "Ts", "Tsuyoshi"},
-       {TERM_VIOLET, "Hu", "Hullc"},
+       {TERM_VIOLET, "Ha", "Halluc"},
        {TERM_L_DARK, "Bl", "Blind"},
        {TERM_RED, "Pa", "Paralyzed"},
        {TERM_VIOLET, "Cf", "Confused"},
@@ -442,6 +470,21 @@ static struct {
        {TERM_YELLOW, "Stlt", "Stealth"},
        {TERM_WHITE, "Rc", "Recall"},
        {TERM_WHITE, "Al", "Alter"},
+       /* Hex */
+       {TERM_WHITE, "SCo", "SCold"},
+       {TERM_BLUE, "SEl", "SElec"},
+       {TERM_L_DARK, "SSh", "SShadow"},
+       {TERM_YELLOW, "EMi", "ExMight"},
+       {TERM_RED, "Bu", "BuildUp"},
+       {TERM_L_DARK, "AMl", "AntiMulti"},
+       {TERM_ORANGE, "AT", "AntiTele"},
+       {TERM_RED, "AM", "AntiMagic"},
+       {TERM_SLATE, "Pa", "Patience"},
+       {TERM_SLATE, "Rv", "Revenge"},
+       {TERM_L_DARK, "Rs", "RuneSword"},
+       {TERM_RED, "Vm", "Vampiric"},
+       {TERM_WHITE, "Cu", "Cure"},
+       {TERM_L_DARK, "ET", "EvilTele"},
        {0, NULL, NULL}
 };
 #endif
@@ -455,7 +498,7 @@ static struct {
  */
 static void prt_status(void)
 {
-       u32b bar_flags[2];
+       u32b bar_flags[3];
        int wid, hgt, row_statbar, max_col_statbar;
        int i, col = 0, num = 0;
        int space = 2;
@@ -466,7 +509,7 @@ static void prt_status(void)
 
        Term_erase(0, row_statbar, max_col_statbar);
 
-       bar_flags[0] = bar_flags[1] = 0L;
+       bar_flags[0] = bar_flags[1] = bar_flags[2] = 0L;
 
        /* Tsuyoshi  */
        if (p_ptr->tsuyoshi) ADD_FLG(BAR_TSUYOSHI);
@@ -599,6 +642,35 @@ static void prt_status(void)
        /* An Eye for an Eye */
        if (p_ptr->tim_eyeeye) ADD_FLG(BAR_EYEEYE);
 
+       /* Hex spells */
+       if (p_ptr->realm1 == REALM_HEX)
+       {
+               if (hex_spelling(HEX_BLESS)) ADD_FLG(BAR_BLESSED);
+               if (hex_spelling(HEX_DEMON_AURA)) { ADD_FLG(BAR_SHFIRE); ADD_FLG(BAR_REGENERATION); }
+               if (hex_spelling(HEX_XTRA_MIGHT)) ADD_FLG(BAR_MIGHT);
+               if (hex_spelling(HEX_DETECT_EVIL)) ADD_FLG(BAR_ESP_EVIL);
+               if (hex_spelling(HEX_ICE_ARMOR)) ADD_FLG(BAR_SHCOLD);
+               if (hex_spelling(HEX_RUNESWORD)) ADD_FLG(BAR_RUNESWORD);
+               if (hex_spelling(HEX_BUILDING)) ADD_FLG(BAR_BUILD);
+               if (hex_spelling(HEX_ANTI_TELE)) ADD_FLG(BAR_ANTITELE);
+               if (hex_spelling(HEX_SHOCK_CLOAK)) ADD_FLG(BAR_SHELEC);
+               if (hex_spelling(HEX_SHADOW_CLOAK)) ADD_FLG(BAR_SHSHADOW);
+               if (hex_spelling(HEX_CONFUSION)) ADD_FLG(BAR_ATTKCONF);
+               if (hex_spelling(HEX_EYE_FOR_EYE)) ADD_FLG(BAR_EYEEYE);
+               if (hex_spelling(HEX_ANTI_MULTI)) ADD_FLG(BAR_ANTIMULTI);
+               if (hex_spelling(HEX_VAMP_BLADE)) ADD_FLG(BAR_VAMPILIC);
+               if (hex_spelling(HEX_ANTI_MAGIC)) ADD_FLG(BAR_ANTIMAGIC);
+               if (hex_spelling(HEX_CURE_LIGHT) ||
+                       hex_spelling(HEX_CURE_SERIOUS) ||
+                       hex_spelling(HEX_CURE_CRITICAL)) ADD_FLG(BAR_CURE);
+
+               if (p_ptr->magic_num2[2])
+               {
+                       if (p_ptr->magic_num2[1] == 1) ADD_FLG(BAR_PATIENCE);
+                       if (p_ptr->magic_num2[1] == 2) ADD_FLG(BAR_REVENGE);
+               }
+       }
+
        /* Calcurate length */
        for (i = 0; bar[i].sstr; i++)
        {
@@ -860,7 +932,7 @@ static void prt_hp(void)
        put_str("HP", ROW_CURHP, COL_CURHP);
 
        /* ¸½ºß¤Î¥Ò¥Ã¥È¥Ý¥¤¥ó¥È */
-       sprintf(tmp, "%4ld", p_ptr->chp);
+       sprintf(tmp, "%4ld", (long int)p_ptr->chp);
 
        if (p_ptr->chp >= p_ptr->mhp)
        {
@@ -881,7 +953,7 @@ static void prt_hp(void)
        put_str( "/", ROW_CURHP, COL_CURHP + 7 );
 
        /* ºÇÂç¥Ò¥Ã¥È¥Ý¥¤¥ó¥È */
-       sprintf(tmp, "%4ld", p_ptr->mhp);
+       sprintf(tmp, "%4ld", (long int)p_ptr->mhp);
        color = TERM_L_GREEN;
 
        c_put_str(color, tmp, ROW_CURHP, COL_CURHP + 8 );
@@ -911,7 +983,7 @@ static void prt_sp(void)
 #endif
 
        /* ¸½ºß¤Î¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È */
-       sprintf(tmp, "%4ld", p_ptr->csp);
+       sprintf(tmp, "%4ld", (long int)p_ptr->csp);
 
        if (p_ptr->csp >= p_ptr->msp)
        {
@@ -932,7 +1004,7 @@ static void prt_sp(void)
        put_str( "/", ROW_CURSP, COL_CURSP + 7 );
 
        /* ºÇÂç¥Þ¥¸¥Ã¥¯¥Ý¥¤¥ó¥È */
-       sprintf(tmp, "%4ld", p_ptr->msp);
+       sprintf(tmp, "%4ld", (long int)p_ptr->msp);
        color = TERM_L_GREEN;
 
        c_put_str(color, tmp, ROW_CURSP, COL_CURSP + 8);
@@ -978,24 +1050,21 @@ static void prt_depth(void)
                else (void)sprintf(depths, "Lev %d", dun_level);
 #endif
 
-               attr = TERM_SLATE;
 
                /* Get color of level based on feeling  -JSV- */
-               if ((turn - old_turn >= (150 - dun_level) * TURNS_PER_TICK) || cheat_xtra)
+               switch (p_ptr->feeling)
                {
-                       switch (feeling)
-                       {
-                       case  1: attr = TERM_L_BLUE;  break; /* Special */
-                       case  2: attr = TERM_VIOLET;  break; /* Horrible visions */
-                       case  3: attr = TERM_RED;     break; /* Very dangerous */
-                       case  4: attr = TERM_L_RED;   break; /* Very bad feeling */
-                       case  5: attr = TERM_ORANGE;  break; /* Bad feeling */
-                       case  6: attr = TERM_YELLOW;  break; /* Nervous */
-                       case  7: attr = TERM_L_UMBER; break; /* Luck is turning */
-                       case  8: attr = TERM_L_WHITE; break; /* Don't like */
-                       case  9: attr = TERM_WHITE;   break; /* Reasonably safe */
-                       case 10: attr = TERM_WHITE;   break; /* Boring place */
-                       }
+               case  0: attr = TERM_SLATE;   break; /* Unknown */
+               case  1: attr = TERM_L_BLUE;  break; /* Special */
+               case  2: attr = TERM_VIOLET;  break; /* Horrible visions */
+               case  3: attr = TERM_RED;     break; /* Very dangerous */
+               case  4: attr = TERM_L_RED;   break; /* Very bad feeling */
+               case  5: attr = TERM_ORANGE;  break; /* Bad feeling */
+               case  6: attr = TERM_YELLOW;  break; /* Nervous */
+               case  7: attr = TERM_L_UMBER; break; /* Luck is turning */
+               case  8: attr = TERM_L_WHITE; break; /* Don't like */
+               case  9: attr = TERM_WHITE;   break; /* Reasonably safe */
+               case 10: attr = TERM_WHITE;   break; /* Boring place */
                }
        }
 
@@ -1242,6 +1311,15 @@ sprintf(text, "  %2d", command_rep);
 #endif
                                break;
                        }
+                       case ACTION_SPELL:
+                       {
+#ifdef JP
+                               strcpy(text, "±Ó¾§");
+#else
+                               strcpy(text, "Spel");
+#endif
+                               break;
+                       }
                        default:
                        {
                                strcpy(text, "    ");
@@ -1272,15 +1350,16 @@ static void prt_speed(void)
        row_speed = hgt + ROW_SPEED;
 
        /* Hack -- Visually "undo" the Search Mode Slowdown */
-       if (p_ptr->action == ACTION_SEARCH) i += 10;
+       if (p_ptr->action == ACTION_SEARCH && !p_ptr->lightspeed) i += 10;
 
        /* Fast */
        if (i > 110)
        {
                if (p_ptr->riding)
                {
-                       if (m_list[p_ptr->riding].fast && !m_list[p_ptr->riding].slow) attr = TERM_L_BLUE;
-                       else if (m_list[p_ptr->riding].slow && !m_list[p_ptr->riding].fast) attr = TERM_VIOLET;
+                       monster_type *m_ptr = &m_list[p_ptr->riding];
+                       if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
+                       else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
                        else attr = TERM_GREEN;
                }
                else if ((is_fast && !p_ptr->slow) || p_ptr->lightspeed) attr = TERM_YELLOW;
@@ -1299,8 +1378,9 @@ static void prt_speed(void)
        {
                if (p_ptr->riding)
                {
-                       if (m_list[p_ptr->riding].fast && !m_list[p_ptr->riding].slow) attr = TERM_L_BLUE;
-                       else if (m_list[p_ptr->riding].slow && !m_list[p_ptr->riding].fast) attr = TERM_VIOLET;
+                       monster_type *m_ptr = &m_list[p_ptr->riding];
+                       if (MON_FAST(m_ptr) && !MON_SLOW(m_ptr)) attr = TERM_L_BLUE;
+                       else if (MON_SLOW(m_ptr) && !MON_FAST(m_ptr)) attr = TERM_VIOLET;
                        else attr = TERM_RED;
                }
                else if (is_fast && !p_ptr->slow) attr = TERM_YELLOW;
@@ -1351,7 +1431,7 @@ static void prt_study(void)
 }
 
 
-static void prt_mane(void)
+static void prt_imitation(void)
 {
        int wid, hgt, row_study, col_study;
 
@@ -1369,7 +1449,7 @@ static void prt_mane(void)
 #ifdef JP
                        c_put_str(attr, "¤Þ¤Í", row_study, col_study);
 #else
-                       c_put_str(attr, "Mane", row_study, col_study);
+                       c_put_str(attr, "Imit", row_study, col_study);
 #endif
                }
                else
@@ -1571,13 +1651,13 @@ static void health_redraw(bool riding)
                byte attr = TERM_RED;
 
                /* Invulnerable */
-               if (m_ptr->invulner) attr = TERM_WHITE;
+               if (MON_INVULNER(m_ptr)) attr = TERM_WHITE;
 
                /* Asleep */
-               else if (m_ptr->csleep) attr = TERM_BLUE;
+               else if (MON_CSLEEP(m_ptr)) attr = TERM_BLUE;
 
                /* Afraid */
-               else if (m_ptr->monfear) attr = TERM_VIOLET;
+               else if (MON_MONFEAR(m_ptr)) attr = TERM_VIOLET;
 
                /* Healthy */
                else if (pct >= 100) attr = TERM_L_GREEN;
@@ -1673,7 +1753,7 @@ static void prt_frame_extra(void)
        /* Study spells */
        prt_study();
 
-       prt_mane();
+       prt_imitation();
 
        prt_status();
 }
@@ -1712,6 +1792,153 @@ static void fix_inven(void)
 }
 
 
+/*
+ * Print monster info in line
+ * nnn X LV name
+ *  nnn : number or unique(U) or wanted unique(W)
+ *  X   : symbol of monster
+ *  LV  : monster lv if known
+ *  name: name of monster
+ */
+static void print_monster_line(int x, int y, monster_type* m_ptr, int n_same){
+       char buf[256];
+       int i;
+       int r_idx = m_ptr->ap_r_idx;
+       monster_race* r_ptr = &r_info[r_idx];
+       Term_gotoxy(x, y);
+       if(!r_ptr)return;
+       //Number of 'U'nique
+       if(r_ptr->flags1&RF1_UNIQUE){//unique
+               bool is_kubi = FALSE;
+               for(i=0;i<MAX_KUBI;i++){
+                       if(kubi_r_idx[i] == r_idx){
+                               is_kubi = TRUE;
+                               break;
+                       }
+               }
+               Term_addstr(-1, TERM_WHITE, is_kubi?"  W":"  U");
+       }else{
+               sprintf(buf, "%3d", n_same);
+               Term_addstr(-1, TERM_WHITE, buf);
+       }
+       //symbol
+       Term_addstr(-1, TERM_WHITE, " ");
+       //Term_add_bigch(r_ptr->d_attr, r_ptr->d_char);
+       //Term_addstr(-1, TERM_WHITE, "/");
+       Term_add_bigch(r_ptr->x_attr, r_ptr->x_char);
+       //LV
+       if (r_ptr->r_tkills && !(m_ptr->mflag2 & MFLAG2_KAGE)){
+               sprintf(buf, " %2d", r_ptr->level);
+       }else{
+               strcpy(buf, " ??");
+       }
+       Term_addstr(-1, TERM_WHITE, buf);
+       //name
+       sprintf(buf, " %s ", r_name+r_ptr->name);
+       Term_addstr(-1, TERM_WHITE, buf);
+       //Term_addstr(-1, TERM_WHITE, look_mon_desc(m_ptr, 0));
+}
+
+ /*
+       max_lines : ºÇÂ粿¹ÔÉÁ²è¤¹¤ë¤«¡¥
+*/
+void print_monster_list(int x, int y, int max_lines){
+       int line = y;
+       monster_type* last_mons = NULL;
+       monster_type* m_ptr = NULL;
+       int n_same = 0;
+       int i;
+
+       for(i=0;i<temp_n;i++){
+               cave_type* c_ptr = &cave[temp_y[i]][temp_x[i]];
+               if(!c_ptr->m_idx || !m_list[c_ptr->m_idx].ml)continue;//no mons or cannot look
+               m_ptr = &m_list[c_ptr->m_idx];
+               if(is_pet(m_ptr))continue;//pet
+               if(!m_ptr->r_idx)continue;//dead?
+               {
+                       /*
+                       int r_idx = m_ptr->ap_r_idx;
+                       monster_race* r_ptr = &r_info[r_idx];
+                       cptr name = (r_name + r_ptr->name);
+                       cptr ename = (r_name + r_ptr->name);
+                       //¥ß¥ß¥Ã¥¯Îà¤ä¡Ö¤½¤ì¡×Åù¤Ï¡¢°ìÍ÷¤Ë½Ð¤Æ¤Ï¤¤¤±¤Ê¤¤
+                       if(r_ptr->flags1&RF1_CHAR_CLEAR)continue;
+                       if((r_ptr->flags1&RF1_NEVER_MOVE)&&(r_ptr->flags2&RF2_CHAR_MULTI))continue;
+                       //¡Ø¥Ì¥ë¡Ù¤Ï¡¢°ìÍ÷¤Ë½Ð¤Æ¤Ï¤¤¤±¤Ê¤¤
+                       if((strcmp(name, "À¸¤±¤ëµõ̵¡Ø¥Ì¥ë¡Ù")==0)||
+                          (strcmp(ename, "Null the Living Void")==0))continue;
+                       //"¶â̵¹¤¤Î»ØÎØ"¤Ï¡¢°ìÍ÷¤Ë½Ð¤Æ¤Ï¤¤¤±¤Ê¤¤
+                       if((strcmp(name, "¶â̵¹¤¤Î»ØÎØ")==0)||
+                               (strcmp(ename, "Plain Gold Ring")==0))continue;
+                       */
+               }
+
+               //¥½¡¼¥ÈºÑ¤ß¤Ê¤Î¤ÇƱ¤¸¥â¥ó¥¹¥¿¡¼¤ÏϢ³¤¹¤ë¡¥¤³¤ì¤òÍøÍѤ·¤ÆƱ¤¸¥â¥ó¥¹¥¿¡¼¤ò¥«¥¦¥ó¥È¡¤¤Þ¤È¤á¤Æɽ¼¨¤¹¤ë¡¥
+               if(!last_mons){//ÀèƬ¥â¥ó¥¹¥¿¡¼
+                       last_mons = m_ptr;
+                       n_same = 1;
+                       continue;
+               }
+               //same race?
+               if(last_mons->ap_r_idx == m_ptr->ap_r_idx){
+                       n_same++;
+                       continue;//ɽ¼¨½èÍý¤ò¼¡¤Ë²ó¤¹
+               }
+               //print last mons info
+               print_monster_line(x, line++, last_mons, n_same);
+               n_same = 1;
+               last_mons = m_ptr;
+               if(line-y-1==max_lines){//»Ä¤ê1¹Ô
+                       break;
+               }
+       }
+       if(line-y-1==max_lines && i!=temp_n){
+               Term_gotoxy(x, line);
+               Term_addstr(-1, TERM_WHITE, "-- and more --");
+       }else{
+               if(last_mons)print_monster_line(x, line++, last_mons, n_same);
+       }
+}
+/*
+ * Hack -- display monster list in sub-windows
+ */
+static void fix_monster_list(void)
+{
+       int j;
+       int w, h;
+
+       /* Scan windows */
+       for (j = 0; j < 8; j++)
+       {
+               term *old = Term;
+
+               /* No window */
+               if (!angband_term[j]) continue;
+
+               /* No relevant flags */
+               if (!(window_flag[j] & (PW_MONSTER_LIST))) continue;
+
+               /* Activate */
+               Term_activate(angband_term[j]);
+               Term_get_size(&w, &h);
+
+               Term_clear();
+
+               target_set_prepare_look();//¥â¥ó¥¹¥¿¡¼°ìÍ÷¤òÀ¸À®¡¤¥½¡¼¥È
+               print_monster_list(0, 0, h);
+
+               /* Fresh */
+               Term_fresh();
+
+               /* Restore */
+               Term_activate(old);
+       }
+}
+
+
+
 
 /*
  * Hack -- display equipment in sub-windows
@@ -2018,9 +2245,9 @@ static void calc_spells(void)
 {
        int                     i, j, k, levels;
        int                     num_allowed;
-       int                     num_boukyaku = 0;
+       int         num_boukyaku = 0;
 
-       magic_type              *s_ptr;
+       const magic_type        *s_ptr;
        int which;
        int bonus = 0;
 
@@ -2321,7 +2548,7 @@ static void calc_spells(void)
                        /* Count it */
                        k++;
                }
-               if (k>32) k = 32;
+               if (k > 32) k = 32;
                if ((p_ptr->new_spells > k) && ((mp_ptr->spell_book == TV_LIFE_BOOK) || (mp_ptr->spell_book == TV_HISSATSU_BOOK))) p_ptr->new_spells = k;
        }
 
@@ -2438,7 +2665,9 @@ static void calc_mana(void)
                /* Normal gloves hurt mage-type spells */
                if (o_ptr->k_idx &&
                    !(have_flag(flgs, TR_FREE_ACT)) &&
-                   !(have_flag(flgs, TR_MAGIC_MASTERY)) &&
+                       !(have_flag(flgs, TR_DEC_MANA)) &&
+                       !(have_flag(flgs, TR_EASY_SPELL)) &&
+                       !((have_flag(flgs, TR_MAGIC_MASTERY)) && (o_ptr->pval > 0)) &&
                    !((have_flag(flgs, TR_DEX)) && (o_ptr->pval > 0)))
                {
                        /* Encumbered */
@@ -2744,6 +2973,10 @@ static void calc_hitpoints(void)
        if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER)) mhp += 30;
        if (p_ptr->tsuyoshi) mhp += 50;
 
+       /* Factor in the hex spell settings */
+       if (hex_spelling(HEX_XTRA_MIGHT)) mhp += 15;
+       if (hex_spelling(HEX_BUILDING)) mhp += 60;
+
        /* New maximum hitpoints */
        if (p_ptr->mhp != mhp)
        {
@@ -2783,7 +3016,7 @@ static void calc_hitpoints(void)
  */
 static void calc_torch(void)
 {
-       int i;
+       int i, rad;
        object_type *o_ptr;
        u32b flgs[TR_FLAG_SIZE];
 
@@ -2794,69 +3027,34 @@ static void calc_torch(void)
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
                o_ptr = &inventory[i];
-
-               /* Examine actual lites */
-               if ((i == INVEN_LITE) && (o_ptr->k_idx) && (o_ptr->tval == TV_LITE))
+               /* Skip empty slots */
+               if (!o_ptr->k_idx) continue;
+               
+               if (o_ptr->name2 == EGO_LITE_SHINE) p_ptr->cur_lite++;
+               
+               /* Need Fuels */
+               if (o_ptr->name2 != EGO_LITE_DARKNESS)
                {
-                       if (o_ptr->name2 == EGO_LITE_DARKNESS)
-                       {
-                               if (o_ptr->sval == SV_LITE_TORCH)
-                               {
-                                       p_ptr->cur_lite -= 1;
-                               }
-
-                               /* Lanterns (with fuel) provide more lite */
-                               else if (o_ptr->sval == SV_LITE_LANTERN)
-                               {
-                                       p_ptr->cur_lite -= 2;
-                               }
-
-                               else if (o_ptr->sval == SV_LITE_FEANOR)
-                               {
-                                       p_ptr->cur_lite -= 3;
-                               }
-                       }
-                       /* Torches (with fuel) provide some lite */
-                       else if ((o_ptr->sval == SV_LITE_TORCH) && (o_ptr->xtra4 > 0))
-                       {
-                               p_ptr->cur_lite += 1;
-                       }
-
-                       /* Lanterns (with fuel) provide more lite */
-                       else if ((o_ptr->sval == SV_LITE_LANTERN) && (o_ptr->xtra4 > 0))
-                       {
-                               p_ptr->cur_lite += 2;
-                       }
-
-                       else if (o_ptr->sval == SV_LITE_FEANOR)
+                       if (o_ptr->tval == TV_LITE)
                        {
-                               p_ptr->cur_lite += 2;
+                               if((o_ptr->sval == SV_LITE_TORCH) && !(o_ptr->xtra4 > 0)) continue;
+                               if((o_ptr->sval == SV_LITE_LANTERN) && !(o_ptr->xtra4 > 0)) continue;
                        }
-
-                       /* Artifact Lites provide permanent, bright, lite */
-                       else if (object_is_fixed_artifact(o_ptr))
-                       {
-                               p_ptr->cur_lite += 3;
-                       }
-
-                       if (o_ptr->name2 == EGO_LITE_SHINE) p_ptr->cur_lite++;
                }
-               else
-               {
-                       /* Skip empty slots */
-                       if (!o_ptr->k_idx) continue;
 
-                       /* Extract the flags */
-                       object_flags(o_ptr, flgs);
-
-                       /* does this item glow? */
-                       if (have_flag(flgs, TR_LITE))
-                       {
-                               if ((o_ptr->name2 == EGO_DARK) || (o_ptr->name1 == ART_NIGHT)) p_ptr->cur_lite--;
-                               else p_ptr->cur_lite++;
-                       }
-               }
+               /* Extract the flags */
+               object_flags(o_ptr, flgs);
 
+               /* calc the lite_radius */
+               
+               rad = 0;
+               if (have_flag(flgs, TR_LITE_1) && o_ptr->name2 != EGO_LITE_DARKNESS)  rad += 1;
+               if (have_flag(flgs, TR_LITE_2) && o_ptr->name2 != EGO_LITE_DARKNESS)  rad += 2;
+               if (have_flag(flgs, TR_LITE_3) && o_ptr->name2 != EGO_LITE_DARKNESS)  rad += 3;
+               if (have_flag(flgs, TR_LITE_M1)) rad -= 1;
+               if (have_flag(flgs, TR_LITE_M2)) rad -= 2;
+               if (have_flag(flgs, TR_LITE_M3)) rad -= 3;
+               p_ptr->cur_lite += rad;
        }
 
        /* max radius is 14 (was 5) without rewriting other code -- */
@@ -2913,6 +3111,120 @@ bool buki_motteruka(int i)
        return ((inventory[i].k_idx && object_is_melee_weapon(&inventory[i])) ? TRUE : FALSE);
 }
 
+bool is_heavy_shoot(object_type *o_ptr)
+{
+       int hold = adj_str_hold[p_ptr->stat_ind[A_STR]];
+       /* It is hard to carholdry a heavy bow */
+       return (hold < o_ptr->weight / 10);
+}
+
+int bow_tval_ammo(object_type *o_ptr)
+{
+       /* Analyze the launcher */
+       switch (o_ptr->sval)
+       {
+               case SV_SLING:
+               {
+                       return TV_SHOT;
+               }
+
+               case SV_SHORT_BOW:
+               case SV_LONG_BOW:
+               case SV_NAMAKE_BOW:
+               {
+                       return TV_ARROW;
+               }
+
+               case SV_LIGHT_XBOW:
+               case SV_HEAVY_XBOW:
+               {
+                       return TV_BOLT;
+               }
+               case SV_CRIMSON:
+               {
+                       return TV_NO_AMMO;
+               }
+       }
+       
+       return 0;
+}
+
+/* calcurate the fire rate of target object */
+s16b calc_num_fire(object_type *o_ptr)
+{
+       int extra_shots = 0;
+       int i;
+       int num = 0;
+       int tval_ammo = bow_tval_ammo(o_ptr);
+       object_type *q_ptr;
+       u32b flgs[TR_FLAG_SIZE];
+       
+       /* Scan the usable inventory */
+       for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
+       {
+               q_ptr = &inventory[i];
+
+               /* Skip non-objects */
+               if (!q_ptr->k_idx) continue;
+               
+               /* Do not apply current equip */
+               if (i == INVEN_BOW) continue;
+
+               /* Extract the item flags */
+               object_flags(q_ptr, flgs);
+
+               /* Boost shots */
+               if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
+       }
+       
+       object_flags(o_ptr, flgs);
+       if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
+       
+       if (o_ptr->k_idx && !is_heavy_shoot(o_ptr))
+       {
+               num = 100;
+               /* Extra shots */
+               num += (extra_shots * 100);
+
+               /* Hack -- Rangers love Bows */
+               if ((p_ptr->pclass == CLASS_RANGER) && 
+                                       (tval_ammo == TV_ARROW))
+               {
+                       num += (p_ptr->lev * 4);
+               }
+
+               if ((p_ptr->pclass == CLASS_CAVALRY) &&
+                   (tval_ammo == TV_ARROW))
+               {
+                       num += (p_ptr->lev * 3);
+               }
+
+               if (p_ptr->pclass == CLASS_ARCHER)
+               {
+                       if (tval_ammo == TV_ARROW)
+                               num += ((p_ptr->lev * 5)+50);
+                       else if ((tval_ammo == TV_BOLT) || (tval_ammo == TV_SHOT))
+                               num += (p_ptr->lev * 4);
+               }
+
+               /*
+                * Addendum -- also "Reward" high level warriors,
+                * with _any_ missile weapon -- TY
+                */
+               if (p_ptr->pclass == CLASS_WARRIOR &&
+                  (tval_ammo <= TV_BOLT) &&
+                  (tval_ammo >= TV_SHOT))
+               {
+                       num += (p_ptr->lev * 2);
+               }
+               if ((p_ptr->pclass == CLASS_ROGUE) &&
+                   (tval_ammo == TV_SHOT))
+               {
+                       num += (p_ptr->lev * 4);
+               }
+       }
+       return num;
+}
 
 /*
  * Calculate the players current "state", taking into account
@@ -2941,7 +3253,6 @@ void calc_bonuses(void)
        int             default_hand = 0;
        int             empty_hands_status = empty_hands(TRUE);
        int             extra_blows[2];
-       int             extra_shots;
        object_type     *o_ptr;
        u32b flgs[TR_FLAG_SIZE];
        bool            omoi = FALSE;
@@ -2954,7 +3265,7 @@ void calc_bonuses(void)
        bool            easy_2weapon = FALSE;
        bool            riding_levitation = FALSE;
        s16b this_o_idx, next_o_idx = 0;
-       player_race *tmp_rp_ptr;
+       const player_race *tmp_rp_ptr;
 
        /* Save the old vision stuff */
        bool old_telepathy = p_ptr->telepathy;
@@ -2979,7 +3290,7 @@ void calc_bonuses(void)
 
 
        /* Clear extra blows/shots */
-       extra_blows[0] = extra_blows[1] = extra_shots = 0;
+       extra_blows[0] = extra_blows[1] = 0;
 
        /* Clear the stat modifiers */
        for (i = 0; i < 6; i++) p_ptr->stat_add[i] = 0;
@@ -3140,7 +3451,7 @@ void calc_bonuses(void)
                if (!p_ptr->migite) default_hand = 1;
        }
 
-       if (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE))
+       if (CAN_TWO_HANDS_WIELDING())
        {
                if (p_ptr->migite && (empty_hands(FALSE) == EMPTY_HAND_LARM) &&
                        object_allow_two_hands_wielding(&inventory[INVEN_RARM]))
@@ -3545,7 +3856,7 @@ void calc_bonuses(void)
                case RACE_S_FAIRY:
                        p_ptr->levitation = TRUE;
                        break;
-               case RACE_KUTA:
+               case RACE_KUTAR:
                        p_ptr->resist_conf = TRUE;
                        break;
                case RACE_ANDROID:
@@ -3882,13 +4193,24 @@ void calc_bonuses(void)
                /* Hack -- cause earthquakes */
                if (have_flag(flgs, TR_IMPACT)) p_ptr->impact[(i == INVEN_RARM) ? 0 : 1] = TRUE;
 
-               /* Boost shots */
-               if (have_flag(flgs, TR_XTRA_SHOTS)) extra_shots++;
-
                /* Various flags */
                if (have_flag(flgs, TR_AGGRAVATE))   p_ptr->cursed |= TRC_AGGRAVATE;
                if (have_flag(flgs, TR_DRAIN_EXP))   p_ptr->cursed |= TRC_DRAIN_EXP;
                if (have_flag(flgs, TR_TY_CURSE))    p_ptr->cursed |= TRC_TY_CURSE;
+               if (have_flag(flgs, TR_ADD_L_CURSE)) p_ptr->cursed |= TRC_ADD_L_CURSE;
+               if (have_flag(flgs, TR_ADD_H_CURSE)) p_ptr->cursed |= TRC_ADD_H_CURSE;
+               if (have_flag(flgs, TR_DRAIN_HP))    p_ptr->cursed |= TRC_DRAIN_HP;
+               if (have_flag(flgs, TR_DRAIN_MANA))  p_ptr->cursed |= TRC_DRAIN_MANA;
+               if (have_flag(flgs, TR_CALL_ANIMAL)) p_ptr->cursed |= TRC_CALL_ANIMAL;
+               if (have_flag(flgs, TR_CALL_DEMON))  p_ptr->cursed |= TRC_CALL_DEMON;
+               if (have_flag(flgs, TR_CALL_DRAGON)) p_ptr->cursed |= TRC_CALL_DRAGON;
+               if (have_flag(flgs, TR_CALL_UNDEAD)) p_ptr->cursed |= TRC_CALL_UNDEAD;
+               if (have_flag(flgs, TR_COWARDICE))   p_ptr->cursed |= TRC_COWARDICE;
+               if (have_flag(flgs, TR_LOW_MELEE))   p_ptr->cursed |= TRC_LOW_MELEE;
+               if (have_flag(flgs, TR_LOW_AC))      p_ptr->cursed |= TRC_LOW_AC;
+               if (have_flag(flgs, TR_LOW_MAGIC))   p_ptr->cursed |= TRC_LOW_MAGIC;
+               if (have_flag(flgs, TR_FAST_DIGEST)) p_ptr->cursed |= TRC_FAST_DIGEST;
+               if (have_flag(flgs, TR_SLOW_REGEN))  p_ptr->cursed |= TRC_SLOW_REGEN;
                if (have_flag(flgs, TR_DEC_MANA))    p_ptr->dec_mana = TRUE;
                if (have_flag(flgs, TR_BLESSED))     p_ptr->bless_blade = TRUE;
                if (have_flag(flgs, TR_XTRA_MIGHT))  p_ptr->xtra_might = TRUE;
@@ -4213,6 +4535,49 @@ void calc_bonuses(void)
                p_ptr->dis_to_a += 10 + (p_ptr->lev * 2 / 5);
        }
 
+       /* Hex bonuses */
+       if (p_ptr->realm1 == REALM_HEX)
+       {
+               if (hex_spelling_any()) p_ptr->skill_stl -= (1 + p_ptr->magic_num2[0]);
+               if (hex_spelling(HEX_DETECT_EVIL)) p_ptr->esp_evil = TRUE;
+               if (hex_spelling(HEX_XTRA_MIGHT)) p_ptr->stat_add[A_STR] += 4;
+               if (hex_spelling(HEX_BUILDING))
+               {
+                       p_ptr->stat_add[A_STR] += 4;
+                       p_ptr->stat_add[A_DEX] += 4;
+                       p_ptr->stat_add[A_CON] += 4;
+               }
+               if (hex_spelling(HEX_DEMON_AURA))
+               {
+                       p_ptr->sh_fire = TRUE;
+                       p_ptr->regenerate = TRUE;
+               }
+               if (hex_spelling(HEX_ICE_ARMOR))
+               {
+                       p_ptr->sh_cold = TRUE; 
+                       p_ptr->to_a += 30;
+                       p_ptr->dis_to_a += 30;
+               }
+               if (hex_spelling(HEX_SHOCK_CLOAK))
+               {
+                       p_ptr->sh_elec = TRUE;
+                       new_speed += 3;
+               }
+               for (i = INVEN_RARM; i <= INVEN_FEET; i++)
+               {
+                       int ac = 0;
+                       o_ptr = &inventory[i];
+                       if (!o_ptr->k_idx) continue;
+                       if (!object_is_armour(o_ptr)) continue;
+                       if (!object_is_cursed(o_ptr)) continue;
+                       ac += 5;
+                       if (o_ptr->curse_flags & TRC_HEAVY_CURSE) ac += 7;
+                       if (o_ptr->curse_flags & TRC_PERMA_CURSE) ac += 13;
+                       p_ptr->to_a += ac;
+                       p_ptr->dis_to_a += ac;
+               }
+       }
+
        /* Calculate stats */
        for (i = 0; i < 6; i++)
        {
@@ -4596,8 +4961,8 @@ void calc_bonuses(void)
                        new_speed = speed;
                }
                new_speed += (p_ptr->skill_exp[GINOU_RIDING] + p_ptr->lev *160L)/3200;
-               if (riding_m_ptr->fast) new_speed += 10;
-               if (riding_m_ptr->slow) new_speed -= 10;
+               if (MON_FAST(riding_m_ptr)) new_speed += 10;
+               if (MON_SLOW(riding_m_ptr)) new_speed -= 10;
                riding_levitation = (riding_r_ptr->flags7 & RF7_CAN_FLY) ? TRUE : FALSE;
                if (riding_r_ptr->flags7 & (RF7_CAN_SWIM | RF7_AQUATIC)) p_ptr->can_swim = TRUE;
 
@@ -4649,96 +5014,32 @@ void calc_bonuses(void)
        /* Examine the "current bow" */
        o_ptr = &inventory[INVEN_BOW];
 
-
-       /* Assume not heavy */
-       p_ptr->heavy_shoot = FALSE;
-
        /* It is hard to carholdry a heavy bow */
-       if (hold < o_ptr->weight / 10)
+       p_ptr->heavy_shoot = is_heavy_shoot(o_ptr);
+       if (p_ptr->heavy_shoot)
        {
                /* Hard to wield a heavy bow */
                p_ptr->to_h_b  += 2 * (hold - o_ptr->weight / 10);
                p_ptr->dis_to_h_b  += 2 * (hold - o_ptr->weight / 10);
-
-               /* Heavy Bow */
-               p_ptr->heavy_shoot = TRUE;
        }
 
-
        /* Compute "extra shots" if needed */
        if (o_ptr->k_idx)
        {
-               /* Analyze the launcher */
-               switch (o_ptr->sval)
-               {
-                       case SV_SLING:
-                       {
-                               p_ptr->tval_ammo = TV_SHOT;
-                               break;
-                       }
-
-                       case SV_SHORT_BOW:
-                       case SV_LONG_BOW:
-                       case SV_NAMAKE_BOW:
-                       {
-                               p_ptr->tval_ammo = TV_ARROW;
-                               break;
-                       }
-
-                       case SV_LIGHT_XBOW:
-                       case SV_HEAVY_XBOW:
-                       {
-                               p_ptr->tval_ammo = TV_BOLT;
-                               break;
-                       }
-                       case SV_CRIMSON:
-                       {
-                               p_ptr->tval_ammo = TV_NO_AMMO;
-                               break;
-                       }
-               }
+               p_ptr->tval_ammo = bow_tval_ammo(o_ptr);
 
                /* Apply special flags */
                if (o_ptr->k_idx && !p_ptr->heavy_shoot)
                {
                        /* Extra shots */
-                       p_ptr->num_fire += (extra_shots * 100);
-
-                       /* Hack -- Rangers love Bows */
-                       if ((p_ptr->pclass == CLASS_RANGER) &&
-                           (p_ptr->tval_ammo == TV_ARROW))
-                       {
-                               p_ptr->num_fire += (p_ptr->lev * 4);
-                       }
-
-                       if ((p_ptr->pclass == CLASS_CAVALRY) &&
-                           (p_ptr->tval_ammo == TV_ARROW))
-                       {
-                               p_ptr->num_fire += (p_ptr->lev * 3);
-                       }
-
-                       if (p_ptr->pclass == CLASS_ARCHER)
-                       {
-                               if (p_ptr->tval_ammo == TV_ARROW)
-                                       p_ptr->num_fire += ((p_ptr->lev * 5)+50);
-                               else if ((p_ptr->tval_ammo == TV_BOLT) || (p_ptr->tval_ammo == TV_SHOT))
-                                       p_ptr->num_fire += (p_ptr->lev * 4);
-                       }
+                       p_ptr->num_fire = calc_num_fire(o_ptr);
 
-                       /*
-                        * Addendum -- also "Reward" high level warriors,
-                        * with _any_ missile weapon -- TY
-                        */
-                       if (p_ptr->pclass == CLASS_WARRIOR &&
-                          (p_ptr->tval_ammo <= TV_BOLT) &&
-                          (p_ptr->tval_ammo >= TV_SHOT))
-                       {
-                               p_ptr->num_fire += (p_ptr->lev * 2);
-                       }
-                       if ((p_ptr->pclass == CLASS_ROGUE) &&
-                           (p_ptr->tval_ammo == TV_SHOT))
+                       /* Snipers love Cross bows */
+                       if ((p_ptr->pclass == CLASS_SNIPER) &&
+                               (p_ptr->tval_ammo == TV_BOLT))
                        {
-                               p_ptr->num_fire += (p_ptr->lev * 4);
+                               p_ptr->to_h_b += (10 + (p_ptr->lev / 5));
+                               p_ptr->dis_to_h_b += (10 + (p_ptr->lev / 5));
                        }
                }
        }
@@ -4801,7 +5102,7 @@ void calc_bonuses(void)
                                case CLASS_BLUE_MAGE:
                                        num = 3; wgt = 100; mul = 2; break;
 
-                               /* Priest, Mindcrafter */
+                               /* Priest, Mindcrafter, Magic-Eater */
                                case CLASS_PRIEST:
                                case CLASS_MAGIC_EATER:
                                case CLASS_MINDCRAFTER:
@@ -4820,7 +5121,7 @@ void calc_bonuses(void)
                                case CLASS_SAMURAI:
                                        num = 5; wgt = 70; mul = 4; break;
 
-                               /* Kaji */
+                               /* Weaponsmith */
                                case CLASS_SMITH:
                                        num = 5; wgt = 150; mul = 5; break;
 
@@ -4849,6 +5150,7 @@ void calc_bonuses(void)
                                case CLASS_BEASTMASTER:
                                        num = 5; wgt = 70; mul = 3; break;
 
+                               /* Cavalry */
                                case CLASS_CAVALRY:
                                        if ((p_ptr->riding) && (have_flag(flgs, TR_RIDING))) {num = 5; wgt = 70; mul = 4;}
                                        else {num = 5; wgt = 100; mul = 3;}
@@ -4858,9 +5160,10 @@ void calc_bonuses(void)
                                case CLASS_SORCERER:
                                        num = 1; wgt = 1; mul = 1; break;
 
-                               /* Archer, Magic eater */
+                               /* Archer, Bard, Sniper */
                                case CLASS_ARCHER:
                                case CLASS_BARD:
+                               case CLASS_SNIPER:
                                        num = 4; wgt = 70; mul = 2; break;
 
                                /* ForceTrainer */
@@ -4876,6 +5179,9 @@ void calc_bonuses(void)
                                        num = 4; wgt = 20; mul = 1; break;
                        }
 
+                       /* Hex - extra mights gives +1 bonus to max blows */
+                       if (hex_spelling(HEX_XTRA_MIGHT) || hex_spelling(HEX_BUILDING)) { num++; wgt /= 2; mul += 2; }
+
                        /* Enforce a minimum "weight" (tenth pounds) */
                        div = ((o_ptr->weight < wgt) ? wgt : o_ptr->weight);
 
@@ -4979,6 +5285,23 @@ void calc_bonuses(void)
                                p_ptr->dis_to_d[i] -= 10;
                        }
                }
+               /* Hex bonuses */
+               if (p_ptr->realm1 == REALM_HEX)
+               {
+                       if (object_is_cursed(o_ptr))
+                       {
+                               if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; }
+                               if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_h[i] += 7; p_ptr->dis_to_h[i] += 7; }
+                               if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_h[i] += 13; p_ptr->dis_to_h[i] += 13; }
+                               if (o_ptr->curse_flags & (TRC_TY_CURSE)) { p_ptr->to_h[i] += 5; p_ptr->dis_to_h[i] += 5; }
+                               if (hex_spelling(HEX_RUNESWORD))
+                               {
+                                       if (o_ptr->curse_flags & (TRC_CURSED)) { p_ptr->to_d[i] += 5; p_ptr->dis_to_d[i] += 5; }
+                                       if (o_ptr->curse_flags & (TRC_HEAVY_CURSE)) { p_ptr->to_d[i] += 7; p_ptr->dis_to_d[i] += 7; }
+                                       if (o_ptr->curse_flags & (TRC_PERMA_CURSE)) { p_ptr->to_d[i] += 13; p_ptr->dis_to_d[i] += 13; }
+                               }
+                       }
+               }
                if (p_ptr->riding)
                {
                        if ((o_ptr->tval == TV_POLEARM) && ((o_ptr->sval == SV_LANCE) || (o_ptr->sval == SV_HEAVY_LANCE)))
@@ -5572,25 +5895,25 @@ msg_print("
 #if 0
        if (have_dd_s && ((p_ptr->realm1 == REALM_SORCERY) || (p_ptr->realm2 == REALM_SORCERY) || (p_ptr->pclass == CLASS_SORCERER)))
        {
-               magic_type *s_ptr = &mp_ptr->info[REALM_SORCERY-1][SPELL_DD_S];
+               const magic_type *s_ptr = &mp_ptr->info[REALM_SORCERY-1][SPELL_DD_S];
                if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
        }
 
        if (have_dd_t && ((p_ptr->realm1 == REALM_TRUMP) || (p_ptr->realm2 == REALM_TRUMP) || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)))
        {
-               magic_type *s_ptr = &mp_ptr->info[REALM_TRUMP-1][SPELL_DD_T];
+               const magic_type *s_ptr = &mp_ptr->info[REALM_TRUMP-1][SPELL_DD_T];
                if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
        }
 #endif
        if (have_sw && ((p_ptr->realm1 == REALM_NATURE) || (p_ptr->realm2 == REALM_NATURE) || (p_ptr->pclass == CLASS_SORCERER)))
        {
-               magic_type *s_ptr = &mp_ptr->info[REALM_NATURE-1][SPELL_SW];
+               const magic_type *s_ptr = &mp_ptr->info[REALM_NATURE-1][SPELL_SW];
                if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
        }
 
        if (have_kabe && ((p_ptr->realm1 == REALM_CRAFT) || (p_ptr->realm2 == REALM_CRAFT) || (p_ptr->pclass == CLASS_SORCERER)))
        {
-               magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT-1][SPELL_KABE];
+               const magic_type *s_ptr = &mp_ptr->info[REALM_CRAFT-1][SPELL_KABE];
                if (p_ptr->lev >= s_ptr->slevel) p_ptr->no_flowed = TRUE;
        }
 }
@@ -5885,7 +6208,7 @@ void redraw_stuff(void)
                p_ptr->redraw &= ~(PR_EXTRA);
                p_ptr->redraw &= ~(PR_CUT | PR_STUN);
                p_ptr->redraw &= ~(PR_HUNGER);
-               p_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_MANE | PR_STATUS);
+               p_ptr->redraw &= ~(PR_STATE | PR_SPEED | PR_STUDY | PR_IMITATION | PR_STATUS);
                prt_frame_extra();
        }
 
@@ -5921,10 +6244,10 @@ void redraw_stuff(void)
 
        if (p_ptr->pclass == CLASS_IMITATOR)
        {
-               if (p_ptr->redraw & (PR_MANE))
+               if (p_ptr->redraw & (PR_IMITATION))
                {
-                       p_ptr->redraw &= ~(PR_MANE);
-                       prt_mane();
+                       p_ptr->redraw &= ~(PR_IMITATION);
+                       prt_imitation();
                }
        }
        else if (p_ptr->redraw & (PR_STUDY))
@@ -5989,7 +6312,14 @@ void window_stuff(void)
                p_ptr->window &= ~(PW_PLAYER);
                fix_player();
        }
-
+       
+       /* Display monster list */
+       if (p_ptr->window & (PW_MONSTER_LIST))
+       {
+               p_ptr->window &= ~(PW_MONSTER_LIST);
+               fix_monster_list();
+       }
+       
        /* Display overhead view */
        if (p_ptr->window & (PW_MESSAGE))
        {
@@ -6077,3 +6407,14 @@ bool heavy_armor(void)
 
        return (monk_arm_wgt > (100 + (p_ptr->lev * 4)));
 }
+
+void update_playtime(void)
+{
+       /* Check if the game has started */
+       if (start_time != 0)
+       {
+               u32b tmp = time(NULL);
+               playtime += (tmp - start_time);
+               start_time = tmp;
+       }
+}