3 #include "monster/monster-flag-types.h"
4 #include "monster/monster-timed-effect-types.h"
5 #include "monster/smart-learn-types.h"
6 #include "object/object-index-list.h"
7 #include "util/flag-group.h"
10 * @brief Monster information, for a specific monster.
12 * fy, fx constrain dungeon size to 256x256
13 * The "hold_o_idx" field points to the first object of a stack
14 * of objects (if any) being carried by the monster (see above).
16 constexpr int MONSTER_MAXHP = 30000; //!< モンスターの最大HP
18 enum class MonsterRaceId : int16_t;
20 class MonsterRaceInfo;
23 MonsterEntity() = default;
24 MonsterRaceId r_idx{}; /*!< モンスターの実種族ID (これが0の時は死亡扱いになる) / Monster race index 0 = dead. */
25 MonsterRaceId ap_r_idx{}; /*!< モンスターの外見種族ID(あやしい影、たぬき、ジュラル星人誤認などにより変化する)Monster race appearance index */
26 FloorType *current_floor_ptr{}; /*!< 所在フロアID(現状はFloorType構造体によるオブジェクトは1つしかないためソースコード設計上の意義以外はない)*/
28 /* Sub-alignment flags for neutral monsters */
29 #define SUB_ALIGN_NEUTRAL 0x0000 /*!< モンスターのサブアライメント:中立 */
30 #define SUB_ALIGN_EVIL 0x0001 /*!< モンスターのサブアライメント:善 */
31 #define SUB_ALIGN_GOOD 0x0002 /*!< モンスターのサブアライメント:悪 */
32 BIT_FLAGS8 sub_align{}; /*!< 中立属性のモンスターが召喚主のアライメントに従い一時的に立っている善悪陣営 / Sub-alignment for a neutral monster */
34 POSITION fy{}; /*!< 所在グリッドY座標 / Y location on map */
35 POSITION fx{}; /*!< 所在グリッドX座標 / X location on map */
36 int hp{}; /*!< 現在のHP / Current Hit points */
37 int maxhp{}; /*!< 現在の最大HP(衰弱効果などにより低下したものの反映) / Max Hit points */
38 int max_maxhp{}; /*!< 生成時の初期最大HP / Max Max Hit points */
39 int dealt_damage{}; /*!< これまでに蓄積して与えてきたダメージ / Sum of damages dealt by player */
40 TIME_EFFECT mtimed[MAX_MTIMED]{}; /*!< 与えられた時限効果の残りターン / Timed status counter */
41 byte mspeed{}; /*!< モンスターの個体加速値 / Monster "speed" */
42 ACTION_ENERGY energy_need{}; /*!< モンスター次ターンまでに必要な行動エネルギー / Monster "energy" */
43 POSITION cdis{}; /*!< 現在のプレイヤーから距離(逐一計算を避けるためのテンポラリ変数) Current dis from player */
44 EnumClassFlagGroup<MonsterTemporaryFlagType> mflag{}; /*!< モンスター個体に与えられた特殊フラグ1 (セーブ不要) / Extra monster flags */
45 EnumClassFlagGroup<MonsterConstantFlagType> mflag2{}; /*!< モンスター個体に与えられた特殊フラグ2 (セーブ必要) / Extra monster flags */
46 bool ml{}; /*!< モンスターがプレイヤーにとって視認できるか(処理のためのテンポラリ変数) Monster is "visible" */
47 ObjectIndexList hold_o_idx_list{}; /*!< モンスターが所持しているアイテムのリスト / Object list being held (if any) */
48 POSITION target_y{}; /*!< モンスターの攻撃目標対象Y座標 / Can attack !los player */
49 POSITION target_x{}; /*!< モンスターの攻撃目標対象X座標 / Can attack !los player */
50 std::string nickname{}; /*!< ペットに与えられた名前 / Monster's Nickname */
51 EXP exp{}; /*!< モンスターの現在所持経験値 */
53 /* TODO: クローン、ペット、有効化は意義が異なるので別変数に切り離すこと。save/loadのバージョン更新が面倒そうだけど */
54 EnumClassFlagGroup<MonsterSmartLearnType> smart{}; /*!< モンスターのプレイヤーに対する学習状態 / Field for "smart_learn" - Some bit-flags for the "smart" field */
55 MONSTER_IDX parent_m_idx{}; /*!< 召喚主のモンスターID */
57 bool is_friendly() const;
59 bool is_hostile() const;
60 bool is_named() const;
61 bool is_named_pet() const;
62 bool is_original_ap() const;
63 bool is_mimicry() const;
64 bool is_valid() const;
65 MonsterRaceId get_real_r_idx() const;
66 MonsterRaceInfo &get_real_r_ref() const;
67 short get_remaining_sleep() const;
68 short get_remaining_acceleration() const;
69 short get_remaining_deceleration() const;
70 short get_remaining_stun() const;
71 short get_remaining_confusion() const;
72 short get_remaining_fear() const;
73 short get_remaining_invulnerability() const;
75 bool is_asleep() const;
76 bool is_accelerated() const;
77 bool is_decelerated() const;
78 bool is_stunned() const;
79 bool is_confused() const;
80 bool is_fearful() const;
81 bool is_invulnerable() const;
82 byte get_temporary_speed() const;