OSDN Git Service

Merge pull request #972 from habu1010/feature/list-for-item-stack
[hengbandforosx/hengbandosx.git] / src / player / player-race.h
1 #pragma once
2
3 #include <unordered_map>
4 #include <vector>
5 #include <optional>
6
7 #include "object-enchant/tr-types.h"
8 #include "player-ability/player-ability-types.h"
9 #include "player/player-class-types.h"
10 #include "player/player-race-types.h"
11 #include "system/angband.h"
12
13 /*
14  * Constant for kinds of mimic
15  */
16 #define MIMIC_NONE 0
17 #define MIMIC_DEMON 1
18 #define MIMIC_DEMON_LORD 2
19 #define MIMIC_VAMPIRE 3
20
21 #define MIMIC_FLAGS choice
22 #define MIMIC_IS_NONLIVING 0x00000001
23 #define MIMIC_IS_DEMON 0x00000002
24 #define MIMIC_IS_UNDEAD 0x00000004
25
26 /*!
27  * プレイヤー種族の生命形態
28  */
29 enum class PlayerRaceLife {
30     LIVING = 0, //生きている
31     UNDEAD = 1, //不死
32     DEMON = 2, //悪魔
33     NONLIVING = 3, //生きてない
34     MAX
35 };
36
37 struct player_race_condition {
38     tr_type type{};
39     PLAYER_LEVEL level{};
40     std::optional<player_class_type> pclass{};
41     bool not_class{};
42
43     player_race_condition(tr_type t, PLAYER_LEVEL l = 1, const std::optional<player_class_type>& c = std::nullopt, bool nc = false)
44         : type(t), level(l), pclass(c), not_class(nc) {}
45 };
46
47 /*!
48  * p@brief プレイヤー種族構造体 / Player racial info
49  */
50 struct player_race {
51     concptr title{}; //!< 種族名 / Title of race
52 #ifdef JP
53     concptr E_title{}; //!< 英語種族名
54 #endif
55     concptr symbol{}; //!< 種族シンボル(救援召喚) / Race symbols
56     s16b r_adj[A_MAX]{}; //!< 能力値ボーナス / Racial stat bonuses
57
58     s16b r_dis{}; //!< 解除 / disarming
59     s16b r_dev{}; //!< 魔道具使用 /magic devices
60     s16b r_sav{}; //!< 魔法防御 / saving throw
61     s16b r_stl{}; //!< 隠密 / stealth
62     s16b r_srh{}; //!< 探索 / search ability
63     s16b r_fos{}; //!< 知覚 / search frequency
64     s16b r_thn{}; //!< 打撃修正(命中) / combat (normal)
65     s16b r_thb{}; //!< 射撃修正(命中) / combat (shooting)
66
67     byte r_mhp{}; //!< ヒットダイス /  Race hit-dice modifier
68     byte r_exp{}; //!< 経験値修正 /Race experience factor
69
70     byte b_age{}; //!< 年齢最小値 / base age
71     byte m_age{}; //!< 年齢加算範囲 / mod age
72
73     byte m_b_ht{}; //!< 身長最小値(男) / base height (males)
74     byte m_m_ht{}; //!< 身長加算範囲(男) / mod height (males)
75     byte m_b_wt{}; //!< 体重最小値(男) / base weight (males)
76     byte m_m_wt{}; //!< 体重加算範囲(男) / mod weight (males)
77
78     byte f_b_ht{}; //!< 身長最小値(女) / base height (females)
79     byte f_m_ht{}; //!< 身長加算範囲(女) / mod height (females)   
80     byte f_b_wt{}; //!< 体重最小値(女) / base weight (females)
81     byte f_m_wt{}; //!< 体重加算範囲(女) / mod weight (females)
82
83     byte infra{}; //!< 赤外線視力 / Infra-vision range
84
85     u32b choice{}; //!< 似つかわしい職業(ミミック時はミミック種族属性) / Legal class choices
86     PlayerRaceLife life{}; //!< 生命の形態
87
88     std::vector<player_race_condition> extra_flags;
89 };
90
91 extern const player_race *rp_ptr;
92
93 typedef struct player_type player_type;
94 SYMBOL_CODE get_summon_symbol_from_player(player_type *creature_ptr);
95 bool is_specific_player_race(player_type *creature_ptr, player_race_type prace);
96 bool player_race_has_flag(player_type *creature_ptr, tr_type flag, bool base_race = false);
97 void add_player_race_flags(player_type *creature_ptr, BIT_FLAGS *flags, bool base_race = false);
98 PlayerRaceLife player_race_life(player_type *creature_ptr, bool base_race = false);