OSDN Git Service

Merge pull request #1927 from dis-/feature/fix-special-disturb
authordis- <dis.rogue@gmail.com>
Mon, 27 Dec 2021 12:31:06 +0000 (21:31 +0900)
committerGitHub <noreply@github.com>
Mon, 27 Dec 2021 12:31:06 +0000 (21:31 +0900)
[Feature] モンスターの特殊な行動、回復について連続行動阻害の要件を整理

33 files changed:
Hengband/Hengband.sln
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/autopick/autopick-describer.cpp
src/birth/birth-select-class.cpp
src/cmd-item/cmd-item.cpp
src/flavor/flavor-util.cpp
src/grid/trap.cpp
src/grid/trap.h
src/lore/lore-util.cpp
src/melee/melee-spell.cpp
src/monster-floor/quantum-effect.cpp
src/mspell/assign-monster-spell.cpp
src/mspell/mspell-attack.cpp
src/mspell/mspell-ball.cpp
src/mspell/mspell-bolt.cpp
src/mspell/mspell-breath.cpp
src/mspell/mspell-curse.cpp
src/mspell/mspell-dispel.cpp
src/mspell/mspell-floor.cpp
src/mspell/mspell-particularity.cpp
src/mspell/mspell-result.h [moved from src/mspell/mspell.h with 94% similarity]
src/mspell/mspell-special.cpp
src/mspell/mspell-status.cpp
src/mspell/mspell-summon.cpp
src/object/object-stack.cpp
src/player/player-move.cpp
src/store/store-owners.cpp
src/store/store-owners.h
src/store/store-util.h
src/system/h-type.h
src/window/display-sub-window-items.cpp

index 77fd6d2..157a870 100644 (file)
@@ -1,7 +1,7 @@
 \r
 Microsoft Visual Studio Solution File, Format Version 12.00\r
-# Visual Studio Version 16\r
-VisualStudioVersion = 16.0.30011.22\r
+# Visual Studio Version 17\r
+VisualStudioVersion = 17.0.31903.59\r
 MinimumVisualStudioVersion = 10.0.40219.1\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Hengband", "Hengband\Hengband.vcxproj", "{C00503B6-18FF-42F1-BAC0-6C94EDE62CB2}"\r
 EndProject\r
index 5ce3156..625aa45 100644 (file)
     <ClInclude Include="..\..\src\load\player-class-specific-data-loader.h" />\r
     <ClInclude Include="..\..\src\load\savedata-old-flag-types.h" />\r
     <ClInclude Include="..\..\src\monster-race\monster-aura-types.h" />\r
-    <ClInclude Include="..\..\src\mspell\mspell.h" />\r
+    <ClInclude Include="..\..\src\mspell\mspell-result.h" />\r
     <ClInclude Include="..\..\src\object-enchant\object-smith.h" />\r
     <ClInclude Include="..\..\src\object-enchant\smith-info.h" />\r
     <ClInclude Include="..\..\src\object-enchant\smith-tables.h" />\r
index 15756b1..30faa67 100644 (file)
     <ClInclude Include="..\..\src\monster-race\monster-aura-types.h">\r
       <Filter>monster-race</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\..\src\mspell\mspell.h">\r
+    <ClInclude Include="..\..\src\mspell\mspell-result.h">\r
       <Filter>mspell</Filter>\r
     </ClInclude>\r
     <ClInclude Include="..\..\src\load\old\load-v1-5-0.h">\r
index e7c4d9a..e8e6c4b 100644 (file)
@@ -524,24 +524,24 @@ hengband_SOURCES = \
        mspell/monster-power-table.cpp mspell/monster-power-table.h \
        mspell/mspell-attack.cpp mspell/mspell-attack.h \
        mspell/mspell-attack-util.cpp mspell/mspell-attack-util.h \
-       mspell/mspell-breath.cpp mspell/mspell-breath.h \
        mspell/mspell-ball.cpp mspell/mspell-ball.h \
        mspell/mspell-bolt.cpp mspell/mspell-bolt.h \
+       mspell/mspell-breath.cpp mspell/mspell-breath.h \
        mspell/mspell-checker.cpp mspell/mspell-checker.h \
        mspell/mspell-curse.cpp mspell/mspell-curse.h \
+       mspell/mspell-damage-calculator.cpp mspell/mspell-damage-calculator.h \
        mspell/mspell-dispel.cpp mspell/mspell-dispel.h \
+       mspell/mspell-floor.cpp mspell/mspell-floor.h \
        mspell/mspell-judgement.cpp mspell/mspell-judgement.h \
-       mspell/mspell-lite.cpp mspell/mspell-lite.h \
-       mspell/mspell-summon.cpp mspell/mspell-summon.h \
-       mspell/mspell-util.cpp mspell/mspell-util.h \
-       mspell/mspell-damage-calculator.cpp mspell/mspell-damage-calculator.h \
        mspell/mspell-learn-checker.cpp mspell/mspell-learn-checker.h \
-       mspell/mspell-floor.cpp mspell/mspell-floor.h \
+       mspell/mspell-lite.cpp mspell/mspell-lite.h \
+       mspell/mspell-particularity.cpp mspell/mspell-particularity.h \
+       mspell/mspell-result.h \
        mspell/mspell-special.cpp mspell/mspell-special.h \
+       mspell/mspell-summon.cpp mspell/mspell-summon.h \
        mspell/mspell-status.cpp mspell/mspell-status.h \
-       mspell/mspell-particularity.cpp mspell/mspell-particularity.h \
        mspell/mspell-selector.cpp mspell/mspell-selector.h \
-       mspell/mspell.h \
+       mspell/mspell-util.cpp mspell/mspell-util.h \
        mspell/smart-mspell-util.cpp mspell/smart-mspell-util.h \
        mspell/specified-summon.cpp mspell/specified-summon.h \
        mspell/summon-checker.cpp mspell/summon-checker.h \
index 3bf5147..f0beae8 100644 (file)
@@ -210,7 +210,7 @@ static void describe_autpick_jp(char *buff, autopick_type *entry, autopick_descr
         }
 
         strcat(buff, "で、名前が「");
-        strncat(buff, describer->str, 80);
+        angband_strcat(buff, describer->str, (MAX_NLEN - MAX_INSCRIPTION));
         if (describer->top)
             strcat(buff, "」で始まるもの");
         else
@@ -218,7 +218,9 @@ static void describe_autpick_jp(char *buff, autopick_type *entry, autopick_descr
     }
 
     if (describer->insc) {
-        strncat(buff, format("に「%s」", describer->insc), 80);
+        char tmp[MAX_INSCRIPTION + 1] = "";
+        angband_strcat(tmp, describer->insc, MAX_INSCRIPTION);
+        angband_strcat(buff, format("に「%s」", tmp), MAX_INSCRIPTION + 6);
 
         if (angband_strstr(describer->insc, "%%all"))
             strcat(buff, "(%%allは全能力を表す英字の記号で置換)");
index 9a337cd..059afe2 100644 (file)
@@ -137,7 +137,7 @@ static bool select_class(PlayerType *player_ptr, char *cur, char *sym, int *k)
             return false;
 
         if (c == ' ' || c == '\r' || c == '\n') {
-            if (cs == PlayerClassType::MAX) {
+            if (int_cs == enum2i(PlayerClassType::MAX)) {
                 *k = randint0(PLAYER_CLASS_TYPE_MAX);
                 cs = i2enum<PlayerClassType>(*k);
                 continue;
index 6e2d42b..5953b32 100644 (file)
@@ -66,6 +66,7 @@
 #include "util/bit-flags-calculator.h"
 #include "util/int-char-converter.h"
 #include "util/quarks.h"
+#include "util/string-processor.h"
 #include "view/display-inventory.h"
 #include "view/display-messages.h"
 
@@ -201,7 +202,7 @@ void do_cmd_inscribe(PlayerType *player_ptr)
     OBJECT_IDX item;
     object_type *o_ptr;
     GAME_TEXT o_name[MAX_NLEN];
-    char out_val[80];
+    char out_val[MAX_INSCRIPTION + 1] = "";
     concptr q = _("どのアイテムに銘を刻みますか? ", "Inscribe which item? ");
     concptr s = _("銘を刻めるアイテムがない。", "You have nothing to inscribe.");
     o_ptr = choose_object(player_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
@@ -213,9 +214,9 @@ void do_cmd_inscribe(PlayerType *player_ptr)
     msg_print(nullptr);
     strcpy(out_val, "");
     if (o_ptr->inscription)
-        strcpy(out_val, quark_str(o_ptr->inscription));
+        angband_strcpy(out_val, quark_str(o_ptr->inscription), MAX_INSCRIPTION);
 
-    if (get_string(_("銘: ", "Inscription: "), out_val, 80)) {
+    if (get_string(_("銘: ", "Inscription: "), out_val, MAX_INSCRIPTION)) {
         o_ptr->inscription = quark_add(out_val);
         set_bits(player_ptr->update, PU_COMBINE);
         set_bits(player_ptr->window_flags, PW_INVEN | PW_EQUIP | PW_FLOOR_ITEM_LIST);
index bd069fe..d4a7b27 100644 (file)
@@ -320,6 +320,8 @@ void get_inscription(char *buff, object_type *o_ptr)
         while (*insc) {
             if (*insc == '#')
                 break;
+            if (buff > ptr + MAX_INSCRIPTION - 1)
+                break;
 #ifdef JP
             if (iskanji(*insc))
                 *buff++ = *insc++;
index d94ccdc..a63df00 100644 (file)
@@ -43,6 +43,7 @@
 #include "target/projection-path-calculator.h"
 #include "timed-effect/player-cut.h"
 #include "timed-effect/timed-effects.h"
+#include "util/enum-converter.h"
 #include "view/display-messages.h"
 #include "world/world.h"
 
@@ -283,21 +284,21 @@ static int check_hit_from_monster_to_player(PlayerType *player_ptr, int power)
  * @brief 落とし穴系トラップの判定とプレイヤーの被害処理
  * @param trap_feat_type トラップの種別ID
  */
-static void hit_trap_pit(PlayerType *player_ptr, enum trap_type trap_feat_type)
+static void hit_trap_pit(PlayerType *player_ptr, TrapType trap_feat_type)
 {
     HIT_POINT dam;
     concptr trap_name = "";
     concptr spike_name = "";
 
     switch (trap_feat_type) {
-    case TRAP_PIT:
+    case TrapType::PIT:
         trap_name = _("落とし穴", "a pit trap");
         break;
-    case TRAP_SPIKED_PIT:
+    case TrapType::SPIKED_PIT:
         trap_name = _("スパイクが敷かれた落とし穴", "a spiked pit");
         spike_name = _("スパイク", "spikes");
         break;
-    case TRAP_POISON_PIT:
+    case TrapType::POISON_PIT:
         trap_name = _("スパイクが敷かれた落とし穴", "a spiked pit");
         spike_name = _("毒を塗られたスパイク", "poisonous spikes");
         break;
@@ -312,7 +313,7 @@ static void hit_trap_pit(PlayerType *player_ptr, enum trap_type trap_feat_type)
 
     msg_format(_("%sに落ちてしまった!", "You have fallen into %s!"), trap_name);
     dam = damroll(2, 6);
-    if (((trap_feat_type != TRAP_SPIKED_PIT) && (trap_feat_type != TRAP_POISON_PIT)) || one_in_(2)) {
+    if (((trap_feat_type != TrapType::SPIKED_PIT) && (trap_feat_type != TrapType::POISON_PIT)) || one_in_(2)) {
         take_hit(player_ptr, DAMAGE_NOESCAPE, dam, trap_name);
         return;
     }
@@ -321,7 +322,7 @@ static void hit_trap_pit(PlayerType *player_ptr, enum trap_type trap_feat_type)
     dam = dam * 2;
     BadStatusSetter bss(player_ptr);
     (void)bss.mod_cut(randint1(dam));
-    if (trap_feat_type != TRAP_POISON_PIT) {
+    if (trap_feat_type != TrapType::POISON_PIT) {
         take_hit(player_ptr, DAMAGE_NOESCAPE, dam, trap_name);
         return;
     }
@@ -390,7 +391,7 @@ void hit_trap(PlayerType *player_ptr, bool break_trap)
     POSITION x = player_ptr->x, y = player_ptr->y;
     grid_type *g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
     feature_type *f_ptr = &f_info[g_ptr->feat];
-    enum trap_type trap_feat_type = f_ptr->flags.has(FloorFeatureType::TRAP) ? (enum trap_type)f_ptr->subtype : NOT_TRAP;
+    TrapType trap_feat_type = f_ptr->flags.has(FloorFeatureType::TRAP) ? i2enum<TrapType>(f_ptr->subtype) : TrapType::NOT_TRAP;
     concptr name = _("トラップ", "a trap");
 
     disturb(player_ptr, false, true);
@@ -399,7 +400,7 @@ void hit_trap(PlayerType *player_ptr, bool break_trap)
 
     /* Analyze */
     switch (trap_feat_type) {
-    case TRAP_TRAPDOOR: {
+    case TrapType::TRAPDOOR: {
         if (player_ptr->levitation) {
             msg_print(_("落とし戸を飛び越えた。", "You fly over a trap door."));
         } else {
@@ -426,14 +427,14 @@ void hit_trap(PlayerType *player_ptr, bool break_trap)
         break;
     }
 
-    case TRAP_PIT:
-    case TRAP_SPIKED_PIT:
-    case TRAP_POISON_PIT: {
+    case TrapType::PIT:
+    case TrapType::SPIKED_PIT:
+    case TrapType::POISON_PIT: {
         hit_trap_pit(player_ptr, trap_feat_type);
         break;
     }
 
-    case TRAP_TY_CURSE: {
+    case TrapType::TY_CURSE: {
         msg_print(_("何かがピカッと光った!", "There is a flash of shimmering light!"));
         num = 2 + randint1(3);
         for (i = 0; i < num; i++) {
@@ -452,54 +453,54 @@ void hit_trap(PlayerType *player_ptr, bool break_trap)
         break;
     }
 
-    case TRAP_TELEPORT: {
+    case TrapType::TELEPORT: {
         msg_print(_("テレポート・トラップにひっかかった!", "You hit a teleport trap!"));
         teleport_player(player_ptr, 100, TELEPORT_PASSIVE);
         break;
     }
 
-    case TRAP_FIRE: {
+    case TrapType::FIRE: {
         msg_print(_("炎に包まれた!", "You are enveloped in flames!"));
         dam = damroll(4, 6);
         (void)fire_dam(player_ptr, dam, _("炎のトラップ", "a fire trap"), false);
         break;
     }
 
-    case TRAP_ACID: {
+    case TrapType::ACID: {
         msg_print(_("酸が吹きかけられた!", "You are splashed with acid!"));
         dam = damroll(4, 6);
         (void)acid_dam(player_ptr, dam, _("酸のトラップ", "an acid trap"), false);
         break;
     }
 
-    case TRAP_SLOW: {
+    case TrapType::SLOW: {
         hit_trap_slow(player_ptr);
         break;
     }
 
-    case TRAP_LOSE_STR: {
+    case TrapType::LOSE_STR: {
         hit_trap_lose_stat(player_ptr, A_STR);
         break;
     }
 
-    case TRAP_LOSE_DEX: {
+    case TrapType::LOSE_DEX: {
         hit_trap_lose_stat(player_ptr, A_DEX);
         break;
     }
 
-    case TRAP_LOSE_CON: {
+    case TrapType::LOSE_CON: {
         hit_trap_lose_stat(player_ptr, A_CON);
         break;
     }
 
-    case TRAP_BLIND:
+    case TrapType::BLIND:
         msg_print(_("黒いガスに包み込まれた!", "A black gas surrounds you!"));
         if (has_resist_blind(player_ptr) == 0) {
             (void)BadStatusSetter(player_ptr).mod_blindness(randint0(50) + 25);
         }
 
         break;
-    case TRAP_CONFUSE: {
+    case TrapType::CONFUSE: {
         msg_print(_("きらめくガスに包み込まれた!", "A gas of scintillating colors surrounds you!"));
         if (has_resist_conf(player_ptr) == 0) {
             (void)BadStatusSetter(player_ptr).mod_confusion(randint0(20) + 10);
@@ -508,7 +509,7 @@ void hit_trap(PlayerType *player_ptr, bool break_trap)
         break;
     }
 
-    case TRAP_POISON: {
+    case TrapType::POISON: {
         msg_print(_("刺激的な緑色のガスに包み込まれた!", "A pungent green gas surrounds you!"));
         if (has_resist_pois(player_ptr) == 0) {
             (void)BadStatusSetter(player_ptr).mod_poison(randint0(20) + 10);
@@ -517,7 +518,7 @@ void hit_trap(PlayerType *player_ptr, bool break_trap)
         break;
     }
 
-    case TRAP_SLEEP: {
+    case TrapType::SLEEP: {
         msg_print(_("奇妙な白い霧に包まれた!", "A strange white mist surrounds you!"));
         if (player_ptr->free_act) {
             break;
@@ -533,7 +534,7 @@ void hit_trap(PlayerType *player_ptr, bool break_trap)
         break;
     }
 
-    case TRAP_TRAPS: {
+    case TrapType::TRAPS: {
         msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
         /* Make some new traps */
         project(player_ptr, 0, 1, y, x, 0, AttributeType::MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID);
@@ -541,7 +542,7 @@ void hit_trap(PlayerType *player_ptr, bool break_trap)
         break;
     }
 
-    case TRAP_ALARM: {
+    case TrapType::ALARM: {
         msg_print(_("けたたましい音が鳴り響いた!", "An alarm sounds!"));
 
         aggravate_monsters(player_ptr, 0);
@@ -549,7 +550,7 @@ void hit_trap(PlayerType *player_ptr, bool break_trap)
         break;
     }
 
-    case TRAP_OPEN: {
+    case TrapType::OPEN: {
         msg_print(_("大音響と共にまわりの壁が崩れた!", "Suddenly, surrounding walls are opened!"));
         (void)project(player_ptr, 0, 3, y, x, 0, AttributeType::DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE);
         (void)project(player_ptr, 0, 3, y, x - 4, 0, AttributeType::DISINTEGRATE, PROJECT_GRID | PROJECT_HIDE);
@@ -559,7 +560,7 @@ void hit_trap(PlayerType *player_ptr, bool break_trap)
         break;
     }
 
-    case TRAP_ARMAGEDDON: {
+    case TrapType::ARMAGEDDON: {
         static int levs[10] = { 0, 0, 20, 10, 5, 3, 2, 1, 1, 1 };
         int evil_idx = 0, good_idx = 0;
 
@@ -602,7 +603,7 @@ void hit_trap(PlayerType *player_ptr, bool break_trap)
         break;
     }
 
-    case TRAP_PIRANHA: {
+    case TrapType::PIRANHA: {
         msg_print(_("突然壁から水が溢れ出した!ピラニアがいる!", "Suddenly, the room is filled with water with piranhas!"));
 
         /* Water fills room */
index 4acc6fe..1173454 100644 (file)
@@ -25,33 +25,32 @@ enum class ChestTrapType : ushort {
 // clang-format on
 
 /* Types of normal traps */
-enum trap_type {
+enum class TrapType {
     NOT_TRAP = -1,
-    TRAP_TRAPDOOR = 0,
-    TRAP_PIT = 1,
-    TRAP_SPIKED_PIT = 2,
-    TRAP_POISON_PIT = 3,
-    TRAP_TY_CURSE = 4,
-    TRAP_TELEPORT = 5,
-    TRAP_FIRE = 6,
-    TRAP_ACID = 7,
-    TRAP_SLOW = 8,
-
-    TRAP_LOSE_STR = 9,
-    TRAP_LOSE_DEX = 10,
-    TRAP_LOSE_CON = 11,
-    TRAP_BLIND = 12,
-    TRAP_CONFUSE = 13,
-    TRAP_POISON = 14,
-    TRAP_SLEEP = 15,
-    TRAP_TRAPS = 16,
-    TRAP_ALARM = 17,
+    TRAPDOOR = 0,
+    PIT = 1,
+    SPIKED_PIT = 2,
+    POISON_PIT = 3,
+    TY_CURSE = 4,
+    TELEPORT = 5,
+    FIRE = 6,
+    ACID = 7,
+    SLOW = 8,
+
+    LOSE_STR = 9,
+    LOSE_DEX = 10,
+    LOSE_CON = 11,
+    BLIND = 12,
+    CONFUSE = 13,
+    POISON = 14,
+    SLEEP = 15,
+    TRAPS = 16,
+    ALARM = 17,
 
     /* Types of special traps */
-    TRAP_OPEN = 18,
-    TRAP_ARMAGEDDON = 19,
-    TRAP_PIRANHA = 20,
-
+    OPEN = 18,
+    ARMAGEDDON = 19,
+    PIRANHA = 20,
 };
 
 extern const std::vector<EnumClassFlagGroup<ChestTrapType>> chest_traps;
index 358e245..c44e08a 100644 (file)
@@ -45,6 +45,7 @@ lore_type *initialize_lore_type(lore_type *lore_ptr, MONRACE_IDX r_idx, monster_
     lore_ptr->flags2 = (lore_ptr->r_ptr->flags2 & lore_ptr->r_ptr->r_flags2);
     lore_ptr->flags3 = (lore_ptr->r_ptr->flags3 & lore_ptr->r_ptr->r_flags3);
     lore_ptr->ability_flags = (lore_ptr->r_ptr->ability_flags & lore_ptr->r_ptr->r_ability_flags);
+    lore_ptr->aura_flags = (lore_ptr->r_ptr->aura_flags & lore_ptr->r_ptr->r_aura_flags);
     lore_ptr->flags7 = (lore_ptr->r_ptr->flags7 & lore_ptr->r_ptr->flags7);
     lore_ptr->flagsr = (lore_ptr->r_ptr->flagsr & lore_ptr->r_ptr->r_flagsr);
     lore_ptr->reinforce = false;
index 41ebedf..47dc268 100644 (file)
@@ -9,8 +9,8 @@
 #include "monster/monster-status.h"
 #include "mspell/assign-monster-spell.h"
 #include "mspell/mspell-checker.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
 #include "player-base/player-class.h"
 #include "player-info/mane-data-type.h"
 #include "spell-realm/spells-hex.h"
index 80e5556..b196b47 100644 (file)
@@ -10,7 +10,7 @@
 #include "monster/monster-info.h"
 #include "monster/smart-learn-types.h"
 #include "mspell/assign-monster-spell.h"
-#include "mspell/mspell.h"
+#include "mspell/mspell-result.h"
 #include "effect/attribute-types.h"
 #include "spell-kind/spells-teleport.h"
 #include "system/floor-type-definition.h"
index f27fbcf..560ad48 100644 (file)
 #include "mspell/mspell-floor.h"
 #include "mspell/mspell-learn-checker.h"
 #include "mspell/mspell-particularity.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-special.h"
 #include "mspell/mspell-status.h"
 #include "mspell/mspell-summon.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
+#include "mspell/mspell-result.h"
 #include "effect/attribute-types.h"
 #include "system/player-type-definition.h"
 #include "util/enum-converter.h"
index 682ef1f..06366e5 100644 (file)
@@ -21,9 +21,9 @@
 #include "mspell/mspell-checker.h"
 #include "mspell/mspell-learn-checker.h"
 #include "mspell/mspell-lite.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-selector.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
 #include "player-base/player-class.h"
 #include "player-info/mane-data-type.h"
 #include "player/attack-defense-types.h"
@@ -54,8 +54,7 @@ static void set_no_magic_mask(msa_type *msa_ptr)
 static void check_mspell_stupid(PlayerType *player_ptr, msa_type *msa_ptr)
 {
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    msa_ptr->in_no_magic_dungeon = d_info[player_ptr->dungeon_idx].flags.has(DungeonFeatureType::NO_MAGIC) && floor_ptr->dun_level
-        && (!floor_ptr->inside_quest || quest_type::is_fixed(floor_ptr->inside_quest));
+    msa_ptr->in_no_magic_dungeon = d_info[player_ptr->dungeon_idx].flags.has(DungeonFeatureType::NO_MAGIC) && floor_ptr->dun_level && (!floor_ptr->inside_quest || quest_type::is_fixed(floor_ptr->inside_quest));
     if (!msa_ptr->in_no_magic_dungeon || ((msa_ptr->r_ptr->flags2 & RF2_STUPID) != 0))
         return;
 
@@ -95,13 +94,11 @@ static bool check_mspell_non_stupid(PlayerType *player_ptr, msa_type *msa_ptr)
     if (!player_ptr->csp)
         msa_ptr->ability_flags.reset(MonsterAbilityType::DRAIN_MANA);
 
-    if (msa_ptr->ability_flags.has_any_of(RF_ABILITY_BOLT_MASK)
-        && !clean_shot(player_ptr, msa_ptr->m_ptr->fy, msa_ptr->m_ptr->fx, player_ptr->y, player_ptr->x, false)) {
+    if (msa_ptr->ability_flags.has_any_of(RF_ABILITY_BOLT_MASK) && !clean_shot(player_ptr, msa_ptr->m_ptr->fy, msa_ptr->m_ptr->fx, player_ptr->y, player_ptr->x, false)) {
         msa_ptr->ability_flags.reset(RF_ABILITY_BOLT_MASK);
     }
 
-    if (msa_ptr->ability_flags.has_any_of(RF_ABILITY_SUMMON_MASK)
-        && !(summon_possible(player_ptr, msa_ptr->y, msa_ptr->x))) {
+    if (msa_ptr->ability_flags.has_any_of(RF_ABILITY_SUMMON_MASK) && !(summon_possible(player_ptr, msa_ptr->y, msa_ptr->x))) {
         msa_ptr->ability_flags.reset(RF_ABILITY_SUMMON_MASK);
     }
 
@@ -185,8 +182,7 @@ static bool check_mspell_unexploded(PlayerType *player_ptr, msa_type *msa_ptr)
     if (msa_ptr->r_ptr->flags2 & RF2_STUPID)
         fail_rate = 0;
 
-    if (!spell_is_inate(msa_ptr->thrown_spell)
-        && (msa_ptr->in_no_magic_dungeon || (monster_stunned_remaining(msa_ptr->m_ptr) && one_in_(2)) || (randint0(100) < fail_rate))) {
+    if (!spell_is_inate(msa_ptr->thrown_spell) && (msa_ptr->in_no_magic_dungeon || (monster_stunned_remaining(msa_ptr->m_ptr) && one_in_(2)) || (randint0(100) < fail_rate))) {
         disturb(player_ptr, true, true);
         msg_format(_("%^sは呪文を唱えようとしたが失敗した。", "%^s tries to cast a spell, but fails."), msa_ptr->m_name);
         return true;
@@ -304,8 +300,7 @@ bool make_attack_spell(PlayerType *player_ptr, MONSTER_IDX m_idx)
         return false;
     }
 
-    if (msa_ptr->m_ptr->mflag.has(MonsterTemporaryFlagType::PREVENT_MAGIC) || !is_hostile(msa_ptr->m_ptr)
-        || ((msa_ptr->m_ptr->cdis > get_max_range(player_ptr)) && !msa_ptr->m_ptr->target_y))
+    if (msa_ptr->m_ptr->mflag.has(MonsterTemporaryFlagType::PREVENT_MAGIC) || !is_hostile(msa_ptr->m_ptr) || ((msa_ptr->m_ptr->cdis > get_max_range(player_ptr)) && !msa_ptr->m_ptr->target_y))
         return false;
 
     decide_lite_range(player_ptr, msa_ptr);
index 6e83c71..8c04987 100644 (file)
@@ -9,8 +9,9 @@
 #include "monster/monster-update.h"
 #include "mspell/mspell-checker.h"
 #include "mspell/mspell-damage-calculator.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
+#include "mspell/mspell-result.h"
 #include "effect/attribute-types.h"
 #include "system/floor-type-definition.h"
 #include "system/monster-type-definition.h"
index 8d4e370..04358cc 100644 (file)
@@ -8,8 +8,9 @@
 #include "monster/monster-update.h"
 #include "mspell/mspell-checker.h"
 #include "mspell/mspell-damage-calculator.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
+#include "mspell/mspell-result.h"
 #include "effect/attribute-types.h"
 #include "system/floor-type-definition.h"
 #include "system/player-type-definition.h"
index 02fef1f..72e1435 100644 (file)
@@ -10,8 +10,9 @@
 #include "monster/monster-update.h"
 #include "mspell/mspell-checker.h"
 #include "mspell/mspell-damage-calculator.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
+#include "mspell/mspell-result.h"
 #include "effect/attribute-types.h"
 #include "system/floor-type-definition.h"
 #include "system/monster-type-definition.h"
@@ -34,7 +35,7 @@ static bool spell_RF4_BREATH_special_message(MONSTER_IDX r_idx, AttributeType GF
         msg_format(_("%^s「ボ帝ビルカッター!!!」", "%^s shouts, 'Boty-Build cutter!!!'"), m_name);
         return true;
     }
-    if (r_idx == MON_RAOU && GF_TYPE == AttributeType::FORCE) {
+    if (r_idx == MON_RAOU && (GF_TYPE == AttributeType::FORCE)) {
         if (one_in_(2))
             msg_format(_("%^s「北斗剛掌波!!」", "%^s says, 'Hokuto Goh-Sho-Ha!!'"), m_name);
         else
index 5f6c773..9cfad78 100644 (file)
@@ -6,8 +6,10 @@
 #include "monster/monster-list.h"
 #include "mspell/mspell-checker.h"
 #include "mspell/mspell-damage-calculator.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
+#include "mspell/mspell-result.h"
+#include "effect/attribute-types.h"
 #include "system/floor-type-definition.h"
 #include "system/player-type-definition.h"
 #include "view/display-messages.h"
index c2b80b3..347b749 100644 (file)
@@ -10,8 +10,8 @@
 #include "monster/monster-info.h"
 #include "monster/monster-status-setter.h"
 #include "monster/monster-status.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
 #include "player-info/race-info.h"
 #include "player/attack-defense-types.h"
 #include "player/player-status.h"
index b13d294..ea76291 100644 (file)
@@ -22,9 +22,9 @@
 #include "monster/monster-status-setter.h"
 #include "monster/monster-status.h"
 #include "monster/monster-update.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-status.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
 #include "player/player-personality-types.h"
 #include "player/player-status-flags.h"
 #include "player/player-status.h"
index 64187fd..10e2f94 100644 (file)
@@ -15,8 +15,9 @@
 #include "monster/monster-update.h"
 #include "mspell/mspell-checker.h"
 #include "mspell/mspell-damage-calculator.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
+#include "mspell/mspell-result.h"
 #include "effect/attribute-types.h"
 #include "system/player-type-definition.h"
 
similarity index 94%
rename from src/mspell/mspell.h
rename to src/mspell/mspell-result.h
index c3318eb..3bf3c75 100644 (file)
@@ -5,7 +5,8 @@
 struct MonsterSpellResult {
 private:
     explicit MonsterSpellResult(const bool valid, const HIT_POINT dam = 0)
-        : valid(valid), dam(dam)
+        : valid(valid)
+        , dam(dam)
     {
     }
 
index e44f792..0f54265 100644 (file)
@@ -24,8 +24,8 @@
 #include "monster/monster-info.h"
 #include "monster/monster-util.h"
 #include "mspell/mspell-checker.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
 #include "player/player-damage.h"
 #include "spell-kind/spells-teleport.h"
 #include "spell-realm/spells-crusade.h"
index 912521f..df6c3fd 100644 (file)
@@ -24,8 +24,8 @@
 #include "monster/monster-update.h"
 #include "mspell/mspell-checker.h"
 #include "mspell/mspell-damage-calculator.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
 #include "player/player-personality-types.h"
 #include "player/player-status-flags.h"
 #include "effect/attribute-types.h"
 #include "view/display-messages.h"
 
 mspell_cast_msg_bad_status_to_player::mspell_cast_msg_bad_status_to_player(concptr blind, concptr not_blind, concptr resist, concptr saved_throw)
-    :   blind(blind)
-    ,   not_blind(not_blind)
-    ,   resist(resist)
-    ,   saved_throw(saved_throw)
-{}
+    : blind(blind)
+    , not_blind(not_blind)
+    , resist(resist)
+    , saved_throw(saved_throw)
+{
+}
 
 mspell_cast_msg_bad_status_to_monster::mspell_cast_msg_bad_status_to_monster(concptr default_msg, concptr resist, concptr saved_throw, concptr success)
-    :   default_msg(default_msg)
-    ,   resist(resist)
-    ,   saved_throw(saved_throw)
-    ,   success(success)
-{}
+    : default_msg(default_msg)
+    , resist(resist)
+    , saved_throw(saved_throw)
+    , success(success)
+{
+}
 
 /*!
  * @brief 状態異常呪文のメッセージ処理関数。 /
@@ -255,7 +257,7 @@ MonsterSpellResult spell_RF5_SCARE(MONSTER_IDX m_idx, PlayerType *player_ptr, MO
     if (TARGET_TYPE == MONSTER_TO_PLAYER) {
         resist = (has_resist_fear(player_ptr) != 0);
         saving_throw = (randint0(100 + rlev / 2) < player_ptr->skill_sav);
-        
+
         mspell_cast_msg_bad_status_to_player msg(_("%^sが何かをつぶやくと、恐ろしげな音が聞こえた。", "%^s mumbles, and you hear scary noises."),
             _("%^sが恐ろしげな幻覚を作り出した。", "%^s casts a fearful illusion."), _("しかし恐怖に侵されなかった。", "You refuse to be frightened."),
             _("しかし恐怖に侵されなかった。", "You refuse to be frightened."));
@@ -279,7 +281,7 @@ MonsterSpellResult spell_RF5_SCARE(MONSTER_IDX m_idx, PlayerType *player_ptr, MO
     mspell_cast_msg_bad_status_to_monster msg(_("%^sが恐ろしげな幻覚を作り出した。", "%^s casts a fearful illusion in front of %s."),
         _("%^sは恐怖を感じない。", "%^s refuses to be frightened."), _("%^sは恐怖を感じない。", "%^s refuses to be frightened."),
         _("%^sは恐怖して逃げ出した!", "%^s flees in terror!"));
-    
+
     spell_badstatus_message_to_mons(player_ptr, m_idx, t_idx, msg, resist, saving_throw);
 
     if (!resist && !saving_throw) {
@@ -315,7 +317,7 @@ MonsterSpellResult spell_RF5_BLIND(MONSTER_IDX m_idx, PlayerType *player_ptr, MO
         mspell_cast_msg_bad_status_to_player msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
             _("%^sが呪文を唱えてあなたの目をくらました!", "%^s casts a spell, burning your eyes!"), _("しかし効果がなかった!", "You are unaffected!"),
             _("しかし効力を跳ね返した!", "You resist the effects!"));
-       
+
         spell_badstatus_message_to_player(player_ptr, m_idx, msg, resist, saving_throw);
 
         if (!resist && !saving_throw) {
@@ -376,12 +378,12 @@ MonsterSpellResult spell_RF5_CONF(MONSTER_IDX m_idx, PlayerType *player_ptr, MON
     if (TARGET_TYPE == MONSTER_TO_PLAYER) {
         resist = (has_resist_conf(player_ptr) != 0);
         saving_throw = (randint0(100 + rlev / 2) < player_ptr->skill_sav);
-        
+
         mspell_cast_msg_bad_status_to_player msg(_("%^sが何かをつぶやくと、頭を悩ます音がした。", "%^s mumbles, and you hear puzzling noises."),
             _("%^sが誘惑的な幻覚を作り出した。", "%^s creates a mesmerising illusion."),
             _("しかし幻覚にはだまされなかった。", "You disbelieve the feeble spell."),
             _("しかし幻覚にはだまされなかった。", "You disbelieve the feeble spell."));
-        
+
         spell_badstatus_message_to_player(player_ptr, m_idx, msg, resist, saving_throw);
 
         if (!resist && !saving_throw) {
@@ -433,11 +435,11 @@ MonsterSpellResult spell_RF5_HOLD(MONSTER_IDX m_idx, PlayerType *player_ptr, MON
     if (TARGET_TYPE == MONSTER_TO_PLAYER) {
         resist = (player_ptr->free_act != 0);
         saving_throw = (randint0(100 + rlev / 2) < player_ptr->skill_sav);
-        
+
         mspell_cast_msg_bad_status_to_player msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
             _("%^sがあなたの目をじっと見つめた!", "%^s stares deep into your eyes!"), _("しかし効果がなかった!", "You are unaffected!"),
             _("しかし効力を跳ね返した!", "You resist the effects!"));
-        
+
         spell_badstatus_message_to_player(player_ptr, m_idx, msg, (bool)resist, saving_throw);
 
         if (!resist && !saving_throw) {
@@ -521,11 +523,11 @@ MonsterSpellResult spell_RF5_SLOW(MONSTER_IDX m_idx, PlayerType *player_ptr, MON
     if (TARGET_TYPE == MONSTER_TO_PLAYER) {
         resist = (has_resist_conf(player_ptr) != 0);
         saving_throw = (randint0(100 + rlev / 2) < player_ptr->skill_sav);
-        
+
         mspell_cast_msg_bad_status_to_player msg(_("%^sがあなたの筋力を吸い取ろうとした!", "%^s drains power from your muscles!"),
             _("%^sがあなたの筋力を吸い取ろうとした!", "%^s drains power from your muscles!"), _("しかし効果がなかった!", "You are unaffected!"),
             _("しかし効力を跳ね返した!", "You resist the effects!"));
-        
+
         spell_badstatus_message_to_player(player_ptr, m_idx, msg, resist, saving_throw);
 
         if (!resist && !saving_throw) {
index 85b68d0..052a040 100644 (file)
@@ -13,8 +13,8 @@
 #include "monster/monster-description-types.h"
 #include "monster/monster-info.h"
 #include "monster/monster-status.h"
+#include "mspell/mspell-result.h"
 #include "mspell/mspell-util.h"
-#include "mspell/mspell.h"
 #include "mspell/specified-summon.h"
 #include "spell-kind/spells-launcher.h"
 #include "effect/attribute-types.h"
@@ -32,6 +32,23 @@ constexpr int S_NUM_6 = 6;
 constexpr int S_NUM_4 = 4;
 
 /*!
+ * @brief モンスターが召喚呪文を使った際にプレイヤーの連続行動を止める処理 /
+ * @param player_ptr プレイヤーへの参照ポインタ
+ * @param target_type プレイヤーを対象とする場合MONSTER_TO_PLAYER、モンスターを対象とする場合MONSTER_TO_MONSTER
+ * @param known モンスターが近くにいる場合TRUE
+ * @param see_either モンスターを視認可能な場合TRUE
+ */
+static void summon_disturb(PlayerType *player_ptr, int target_type, bool known, bool see_either)
+{
+    bool mon_to_mon = target_type == MONSTER_TO_MONSTER;
+    bool mon_to_player = target_type == MONSTER_TO_PLAYER;
+    if (mon_to_player || (mon_to_mon && known && see_either)) {
+        disturb(player_ptr, true, true);
+    }
+}
+
+
+/*!
  * @brief 特定条件のモンスター召喚のみPM_ALLOW_UNIQUEを許可する /
  * @param floor_ptr 現在フロアへの参照ポインタ
  * @param m_idx モンスターID
@@ -84,8 +101,7 @@ static void decide_summon_kin_caster(
         return;
     }
 
-    if (mon_to_player || (mon_to_mon && known && see_either))
-        disturb(player_ptr, true, true);
+    summon_disturb(player_ptr, target_type, known, see_either);
 
     if (player_ptr->blind) {
         if (mon_to_player)
@@ -123,9 +139,12 @@ MonsterSpellResult spell_RF6_S_KIN(PlayerType *player_ptr, POSITION y, POSITION
     monster_name(player_ptr, m_idx, m_name);
     monster_name(player_ptr, t_idx, t_name);
     monster_desc(player_ptr, m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
-
-    disturb(player_ptr, true, true);
+    
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
     bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
+    summon_disturb(player_ptr, target_type, known, see_either);
+
     decide_summon_kin_caster(player_ptr, m_idx, t_idx, target_type, m_name, m_poss, known);
     int count = 0;
     switch (m_ptr->r_idx) {
@@ -213,18 +232,21 @@ MonsterSpellResult spell_RF6_S_KIN(PlayerType *player_ptr, POSITION y, POSITION
  */
 MonsterSpellResult spell_RF6_S_CYBER(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
-    int count = 0;
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
     monster_type *m_ptr = &floor_ptr->m_list[m_idx];
     DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
     bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
     bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
         _("%^sがサイバーデーモンを召喚した!", "%^s magically summons Cyberdemons!"),
         _("%^sがサイバーデーモンを召喚した!", "%^s magically summons Cyberdemons!"));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
+    int count = 0;
     if (is_friendly(m_ptr) && mon_to_mon) {
         count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_CYBER, (PM_ALLOW_GROUP));
     } else {
@@ -256,16 +278,20 @@ MonsterSpellResult spell_RF6_S_CYBER(PlayerType *player_ptr, POSITION y, POSITIO
  */
 MonsterSpellResult spell_RF6_S_MONSTER(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."), _("%^sが魔法で仲間を召喚した!", "%^s magically summons help!"),
         _("%^sが魔法で仲間を召喚した!", "%^s magically summons help!"));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
     int count = 0;
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
-    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
     for (int k = 0; k < 1; k++) {
         if (mon_to_player)
             count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_NONE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
@@ -299,16 +325,20 @@ MonsterSpellResult spell_RF6_S_MONSTER(PlayerType *player_ptr, POSITION y, POSIT
  */
 MonsterSpellResult spell_RF6_S_MONSTERS(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
         _("%^sが魔法でモンスターを召喚した!", "%^s magically summons monsters!"), _("%^sが魔法でモンスターを召喚した!", "%^s magically summons monsters!"));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
     int count = 0;
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
-    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
     for (auto k = 0; k < S_NUM_6; k++) {
         if (mon_to_player)
             count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_NONE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
@@ -342,16 +372,20 @@ MonsterSpellResult spell_RF6_S_MONSTERS(PlayerType *player_ptr, POSITION y, POSI
  */
 MonsterSpellResult spell_RF6_S_ANT(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."), _("%^sが魔法でアリを召喚した。", "%^s magically summons ants."),
         _("%^sが魔法でアリを召喚した。", "%^s magically summons ants."));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
     int count = 0;
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
-    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
     for (auto k = 0; k < S_NUM_6; k++) {
         count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_ANT, PM_ALLOW_GROUP);
     }
@@ -381,16 +415,20 @@ MonsterSpellResult spell_RF6_S_ANT(PlayerType *player_ptr, POSITION y, POSITION
  */
 MonsterSpellResult spell_RF6_S_SPIDER(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."), _("%^sが魔法でクモを召喚した。", "%^s magically summons spiders."),
         _("%^sが魔法でクモを召喚した。", "%^s magically summons spiders."));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
     int count = 0;
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
-    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
     for (auto k = 0; k < S_NUM_6; k++) {
         count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_SPIDER, PM_ALLOW_GROUP);
     }
@@ -420,16 +458,20 @@ MonsterSpellResult spell_RF6_S_SPIDER(PlayerType *player_ptr, POSITION y, POSITI
  */
 MonsterSpellResult spell_RF6_S_HOUND(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
         _("%^sが魔法でハウンドを召喚した。", "%^s magically summons hounds."), _("%^sが魔法でハウンドを召喚した。", "%^s magically summons hounds."));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
     int count = 0;
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
-    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
     for (auto k = 0; k < S_NUM_4; k++) {
         count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_HOUND, PM_ALLOW_GROUP);
     }
@@ -459,16 +501,20 @@ MonsterSpellResult spell_RF6_S_HOUND(PlayerType *player_ptr, POSITION y, POSITIO
  */
 MonsterSpellResult spell_RF6_S_HYDRA(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
         _("%^sが魔法でヒドラを召喚した。", "%^s magically summons hydras."), _("%^sが魔法でヒドラを召喚した。", "%^s magically summons hydras."));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
     int count = 0;
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
-    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
     for (auto k = 0; k < S_NUM_4; k++) {
         count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_HYDRA, PM_ALLOW_GROUP);
     }
@@ -498,12 +544,18 @@ MonsterSpellResult spell_RF6_S_HYDRA(PlayerType *player_ptr, POSITION y, POSITIO
  */
 MonsterSpellResult spell_RF6_S_ANGEL(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
         _("%^sが魔法で天使を召喚した!", "%^s magically summons an angel!"), _("%^sが魔法で天使を召喚した!", "%^s magically summons an angel!"));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
     monster_type *m_ptr = &floor_ptr->m_list[m_idx];
     monster_race *r_ptr = &r_info[m_ptr->r_idx];
     int num = 1;
@@ -511,7 +563,6 @@ MonsterSpellResult spell_RF6_S_ANGEL(PlayerType *player_ptr, POSITION y, POSITIO
         num += r_ptr->level / 40;
     }
 
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
     int count = 0;
     for (int k = 0; k < num; k++) {
         count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_ANGEL, PM_ALLOW_GROUP);
@@ -525,7 +576,6 @@ MonsterSpellResult spell_RF6_S_ANGEL(PlayerType *player_ptr, POSITION y, POSITIO
             msg_print(_("多くのものが間近に現れた音がする。", "You hear many things appear nearby."));
     }
 
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
     if (monster_near_player(floor_ptr, m_idx, t_idx) && !see_monster(player_ptr, t_idx) && count && mon_to_mon)
         floor_ptr->monster_noise = true;
 
@@ -548,14 +598,19 @@ MonsterSpellResult spell_RF6_S_ANGEL(PlayerType *player_ptr, POSITION y, POSITIO
  */
 MonsterSpellResult spell_RF6_S_DEMON(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
         _("%^sは魔法で混沌の宮廷から悪魔を召喚した!", "%^s magically summons a demon from the Courts of Chaos!"),
         _("%^sは魔法で混沌の宮廷から悪魔を召喚した!", "%^s magically summons a demon from the Courts of Chaos!"));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
     int count = 0;
     for (int k = 0; k < 1; k++) {
         count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_DEMON, PM_ALLOW_GROUP);
@@ -564,7 +619,6 @@ MonsterSpellResult spell_RF6_S_DEMON(PlayerType *player_ptr, POSITION y, POSITIO
     if (player_ptr->blind && count)
         msg_print(_("何かが間近に現れた音がする。", "You hear something appear nearby."));
 
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
     if (monster_near_player(floor_ptr, m_idx, t_idx) && !see_monster(player_ptr, t_idx) && count && mon_to_mon)
         floor_ptr->monster_noise = true;
 
@@ -587,14 +641,19 @@ MonsterSpellResult spell_RF6_S_DEMON(PlayerType *player_ptr, POSITION y, POSITIO
  */
 MonsterSpellResult spell_RF6_S_UNDEAD(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
         _("%^sが魔法でアンデッドの強敵を召喚した!", "%^s magically summons an undead adversary!"),
         _("%sが魔法でアンデッドを召喚した。", "%^s magically summons undead."));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
     int count = 0;
     for (int k = 0; k < 1; k++) {
         count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_UNDEAD, PM_ALLOW_GROUP);
@@ -603,7 +662,6 @@ MonsterSpellResult spell_RF6_S_UNDEAD(PlayerType *player_ptr, POSITION y, POSITI
     if (player_ptr->blind && count)
         msg_print(_("何かが間近に現れた音がする。", "You hear something appear nearby."));
 
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
     if (monster_near_player(floor_ptr, m_idx, t_idx) && !see_monster(player_ptr, t_idx) && count && mon_to_mon)
         floor_ptr->monster_noise = true;
 
@@ -626,15 +684,19 @@ MonsterSpellResult spell_RF6_S_UNDEAD(PlayerType *player_ptr, POSITION y, POSITI
  */
 MonsterSpellResult spell_RF6_S_DRAGON(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
         _("%^sが魔法でドラゴンを召喚した!", "%^s magically summons a dragon!"), _("%^sが魔法でドラゴンを召喚した!", "%^s magically summons a dragon!"));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
-    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
     int count = 0;
     if (mon_to_player)
         count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_DRAGON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
@@ -667,15 +729,18 @@ MonsterSpellResult spell_RF6_S_DRAGON(PlayerType *player_ptr, POSITION y, POSITI
  */
 MonsterSpellResult spell_RF6_S_HI_UNDEAD(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
-    GAME_TEXT m_name[MAX_NLEN];
-    monster_name(player_ptr, m_idx, m_name);
-
-    disturb(player_ptr, true, true);
-
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
     monster_type *m_ptr = &floor_ptr->m_list[m_idx];
-    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
     bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
+    GAME_TEXT m_name[MAX_NLEN];
+    monster_name(player_ptr, m_idx, m_name);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
+
     int count = 0;
     if (((m_ptr->r_idx == MON_MORGOTH) || (m_ptr->r_idx == MON_SAURON) || (m_ptr->r_idx == MON_ANGMAR)) && ((r_info[MON_NAZGUL].cur_num + 2) < r_info[MON_NAZGUL].max_num) && mon_to_player) {
         count += summon_NAZGUL(player_ptr, y, x, m_idx);
@@ -686,7 +751,6 @@ MonsterSpellResult spell_RF6_S_HI_UNDEAD(PlayerType *player_ptr, POSITION y, POS
 
         monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
 
-        DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
         for (auto k = 0; k < S_NUM_6; k++) {
             if (mon_to_player)
                 count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_HI_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
@@ -722,16 +786,20 @@ MonsterSpellResult spell_RF6_S_HI_UNDEAD(PlayerType *player_ptr, POSITION y, POS
  */
 MonsterSpellResult spell_RF6_S_HI_DRAGON(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
         _("%^sが魔法で古代ドラゴンを召喚した!", "%^s magically summons ancient dragons!"),
         _("%^sが魔法で古代ドラゴンを召喚した!", "%^s magically summons ancient dragons!"));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
-    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
     int count = 0;
     for (auto k = 0; k < S_NUM_4; k++) {
         if (mon_to_player)
@@ -767,17 +835,21 @@ MonsterSpellResult spell_RF6_S_HI_DRAGON(PlayerType *player_ptr, POSITION y, POS
  */
 MonsterSpellResult spell_RF6_S_AMBERITES(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
         _("%^sがアンバーの王族を召喚した!", "%^s magically summons Lords of Amber!"),
         _("%^sがアンバーの王族を召喚した!", "%^s magically summons Lords of Amber!"));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
     int count = 0;
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
-    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
     for (auto k = 0; k < S_NUM_4; k++) {
         count += summon_specific(player_ptr, m_idx, y, x, rlev, SUMMON_AMBERITES, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
     }
@@ -808,17 +880,21 @@ MonsterSpellResult spell_RF6_S_AMBERITES(PlayerType *player_ptr, POSITION y, POS
  */
 MonsterSpellResult spell_RF6_S_UNIQUE(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
 {
+    floor_type *floor_ptr = player_ptr->current_floor_ptr;
+    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
+    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
+    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
+    bool see_either = see_monster(player_ptr, m_idx) || see_monster(player_ptr, t_idx);
+    bool known = monster_near_player(floor_ptr, m_idx, t_idx);
+
     mspell_cast_msg_blind msg(_("%^sが何かをつぶやいた。", "%^s mumbles."),
         _("%^sが魔法で特別な強敵を召喚した!", "%^s magically summons special opponents!"),
         _("%^sが魔法で特別な強敵を召喚した!", "%^s magically summons special opponents!"));
 
     monspell_message(player_ptr, m_idx, t_idx, msg, TARGET_TYPE);
+    summon_disturb(player_ptr, TARGET_TYPE, known, see_either);
 
-    floor_type *floor_ptr = player_ptr->current_floor_ptr;
     monster_type *m_ptr = &floor_ptr->m_list[m_idx];
-    DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
-    bool mon_to_mon = (TARGET_TYPE == MONSTER_TO_MONSTER);
-    bool mon_to_player = (TARGET_TYPE == MONSTER_TO_PLAYER);
     bool uniques_are_summoned = false;
     int count = 0;
     for (auto k = 0; k < S_NUM_4; k++) {
index 8baec63..0b736eb 100644 (file)
@@ -7,6 +7,7 @@
 #include "object/object-stack.h"
 #include "game-option/game-play-options.h"
 #include "object-enchant/object-ego.h"
+#include "object-enchant/object-smith.h"
 #include "object-enchant/special-object-flags.h"
 #include "object-enchant/trc-types.h"
 #include "object/object-kind.h"
@@ -177,6 +178,10 @@ int object_similar_part(const object_type *o_ptr, const object_type *j_ptr)
             return 0;
         if (o_ptr->ds != j_ptr->ds)
             return 0;
+        if (Smith::object_effect(o_ptr) != Smith::object_effect(j_ptr))
+            return 0;
+        if (Smith::object_activation(o_ptr) != Smith::object_activation(j_ptr))
+            return 0;
         break;
     }
     default: {
index 650f767..87d9a22 100644 (file)
@@ -45,6 +45,7 @@
 #include "system/player-type-definition.h"
 #include "target/target-checker.h"
 #include "util/bit-flags-calculator.h"
+#include "util/enum-converter.h"
 #include "view/display-messages.h"
 
 int flow_head = 0;
@@ -277,42 +278,44 @@ bool trap_can_be_ignored(PlayerType *player_ptr, FEAT_IDX feat)
     if (f_ptr->flags.has_not(FloorFeatureType::TRAP))
         return true;
 
-    switch (f_ptr->subtype) {
-    case TRAP_TRAPDOOR:
-    case TRAP_PIT:
-    case TRAP_SPIKED_PIT:
-    case TRAP_POISON_PIT:
+    switch (i2enum<TrapType>(f_ptr->subtype)) {
+    case TrapType::TRAPDOOR:
+    case TrapType::PIT:
+    case TrapType::SPIKED_PIT:
+    case TrapType::POISON_PIT:
         if (player_ptr->levitation)
             return true;
         break;
-    case TRAP_TELEPORT:
+    case TrapType::TELEPORT:
         if (player_ptr->anti_tele)
             return true;
         break;
-    case TRAP_FIRE:
+    case TrapType::FIRE:
         if (has_immune_fire(player_ptr))
             return true;
         break;
-    case TRAP_ACID:
+    case TrapType::ACID:
         if (has_immune_acid(player_ptr))
             return true;
         break;
-    case TRAP_BLIND:
+    case TrapType::BLIND:
         if (has_resist_blind(player_ptr))
             return true;
         break;
-    case TRAP_CONFUSE:
+    case TrapType::CONFUSE:
         if (has_resist_conf(player_ptr))
             return true;
         break;
-    case TRAP_POISON:
+    case TrapType::POISON:
         if (has_resist_pois(player_ptr))
             return true;
         break;
-    case TRAP_SLEEP:
+    case TrapType::SLEEP:
         if (player_ptr->free_act)
             return true;
         break;
+    default:
+        break;
     }
 
     return false;
index 288202d..945744f 100644 (file)
@@ -1,4 +1,5 @@
 #include "store/store-owners.h"
+#include "store/store-util.h"
 #include "player-info/race-types.h"
 
 /*!
index 7292133..0e5d884 100644 (file)
@@ -1,10 +1,10 @@
 #pragma once
 
 #include "player-info/race-types.h"
+#include "store/store-util.h"
 #include "system/angband.h"
 #include <array>
 
-#define MAX_STORES 10 /*!< 店舗の種類最大数 / Total number of stores (see "store.c", etc) */
 #define MAX_OWNERS 32 /*!< 各店舗毎の店主定義最大数 / Total number of owners per store (see "store.c", etc) */
 
 /*!
index 261ca9a..6d40536 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "system/angband.h"
 
+#include "util/enum-converter.h"
 #include "util/enum-range.h"
 
 #include <memory>
@@ -20,8 +21,9 @@ enum class StoreSaleType {
     HOME      = 7, //!< 店舗の種類: 我が家
     BOOK      = 8, //!< 店舗の種類: 書店
     MUSEUM    = 9, //!< 店舗の種類: 博物館
-    MAX       = 10
+    MAX
 };
+constexpr int MAX_STORES = enum2i(StoreSaleType::MAX); /*!< 店舗の種類最大数 / Total number of stores (see "store.c", etc) */
 
 constexpr auto STORE_SALE_TYPE_LIST = EnumRange(StoreSaleType::GENERAL, StoreSaleType::MUSEUM);
 
index 235c4bd..b733a90 100644 (file)
@@ -57,6 +57,7 @@ typedef int errr;
 #define MAX_SHORT 32767 /*!< Maximum value storable in a "int16_t" (hard-coded) */
 
 #define MAX_NLEN 160 /*!< Maximum length of object's name */
+#define MAX_INSCRIPTION _(76, 69) /*!< Maximum length of object's inscription */
 #define MAX_MONSTER_NAME 160 /*!< モンスター名称の最大バイト数 / Max characters of monster's name */
 
 /*!
index 09ca467..88f9551 100644 (file)
@@ -21,7 +21,7 @@ void display_short_flavors(flavor_type *flavor_ptr)
     if (flavor_ptr->o_ptr->inscription == 0)
         return;
 
-    char buff[1024];
+    char buff[1024] = "";
     if (flavor_ptr->tmp_val2[0])
         strcat(flavor_ptr->tmp_val2, ", ");