OSDN Git Service

Extend features of tiling. (separation of Cell size and Tile size / add offset position.)
[hengband/hengband.git] / src / xtra2.c
index 64f7a09..90bf7fc 100644 (file)
@@ -1,22 +1,25 @@
-/* File: xtra2.c */
-
-/*
- * 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.  Other copyrights may also apply.
+/*!
+ * @file xtra2.c
+ * @brief »¨Â¿¤Ê¤½¤Î¾¤Î½èÍý2 / effects of various "objects"
+ * @date 2014/02/06
+ * @author
+ * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke\n
+ * This software may be copied and distributed for educational, research, and\n
+ * not for profit purposes provided that this copyright and statement are\n
+ * included in all such copies.\n
+ * 2014 Deskull rearranged comment for Doxygen.
  */
 
-/* Purpose: effects of various "objects" */
 
 #include "angband.h"
 
 #define REWARD_CHANCE 10
 
 
-/*
+/*!
+ * @brief ¥×¥ì¥¤¥ä¡¼¤Î·Ð¸³ÃͤˤĤ¤¤ÆÀ°¹çÀ­¤Î¤¿¤á¤Î¥Á¥§¥Ã¥¯¤ÈÄ´À°¤ò¹Ô¤¦ /
  * Advance experience levels and print experience
+ * @return ¤Ê¤·
  */
 void check_experience(void)
 {
@@ -227,10 +230,13 @@ msg_print("
 }
 
 
-/*
+/*!
+ * @brief ¥â¥ó¥¹¥¿¡¼¤òÅݤ·¤¿ºÝ¤ÎºâÊõsval¤òÊÖ¤¹
+ * @param r_idx Åݤ·¤¿¥â¥ó¥¹¥¿¡¼¤Î¼ï²ID
+ * @return ºâÊõ¤Îsval
+ * @details
  * Hack -- Return the "automatic coin type" of a monster race
  * Used to allocate proper treasure when "Creeping coins" die
- *
  * XXX XXX XXX Note the use of actual "monster names"
  */
 static int get_coin_type(int r_idx)
@@ -251,8 +257,11 @@ static int get_coin_type(int r_idx)
 }
 
 
-/*
+/*!
+ * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥¯¥í¡¼¥¯¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
  * Hack -- determine if a template is Cloak
+ * @param k_idx È½Äꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
+ * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥¯¥í¡¼¥¯¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
  */
 static bool kind_is_cloak(int k_idx)
 {
@@ -269,8 +278,11 @@ static bool kind_is_cloak(int k_idx)
 }
 
 
-/*
+/*!
+ * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬´È¾õÉð´ï¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
  * Hack -- determine if a template is Polearm
+ * @param k_idx È½Äꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
+ * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬´È¾õÉð´ï¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
  */
 static bool kind_is_polearm(int k_idx)
 {
@@ -287,8 +299,11 @@ static bool kind_is_polearm(int k_idx)
 }
 
 
-/*
+/*!
+ * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬·õ¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
  * Hack -- determine if a template is Sword
+ * @param k_idx È½Äꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
+ * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬·õ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
  */
 static bool kind_is_sword(int k_idx)
 {
@@ -305,8 +320,11 @@ static bool kind_is_sword(int k_idx)
 }
 
 
-/*
+/*!
+ * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬ËâË¡½ñ¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
  * Hack -- determine if a template is Book
+ * @param k_idx È½Äꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
+ * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬ËâË¡½ñ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
  */
 static bool kind_is_book(int k_idx)
 {
@@ -323,8 +341,11 @@ static bool kind_is_book(int k_idx)
 }
 
 
-/*
+/*!
+ * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥Ù¡¼¥¹¥¢¥¤¥Æ¥à»þÅÀ¤ÇGOOD¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
  * Hack -- determine if a template is Good book
+ * @param k_idx È½Äꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
+ * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥Ù¡¼¥¹¥¢¥¤¥Æ¥à»þÅÀ¤ÇGOOD¤Ê¥¢¥¤¥Æ¥à¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
  */
 static bool kind_is_good_book(int k_idx)
 {
@@ -341,8 +362,11 @@ static bool kind_is_good_book(int k_idx)
 }
 
 
-/*
+/*!
+ * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬³»¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
  * Hack -- determine if a template is Armor
+ * @param k_idx È½Äꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
+ * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬³»¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
  */
 static bool kind_is_armor(int k_idx)
 {
@@ -359,8 +383,11 @@ static bool kind_is_armor(int k_idx)
 }
 
 
-/*
+/*!
+ * @brief ¥ª¥Ö¥¸¥§¥¯¥È¤¬ÂÇ·âÉð´ï¤«¤É¤¦¤«¤òȽÄꤹ¤ë /
  * Hack -- determine if a template is hafted weapon
+ * @param k_idx È½Äꤷ¤¿¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ù¡¼¥¹¥¢¥¤¥Æ¥àID
+ * @return ¥ª¥Ö¥¸¥§¥¯¥È¤¬ÂÇ·âÉð´ï¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
  */
 static bool kind_is_hafted(int k_idx)
 {
@@ -376,10 +403,16 @@ static bool kind_is_hafted(int k_idx)
        return (FALSE);
 }
 
-
+/*!
+ * @brief ¥¯¥¨¥¹¥È¤òãÀ®¾õÂ֤ˤ¹¤ë /
+ * @param quest_num Ã£À®¾õÂ֤ˤ·¤¿¤¤¥¯¥¨¥¹¥È¤ÎID
+ * @return ¤Ê¤·
+ */
 void complete_quest(int quest_num)
 {
-       switch (quest[quest_num].type)
+       quest_type* const q_ptr = &quest[quest_num];
+
+       switch (q_ptr->type)
        {
        case QUEST_TYPE_RANDOM:
                if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_C, quest_num, NULL);
@@ -389,16 +422,22 @@ void complete_quest(int quest_num)
                break;
        }
 
-       quest[quest_num].status = QUEST_STATUS_COMPLETED;
-       quest[quest_num].complev = (byte)p_ptr->lev;
+       q_ptr->status = QUEST_STATUS_COMPLETED;
+       q_ptr->complev = (byte)p_ptr->lev;
+       update_playtime();
+       q_ptr->comptime = playtime;
 
-       if (!(quest[quest_num].flags & QUEST_FLAG_SILENT))
+       if (!(q_ptr->flags & QUEST_FLAG_SILENT))
        {
                msg_print(_("¥¯¥¨¥¹¥È¤òãÀ®¤·¤¿¡ª", "You just completed your quest!"));
                msg_print(NULL);
        }
 }
 
+/*!
+ * @brief ¸½ºß¥Õ¥í¥¢¤Ë»Ä¤Ã¤Æ¤¤¤ëŨ¥â¥ó¥¹¥¿¡¼¤Î¿ô¤òÊÖ¤¹ /
+ * @return ¸½ºß¤ÎŨ¥â¥ó¥¹¥¿¡¼¤Î¿ô
+ */
 static int count_all_hostile_monsters(void)
 {
        int x, y;
@@ -420,12 +459,15 @@ static int count_all_hostile_monsters(void)
        return number_mon;
 }
 
-/*
+/*!
+ * @brief ÆÃÄê¤ÎŨ¤òÅݤ·¤¿ºÝ¤Ë¥¯¥¨¥¹¥ÈãÀ®½èÍý /
  * Check for "Quest" completion when a quest monster is killed or charmed.
+ * @param m_ptr ·âÇˤ·¤¿¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
  */
 void check_quest_completion(monster_type *m_ptr)
 {
-       int i, j, y, x, ny, nx;
+       int y, x;
 
        int quest_num;
 
@@ -440,42 +482,46 @@ void check_quest_completion(monster_type *m_ptr)
        x = m_ptr->fx;
 
        /* Inside a quest */
-       quest_num = p_ptr->inside_quest;
+       quest_num = p_ptr->inside_quest;                
 
        /* Search for an active quest on this dungeon level */
        if (!quest_num)
        {
+               int i;
+
                for (i = max_quests - 1; i > 0; i--)
                {
+                       quest_type* const q_ptr = &quest[i];
+                       
                        /* Quest is not active */
-                       if (quest[i].status != QUEST_STATUS_TAKEN)
+                       if (q_ptr->status != QUEST_STATUS_TAKEN)
                                continue;
 
                        /* Quest is not a dungeon quest */
-                       if (quest[i].flags & QUEST_FLAG_PRESET)
+                       if (q_ptr->flags & QUEST_FLAG_PRESET)
                                continue;
 
                        /* Quest is not on this level */
-                       if ((quest[i].level != dun_level) &&
-                           (quest[i].type != QUEST_TYPE_KILL_ANY_LEVEL))
+                       if ((q_ptr->level != dun_level) &&
+                           (q_ptr->type != QUEST_TYPE_KILL_ANY_LEVEL))
                                continue;
 
                        /* Not a "kill monster" quest */
-                       if ((quest[i].type == QUEST_TYPE_FIND_ARTIFACT) ||
-                           (quest[i].type == QUEST_TYPE_FIND_EXIT))
+                       if ((q_ptr->type == QUEST_TYPE_FIND_ARTIFACT) ||
+                           (q_ptr->type == QUEST_TYPE_FIND_EXIT))
                                continue;
 
                        /* Interesting quest */
-                       if ((quest[i].type == QUEST_TYPE_KILL_NUMBER) ||
-                           (quest[i].type == QUEST_TYPE_TOWER) ||
-                           (quest[i].type == QUEST_TYPE_KILL_ALL))
+                       if ((q_ptr->type == QUEST_TYPE_KILL_NUMBER) ||
+                           (q_ptr->type == QUEST_TYPE_TOWER) ||
+                           (q_ptr->type == QUEST_TYPE_KILL_ALL))
                                break;
 
                        /* Interesting quest */
-                       if (((quest[i].type == QUEST_TYPE_KILL_LEVEL) ||
-                            (quest[i].type == QUEST_TYPE_KILL_ANY_LEVEL) ||
-                            (quest[i].type == QUEST_TYPE_RANDOM)) &&
-                            (quest[i].r_idx == m_ptr->r_idx))
+                       if (((q_ptr->type == QUEST_TYPE_KILL_LEVEL) ||
+                            (q_ptr->type == QUEST_TYPE_KILL_ANY_LEVEL) ||
+                            (q_ptr->type == QUEST_TYPE_RANDOM)) &&
+                            (q_ptr->r_idx == m_ptr->r_idx))
                                break;
                }
 
@@ -486,19 +532,19 @@ void check_quest_completion(monster_type *m_ptr)
        if (quest_num && (quest[quest_num].status == QUEST_STATUS_TAKEN))
        {
                /* Current quest */
-               i = quest_num;
+               quest_type* const q_ptr = &quest[quest_num];
 
-               switch (quest[i].type)
+               switch (q_ptr->type)
                {
                        case QUEST_TYPE_KILL_NUMBER:
                        {
-                               quest[i].cur_num++;
+                               q_ptr->cur_num++;
 
-                               if (quest[i].cur_num >= quest[i].num_mon)
+                               if (q_ptr->cur_num >= q_ptr->num_mon)
                                {
-                                       complete_quest(i);
+                                       complete_quest(quest_num);
 
-                                       quest[i].cur_num = 0;
+                                       q_ptr->cur_num = 0;
                                }
                                break;
                        }
@@ -508,13 +554,13 @@ void check_quest_completion(monster_type *m_ptr)
 
                                if (count_all_hostile_monsters() == 1)
                                {
-                                       if (quest[i].flags & QUEST_FLAG_SILENT)
+                                       if (q_ptr->flags & QUEST_FLAG_SILENT)
                                        {
-                                               quest[i].status = QUEST_STATUS_FINISHED;
+                                               q_ptr->status = QUEST_STATUS_FINISHED;
                                        }
                                        else
                                        {
-                                               complete_quest(i);
+                                               complete_quest(quest_num);
                                        }
                                }
                                break;
@@ -523,42 +569,42 @@ void check_quest_completion(monster_type *m_ptr)
                        case QUEST_TYPE_RANDOM:
                        {
                                /* Only count valid monsters */
-                               if (quest[i].r_idx != m_ptr->r_idx)
+                               if (q_ptr->r_idx != m_ptr->r_idx)
                                        break;
 
-                               quest[i].cur_num++;
+                               q_ptr->cur_num++;
 
-                               if (quest[i].cur_num >= quest[i].max_num)
+                               if (q_ptr->cur_num >= q_ptr->max_num)
                                {
-                                       complete_quest(i);
+                                       complete_quest(quest_num);
 
-                                       if (!(quest[i].flags & QUEST_FLAG_PRESET))
+                                       if (!(q_ptr->flags & QUEST_FLAG_PRESET))
                                        {
                                                create_stairs = TRUE;
                                                p_ptr->inside_quest = 0;
                                        }
 
                                        /* Finish the two main quests without rewarding */
-                                       if ((i == QUEST_OBERON) || (i == QUEST_SERPENT))
+                                       if ((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT))
                                        {
-                                               quest[i].status = QUEST_STATUS_FINISHED;
+                                               q_ptr->status = QUEST_STATUS_FINISHED;
                                        }
 
-                                       if (quest[i].type == QUEST_TYPE_RANDOM)
+                                       if (q_ptr->type == QUEST_TYPE_RANDOM)
                                        {
                                                reward = TRUE;
-                                               quest[i].status = QUEST_STATUS_FINISHED;
+                                               q_ptr->status = QUEST_STATUS_FINISHED;
                                        }
                                }
                                break;
                        }
                        case QUEST_TYPE_KILL_ANY_LEVEL:
                        {
-                               quest[i].cur_num++;
-                               if (quest[i].cur_num >= quest[i].max_num)
+                               q_ptr->cur_num++;
+                               if (q_ptr->cur_num >= q_ptr->max_num)
                                {
-                                       complete_quest(i);
-                                       quest[i].cur_num = 0;
+                                       complete_quest(quest_num);
+                                       q_ptr->cur_num = 0;
                                }
                                break;
                        }
@@ -568,7 +614,7 @@ void check_quest_completion(monster_type *m_ptr)
 
                                if (count_all_hostile_monsters() == 1)
                                {
-                                       quest[i].status = QUEST_STATUS_STAGE_COMPLETED;
+                                       q_ptr->status = QUEST_STATUS_STAGE_COMPLETED;
 
                                        if((quest[QUEST_TOWER1].status == QUEST_STATUS_STAGE_COMPLETED) &&
                                           (quest[QUEST_TOWER2].status == QUEST_STATUS_STAGE_COMPLETED) &&
@@ -586,6 +632,8 @@ void check_quest_completion(monster_type *m_ptr)
        /* Create a magical staircase */
        if (create_stairs)
        {
+               int ny, nx;
+
                /* Stagger around */
                while (cave_perma_bold(y, x) || cave[y][x].o_idx || (cave[y][x].info & CAVE_OBJECT) )
                {
@@ -616,7 +664,9 @@ msg_print("
         */
        if (reward)
        {
-               for (j = 0; j < (dun_level / 15)+1; j++)
+               int i;
+
+               for (i = 0; i < (dun_level / 15)+1; i++)
                {
                        /* Get local object */
                        q_ptr = &forge;
@@ -633,7 +683,12 @@ msg_print("
        }
 }
 
-
+/*!
+ * @brief ÆÃÄê¤Î¥¢¡¼¥Æ¥£¥Õ¥¡¥¯¥È¤òÆþ¼ê¤·¤¿ºÝ¤Î¥¯¥¨¥¹¥ÈãÀ®½èÍý /
+ * Check for "Quest" completion when a quest monster is killed or charmed.
+ * @param o_ptr Æþ¼ê¤·¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
+ */
 void check_find_art_quest_completion(object_type *o_ptr)
 {
        int i;
@@ -649,8 +704,12 @@ void check_find_art_quest_completion(object_type *o_ptr)
        }
 }
 
-/*
+
+/*!
+ * @brief ¥â¥ó¥¹¥¿¡¼¤ò·âÇˤ·¤¿ºÝ¤Î½Ò¸ì¥á¥Ã¥»¡¼¥¸¤òÊÖ¤¹ /
  * Return monster death string
+ * @param r_ptr ·âÇˤµ¤ì¤¿¥â¥ó¥¹¥¿¡¼¤Î¼ï²¾ðÊó¤ò»ý¤Ä¹½Â¤ÂΤλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ·âÇˤµ¤ì¤¿¥â¥ó¥¹¥¿¡¼¤Î½Ò¸ì
  */
 cptr extract_note_dies(monster_race *r_ptr)
 {
@@ -687,19 +746,22 @@ cptr extract_note_dies(monster_race *r_ptr)
 }
 
 
-/*
+/*!
+ * @brief ¥â¥ó¥¹¥¿¡¼¤¬»àË´¤·¤¿»þ¤Î½èÍý /
  * Handle the "death" of a monster.
- *
+ * @param m_idx »àË´¤·¤¿¥â¥ó¥¹¥¿¡¼¤ÎID
+ * @param drop_item TRUE¤Ê¤é¤Ð¥â¥ó¥¹¥¿¡¼¤Î¥É¥í¥Ã¥×½èÍý¤ò¹Ô¤¦
+ * @return ·âÇˤµ¤ì¤¿¥â¥ó¥¹¥¿¡¼¤Î½Ò¸ì
+ * @details
+ * <pre>
  * Disperse treasures centered at the monster location based on the
  * various flags contained in the monster flags fields.
- *
  * Check for "Quest" completion when a quest monster is killed.
- *
  * Note that only the player can induce "monster_death()" on Uniques.
  * Thus (for now) all Quest monsters should be Uniques.
- *
  * Note that monsters can now carry objects, and when a monster dies,
  * it drops all of its objects, which may disappear in crowded rooms.
+ * </pre>
  */
 void monster_death(int m_idx, bool drop_item)
 {
@@ -1321,8 +1383,16 @@ msg_print("
                        break;
 
                case MON_SURTUR:
-                       a_idx = ART_TWILIGHT;
-                       chance = 66;
+                       if (!one_in_(3))
+                       {
+                               a_idx = ART_TWILIGHT;
+                               chance = 100;
+                       }
+                       else
+                       {
+                               a_idx = ART_ORB_OF_FATE;
+                               chance = 100;
+                       }
                        break;
 
                case MON_SARUMAN:
@@ -1347,7 +1417,7 @@ msg_print("
 
                case MON_GOEMON:
                        a_idx = ART_ZANTETSU;
-                       chance = 75;
+                       chance = 100;
                        break;
 
                case MON_HAGEN:
@@ -1409,6 +1479,12 @@ msg_print("
                        a_idx = ART_ROBIN_HOOD;
                        chance = 5;
                        break;
+
+               case MON_KOGAN:
+                       a_idx = ART_NANACHO;
+                       chance = 80;
+                       break;
+
                }
 
                if ((a_idx > 0) && ((randint0(100) < chance) || p_ptr->wizard))
@@ -1599,14 +1675,20 @@ msg_print("
        }
 }
 
-/*
+/*!
+ * @brief ¥â¥ó¥¹¥¿¡¼¤ËÍ¿¤¨¤¿¥À¥á¡¼¥¸¤Î½¤Àµ½èÍý /
  * Modify the physical damage done to the monster.
+ * @param m_ptr ¥À¥á¡¼¥¸¤ò¼õ¤±¤ë¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @param dam ¥À¥á¡¼¥¸´ðËÜÃÍ
+ * @param is_psy_spear ¹¶·â¼êÃʤ¬¸÷¤Î·õ¤Ê¤é¤ÐTRUE
+ * @return ½¤Àµ¤ò¹Ô¤Ã¤¿·ë²Ì¤Î¥À¥á¡¼¥¸ÎÌ
+ * @details
+ * <pre>
  * (for example when it's invulnerable or shielded)
- *
  * ToDo: Accept a damage-type to calculate the modified damage from
  * things like fire, frost, lightning, poison, ... attacks.
- *
  * "type" is not yet used and should be 0.
+ * </pre>
  */
 int mon_damage_mod(monster_type *m_ptr, int dam, bool is_psy_spear)
 {
@@ -1640,14 +1722,19 @@ int mon_damage_mod(monster_type *m_ptr, int dam, bool is_psy_spear)
 }
 
 
-/*
+/*!
+ * @brief ¥â¥ó¥¹¥¿¡¼¤ËÍ¿¤¨¤¿¥À¥á¡¼¥¸¤ò¸µ¤Ë·Ð¸³Ãͤò²Ã»»¤¹¤ë /
  * Calculate experience point to be get
- *
+ * @param dam Í¿¤¨¤¿¥À¥á¡¼¥¸ÎÌ
+ * @param m_ptr ¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * Even the 64 bit operation is not big enough to avoid overflaw
  * unless we carefully choose orders of multiplication and division.
- *
  * Get the coefficient first, and multiply (potentially huge) base
  * experience point of a monster later.
+ * </pre>
  */
 static void get_exp_from_mon(int dam, monster_type *m_ptr)
 {
@@ -1696,6 +1783,20 @@ static void get_exp_from_mon(int dam, monster_type *m_ptr)
                        s64b_RSHIFT(new_exp, new_exp_frac, 2);
                }
        }
+       
+       /* Special penalty for rest_and_shoot exp scum */
+       if ((m_ptr->dealt_damage > m_ptr->max_maxhp) && (m_ptr->hp >= 0))
+       {
+               int over_damage = m_ptr->dealt_damage / m_ptr->max_maxhp;
+               if (over_damage > 32) over_damage = 32;
+
+               while (over_damage--)
+               {
+                       /* 9/10 for once */
+                       s64b_mul(&new_exp, &new_exp_frac, 0, 9);
+                       s64b_div(&new_exp, &new_exp_frac, 0, 10);
+               }
+       }
 
        /* Finally multiply base experience point of the monster */
        s64b_mul(&new_exp, &new_exp_frac, 0, r_ptr->mexp);
@@ -1705,34 +1806,34 @@ static void get_exp_from_mon(int dam, monster_type *m_ptr)
 }
 
 
-/*
+/*!
+ * @brief ¥â¥ó¥¹¥¿¡¼¤ÎHP¤ò¥À¥á¡¼¥¸¤Ë±þ¤¸¤Æ¸º»»¤¹¤ë /
  * Decreases monsters hit points, handling monster death.
- *
+ * @param dam Í¿¤¨¤¿¥À¥á¡¼¥¸ÎÌ
+ * @param m_idx ¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¥â¥ó¥¹¥¿¡¼¤ÎID
+ * @param fear ¥À¥á¡¼¥¸¤Ë¤è¤Ã¤Æ¥â¥ó¥¹¥¿¡¼¤¬¶²¹²¾õÂ֤˴٤俤ʤé¤ÐTRUE¤òÊÖ¤¹
+ * @param note ¥â¥ó¥¹¥¿¡¼¤¬Åݤµ¤ì¤¿ºÝ¤ÎÆÃÊ̤ʥá¥Ã¥»¡¼¥¸½Ò¸ì
+ * @return ¤Ê¤·
+ * @details
+ * <pre>
  * We return TRUE if the monster has been killed (and deleted).
- *
  * We announce monster death (using an optional "death message"
  * if given, and a otherwise a generic killed/destroyed message).
- *
  * Only "physical attacks" can induce the "You have slain" message.
  * Missile and Spell attacks will induce the "dies" message, or
  * various "specialized" messages.  Note that "You have destroyed"
  * and "is destroyed" are synonyms for "You have slain" and "dies".
- *
  * Hack -- unseen monsters yield "You have killed it." message.
- *
  * Added fear (DGK) and check whether to print fear messages -CWS
- *
  * Made name, sex, and capitalization generic -BEN-
- *
  * As always, the "ghost" processing is a total hack.
- *
  * Hack -- we "delay" fear messages by passing around a "fear" flag.
- *
  * XXX XXX XXX Consider decreasing monster experience over time, say,
  * by using "(m_exp * m_lev * (m_lev)) / (p_lev * (m_lev + n_killed))"
  * instead of simply "(m_exp * m_lev) / (p_lev)", to make the first
  * monster worth more than subsequent monsters.  This would also need
  * to induce changes in the monster recall code.
+ * </pre>
  */
 bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
 {
@@ -1745,19 +1846,17 @@ bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
        bool        innocent = TRUE, thief = FALSE;
        int         i;
        int         expdam;
+       int                     dealt_damage;
 
-       COPY(&exp_mon, m_ptr, monster_type);
-       if (!(r_ptr->flags7 & RF7_KILL_EXP))
-       {
-               expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp;
-               if (r_ptr->flags6 & RF6_HEAL) expdam = (expdam+1) * 2 / 3;
-
-               get_exp_from_mon(expdam, &exp_mon);
+       (void)COPY(&exp_mon, m_ptr, monster_type);
+       
+       expdam = (m_ptr->hp > dam) ? dam : m_ptr->hp;
 
-               /* Genocided by chaos patron */
-               if (!m_ptr->r_idx) m_idx = 0;
-       }
+       get_exp_from_mon(expdam, &exp_mon);
 
+       /* Genocided by chaos patron */
+       if (!m_ptr->r_idx) m_idx = 0;
+       
        /* Redraw (later) if needed */
        if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
        if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
@@ -1773,9 +1872,20 @@ bool mon_take_hit(int m_idx, int dam, bool *fear, cptr note)
 
        /* Genocided by chaos patron */
        if (!m_idx) return TRUE;
+       
+       /* Remember dealt_damage before this attack*/
+       dealt_damage = m_ptr->dealt_damage;
 
        /* Hurt it */
        m_ptr->hp -= dam;
+       
+       m_ptr->dealt_damage += dam;
+       if(m_ptr->dealt_damage > m_ptr->max_maxhp * 100) m_ptr->dealt_damage = m_ptr->max_maxhp * 100;
+       if (p_ptr->wizard)
+       {
+               msg_format( _("¹ç·×%d/%d¤Î¥À¥á¡¼¥¸¤òÍ¿¤¨¤¿¡£","You do %d (out of %d) damage."),
+                                       m_ptr->dealt_damage, m_ptr->maxhp);
+       }
 
        /* It is dead now */
        if (m_ptr->hp < 0)
@@ -2128,11 +2238,7 @@ msg_format("%s
                        delete_monster_idx(m_idx);
                }
 
-               /* Prevent bug of chaos patron's reward */
-               if (r_ptr->flags7 & RF7_KILL_EXP)
-                       get_exp_from_mon((long)exp_mon.max_maxhp*2, &exp_mon);
-               else
-                       get_exp_from_mon(((long)exp_mon.max_maxhp+1L) * 9L / 10L, &exp_mon);
+               get_exp_from_mon((long)exp_mon.max_maxhp*2, &exp_mon);
 
                /* Not afraid */
                (*fear) = FALSE;
@@ -2205,8 +2311,12 @@ msg_format("%^s
 }
 
 
-/*
+/*!
+ * @brief ¸½ºß¤Î¥³¥ó¥½¡¼¥ëɽ¼¨¤Î½Ä²£¤òÊÖ¤¹¡£ /
  * Get term size and calculate screen size
+ * @param wid_p ¥³¥ó¥½¡¼¥ë¤Îɽ¼¨Éýʸ»ú¿ô¤òÊÖ¤¹
+ * @param hgt_p ¥³¥ó¥½¡¼¥ë¤Îɽ¼¨¹Ô¿ô¤òÊÖ¤¹
+ * @return ¤Ê¤·
  */
 void get_screen_size(int *wid_p, int *hgt_p)
 {
@@ -2217,9 +2327,10 @@ void get_screen_size(int *wid_p, int *hgt_p)
 }
 
 
-/*
- * Calculates current boundaries
- * Called below and from "do_cmd_locate()".
+/*!
+ * @brief ¥³¥ó¥½¡¼¥ë¾å¤Ë¤ª¤±¤ë¥Þ¥Ã¥×ɽ¼¨¤Îº¸¾å°ÌÃÖ¤òÊÖ¤¹ /
+ * Calculates current boundaries Called below and from "do_cmd_locate()".
+ * @return ¤Ê¤·
  */
 void panel_bounds_center(void)
 {
@@ -2235,8 +2346,10 @@ void panel_bounds_center(void)
 }
 
 
-/*
+/*!
+ * @brief ¥³¥ó¥½¡¼¥ë¤Î¥ê¥µ¥¤¥º¤Ë¹ç¤ï¤»¤Æ¥Þ¥Ã¥×¤òºÆÉÁ²è¤¹¤ë /
  * Map resizing whenever the main term changes size
+ * @return ¤Ê¤·
  */
 void resize_map(void)
 {
@@ -2284,8 +2397,10 @@ void resize_map(void)
        Term_fresh();
 }
 
-/*
+/*!
+ * @brief ¥³¥ó¥½¡¼¥ë¤òºÆÉÁ²è¤¹¤ë /
  * Redraw a term when it is resized
+ * @return ¤Ê¤·
  */
 void redraw_window(void)
 {
@@ -2306,12 +2421,14 @@ void redraw_window(void)
 }
 
 
-/*
+/*!
+ * @brief ¥Õ¥©¡¼¥«¥¹¤òÅö¤Æ¤ë¤Ù¤­¥Þ¥Ã¥×ÉÁ²è¤Î´ð½àºÂɸ¤ò»ØÄꤹ¤ë¡Ê¥µ¥Ö¥ë¡¼¥Á¥ó¡Ë
+ * @param dy Êѹ¹Àè¤Î¥Õ¥í¥¢YºÂɸ
+ * @param dx Êѹ¹Àè¤Î¥Õ¥í¥¢XºÂɸ
  * Handle a request to change the current panel
- *
  * Return TRUE if the panel was changed.
- *
  * Also used in do_cmd_locate
+ * @return ¼ÂºÝ¤ËºÆÉÁ²è¤¬É¬ÍפÀ¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹
  */
 bool change_panel(int dy, int dx)
 {
@@ -2360,6 +2477,16 @@ bool change_panel(int dy, int dx)
        return (FALSE);
 }
 
+/*!
+ * @brief ¥Õ¥©¡¼¥«¥¹¤òÅö¤Æ¤ë¤Ù¤­¥Þ¥Ã¥×ÉÁ²è¤Î´ð½àºÂɸ¤ò»ØÄꤹ¤ë
+ * @param y Êѹ¹Àè¤Î¥Õ¥í¥¢YºÂɸ
+ * @param x Êѹ¹Àè¤Î¥Õ¥í¥¢XºÂɸ
+ * @details
+ * Handle a request to change the current panel
+ * Return TRUE if the panel was changed.
+ * Also used in do_cmd_locate
+ * @return ¼ÂºÝ¤ËºÆÉÁ²è¤¬É¬ÍפÀ¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹
+ */
 bool change_panel_xy(int y, int x)
 {
        int dy = 0, dx = 0;
@@ -2379,13 +2506,14 @@ bool change_panel_xy(int y, int x)
 }
 
 
-/*
+/*!
+ * @brief ¥Þ¥Ã¥×ÉÁ²è¤Î¥Õ¥©¡¼¥«¥¹¤òÅö¤Æ¤ë¤Ù¤­ºÂɸ¤ò¹¹¿·¤¹¤ë
+ * @details
  * Given an row (y) and col (x), this routine detects when a move
  * off the screen has occurred and figures new borders. -RAK-
- *
  * "Update" forces a "full update" to take place.
- *
  * The map is reprinted if necessary, and "TRUE" is returned.
+ * @return ¼ÂºÝ¤ËºÆÉÁ²è¤¬É¬ÍפÀ¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹
  */
 void verify_panel(void)
 {
@@ -4900,7 +5028,7 @@ msg_print("
                        msg_print("'Use my gift wisely.'");
 #endif
 
-                       acquirement(py, px, 1, FALSE, FALSE);
+                       acquirement(py, px, 1, FALSE, FALSE, FALSE);
 #ifdef JP
                        reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
 #else
@@ -4922,7 +5050,7 @@ msg_print("
                        msg_print("'Use my gift wisely.'");
 #endif
 
-                       acquirement(py, px, 1, TRUE, FALSE);
+                       acquirement(py, px, 1, TRUE, FALSE, FALSE);
 #ifdef JP
                        reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
 #else
@@ -5063,7 +5191,7 @@ msg_print("
                        msg_print("'Thy deed hath earned thee a worthy reward.'");
 #endif
 
-                       acquirement(py, px, randint1(2) + 1, FALSE, FALSE);
+                       acquirement(py, px, randint1(2) + 1, FALSE, FALSE, FALSE);
 #ifdef JP
                        reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
 #else
@@ -5085,7 +5213,7 @@ msg_print("
                        msg_print("'Behold, mortal, how generously I reward thy loyalty.'");
 #endif
 
-                       acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
+                       acquirement(py, px, randint1(2) + 1, TRUE, FALSE, FALSE);
 #ifdef JP
                        reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
 #else
@@ -5836,25 +5964,16 @@ bool tgt_pt(int *x_ptr, int *y_ptr)
 
                                n++;
 
-                               while(n < temp_n)       /* Skip stairs which have defferent distance */
+                               /* Skip stairs which have defferent distance */
+                               for (; n < temp_n; ++ n)
                                {
                                        cave_type *c_ptr = &cave[temp_y[n]][temp_x[n]];
 
-                                       if (ch == '>')
-                                       {
-                                               if (cave_have_flag_grid(c_ptr, FF_LESS) ||
-                                                       cave_have_flag_grid(c_ptr, FF_QUEST_ENTER))
-                                                       n++;
-                                               else
-                                                       break;
-                                       }
-                                       else /* if (ch == '<') */
+                                       if (cave_have_flag_grid(c_ptr, FF_STAIRS) &&
+                                           cave_have_flag_grid(c_ptr, ch == '>' ? FF_MORE : FF_LESS))
                                        {
-                                               if (cave_have_flag_grid(c_ptr, FF_MORE) ||
-                                                       cave_have_flag_grid(c_ptr, FF_QUEST_EXIT))
-                                                       n++;
-                                               else
-                                                       break;
+                                               /* Found */
+                                               break;
                                        }
                                }