3 #include "mutation/mutation-flag-types.h"
4 #include "object-enchant/trc-types.h"
5 #include "player-ability/player-ability-types.h"
6 #include "player-info/class-specific-data.h"
7 #include "player-info/class-types.h"
8 #include "player-info/race-types.h"
9 #include "player/player-personality-types.h"
10 #include "player/player-sex.h"
11 #include "system/angband.h"
12 #include "system/system-variables.h"
13 #include "util/flag-group.h"
14 #include "util/point-2d.h"
19 enum class ItemKindType : short;
20 enum class PlayerSkillKindType;
21 enum class MimicKindType;
22 enum class MonsterAbilityType;
23 enum class MonsterRaceId : int16_t;
24 enum class Virtue : short;
32 bool is_true_winner() const;
34 FloorType *current_floor_ptr{};
35 POSITION oldpy{}; /* Previous player location -KMW- */
36 POSITION oldpx{}; /* Previous player location -KMW- */
38 player_sex psex{}; /* Sex index */
39 PlayerRaceType prace{}; /* Race index */
40 PlayerClassType pclass{}; /* Class index */
41 player_personality_type ppersonality{}; /* Personality index */
42 int16_t realm1{}; /* First magic realm */
43 int16_t realm2{}; /* Second magic realm */
44 int16_t element{}; //!< 元素使い領域番号 / Elementalist system index
46 DICE_SID hitdie{}; /* Hit dice (sides) */
47 uint16_t expfact{}; /* Experience factor
48 * Note: was byte, causing overflow for Amberite
49 * characters (such as Amberite Paladins)
52 int16_t age{}; /* Characters age */
53 int16_t ht{}; /* Height */
54 int16_t wt{}; /* Weight */
55 int16_t sc{}; /* Social Class */
57 PRICE au{}; /* Current Gold */
59 EXP max_max_exp{}; /* Max max experience (only to calculate score) */
60 EXP max_exp{}; /* Max experience */
61 EXP exp{}; /* Cur experience */
62 uint32_t exp_frac{}; /* Cur exp frac (times 2^16) */
64 PLAYER_LEVEL lev{}; /* Level */
66 int16_t town_num{}; /* Current town number */
67 int16_t arena_number{}; /* monster number in on_defeat_arena_monster -KMW- */
69 POSITION wilderness_x{}; /* Coordinates in the wilderness */
70 POSITION wilderness_y{};
73 int mhp{}; /* Max hit pts */
74 int chp{}; /* Cur hit pts */
75 uint32_t chp_frac{}; /* Cur hit frac (times 2^16) */
76 PERCENTAGE mutant_regenerate_mod{};
78 MANA_POINT msp{}; /* Max mana pts */
79 MANA_POINT csp{}; /* Cur mana pts */
80 uint32_t csp_frac{}; /* Cur mana frac (times 2^16) */
82 int16_t max_plv{}; /* Max Player Level */
84 short stat_max[A_MAX]{}; /* Current "maximal" stat values */
85 short stat_max_max[A_MAX]{}; /* Maximal "maximal" stat values */
86 short stat_cur[A_MAX]{}; /* Current "natural" stat values */
88 int16_t learned_spells{};
93 TIME_EFFECT protevil{}; /* Timed -- Protection */
94 TIME_EFFECT invuln{}; /* Timed -- Invulnerable */
95 TIME_EFFECT ult_res{}; /* Timed -- Ultimate Resistance */
96 TIME_EFFECT hero{}; /* Timed -- Heroism */
97 TIME_EFFECT shero{}; /* Timed -- Super Heroism */
98 TIME_EFFECT shield{}; /* Timed -- Shield Spell */
99 TIME_EFFECT blessed{}; /* Timed -- Blessed */
100 TIME_EFFECT tim_invis{}; /* Timed -- See Invisible */
101 TIME_EFFECT tim_infra{}; /* Timed -- Infra Vision */
102 TIME_EFFECT tsuyoshi{}; /* Timed -- Tsuyoshi Special */
103 TIME_EFFECT ele_attack{}; /* Timed -- Elemental Attack */
104 TIME_EFFECT ele_immune{}; /* Timed -- Elemental Immune */
106 TIME_EFFECT oppose_acid{}; /* Timed -- oppose acid */
107 TIME_EFFECT oppose_elec{}; /* Timed -- oppose lightning */
108 TIME_EFFECT oppose_fire{}; /* Timed -- oppose heat */
109 TIME_EFFECT oppose_cold{}; /* Timed -- oppose cold */
110 TIME_EFFECT oppose_pois{}; /* Timed -- oppose poison */
112 TIME_EFFECT tim_esp{}; /* Timed ESP */
113 TIME_EFFECT wraith_form{}; /* Timed wraithform */
115 TIME_EFFECT resist_magic{}; /* Timed Resist Magic (later) */
116 TIME_EFFECT tim_regen{};
117 TIME_EFFECT tim_pass_wall{};
118 TIME_EFFECT tim_stealth{};
119 TIME_EFFECT tim_levitation{};
120 TIME_EFFECT tim_sh_touki{};
121 TIME_EFFECT lightspeed{};
122 TIME_EFFECT tsubureru{};
123 TIME_EFFECT magicdef{};
124 TIME_EFFECT tim_res_nether{}; /* Timed -- Nether resistance */
125 TIME_EFFECT tim_res_time{}; /* Timed -- Time resistance */
126 MimicKindType mimic_form{};
127 TIME_EFFECT tim_mimic{};
128 TIME_EFFECT tim_sh_fire{};
129 TIME_EFFECT tim_sh_holy{};
130 TIME_EFFECT tim_eyeeye{};
132 /* for mirror master */
133 TIME_EFFECT tim_reflect{}; /* Timed -- Reflect */
134 TIME_EFFECT multishadow{}; /* Timed -- Multi-shadow */
135 TIME_EFFECT dustrobe{}; /* Timed -- Robe of dust */
139 #define COMMAND_ARG_REST_UNTIL_DONE -2 /*!<休憩コマンド引数 … 必要な分だけ回復 */
140 #define COMMAND_ARG_REST_FULL_HEALING -1 /*!<休憩コマンド引数 … HPとMPが全回復するまで */
141 GAME_TURN resting{}; /* Current counter for resting, if any */
143 int16_t chaos_patron{};
145 EnumClassFlagGroup<PlayerMutationType> muta{}; /*!< 突然変異 / mutations */
147 int16_t virtues[8]{};
148 Virtue vir_types[8]{};
150 TIME_EFFECT word_recall{}; /* Word of recall counter */
151 TIME_EFFECT alter_reality{}; /* Alter reality counter */
152 DUNGEON_IDX recall_dungeon{}; /* Dungeon set to be recalled */
154 ENERGY energy_need{}; /* Energy needed for next move */
155 ENERGY enchant_energy_need{}; /* Energy needed for next upkeep effect */
157 int16_t food{}; /*!< ゲーム中の滋養度の型定義 / Current nutrition */
160 * p_ptr->special_attackによるプレイヤーの攻撃状態の定義 / Bit flags for the "p_ptr->special_attack" variable. -LM-
162 * Note: The elemental and poison attacks should be managed using the
163 * function "set_ele_attack", in spell2.c. This provides for timeouts and
164 * prevents the player from getting more than one at a time.
166 BIT_FLAGS special_attack{};
168 /* プレイヤーの防御状態の定義 / Bit flags for the "p_ptr->special_defense" variable. -LM- */
169 BIT_FLAGS special_defense{};
170 byte action{}; /*!< プレイヤーが現在取っている常時行動のID / Currently action */
171 BIT_FLAGS spell_learned1{}; /* bit mask of spells learned */
172 BIT_FLAGS spell_learned2{}; /* bit mask of spells learned */
173 BIT_FLAGS spell_worked1{}; /* bit mask of spells tried and worked */
174 BIT_FLAGS spell_worked2{}; /* bit mask of spells tried and worked */
175 BIT_FLAGS spell_forgotten1{}; /* bit mask of spells learned but forgotten */
176 BIT_FLAGS spell_forgotten2{}; /* bit mask of spells learned but forgotten */
177 SPELL_IDX spell_order[64]{}; /* order spells learned/remembered/forgotten */
179 SUB_EXP spell_exp[64]{}; /* Proficiency of spells */
180 std::map<ItemKindType, std::array<SUB_EXP, 64>> weapon_exp{}; /* Proficiency of weapons */
181 std::map<ItemKindType, std::array<SUB_EXP, 64>> weapon_exp_max{}; /* Maximum proficiency of weapons */
182 std::map<PlayerSkillKindType, SUB_EXP> skill_exp{}; /* Proficiency of misc. skill */
184 ClassSpecificData class_specific_data;
186 int player_hp[PY_MAX_LEVEL]{};
187 std::string died_from{}; /* What killed the player */
188 std::string last_message = ""; /* Last message on death or retirement */
189 char history[4][60]{}; /* Textual "history" for the Player */
191 uint16_t panic_save{}; /* Panic save */
193 bool wait_report_score{}; /* Waiting to report score */
194 bool is_dead{}; /* Player is dead */
197 BIT_FLAGS change_floor_mode{}; /*!<フロア移行処理に関するフラグ / Mode flags for changing floor */
199 MONSTER_IDX riding{}; /* Riding on a monster of this index */
201 #define KNOW_STAT 0x01
202 #define KNOW_HPRATE 0x02
203 BIT_FLAGS8 knowledge{}; /* Knowledge about yourself */
204 BIT_FLAGS visit{}; /* Visited towns */
206 PlayerRaceType start_race{}; /* Race at birth */
207 BIT_FLAGS old_race1{}; /* Record of race changes */
208 BIT_FLAGS old_race2{}; /* Record of race changes */
209 int16_t old_realm{}; /* Record of realm changes */
211 int16_t pet_follow_distance{}; /* Length of the imaginary "leash" for pets */
212 BIT_FLAGS16 pet_extra_flags{}; /* Various flags for controling pets */
214 bool knows_daily_bounty{}; //!< 日替わり賞金首を知っているか否か
216 bool dtrap{}; /* Whether you are on trap-safe grids */
217 FLOOR_IDX floor_id{}; /* Current floor location */
219 bool autopick_autoregister{}; /* auto register is in-use or not */
221 byte feeling{}; /* Most recent dungeon feeling */
222 int32_t feeling_turn{}; /* The turn of the last dungeon feeling */
224 std::shared_ptr<ItemEntity[]> inventory_list{}; /* The player's inventory */
225 int16_t inven_cnt{}; /* Number of items in inventory */
226 int16_t equip_cnt{}; /* Number of items in equipment */
228 /*** Temporary fields ***/
230 bool select_ring_slot{};
232 bool playing{}; /* True if player is playing */
233 bool leaving{}; /* True if player is leaving */
235 bool monk_notify_aux{};
238 byte exit_bldg{}; /* Goal obtained in on_defeat_arena_monster? -KMW- */
240 bool leaving_dungeon{}; /* True if player is leaving the dungeon */
241 bool teleport_town{};
242 bool enter_dungeon{}; /* Just enter the dungeon */
244 IDX health_who{}; /* Health bar trackee */
246 MonsterRaceId monster_race_idx{}; /* Monster race trackee */
248 short tracking_bi_id{}; /* Object kind trackee */
250 int16_t new_spells{}; /* Number of spells available */
251 int16_t old_spells{};
253 int16_t old_food_aux{}; /* Old value of food */
255 bool old_cumber_armor{};
256 bool old_cumber_glove{};
257 bool old_heavy_wield[2]{};
258 bool old_heavy_shoot{};
259 bool old_icky_wield[2]{};
260 bool old_riding_wield[2]{};
261 bool old_riding_ryoute{};
263 int extra_blows[2]{};
265 POSITION old_lite{}; /* Old radius of lite (if any) */
267 bool cumber_armor{}; /* Mana draining armor */
268 bool cumber_glove{}; /* Mana draining gloves */
269 bool heavy_wield[2]{}; /* Heavy weapon */
270 bool is_icky_wield[2]{}; /* クラスにふさわしくない装備をしている / Icky weapon */
271 bool is_icky_riding_wield[2]{}; /* 乗馬中に乗馬にふさわしくない装備をしている / Riding weapon */
272 bool riding_ryoute{}; /* Riding weapon */
275 BIT_FLAGS easy_2weapon{};
276 BIT_FLAGS down_saving{};
278 POSITION cur_lite{}; /* Radius of lite (if any) */
280 int16_t stat_use[A_MAX]{}; /* Current modified stats */
281 int16_t stat_top[A_MAX]{}; /* Maximal modified stats */
286 int alignment{}; /* Good/evil/neutral */
289 DIRECTION fishing_dir{};
291 MONSTER_IDX pet_t_m_idx{};
292 MONSTER_IDX riding_t_m_idx{};
294 /*** Extracted fields ***/
296 int16_t running{}; /* Current counter for running, if any */
297 bool suppress_multi_reward{}; /*!< 複数レベルアップ時のパトロンからの報酬多重受け取りを防止 */
299 int16_t stat_add[A_MAX]{}; /* Modifiers to stat values */
300 int16_t stat_index[A_MAX]{}; /* Indexes into stat tables */
302 bool hack_mutation{};
304 bool level_up_message{};
306 BIT_FLAGS anti_magic{}; /* Anti-magic */
307 BIT_FLAGS anti_tele{}; /* Prevent teleportation */
309 EnumClassFlagGroup<CurseTraitType> cursed{}; /* Player is cursed */
310 EnumClassFlagGroup<CurseSpecialTraitType> cursed_special{}; /* Player is special type cursed */
312 bool can_swim{}; /* No damage falling */
313 BIT_FLAGS levitation{}; /* No damage falling */
314 BIT_FLAGS lite{}; /* Permanent light */
315 BIT_FLAGS free_act{}; /* Never paralyzed */
316 BIT_FLAGS see_inv{}; /* Can see invisible */
317 BIT_FLAGS regenerate{}; /* Regenerate hit pts */
318 BIT_FLAGS hold_exp{}; /* Resist exp draining */
320 BIT_FLAGS telepathy{}; /* Telepathy */
321 BIT_FLAGS esp_animal{};
322 BIT_FLAGS esp_undead{};
323 BIT_FLAGS esp_demon{};
325 BIT_FLAGS esp_troll{};
326 BIT_FLAGS esp_giant{};
327 BIT_FLAGS esp_dragon{};
328 BIT_FLAGS esp_human{};
329 BIT_FLAGS esp_evil{};
330 BIT_FLAGS esp_good{};
331 BIT_FLAGS esp_nonliving{};
332 BIT_FLAGS esp_unique{};
334 BIT_FLAGS slow_digest{}; /* Slower digestion */
335 BIT_FLAGS bless_blade{}; //!< 祝福された装備をしている / Blessed by inventory items
336 BIT_FLAGS xtra_might{}; /* Extra might bow */
337 BIT_FLAGS impact{}; //!< クリティカル率を上げる装備をしている / Critical blows
338 BIT_FLAGS earthquake{}; //!< 地震を起こす装備をしている / Earthquake blows
339 BIT_FLAGS dec_mana{};
340 BIT_FLAGS easy_spell{};
341 BIT_FLAGS heavy_spell{};
343 BIT_FLAGS mighty_throw{};
344 BIT_FLAGS see_nocto{}; /* Noctovision */
345 bool invoking_midnight_curse{};
347 DICE_NUMBER to_dd[2]{}; /* Extra dice/sides */
350 HIT_PROB dis_to_h[2]{}; /*!< 判明している現在の表記上の近接武器命中修正値 / Known bonus to hit (wield) */
351 HIT_PROB dis_to_h_b{}; /*!< 判明している現在の表記上の射撃武器命中修正値 / Known bonus to hit (bow) */
352 int dis_to_d[2]{}; /*!< 判明している現在の表記上の近接武器ダメージ修正値 / Known bonus to dam (wield) */
353 ARMOUR_CLASS dis_to_a{}; /*!< 判明している現在の表記上の装備AC修正値 / Known bonus to ac */
354 ARMOUR_CLASS dis_ac{}; /*!< 判明している現在の表記上の装備AC基礎値 / Known base ac */
356 int16_t to_h[2]{}; /* Bonus to hit (wield) */
357 int16_t to_h_b{}; /* Bonus to hit (bow) */
358 int16_t to_h_m{}; /* Bonus to hit (misc) */
359 int16_t to_d[2]{}; /* Bonus to dam (wield) */
360 int16_t to_d_m{}; /* Bonus to dam (misc) */
361 ARMOUR_CLASS to_a{}; /* Bonus to ac */
363 int16_t to_m_chance{}; /* Minusses to cast chance */
367 ARMOUR_CLASS ac{}; /*!< 装備無しの基本AC / Base ac */
369 ACTION_SKILL_POWER see_infra{}; /*!< 赤外線視能力の強さ /Infravision range */
370 ACTION_SKILL_POWER skill_dis{}; /*!< 行動技能値:解除能力 / Skill: Disarming */
371 ACTION_SKILL_POWER skill_dev{}; /*!< 行動技能値:魔道具使用 / Skill: Magic Devices */
372 ACTION_SKILL_POWER skill_sav{}; /*!< 行動技能値:魔法防御 / Skill: Saving throw */
373 ACTION_SKILL_POWER skill_stl{}; /*!< 行動技能値:隠密 / Skill: Stealth factor */
376 * 行動技能値:知覚 / Skill: Searching ability
377 * この値はsearch()による地形の隠し要素発見処理などで混乱、盲目、幻覚、無光源などの
378 * 状態異常がない限り、難易度修正などがないままそのままパーセンテージ値として使われる。
379 * 100以上ならば必ず全てのトラップなどを見つけることが出来る。
381 ACTION_SKILL_POWER skill_srh{};
383 ACTION_SKILL_POWER skill_fos{}; /*!< 行動技能値:探索 / Skill: Searching frequency */
384 ACTION_SKILL_POWER skill_thn{}; /*!< 行動技能値:打撃命中能力 / Skill: To hit (normal) */
385 ACTION_SKILL_POWER skill_thb{}; /*!< 行動技能値:射撃命中能力 / Skill: To hit (shooting) */
386 ACTION_SKILL_POWER skill_tht{}; /*!< 行動技能値:投射命中能力 / Skill: To hit (throwing) */
387 ACTION_SKILL_POWER skill_dig{}; /*!< 行動技能値:掘削 / Skill: Digging */
389 int16_t num_blow[2]{}; /* Number of blows */
390 int16_t num_fire{}; /* Number of shots */
392 byte tval_xtra{}; /* (Unused)Correct xtra tval */
393 ItemKindType tval_ammo{}; /* Correct ammo tval */
395 int16_t pspeed{}; /*!< 現在の速度 / Current speed */
397 ENERGY energy_use{}; /*!< 直近のターンに消費したエネルギー / Energy use this turn */
399 POSITION y{}; /*!< ダンジョンの現在Y座標 / Player location in dungeon */
400 POSITION x{}; /*!< ダンジョンの現在X座標 / Player location in dungeon */
401 GAME_TEXT name[32]{}; /*!< 現在のプレイヤー名 / Current player's character name */
402 char base_name[32]{}; /*!< Stripped version of "player_name" */
404 std::shared_ptr<TimedEffects> effects() const;
405 bool is_fully_healthy() const;
406 std::string decrease_ability_random();
407 std::string decrease_ability_all();
408 Pos2D get_position() const;
409 bool is_located_at_running_destination() const;
410 bool is_located_at(const Pos2D &pos) const;
413 std::shared_ptr<TimedEffects> timed_effects;
416 extern PlayerType *p_ptr;