OSDN Git Service

[Refactor] #935 Removed inclusion for player-ability-types.h from player-status.h
[hengbandforosx/hengbandosx.git] / src / system / player-type-definition.h
1 #pragma once
2
3 #include "player-ability/player-abillity-types.h"
4 #include "player/player-race-types.h"
5 #include "player/player-classes-types.h"
6 #include "player/player-personalities-types.h"
7 #include "system/angband.h"
8 #include "system/system-variables.h"
9
10 #define MAX_SKILLS 10
11 #define MAX_MANE 16
12
13 enum class MUTA;
14 enum class RF_ABILITY;
15
16 typedef struct floor_type floor_type;
17 typedef struct object_type object_type;
18 typedef struct player_type {
19     int player_uid{};
20     int player_euid{};
21     int player_egid{};
22
23     floor_type *current_floor_ptr{};
24     POSITION oldpy{}; /* Previous player location -KMW- */
25     POSITION oldpx{}; /* Previous player location -KMW- */
26
27     SEX_IDX psex{}; /* Sex index */
28     player_race_type prace{}; /* Race index */
29     player_class_type pclass{}; /* Class index */
30     player_personality_type pseikaku{}; /* Seikaku index */
31     REALM_IDX realm1{}; /* First magic realm */
32     REALM_IDX realm2{}; /* Second magic realm */
33     REALM_IDX element{}; //!< 元素使い領域番号 / Elementalist system index
34     player_personality_type oops{}; /* Unused */
35
36     DICE_SID hitdie{}; /* Hit dice (sides) */
37     u16b expfact{}; /* Experience factor
38                      * Note: was byte, causing overflow for Amberite
39                      * characters (such as Amberite Paladins)
40                      */
41
42     s16b age{}; /* Characters age */
43     s16b ht{}; /* Height */
44     s16b wt{}; /* Weight */
45     s16b sc{}; /* Social Class */
46
47     PRICE au{}; /* Current Gold */
48
49     EXP max_max_exp{}; /* Max max experience (only to calculate score) */
50     EXP max_exp{}; /* Max experience */
51     EXP exp{}; /* Cur experience */
52     u32b exp_frac{}; /* Cur exp frac (times 2^16) */
53
54     PLAYER_LEVEL lev{}; /* Level */
55
56     TOWN_IDX town_num{}; /* Current town number */
57     s16b arena_number{}; /* monster number in on_defeat_arena_monster -KMW- */
58     bool phase_out{}; /*!< フェイズアウト状態(闘技場観戦状態などに利用、NPCの処理の対象にならず自身もほとんどの行動ができない) */
59
60     DUNGEON_IDX dungeon_idx{}; /* current dungeon index */
61     POSITION wilderness_x{}; /* Coordinates in the wilderness */
62     POSITION wilderness_y{};
63     bool wild_mode{};
64
65     HIT_POINT mhp{}; /* Max hit pts */
66     HIT_POINT chp{}; /* Cur hit pts */
67     u32b chp_frac{}; /* Cur hit frac (times 2^16) */
68     PERCENTAGE mutant_regenerate_mod{};
69
70     MANA_POINT msp{}; /* Max mana pts */
71     MANA_POINT csp{}; /* Cur mana pts */
72     u32b csp_frac{}; /* Cur mana frac (times 2^16) */
73
74     s16b max_plv{}; /* Max Player Level */
75
76     BASE_STATUS stat_max[A_MAX]{}; /* Current "maximal" stat values */
77     BASE_STATUS stat_max_max[A_MAX]{}; /* Maximal "maximal" stat values */
78     BASE_STATUS stat_cur[A_MAX]{}; /* Current "natural" stat values */
79
80     s16b learned_spells{};
81     s16b add_spells{};
82
83     u32b count{};
84
85     TIME_EFFECT fast{}; /* Timed -- Fast */
86     TIME_EFFECT slow{}; /* Timed -- Slow */
87     TIME_EFFECT blind{}; /* Timed -- Blindness */
88     TIME_EFFECT paralyzed{}; /* Timed -- Paralysis */
89     TIME_EFFECT confused{}; /* Timed -- Confusion */
90     TIME_EFFECT afraid{}; /* Timed -- Fear */
91     TIME_EFFECT image{}; /* Timed -- Hallucination */
92     TIME_EFFECT poisoned{}; /* Timed -- Poisoned */
93     TIME_EFFECT cut{}; /* Timed -- Cut */
94     TIME_EFFECT stun{}; /* Timed -- Stun */
95
96     TIME_EFFECT protevil{}; /* Timed -- Protection */
97     TIME_EFFECT invuln{}; /* Timed -- Invulnerable */
98     TIME_EFFECT ult_res{}; /* Timed -- Ultimate Resistance */
99     TIME_EFFECT hero{}; /* Timed -- Heroism */
100     TIME_EFFECT shero{}; /* Timed -- Super Heroism */
101     TIME_EFFECT shield{}; /* Timed -- Shield Spell */
102     TIME_EFFECT blessed{}; /* Timed -- Blessed */
103     TIME_EFFECT tim_invis{}; /* Timed -- See Invisible */
104     TIME_EFFECT tim_infra{}; /* Timed -- Infra Vision */
105     TIME_EFFECT tsuyoshi{}; /* Timed -- Tsuyoshi Special */
106     TIME_EFFECT ele_attack{}; /* Timed -- Elemental Attack */
107     TIME_EFFECT ele_immune{}; /* Timed -- Elemental Immune */
108
109     TIME_EFFECT oppose_acid{}; /* Timed -- oppose acid */
110     TIME_EFFECT oppose_elec{}; /* Timed -- oppose lightning */
111     TIME_EFFECT oppose_fire{}; /* Timed -- oppose heat */
112     TIME_EFFECT oppose_cold{}; /* Timed -- oppose cold */
113     TIME_EFFECT oppose_pois{}; /* Timed -- oppose poison */
114
115     TIME_EFFECT tim_esp{}; /* Timed ESP */
116     TIME_EFFECT wraith_form{}; /* Timed wraithform */
117
118     TIME_EFFECT resist_magic{}; /* Timed Resist Magic (later) */
119     TIME_EFFECT tim_regen{};
120     TIME_EFFECT tim_pass_wall{};
121     TIME_EFFECT tim_stealth{};
122     TIME_EFFECT tim_levitation{};
123     TIME_EFFECT tim_sh_touki{};
124     TIME_EFFECT lightspeed{};
125     TIME_EFFECT tsubureru{};
126     TIME_EFFECT magicdef{};
127     TIME_EFFECT tim_res_nether{}; /* Timed -- Nether resistance */
128     TIME_EFFECT tim_res_time{}; /* Timed -- Time resistance */
129     MIMIC_RACE_IDX mimic_form{};
130     TIME_EFFECT tim_mimic{};
131     TIME_EFFECT tim_sh_fire{};
132     TIME_EFFECT tim_sh_holy{};
133     TIME_EFFECT tim_eyeeye{};
134
135     /* for mirror master */
136     TIME_EFFECT tim_reflect{}; /* Timed -- Reflect */
137     TIME_EFFECT multishadow{}; /* Timed -- Multi-shadow */
138     TIME_EFFECT dustrobe{}; /* Timed -- Robe of dust */
139
140     bool timewalk{};
141
142 #define COMMAND_ARG_REST_UNTIL_DONE -2 /*!<休憩コマンド引数 … 必要な分だけ回復 */
143 #define COMMAND_ARG_REST_FULL_HEALING -1 /*!<休憩コマンド引数 … HPとMPが全回復するまで */
144     GAME_TURN resting{}; /* Current counter for resting, if any */
145
146     PATRON_IDX chaos_patron{};
147
148     EnumClassFlagGroup<MUTA> muta{}; /*!< 突然変異 / mutations */
149
150     s16b virtues[8]{};
151     s16b vir_types[8]{};
152
153     TIME_EFFECT word_recall{}; /* Word of recall counter */
154     TIME_EFFECT alter_reality{}; /* Alter reality counter */
155     DUNGEON_IDX recall_dungeon{}; /* Dungeon set to be recalled */
156
157     ENERGY energy_need{}; /* Energy needed for next move */
158     ENERGY enchant_energy_need{}; /* Energy needed for next upkeep effect        */
159
160     FEED food{}; /* Current nutrition */
161
162     /*
163      * p_ptr->special_attackによるプレイヤーの攻撃状態の定義 / Bit flags for the "p_ptr->special_attack" variable. -LM-
164      *
165      * Note:  The elemental and poison attacks should be managed using the
166      * function "set_ele_attack", in spell2.c.  This provides for timeouts and
167      * prevents the player from getting more than one at a time.
168      */
169     BIT_FLAGS special_attack{};
170
171     /* プレイヤーの防御状態の定義 / Bit flags for the "p_ptr->special_defense" variable. -LM- */
172     BIT_FLAGS special_defense{};
173     ACTION_IDX action{}; /* Currently action */
174     BIT_FLAGS spell_learned1{}; /* bit mask of spells learned */
175     BIT_FLAGS spell_learned2{}; /* bit mask of spells learned */
176     BIT_FLAGS spell_worked1{}; /* bit mask of spells tried and worked */
177     BIT_FLAGS spell_worked2{}; /* bit mask of spells tried and worked */
178     BIT_FLAGS spell_forgotten1{}; /* bit mask of spells learned but forgotten */
179     BIT_FLAGS spell_forgotten2{}; /* bit mask of spells learned but forgotten */
180     SPELL_IDX spell_order[64]{}; /* order spells learned/remembered/forgotten */
181
182     SUB_EXP spell_exp[64]{}; /* Proficiency of spells */
183     SUB_EXP weapon_exp[5][64]{}; /* Proficiency of weapons */
184     SUB_EXP skill_exp[MAX_SKILLS]{}; /* Proficiency of misc. skill */
185
186     MAGIC_NUM1 magic_num1[MAX_SPELLS]{}; /*!< Array for non-spellbook type magic */
187     MAGIC_NUM2 magic_num2[MAX_SPELLS]{}; /*!< 魔道具術師の取り込み済魔道具使用回数 / Flags for non-spellbook type magics */
188
189     RF_ABILITY mane_spell[MAX_MANE]{};
190     HIT_POINT mane_dam[MAX_MANE]{};
191     s16b mane_num{};
192     bool new_mane{};
193
194 #define CONCENT_RADAR_THRESHOLD 2
195 #define CONCENT_TELE_THRESHOLD 5
196     s16b concent{}; /* Sniper's concentration level */
197
198     HIT_POINT player_hp[PY_MAX_LEVEL]{};
199     char died_from[MAX_MONSTER_NAME]{}; /* What killed the player */
200     concptr last_message{}; /* Last message on death or retirement */
201     char history[4][60]{}; /* Textual "history" for the Player */
202
203     u16b panic_save{}; /* Panic save */
204
205     bool wait_report_score{}; /* Waiting to report score */
206     bool is_dead{}; /* Player is dead */
207     bool now_damaged{};
208     bool ambush_flag{};
209     BIT_FLAGS change_floor_mode{}; /*!<フロア移行処理に関するフラグ / Mode flags for changing floor */
210
211     bool reset_concent{}; /* Concentration reset flag */
212
213     MONSTER_IDX riding{}; /* Riding on a monster of this index */
214
215 #define KNOW_STAT 0x01
216 #define KNOW_HPRATE 0x02
217     BIT_FLAGS8 knowledge{}; /* Knowledge about yourself */
218     BIT_FLAGS visit{}; /* Visited towns */
219
220     player_race_type start_race{}; /* Race at birth */
221     BIT_FLAGS old_race1{}; /* Record of race changes */
222     BIT_FLAGS old_race2{}; /* Record of race changes */
223     s16b old_realm{}; /* Record of realm changes */
224
225     s16b pet_follow_distance{}; /* Length of the imaginary "leash" for pets */
226     s16b pet_extra_flags{}; /* Various flags for controling pets */
227
228     MONSTER_IDX today_mon{}; //!< 日替わり賞金首を知っていればそのモンスターID、知らなければ 0
229
230     bool dtrap{}; /* Whether you are on trap-safe grids */
231     FLOOR_IDX floor_id{}; /* Current floor location */
232
233     bool autopick_autoregister{}; /* auto register is in-use or not */
234
235     byte feeling{}; /* Most recent dungeon feeling */
236     s32b feeling_turn{}; /* The turn of the last dungeon feeling */
237
238     object_type *inventory_list{}; /* The player's inventory */
239     s16b inven_cnt{}; /* Number of items in inventory */
240     s16b equip_cnt{}; /* Number of items in equipment */
241
242     /*** Temporary fields ***/
243
244     bool select_ring_slot{};
245
246     bool playing{}; /* True if player is playing */
247     bool leaving{}; /* True if player is leaving */
248
249     bool monk_notify_aux{};
250
251     byte leave_bldg{};
252     byte exit_bldg{}; /* Goal obtained in on_defeat_arena_monster? -KMW- */
253
254     bool leaving_dungeon{}; /* True if player is leaving the dungeon */
255     bool teleport_town{};
256     bool enter_dungeon{}; /* Just enter the dungeon */
257
258     IDX health_who{}; /* Health bar trackee */
259
260     MONRACE_IDX monster_race_idx{}; /* Monster race trackee */
261
262     KIND_OBJECT_IDX object_kind_idx{}; /* Object kind trackee */
263
264     s16b new_spells{}; /* Number of spells available */
265     s16b old_spells{};
266
267     s16b old_food_aux{}; /* Old value of food */
268
269     bool old_cumber_armor{};
270     bool old_cumber_glove{};
271     bool old_heavy_wield[2]{};
272     bool old_heavy_shoot{};
273     bool old_icky_wield[2]{};
274     bool old_riding_wield[2]{};
275     bool old_riding_ryoute{};
276     bool old_monlite{};
277     int extra_blows[2]{};
278
279     POSITION old_lite{}; /* Old radius of lite (if any) */
280
281     bool cumber_armor{}; /* Mana draining armor */
282     bool cumber_glove{}; /* Mana draining gloves */
283     bool heavy_wield[2]{}; /* Heavy weapon */
284     bool icky_wield[2]{}; /* Icky weapon */
285     bool riding_wield[2]{}; /* Riding weapon */
286     bool riding_ryoute{}; /* Riding weapon */
287     bool monlite{};
288     BIT_FLAGS yoiyami{};
289     BIT_FLAGS easy_2weapon{};
290     BIT_FLAGS down_saving{};
291
292     POSITION cur_lite{}; /* Radius of lite (if any) */
293
294     BIT_FLAGS update{}; /* Pending Updates */
295     BIT_FLAGS redraw{}; /* Normal Redraws */
296     BIT_FLAGS window_flags{}; /* Window Redraws */
297     s16b stat_use[A_MAX]{}; /* Current modified stats */
298     s16b stat_top[A_MAX]{}; /* Maximal modified stats */
299
300     bool sutemi{};
301     bool counter{};
302
303     ALIGNMENT align{}; /* Good/evil/neutral */
304     POSITION run_py{};
305     POSITION run_px{};
306     DIRECTION fishing_dir{};
307
308     MONSTER_IDX pet_t_m_idx{};
309     MONSTER_IDX riding_t_m_idx{};
310
311     /*** Extracted fields ***/
312
313     s16b running{}; /* Current counter for running, if any */
314     bool suppress_multi_reward{}; /*!< 複数レベルアップ時のパトロンからの報酬多重受け取りを防止 */
315
316     s16b stat_add[A_MAX]{}; /* Modifiers to stat values */
317     s16b stat_index[A_MAX]{}; /* Indexes into stat tables */
318
319     bool hack_mutation{};
320     bool is_fired{};
321     bool level_up_message{};
322
323     BIT_FLAGS anti_magic{}; /* Anti-magic */
324     BIT_FLAGS anti_tele{}; /* Prevent teleportation */
325
326     BIT_FLAGS cursed{}; /* Player is cursed */
327
328     bool can_swim{}; /* No damage falling */
329     BIT_FLAGS levitation{}; /* No damage falling */
330     BIT_FLAGS lite{}; /* Permanent light */
331     BIT_FLAGS free_act{}; /* Never paralyzed */
332     BIT_FLAGS see_inv{}; /* Can see invisible */
333     BIT_FLAGS regenerate{}; /* Regenerate hit pts */
334     BIT_FLAGS hold_exp{}; /* Resist exp draining */
335
336     BIT_FLAGS telepathy{}; /* Telepathy */
337     BIT_FLAGS esp_animal{};
338     BIT_FLAGS esp_undead{};
339     BIT_FLAGS esp_demon{};
340     BIT_FLAGS esp_orc{};
341     BIT_FLAGS esp_troll{};
342     BIT_FLAGS esp_giant{};
343     BIT_FLAGS esp_dragon{};
344     BIT_FLAGS esp_human{};
345     BIT_FLAGS esp_evil{};
346     BIT_FLAGS esp_good{};
347     BIT_FLAGS esp_nonliving{};
348     BIT_FLAGS esp_unique{};
349
350     BIT_FLAGS slow_digest{}; /* Slower digestion */
351     BIT_FLAGS bless_blade{}; //!< 祝福された装備をしている / Blessed by inventory items
352     BIT_FLAGS xtra_might{}; /* Extra might bow */
353     BIT_FLAGS impact{}; //!< クリティカル率を上げる装備をしている / Critical blows
354     BIT_FLAGS earthquake{}; //!< 地震を起こす装備をしている / Earthquake blows
355     BIT_FLAGS dec_mana{};
356     BIT_FLAGS easy_spell{};
357     BIT_FLAGS heavy_spell{};
358     BIT_FLAGS warning{};
359     BIT_FLAGS mighty_throw{};
360     BIT_FLAGS see_nocto{}; /* Noctovision */
361     bool invoking_midnight_curse{};
362
363     DICE_NUMBER to_dd[2]{}; /* Extra dice/sides */
364     DICE_SID to_ds[2]{};
365
366     HIT_PROB dis_to_h[2]{}; /*!< 判明している現在の表記上の近接武器命中修正値 /  Known bonus to hit (wield) */
367     HIT_PROB dis_to_h_b{}; /*!< 判明している現在の表記上の射撃武器命中修正値 / Known bonus to hit (bow) */
368     HIT_POINT dis_to_d[2]{}; /*!< 判明している現在の表記上の近接武器ダメージ修正値 / Known bonus to dam (wield) */
369     ARMOUR_CLASS dis_to_a{}; /*!< 判明している現在の表記上の装備AC修正値 / Known bonus to ac */
370     ARMOUR_CLASS dis_ac{}; /*!< 判明している現在の表記上の装備AC基礎値 / Known base ac */
371
372     s16b to_h[2]{}; /* Bonus to hit (wield) */
373     s16b to_h_b{}; /* Bonus to hit (bow) */
374     s16b to_h_m{}; /* Bonus to hit (misc) */
375     s16b to_d[2]{}; /* Bonus to dam (wield) */
376     s16b to_d_m{}; /* Bonus to dam (misc) */
377     ARMOUR_CLASS to_a{}; /* Bonus to ac */
378
379     s16b to_m_chance{}; /* Minusses to cast chance */
380
381     bool no_flowed{};
382
383     ARMOUR_CLASS ac{}; /*!< 装備無しの基本AC / Base ac */
384
385     ACTION_SKILL_POWER see_infra{}; /*!< 赤外線視能力の強さ /Infravision range */
386     ACTION_SKILL_POWER skill_dis{}; /*!< 行動技能値:解除能力 / Skill: Disarming */
387     ACTION_SKILL_POWER skill_dev{}; /*!< 行動技能値:魔道具使用 / Skill: Magic Devices */
388     ACTION_SKILL_POWER skill_sav{}; /*!< 行動技能値:魔法防御 / Skill: Saving throw */
389     ACTION_SKILL_POWER skill_stl{}; /*!< 行動技能値:隠密 / Skill: Stealth factor */
390
391     /*!
392      * 行動技能値:知覚 / Skill: Searching ability
393      * この値はsearch()による地形の隠し要素発見処理などで混乱、盲目、幻覚、無光源などの
394      * 状態異常がない限り、難易度修正などがないままそのままパーセンテージ値として使われる。
395      * 100以上ならば必ず全てのトラップなどを見つけることが出来る。
396      */
397     ACTION_SKILL_POWER skill_srh{};
398
399     ACTION_SKILL_POWER skill_fos{}; /*!< 行動技能値:探索 / Skill: Searching frequency */
400     ACTION_SKILL_POWER skill_thn{}; /*!< 行動技能値:打撃命中能力 / Skill: To hit (normal) */
401     ACTION_SKILL_POWER skill_thb{}; /*!< 行動技能値:射撃命中能力 / Skill: To hit (shooting) */
402     ACTION_SKILL_POWER skill_tht{}; /*!< 行動技能値:投射命中能力 / Skill: To hit (throwing) */
403     ACTION_SKILL_POWER skill_dig{}; /*!< 行動技能値:掘削 / Skill: Digging */
404
405     s16b num_blow[2]{}; /* Number of blows */
406     s16b num_fire{}; /* Number of shots */
407
408     byte tval_xtra{}; /* (Unused)Correct xtra tval */
409     byte tval_ammo{}; /* Correct ammo tval */
410
411     s16b pspeed{}; /*!< 現在の速度 / Current speed */
412
413     ENERGY energy_use{}; /*!< 直近のターンに消費したエネルギー / Energy use this turn */
414
415     POSITION y{}; /*!< ダンジョンの現在Y座標 / Player location in dungeon */
416     POSITION x{}; /*!< ダンジョンの現在X座標 / Player location in dungeon */
417     GAME_TEXT name[32]{}; /*!< 現在のプレイヤー名 / Current player's character name */
418     char base_name[32]{}; /*!< Stripped version of "player_name" */
419 } player_type;
420
421 extern player_type *p_ptr;