OSDN Git Service

Merge branch 'master' of https://github.com/hengband/hengband
[hengbandforosx/hengbandosx.git] / src / player / player-realm.h
1 #pragma once
2
3 #include "realm/realm-types.h"
4 #include "system/angband.h"
5 #include "util/flag-group.h"
6 #include <cstdint>
7 #include <optional>
8 #include <string>
9 #include <string_view>
10 #include <vector>
11
12 using RealmChoices = EnumClassFlagGroup<RealmType>;
13
14 enum class ItemKindType : short;
15 enum class PlayerClassType : short;
16 class PlayerType;
17 class LocalizedString;
18 struct magic_type;
19 class PlayerRealm {
20 public:
21     PlayerRealm(PlayerType *player_ptr);
22
23     static const LocalizedString &get_name(RealmType realm);
24     static std::string_view get_explanation(RealmType realm);
25     static std::string_view get_subinfo(RealmType realm);
26     static const magic_type &get_spell_info(RealmType realm, int spell_id, std::optional<PlayerClassType> pclass = std::nullopt);
27     static const std::string &get_spell_name(RealmType realm, int spell_id);
28     static const std::string &get_spell_description(RealmType realm, int spell_id);
29     static ItemKindType get_book(RealmType realm);
30     static RealmChoices get_realm1_choices(PlayerClassType pclass);
31     static RealmChoices get_realm2_choices(PlayerClassType pclass);
32     static RealmType get_realm_of_book(ItemKindType tval);
33     static bool is_magic(RealmType realm);
34     static bool is_technic(RealmType realm);
35
36     class Realm {
37     public:
38         Realm(RealmType realm);
39         const LocalizedString &get_name() const;
40         std::string_view get_explanation() const;
41         std::string_view get_subinfo() const;
42         const magic_type &get_spell_info(int spell_id) const;
43         const std::string &get_spell_name(int spell_id) const;
44         const std::string &get_spell_description(int spell_id) const;
45         ItemKindType get_book() const;
46         bool is_available() const;
47         bool is_good_attribute() const;
48         bool equals(RealmType realm) const;
49         RealmType to_enum() const;
50
51     private:
52         RealmType realm_;
53     };
54
55     const Realm &realm1() const;
56     const Realm &realm2() const;
57     bool is_realm_hex() const;
58     void reset();
59     void set(RealmType realm1, RealmType realm2 = RealmType::NONE);
60
61 private:
62     void set_(RealmType realm1, RealmType realm2);
63
64     PlayerType *player_ptr;
65     Realm realm1_;
66     Realm realm2_;
67 };