OSDN Git Service

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