OSDN Git Service

[Refactor] #38997 anger_monster() にplayer_type * 引数を追加 / Added player_type * argument...
authorHourier <hourier@users.sourceforge.jp>
Thu, 16 Jan 2020 13:35:28 +0000 (22:35 +0900)
committerHourier <hourier@users.sourceforge.jp>
Thu, 16 Jan 2020 13:35:28 +0000 (22:35 +0900)
src/cmd/cmd-basic.c
src/combat/melee1.c
src/combat/shoot.c
src/monster.h
src/monster1.c
src/spells1.c

index 67273e6..eb117f8 100644 (file)
@@ -2647,7 +2647,7 @@ bool do_cmd_throw(player_type *creature_ptr, int mult, bool boomerang, OBJECT_ID
 
                                        /* Anger the monster */
                                        if ((tdam > 0) && !object_is_potion(q_ptr))
-                                               anger_monster(m_ptr);
+                                               anger_monster(creature_ptr, m_ptr);
 
                                        if (fear && m_ptr->ml)
                                        {
index 2c98853..250fd12 100644 (file)
@@ -1240,7 +1240,7 @@ static void natural_attack(player_type *attacker_ptr, MONSTER_IDX m_idx, int att
                k, m_ptr->hp - k, m_ptr->maxhp, m_ptr->max_maxhp);
 
        /* Anger the monster */
-       if (k > 0) anger_monster(m_ptr);
+       if (k > 0) anger_monster(attacker_ptr, m_ptr);
 
        /* Damage, check for fear and mdeath */
        switch (attack)
@@ -1861,7 +1861,7 @@ static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, boo
                        int tmp = (10 + randint1(15) + attacker_ptr->lev / 5);
 
                        k = 0;
-                       anger_monster(m_ptr);
+                       anger_monster(attacker_ptr, m_ptr);
 
                        if (!(r_ptr->flags3 & (RF3_NO_STUN)))
                        {
@@ -1952,7 +1952,7 @@ static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, boo
                }
 
                /* Anger the monster */
-               if (k > 0) anger_monster(m_ptr);
+               if (k > 0) anger_monster(attacker_ptr, m_ptr);
 
                touch_zap_player(m_ptr, attacker_ptr);
 
index 5a41826..6b21d23 100644 (file)
@@ -751,7 +751,7 @@ void exe_fire(player_type *shooter_ptr, INVENTORY_IDX item, object_type *j_ptr,
                                                message_pain(c_mon_ptr->m_idx, tdam);
 
                                                /* Anger the monster */
-                                               if (tdam > 0) anger_monster(m_ptr);
+                                               if (tdam > 0) anger_monster(shooter_ptr, m_ptr);
 
                                                if (fear && m_ptr->ml)
                                                {
index 04a05db..3c0c366 100644 (file)
@@ -446,7 +446,7 @@ extern monsterrace_hook_type get_monster_hook2(player_type *player_ptr, POSITION
 extern void set_friendly(monster_type *m_ptr);
 extern void set_pet(monster_type *m_ptr);
 extern void set_hostile(monster_type *m_ptr);
-extern void anger_monster(monster_type *m_ptr);
+extern void anger_monster(player_type *player_ptr, monster_type *m_ptr);
 
 /*
  * Bit flags for the *_can_enter() and monster_can_cross_terrain()
index ff9a7da..86e3b50 100644 (file)
@@ -2257,9 +2257,9 @@ void set_hostile(monster_type *m_ptr)
  * @param m_ptr モンスター情報構造体の参照ポインタ
  * @return なし
  */
-void anger_monster(monster_type *m_ptr)
+void anger_monster(player_type *player_ptr, monster_type *m_ptr)
 {
-       if (p_ptr->phase_out) return;
+       if (player_ptr->phase_out) return;
        if (is_friendly(m_ptr))
        {
                GAME_TEXT m_name[MAX_NLEN];
@@ -2269,10 +2269,10 @@ void anger_monster(monster_type *m_ptr)
 
                set_hostile(m_ptr);
 
-               chg_virtue(p_ptr, V_INDIVIDUALISM, 1);
-               chg_virtue(p_ptr, V_HONOUR, -1);
-               chg_virtue(p_ptr, V_JUSTICE, -1);
-               chg_virtue(p_ptr, V_COMPASSION, -1);
+               chg_virtue(player_ptr, V_INDIVIDUALISM, 1);
+               chg_virtue(player_ptr, V_HONOUR, -1);
+               chg_virtue(player_ptr, V_JUSTICE, -1);
+               chg_virtue(player_ptr, V_COMPASSION, -1);
        }
 }
 
index ac1f330..e91dc6a 100644 (file)
@@ -3875,7 +3875,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
                else
                {
                        /* HACK - anger the monster before showing the sleep message */
-                       if (do_sleep) anger_monster(m_ptr);
+                       if (do_sleep) anger_monster(caster_ptr, m_ptr);
 
                        /* Give detailed messages if visible or destroyed */
                        if (note && seen_msg)
@@ -3889,7 +3889,7 @@ static bool project_m(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSI
 
                        /* Anger monsters */
                        if (((dam > 0) || get_angry) && !do_sleep)
-                               anger_monster(m_ptr);
+                               anger_monster(caster_ptr, m_ptr);
 
                        if ((fear || do_fear) && seen)
                        {