OSDN Git Service

Merge pull request #3814 from Slimebreath6078/feature/Add_Laffey_II
[hengbandforosx/hengbandosx.git] / src / system / monster-race-info.h
1 #pragma once
2
3 #include "monster-attack/monster-attack-effect.h"
4 #include "monster-attack/monster-attack-table.h"
5 #include "monster-race/monster-aura-types.h"
6 #include "monster-race/race-ability-flags.h"
7 #include "monster-race/race-behavior-flags.h"
8 #include "monster-race/race-brightness-flags.h"
9 #include "monster-race/race-drop-flags.h"
10 #include "monster-race/race-feature-flags.h"
11 #include "monster-race/race-flags-resistance.h"
12 #include "monster-race/race-kind-flags.h"
13 #include "monster-race/race-misc-flags.h"
14 #include "monster-race/race-population-flags.h"
15 #include "monster-race/race-sex-const.h"
16 #include "monster-race/race-speak-flags.h"
17 #include "monster-race/race-special-flags.h"
18 #include "monster-race/race-visual-flags.h"
19 #include "monster-race/race-wilderness-flags.h"
20 #include "system/angband.h"
21 #include "util/flag-group.h"
22 #include <map>
23 #include <set>
24 #include <string>
25 #include <tuple>
26 #include <vector>
27
28 /*! モンスターが1ターンに攻撃する最大回数 (射撃を含む) / The maximum number of times a monster can attack in a turn (including SHOOT) */
29 constexpr int MAX_NUM_BLOWS = 4;
30
31 enum class FixedArtifactId : short;
32 enum class MonsterRaceId : int16_t;
33
34 class MonsterBlow {
35 public:
36     RaceBlowMethodType method{};
37     RaceBlowEffectType effect{};
38     DICE_NUMBER d_dice{};
39     DICE_SID d_side{};
40 };
41
42 /*!
43  * @brief モンスター種族の定義構造体
44  * @details
45  * Monster "race" information, including racial memories
46  *
47  * Note that "d_attr" and "d_char" are used for MORE than "visual" stuff.
48  *
49  * Note that "x_attr" and "x_char" are used ONLY for "visual" stuff.
50  *
51  * Note that "cur_num" (and "max_num") represent the number of monsters
52  * of the given race currently on (and allowed on) the current level.
53  * This information yields the "dead" flag for Unique monsters.
54  *
55  * Note that "max_num" is reset when a new player is created.
56  * Note that "cur_num" is reset when a new level is created.
57  *
58  * Note that several of these fields, related to "recall", can be
59  * scrapped if space becomes an issue, resulting in less "complete"
60  * monster recall (no knowledge of spells, etc).  All of the "recall"
61  * fields have a special prefix to aid in searching for them.
62  */
63 class MonsterRaceInfo {
64 public:
65     MonsterRaceInfo() = default;
66
67     MonsterRaceId idx{};
68     std::string name; //!< 名前データのオフセット(日本語) /  Name offset(Japanese)
69 #ifdef JP
70     std::string E_name; //!< 名前データのオフセット(英語) /  Name offset(English)
71 #endif
72     std::string text; //!< 思い出テキストのオフセット / Lore text offset
73     DICE_NUMBER hdice{}; //!< HPのダイス数 / Creatures hit dice count
74     DICE_SID hside{}; //!< HPのダイス面数 / Creatures hit dice sides
75     ARMOUR_CLASS ac{}; //!< アーマークラス / Armour Class
76     SLEEP_DEGREE sleep{}; //!< 睡眠値 / Inactive counter (base)
77     POSITION aaf{}; //!< 感知範囲(1-100スクエア) / Area affect radius (1-100)
78     byte speed{}; //!< 加速(110で+0) / Speed (normally 110)
79     EXP mexp{}; //!< 殺害時基本経験値 / Exp value for kill
80     RARITY freq_spell{}; //!< 魔法&特殊能力仕様頻度(1/n) /  Spell frequency
81     MonsterSex sex{}; //!< 性別 / Sex
82     EnumClassFlagGroup<MonsterAbilityType> ability_flags; //!< 能力フラグ(魔法/ブレス) / Ability Flags
83     EnumClassFlagGroup<MonsterAuraType> aura_flags; //!< オーラフラグ / Aura Flags
84     EnumClassFlagGroup<MonsterBehaviorType> behavior_flags; //!< 能力フラグ(習性)
85     EnumClassFlagGroup<MonsterVisualType> visual_flags; //!< 能力フラグ(シンボル) / Symbol Flags
86     EnumClassFlagGroup<MonsterKindType> kind_flags; //!< 能力フラグ(種族・徳) / Attr Flags
87     EnumClassFlagGroup<MonsterResistanceType> resistance_flags; //!< 耐性フラグ / Flags R (resistances info)
88     EnumClassFlagGroup<MonsterDropType> drop_flags; //!< 能力フラグ(ドロップ) / Drop Flags
89     EnumClassFlagGroup<MonsterWildernessType> wilderness_flags; //!< 荒野フラグ / Wilderness Flags
90     EnumClassFlagGroup<MonsterFeatureType> feature_flags; //!< 能力フラグ(地形関連) / Feature Flags
91     EnumClassFlagGroup<MonsterPopulationType> population_flags; //!< 能力フラグ(出現数関連) / Population Flags
92     EnumClassFlagGroup<MonsterSpeakType> speak_flags; //!< 能力フラグ(セリフ) / Speaking Flags
93     EnumClassFlagGroup<MonsterBrightnessType> brightness_flags; //!< 能力フラグ(明暗) / Speaking Lite or Dark
94     EnumClassFlagGroup<MonsterSpecialType> special_flags; //!< 能力フラグ(特殊) / Special Flags
95     EnumClassFlagGroup<MonsterMiscType> misc_flags; //!< 能力フラグ(その他) / Speaking Other
96     MonsterBlow blows[MAX_NUM_BLOWS]{}; //!< 打撃能力定義 / Up to four blows per round
97
98     //! 指定護衛リスト <モンスター種族ID,護衛数ダイス数,護衛数ダイス面>
99     std::vector<std::tuple<MonsterRaceId, DICE_NUMBER, DICE_SID>> reinforces;
100
101     //! 特定アーティファクトドロップリスト <アーティファクトID,ドロップ率>
102     std::vector<std::tuple<FixedArtifactId, PERCENTAGE>> drop_artifacts;
103
104     PERCENTAGE arena_ratio{}; //!< モンスター闘技場の掛け金倍率修正値(%基準 / 0=100%) / The adjustment ratio for gambling monster
105     MonsterRaceId next_r_idx{}; //!< 進化先モンスター種族ID
106     EXP next_exp{}; //!< 進化に必要な経験値
107     DEPTH level{}; //!< レベル / Level of creature
108     RARITY rarity{}; //!< レアリティ / Rarity of creature
109     TERM_COLOR d_attr{}; //!< デフォルトの表示色 / Default monster attribute
110     char d_char{}; //!< デフォルトの表示文字 / Default monster character
111     TERM_COLOR x_attr{}; //!< 設定した表示色(またはタイル位置Y) / Desired monster attribute
112     char x_char{}; //!< 設定した表示文字(またはタイル位置X) / Desired monster character
113     MONSTER_NUMBER max_num{}; //!< 階に最大存在できる数 / Maximum population allowed per level
114     MONSTER_NUMBER cur_num{}; //!< 階に現在いる数 / Monster population on current level
115     FLOOR_IDX floor_id{}; //!< 存在している保存階ID /  Location of unique monster
116     MONSTER_NUMBER r_sights{}; //!< 見えている数 / Count sightings of this monster
117     MONSTER_NUMBER r_deaths{}; //!< このモンスターに殺された人数 / Count deaths from this monster
118     MONSTER_NUMBER r_pkills{}; //!< このゲームで倒すのを見た数 / Count visible monsters killed in this life
119     MONSTER_NUMBER r_akills{}; //!< このゲームで倒した数 / Count all monsters killed in this life
120     MONSTER_NUMBER r_tkills{}; //!< 全ゲームで倒した数 / Count monsters killed in all lives
121     byte r_wake{}; //!< @に気づいて起きた数 / Number of times woken up (?)
122     byte r_ignore{}; //!< @に気づいていない数 / Number of times ignored (?)
123     bool r_can_evolve{}; //!< 進化するか否か / Flag being able to evolve
124     ITEM_NUMBER r_drop_gold{}; //!< これまでに撃破時に落とした財宝の数 / Max number of gold dropped at once
125     ITEM_NUMBER r_drop_item{}; //!< これまでに撃破時に落としたアイテムの数 / Max number of item dropped at once
126     byte r_cast_spell{}; //!< 使った魔法/ブレスの種類数 /  Max unique number of spells seen
127     byte r_blows[MAX_NUM_BLOWS]{}; //!< 受けた打撃 /  Number of times each blow type was seen
128     EnumClassFlagGroup<MonsterAbilityType> r_ability_flags; //!< 見た能力フラグ(魔法/ブレス) / Observed racial ability flags
129     EnumClassFlagGroup<MonsterAuraType> r_aura_flags; //!< 見た能力フラグ(オーラ) / Observed aura flags
130     EnumClassFlagGroup<MonsterBehaviorType> r_behavior_flags; //!< 見た能力フラグ(習性) / Observed racial attr flags
131     EnumClassFlagGroup<MonsterKindType> r_kind_flags; //!< 見た能力フラグ(種族・徳) / Observed racial attr flags
132     EnumClassFlagGroup<MonsterResistanceType> r_resistance_flags; //!< 見た耐性フラグ / Observed racial resistances flags
133     EnumClassFlagGroup<MonsterDropType> r_drop_flags; //!< 見た能力フラグ(ドロップ) / Observed drop flags
134     EnumClassFlagGroup<MonsterFeatureType> r_feature_flags; //!< 見た能力フラグ(地形関連) / Observed feature flags
135     EnumClassFlagGroup<MonsterSpecialType> r_special_flags; //!< 見た能力フラグ(特殊) / Observed special flags
136     EnumClassFlagGroup<MonsterMiscType> r_misc_flags; //!< 見た能力フラグ(その他) / Observed feature flags
137     PLAYER_LEVEL defeat_level{}; //!< 倒したレベル(ユニーク用) / player level at which defeated this race
138     REAL_TIME defeat_time{}; //!< 倒した時間(ユニーク用) / time at which defeated this race
139     PERCENTAGE cur_hp_per{}; //!< 生成時現在HP率(%)
140
141     const std::string &decide_horror_message() const;
142     bool has_living_flag() const;
143     bool is_explodable() const;
144     std::string get_died_message() const;
145     void kill_unique();
146     std::string get_pronoun_of_summoned_kin() const;
147 };
148
149 class MonraceList {
150 public:
151     MonraceList(MonraceList &&) = delete;
152     MonraceList(const MonraceList &) = delete;
153     MonraceList &operator=(const MonraceList &) = delete;
154     MonraceList &operator=(MonraceList &&) = delete;
155     MonsterRaceInfo &operator[](const MonsterRaceId r_idx);
156     const MonsterRaceInfo &operator[](const MonsterRaceId r_idx) const;
157
158     static const std::map<MonsterRaceId, std::set<MonsterRaceId>> &get_unified_uniques();
159     static MonraceList &get_instance();
160     bool can_unify_separate(const MonsterRaceId r_idx) const;
161     void kill_unified_unique(const MonsterRaceId r_idx);
162     bool is_selectable(const MonsterRaceId r_idx) const;
163     void defeat_separated_uniques();
164     bool is_unified(const MonsterRaceId r_idx) const;
165     bool exists_separates(const MonsterRaceId r_idx) const;
166     bool is_separated(const MonsterRaceId r_idx) const;
167     bool can_select_separate(const MonsterRaceId r_idx, const int hp, const int maxhp) const;
168     int calc_figurine_value(const MonsterRaceId r_idx) const;
169     int calc_capture_value(const MonsterRaceId r_idx) const;
170
171 private:
172     MonraceList() = default;
173
174     static MonraceList instance;
175
176     const static std::map<MonsterRaceId, std::set<MonsterRaceId>> unified_uniques;
177 };