OSDN Git Service

refactor a_m_aux2
[hengband/hengband.git] / src / melee2.c
index e050863..a49737d 100644 (file)
@@ -212,7 +212,7 @@ void mon_take_hit_mon(int m_idx, int dam, bool *fear, cptr note, int who)
        /* Wake it up */
        (void)set_monster_csleep(m_idx, 0);
 
-       if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 0);
+       if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 1);
 
        if (MON_INVULNER(m_ptr) && randint0(PENETRATE_INVULNERABILITY))
        {
@@ -1477,7 +1477,7 @@ static bool monst_attack_monst(int m_idx, int t_idx)
                mon_fight = TRUE;
        }
 
-       if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 0);
+       if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 1);
 
        /* Scan through all four blows */
        for (ap_cnt = 0; ap_cnt < 4; ap_cnt++)
@@ -1706,7 +1706,7 @@ act = "%s
 
                        case RBM_EXPLODE:
                                {
-                                       if (see_either) disturb(1, 0);
+                                       if (see_either) disturb(1, 1);
 #ifdef JP
 act = "Çúȯ¤·¤¿¡£";
 #else
@@ -1942,6 +1942,14 @@ act = "%s
                                effect_type = BLOW_EFFECT_TYPE_HEAL;
                                break;
 
+                       case RBE_INERTIA:
+                               pt = GF_INERTIA;
+                               break;
+
+                       case RBE_STUN:
+                               pt = GF_SOUND;
+                               break;
+
                        default:
                                pt = 0;
                                break;
@@ -2394,7 +2402,7 @@ static void process_monster(int m_idx)
                                msg_format("%^s seems to be in so much pain, and trying to escape from your restriction.", m_name);
 #endif
                                riding_pinch++;
-                               disturb(1, 0);
+                               disturb(1, 1);
                        }
                        else
                        {
@@ -3347,7 +3355,7 @@ msg_format("%^s%s", m_name, monmessage);
                        {
                                /* Disturb */
                                if (is_hostile(m_ptr))
-                                       disturb(0, 0);
+                                       disturb(0, 1);
                        }
 
                        /* Take or Kill objects on the floor */
@@ -4571,11 +4579,22 @@ bool process_the_world(int num, int who, bool vs_player)
 
 void monster_gain_exp(int m_idx, int s_idx)
 {
-       monster_type *m_ptr = &m_list[m_idx];
-       monster_race *r_ptr = &r_info[m_ptr->r_idx];
-       monster_race *s_ptr = &r_info[s_idx];
+       monster_type *m_ptr;
+       monster_race *r_ptr;
+       monster_race *s_ptr;
        int new_exp;
 
+       /* Paranoia */
+       if (m_idx <= 0 || s_idx <= 0) return;
+
+       m_ptr = &m_list[m_idx];
+
+       /* Paranoia -- Skip dead monsters */
+       if (!m_ptr->r_idx) return;
+
+       r_ptr = &r_info[m_ptr->r_idx];
+       s_ptr = &r_info[s_idx];
+
        if (p_ptr->inside_battle) return;
 
        if (!r_ptr->next_exp) return;
@@ -4622,6 +4641,9 @@ void monster_gain_exp(int m_idx, int s_idx)
                }
                m_ptr->maxhp = m_ptr->max_maxhp;
                m_ptr->hp = old_hp * m_ptr->maxhp / old_maxhp;
+               
+               /* dealt damage is 0 at initial*/
+               m_ptr->dealt_damage = 0;
 
                /* Extract the monster base speed */
                m_ptr->mspeed = get_mspeed(r_ptr);