OSDN Git Service

[Refactor] #40514 set_personality_flags() 整理の上削除. have_good_luck() を追加. / Deleted...
authordeskull <deskull@users.sourceforge.jp>
Wed, 12 Aug 2020 07:59:12 +0000 (16:59 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 12 Aug 2020 07:59:12 +0000 (16:59 +0900)
src/cmd-io/cmd-dump.c
src/io/mutations-dump.c
src/object-enchant/apply-magic.c
src/perception/simple-perception.c
src/player/player-personality.c
src/player/player-personality.h
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c
src/player/selfinfo.c

index cbfdd1e..ef52078 100644 (file)
@@ -35,6 +35,7 @@
 #include "view/display-messages.h"
 #include "view/display-player.h" // 暫定。後で消す.
 #include "world/world.h"
+#include "player/player-status-flags.h"
 
 /*!
  * @brief 画面を再描画するコマンドのメインルーチン
@@ -234,7 +235,7 @@ void do_cmd_feeling(player_type *creature_ptr)
                return;
        }
 
-       if (creature_ptr->muta3 & MUT3_GOOD_LUCK)
+       if (have_good_luck(creature_ptr))
                msg_print(do_cmd_feeling_text_lucky[creature_ptr->feeling]);
        else if (is_echizen(creature_ptr))
                msg_print(do_cmd_feeling_text_combat[creature_ptr->feeling]);
index 736390a..a3c9856 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "io/mutations-dump.h"
 #include "mutation/mutation-flag-types.h"
+#include "player/player-status-flags.h"
 
 /*!
  * @brief ファイルポインタを通じて突然変異の一覧を出力する
@@ -304,7 +305,7 @@ void dump_mutations(player_type *creature_ptr, FILE *out_file)
         if (creature_ptr->muta3 & MUT3_MOTION)
             fprintf(out_file, _(" あなたの動作は正確で力強い。(隠密+1)\n", " Your movements are precise and forceful (+1 STL).\n"));
 
-        if (creature_ptr->muta3 & MUT3_GOOD_LUCK)
+        if (have_good_luck(creature_ptr))
             fprintf(out_file, _(" あなたは白いオーラにつつまれている。\n", " There is a white aura surrounding you.\n"));
 
         if (creature_ptr->muta3 & MUT3_BAD_LUCK)
index 96fd49c..71b1c78 100644 (file)
@@ -32,6 +32,8 @@
 #include "system/floor-type-definition.h"
 #include "util/bit-flags-calculator.h"
 #include "world/world.h"
+#include "player/player-status-flags.h"
+
 
 /*!
  * @brief 生成されたベースアイテムに魔法的な強化を与えるメインルーチン
@@ -59,7 +61,7 @@ void apply_magic(player_type *owner_ptr, object_type *o_ptr, DEPTH lev, BIT_FLAG
     if ((owner_ptr->pseikaku != PERSONALITY_MUNCHKIN) && (f2 > d_info[owner_ptr->dungeon_idx].obj_great))
         f2 = d_info[owner_ptr->dungeon_idx].obj_great;
 
-    if (owner_ptr->muta3 & MUT3_GOOD_LUCK) {
+    if (have_good_luck(owner_ptr)) {
         f1 += 5;
         f2 += 2;
     } else if (owner_ptr->muta3 & MUT3_BAD_LUCK) {
@@ -100,7 +102,7 @@ void apply_magic(player_type *owner_ptr, object_type *o_ptr, DEPTH lev, BIT_FLAG
     for (int i = 0; i < rolls; i++) {
         if (make_artifact(owner_ptr, o_ptr))
             break;
-        if ((owner_ptr->muta3 & MUT3_GOOD_LUCK) && one_in_(77)) {
+        if (have_good_luck(owner_ptr) && one_in_(77)) {
             if (make_artifact(owner_ptr, o_ptr))
                 break;
         }
index b26c947..cd16e86 100644 (file)
@@ -24,6 +24,7 @@
 #include "perception/object-perception.h"
 #include "player/avatar.h"
 #include "view/display-messages.h"
+#include "player/player-status-flags.h"
 
 /*!
  * @brief 擬似鑑定を実際に行い判定を反映する
@@ -279,7 +280,7 @@ void sense_inventory1(player_type *creature_ptr)
         if ((i < INVEN_RARM) && (0 != randint0(5)))
             continue;
 
-        if ((creature_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13)) {
+        if (have_good_luck(creature_ptr) && !randint0(13)) {
             heavy = TRUE;
         }
 
index e2fb271..eee3349 100644 (file)
@@ -141,9 +141,3 @@ const player_personality personality_info[MAX_PERSONALITIES] =
 };
 
 const player_personality *ap_ptr;
-
-void set_personality_flags(player_type *creature_ptr)
-{
-    if (creature_ptr->pseikaku == PERSONALITY_LUCKY)
-        creature_ptr->muta3 |= MUT3_GOOD_LUCK;
-}
index 0b3f64e..32ea579 100644 (file)
@@ -29,5 +29,3 @@ typedef struct player_personality {
 
 extern const player_personality personality_info[MAX_PERSONALITIES];
 extern const player_personality *ap_ptr;
-
-extern void set_personality_flags(player_type *creature_ptr);
index 23a6d2f..a3f1f6f 100644 (file)
@@ -2185,3 +2185,5 @@ bool is_not_monk_weapon(player_type *creature_ptr, int i)
     OBJECT_SUBTYPE_VALUE sval = creature_ptr->inventory_list[INVEN_RARM + i].sval;
     return (creature_ptr->pclass == CLASS_MONK) || (creature_ptr->pclass == CLASS_FORCETRAINER) && (!s_info[creature_ptr->pclass].w_max[tval][sval]);
 }
+
+bool have_good_luck(player_type *creature_ptr) { return (creature_ptr->pseikaku == PERSONALITY_LUCKY) || (creature_ptr->muta3 |= MUT3_GOOD_LUCK); };
index 4c15981..72aaf9f 100644 (file)
@@ -79,5 +79,4 @@ bool is_disable_two_handed_bonus(player_type *creature_ptr, int i);
 bool is_not_ninja_weapon(player_type *creature_ptr, int i);
 bool is_not_monk_weapon(player_type *creature_ptr, int i);
 void is_icky_wield_weapon(player_type *creature_ptr, int i);
-
-
+bool have_good_luck(player_type *creature_ptr);
index 7ebd00b..9f8aaa2 100644 (file)
@@ -717,7 +717,6 @@ void calc_bonuses(player_type *creature_ptr)
     }
 
     calc_class_status(creature_ptr);
-    set_personality_flags(creature_ptr);
     calc_equipment_status(creature_ptr);
 
     if (old_mighty_throw != creature_ptr->mighty_throw) {
index 13af776..fffb95b 100644 (file)
@@ -31,6 +31,7 @@
 #include "status/element-resistance.h"
 #include "term/screen-processor.h"
 #include "util/bit-flags-calculator.h"
+#include "player/player-status-flags.h"
 
 /*!
  * @brief 自己分析処理(Nethackからのアイデア) / self-knowledge... idea from nethack.
@@ -755,7 +756,7 @@ void self_knowledge(player_type *creature_ptr)
         if (creature_ptr->muta3 & MUT3_MOTION) {
             info[i++] = _("あなたの動作は正確で力強い。(隠密+1)", "Your movements are precise and forceful (+1 STL).");
         }
-        if (creature_ptr->muta3 & MUT3_GOOD_LUCK) {
+        if (have_good_luck(creature_ptr)) {
             info[i++] = _("あなたは白いオーラにつつまれている。", "There is a white aura surrounding you.");
         }
         if (creature_ptr->muta3 & MUT3_BAD_LUCK) {