OSDN Git Service

Merge branch 'master' of https://github.com/hengband/hengband
[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 class PlayerSkillKindType {
13     MARTIAL_ARTS = 0,
14     TWO_WEAPON = 1,
15     RIDING = 2,
16     SHIELD = 3,
17     MAX,
18 };
19
20 enum class PlayerSkillRank {
21     UNSKILLED = 0,
22     BEGINNER = 1,
23     SKILLED = 2,
24     EXPERT = 3,
25     MASTER = 4,
26 };
27
28 constexpr auto MAX_SKILLS = 10;
29 constexpr auto PLAYER_SKILL_KIND_TYPE_RANGE = EnumRange(PlayerSkillKindType::MARTIAL_ARTS, PlayerSkillKindType::MAX);
30
31 enum class ItemKindType : short;
32 enum class RealmType;
33
34 /*
35  * Information about "skill"
36  */
37 struct skill_table {
38     std::map<ItemKindType, std::array<SUB_EXP, 64>> w_start{}; /* start weapon exp */
39     std::map<ItemKindType, std::array<SUB_EXP, 64>> w_max{}; /* max weapon exp */
40     std::map<PlayerSkillKindType, SUB_EXP> s_start{}; /* start skill */
41     std::map<PlayerSkillKindType, SUB_EXP> s_max{}; /* max skill */
42 };
43
44 extern std::vector<skill_table> class_skills_info;
45
46 class MonsterRaceInfo;
47 class ItemEntity;
48 class PlayerType;
49
50 class PlayerSkill {
51 public:
52     PlayerSkill(PlayerType *player_ptr);
53
54     static SUB_EXP weapon_exp_at(PlayerSkillRank rank);
55     static SUB_EXP spell_exp_at(PlayerSkillRank rank);
56     static bool valid_weapon_exp(int weapon_exp);
57     static PlayerSkillRank weapon_skill_rank(int weapon_exp);
58     static PlayerSkillRank riding_skill_rank(int riding_exp);
59     static PlayerSkillRank spell_skill_rank(int spell_exp);
60     static concptr skill_name(PlayerSkillKindType skill);
61     static concptr skill_rank_str(PlayerSkillRank rank);
62
63     void gain_melee_weapon_exp(const ItemEntity *o_ptr);
64     void gain_range_weapon_exp(const ItemEntity *o_ptr);
65     void gain_martial_arts_skill_exp();
66     void gain_two_weapon_skill_exp();
67     void gain_riding_skill_exp_on_melee_attack(const MonsterRaceInfo *r_ptr);
68     void gain_riding_skill_exp_on_range_attack();
69     void gain_riding_skill_exp_on_fall_off_check(int dam);
70     void gain_spell_skill_exp(RealmType realm, int spell_idx);
71     void gain_continuous_spell_skill_exp(RealmType realm, int spell_idx);
72     PlayerSkillRank gain_spell_skill_exp_over_learning(int spell_idx);
73
74     EXP exp_of_spell(RealmType realm, int spell_idx) const;
75
76     void apply_special_weapon_skill_max_values();
77     void limit_weapon_skills_by_max_value();
78
79 private:
80     PlayerType *player_ptr;
81 };