OSDN Git Service

Rest and Shoot exp is reduced by accumulated damages. 9/10 per maxhp.
authordis- <dis-@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 3 Mar 2013 09:05:40 +0000 (09:05 +0000)
committerdis- <dis-@0568b783-4c39-0410-ac80-bf13821ea2a2>
Sun, 3 Mar 2013 09:05:40 +0000 (09:05 +0000)
src/load.c
src/save.c
src/types.h
src/xtra2.c

index f24d8da..7df5067 100644 (file)
@@ -840,7 +840,7 @@ static void rd_monster(monster_type *m_ptr)
        }
        else
        {
-               rd_s16b(&m_ptr->dealt_damage); 
+               rd_u32b(&m_ptr->dealt_damage); 
        }
 
        /* Monster race index of its appearance */
index cdc0ca2..a5bc01d 100644 (file)
@@ -215,7 +215,7 @@ static void wr_monster(monster_type *m_ptr)
        wr_s16b(m_ptr->hp);
        wr_s16b(m_ptr->maxhp);
        wr_s16b(m_ptr->max_maxhp);
-       wr_s16b(m_ptr->dealt_damage);
+       wr_u32b(m_ptr->dealt_damage);
        
 
        /* Monster race index of its appearance */
index d71a076..8e34eec 100644 (file)
@@ -591,7 +591,7 @@ struct monster_type
        s16b hp;                /* Current Hit points */
        s16b maxhp;             /* Max Hit points */
        s16b max_maxhp;         /* Max Max Hit points */
-       s16b dealt_damage;              /* Sum of damages dealt by player */
+       u32b dealt_damage;              /* Sum of damages dealt by player */
 
        s16b mtimed[MAX_MTIMED];        /* Timed status counter */
 
index e64e84f..797624c 100644 (file)
@@ -1696,6 +1696,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);
@@ -1745,12 +1759,12 @@ 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;
 
        (void)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);
 
@@ -1773,6 +1787,9 @@ 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;
@@ -2138,9 +2155,17 @@ msg_format("%s
 
                /* 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);
+               {
+                       u32b destroy_exp = exp_mon.max_maxhp + 1;
+                       /* Add remained exp*/
+                       if(dealt_damage < m_ptr->maxhp)
+                               destroy_exp += m_ptr->maxhp - dealt_damage;
+                       get_exp_from_mon(destroy_exp, &exp_mon);
+               }
 
                /* Not afraid */
                (*fear) = FALSE;