OSDN Git Service

cc1b031a3d84420b9af5118bf6b613aeb3dcdc4b
[hengbandforosx/hengbandosx.git] / src / player / player-skill.h
1 #pragma once
2
3 #include "system/angband.h"
4
5 #include "util/enum-range.h"
6
7 #include <array>
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 enum skill_idx {
13     SKILL_MARTIAL_ARTS = 0,
14     SKILL_TWO_WEAPON = 1,
15     SKILL_RIDING = 2,
16     SKILL_SHIELD = 3,
17     SKILL_MAX = 4,
18 };
19
20 constexpr auto PLAYER_SKILL_KIND_TYPE_RANGE = EnumRange(SKILL_MARTIAL_ARTS, SKILL_SHIELD);
21
22 /* Proficiency level */
23 #define EXP_LEVEL_UNSKILLED 0
24 #define EXP_LEVEL_BEGINNER 1
25 #define EXP_LEVEL_SKILLED 2
26 #define EXP_LEVEL_EXPERT 3
27 #define EXP_LEVEL_MASTER 4
28
29 extern const concptr exp_level_str[5];
30
31 enum class ItemKindType : short;
32
33 /*
34  * Information about "skill"
35  */
36 typedef struct skill_table {
37     std::map<ItemKindType, std::array<SUB_EXP, 64>> w_start{}; /* start weapon exp */
38     std::map<ItemKindType, std::array<SUB_EXP, 64>> w_max{}; /* max weapon exp */
39     std::map<skill_idx, SUB_EXP> s_start{}; /* start skill */
40     std::map<skill_idx, SUB_EXP> s_max{}; /* max skill */
41 } skill_table;
42
43 extern std::vector<skill_table> s_info;
44
45 struct monster_race;
46 struct object_type;
47 struct player_type;
48
49 class PlayerSkill {
50 public:
51     PlayerSkill(player_type *player_ptr);
52
53     static SUB_EXP weapon_exp_at(int level);
54     static SUB_EXP spell_exp_at(int level);
55     static bool valid_weapon_exp(int weapon_exp);
56     static int weapon_exp_level(int weapon_exp);
57     static int riding_exp_level(int riding_exp);
58     static int spell_exp_level(int spell_exp);
59
60     void gain_melee_weapon_exp(const object_type *o_ptr);
61     void gain_range_weapon_exp(const object_type *o_ptr);
62     void gain_martial_arts_skill_exp();
63     void gain_two_weapon_skill_exp();
64     void gain_riding_skill_exp_on_melee_attack(const monster_race *r_ptr);
65     void gain_riding_skill_exp_on_range_attack();
66     void gain_riding_skill_exp_on_fall_off_check(HIT_POINT dam);
67     void gain_spell_skill_exp(int realm, int spell_idx);
68     void gain_continuous_spell_skill_exp(int realm, int spell_idx);
69     int gain_spell_skill_exp_over_learning(int spell_idx);
70
71     EXP exp_of_spell(int realm, int spell_idx) const;
72
73 private:
74     player_type *player_ptr;
75 };