From: Hourier Date: Thu, 16 Jan 2020 13:35:28 +0000 (+0900) Subject: [Refactor] #38997 anger_monster() にplayer_type * 引数を追加 / Added player_type * argument... X-Git-Tag: vmacos3.0.0-alpha52~1958 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=334389fc58305ab2482efae9e8373a652f3bdfea;p=hengbandforosx%2Fhengbandosx.git [Refactor] #38997 anger_monster() にplayer_type * 引数を追加 / Added player_type * argument to anger_monster() --- diff --git a/src/cmd/cmd-basic.c b/src/cmd/cmd-basic.c index 67273e6f7..eb117f84d 100644 --- a/src/cmd/cmd-basic.c +++ b/src/cmd/cmd-basic.c @@ -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) { diff --git a/src/combat/melee1.c b/src/combat/melee1.c index 2c98853cc..250fd1259 100644 --- a/src/combat/melee1.c +++ b/src/combat/melee1.c @@ -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); diff --git a/src/combat/shoot.c b/src/combat/shoot.c index 5a41826fd..6b21d23c2 100644 --- a/src/combat/shoot.c +++ b/src/combat/shoot.c @@ -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) { diff --git a/src/monster.h b/src/monster.h index 04a05dbd9..3c0c3661b 100644 --- a/src/monster.h +++ b/src/monster.h @@ -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() diff --git a/src/monster1.c b/src/monster1.c index ff9a7da74..86e3b5081 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -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); } } diff --git a/src/spells1.c b/src/spells1.c index ac1f3303c..e91dc6afe 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -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) {