• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revisiona2ffb557e185c84f844bd6b772db6d23b5d80893 (tree)
Time2019-07-10 12:22:26
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38997 heavy_armor() に player_type * 引数を追加.

Change Summary

Incremental Difference

--- a/src/files.c
+++ b/src/files.c
@@ -2295,13 +2295,13 @@ static void player_flags(BIT_FLAGS flgs[TR_FLAG_SIZE])
22952295 break;
22962296 case CLASS_MONK:
22972297 case CLASS_FORCETRAINER:
2298- if ((p_ptr->lev > 9) && !heavy_armor())
2298+ if ((p_ptr->lev > 9) && !heavy_armor(p_ptr))
22992299 add_flag(flgs, TR_SPEED);
2300- if ((p_ptr->lev>24) && !heavy_armor())
2300+ if ((p_ptr->lev>24) && !heavy_armor(p_ptr))
23012301 add_flag(flgs, TR_FREE_ACT);
23022302 break;
23032303 case CLASS_NINJA:
2304- if (heavy_armor())
2304+ if (heavy_armor(p_ptr))
23052305 add_flag(flgs, TR_SPEED);
23062306 else
23072307 {
--- a/src/mind.c
+++ b/src/mind.c
@@ -592,7 +592,7 @@ void mindcraft_info(char *p, int use_mind, int power)
592592 {
593593 int boost = P_PTR_KI;
594594
595- if (heavy_armor()) boost /= 2;
595+ if (heavy_armor(p_ptr)) boost /= 2;
596596
597597 switch (power)
598598 {
@@ -891,7 +891,7 @@ static bool_hack get_mind_power(SPELL_IDX *sn, bool only_browse)
891891
892892 if (use_mind == MIND_KI)
893893 {
894- if (heavy_armor()) chance += 20;
894+ if (heavy_armor(p_ptr)) chance += 20;
895895 if (p_ptr->icky_wield[0]) chance += 20;
896896 else if (has_weapon[0]) chance += 10;
897897 if (p_ptr->icky_wield[1]) chance += 20;
@@ -924,7 +924,7 @@ static bool_hack get_mind_power(SPELL_IDX *sn, bool only_browse)
924924
925925 if (use_mind == MIND_KI)
926926 {
927- if (heavy_armor()) chance += 5;
927+ if (heavy_armor(p_ptr)) chance += 5;
928928 if (p_ptr->icky_wield[0]) chance += 5;
929929 if (p_ptr->icky_wield[1]) chance += 5;
930930 }
@@ -1195,7 +1195,7 @@ static bool cast_force_spell(int spell)
11951195 PLAYER_LEVEL plev = p_ptr->lev;
11961196 int boost = P_PTR_KI;
11971197
1198- if (heavy_armor()) boost /= 2;
1198+ if (heavy_armor(p_ptr)) boost /= 2;
11991199
12001200 /* spell code */
12011201 switch (spell)
@@ -1809,7 +1809,7 @@ void do_cmd_mind(void)
18091809 mana_cost = spell.mana_cost;
18101810 if (use_mind == MIND_KI)
18111811 {
1812- if (heavy_armor()) chance += 20;
1812+ if (heavy_armor(p_ptr)) chance += 20;
18131813 if (p_ptr->icky_wield[0]) chance += 20;
18141814 else if (has_melee_weapon(INVEN_RARM)) chance += 10;
18151815 if (p_ptr->icky_wield[1]) chance += 20;
@@ -1871,7 +1871,7 @@ void do_cmd_mind(void)
18711871
18721872 if (use_mind == MIND_KI)
18731873 {
1874- if (heavy_armor()) chance += 5;
1874+ if (heavy_armor(p_ptr)) chance += 5;
18751875 if (p_ptr->icky_wield[0]) chance += 5;
18761876 if (p_ptr->icky_wield[1]) chance += 5;
18771877 }
--- a/src/player-status.c
+++ b/src/player-status.c
@@ -1641,7 +1641,7 @@ void calc_bonuses(void)
16411641 case CLASS_MONK:
16421642 case CLASS_FORCETRAINER:
16431643 /* Unencumbered Monks become faster every 10 levels */
1644- if (!(heavy_armor()))
1644+ if (!(heavy_armor(p_ptr)))
16451645 {
16461646 if (!(PRACE_IS_(p_ptr, RACE_KLACKON) ||
16471647 PRACE_IS_(p_ptr, RACE_SPRITE) ||
@@ -1686,7 +1686,7 @@ void calc_bonuses(void)
16861686 break;
16871687 case CLASS_NINJA:
16881688 /* Unencumbered Ninjas become faster every 10 levels */
1689- if (heavy_armor())
1689+ if (heavy_armor(p_ptr))
16901690 {
16911691 new_speed -= (p_ptr->lev) / 10;
16921692 p_ptr->skill_stl -= (p_ptr->lev) / 10;
@@ -2590,7 +2590,7 @@ void calc_bonuses(void)
25902590 if (p_ptr->cursed & TRC_TELEPORT) p_ptr->cursed &= ~(TRC_TELEPORT_SELF);
25912591
25922592 /* Monks get extra ac for armour _not worn_ */
2593- if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor())
2593+ if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && !heavy_armor(p_ptr))
25942594 {
25952595 if (!(p_ptr->inventory_list[INVEN_BODY].k_idx))
25962596 {
@@ -3516,7 +3516,7 @@ void calc_bonuses(void)
35163516 if (blow_base > 59) p_ptr->num_blow[0]++;
35173517 }
35183518
3519- if (heavy_armor() && (p_ptr->pclass != CLASS_BERSERKER))
3519+ if (heavy_armor(p_ptr) && (p_ptr->pclass != CLASS_BERSERKER))
35203520 p_ptr->num_blow[0] /= 2;
35213521 else
35223522 {
@@ -3574,7 +3574,7 @@ void calc_bonuses(void)
35743574
35753575 p_ptr->monk_armour_aux = FALSE;
35763576
3577- if (heavy_armor())
3577+ if (heavy_armor(p_ptr))
35783578 {
35793579 p_ptr->monk_armour_aux = TRUE;
35803580 }
@@ -3848,7 +3848,7 @@ void calc_bonuses(void)
38483848
38493849 if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_NINJA)) && (p_ptr->monk_armour_aux != p_ptr->monk_notify_aux))
38503850 {
3851- if (heavy_armor())
3851+ if (heavy_armor(p_ptr))
38523852 {
38533853 msg_print(_("装備が重くてバランスを取れない。", "The weight of your armor disrupts your balance."));
38543854 if (current_world_ptr->is_loading_now)
@@ -4958,22 +4958,22 @@ BIT_FLAGS16 empty_hands(bool riding_control)
49584958 * @brief プレイヤーが防具重量制限のある職業時にペナルティを受ける状態にあるかどうかを返す。
49594959 * @return ペナルティが適用されるならばTRUE。
49604960 */
4961-bool heavy_armor(void)
4961+bool heavy_armor(player_type *creature_ptr)
49624962 {
49634963 WEIGHT monk_arm_wgt = 0;
49644964
4965- if ((p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_NINJA)) return FALSE;
4965+ if ((creature_ptr->pclass != CLASS_MONK) && (creature_ptr->pclass != CLASS_FORCETRAINER) && (creature_ptr->pclass != CLASS_NINJA)) return FALSE;
49664966
49674967 /* Weight the armor */
4968- if (p_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += p_ptr->inventory_list[INVEN_RARM].weight;
4969- if (p_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += p_ptr->inventory_list[INVEN_LARM].weight;
4970- monk_arm_wgt += p_ptr->inventory_list[INVEN_BODY].weight;
4971- monk_arm_wgt += p_ptr->inventory_list[INVEN_HEAD].weight;
4972- monk_arm_wgt += p_ptr->inventory_list[INVEN_OUTER].weight;
4973- monk_arm_wgt += p_ptr->inventory_list[INVEN_HANDS].weight;
4974- monk_arm_wgt += p_ptr->inventory_list[INVEN_FEET].weight;
4975-
4976- return (monk_arm_wgt > (100 + (p_ptr->lev * 4)));
4968+ if (creature_ptr->inventory_list[INVEN_RARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_RARM].weight;
4969+ if (creature_ptr->inventory_list[INVEN_LARM].tval > TV_SWORD) monk_arm_wgt += creature_ptr->inventory_list[INVEN_LARM].weight;
4970+ monk_arm_wgt += creature_ptr->inventory_list[INVEN_BODY].weight;
4971+ monk_arm_wgt += creature_ptr->inventory_list[INVEN_HEAD].weight;
4972+ monk_arm_wgt += creature_ptr->inventory_list[INVEN_OUTER].weight;
4973+ monk_arm_wgt += creature_ptr->inventory_list[INVEN_HANDS].weight;
4974+ monk_arm_wgt += creature_ptr->inventory_list[INVEN_FEET].weight;
4975+
4976+ return (monk_arm_wgt > (100 + (creature_ptr->lev * 4)));
49774977 }
49784978
49794979 /*!
--- a/src/player-status.h
+++ b/src/player-status.h
@@ -736,7 +736,7 @@ extern WEIGHT weight_limit(void);
736736 extern bool has_melee_weapon(int i);
737737 extern bool is_heavy_shoot(object_type *o_ptr);
738738
739-extern bool heavy_armor(void);
739+extern bool heavy_armor(player_type *creature_ptr);
740740 extern void update_creature(player_type *creature_ptr);
741741 extern BIT_FLAGS16 empty_hands(bool riding_control);
742742 extern bool player_has_no_spellbooks(void);
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -3369,7 +3369,7 @@ bool shock_power(void)
33693369 HIT_POINT dam;
33703370 PLAYER_LEVEL plev = p_ptr->lev;
33713371 int boost = P_PTR_KI;
3372- if (heavy_armor()) boost /= 2;
3372+ if (heavy_armor(p_ptr)) boost /= 2;
33733373
33743374 project_length = 1;
33753375 if (!get_aim_dir(&dir)) return FALSE;
Show on old repository browser