OSDN Git Service

[Refactor] #963 Renamed player_type.align to alignment
authorHourier <grapefox.whitelucifer.0408@gmail.com>
Thu, 29 Apr 2021 05:49:40 +0000 (14:49 +0900)
committerHourier <grapefox.whitelucifer.0408@gmail.com>
Thu, 29 Apr 2021 09:39:44 +0000 (18:39 +0900)
16 files changed:
src/io-dump/character-dump.cpp
src/knowledge/knowledge-self.cpp
src/monster-floor/monster-summon.cpp
src/monster/monster-info.cpp
src/monster/monster-processor.cpp
src/player-info/alignment.cpp
src/player-info/alignment.h
src/player/player-status-resist.cpp
src/player/player-status.cpp
src/room/space-finder.cpp
src/specific-object/death-scythe.cpp
src/spell/spell-info.cpp
src/system/player-type-definition.h
src/view/display-player.cpp
src/view/display-self-info.cpp
src/wizard/wizard-player-modifier.cpp

index 19a41f7..2523144 100644 (file)
@@ -1,6 +1,5 @@
 #include <string>
 
-#include "io-dump/character-dump.h"
 #include "artifact/fixed-art-types.h"
 #include "cmd-building/cmd-building.h"
 #include "dungeon/dungeon.h"
@@ -10,6 +9,7 @@
 #include "game-option/birth-options.h"
 #include "game-option/game-play-options.h"
 #include "inventory/inventory-slot-types.h"
+#include "io-dump/character-dump.h"
 #include "io-dump/player-status-dump.h"
 #include "io-dump/special-class-dump.h"
 #include "io/mutations-dump.h"
@@ -26,8 +26,8 @@
 #include "monster/smart-learn-types.h"
 #include "object/object-info.h"
 #include "pet/pet-util.h"
-#include "player-info/avatar.h"
 #include "player-info/alignment.h"
+#include "player-info/avatar.h"
 #include "player/player-status-flags.h"
 #include "player/player-status-table.h"
 #include "player/race-info-table.h"
@@ -453,7 +453,7 @@ static void dump_aux_virtues(player_type *creature_ptr, FILE *fff)
     }
 
     std::unique_ptr<PlayerAlignment> alignment(new PlayerAlignment(creature_ptr));
-    std::string alg = alignment->your_alignment();
+    std::string alg = alignment->get_alignment();
     fprintf(fff, _("\n属性 : %s\n", "\nYour alignment : %s\n"), alg.c_str());
     fprintf(fff, "\n");
     dump_virtues(creature_ptr, fff);
index 2c66aa2..c0a5d4e 100644 (file)
@@ -6,15 +6,15 @@
 
 #include <cstdlib>
 
-#include "knowledge-self.h"
 #include "birth/birth-explanations-table.h"
 #include "core/show-file.h"
 #include "flavor/flavor-describer.h"
 #include "floor/floor-town.h"
 #include "info-reader/fixed-map-parser.h"
 #include "io-dump/dump-util.h"
-#include "player-info/avatar.h"
+#include "knowledge-self.h"
 #include "player-info/alignment.h"
+#include "player-info/avatar.h"
 #include "player/player-class.h"
 #include "player/player-status-table.h"
 #include "player/race-info-table.h"
@@ -39,7 +39,7 @@ void do_cmd_knowledge_virtues(player_type *creature_ptr)
         return;
 
     std::unique_ptr<PlayerAlignment> alignment(new PlayerAlignment(creature_ptr));
-    std::string alg = alignment->your_alignment();
+    std::string alg = alignment->get_alignment();
     fprintf(fff, _("現在の属性 : %s\n\n", "Your alignment : %s\n\n"), alg.c_str());
     dump_virtues(creature_ptr, fff);
     angband_fclose(fff);
index b252f2d..98c99ef 100644 (file)
@@ -50,7 +50,7 @@ static bool summon_specific_okay(player_type *player_ptr, MONRACE_IDX r_idx)
         if (monster_has_hostile_align(player_ptr, m_ptr, 0, 0, r_ptr))
             return FALSE;
     } else if (summon_specific_who < 0) {
-        if (monster_has_hostile_align(player_ptr, NULL, 10, -10, r_ptr) && !one_in_(ABS(player_ptr->align) / 2 + 1))
+        if (monster_has_hostile_align(player_ptr, NULL, 10, -10, r_ptr) && !one_in_(ABS(player_ptr->alignment) / 2 + 1))
             return FALSE;
     }
 
index 84c5295..a90f201 100644 (file)
@@ -212,9 +212,9 @@ bool monster_has_hostile_align(player_type *player_ptr, monster_type *m_ptr, int
         sub_align1 = m_ptr->sub_align;
     } else /* For player */
     {
-        if (player_ptr->align >= pa_good)
+        if (player_ptr->alignment >= pa_good)
             sub_align1 |= SUB_ALIGN_GOOD;
-        if (player_ptr->align <= pa_evil)
+        if (player_ptr->alignment <= pa_evil)
             sub_align1 |= SUB_ALIGN_EVIL;
     }
 
index 3bfd266..4674097 100644 (file)
@@ -323,9 +323,9 @@ void process_angar(player_type *target_ptr, MONSTER_IDX m_idx, bool see_m)
     GAME_TEXT m_name[MAX_NLEN];
     monster_desc(target_ptr, m_name, m_ptr, is_pet(m_ptr) ? MD_ASSUME_VISIBLE : 0);
 
-    /* When riding a hostile align pet */
+    /* When riding a hostile alignment pet */
     if (target_ptr->riding == m_idx) {
-        if (abs(target_ptr->align / 10) < randint0(target_ptr->skill_exp[GINOU_RIDING]))
+        if (abs(target_ptr->alignment / 10) < randint0(target_ptr->skill_exp[GINOU_RIDING]))
             return;
 
         msg_format(_("%^sが突然暴れだした!", "%^s suddenly begins unruly!"), m_name);
index 2bd4210..b21cc0b 100644 (file)
@@ -14,17 +14,17 @@ PlayerAlignment::PlayerAlignment(player_type *creature_ptr)
  */
 concptr PlayerAlignment::alignment_label()
 {
-    if (this->creature_ptr->align > 150)
+    if (this->creature_ptr->alignment > 150)
         return _("大善", "Lawful");
-    else if (this->creature_ptr->align > 50)
+    else if (this->creature_ptr->alignment > 50)
         return _("中善", "Good");
-    else if (this->creature_ptr->align > 10)
+    else if (this->creature_ptr->alignment > 10)
         return _("小善", "Neutral Good");
-    else if (this->creature_ptr->align > -11)
+    else if (this->creature_ptr->alignment > -11)
         return _("中立", "Neutral");
-    else if (this->creature_ptr->align > -51)
+    else if (this->creature_ptr->alignment > -51)
         return _("小悪", "Neutral Evil");
-    else if (this->creature_ptr->align > -151)
+    else if (this->creature_ptr->alignment > -151)
         return _("中悪", "Evil");
     else
         return _("大悪", "Chaotic");
@@ -35,11 +35,11 @@ concptr PlayerAlignment::alignment_label()
  * @param creature_ptr 算出するクリーチャーの参照ポインタ。
  * @return アライメントの表記を返す。
  */
-concptr PlayerAlignment::your_alignment(bool with_value)
+concptr PlayerAlignment::get_alignment(bool with_value)
 {
     auto s = alignment_label();
     if (with_value || show_actual_value)
-        return format(_("%s(%ld)", "%s (%ld)"), s, static_cast<long>(this->creature_ptr->align));
+        return format(_("%s(%ld)", "%s (%ld)"), s, static_cast<long>(this->creature_ptr->alignment));
 
     return s;
 }
index a1cb98c..322155d 100644 (file)
@@ -8,7 +8,7 @@ public:
     PlayerAlignment(player_type *creature_ptr);
     PlayerAlignment() = delete;
     virtual ~PlayerAlignment() = default;
-    concptr your_alignment(bool with_value = false);
+    concptr get_alignment(bool with_value = false);
 private:
     player_type *creature_ptr;
     concptr alignment_label();
index 9a1c068..a517332 100644 (file)
@@ -436,9 +436,9 @@ PERCENTAGE calc_holy_fire_damage_rate(player_type *creature_ptr, rate_calc_type_
 {
     (void)mode; // unused
     PERCENTAGE per = 100;
-    if (creature_ptr->align > 10)
+    if (creature_ptr->alignment > 10)
         per /= 2;
-    else if (creature_ptr->align < -10)
+    else if (creature_ptr->alignment < -10)
         per *= 2;
     return per;
 }
@@ -450,7 +450,7 @@ PERCENTAGE calc_hell_fire_damage_rate(player_type *creature_ptr, rate_calc_type_
 {
     (void)mode; // unused
     PERCENTAGE per = 100;
-    if (creature_ptr->align > 10)
+    if (creature_ptr->alignment > 10)
         per *= 2;
     return per;
 }
index ff97344..c5eacad 100644 (file)
@@ -461,7 +461,7 @@ static void update_bonuses(player_type *creature_ptr)
 
 static void update_alignment(player_type *creature_ptr)
 {
-    creature_ptr->align = 0;
+    creature_ptr->alignment = 0;
     floor_type *floor_ptr = creature_ptr->current_floor_ptr;
     for (MONSTER_IDX m_idx = floor_ptr->m_max - 1; m_idx >= 1; m_idx--) {
         monster_type *m_ptr;
@@ -475,27 +475,27 @@ static void update_alignment(player_type *creature_ptr)
             continue;
 
         if (any_bits(r_ptr->flags3, RF3_GOOD))
-            creature_ptr->align += r_ptr->level;
+            creature_ptr->alignment += r_ptr->level;
         if (any_bits(r_ptr->flags3, RF3_EVIL))
-            creature_ptr->align -= r_ptr->level;
+            creature_ptr->alignment -= r_ptr->level;
     }
 
     if (creature_ptr->mimic_form) {
         switch (creature_ptr->mimic_form) {
         case MIMIC_DEMON:
-            creature_ptr->align -= 200;
+            creature_ptr->alignment -= 200;
             break;
         case MIMIC_DEMON_LORD:
-            creature_ptr->align -= 200;
+            creature_ptr->alignment -= 200;
             break;
         }
     } else {
         switch (creature_ptr->prace) {
         case RACE_ARCHON:
-            creature_ptr->align += 200;
+            creature_ptr->alignment += 200;
             break;
         case RACE_BALROG:
-            creature_ptr->align -= 200;
+            creature_ptr->alignment -= 200;
             break;
 
         default:
@@ -508,7 +508,7 @@ static void update_alignment(player_type *creature_ptr)
             continue;
         if (creature_ptr->inventory_list[INVEN_MAIN_HAND + i].name1 != ART_IRON_BALL)
             continue;
-        creature_ptr->align -= 1000;
+        creature_ptr->alignment -= 1000;
     }
 
     int j = 0;
@@ -516,7 +516,7 @@ static void update_alignment(player_type *creature_ptr)
     for (int i = 0; i < 8; i++) {
         switch (creature_ptr->vir_types[i]) {
         case V_JUSTICE:
-            creature_ptr->align += creature_ptr->virtues[i] * 2;
+            creature_ptr->alignment += creature_ptr->virtues[i] * 2;
             break;
         case V_CHANCE:
             break;
@@ -525,23 +525,23 @@ static void update_alignment(player_type *creature_ptr)
             neutral[j++] = i;
             break;
         case V_UNLIFE:
-            creature_ptr->align -= creature_ptr->virtues[i];
+            creature_ptr->alignment -= creature_ptr->virtues[i];
             break;
         default:
-            creature_ptr->align += creature_ptr->virtues[i];
+            creature_ptr->alignment += creature_ptr->virtues[i];
             break;
         }
     }
 
     for (int i = 0; i < j; i++) {
-        if (creature_ptr->align > 0) {
-            creature_ptr->align -= creature_ptr->virtues[neutral[i]] / 2;
-            if (creature_ptr->align < 0)
-                creature_ptr->align = 0;
-        } else if (creature_ptr->align < 0) {
-            creature_ptr->align += creature_ptr->virtues[neutral[i]] / 2;
-            if (creature_ptr->align > 0)
-                creature_ptr->align = 0;
+        if (creature_ptr->alignment > 0) {
+            creature_ptr->alignment -= creature_ptr->virtues[neutral[i]] / 2;
+            if (creature_ptr->alignment < 0)
+                creature_ptr->alignment = 0;
+        } else if (creature_ptr->alignment < 0) {
+            creature_ptr->alignment += creature_ptr->virtues[neutral[i]] / 2;
+            if (creature_ptr->alignment > 0)
+                creature_ptr->alignment = 0;
         }
     }
 }
index 723851c..95a0dd7 100644 (file)
@@ -166,7 +166,7 @@ static bool find_space_aux(dun_data_type *dd_ptr, POSITION blocks_high, POSITION
  * the room calling this function.\n
  *\n
  * We allocate space in 11x11 blocks, but want to make sure that rooms\n
- * align neatly on the standard screen.  Therefore, we make them use\n
+ * alignment neatly on the standard screen.  Therefore, we make them use\n
  * blocks in few 11x33 rectangles as possible.\n
  *\n
  * Be careful to include the edges of the room in height and width!\n
index 6a2033b..36a8444 100644 (file)
@@ -87,7 +87,7 @@ static int calc_death_scythe_reflection_magnification(player_type *attacker_ptr)
  */
 static void compensate_death_scythe_reflection_magnification(player_type *attacker_ptr, int *magnification, BIT_FLAGS *death_scythe_flags)
 {
-    if ((attacker_ptr->align < 0) && (*magnification < 20))
+    if ((attacker_ptr->alignment < 0) && (*magnification < 20))
         *magnification = 20;
 
     if (!(has_resist_acid(attacker_ptr) || is_oppose_acid(attacker_ptr) || has_immune_acid(attacker_ptr)) && (*magnification < 25))
index c90fcd9..dcd6c1d 100644 (file)
@@ -174,18 +174,18 @@ PERCENTAGE spell_chance(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_
     PERCENTAGE penalty = (mp_ptr->spell_stat == A_WIS) ? 10 : 4;
     switch (use_realm) {
     case REALM_NATURE:
-        if ((caster_ptr->align > 50) || (caster_ptr->align < -50))
+        if ((caster_ptr->alignment > 50) || (caster_ptr->alignment < -50))
             chance += penalty;
         break;
     case REALM_LIFE:
     case REALM_CRUSADE:
-        if (caster_ptr->align < -20)
+        if (caster_ptr->alignment < -20)
             chance += penalty;
         break;
     case REALM_DEATH:
     case REALM_DAEMON:
     case REALM_HEX:
-        if (caster_ptr->align > 20)
+        if (caster_ptr->alignment > 20)
             chance += penalty;
         break;
     }
index d0d918e..c1a3d04 100644 (file)
@@ -301,7 +301,7 @@ typedef struct player_type {
     bool sutemi{};
     bool counter{};
 
-    ALIGNMENT align{}; /* Good/evil/neutral */
+    ALIGNMENT alignment{}; /* Good/evil/neutral */
     POSITION run_py{};
     POSITION run_px{};
     DIRECTION fishing_dir{};
index a75ea42..bc4dab7 100644 (file)
@@ -135,7 +135,7 @@ static void display_phisique(player_type *creature_ptr)
     display_player_one_line(ENTRY_SOCIAL, format("%d", (int)creature_ptr->sc), TERM_L_BLUE);
 #endif
     std::unique_ptr<PlayerAlignment> alignment(new PlayerAlignment(creature_ptr));
-    std::string alg = alignment->your_alignment();
+    std::string alg = alignment->get_alignment();
     display_player_one_line(ENTRY_ALIGN, format("%s", alg.c_str()), TERM_L_BLUE);
 }
 
@@ -354,11 +354,10 @@ void display_player(player_type *creature_ptr, int mode)
  */
 void display_player_equippy(player_type *creature_ptr, TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode)
 {
-       int max_i = (mode & DP_WP) ? INVEN_BOW + 1 : INVEN_TOTAL;
-       for (int i = INVEN_MAIN_HAND; i < max_i; i++)
-       {
-               object_type *o_ptr;
-               o_ptr = &creature_ptr->inventory_list[i];
+    int max_i = (mode & DP_WP) ? INVEN_BOW + 1 : INVEN_TOTAL;
+    for (int i = INVEN_MAIN_HAND; i < max_i; i++) {
+        object_type *o_ptr;
+        o_ptr = &creature_ptr->inventory_list[i];
 
         TERM_COLOR a = object_attr(o_ptr);
         SYMBOL_CODE c = object_char(o_ptr);
index 34bc24d..1c66407 100644 (file)
@@ -5,7 +5,6 @@
 #include "player-info/self-info-util.h"
 #include "player/player-race.h"
 #include "player/player-status-table.h"
-#include "player/player-status.h"
 #include "system/player-type-definition.h"
 #include "term/screen-processor.h"
 #include <string>
@@ -37,7 +36,7 @@ void display_virtue(player_type *creature_ptr, self_info_type *self_ptr)
 {
     self_ptr->info[self_ptr->line++] = "";
     std::unique_ptr<PlayerAlignment> alignment(new PlayerAlignment(creature_ptr));
-    std::string alg = alignment->your_alignment(true);
+    std::string alg = alignment->get_alignment(true);
     sprintf(self_ptr->plev_buf, _("現在の属性 : %s", "Your alignment : %s"), alg.c_str());
     strcpy(self_ptr->buf[1], self_ptr->plev_buf);
     self_ptr->info[self_ptr->line++] = self_ptr->buf[1];
index b197f5c..8d1967e 100644 (file)
@@ -72,7 +72,7 @@ void wizard_player_modifier(player_type *creature_ptr)
     case '\r':
         break;
     case 'a':
-        msg_format("Your alignment is %d.", creature_ptr->align);
+        msg_format("Your alignment is %d.", creature_ptr->alignment);
         break;
     case 'c':
         wiz_reset_class(creature_ptr);