OSDN Git Service

[Refactor] #4169 TimedEffects::PlayerHallucination をshared_ptr から普通のクラスに差し替えた
authorHourier <66951241+Hourier@users.noreply.github.com>
Tue, 28 May 2024 12:02:26 +0000 (21:02 +0900)
committerHourier <66951241+Hourier@users.noreply.github.com>
Tue, 28 May 2024 13:45:01 +0000 (22:45 +0900)
45 files changed:
src/action/action-limited.cpp
src/action/movement-execution.cpp
src/action/open-close-execution.cpp
src/blue-magic/blue-magic-checker.cpp
src/cmd-action/cmd-attack.cpp
src/cmd-action/cmd-open-close.cpp
src/cmd-action/cmd-pet.cpp
src/cmd-io/cmd-dump.cpp
src/combat/shoot.cpp
src/core/magic-effects-timeout-reducer.cpp
src/core/player-processor.cpp
src/effect/effect-processor.cpp
src/floor/pattern-walk.cpp
src/load/player-info-loader.cpp
src/melee/melee-util.cpp
src/mind/mind-ninja.cpp
src/monster-attack/monster-attack-player.cpp
src/monster-floor/monster-death.cpp
src/monster/monster-damage.cpp
src/monster/monster-describer.cpp
src/monster/monster-info.cpp
src/monster/monster-status.cpp
src/monster/monster-update.cpp
src/object-use/throw-execution.cpp
src/player-info/self-info.cpp
src/player/eldritch-horror.cpp
src/player/player-damage.cpp
src/player/player-move.cpp
src/save/player-writer.cpp
src/spell-class/spells-mirror-master.cpp
src/spell-kind/spells-fetcher.cpp
src/status/bad-status-setter.cpp
src/status/buff-setter.cpp
src/system/player-type-definition.cpp
src/target/grid-selector.cpp
src/target/target-describer.cpp
src/target/target-preparation.cpp
src/timed-effect/player-hallucination.h
src/timed-effect/timed-effects.cpp
src/timed-effect/timed-effects.h
src/view/display-map.cpp
src/window/display-sub-windows.cpp
src/window/main-window-left-frame.cpp
src/window/main-window-stat-poster.cpp
src/window/main-window-util.cpp

index 41a18f1..abd5887 100644 (file)
@@ -15,7 +15,6 @@
 #include "system/floor-type-definition.h"
 #include "system/player-type-definition.h"
 #include "term/screen-processor.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-stun.h"
 #include "timed-effect/timed-effects.h"
 #include "view/display-messages.h"
@@ -58,7 +57,7 @@ bool cmd_limit_confused(PlayerType *player_ptr)
 
 bool cmd_limit_image(PlayerType *player_ptr)
 {
-    if (player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (player_ptr->effects()->hallucination().is_hallucinated()) {
         msg_print(_("幻覚が見えて集中できない!", "Your hallucinations prevent you from concentrating!"));
         return true;
     }
index 7f9c774..4bc2caf 100644 (file)
@@ -41,7 +41,6 @@
 #include "system/player-type-definition.h"
 #include "system/redrawing-flags-updater.h"
 #include "system/terrain-type-definition.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-stun.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
@@ -165,10 +164,10 @@ void exe_movement(PlayerType *player_ptr, DIRECTION dir, bool do_pickup, bool br
     bool do_past = false;
     if (grid.has_monster() && (m_ptr->ml || p_can_enter || p_can_kill_walls)) {
         auto *r_ptr = &m_ptr->get_monrace();
-        auto effects = player_ptr->effects();
-        auto is_stunned = effects->stun()->is_stunned();
+        const auto effects = player_ptr->effects();
+        const auto is_stunned = effects->stun()->is_stunned();
         auto can_cast = !effects->confusion().is_confused();
-        auto is_hallucinated = effects->hallucination()->is_hallucinated();
+        const auto is_hallucinated = effects->hallucination().is_hallucinated();
         can_cast &= !is_hallucinated;
         can_cast &= m_ptr->ml;
         can_cast &= !is_stunned;
@@ -281,10 +280,10 @@ void exe_movement(PlayerType *player_ptr, DIRECTION dir, bool do_pickup, bool br
                 lite_spot(player_ptr, pos.y, pos.x);
             }
         } else {
-            auto effects = player_ptr->effects();
-            auto is_confused = effects->confusion().is_confused();
-            auto is_stunned = effects->stun()->is_stunned();
-            auto is_hallucinated = effects->hallucination()->is_hallucinated();
+            const auto effects = player_ptr->effects();
+            const auto is_confused = effects->confusion().is_confused();
+            const auto is_stunned = effects->stun()->is_stunned();
+            const auto is_hallucinated = effects->hallucination().is_hallucinated();
             if (boundary_floor(grid, terrain, terrain_mimic)) {
                 msg_print(_("それ以上先には進めない。", "You cannot go any more."));
                 if (!(is_confused || is_stunned || is_hallucinated)) {
@@ -313,10 +312,10 @@ void exe_movement(PlayerType *player_ptr, DIRECTION dir, bool do_pickup, bool br
     }
 
     if (can_move && !pattern_seq(player_ptr, pos)) {
-        auto effects = player_ptr->effects();
-        auto is_confused = effects->confusion().is_confused();
-        auto is_stunned = effects->stun()->is_stunned();
-        auto is_hallucinated = effects->hallucination()->is_hallucinated();
+        const auto effects = player_ptr->effects();
+        const auto is_confused = effects->confusion().is_confused();
+        const auto is_stunned = effects->stun()->is_stunned();
+        const auto is_hallucinated = effects->hallucination().is_hallucinated();
         if (!(is_confused || is_stunned || is_hallucinated)) {
             energy.reset_player_turn();
         }
index c72b6b0..ca21eae 100644 (file)
@@ -28,7 +28,6 @@
 #include "system/player-type-definition.h"
 #include "system/terrain-type-definition.h"
 #include "term/screen-processor.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
@@ -64,7 +63,7 @@ bool exe_open(PlayerType *player_ptr, POSITION y, POSITION x)
         i = i / 10;
     }
 
-    if (effects->confusion().is_confused() || effects->hallucination()->is_hallucinated()) {
+    if (effects->confusion().is_confused() || effects->hallucination().is_hallucinated()) {
         i = i / 10;
     }
 
@@ -165,7 +164,7 @@ bool easy_open_door(PlayerType *player_ptr, POSITION y, POSITION x)
             power_disarm = power_disarm / 10;
         }
 
-        if (effects->confusion().is_confused() || effects->hallucination()->is_hallucinated()) {
+        if (effects->confusion().is_confused() || effects->hallucination().is_hallucinated()) {
             power_disarm = power_disarm / 10;
         }
 
@@ -220,7 +219,7 @@ bool exe_disarm_chest(PlayerType *player_ptr, POSITION y, POSITION x, OBJECT_IDX
         i = i / 10;
     }
 
-    if (effects->confusion().is_confused() || effects->hallucination()->is_hallucinated()) {
+    if (effects->confusion().is_confused() || effects->hallucination().is_hallucinated()) {
         i = i / 10;
     }
 
@@ -285,7 +284,7 @@ bool exe_disarm(PlayerType *player_ptr, POSITION y, POSITION x, DIRECTION dir)
         i = i / 10;
     }
 
-    if (effects->confusion().is_confused() || effects->hallucination()->is_hallucinated()) {
+    if (effects->confusion().is_confused() || effects->hallucination().is_hallucinated()) {
         i = i / 10;
     }
 
index 1bbc7dc..0bbbe63 100644 (file)
@@ -22,7 +22,6 @@
 #include "system/angband.h"
 #include "system/player-type-definition.h"
 #include "system/redrawing-flags-updater.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/player-stun.h"
 #include "timed-effect/timed-effects.h"
@@ -47,7 +46,7 @@ void learn_spell(PlayerType *player_ptr, MonsterAbilityType monspell)
     const auto is_confused = effects->confusion().is_confused();
     const auto is_blind = effects->blindness().is_blind();
     const auto is_stunned = effects->stun()->is_stunned();
-    const auto is_hallucinated = effects->hallucination()->is_hallucinated();
+    const auto is_hallucinated = effects->hallucination().is_hallucinated();
     const auto is_paralyzed = effects->paralysis()->is_paralyzed();
     if (is_confused || is_blind || is_hallucinated || is_stunned || is_paralyzed) {
         return;
index 782ab83..204e719 100644 (file)
@@ -47,7 +47,6 @@
 #include "system/monster-entity.h"
 #include "system/monster-race-info.h"
 #include "system/player-type-definition.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-stun.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
@@ -189,8 +188,8 @@ bool do_cmd_attack(PlayerType *player_ptr, POSITION y, POSITION x, combat_option
     }
 
     const auto m_name = monster_desc(player_ptr, m_ptr, 0);
-    auto effects = player_ptr->effects();
-    auto is_hallucinated = effects->hallucination()->is_hallucinated();
+    const auto effects = player_ptr->effects();
+    const auto is_hallucinated = effects->hallucination().is_hallucinated();
     if (m_ptr->ml) {
         if (!is_hallucinated) {
             monster_race_track(player_ptr, m_ptr->ap_r_idx);
@@ -199,8 +198,8 @@ bool do_cmd_attack(PlayerType *player_ptr, POSITION y, POSITION x, combat_option
         health_track(player_ptr, g_ptr->m_idx);
     }
 
-    auto is_confused = effects->confusion().is_confused();
-    auto is_stunned = effects->stun()->is_stunned();
+    const auto is_confused = effects->confusion().is_confused();
+    const auto is_stunned = effects->stun()->is_stunned();
     if (is_female(*r_ptr) && !(is_stunned || is_confused || is_hallucinated || !m_ptr->ml)) {
         // @todo 「特定の武器を装備している」旨のメソッドを別途作る
         constexpr auto zantetsu = FixedArtifactId::ZANTETSU;
index 09ef2ab..79a71e3 100644 (file)
@@ -28,7 +28,6 @@
 #include "system/terrain-type-definition.h"
 #include "target/target-getter.h"
 #include "term/screen-processor.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
@@ -57,7 +56,7 @@ static bool exe_open_chest(PlayerType *player_ptr, const Pos2D &pos, OBJECT_IDX
             i = i / 10;
         }
 
-        if (effects->confusion().is_confused() || effects->hallucination()->is_hallucinated()) {
+        if (effects->confusion().is_confused() || effects->hallucination().is_hallucinated()) {
             i = i / 10;
         }
 
index b0706ed..4f4b0b7 100644 (file)
@@ -57,7 +57,6 @@
 #include "target/target-setter.h"
 #include "target/target-types.h"
 #include "term/screen-processor.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "util/int-char-converter.h"
@@ -382,12 +381,12 @@ void do_cmd_pet(PlayerType *player_ptr)
     power_desc[num] = _("ペットを放す", "dismiss pets");
     powers[num++] = PET_DISMISS;
 
-    auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
-    auto taget_of_pet = player_ptr->current_floor_ptr->m_list[player_ptr->pet_t_m_idx].get_appearance_monrace().name.data();
-    auto target_of_pet_appearance = is_hallucinated ? _("何か奇妙な物", "something strange") : taget_of_pet;
-    auto mes = _("ペットのターゲットを指定 (現在:%s)", "specify a target of pet (now:%s)");
-    auto target_name = player_ptr->pet_t_m_idx > 0 ? target_of_pet_appearance : _("指定なし", "nothing");
-    auto target_ask = format(mes, target_name);
+    const auto is_hallucinated = player_ptr->effects()->hallucination().is_hallucinated();
+    const auto taget_of_pet = player_ptr->current_floor_ptr->m_list[player_ptr->pet_t_m_idx].get_appearance_monrace().name.data();
+    const auto target_of_pet_appearance = is_hallucinated ? _("何か奇妙な物", "something strange") : taget_of_pet;
+    const auto mes = _("ペットのターゲットを指定 (現在:%s)", "specify a target of pet (now:%s)");
+    const auto target_name = player_ptr->pet_t_m_idx > 0 ? target_of_pet_appearance : _("指定なし", "nothing");
+    const auto target_ask = format(mes, target_name);
     power_desc[num] = target_ask;
     powers[num++] = PET_TARGET;
     power_desc[num] = _("近くにいろ", "stay close");
index b88e260..fd59f7a 100644 (file)
@@ -33,7 +33,6 @@
 #include "term/gameterm.h"
 #include "term/screen-processor.h"
 #include "term/term-color-types.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/angband-files.h"
 #include "util/int-char-converter.h"
@@ -277,7 +276,7 @@ void do_cmd_time(PlayerType *player_ptr)
     constexpr auto mes = _("%s日目, 時刻は%d:%02d %sです。", "This is day %s. The time is %d:%02d %s.");
     msg_format(mes, day_buf.data(), (hour % 12 == 0) ? 12 : (hour % 12), min, (hour < 12) ? "AM" : "PM");
     std::filesystem::path path;
-    if (!randint0(10) || player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (!randint0(10) || player_ptr->effects()->hallucination().is_hallucinated()) {
         path = path_build(ANGBAND_DIR_FILE, _("timefun_j.txt", "timefun.txt"));
     } else {
         path = path_build(ANGBAND_DIR_FILE, _("timenorm_j.txt", "timenorm.txt"));
index ba4ceef..fe81508 100644 (file)
@@ -60,7 +60,6 @@
 #include "target/projection-path-calculator.h"
 #include "target/target-checker.h"
 #include "target/target-getter.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
@@ -765,7 +764,7 @@ void exe_fire(PlayerType *player_ptr, INVENTORY_IDX i_idx, ItemEntity *j_ptr, SP
                         msg_format(_("%sが%sに命中した。", "The %s hits %s."), item_name.data(), m_name.data());
 
                         if (m_ptr->ml) {
-                            if (!player_ptr->effects()->hallucination()->is_hallucinated()) {
+                            if (!player_ptr->effects()->hallucination().is_hallucinated()) {
                                 monster_race_track(player_ptr, m_ptr->ap_r_idx);
                             }
 
index e0d772c..d65c28e 100644 (file)
@@ -19,7 +19,6 @@
 #include "system/player-type-definition.h"
 #include "timed-effect/player-acceleration.h"
 #include "timed-effect/player-deceleration.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/player-poison.h"
 #include "timed-effect/player-stun.h"
@@ -37,7 +36,7 @@ void reduce_magic_effects_timeout(PlayerType *player_ptr)
 
     BadStatusSetter bss(player_ptr);
     const auto effects = player_ptr->effects();
-    if (effects->hallucination()->is_hallucinated()) {
+    if (effects->hallucination().is_hallucinated()) {
         (void)bss.mod_hallucination(-1);
     }
 
index 5137b20..8d5316a 100644 (file)
@@ -56,7 +56,6 @@
 #include "system/redrawing-flags-updater.h"
 #include "term/screen-processor.h"
 #include "timed-effect/player-cut.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/player-stun.h"
 #include "timed-effect/timed-effects.h"
@@ -330,7 +329,7 @@ void process_player(PlayerType *player_ptr)
                 player_ptr->energy_need += (int16_t)((int32_t)player_ptr->energy_use * ENERGY_NEED() / 100L);
             }
 
-            if (effects->hallucination()->is_hallucinated()) {
+            if (effects->hallucination().is_hallucinated()) {
                 rfu.set_flag(MainWindowRedrawingFlag::MAP);
             }
 
index 6711897..2b5c459 100644 (file)
@@ -35,7 +35,6 @@
 #include "system/monster-race-info.h"
 #include "system/player-type-definition.h"
 #include "target/projection-path-calculator.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
@@ -485,7 +484,7 @@ ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX src_idx, POSITIO
             if (grid.has_monster()) {
                 auto &monster = floor.m_list[grid.m_idx];
                 if (monster.ml) {
-                    if (!player_ptr->effects()->hallucination()->is_hallucinated()) {
+                    if (!player_ptr->effects()->hallucination().is_hallucinated()) {
                         monster_race_track(player_ptr, monster.ap_r_idx);
                     }
 
index 857fae9..35d40c6 100644 (file)
@@ -25,7 +25,6 @@
 #include "system/player-type-definition.h"
 #include "system/terrain-type-definition.h"
 #include "term/z-form.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-stun.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
@@ -187,7 +186,7 @@ bool pattern_seq(PlayerType *player_ptr, const Pos2D &pos)
         const auto effects = player_ptr->effects();
         const auto is_stunned = effects->stun()->is_stunned();
         const auto is_confused = effects->confusion().is_confused();
-        const auto is_hallucinated = effects->hallucination()->is_hallucinated();
+        const auto is_hallucinated = effects->hallucination().is_hallucinated();
         if (is_pattern_tile_cur || is_confused || is_stunned || is_hallucinated) {
             return true;
         }
index b3d8b7c..e3e94f6 100644 (file)
@@ -26,7 +26,6 @@
 #include "system/player-type-definition.h"
 #include "timed-effect/player-acceleration.h"
 #include "timed-effect/player-deceleration.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/player-poison.h"
 #include "timed-effect/player-stun.h"
@@ -369,7 +368,7 @@ static void rd_status(PlayerType *player_ptr)
     effects->cut().set(rd_s16b());
     effects->stun()->set(rd_s16b());
     effects->poison()->set(rd_s16b());
-    effects->hallucination()->set(rd_s16b());
+    effects->hallucination().set(rd_s16b());
     player_ptr->protevil = rd_s16b();
     player_ptr->invuln = rd_s16b();
     if (h_older_than(0, 0, 0)) {
index 5e9509a..597d269 100644 (file)
@@ -7,7 +7,6 @@
 #include "system/monster-entity.h"
 #include "system/monster-race-info.h"
 #include "system/player-type-definition.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 
 mam_type *initialize_mam_type(PlayerType *player_ptr, mam_type *mam_ptr, MONSTER_IDX m_idx, MONSTER_IDX t_idx)
@@ -31,7 +30,7 @@ mam_type *initialize_mam_type(PlayerType *player_ptr, mam_type *mam_ptr, MONSTER
     mam_ptr->ac = tr_ptr->ac;
     mam_ptr->rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
     mam_ptr->blinked = false;
-    mam_ptr->do_silly_attack = (one_in_(2) && player_ptr->effects()->hallucination()->is_hallucinated());
+    mam_ptr->do_silly_attack = (one_in_(2) && player_ptr->effects()->hallucination().is_hallucinated());
     mam_ptr->power = 0;
     mam_ptr->obvious = false;
     mam_ptr->known = (mam_ptr->m_ptr->cdis <= MAX_PLAYER_SIGHT) || (mam_ptr->t_ptr->cdis <= MAX_PLAYER_SIGHT);
index 009e47a..5d781da 100644 (file)
@@ -56,7 +56,6 @@
 #include "target/projection-path-calculator.h"
 #include "target/target-checker.h"
 #include "target/target-getter.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/player-stun.h"
 #include "timed-effect/timed-effects.h"
@@ -83,7 +82,7 @@ bool kawarimi(PlayerType *player_ptr, bool success)
     const auto effects = player_ptr->effects();
     const auto is_confused = effects->confusion().is_confused();
     const auto is_blind = effects->blindness().is_blind();
-    const auto is_hallucinated = effects->hallucination()->is_hallucinated();
+    const auto is_hallucinated = effects->hallucination().is_hallucinated();
     const auto is_paralyzed = effects->paralysis()->is_paralyzed();
     if (is_confused || is_blind || is_paralyzed || is_hallucinated) {
         return false;
index 469ba57..6f9f370 100644 (file)
@@ -51,7 +51,6 @@
 #include "system/monster-race-info.h"
 #include "system/player-type-definition.h"
 #include "system/redrawing-flags-updater.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-stun.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
@@ -68,7 +67,7 @@ MonsterAttackPlayer::MonsterAttackPlayer(PlayerType *player_ptr, short m_idx)
     , m_ptr(&player_ptr->current_floor_ptr->m_list[m_idx])
     , method(RaceBlowMethodType::NONE)
     , effect(RaceBlowEffectType::NONE)
-    , do_silly_attack(one_in_(2) && player_ptr->effects()->hallucination()->is_hallucinated())
+    , do_silly_attack(one_in_(2) && player_ptr->effects()->hallucination().is_hallucinated())
     , player_ptr(player_ptr)
 {
 }
index ebc246d..9e549e0 100644 (file)
@@ -42,7 +42,6 @@
 #include "system/player-type-definition.h"
 #include "system/redrawing-flags-updater.h"
 #include "system/system-variables.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
@@ -308,7 +307,8 @@ static void drop_items_golds(PlayerType *player_ptr, MonsterDeath *md_ptr, int d
     auto *floor_ptr = player_ptr->current_floor_ptr;
     floor_ptr->object_level = floor_ptr->base_level;
     coin_type = 0;
-    bool visible = (md_ptr->m_ptr->ml && !player_ptr->effects()->hallucination()->is_hallucinated()) || (md_ptr->r_ptr->kind_flags.has(MonsterKindType::UNIQUE));
+    auto visible = md_ptr->m_ptr->ml && !player_ptr->effects()->hallucination().is_hallucinated();
+    visible |= (md_ptr->r_ptr->kind_flags.has(MonsterKindType::UNIQUE));
     if (visible && (dump_item || dump_gold)) {
         lore_treasure(player_ptr, md_ptr->m_idx, dump_item, dump_gold);
     }
index bf3262b..2b02a44 100644 (file)
@@ -38,7 +38,6 @@
 #include "system/monster-race-info.h"
 #include "system/player-type-definition.h"
 #include "system/redrawing-flags-updater.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
@@ -225,7 +224,7 @@ void MonsterDamageProcessor::increase_kill_numbers()
 {
     auto *m_ptr = &this->player_ptr->current_floor_ptr->m_list[this->m_idx];
     auto &r_ref = m_ptr->get_real_monrace();
-    auto is_hallucinated = this->player_ptr->effects()->hallucination()->is_hallucinated();
+    auto is_hallucinated = this->player_ptr->effects()->hallucination().is_hallucinated();
     if (((m_ptr->ml == 0) || is_hallucinated) && r_ref.kind_flags.has_not(MonsterKindType::UNIQUE)) {
         return;
     }
index 0c56e59..0113209 100644 (file)
@@ -11,7 +11,6 @@
 #include "system/monster-entity.h"
 #include "system/monster-race-info.h"
 #include "system/player-type-definition.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "util/string-processor.h"
@@ -169,7 +168,7 @@ static std::string replace_monster_name_undefined(std::string_view name)
 static std::optional<std::string> get_fake_monster_name(const PlayerType &player, const MonsterEntity &monster, const std::string &name, const BIT_FLAGS mode)
 {
     const auto &monrace = monster.get_appearance_monrace();
-    const auto is_hallucinated = player.effects()->hallucination()->is_hallucinated();
+    const auto is_hallucinated = player.effects()->hallucination().is_hallucinated();
     if (monrace.kind_flags.has_not(MonsterKindType::UNIQUE) || (is_hallucinated && none_bits(mode, MD_IGNORE_HALLU))) {
         return std::nullopt;
     }
@@ -248,7 +247,7 @@ std::string monster_desc(PlayerType *player_ptr, const MonsterEntity *m_ptr, BIT
         return *pronoun_self;
     }
 
-    const auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
+    const auto is_hallucinated = player_ptr->effects()->hallucination().is_hallucinated();
     const auto name = get_describing_monster_name(*m_ptr, is_hallucinated, mode);
     std::stringstream ss;
     if (m_ptr->is_pet() && !m_ptr->is_original_ap()) {
index 17b69a2..5eb7de6 100644 (file)
@@ -27,7 +27,6 @@
 #include "system/monster-race-info.h"
 #include "system/player-type-definition.h"
 #include "system/terrain-type-definition.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "util/string-processor.h"
@@ -197,7 +196,7 @@ bool monster_has_hostile_align(PlayerType *player_ptr, MonsterEntity *m_ptr, int
 
 bool is_original_ap_and_seen(PlayerType *player_ptr, const MonsterEntity *m_ptr)
 {
-    return m_ptr->ml && !player_ptr->effects()->hallucination()->is_hallucinated() && m_ptr->is_original_ap();
+    return m_ptr->ml && !player_ptr->effects()->hallucination().is_hallucinated() && m_ptr->is_original_ap();
 }
 
 /*!
index 528a0a6..a406143 100644 (file)
@@ -20,7 +20,6 @@
 #include "system/monster-race-info.h"
 #include "system/player-type-definition.h"
 #include "system/redrawing-flags-updater.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
@@ -485,7 +484,7 @@ void monster_gain_exp(PlayerType *player_ptr, MONSTER_IDX m_idx, MonsterRaceId s
 
     m_ptr->exp = 0;
     if (m_ptr->is_pet() || m_ptr->ml) {
-        auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
+        const auto is_hallucinated = player_ptr->effects()->hallucination().is_hallucinated();
         if (!ignore_unview || player_can_see_bold(player_ptr, m_ptr->fy, m_ptr->fx)) {
             if (is_hallucinated) {
                 MonsterRaceInfo *hallucinated_race = nullptr;
index 780971c..83b13be 100644 (file)
@@ -38,7 +38,6 @@
 #include "system/player-type-definition.h"
 #include "system/redrawing-flags-updater.h"
 #include "target/projection-path-calculator.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "world/world.h"
@@ -256,7 +255,7 @@ static bool update_weird_telepathy(PlayerType *player_ptr, um_type *um_ptr, MONS
 
     um_ptr->flag = true;
     m_ptr->mflag.set(MonsterTemporaryFlagType::ESP);
-    if (m_ptr->is_original_ap() && !player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (m_ptr->is_original_ap() && !player_ptr->effects()->hallucination().is_hallucinated()) {
         r_ptr->r_misc_flags.set(MonsterMiscType::WEIRD_MIND);
         update_smart_stupid_flags(r_ptr);
     }
@@ -268,10 +267,11 @@ static void update_telepathy_sight(PlayerType *player_ptr, um_type *um_ptr, MONS
 {
     auto *m_ptr = um_ptr->m_ptr;
     auto *r_ptr = &m_ptr->get_monrace();
+    const auto is_hallucinated = player_ptr->effects()->hallucination().is_hallucinated();
     if (PlayerClass(player_ptr).samurai_stance_is(SamuraiStanceType::MUSOU)) {
         um_ptr->flag = true;
         um_ptr->m_ptr->mflag.set(MonsterTemporaryFlagType::ESP);
-        if (um_ptr->m_ptr->is_original_ap() && !player_ptr->effects()->hallucination()->is_hallucinated()) {
+        if (um_ptr->m_ptr->is_original_ap() && !is_hallucinated) {
             update_smart_stupid_flags(r_ptr);
         }
 
@@ -282,7 +282,6 @@ static void update_telepathy_sight(PlayerType *player_ptr, um_type *um_ptr, MONS
         return;
     }
 
-    auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
     if (r_ptr->misc_flags.has(MonsterMiscType::EMPTY_MIND)) {
         if (m_ptr->is_original_ap() && !is_hallucinated) {
             r_ptr->r_misc_flags.set(MonsterMiscType::EMPTY_MIND);
@@ -306,7 +305,7 @@ static void update_specific_race_telepathy(PlayerType *player_ptr, um_type *um_p
 {
     auto *m_ptr = um_ptr->m_ptr;
     auto *r_ptr = &m_ptr->get_monrace();
-    auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
+    const auto is_hallucinated = player_ptr->effects()->hallucination().is_hallucinated();
     if ((player_ptr->esp_animal) && r_ptr->kind_flags.has(MonsterKindType::ANIMAL)) {
         um_ptr->flag = true;
         m_ptr->mflag.set(MonsterTemporaryFlagType::ESP);
@@ -474,7 +473,7 @@ static void decide_sight_invisible_monster(PlayerType *player_ptr, um_type *um_p
 
     bool do_cold_blood = check_cold_blood(player_ptr, um_ptr, distance);
     bool do_invisible = check_invisible(player_ptr, um_ptr);
-    if (!um_ptr->flag || !m_ptr->is_original_ap() || player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (!um_ptr->flag || !m_ptr->is_original_ap() || player_ptr->effects()->hallucination().is_hallucinated()) {
         return;
     }
 
@@ -514,7 +513,7 @@ static void update_invisible_monster(PlayerType *player_ptr, um_type *um_ptr, MO
         rfu.set_flag(MainWindowRedrawingFlag::UHEALTH);
     }
 
-    if (!player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (!player_ptr->effects()->hallucination().is_hallucinated()) {
         auto *r_ptr = &m_ptr->get_monrace();
         if ((m_ptr->ap_r_idx == MonsterRaceId::KAGE) && (monraces_info[MonsterRaceId::KAGE].r_sights < MAX_SHORT)) {
             monraces_info[MonsterRaceId::KAGE].r_sights++;
index 9ee7ab7..6431cd6 100644 (file)
@@ -61,7 +61,6 @@
 #include "target/target-checker.h"
 #include "target/target-getter.h"
 #include "term/screen-processor.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "util/string-processor.h"
@@ -479,7 +478,7 @@ void ObjectThrowEntity::display_attack_racial_power()
         return;
     }
 
-    if (!this->player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (!this->player_ptr->effects()->hallucination().is_hallucinated()) {
         monster_race_track(this->player_ptr, this->m_ptr->ap_r_idx);
     }
 
index d32df9f..93c73d6 100644 (file)
@@ -30,7 +30,6 @@
 #include "term/gameterm.h"
 #include "term/screen-processor.h"
 #include "term/z-form.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-poison.h"
 #include "timed-effect/player-stun.h"
 #include "timed-effect/timed-effects.h"
@@ -63,7 +62,7 @@ static void set_bad_status_info(PlayerType *player_ptr, self_info_type *self_ptr
         self_ptr->info_list.emplace_back(_("あなたは毒に侵されている。", "You are poisoned."));
     }
 
-    if (effects->hallucination()->is_hallucinated()) {
+    if (effects->hallucination().is_hallucinated()) {
         self_ptr->info_list.emplace_back(_("あなたは幻覚を見ている。", "You are hallucinating."));
     }
 }
@@ -341,9 +340,9 @@ void report_magics(PlayerType *player_ptr)
             _("あなたは毒に侵されている", "You are poisoned"));
     }
 
-    const auto hallucination = effects->hallucination();
-    if (hallucination->is_hallucinated()) {
-        info.emplace_back(report_magics_aux(hallucination->current()),
+    const auto &hallucination = effects->hallucination();
+    if (hallucination.is_hallucinated()) {
+        info.emplace_back(report_magics_aux(hallucination.current()),
             _("あなたは幻覚を見ている", "You are hallucinating"));
     }
 
index 14c04a2..3f21d35 100644 (file)
@@ -29,7 +29,6 @@
 #include "system/monster-race-info.h"
 #include "system/player-type-definition.h"
 #include "system/redrawing-flags-updater.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "view/display-messages.h"
 #include "world/world.h"
@@ -63,7 +62,7 @@ static void feel_eldritch_horror(std::string_view desc, MonsterRaceInfo *r_ptr)
 
 static bool process_mod_hallucination(PlayerType *player_ptr, std::string_view m_name, const MonsterRaceInfo &monrace)
 {
-    if (!player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (!player_ptr->effects()->hallucination().is_hallucinated()) {
         return false;
     }
 
index 5bb4e83..60146f1 100644 (file)
@@ -62,7 +62,6 @@
 #include "system/redrawing-flags-updater.h"
 #include "term/screen-processor.h"
 #include "term/term-color-types.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
@@ -401,8 +400,8 @@ int take_hit(PlayerType *player_ptr, int damage_type, int damage, std::string_vi
                     player_ptr->died_from = _("切腹", "Seppuku");
                 }
             } else {
-                auto effects = player_ptr->effects();
-                auto is_hallucinated = effects->hallucination()->is_hallucinated();
+                const auto effects = player_ptr->effects();
+                const auto is_hallucinated = effects->hallucination().is_hallucinated();
                 auto paralysis_state = "";
                 if (effects->paralysis()->is_paralyzed()) {
                     paralysis_state = player_ptr->free_act ? _("彫像状態で", " while being the statue") : _("麻痺状態で", " while paralyzed");
@@ -560,7 +559,7 @@ int take_hit(PlayerType *player_ptr, int damage_type, int damage, std::string_vi
 
         sound(SOUND_WARN);
         if (record_danger && (old_chp > warning)) {
-            if (player_ptr->effects()->hallucination()->is_hallucinated() && damage_type == DAMAGE_ATTACK) {
+            if (player_ptr->effects()->hallucination().is_hallucinated() && damage_type == DAMAGE_ATTACK) {
                 hit_from = _("何か", "something");
             }
 
index 7aa332a..b6484bb 100644 (file)
@@ -46,7 +46,6 @@
 #include "system/redrawing-flags-updater.h"
 #include "system/terrain-type-definition.h"
 #include "target/target-checker.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "util/enum-converter.h"
@@ -110,7 +109,7 @@ void search(PlayerType *player_ptr)
         chance = chance / 10;
     }
 
-    if (effects->confusion().is_confused() || effects->hallucination()->is_hallucinated()) {
+    if (effects->confusion().is_confused() || effects->hallucination().is_hallucinated()) {
         chance = chance / 10;
     }
 
index ec7a044..a55bc67 100644 (file)
@@ -13,7 +13,6 @@
 #include "system/player-type-definition.h"
 #include "timed-effect/player-acceleration.h"
 #include "timed-effect/player-deceleration.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/player-poison.h"
 #include "timed-effect/player-stun.h"
@@ -171,7 +170,7 @@ void wr_player(PlayerType *player_ptr)
     wr_s16b(effects->cut().current());
     wr_s16b(effects->stun()->current());
     wr_s16b(effects->poison()->current());
-    wr_s16b(effects->hallucination()->current());
+    wr_s16b(effects->hallucination().current());
     wr_s16b(player_ptr->protevil);
     wr_s16b(player_ptr->invuln);
     wr_s16b(player_ptr->ult_res);
index 17e4236..f9955c4 100644 (file)
@@ -37,7 +37,6 @@
 #include "target/grid-selector.h"
 #include "target/projection-path-calculator.h"
 #include "target/target-checker.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
@@ -314,7 +313,7 @@ void SpellsMirrorMaster::project_seeker_ray(int target_x, int target_y, int dam)
             const auto &grid = floor.grid_array[project_m_y][project_m_x];
             const auto &monster = floor.m_list[grid.m_idx];
             if (project_m_n == 1 && grid.has_monster() && monster.ml) {
-                if (!this->player_ptr->effects()->hallucination()->is_hallucinated()) {
+                if (!this->player_ptr->effects()->hallucination().is_hallucinated()) {
                     monster_race_track(this->player_ptr, monster.ap_r_idx);
                 }
                 health_track(this->player_ptr, grid.m_idx);
@@ -413,7 +412,7 @@ static bool activate_super_ray_effect(PlayerType *player_ptr, int y, int x, int
     const auto *g_ptr = &floor_ptr->grid_array[project_m_y][project_m_x];
     const auto *m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
     if (project_m_n == 1 && g_ptr->has_monster() && m_ptr->ml) {
-        if (!player_ptr->effects()->hallucination()->is_hallucinated()) {
+        if (!player_ptr->effects()->hallucination().is_hallucinated()) {
             monster_race_track(player_ptr, m_ptr->ap_r_idx);
         }
         health_track(player_ptr, g_ptr->m_idx);
index bd6245e..321ef3a 100644 (file)
@@ -23,7 +23,6 @@
 #include "target/target-checker.h"
 #include "target/target-setter.h"
 #include "target/target-types.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
@@ -165,7 +164,7 @@ bool fetch_monster(PlayerType *player_ptr)
     }
 
     if (monster.ml) {
-        if (!player_ptr->effects()->hallucination()->is_hallucinated()) {
+        if (!player_ptr->effects()->hallucination().is_hallucinated()) {
             monster_race_track(player_ptr, monster.ap_r_idx);
         }
 
index b2acb45..11a6635 100644 (file)
@@ -20,7 +20,6 @@
 #include "system/player-type-definition.h"
 #include "system/redrawing-flags-updater.h"
 #include "timed-effect/player-deceleration.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/player-poison.h"
 #include "timed-effect/player-stun.h"
@@ -356,10 +355,10 @@ bool BadStatusSetter::hallucination(const TIME_EFFECT tmp_v)
         v = 0;
     }
 
-    auto hallucination = this->player_ptr->effects()->hallucination();
+    auto &hallucination = this->player_ptr->effects()->hallucination();
     if (v > 0) {
         set_tsuyoshi(this->player_ptr, 0, true);
-        if (!hallucination->is_hallucinated()) {
+        if (!hallucination.is_hallucinated()) {
             msg_print(_("ワーオ!何もかも虹色に見える!", "Oh, wow! Everything looks so cosmic now!"));
             reset_concentration(this->player_ptr, true);
 
@@ -367,13 +366,13 @@ bool BadStatusSetter::hallucination(const TIME_EFFECT tmp_v)
             notice = true;
         }
     } else {
-        if (hallucination->is_hallucinated()) {
+        if (hallucination.is_hallucinated()) {
             msg_print(_("やっとはっきりと物が見えるようになった。", "You can see clearly again."));
             notice = true;
         }
     }
 
-    hallucination->set(v);
+    hallucination.set(v);
     auto &rfu = RedrawingFlagsUpdater::get_instance();
     rfu.set_flag(MainWindowRedrawingFlag::TIMED_EFFECT);
     if (!notice) {
@@ -402,7 +401,7 @@ bool BadStatusSetter::hallucination(const TIME_EFFECT tmp_v)
 
 bool BadStatusSetter::mod_hallucination(const TIME_EFFECT tmp_v)
 {
-    return this->hallucination(this->player_ptr->effects()->hallucination()->current() + tmp_v);
+    return this->hallucination(this->player_ptr->effects()->hallucination().current() + tmp_v);
 }
 
 /*!
index 10be887..c845734 100644 (file)
@@ -20,7 +20,6 @@
 #include "system/redrawing-flags-updater.h"
 #include "timed-effect/player-acceleration.h"
 #include "timed-effect/player-deceleration.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/player-poison.h"
 #include "timed-effect/player-stun.h"
@@ -40,7 +39,7 @@ void reset_tim_flags(PlayerType *player_ptr)
     effects->paralysis()->reset();
     effects->confusion().reset();
     effects->fear().reset();
-    effects->hallucination()->reset();
+    effects->hallucination().reset();
     effects->poison()->reset();
     effects->cut().reset();
     effects->stun()->reset();
index 6d0bcd0..79a824a 100644 (file)
@@ -4,7 +4,6 @@
 #include "system/angband-exceptions.h"
 #include "system/redrawing-flags-updater.h"
 #include "timed-effect/player-deceleration.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/player-poison.h"
 #include "timed-effect/player-stun.h"
@@ -54,7 +53,7 @@ bool PlayerType::is_fully_healthy() const
     is_fully_healthy &= !effects->cut().is_cut();
     is_fully_healthy &= !effects->deceleration()->is_slow();
     is_fully_healthy &= !effects->paralysis()->is_paralyzed();
-    is_fully_healthy &= !effects->hallucination()->is_hallucinated();
+    is_fully_healthy &= !effects->hallucination().is_hallucinated();
     is_fully_healthy &= !this->word_recall;
     is_fully_healthy &= !this->alter_reality;
     return is_fully_healthy;
index 5fcb331..ebc84ef 100644 (file)
@@ -17,7 +17,6 @@
 #include "target/target-checker.h"
 #include "target/target-sorter.h"
 #include "term/screen-processor.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/int-char-converter.h"
 #include "view/display-messages.h"
@@ -41,7 +40,7 @@ static bool tgt_pt_accept(PlayerType *player_ptr, POSITION y, POSITION x)
         return true;
     }
 
-    if (player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (player_ptr->effects()->hallucination().is_hallucinated()) {
         return false;
     }
 
index e36d93b..11e164f 100644 (file)
@@ -38,7 +38,6 @@
 #include "term/screen-processor.h"
 #include "term/term-color-types.h"
 #include "term/z-form.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-lore.h"
@@ -154,7 +153,7 @@ static void describe_target(PlayerType *player_ptr, GridExamination *ge_ptr)
 
 static ProcessResult describe_hallucinated_target(PlayerType *player_ptr, GridExamination *ge_ptr)
 {
-    if (!player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (!player_ptr->effects()->hallucination().is_hallucinated()) {
         return ProcessResult::PROCESS_CONTINUE;
     }
 
index 83e5435..b4c9603 100644 (file)
@@ -18,7 +18,6 @@
 #include "target/projection-path-calculator.h"
 #include "target/target-sorter.h"
 #include "target/target-types.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "window/main-window-util.h"
@@ -48,7 +47,7 @@ bool target_able(PlayerType *player_ptr, MONSTER_IDX m_idx)
         return false;
     }
 
-    if (player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (player_ptr->effects()->hallucination().is_hallucinated()) {
         return false;
     }
 
@@ -81,7 +80,7 @@ static bool target_set_accept(PlayerType *player_ptr, const Pos2D &pos)
         return true;
     }
 
-    if (player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (player_ptr->effects()->hallucination().is_hallucinated()) {
         return false;
     }
 
@@ -193,7 +192,7 @@ void target_sensing_monsters_prepare(PlayerType *player_ptr, std::vector<MONSTER
     monster_list.clear();
 
     // 幻覚時は正常に感知できない
-    if (player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (player_ptr->effects()->hallucination().is_hallucinated()) {
         return;
     }
 
index 3f89ef9..489eab1 100644 (file)
@@ -3,6 +3,11 @@
 class PlayerHallucination {
 public:
     PlayerHallucination() = default;
+    ~PlayerHallucination() = default;
+    PlayerHallucination(const PlayerHallucination &) = delete;
+    PlayerHallucination(PlayerHallucination &&) = delete;
+    PlayerHallucination &operator=(const PlayerHallucination &) = delete;
+    PlayerHallucination &operator=(PlayerHallucination &&) = delete;
 
     short current() const;
     bool is_hallucinated() const;
index 69b9daa..1dd680f 100644 (file)
@@ -7,14 +7,12 @@
 #include "timed-effect/timed-effects.h"
 #include "timed-effect/player-acceleration.h"
 #include "timed-effect/player-deceleration.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/player-poison.h"
 #include "timed-effect/player-stun.h"
 
 TimedEffects::TimedEffects()
-    : player_hallucination(std::make_shared<PlayerHallucination>())
-    , player_paralysis(std::make_shared<PlayerParalysis>())
+    : player_paralysis(std::make_shared<PlayerParalysis>())
     , player_stun(std::make_shared<PlayerStun>())
     , player_acceleration(std::make_shared<PlayerAcceleration>())
     , player_deceleration(std::make_shared<PlayerDeceleration>())
@@ -62,7 +60,12 @@ const PlayerFear &TimedEffects::fear() const
     return this->player_fear;
 }
 
-std::shared_ptr<PlayerHallucination> TimedEffects::hallucination() const
+PlayerHallucination &TimedEffects::hallucination()
+{
+    return this->player_hallucination;
+}
+
+const PlayerHallucination &TimedEffects::hallucination() const
 {
     return this->player_hallucination;
 }
index 62225b1..f3ef2c8 100644 (file)
@@ -4,11 +4,11 @@
 #include "timed-effect/player-confusion.h"
 #include "timed-effect/player-cut.h"
 #include "timed-effect/player-fear.h"
+#include "timed-effect/player-hallucination.h"
 #include <memory>
 
 class PlayerAcceleration;
 class PlayerDeceleration;
-class PlayerHallucination;
 class PlayerParalysis;
 class PlayerPoison;
 class PlayerStun;
@@ -29,7 +29,8 @@ public:
     const PlayerCut &cut() const;
     PlayerFear &fear();
     const PlayerFear &fear() const;
-    std::shared_ptr<PlayerHallucination> hallucination() const;
+    PlayerHallucination &hallucination();
+    const PlayerHallucination &hallucination() const;
     std::shared_ptr<PlayerParalysis> paralysis() const;
     std::shared_ptr<PlayerStun> stun() const;
     std::shared_ptr<PlayerAcceleration> acceleration() const;
@@ -41,7 +42,7 @@ private:
     PlayerConfusion player_confusion{};
     PlayerCut player_cut{};
     PlayerFear player_fear{};
-    std::shared_ptr<PlayerHallucination> player_hallucination;
+    PlayerHallucination player_hallucination{};
     std::shared_ptr<PlayerParalysis> player_paralysis;
     std::shared_ptr<PlayerStun> player_stun;
     std::shared_ptr<PlayerAcceleration> player_acceleration;
index b97c82a..3234adf 100644 (file)
@@ -21,7 +21,6 @@
 #include "system/player-type-definition.h"
 #include "system/terrain-type-definition.h"
 #include "term/term-color-types.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-symbol.h"
@@ -222,7 +221,7 @@ DisplaySymbolPair map_info(PlayerType *player_ptr, const Pos2D &pos)
     }
 
     DisplaySymbolPair symbol_pair = { symbol_config, symbol_config };
-    const auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
+    const auto is_hallucinated = player_ptr->effects()->hallucination().is_hallucinated();
     if (is_hallucinated && one_in_(256)) {
         symbol_pair.symbol_foreground = image_random();
     }
index 745767b..c211ce6 100644 (file)
@@ -35,7 +35,6 @@
 #include "target/target-preparation.h"
 #include "term/gameterm.h"
 #include "term/screen-processor.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-stun.h"
 #include "timed-effect/timed-effects.h"
 #include "util/buffer-shaper.h"
@@ -223,7 +222,7 @@ static void print_pet_list_oneline(PlayerType *player_ptr, const MonsterEntity &
     const auto &monrace = monster.get_appearance_monrace();
     const auto name = monster_desc(player_ptr, &monster, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE | MD_NO_OWNER);
     const auto &[bar_color, bar_len] = monster.get_hp_bar_data();
-    const auto is_visible = monster.ml && !player_ptr->effects()->hallucination()->is_hallucinated();
+    const auto is_visible = monster.ml && !player_ptr->effects()->hallucination().is_hallucinated();
 
     term_erase(0, y);
     if (is_visible) {
@@ -563,7 +562,7 @@ static void display_floor_item_list(PlayerType *player_ptr, const Pos2D &pos)
     std::string line;
 
     // 先頭行を書く。
-    auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
+    const auto is_hallucinated = player_ptr->effects()->hallucination().is_hallucinated();
     if (player_ptr->is_located_at(pos)) {
         line = format(_("(X:%03d Y:%03d) あなたの足元のアイテム一覧", "Items at (%03d,%03d) under you"), pos.x, pos.y);
     } else if (const auto *m_ptr = monster_on_floor_items(&floor, &grid); m_ptr != nullptr) {
index 8e606bd..df0b1ae 100644 (file)
@@ -18,7 +18,6 @@
 #include "term/screen-processor.h"
 #include "term/term-color-types.h"
 #include "term/z-form.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "util/string-processor.h"
 #include "window/main-window-row-column.h"
@@ -385,7 +384,7 @@ void print_health(PlayerType *player_ptr, bool riding)
 
     const auto &monster = player_ptr->current_floor_ptr->m_list[*monster_idx];
 
-    if ((!monster.ml) || (player_ptr->effects()->hallucination()->is_hallucinated()) || monster.is_dead()) {
+    if ((!monster.ml) || (player_ptr->effects()->hallucination().is_hallucinated()) || monster.is_dead()) {
         term_putstr(col, row, max_width, TERM_WHITE, "[----------]");
         return;
     }
index f8390c2..c5e4226 100644 (file)
@@ -24,7 +24,6 @@
 #include "term/term-color-types.h"
 #include "term/z-form.h"
 #include "timed-effect/player-deceleration.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/player-paralysis.h"
 #include "timed-effect/player-poison.h"
 #include "timed-effect/player-stun.h"
@@ -451,7 +450,7 @@ void print_status(PlayerType *player_ptr)
         ADD_BAR_FLAG(BAR_TSUYOSHI);
     }
 
-    if (effects->hallucination()->is_hallucinated()) {
+    if (effects->hallucination().is_hallucinated()) {
         ADD_BAR_FLAG(BAR_HALLUCINATION);
     }
 
index def8349..bfcaae4 100644 (file)
@@ -16,7 +16,6 @@
 #include "term/gameterm.h"
 #include "term/screen-processor.h"
 #include "term/term-color-types.h"
-#include "timed-effect/player-hallucination.h"
 #include "timed-effect/timed-effects.h"
 #include "view/display-map.h"
 #include "view/display-symbol.h"
@@ -118,7 +117,7 @@ static void display_shortened_item_name(PlayerType *player_ptr, ItemEntity *o_pt
 {
     auto item_name = describe_flavor(player_ptr, o_ptr, (OD_NO_FLAVOR | OD_OMIT_PREFIX | OD_NAME_ONLY));
     auto attr = tval_to_attr[enum2i(o_ptr->bi_key.tval()) % 128];
-    if (player_ptr->effects()->hallucination()->is_hallucinated()) {
+    if (player_ptr->effects()->hallucination().is_hallucinated()) {
         attr = TERM_WHITE;
         item_name = _("何か奇妙な物", "something strange");
     }