OSDN Git Service

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